diff --git a/config/default_config/other.yaml b/config/default_config/other.yaml index 4a2183e..a4d62e7 100644 --- a/config/default_config/other.yaml +++ b/config/default_config/other.yaml @@ -5,6 +5,8 @@ autoQuit: 50 # 主人QQ号 masterQQ: +# 禁用频道功能 true: 不接受频道消息,flase:接受频道消息 +disableGuildMsg: true # 禁用私聊功能 true:私聊只接受ck以及抽卡链接(Bot主人不受限制),false:私聊可以触发全部指令,默认false disablePrivate: false # 禁用私聊Bot提示内容 diff --git a/lib/config/init.js b/lib/config/init.js index f66c8a9..e6f4a6d 100644 --- a/lib/config/init.js +++ b/lib/config/init.js @@ -33,7 +33,7 @@ await checkInit() async function checkInit () { /** 检查node_modules */ if (!fs.existsSync('./node_modules') || !fs.existsSync('./node_modules/icqq')) { - console.log('请先npm install安装') + console.log('请先运行命令:pnpm install 安装依赖') process.exit() } diff --git a/lib/plugins/loader.js b/lib/plugins/loader.js index d12b64e..a376cdd 100644 --- a/lib/plugins/loader.js +++ b/lib/plugins/loader.js @@ -159,6 +159,8 @@ class PluginsLoader { * @param e icqq Events */ async deal (e) { + /** 检查频道消息 */ + if (this.checkGuildMsg(e)) return /** 检查黑白名单 */ if (!this.checkBlack(e)) return /** 冷却 */ @@ -659,6 +661,11 @@ class PluginsLoader { return false } + /** 判断频道消息 */ + checkGuildMsg (e) { + return cfg.getOther().disableGuildMsg && e.detail_type == 'guild' + } + /** 判断黑白名单 */ checkBlack (e) { let other = cfg.getOther()