From e48d93b7cb3685587e338b47cf12f96759a01eca Mon Sep 17 00:00:00 2001 From: tcmofashi Date: Fri, 7 Mar 2025 09:24:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=B9=E8=87=AA=E5=B7=B1=E5=8F=91?= =?UTF-8?q?=E5=87=BA=E7=9A=84=E8=A1=A8=E6=83=85=E5=8C=85=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/chat/bot.py | 3 ++- src/plugins/chat/emoji_manager.py | 2 +- src/plugins/chat/message.py | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/chat/bot.py b/src/plugins/chat/bot.py index b927472e5..73296c1da 100644 --- a/src/plugins/chat/bot.py +++ b/src/plugins/chat/bot.py @@ -167,7 +167,7 @@ class ChatBot: bot_response_time = tinking_time_point if random() < global_config.emoji_chance: - emoji_path = await emoji_manager.get_emoji_for_text(response) + emoji_path,discription = await emoji_manager.get_emoji_for_text(response) if emoji_path: emoji_cq = CQCode.create_emoji_cq(emoji_path) @@ -183,6 +183,7 @@ class ChatBot: raw_message=emoji_cq, plain_text=emoji_cq, processed_plain_text=emoji_cq, + detailed_plain_text=discription, user_nickname=global_config.BOT_NICKNAME, group_name=message.group_name, time=bot_response_time, diff --git a/src/plugins/chat/emoji_manager.py b/src/plugins/chat/emoji_manager.py index c31937624..3ba167308 100644 --- a/src/plugins/chat/emoji_manager.py +++ b/src/plugins/chat/emoji_manager.py @@ -152,7 +152,7 @@ class EmojiManager: {'$inc': {'usage_count': 1}} ) logger.success(f"找到匹配的表情包: {selected_emoji.get('discription', '无描述')} (相似度: {similarity:.4f})") - return selected_emoji['path'] + return selected_emoji['path'],"[表情包: %s]" % selected_emoji.get('discription', '无描述') except Exception as search_error: logger.error(f"搜索表情包失败: {str(search_error)}") diff --git a/src/plugins/chat/message.py b/src/plugins/chat/message.py index af9f93013..4ac574e66 100644 --- a/src/plugins/chat/message.py +++ b/src/plugins/chat/message.py @@ -77,7 +77,10 @@ class Message: if self.user_cardname else f"{self.user_nickname or f'用户{self.user_id}'}" ) - self.detailed_plain_text = f"[{time_str}] {name}: {self.processed_plain_text}\n" + if isinstance(self,Message_Sending) and self.is_emoji: + self.detailed_plain_text = f"[{time_str}] {name}: {self.detailed_plain_text}\n" + else: + self.detailed_plain_text = f"[{time_str}] {name}: {self.processed_plain_text}\n" self._initialized = True