stdin2discord: add verbose logging on query failure. fix logic for long messages
This commit is contained in:
parent
ec8636e153
commit
a5b334279d
@ -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 = ''
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user