1
0
mirror of https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot.git synced 2025-06-16 06:56:46 +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 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