避免错误信息太长,以及加点提前过滤

This commit is contained in:
shenjack 2024-06-10 17:33:33 +08:00
parent dade195e76
commit b3e9588763
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -323,6 +323,8 @@ def on_ica_message(msg: IcaNewMessage, client: IcaClient) -> None:
bangbang_img(msg, client) bangbang_img(msg, client)
except: # noqa except: # noqa
report_msg = f"bmcl插件发生错误,请呼叫shenjack\n{traceback.format_exc()}" report_msg = f"bmcl插件发生错误,请呼叫shenjack\n{traceback.format_exc()}"
if len(report_msg) > 200:
report_msg = report_msg[:200] + "..." # 防止消息过长
reply = msg.reply_with(report_msg) reply = msg.reply_with(report_msg)
client.send_and_warn(reply) client.send_and_warn(reply)
@ -364,6 +366,8 @@ def on_tailchat_message(msg, client) -> None:
bangbang_img(msg, client) bangbang_img(msg, client)
except: # noqa except: # noqa
report_msg = f"bmcl插件发生错误,请呼叫shenjack\n{traceback.format_exc()}" report_msg = f"bmcl插件发生错误,请呼叫shenjack\n{traceback.format_exc()}"
if len(report_msg) > 200:
report_msg = report_msg[:200] + "..." # 防止消息过长
reply = msg.reply_with(report_msg) reply = msg.reply_with(report_msg)
client.send_and_warn(reply) client.send_and_warn(reply)