3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-16 08:59:34 +01:00
pbot/applets/ty.py

23 lines
470 B
Python
Raw Normal View History

2022-04-06 18:09:20 +02:00
#!/usr/bin/env python3
import sys
import subprocess
url = 'https://based.lol/run.ty'
if len(sys.argv) <= 1:
2022-04-08 18:10:07 +02:00
print('usage: ty` <code> [-stdin=<input>]')
2022-04-06 18:09:20 +02:00
sys.exit(0)
cmd = ' '.join(sys.argv[1:]).replace('\\n', '\n')
[code, *input] = cmd.split('-stdin=')
2022-04-08 18:10:07 +02:00
print(
subprocess.run([
'curl', url,
'--data-urlencode', f'code={code}',
'--data-urlencode', f'input={"".join(input)}'
], text=True, capture_output=True).stdout.rstrip()
)