1
0
mirror of https://gitlab.com/simple-stock-bots/simple-stock-bot.git synced 2025-06-16 15:17:28 +00:00

added error code #18

This commit is contained in:
MisterBiggs 2021-07-05 03:08:04 -07:00
parent 371b4505eb
commit cb92127ecd

9
bot.py
View File

@ -5,6 +5,8 @@ import io
import json import json
import logging import logging
import os import os
import random
import string
import traceback import traceback
from logging import critical, debug, error, info, warning from logging import critical, debug, error, info, warning
from uuid import uuid4 from uuid import uuid4
@ -511,6 +513,9 @@ def error(update: Update, context: CallbackContext):
) )
tb_string = "".join(tb_list) 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: if update:
message = ( message = (
f"An exception was raised while handling an update\n" f"An exception was raised while handling an update\n"
@ -523,8 +528,10 @@ def error(update: Update, context: CallbackContext):
warning(message) warning(message)
else: else:
warning(tb_string) warning(tb_string)
update.message.reply_text( 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 # Finally, send the message