mirror of
https://github.com/langbot-app/LangBot.git
synced 2025-11-25 11:29:39 +08:00
feat: 支持设置全局群聊、私聊禁用
This commit is contained in:
@@ -102,6 +102,9 @@ class QQBotManager:
|
||||
|
||||
enable_banlist = False
|
||||
|
||||
enable_private = True
|
||||
enable_group = True
|
||||
|
||||
ban_person = []
|
||||
ban_group = []
|
||||
|
||||
@@ -242,6 +245,11 @@ class QQBotManager:
|
||||
self.ban_group = banlist.group
|
||||
logging.info("加载禁用列表: person: {}, group: {}".format(self.ban_person, self.ban_group))
|
||||
|
||||
if hasattr(banlist, "enable_private"):
|
||||
self.enable_private = banlist.enable_private
|
||||
if hasattr(banlist, "enable_group"):
|
||||
self.enable_group = banlist.enable_group
|
||||
|
||||
config = pkg.utils.context.get_config()
|
||||
if os.path.exists("sensitive.json") \
|
||||
and config.sensitive_word_filter is not None \
|
||||
@@ -269,7 +277,9 @@ class QQBotManager:
|
||||
import config
|
||||
reply = ''
|
||||
|
||||
if event.sender.id == self.bot_account_id:
|
||||
if not self.enable_private:
|
||||
logging.debug("已在banlist.py中禁用所有私聊")
|
||||
elif event.sender.id == self.bot_account_id:
|
||||
pass
|
||||
else:
|
||||
if Image in event.message_chain:
|
||||
@@ -343,7 +353,9 @@ class QQBotManager:
|
||||
|
||||
return replys
|
||||
|
||||
if Image in event.message_chain:
|
||||
if not self.enable_group:
|
||||
logging.debug("已在banlist.py中禁用所有群聊")
|
||||
elif Image in event.message_chain:
|
||||
pass
|
||||
else:
|
||||
if At(self.bot_account_id) in event.message_chain and response_at(event.group.id):
|
||||
|
||||
Reference in New Issue
Block a user