3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-19 10:29:30 +01:00
pbot/applets/ty.py
Pragmatic Software 7b9971294a Add Ty applet
2022-04-06 09:09:20 -07:00

17 lines
406 B
Python
Executable File
Vendored

#!/usr/bin/env python3
import sys
import subprocess
url = 'https://based.lol/run.ty'
if len(sys.argv) <= 1:
print('Usage: ty` <code> [-stdin=<input>]')
sys.exit(0)
cmd = ' '.join(sys.argv[1:]).replace('\\n', '\n')
[code, *input] = cmd.split('-stdin=')
print(subprocess.run(['curl', url, '-F', f'code={code}', '-F', f'input={"".join(input)}'], text=True, capture_output=True).stdout.rstrip())