修改 plugins.error_handler 通知用户的信息

This commit is contained in:
洛水.山岭居室 2022-05-25 18:28:01 +08:00
parent 4a89061e20
commit 3473f0e16f

View File

@ -69,14 +69,9 @@ async def error_handler(update: object, context: CallbackContext) -> None:
Log.error("处理函数时发生异常 \n", exc) Log.error("处理函数时发生异常 \n", exc)
try: try:
message = update.message message = update.message
user = update.effective_user
if message is not None: if message is not None:
text = "派蒙这边发生了点问题!如果有任务请尽量退出任务。" text = f"派蒙这边发生了点问题!如果有任务请尽量退出任务。"\
if user is not None: f"\n错误信息为 {str(context.error)}"
if user.id in admin_list:
error_test = str(context.error)
if len(error_test) <= 50:
text += f"\n错误信息为 {str(context.error)}"
await context.bot.send_message(message.chat_id, text, reply_markup=ReplyKeyboardRemove()) await context.bot.send_message(message.chat_id, text, reply_markup=ReplyKeyboardRemove())
except BadRequest: except BadRequest:
pass pass