stdin2discord: add verbose logging on query failure. fix logic for long messages

This commit is contained in:
user2 2024-07-11 15:37:12 +03:00
parent ec8636e153
commit a5b334279d

View File

@ -11,12 +11,17 @@ def send(_msg: str):
data=f'content=```diff\n{requests.utils.quote(_msg)}```'.encode('utf-8'),
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
)
r.raise_for_status()
try:
r.raise_for_status()
except Exception:
print(r.text)
raise
msg = ''
for line in sys.stdin:
if len(msg + line) >= 2000:
if len(msg + line) >= 1900:
send(msg)
msg = ''