diff --git a/apps/groupAdmin/groupAdmin.js b/apps/groupAdmin/groupAdmin.js index 31f275b..53b6730 100644 --- a/apps/groupAdmin/groupAdmin.js +++ b/apps/groupAdmin/groupAdmin.js @@ -147,6 +147,10 @@ export class GroupAdmin extends plugin { { reg: '^#?(加|设|移)精$', fnc: 'essenceMessage' + }, + { + reg: '^#?群管(加|删)白(名单)?', + fnc: 'whiteQQ' } ] }) @@ -714,4 +718,17 @@ export class GroupAdmin extends plugin { } e.reply(res || `${isAdd}精失败`) } + + async whiteQQ () { + if (!common.checkPermission(this.e, 'master')) return + let type = /加/.test(this.e.msg) ? 'add' : 'del' + let qq = this.e.at || (this.e.msg.match(/\d+/)?.[0] || '') + + const isWhite = Config.groupAdmin.whiteQQ.includes(Number(qq)) + if (isWhite && type == 'add') return this.reply('❎ 此人已在群管白名单内') + if (!isWhite && type == 'del') return this.reply('❎ 此人未在群管白名单中') + + Config.modifyarr('groupAdmin', 'whiteQQ', qq, type) + this.reply(`✅ 已${type == 'add' ? '加入' : '删除'}${qq}到群管白名单`) + } } diff --git a/apps/groupAdmin/groupBannedWords.js b/apps/groupAdmin/groupBannedWords.js index ad419d8..8567d51 100644 --- a/apps/groupAdmin/groupBannedWords.js +++ b/apps/groupAdmin/groupBannedWords.js @@ -1,4 +1,5 @@ import { common, GroupBannedWords } from '../../model/index.js' +import { Config } from '../../components/index.js' import _ from 'lodash' export class NewGroupBannedWords extends plugin { @@ -47,7 +48,8 @@ export class NewGroupBannedWords extends plugin { } async monitor (e) { - if (!e.message || e.isMaster || e.member?.is_owner || e.member?.is_admin) { + const isWhite = Config.groupAdmin.whiteQQ.includes(e.user_id) + if (!e.message || e.isMaster || e.member?.is_owner || e.member?.is_admin || isWhite) { return false } const groupBannedWords = GroupBannedWords.initTextArr(e.group_id) diff --git a/apps/groupAdmin/groupVerify.js b/apps/groupAdmin/groupVerify.js index bb42b1e..621c756 100644 --- a/apps/groupAdmin/groupVerify.js +++ b/apps/groupAdmin/groupVerify.js @@ -137,6 +137,7 @@ Bot.on?.('notice.group.increase', async (e) => { if (!e.group.is_admin && !e.group.is_owner) return if (e.user_id == (e.bot ?? Bot).uin) return if (Config.masterQQ.includes(e.user_id)) return + if (Config.groupAdmin.whiteQQ.includes(e.user_id)) return await sleep(DelayTime * 1000) await verify(e.user_id, e.group_id, e) diff --git a/components/Config.js b/components/Config.js index 38dbb0d..45252b2 100644 --- a/components/Config.js +++ b/components/Config.js @@ -103,6 +103,10 @@ class Config { return this.getDefOrConfig('state') } + get groupAdmin () { + return this.getDefOrConfig('groupAdmin') + } + /** * 默认配置和用户配置 * @param name diff --git a/config/default_config/groupAdmin.yaml b/config/default_config/groupAdmin.yaml new file mode 100644 index 0000000..9547f82 --- /dev/null +++ b/config/default_config/groupAdmin.yaml @@ -0,0 +1,2 @@ +#白名单QQ +whiteQQ: [10086 , 114514] \ No newline at end of file