feat: 支持更换敏感词的掩盖字符

This commit is contained in:
Rock Chin
2023-03-06 15:07:10 +08:00
parent 2541acf9d2
commit 9d73770a4e
3 changed files with 10 additions and 3 deletions
+5 -1
View File
@@ -82,7 +82,11 @@ class QQBotManager:
and config.sensitive_word_filter is not None \
and config.sensitive_word_filter:
with open("sensitive.json", "r", encoding="utf-8") as f:
self.reply_filter = pkg.qqbot.filter.ReplyFilter(json.load(f)['words'])
sensitive_json = json.load(f)
self.reply_filter = pkg.qqbot.filter.ReplyFilter(
sensitive_words=sensitive_json['words'],
mask=sensitive_json['mask'] if 'mask' in sensitive_json else '*'
)
else:
self.reply_filter = pkg.qqbot.filter.ReplyFilter([])