chore: 删除冗余的兼容性检查判断

This commit is contained in:
Rock Chin
2023-04-06 20:34:56 +08:00
parent 7aef1758e0
commit d16cb25cde
14 changed files with 37 additions and 45 deletions

View File

@@ -13,11 +13,8 @@ def handle_exception(notify_admin: str = "", set_reply: str = "") -> list:
"""处理异常当notify_admin不为空时会通知管理员返回通知用户的消息"""
import config
pkg.utils.context.get_qqbot_manager().notify_admin(notify_admin)
if hasattr(config, 'hide_exce_info_to_user') and config.hide_exce_info_to_user:
if hasattr(config, 'alter_tip_message'):
return [config.alter_tip_message] if config.alter_tip_message else []
else:
return ["[bot]出错了,请重试或联系管理员"]
if config.hide_exce_info_to_user:
return [config.alter_tip_message] if config.alter_tip_message else []
else:
return [set_reply]
@@ -40,7 +37,7 @@ def process_normal_message(text_message: str, mgr, config, launcher_type: str,
reply = handle_exception(notify_admin=f"{session_name},多次尝试失败。", set_reply=f"[bot]多次尝试失败,请重试或联系管理员")
break
try:
prefix = "[GPT]" if hasattr(config, "show_prefix") and config.show_prefix else ""
prefix = "[GPT]" if config.show_prefix else ""
text = session.append(text_message)