Skip to content

Commit

Permalink
前置 念弹幕功能到本地问答库前
Browse files Browse the repository at this point in the history
  • Loading branch information
Ikaros-521 committed Oct 2, 2023
1 parent 8e8c8da commit 224316e
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions utils/my_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"):
Expand All @@ -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,
Expand Down

0 comments on commit 224316e

Please sign in to comment.