From cb92127ecd793428ebe63daaf7a9548e81c7e74d Mon Sep 17 00:00:00 2001 From: MisterBiggs Date: Mon, 5 Jul 2021 03:08:04 -0700 Subject: [PATCH] added error code #18 --- bot.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 8667fce..87f3fd7 100644 --- a/bot.py +++ b/bot.py @@ -5,6 +5,8 @@ import io import json import logging import os +import random +import string import traceback from logging import critical, debug, error, info, warning from uuid import uuid4 @@ -511,6 +513,9 @@ def error(update: Update, context: CallbackContext): ) tb_string = "".join(tb_list) + err_code = "".join([random.choice(string.ascii_lowercase) for i in range(5)]) + warning(f"Logging error: {err_code}") + if update: message = ( f"An exception was raised while handling an update\n" @@ -523,8 +528,10 @@ def error(update: Update, context: CallbackContext): warning(message) else: warning(tb_string) + update.message.reply_text( - text="An error has occured. Please inform @MisterBiggs if the error persists." + text=f"An error has occured. Please inform @MisterBiggs if the error persists. Error Code: `{err_code}`", + parse_mode=telegram.ParseMode.MARKDOWN, ) # Finally, send the message