mirror of https://github.com/Mai-with-u/MaiBot.git
modified: src/plugins/chat/utils.py
parent
20c553ab39
commit
c004faaba4
|
|
@ -46,11 +46,12 @@ def is_mentioned_bot_in_message(message: MessageRecv) -> bool:
|
||||||
"""检查消息是否提到了机器人"""
|
"""检查消息是否提到了机器人"""
|
||||||
keywords = [global_config.BOT_NICKNAME]
|
keywords = [global_config.BOT_NICKNAME]
|
||||||
nicknames = global_config.BOT_ALIAS_NAMES
|
nicknames = global_config.BOT_ALIAS_NAMES
|
||||||
|
message_content = re.sub(r'\[CQ:reply,[\s\S]*?\]','', message.raw_message)
|
||||||
for keyword in keywords:
|
for keyword in keywords:
|
||||||
if keyword in message.processed_plain_text:
|
if keyword in message_content:
|
||||||
return True
|
return True
|
||||||
for nickname in nicknames:
|
for nickname in nicknames:
|
||||||
if nickname in message.processed_plain_text:
|
if nickname in message_content:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue