From 224316e53a409deeff3243ecec8d2e783ccb3946 Mon Sep 17 00:00:00 2001 From: Ikaros <327209194@qq.com> Date: Mon, 2 Oct 2023 12:21:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=BD=AE=20=E5=BF=B5=E5=BC=B9?= =?UTF-8?q?=E5=B9=95=E5=8A=9F=E8=83=BD=E5=88=B0=E6=9C=AC=E5=9C=B0=E9=97=AE?= =?UTF-8?q?=E7=AD=94=E5=BA=93=E5=89=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/my_handle.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/utils/my_handle.py b/utils/my_handle.py index 44f2e393..927d9d5f 100644 --- a/utils/my_handle.py +++ b/utils/my_handle.py @@ -1293,25 +1293,16 @@ def comment_handle(self, data): if self.integral_handle("crud", data): return + # 输出当前用户发送的弹幕消息 + logging.info(f"[{user_name}]: {content}") + """ 用户名也得过滤一下,防止炸弹人 """ # 用户名以及弹幕违禁判断 if self.prohibitions_handle(user_name) or self.prohibitions_handle(content): return - - # 1、本地问答库 处理 - if self.local_qa_handle(data): - return - - # 2、点歌模式 触发后不执行后面的其他功能 - if self.choose_song_handle(data): - return - - # 3、画图模式 触发后不执行后面的其他功能 - if self.sd_handle(data): - return - + # 弹幕格式检查和特殊字符替换 content = self.comment_check_and_replace(content) if content is None: @@ -1322,9 +1313,6 @@ def comment_handle(self, data): logging.debug(f"用户:{user_name}],发送纯符号的弹幕,已过滤") return - # 输出当前用户发送的弹幕消息 - logging.info(f"[{user_name}]: {content}") - try: # 念弹幕 if My_handle.config.get("read_comment", "enable"): @@ -1351,6 +1339,17 @@ def comment_handle(self, data): except Exception as e: logging.error(traceback.format_exc()) + # 1、本地问答库 处理 + if self.local_qa_handle(data): + return + + # 2、点歌模式 触发后不执行后面的其他功能 + if self.choose_song_handle(data): + return + + # 3、画图模式 触发后不执行后面的其他功能 + if self.sd_handle(data): + return data_json = { "user_name": user_name,