refactor: 将多个方法修改为静态方法以提高代码可读性和一致性
This commit is contained in:
@@ -37,7 +37,8 @@ class ReasoningChat:
|
||||
self.mood_manager = MoodManager.get_instance()
|
||||
self.mood_manager.start_mood_update()
|
||||
|
||||
async def _create_thinking_message(self, message, chat, userinfo, messageinfo):
|
||||
@staticmethod
|
||||
async def _create_thinking_message(message, chat, userinfo, messageinfo):
|
||||
"""创建思考消息"""
|
||||
bot_user_info = UserInfo(
|
||||
user_id=global_config.BOT_QQ,
|
||||
@@ -59,7 +60,8 @@ class ReasoningChat:
|
||||
|
||||
return thinking_id
|
||||
|
||||
async def _send_response_messages(self, message, chat, response_set: List[str], thinking_id) -> MessageSending:
|
||||
@staticmethod
|
||||
async def _send_response_messages(message, chat, response_set: List[str], thinking_id) -> MessageSending:
|
||||
"""发送回复消息"""
|
||||
container = message_manager.get_container(chat.stream_id)
|
||||
thinking_message = None
|
||||
@@ -104,7 +106,8 @@ class ReasoningChat:
|
||||
|
||||
return first_bot_msg
|
||||
|
||||
async def _handle_emoji(self, message, chat, response):
|
||||
@staticmethod
|
||||
async def _handle_emoji(message, chat, response):
|
||||
"""处理表情包"""
|
||||
if random() < global_config.emoji_chance:
|
||||
emoji_raw = await emoji_manager.get_emoji_for_text(response)
|
||||
@@ -291,7 +294,8 @@ class ReasoningChat:
|
||||
# 意愿管理器:注销当前message信息
|
||||
willing_manager.delete(message.message_info.message_id)
|
||||
|
||||
def _check_ban_words(self, text: str, chat, userinfo) -> bool:
|
||||
@staticmethod
|
||||
def _check_ban_words(text: str, chat, userinfo) -> bool:
|
||||
"""检查消息中是否包含过滤词"""
|
||||
for word in global_config.ban_words:
|
||||
if word in text:
|
||||
@@ -302,7 +306,8 @@ class ReasoningChat:
|
||||
return True
|
||||
return False
|
||||
|
||||
def _check_ban_regex(self, text: str, chat, userinfo) -> bool:
|
||||
@staticmethod
|
||||
def _check_ban_regex(text: str, chat, userinfo) -> bool:
|
||||
"""检查消息是否匹配过滤正则表达式"""
|
||||
for pattern in global_config.ban_msgs_regex:
|
||||
if pattern.search(text):
|
||||
|
||||
Reference in New Issue
Block a user