bot error reporting does not use colors & truncates at 2500 chars

master
Tomáš Mládek 2021-09-22 23:57:42 +02:00
parent cf19301f96
commit ff39c8eeb3
1 changed files with 9 additions and 4 deletions

View File

@ -180,6 +180,9 @@ class KollagenBot:
check=True, check=True,
capture_output=True, capture_output=True,
timeout=60, timeout=60,
env={
'NO_COLOR': "1"
}
) )
ntf.seek(0) ntf.seek(0)
@ -218,11 +221,13 @@ class KollagenBot:
if isinstance(update, Update): if isinstance(update, Update):
if isinstance(context.error, subprocess.CalledProcessError): if isinstance(context.error, subprocess.CalledProcessError):
update.message.reply_text( error_display = context.error.stderr.decode('utf-8')
f"Something is fucked!\n{context.error.stderr.decode('utf-8')}"
)
else: else:
update.message.reply_text(f"Something is fucked!\n{context.error}") error_display = str(context.error)
error_display = error_display[:2500]
update.message.reply_text(
f"Something is fucked!\n{error_display}"
)
def start_idle(self): def start_idle(self):
self.updater.start_polling() self.updater.start_polling()