添加一个设置用来禁用频道消息 (#5)

This commit is contained in:
2y8e9h22 2023-03-06 18:07:30 +08:00 committed by GitHub
parent 9502bd3ddc
commit c30f0dac9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -5,6 +5,8 @@ autoQuit: 50
# 主人QQ号 # 主人QQ号
masterQQ: masterQQ:
# 禁用频道功能 true: 不接受频道消息flase接受频道消息
disableGuildMsg: true
# 禁用私聊功能 true私聊只接受ck以及抽卡链接Bot主人不受限制false私聊可以触发全部指令默认false # 禁用私聊功能 true私聊只接受ck以及抽卡链接Bot主人不受限制false私聊可以触发全部指令默认false
disablePrivate: false disablePrivate: false
# 禁用私聊Bot提示内容 # 禁用私聊Bot提示内容

View File

@ -33,7 +33,7 @@ await checkInit()
async function checkInit () { async function checkInit () {
/** 检查node_modules */ /** 检查node_modules */
if (!fs.existsSync('./node_modules') || !fs.existsSync('./node_modules/icqq')) { if (!fs.existsSync('./node_modules') || !fs.existsSync('./node_modules/icqq')) {
console.log('请先npm install安装') console.log('请先运行命令pnpm install 安装依赖')
process.exit() process.exit()
} }

View File

@ -159,6 +159,8 @@ class PluginsLoader {
* @param e icqq Events * @param e icqq Events
*/ */
async deal (e) { async deal (e) {
/** 检查频道消息 */
if (this.checkGuildMsg(e)) return
/** 检查黑白名单 */ /** 检查黑白名单 */
if (!this.checkBlack(e)) return if (!this.checkBlack(e)) return
/** 冷却 */ /** 冷却 */
@ -659,6 +661,11 @@ class PluginsLoader {
return false return false
} }
/** 判断频道消息 */
checkGuildMsg (e) {
return cfg.getOther().disableGuildMsg && e.detail_type == 'guild'
}
/** 判断黑白名单 */ /** 判断黑白名单 */
checkBlack (e) { checkBlack (e) {
let other = cfg.getOther() let other = cfg.getOther()