From 08cb3b240386785557def1718a4a8762859e961f Mon Sep 17 00:00:00 2001
From: ikaros <327209194@qq.com>
Date: Sat, 2 Sep 2023 18:38:15 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8A=96=E9=9F=B3=E5=85=B3=E6=B3=A8=E4=BA=8B?=
=?UTF-8?q?=E4=BB=B6=E5=8F=AF=E4=BB=A5=E8=A7=A6=E5=8F=91=E5=85=B3=E6=B3=A8?=
=?UTF-8?q?=E6=84=9F=E8=B0=A2=E8=AF=9D=E6=9C=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 3 +-
UI_main.py | 241 ++++++++++++++++++++++++-------------------
config.json | 8 +-
config.json.bak | 8 +-
dy.py | 9 ++
main.py | 23 ++++-
ui/main.ui | 252 ++++++++++++++++++++++++++-------------------
utils/audio.py | 2 +-
utils/my_handle.py | 42 +++++++-
9 files changed, 367 insertions(+), 221 deletions(-)
diff --git a/README.md b/README.md
index 84e6abdd..58a5c019 100644
--- a/README.md
+++ b/README.md
@@ -1258,7 +1258,7 @@ cmd运行`npm i docsify-cli -g`
- [x] 支持关闭聊天(LLM等)
- [x] langchain-chatglm的接入
- [ ] Edge-TTS在合成音频时会出现合成成功但是系统找不到文件的bug
-- [ ] 抖音关注事件可以触发关注感谢话术
+- [x] 抖音关注事件可以触发关注感谢话术
## 📝更新日志
@@ -1574,6 +1574,7 @@ cmd运行`npm i docsify-cli -g`
- 补充、删减部分违禁词
- 补充遗漏的zhipuai库
- 入场和礼物感谢部分删除用户名中存在的特殊符号
+ - 抖音关注事件可以触发关注感谢话术
diff --git a/UI_main.py b/UI_main.py
index f9f9e047..adaafe35 100644
--- a/UI_main.py
+++ b/UI_main.py
@@ -86,7 +86,7 @@ def setupUi(self, MainWindow):
self.scrollArea.setWidgetResizable(True)
self.scrollArea.setObjectName("scrollArea")
self.scrollAreaWidgetContents = QtWidgets.QWidget()
- self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 984, 9724))
+ self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, -2153, 984, 9894))
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
self.verticalLayout = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents)
self.verticalLayout.setContentsMargins(35, 20, 35, 20)
@@ -473,36 +473,48 @@ def setupUi(self, MainWindow):
self.groupBox_thanks.setObjectName("groupBox_thanks")
self.gridLayout_42 = QtWidgets.QGridLayout(self.groupBox_thanks)
self.gridLayout_42.setObjectName("gridLayout_42")
- self.label_thanks_entrance_copy = QtWidgets.QLabel(self.groupBox_thanks)
- self.label_thanks_entrance_copy.setObjectName("label_thanks_entrance_copy")
- self.gridLayout_42.addWidget(self.label_thanks_entrance_copy, 2, 0, 1, 1)
self.label_thanks_gift_copy = QtWidgets.QLabel(self.groupBox_thanks)
self.label_thanks_gift_copy.setObjectName("label_thanks_gift_copy")
- self.gridLayout_42.addWidget(self.label_thanks_gift_copy, 3, 0, 1, 1)
- self.label_thanks_lowest_price = QtWidgets.QLabel(self.groupBox_thanks)
- self.label_thanks_lowest_price.setObjectName("label_thanks_lowest_price")
- self.gridLayout_42.addWidget(self.label_thanks_lowest_price, 4, 0, 1, 1)
+ self.gridLayout_42.addWidget(self.label_thanks_gift_copy, 4, 0, 1, 1)
self.lineEdit_thanks_entrance_copy = QtWidgets.QLineEdit(self.groupBox_thanks)
self.lineEdit_thanks_entrance_copy.setObjectName("lineEdit_thanks_entrance_copy")
self.gridLayout_42.addWidget(self.lineEdit_thanks_entrance_copy, 2, 1, 1, 1)
- self.checkBox_thanks_entrance_enable = QtWidgets.QCheckBox(self.groupBox_thanks)
- self.checkBox_thanks_entrance_enable.setObjectName("checkBox_thanks_entrance_enable")
- self.gridLayout_42.addWidget(self.checkBox_thanks_entrance_enable, 0, 1, 1, 1)
- self.lineEdit_thanks_lowest_price = QtWidgets.QLineEdit(self.groupBox_thanks)
- self.lineEdit_thanks_lowest_price.setObjectName("lineEdit_thanks_lowest_price")
- self.gridLayout_42.addWidget(self.lineEdit_thanks_lowest_price, 4, 1, 1, 1)
- self.lineEdit_thanks_gift_copy = QtWidgets.QLineEdit(self.groupBox_thanks)
- self.lineEdit_thanks_gift_copy.setObjectName("lineEdit_thanks_gift_copy")
- self.gridLayout_42.addWidget(self.lineEdit_thanks_gift_copy, 3, 1, 1, 1)
self.label_thanks_entrance_enable = QtWidgets.QLabel(self.groupBox_thanks)
self.label_thanks_entrance_enable.setObjectName("label_thanks_entrance_enable")
self.gridLayout_42.addWidget(self.label_thanks_entrance_enable, 0, 0, 1, 1)
+ self.label_thanks_follow_copy = QtWidgets.QLabel(self.groupBox_thanks)
+ self.label_thanks_follow_copy.setObjectName("label_thanks_follow_copy")
+ self.gridLayout_42.addWidget(self.label_thanks_follow_copy, 7, 0, 1, 1)
self.label_thanks_gift_enable = QtWidgets.QLabel(self.groupBox_thanks)
self.label_thanks_gift_enable.setObjectName("label_thanks_gift_enable")
- self.gridLayout_42.addWidget(self.label_thanks_gift_enable, 1, 0, 1, 1)
+ self.gridLayout_42.addWidget(self.label_thanks_gift_enable, 3, 0, 1, 1)
+ self.label_thanks_entrance_copy = QtWidgets.QLabel(self.groupBox_thanks)
+ self.label_thanks_entrance_copy.setObjectName("label_thanks_entrance_copy")
+ self.gridLayout_42.addWidget(self.label_thanks_entrance_copy, 2, 0, 1, 1)
self.checkBox_thanks_gift_enable = QtWidgets.QCheckBox(self.groupBox_thanks)
self.checkBox_thanks_gift_enable.setObjectName("checkBox_thanks_gift_enable")
- self.gridLayout_42.addWidget(self.checkBox_thanks_gift_enable, 1, 1, 1, 1)
+ self.gridLayout_42.addWidget(self.checkBox_thanks_gift_enable, 3, 1, 1, 1)
+ self.label_thanks_lowest_price = QtWidgets.QLabel(self.groupBox_thanks)
+ self.label_thanks_lowest_price.setObjectName("label_thanks_lowest_price")
+ self.gridLayout_42.addWidget(self.label_thanks_lowest_price, 5, 0, 1, 1)
+ self.lineEdit_thanks_lowest_price = QtWidgets.QLineEdit(self.groupBox_thanks)
+ self.lineEdit_thanks_lowest_price.setObjectName("lineEdit_thanks_lowest_price")
+ self.gridLayout_42.addWidget(self.lineEdit_thanks_lowest_price, 5, 1, 1, 1)
+ self.lineEdit_thanks_gift_copy = QtWidgets.QLineEdit(self.groupBox_thanks)
+ self.lineEdit_thanks_gift_copy.setObjectName("lineEdit_thanks_gift_copy")
+ self.gridLayout_42.addWidget(self.lineEdit_thanks_gift_copy, 4, 1, 1, 1)
+ self.checkBox_thanks_entrance_enable = QtWidgets.QCheckBox(self.groupBox_thanks)
+ self.checkBox_thanks_entrance_enable.setObjectName("checkBox_thanks_entrance_enable")
+ self.gridLayout_42.addWidget(self.checkBox_thanks_entrance_enable, 0, 1, 1, 1)
+ self.label_thanks_follow_enable = QtWidgets.QLabel(self.groupBox_thanks)
+ self.label_thanks_follow_enable.setObjectName("label_thanks_follow_enable")
+ self.gridLayout_42.addWidget(self.label_thanks_follow_enable, 6, 0, 1, 1)
+ self.checkBox_thanks_follow_enable = QtWidgets.QCheckBox(self.groupBox_thanks)
+ self.checkBox_thanks_follow_enable.setObjectName("checkBox_thanks_follow_enable")
+ self.gridLayout_42.addWidget(self.checkBox_thanks_follow_enable, 6, 1, 1, 1)
+ self.lineEdit_thanks_follow_copy = QtWidgets.QLineEdit(self.groupBox_thanks)
+ self.lineEdit_thanks_follow_copy.setObjectName("lineEdit_thanks_follow_copy")
+ self.gridLayout_42.addWidget(self.lineEdit_thanks_follow_copy, 7, 1, 1, 1)
self.gridLayout.addWidget(self.groupBox_thanks, 20, 0, 1, 3)
self.groupBox_filter = QtWidgets.QGroupBox(self.formWidget)
self.groupBox_filter.setStyleSheet("")
@@ -511,102 +523,114 @@ def setupUi(self, MainWindow):
self.gridLayout_26.setObjectName("gridLayout_26")
self.gridLayout_filter = QtWidgets.QGridLayout()
self.gridLayout_filter.setObjectName("gridLayout_filter")
- self.lineEdit_filter_schedule_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter)
- self.lineEdit_filter_schedule_forget_reserve_num.setObjectName("lineEdit_filter_schedule_forget_reserve_num")
- self.gridLayout_filter.addWidget(self.lineEdit_filter_schedule_forget_reserve_num, 15, 1, 1, 1)
- self.label_filter_schedule_forget_duration = QtWidgets.QLabel(self.groupBox_filter)
- self.label_filter_schedule_forget_duration.setObjectName("label_filter_schedule_forget_duration")
- self.gridLayout_filter.addWidget(self.label_filter_schedule_forget_duration, 14, 0, 1, 1)
- self.label_filter_talk_forget_duration = QtWidgets.QLabel(self.groupBox_filter)
- self.label_filter_talk_forget_duration.setObjectName("label_filter_talk_forget_duration")
- self.gridLayout_filter.addWidget(self.label_filter_talk_forget_duration, 12, 0, 1, 1)
+ self.label_filter_talk_forget_reserve_num = QtWidgets.QLabel(self.groupBox_filter)
+ self.label_filter_talk_forget_reserve_num.setObjectName("label_filter_talk_forget_reserve_num")
+ self.gridLayout_filter.addWidget(self.label_filter_talk_forget_reserve_num, 15, 0, 1, 1)
+ self.lineEdit_filter_talk_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter)
+ self.lineEdit_filter_talk_forget_reserve_num.setObjectName("lineEdit_filter_talk_forget_reserve_num")
+ self.gridLayout_filter.addWidget(self.lineEdit_filter_talk_forget_reserve_num, 15, 1, 1, 1)
+ self.lineEdit_filter_max_char_len = QtWidgets.QLineEdit(self.groupBox_filter)
+ self.lineEdit_filter_max_char_len.setObjectName("lineEdit_filter_max_char_len")
+ self.gridLayout_filter.addWidget(self.lineEdit_filter_max_char_len, 5, 1, 1, 1)
+ self.lineEdit_filter_comment_forget_duration = QtWidgets.QLineEdit(self.groupBox_filter)
+ self.lineEdit_filter_comment_forget_duration.setObjectName("lineEdit_filter_comment_forget_duration")
+ self.gridLayout_filter.addWidget(self.lineEdit_filter_comment_forget_duration, 6, 1, 1, 1)
+ self.lineEdit_filter_entrance_forget_duration = QtWidgets.QLineEdit(self.groupBox_filter)
+ self.lineEdit_filter_entrance_forget_duration.setObjectName("lineEdit_filter_entrance_forget_duration")
+ self.gridLayout_filter.addWidget(self.lineEdit_filter_entrance_forget_duration, 12, 1, 1, 1)
+ self.label_filter_comment_forget_reserve_num = QtWidgets.QLabel(self.groupBox_filter)
+ self.label_filter_comment_forget_reserve_num.setObjectName("label_filter_comment_forget_reserve_num")
+ self.gridLayout_filter.addWidget(self.label_filter_comment_forget_reserve_num, 7, 0, 1, 1)
+ self.label_filter_max_len = QtWidgets.QLabel(self.groupBox_filter)
+ self.label_filter_max_len.setObjectName("label_filter_max_len")
+ self.gridLayout_filter.addWidget(self.label_filter_max_len, 4, 0, 1, 1)
+ self.lineEdit_filter_badwords_path = QtWidgets.QLineEdit(self.groupBox_filter)
+ self.lineEdit_filter_badwords_path.setObjectName("lineEdit_filter_badwords_path")
+ self.gridLayout_filter.addWidget(self.lineEdit_filter_badwords_path, 2, 1, 1, 1)
+ self.label_filter_max_char_len = QtWidgets.QLabel(self.groupBox_filter)
+ self.label_filter_max_char_len.setObjectName("label_filter_max_char_len")
+ self.gridLayout_filter.addWidget(self.label_filter_max_char_len, 5, 0, 1, 1)
+ self.lineEdit_filter_max_len = QtWidgets.QLineEdit(self.groupBox_filter)
+ self.lineEdit_filter_max_len.setObjectName("lineEdit_filter_max_len")
+ self.gridLayout_filter.addWidget(self.lineEdit_filter_max_len, 4, 1, 1, 1)
+ self.lineEdit_filter_gift_forget_duration = QtWidgets.QLineEdit(self.groupBox_filter)
+ self.lineEdit_filter_gift_forget_duration.setObjectName("lineEdit_filter_gift_forget_duration")
+ self.gridLayout_filter.addWidget(self.lineEdit_filter_gift_forget_duration, 8, 1, 1, 1)
self.label_filter_entrance_forget_reserve_num = QtWidgets.QLabel(self.groupBox_filter)
self.label_filter_entrance_forget_reserve_num.setObjectName("label_filter_entrance_forget_reserve_num")
- self.gridLayout_filter.addWidget(self.label_filter_entrance_forget_reserve_num, 11, 0, 1, 1)
+ self.gridLayout_filter.addWidget(self.label_filter_entrance_forget_reserve_num, 13, 0, 1, 1)
+ self.label_filter_talk_forget_duration = QtWidgets.QLabel(self.groupBox_filter)
+ self.label_filter_talk_forget_duration.setObjectName("label_filter_talk_forget_duration")
+ self.gridLayout_filter.addWidget(self.label_filter_talk_forget_duration, 14, 0, 1, 1)
self.label_filter_badwords_path = QtWidgets.QLabel(self.groupBox_filter)
self.label_filter_badwords_path.setObjectName("label_filter_badwords_path")
self.gridLayout_filter.addWidget(self.label_filter_badwords_path, 2, 0, 1, 1)
- self.textEdit_filter_before_must_str = QtWidgets.QTextEdit(self.groupBox_filter)
- self.textEdit_filter_before_must_str.setObjectName("textEdit_filter_before_must_str")
- self.gridLayout_filter.addWidget(self.textEdit_filter_before_must_str, 0, 1, 1, 1)
+ self.label_filter_schedule_forget_duration = QtWidgets.QLabel(self.groupBox_filter)
+ self.label_filter_schedule_forget_duration.setObjectName("label_filter_schedule_forget_duration")
+ self.gridLayout_filter.addWidget(self.label_filter_schedule_forget_duration, 16, 0, 1, 1)
self.label_filter_comment_forget_duration = QtWidgets.QLabel(self.groupBox_filter)
self.label_filter_comment_forget_duration.setObjectName("label_filter_comment_forget_duration")
self.gridLayout_filter.addWidget(self.label_filter_comment_forget_duration, 6, 0, 1, 1)
- self.lineEdit_filter_comment_forget_duration = QtWidgets.QLineEdit(self.groupBox_filter)
- self.lineEdit_filter_comment_forget_duration.setObjectName("lineEdit_filter_comment_forget_duration")
- self.gridLayout_filter.addWidget(self.lineEdit_filter_comment_forget_duration, 6, 1, 1, 1)
- self.lineEdit_filter_badwords_path = QtWidgets.QLineEdit(self.groupBox_filter)
- self.lineEdit_filter_badwords_path.setObjectName("lineEdit_filter_badwords_path")
- self.gridLayout_filter.addWidget(self.lineEdit_filter_badwords_path, 2, 1, 1, 1)
- self.lineEdit_filter_talk_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter)
- self.lineEdit_filter_talk_forget_reserve_num.setObjectName("lineEdit_filter_talk_forget_reserve_num")
- self.gridLayout_filter.addWidget(self.lineEdit_filter_talk_forget_reserve_num, 13, 1, 1, 1)
- self.label_filter_max_len = QtWidgets.QLabel(self.groupBox_filter)
- self.label_filter_max_len.setObjectName("label_filter_max_len")
- self.gridLayout_filter.addWidget(self.label_filter_max_len, 4, 0, 1, 1)
+ self.lineEdit_filter_schedule_forget_duration = QtWidgets.QLineEdit(self.groupBox_filter)
+ self.lineEdit_filter_schedule_forget_duration.setObjectName("lineEdit_filter_schedule_forget_duration")
+ self.gridLayout_filter.addWidget(self.lineEdit_filter_schedule_forget_duration, 16, 1, 1, 1)
+ self.lineEdit_filter_gift_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter)
+ self.lineEdit_filter_gift_forget_reserve_num.setObjectName("lineEdit_filter_gift_forget_reserve_num")
+ self.gridLayout_filter.addWidget(self.lineEdit_filter_gift_forget_reserve_num, 9, 1, 1, 1)
+ self.label_filter_follow_forget_duration = QtWidgets.QLabel(self.groupBox_filter)
+ self.label_filter_follow_forget_duration.setObjectName("label_filter_follow_forget_duration")
+ self.gridLayout_filter.addWidget(self.label_filter_follow_forget_duration, 10, 0, 1, 1)
+ self.lineEdit_filter_entrance_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter)
+ self.lineEdit_filter_entrance_forget_reserve_num.setObjectName("lineEdit_filter_entrance_forget_reserve_num")
+ self.gridLayout_filter.addWidget(self.lineEdit_filter_entrance_forget_reserve_num, 13, 1, 1, 1)
+ self.label_filter_bad_pinyin_path = QtWidgets.QLabel(self.groupBox_filter)
+ self.label_filter_bad_pinyin_path.setObjectName("label_filter_bad_pinyin_path")
+ self.gridLayout_filter.addWidget(self.label_filter_bad_pinyin_path, 3, 0, 1, 1)
+ self.textEdit_filter_after_must_str = QtWidgets.QTextEdit(self.groupBox_filter)
+ self.textEdit_filter_after_must_str.setObjectName("textEdit_filter_after_must_str")
+ self.gridLayout_filter.addWidget(self.textEdit_filter_after_must_str, 1, 1, 1, 1)
+ self.textEdit_filter_before_must_str = QtWidgets.QTextEdit(self.groupBox_filter)
+ self.textEdit_filter_before_must_str.setObjectName("textEdit_filter_before_must_str")
+ self.gridLayout_filter.addWidget(self.textEdit_filter_before_must_str, 0, 1, 1, 1)
+ self.label_filter_gift_forget_reserve_num = QtWidgets.QLabel(self.groupBox_filter)
+ self.label_filter_gift_forget_reserve_num.setObjectName("label_filter_gift_forget_reserve_num")
+ self.gridLayout_filter.addWidget(self.label_filter_gift_forget_reserve_num, 9, 0, 1, 1)
self.lineEdit_filter_bad_pinyin_path = QtWidgets.QLineEdit(self.groupBox_filter)
self.lineEdit_filter_bad_pinyin_path.setObjectName("lineEdit_filter_bad_pinyin_path")
self.gridLayout_filter.addWidget(self.lineEdit_filter_bad_pinyin_path, 3, 1, 1, 1)
- self.label_filter_schedule_forget_reserve_num = QtWidgets.QLabel(self.groupBox_filter)
- self.label_filter_schedule_forget_reserve_num.setObjectName("label_filter_schedule_forget_reserve_num")
- self.gridLayout_filter.addWidget(self.label_filter_schedule_forget_reserve_num, 15, 0, 1, 1)
- self.lineEdit_filter_max_len = QtWidgets.QLineEdit(self.groupBox_filter)
- self.lineEdit_filter_max_len.setObjectName("lineEdit_filter_max_len")
- self.gridLayout_filter.addWidget(self.lineEdit_filter_max_len, 4, 1, 1, 1)
- self.lineEdit_filter_max_char_len = QtWidgets.QLineEdit(self.groupBox_filter)
- self.lineEdit_filter_max_char_len.setObjectName("lineEdit_filter_max_char_len")
- self.gridLayout_filter.addWidget(self.lineEdit_filter_max_char_len, 5, 1, 1, 1)
- self.label_filter_max_char_len = QtWidgets.QLabel(self.groupBox_filter)
- self.label_filter_max_char_len.setObjectName("label_filter_max_char_len")
- self.gridLayout_filter.addWidget(self.label_filter_max_char_len, 5, 0, 1, 1)
- self.label_filter_talk_forget_reserve_num = QtWidgets.QLabel(self.groupBox_filter)
- self.label_filter_talk_forget_reserve_num.setObjectName("label_filter_talk_forget_reserve_num")
- self.gridLayout_filter.addWidget(self.label_filter_talk_forget_reserve_num, 13, 0, 1, 1)
self.label_filter_before_must_str = QtWidgets.QLabel(self.groupBox_filter)
self.label_filter_before_must_str.setObjectName("label_filter_before_must_str")
self.gridLayout_filter.addWidget(self.label_filter_before_must_str, 0, 0, 1, 1)
- self.label_filter_bad_pinyin_path = QtWidgets.QLabel(self.groupBox_filter)
- self.label_filter_bad_pinyin_path.setObjectName("label_filter_bad_pinyin_path")
- self.gridLayout_filter.addWidget(self.label_filter_bad_pinyin_path, 3, 0, 1, 1)
- self.label_filter_entrance_forget_duration = QtWidgets.QLabel(self.groupBox_filter)
- self.label_filter_entrance_forget_duration.setObjectName("label_filter_entrance_forget_duration")
- self.gridLayout_filter.addWidget(self.label_filter_entrance_forget_duration, 10, 0, 1, 1)
- self.lineEdit_filter_schedule_forget_duration = QtWidgets.QLineEdit(self.groupBox_filter)
- self.lineEdit_filter_schedule_forget_duration.setObjectName("lineEdit_filter_schedule_forget_duration")
- self.gridLayout_filter.addWidget(self.lineEdit_filter_schedule_forget_duration, 14, 1, 1, 1)
- self.lineEdit_filter_entrance_forget_duration = QtWidgets.QLineEdit(self.groupBox_filter)
- self.lineEdit_filter_entrance_forget_duration.setObjectName("lineEdit_filter_entrance_forget_duration")
- self.gridLayout_filter.addWidget(self.lineEdit_filter_entrance_forget_duration, 10, 1, 1, 1)
self.lineEdit_filter_talk_forget_duration = QtWidgets.QLineEdit(self.groupBox_filter)
self.lineEdit_filter_talk_forget_duration.setObjectName("lineEdit_filter_talk_forget_duration")
- self.gridLayout_filter.addWidget(self.lineEdit_filter_talk_forget_duration, 12, 1, 1, 1)
- self.label_filter_gift_forget_reserve_num = QtWidgets.QLabel(self.groupBox_filter)
- self.label_filter_gift_forget_reserve_num.setObjectName("label_filter_gift_forget_reserve_num")
- self.gridLayout_filter.addWidget(self.label_filter_gift_forget_reserve_num, 9, 0, 1, 1)
+ self.gridLayout_filter.addWidget(self.lineEdit_filter_talk_forget_duration, 14, 1, 1, 1)
self.label_filter_after_must_str = QtWidgets.QLabel(self.groupBox_filter)
self.label_filter_after_must_str.setObjectName("label_filter_after_must_str")
self.gridLayout_filter.addWidget(self.label_filter_after_must_str, 1, 0, 1, 1)
- self.label_filter_gift_forget_duration = QtWidgets.QLabel(self.groupBox_filter)
- self.label_filter_gift_forget_duration.setObjectName("label_filter_gift_forget_duration")
- self.gridLayout_filter.addWidget(self.label_filter_gift_forget_duration, 8, 0, 1, 1)
- self.textEdit_filter_after_must_str = QtWidgets.QTextEdit(self.groupBox_filter)
- self.textEdit_filter_after_must_str.setObjectName("textEdit_filter_after_must_str")
- self.gridLayout_filter.addWidget(self.textEdit_filter_after_must_str, 1, 1, 1, 1)
- self.label_filter_comment_forget_reserve_num = QtWidgets.QLabel(self.groupBox_filter)
- self.label_filter_comment_forget_reserve_num.setObjectName("label_filter_comment_forget_reserve_num")
- self.gridLayout_filter.addWidget(self.label_filter_comment_forget_reserve_num, 7, 0, 1, 1)
self.lineEdit_filter_comment_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter)
self.lineEdit_filter_comment_forget_reserve_num.setObjectName("lineEdit_filter_comment_forget_reserve_num")
self.gridLayout_filter.addWidget(self.lineEdit_filter_comment_forget_reserve_num, 7, 1, 1, 1)
- self.lineEdit_filter_gift_forget_duration = QtWidgets.QLineEdit(self.groupBox_filter)
- self.lineEdit_filter_gift_forget_duration.setObjectName("lineEdit_filter_gift_forget_duration")
- self.gridLayout_filter.addWidget(self.lineEdit_filter_gift_forget_duration, 8, 1, 1, 1)
- self.lineEdit_filter_entrance_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter)
- self.lineEdit_filter_entrance_forget_reserve_num.setObjectName("lineEdit_filter_entrance_forget_reserve_num")
- self.gridLayout_filter.addWidget(self.lineEdit_filter_entrance_forget_reserve_num, 11, 1, 1, 1)
- self.lineEdit_filter_gift_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter)
- self.lineEdit_filter_gift_forget_reserve_num.setObjectName("lineEdit_filter_gift_forget_reserve_num")
- self.gridLayout_filter.addWidget(self.lineEdit_filter_gift_forget_reserve_num, 9, 1, 1, 1)
+ self.label_filter_schedule_forget_reserve_num = QtWidgets.QLabel(self.groupBox_filter)
+ self.label_filter_schedule_forget_reserve_num.setObjectName("label_filter_schedule_forget_reserve_num")
+ self.gridLayout_filter.addWidget(self.label_filter_schedule_forget_reserve_num, 17, 0, 1, 1)
+ self.label_filter_gift_forget_duration = QtWidgets.QLabel(self.groupBox_filter)
+ self.label_filter_gift_forget_duration.setObjectName("label_filter_gift_forget_duration")
+ self.gridLayout_filter.addWidget(self.label_filter_gift_forget_duration, 8, 0, 1, 1)
+ self.lineEdit_filter_schedule_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter)
+ self.lineEdit_filter_schedule_forget_reserve_num.setObjectName("lineEdit_filter_schedule_forget_reserve_num")
+ self.gridLayout_filter.addWidget(self.lineEdit_filter_schedule_forget_reserve_num, 17, 1, 1, 1)
+ self.label_filter_entrance_forget_duration = QtWidgets.QLabel(self.groupBox_filter)
+ self.label_filter_entrance_forget_duration.setObjectName("label_filter_entrance_forget_duration")
+ self.gridLayout_filter.addWidget(self.label_filter_entrance_forget_duration, 12, 0, 1, 1)
+ self.label_filter_follow_forget_reserve_num = QtWidgets.QLabel(self.groupBox_filter)
+ self.label_filter_follow_forget_reserve_num.setObjectName("label_filter_follow_forget_reserve_num")
+ self.gridLayout_filter.addWidget(self.label_filter_follow_forget_reserve_num, 11, 0, 1, 1)
+ self.lineEdit_filter_follow_forget_duration = QtWidgets.QLineEdit(self.groupBox_filter)
+ self.lineEdit_filter_follow_forget_duration.setObjectName("lineEdit_filter_follow_forget_duration")
+ self.gridLayout_filter.addWidget(self.lineEdit_filter_follow_forget_duration, 10, 1, 1, 1)
+ self.lineEdit_filter_follow_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter)
+ self.lineEdit_filter_follow_forget_reserve_num.setObjectName("lineEdit_filter_follow_forget_reserve_num")
+ self.gridLayout_filter.addWidget(self.lineEdit_filter_follow_forget_reserve_num, 11, 1, 1, 1)
self.gridLayout_26.addLayout(self.gridLayout_filter, 0, 0, 1, 1)
self.gridLayout.addWidget(self.groupBox_filter, 18, 0, 1, 3)
self.lineEdit_room_display_id = QtWidgets.QLineEdit(self.formWidget)
@@ -1588,7 +1612,7 @@ def setupUi(self, MainWindow):
self.scrollArea_copywriting_config.setWidgetResizable(True)
self.scrollArea_copywriting_config.setObjectName("scrollArea_copywriting_config")
self.scrollAreaWidgetContents_4 = QtWidgets.QWidget()
- self.scrollAreaWidgetContents_4.setGeometry(QtCore.QRect(0, 0, 359, 104))
+ self.scrollAreaWidgetContents_4.setGeometry(QtCore.QRect(0, 0, 652, 498))
self.scrollAreaWidgetContents_4.setObjectName("scrollAreaWidgetContents_4")
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents_4)
self.verticalLayout_4.setObjectName("verticalLayout_4")
@@ -1964,30 +1988,35 @@ def retranslateUi(self, MainWindow):
self.comboBox_local_qa_text_type.setItemText(0, _translate("MainWindow", "自定义json"))
self.comboBox_local_qa_text_type.setItemText(1, _translate("MainWindow", "一问一答"))
self.groupBox_thanks.setTitle(_translate("MainWindow", "答谢"))
- self.label_thanks_entrance_copy.setText(_translate("MainWindow", "入场文案"))
self.label_thanks_gift_copy.setText(_translate("MainWindow", "礼物文案"))
- self.label_thanks_lowest_price.setText(_translate("MainWindow", "最低答谢价格"))
- self.checkBox_thanks_entrance_enable.setText(_translate("MainWindow", "启用"))
self.label_thanks_entrance_enable.setText(_translate("MainWindow", "入场欢迎"))
+ self.label_thanks_follow_copy.setText(_translate("MainWindow", "关注文案"))
self.label_thanks_gift_enable.setText(_translate("MainWindow", "礼物答谢"))
+ self.label_thanks_entrance_copy.setText(_translate("MainWindow", "入场文案"))
self.checkBox_thanks_gift_enable.setText(_translate("MainWindow", "启用"))
+ self.label_thanks_lowest_price.setText(_translate("MainWindow", "最低答谢价格"))
+ self.checkBox_thanks_entrance_enable.setText(_translate("MainWindow", "启用"))
+ self.label_thanks_follow_enable.setText(_translate("MainWindow", "关注答谢"))
+ self.checkBox_thanks_follow_enable.setText(_translate("MainWindow", "启用"))
self.groupBox_filter.setTitle(_translate("MainWindow", "过滤"))
- self.label_filter_schedule_forget_duration.setText(_translate("MainWindow", "定时遗忘间隔"))
- self.label_filter_talk_forget_duration.setText(_translate("MainWindow", "聊天遗忘间隔"))
+ self.label_filter_talk_forget_reserve_num.setText(_translate("MainWindow", "聊天保留数"))
+ self.label_filter_comment_forget_reserve_num.setText(_translate("MainWindow", "弹幕保留数"))
+ self.label_filter_max_len.setText(_translate("MainWindow", "最大单词数"))
+ self.label_filter_max_char_len.setText(_translate("MainWindow", "最大字符数"))
self.label_filter_entrance_forget_reserve_num.setText(_translate("MainWindow", "入场保留数"))
+ self.label_filter_talk_forget_duration.setText(_translate("MainWindow", "聊天遗忘间隔"))
self.label_filter_badwords_path.setText(_translate("MainWindow", "违禁词路径"))
+ self.label_filter_schedule_forget_duration.setText(_translate("MainWindow", "定时遗忘间隔"))
self.label_filter_comment_forget_duration.setText(_translate("MainWindow", "弹幕遗忘间隔"))
- self.label_filter_max_len.setText(_translate("MainWindow", "最大单词数"))
- self.label_filter_schedule_forget_reserve_num.setText(_translate("MainWindow", "定时保留数"))
- self.label_filter_max_char_len.setText(_translate("MainWindow", "最大字符数"))
- self.label_filter_talk_forget_reserve_num.setText(_translate("MainWindow", "聊天保留数"))
- self.label_filter_before_must_str.setText(_translate("MainWindow", "弹幕前缀"))
+ self.label_filter_follow_forget_duration.setText(_translate("MainWindow", "关注遗忘间隔"))
self.label_filter_bad_pinyin_path.setText(_translate("MainWindow", "违禁拼音路径"))
- self.label_filter_entrance_forget_duration.setText(_translate("MainWindow", "入场遗忘间隔"))
self.label_filter_gift_forget_reserve_num.setText(_translate("MainWindow", "礼物保留数"))
+ self.label_filter_before_must_str.setText(_translate("MainWindow", "弹幕前缀"))
self.label_filter_after_must_str.setText(_translate("MainWindow", "弹幕后缀"))
+ self.label_filter_schedule_forget_reserve_num.setText(_translate("MainWindow", "定时保留数"))
self.label_filter_gift_forget_duration.setText(_translate("MainWindow", "礼物遗忘间隔"))
- self.label_filter_comment_forget_reserve_num.setText(_translate("MainWindow", "弹幕保留数"))
+ self.label_filter_entrance_forget_duration.setText(_translate("MainWindow", "入场遗忘间隔"))
+ self.label_filter_follow_forget_reserve_num.setText(_translate("MainWindow", "关注保留数"))
self.groupBox_audio_random_speed.setTitle(_translate("MainWindow", "音频随机变速"))
self.label_audio_random_speed_normal_enable.setText(_translate("MainWindow", "普通音频变速"))
self.label_audio_random_speed_normal_speed_min.setText(_translate("MainWindow", "速度下限"))
diff --git a/config.json b/config.json
index 3ffee774..233d63c4 100644
--- a/config.json
+++ b/config.json
@@ -53,6 +53,8 @@
"gift_forget_reserve_num": 1,
"entrance_forget_duration": 5.0,
"entrance_forget_reserve_num": 2,
+ "follow_forget_duration": 3.0,
+ "follow_forget_reserve_num": 1,
"talk_forget_duration": 0.1,
"talk_forget_reserve_num": 1,
"schedule_forget_duration": 0.1,
@@ -60,9 +62,11 @@
},
"thanks": {
"entrance_enable": true,
+ "entrance_copy": "欢迎{username}",
"gift_enable": true,
- "entrance_copy": "欢迎 {username}",
- "gift_copy": "感谢 {username} 送的 {gift_name}",
+ "gift_copy": "感谢{username}送的{gift_name}",
+ "follow_enable": true,
+ "follow_copy": "感谢{username}的关注",
"lowest_price": 1.0
},
"live2d": {
diff --git a/config.json.bak b/config.json.bak
index 3ffee774..233d63c4 100644
--- a/config.json.bak
+++ b/config.json.bak
@@ -53,6 +53,8 @@
"gift_forget_reserve_num": 1,
"entrance_forget_duration": 5.0,
"entrance_forget_reserve_num": 2,
+ "follow_forget_duration": 3.0,
+ "follow_forget_reserve_num": 1,
"talk_forget_duration": 0.1,
"talk_forget_reserve_num": 1,
"schedule_forget_duration": 0.1,
@@ -60,9 +62,11 @@
},
"thanks": {
"entrance_enable": true,
+ "entrance_copy": "欢迎{username}",
"gift_enable": true,
- "entrance_copy": "欢迎 {username}",
- "gift_copy": "感谢 {username} 送的 {gift_name}",
+ "gift_copy": "感谢{username}送的{gift_name}",
+ "follow_enable": true,
+ "follow_copy": "感谢{username}的关注",
"lowest_price": 1.0
},
"live2d": {
diff --git a/dy.py b/dy.py
index 36c4fcf1..0d1d2966 100644
--- a/dy.py
+++ b/dy.py
@@ -177,8 +177,16 @@ def on_message(ws, message):
my_handle.process_data(data, "entrance")
elif type == 4:
+ user_name = data_json["User"]["Nickname"]
+
logging.info(f'[➕直播间关注消息] 感谢 {data_json["User"]["Nickname"]} 的关注')
+ data = {
+ "username": user_name
+ }
+
+ my_handle.process_data(data, "follow")
+
pass
elif type == 5:
@@ -242,6 +250,7 @@ def on_message(ws, message):
def on_error(ws, error):
logging.error("Error:", error)
+
def on_close(ws):
logging.debug("WebSocket connection closed")
diff --git a/main.py b/main.py
index e2dbc03b..ba32cdb5 100644
--- a/main.py
+++ b/main.py
@@ -426,6 +426,7 @@ def init_config(self):
self.ui.label_local_qa_audio_file_path.setToolTip("本地问答音频文件存储路径")
self.ui.label_local_qa_audio_similarity.setToolTip("最低音频匹配相似度,就是说用户发送的内容和本地音频库中音频文件名的最低相似度。\n低了就会被当做一般弹幕处理")
+ # 过滤
self.ui.label_filter_before_must_str.setToolTip("弹幕过滤,必须携带的触发前缀字符串(任一)\n例如:配置#,那么就需要发送:#你好")
self.ui.label_filter_after_must_str.setToolTip("弹幕过滤,必须携带的触发后缀字符串(任一)\n例如:配置。那么就需要发送:你好。")
self.ui.label_filter_badwords_path.setToolTip("本地违禁词数据路径(你如果不需要,可以清空文件内容)")
@@ -438,16 +439,21 @@ def init_config(self):
self.ui.label_filter_gift_forget_reserve_num.setToolTip("保留最新收到的数据的数量")
self.ui.label_filter_entrance_forget_duration.setToolTip("指的是每隔这个间隔时间(秒),就会丢弃这个间隔时间中接收到的数据,\n保留数据在以下配置中可以自定义")
self.ui.label_filter_entrance_forget_reserve_num.setToolTip("保留最新收到的数据的数量")
+ self.ui.label_filter_follow_forget_duration.setToolTip("指的是每隔这个间隔时间(秒),就会丢弃这个间隔时间中接收到的数据,\n保留数据在以下配置中可以自定义")
+ self.ui.label_filter_follow_forget_reserve_num.setToolTip("保留最新收到的数据的数量")
self.ui.label_filter_talk_forget_duration.setToolTip("指的是每隔这个间隔时间(秒),就会丢弃这个间隔时间中接收到的数据,\n保留数据在以下配置中可以自定义")
self.ui.label_filter_talk_forget_reserve_num.setToolTip("保留最新收到的数据的数量")
self.ui.label_filter_schedule_forget_duration.setToolTip("指的是每隔这个间隔时间(秒),就会丢弃这个间隔时间中接收到的数据,\n保留数据在以下配置中可以自定义")
self.ui.label_filter_schedule_forget_reserve_num.setToolTip("保留最新收到的数据的数量")
+ # 答谢
self.ui.label_thanks_entrance_enable.setToolTip("是否启用欢迎用户进入直播间功能")
- self.ui.label_thanks_gift_enable.setToolTip("是否启用感谢用户赠送礼物功能")
self.ui.label_thanks_entrance_copy.setToolTip("用户进入直播间的相关文案,请勿动 {username},此字符串用于替换用户名")
+ self.ui.label_thanks_gift_enable.setToolTip("是否启用感谢用户赠送礼物功能")
self.ui.label_thanks_gift_copy.setToolTip("用户赠送礼物的相关文案,请勿动 {username} 和 {gift_name},此字符串用于替换用户名和礼物名")
self.ui.label_thanks_lowest_price.setToolTip("设置最低答谢礼物的价格(元),低于这个设置的礼物不会触发答谢")
+ self.ui.label_thanks_follow_enable.setToolTip("是否启用感谢用户关注的功能")
+ self.ui.label_thanks_follow_copy.setToolTip("用户关注时的相关文案,请勿动 {username},此字符串用于替换用户名")
self.ui.label_live2d_enable.setToolTip("启动web服务,用于加载本地Live2D模型")
self.ui.label_live2d_port.setToolTip("web服务运行的端口号,默认:12345,范围:0-65535,没事不要乱改就好")
@@ -764,6 +770,7 @@ def init_config(self):
self.ui.lineEdit_local_qa_audio_file_path.setText(self.local_qa_config['audio']['file_path'])
self.ui.lineEdit_local_qa_audio_similarity.setText(str(self.local_qa_config['audio']['similarity']))
+ # 过滤
tmp_str = ""
for tmp in self.filter_config['before_must_str']:
tmp_str = tmp_str + tmp + "\n"
@@ -782,6 +789,8 @@ def init_config(self):
self.ui.lineEdit_filter_gift_forget_reserve_num.setText(str(self.filter_config['gift_forget_reserve_num']))
self.ui.lineEdit_filter_entrance_forget_duration.setText(str(self.filter_config['entrance_forget_duration']))
self.ui.lineEdit_filter_entrance_forget_reserve_num.setText(str(self.filter_config['entrance_forget_reserve_num']))
+ self.ui.lineEdit_filter_follow_forget_duration.setText(str(self.filter_config['follow_forget_duration']))
+ self.ui.lineEdit_filter_follow_forget_reserve_num.setText(str(self.filter_config['follow_forget_reserve_num']))
self.ui.lineEdit_filter_talk_forget_duration.setText(str(self.filter_config['talk_forget_duration']))
self.ui.lineEdit_filter_talk_forget_reserve_num.setText(str(self.filter_config['talk_forget_reserve_num']))
self.ui.lineEdit_filter_schedule_forget_duration.setText(str(self.filter_config['schedule_forget_duration']))
@@ -791,11 +800,14 @@ def init_config(self):
# 答谢
if self.thanks_config['entrance_enable']:
self.ui.checkBox_thanks_entrance_enable.setChecked(True)
+ self.ui.lineEdit_thanks_entrance_copy.setText(self.thanks_config['entrance_copy'])
if self.thanks_config['gift_enable']:
self.ui.checkBox_thanks_gift_enable.setChecked(True)
- self.ui.lineEdit_thanks_entrance_copy.setText(self.thanks_config['entrance_copy'])
self.ui.lineEdit_thanks_gift_copy.setText(self.thanks_config['gift_copy'])
self.ui.lineEdit_thanks_lowest_price.setText(str(self.thanks_config['lowest_price']))
+ if self.thanks_config['follow_enable']:
+ self.ui.checkBox_thanks_follow_enable.setChecked(True)
+ self.ui.lineEdit_thanks_follow_copy.setText(self.thanks_config['follow_copy'])
if self.live2d_config['enable']:
self.ui.checkBox_live2d_enable.setChecked(True)
@@ -2039,6 +2051,7 @@ def common_textEdit_handle(content):
config_data["local_qa"]["audio"]["file_path"] = self.ui.lineEdit_local_qa_audio_file_path.text()
config_data["local_qa"]["audio"]["similarity"] = round(float(self.ui.lineEdit_local_qa_audio_similarity.text()), 2)
+ # 过滤
config_data["filter"]["before_must_str"] = common_textEdit_handle(self.ui.textEdit_filter_before_must_str.toPlainText())
config_data["filter"]["after_must_str"] = common_textEdit_handle(self.ui.textEdit_filter_after_must_str.toPlainText())
config_data["filter"]["badwords_path"] = self.ui.lineEdit_filter_badwords_path.text()
@@ -2051,6 +2064,8 @@ def common_textEdit_handle(content):
config_data["filter"]["gift_forget_reserve_num"] = int(self.ui.lineEdit_filter_gift_forget_reserve_num.text())
config_data["filter"]["entrance_forget_duration"] = round(float(self.ui.lineEdit_filter_entrance_forget_duration.text()), 2)
config_data["filter"]["entrance_forget_reserve_num"] = int(self.ui.lineEdit_filter_entrance_forget_reserve_num.text())
+ config_data["filter"]["follow_forget_duration"] = round(float(self.ui.lineEdit_filter_follow_forget_duration.text()), 2)
+ config_data["filter"]["follow_forget_reserve_num"] = int(self.ui.lineEdit_filter_follow_forget_reserve_num.text())
config_data["filter"]["talk_forget_duration"] = round(float(self.ui.lineEdit_filter_talk_forget_duration.text()), 2)
config_data["filter"]["talk_forget_reserve_num"] = int(self.ui.lineEdit_filter_talk_forget_reserve_num.text())
config_data["filter"]["schedule_forget_duration"] = round(float(self.ui.lineEdit_filter_schedule_forget_duration.text()), 2)
@@ -2058,10 +2073,12 @@ def common_textEdit_handle(content):
# 答谢
config_data["thanks"]["entrance_enable"] = self.ui.checkBox_thanks_entrance_enable.isChecked()
- config_data["thanks"]["gift_enable"] = self.ui.checkBox_thanks_gift_enable.isChecked()
config_data["thanks"]["entrance_copy"] = self.ui.lineEdit_thanks_entrance_copy.text()
+ config_data["thanks"]["gift_enable"] = self.ui.checkBox_thanks_gift_enable.isChecked()
config_data["thanks"]["gift_copy"] = self.ui.lineEdit_thanks_gift_copy.text()
config_data["thanks"]["lowest_price"] = round(float(self.ui.lineEdit_thanks_lowest_price.text()), 2)
+ config_data["thanks"]["follow_enable"] = self.ui.checkBox_thanks_follow_enable.isChecked()
+ config_data["thanks"]["follow_copy"] = self.ui.lineEdit_thanks_follow_copy.text()
config_data["live2d"]["enable"] = self.ui.checkBox_live2d_enable.isChecked()
live2d_port = self.ui.lineEdit_live2d_port.text()
diff --git a/ui/main.ui b/ui/main.ui
index f771b2ce..84fbc498 100644
--- a/ui/main.ui
+++ b/ui/main.ui
@@ -136,9 +136,9 @@ background-color: rgba(255, 255, 255, 50);
0
- 0
+ -2153
984
- 9724
+ 9894
@@ -965,64 +965,88 @@ background-color: rgba(255, 255, 255, 50);
答谢
- -
-
+
-
+
- 入场文案
+ 礼物文案
- -
-
+
-
+
+
+ -
+
- 礼物文案
+ 入场欢迎
- -
-
+
-
+
- 最低答谢价格
+ 关注文案
- -
-
+
-
+
+
+ 礼物答谢
+
+
- -
-
+
-
+
+
+ 入场文案
+
+
+
+ -
+
启用
- -
+
-
+
+
+ 最低答谢价格
+
+
+
+ -
- -
+
-
- -
-
+
-
+
- 入场欢迎
+ 启用
- -
-
+
-
+
- 礼物答谢
+ 关注答谢
- -
-
+
-
+
启用
+ -
+
+
@@ -1037,30 +1061,69 @@ background-color: rgba(255, 255, 255, 50);
-
+
-
+
+
+ 聊天保留数
+
+
+
-
-
+
- -
-
+
-
+
+
+ -
+
+
+ -
+
+
+ -
+
- 定时遗忘间隔
+ 弹幕保留数
- -
-
+
-
+
- 聊天遗忘间隔
+ 最大单词数
- -
+
-
+
+
+ -
+
+
+ 最大字符数
+
+
+
+ -
+
+
+ -
+
+
+ -
入场保留数
+ -
+
+
+ 聊天遗忘间隔
+
+
+
-
@@ -1068,8 +1131,12 @@ background-color: rgba(255, 255, 255, 50);
- -
-
+
-
+
+
+ 定时遗忘间隔
+
+
-
@@ -1078,51 +1145,44 @@ background-color: rgba(255, 255, 255, 50);
- -
-
-
- -
-
+
-
+
- -
-
+
-
+
- -
-
+
-
+
- 最大单词数
+ 关注遗忘间隔
- -
-
+
-
+
- -
-
+
-
+
- 定时保留数
+ 违禁拼音路径
- -
-
+
-
+
- -
-
+
-
+
- -
-
+
-
+
- 最大字符数
+ 礼物保留数
- -
-
-
- 聊天保留数
-
-
+
-
+
-
@@ -1131,40 +1191,23 @@ background-color: rgba(255, 255, 255, 50);
- -
-
-
- 违禁拼音路径
-
-
-
- -
-
-
- 入场遗忘间隔
-
-
-
-
-
-
- -
-
-
- -
- -
-
+
-
+
- 礼物保留数
+ 弹幕后缀
- -
-
+
-
+
+
+ -
+
- 弹幕后缀
+ 定时保留数
@@ -1175,27 +1218,28 @@ background-color: rgba(255, 255, 255, 50);
- -
-
+
-
+
- -
-
+
-
+
- 弹幕保留数
+ 入场遗忘间隔
- -
-
+
-
+
+
+ 关注保留数
+
+
- -
-
+
-
+
-
-
-
- -
-
+
@@ -2955,8 +2999,8 @@ border-radius: 3px;
0
0
- 359
- 104
+ 652
+ 498
diff --git a/utils/audio.py b/utils/audio.py
index 2e3e6e2b..9281747e 100644
--- a/utils/audio.py
+++ b/utils/audio.py
@@ -249,7 +249,7 @@ def audio_synthesis(self, message):
return
# 只有信息类型是 弹幕,才会进行念用户名
- if message['type'] == "comment":
+ elif message['type'] == "comment":
# 回复时是否念用户名字
if self.config.get("read_user_name", "enable"):
tmp_message = deepcopy(message)
diff --git a/utils/my_handle.py b/utils/my_handle.py
index b4d0dbf3..db3e1aac 100644
--- a/utils/my_handle.py
+++ b/utils/my_handle.py
@@ -1069,6 +1069,39 @@ def entrance_handle(self, data):
logging.error(traceback.format_exc())
+ # 关注处理
+ def follow_handle(self, data):
+ try:
+ # 合并字符串末尾连续的* 主要针对获取不到用户名的情况
+ data['username'] = My_handle.common.merge_consecutive_asterisks(data['username'])
+ # 删除用户名中的特殊字符
+ data['username'] = My_handle.common.replace_special_characters(data['username'], "!!@#¥$%^&*_-+/——=()()【】}|{:;<>~`\\")
+
+ # 违禁处理
+ if self.prohibitions_handle(data['username']):
+ return
+
+ # logging.debug(f"[{data['username']}]: {data['content']}")
+
+ if False == self.thanks_config["follow_enable"]:
+ return
+
+ resp_content = self.thanks_config["follow_copy"].format(username=data["username"])
+
+ message = {
+ "type": "follow",
+ "tts_type": My_handle.audio_synthesis_type,
+ "data": My_handle.config.get(My_handle.audio_synthesis_type),
+ "config": self.filter_config,
+ "user_name": data['username'],
+ "content": resp_content
+ }
+
+ # 音频合成(edge-tts / vits_fast)并播放
+ My_handle.audio.audio_synthesis(message)
+ except Exception as e:
+ logging.error(traceback.format_exc())
+
# 定时处理
def schedule_handle(self, data):
try:
@@ -1091,6 +1124,7 @@ def schedule_handle(self, data):
"""
数据丢弃部分
+ 增加新的处理事件时,需要进行这块部分的内容追加
"""
def process_data(self, data, timer_flag):
with self.data_lock:
@@ -1101,7 +1135,7 @@ def process_data(self, data, timer_flag):
# self.timers[timer_flag].last_data = data
if hasattr(self.timers[timer_flag], 'last_data'):
self.timers[timer_flag].last_data.append(data)
- # 这里需要注意配置命名
+ # 这里需要注意配置命名!!!
if len(self.timers[timer_flag].last_data) > int(My_handle.config.get("filter", timer_flag + "_forget_reserve_num")):
self.timers[timer_flag].last_data.pop(0)
else:
@@ -1124,6 +1158,9 @@ def process_last_data(self, timer_flag):
for data in timer.last_data:
self.entrance_handle(data)
#self.entrance_handle(timer.last_data)
+ elif timer_flag == "follow":
+ for data in timer.last_data:
+ self.follow_handle(data)
elif timer_flag == "talk":
# 聊天暂时共用弹幕处理逻辑
for data in timer.last_data:
@@ -1144,9 +1181,10 @@ def get_interval(self, timer_flag):
"comment": My_handle.config.get("filter", "comment_forget_duration"),
"gift": My_handle.config.get("filter", "gift_forget_duration"),
"entrance": My_handle.config.get("filter", "entrance_forget_duration"),
+ "follow": My_handle.config.get("filter", "follow_forget_duration"),
"talk": My_handle.config.get("filter", "talk_forget_duration"),
"schedule": My_handle.config.get("filter", "schedule_forget_duration")
- # 根据需要添加更多计时器及其间隔
+ # 根据需要添加更多计时器及其间隔,记得添加config.json中的配置项
}
# 默认间隔为0.1秒