支持别名,可以用不同名称召唤机器人

This commit is contained in:
Hosigus
2025-03-10 14:33:30 +08:00
parent 62523409d1
commit e4b8865f99
6 changed files with 20 additions and 18 deletions

View File

@@ -53,19 +53,13 @@ def db_message_to_str(message_dict: Dict) -> str:
return result
def is_mentioned_bot_in_message(message: Message) -> bool:
"""检查消息是否提到了机器人"""
keywords = [global_config.BOT_NICKNAME]
for keyword in keywords:
if keyword in message.processed_plain_text:
return True
return False
def is_mentioned_bot_in_txt(message: str) -> bool:
"""检查消息是否提到了机器人"""
keywords = [global_config.BOT_NICKNAME]
for keyword in keywords:
if global_config.BOT_NICKNAME is None:
return True
if global_config.BOT_NICKNAME in message:
return True
for keyword in global_config.BOT_ALIAS_NAMES:
if keyword in message:
return True
return False