🤗 新增群管白名单
This commit is contained in:
@@ -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}到群管白名单`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -103,6 +103,10 @@ class Config {
|
||||
return this.getDefOrConfig('state')
|
||||
}
|
||||
|
||||
get groupAdmin () {
|
||||
return this.getDefOrConfig('groupAdmin')
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认配置和用户配置
|
||||
* @param name
|
||||
|
||||
2
config/default_config/groupAdmin.yaml
Normal file
2
config/default_config/groupAdmin.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
#白名单QQ
|
||||
whiteQQ: [10086 , 114514]
|
||||
Reference in New Issue
Block a user