From c30f0dac9b1ae5677ac313196978e775e5d55325 Mon Sep 17 00:00:00 2001 From: 2y8e9h22 <70102795+2y8e9h22@users.noreply.github.com> Date: Mon, 6 Mar 2023 18:07:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E7=94=A8=E6=9D=A5=E7=A6=81=E7=94=A8=E9=A2=91=E9=81=93?= =?UTF-8?q?=E6=B6=88=E6=81=AF=20(#5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/default_config/other.yaml | 2 ++ lib/config/init.js | 2 +- lib/plugins/loader.js | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) 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()