mirror of https://github.com/Mai-with-u/MaiBot.git
Fix TypeError in _check_ban_regex by handling NoneType raw_message
- Add None check for text parameter in _check_ban_regex function - Prevents TypeError when message.raw_message is None - Fixes issue: expected string or bytes-like object, got 'NoneType'pull/1239/head
parent
750bdfe04d
commit
89fb98c7f4
|
|
@ -58,6 +58,10 @@ def _check_ban_regex(text: str, chat: ChatStream, userinfo: UserInfo) -> bool:
|
|||
Returns:
|
||||
bool: 是否匹配过滤正则
|
||||
"""
|
||||
# 检查text是否为None或空字符串
|
||||
if text is None or not text:
|
||||
return False
|
||||
|
||||
for pattern in global_config.message_receive.ban_msgs_regex:
|
||||
if re.search(pattern, text):
|
||||
chat_name = chat.group_info.group_name if chat.group_info else "私聊"
|
||||
|
|
|
|||
Loading…
Reference in New Issue