feat: 被禁言时不处理消息 #62

This commit is contained in:
Rock Chin 2023-01-01 18:27:34 +08:00
parent b085c133bf
commit e2441165c9
2 changed files with 11 additions and 1 deletions

View File

@ -112,7 +112,8 @@ class QQBotManager:
def send(self, event, msg, check_quote=True):
asyncio.run(
self.bot.send(event, msg, quote=True if hasattr(config, "quote_origin") and config.quote_origin and check_quote else False))
self.bot.send(event, msg, quote=True if hasattr(config,
"quote_origin") and config.quote_origin and check_quote else False))
# 私聊消息处理
def on_person_message(self, event: MessageEvent):

View File

@ -1,4 +1,5 @@
# 此模块提供了消息处理的具体逻辑的接口
import asyncio
import datetime
import pkg.qqbot.manager as manager
@ -27,6 +28,14 @@ def process_message(launcher_type: str, launcher_id: int, text_message: str, mes
reply = []
session_name = "{}_{}".format(launcher_type, launcher_id)
# 检查是否被禁言
result = mgr.bot.member_info(target=launcher_id, member_id=mgr.bot.qq).get()
result = asyncio.run(result)
if result.mute_time_remaining > 0:
logging.info("机器人被禁言,跳过消息处理(group_{},剩余{}s)".format(launcher_id,
result.mute_time_remaining))
return reply
pkg.openai.session.get_session(session_name).acquire_response_lock()
try: