fix(desktop): bundle cli command modules

This commit is contained in:
zhayujie
2026-06-30 10:03:12 +08:00
parent fd90a89b45
commit 0a762b8c08
2 changed files with 30 additions and 6 deletions

View File

@@ -37,13 +37,16 @@ class Banwords(Plugin):
self.searchr = WordsSearch()
self.action = conf["action"]
# banwords.txt is gitignored / not shipped by default; treat a
# missing file as an empty ban list instead of failing to init.
banwords_path = os.path.join(curdir, "banwords.txt")
with open(banwords_path, "r", encoding="utf-8") as f:
words = []
for line in f:
word = line.strip()
if word:
words.append(word)
words = []
if os.path.exists(banwords_path):
with open(banwords_path, "r", encoding="utf-8") as f:
for line in f:
word = line.strip()
if word:
words.append(word)
self.searchr.SetKeywords(words)
self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context
if conf.get("reply_filter", True):