fix: address second-round review feedback on bot identity PR

This commit is contained in:
晴猫
2026-03-15 08:05:36 +09:00
parent 4f8ab0abb1
commit d3420bd1b3
8 changed files with 31 additions and 12 deletions

View File

@@ -44,8 +44,10 @@ class DirectMessageSender:
# 获取麦麦的信息
bot_user_id = get_bot_account(chat_stream.platform)
if not bot_user_id:
logger.warning(f"[私聊][{self.private_name}]平台 {chat_stream.platform} 未配置机器人账号,发送消息时回退到 QQ 账号")
bot_user_id = str(getattr(global_config.bot, "qq_account", "")).strip()
bot_user_id = get_bot_account("qq")
if not bot_user_id:
logger.error(f"[私聊][{self.private_name}]平台 {chat_stream.platform} 无可用机器人账号,无法发送消息")
raise RuntimeError("机器人账号未配置")
bot_user_info = UserInfo(
user_id=bot_user_id,
user_nickname=global_config.bot.nickname,

View File

@@ -1117,8 +1117,10 @@ class DefaultReplyer:
"""构建单个发送消息"""
bot_user_id = get_bot_account(self.chat_stream.platform)
if not bot_user_id:
logger.warning(f"平台 {self.chat_stream.platform} 未配置机器人账号,发送消息时回退到 QQ 账号")
bot_user_id = str(getattr(global_config.bot, "qq_account", "")).strip()
bot_user_id = get_bot_account("qq")
if not bot_user_id:
logger.error(f"平台 {self.chat_stream.platform} 无可用机器人账号,无法构建发送消息")
raise RuntimeError("机器人账号未配置")
maim_message = MessageBase(
message_info=BaseMessageInfo(

View File

@@ -957,8 +957,10 @@ class PrivateReplyer:
"""构建单个发送消息"""
bot_user_id = get_bot_account(self.chat_stream.platform)
if not bot_user_id:
logger.warning(f"平台 {self.chat_stream.platform} 未配置机器人账号,发送消息时回退到 QQ 账号")
bot_user_id = str(getattr(global_config.bot, "qq_account", "")).strip()
bot_user_id = get_bot_account("qq")
if not bot_user_id:
logger.error(f"平台 {self.chat_stream.platform} 无可用机器人账号,无法构建发送消息")
raise RuntimeError("机器人账号未配置")
maim_message = MessageBase(
message_info=BaseMessageInfo(

View File

@@ -93,7 +93,7 @@ def get_all_bot_accounts() -> dict[str, str]:
bot_accounts["tg"] = telegram_account
for platform_name, account in platform_accounts.items():
if platform_name in {"tg", "telegram"}:
if platform_name in {"tg", "telegram", "qq", "webui"}:
continue
bot_accounts[platform_name] = account