🤗 新增白名单被禁言自动解禁

This commit is contained in:
等风来
2024-04-03 06:12:36 +08:00
committed by 🌌
parent 18787afa72
commit ade970b891
3 changed files with 35 additions and 2 deletions

View File

@@ -141,9 +141,24 @@ Bot.on?.('notice.group', async (e) => {
}
break
}
// 禁言 (这里仅处理机器人被禁言)
// 禁言
case 'ban': {
const forbiddenTime = formatDuration(e.duration, 'default')
/** 处理白名单禁言 */
const { groupAdmin } = Config
const isMaster = Config.masterQQ?.includes(e.operator_id) || e.operator_id === (e.bot ?? Bot).uin
const isWhiteUser = groupAdmin.whiteQQ.includes(e.user_id)
if (
isWhiteUser &&
!isMaster &&
groupAdmin.noBan &&
(e.group.is_admin || e.group.is_owner) &&
e.duration !== 0
) {
await e.group.muteMember(e.user_id, 0)
e.reply('已解除白名单用户的禁言')
}
if (!Config.getGroup(e.group_id).botBeenBanned) return false

View File

@@ -151,6 +151,10 @@ export class GroupAdmin extends plugin {
{
reg: '^#?群管(加|删)白(名单)?',
fnc: 'whiteQQ'
},
{
reg: '^#?(开启|关闭)白名单(自动)?解禁',
fnc: 'noBan'
}
]
})
@@ -731,4 +735,16 @@ export class GroupAdmin extends plugin {
Config.modifyarr('groupAdmin', 'whiteQQ', qq, type)
this.reply(`✅ 已${type == 'add' ? '加入' : '删除'}${qq}到群管白名单`)
}
async noBan () {
if (!common.checkPermission(this.e, 'master')) return
let type = !!/开启/.test(this.e.msg)
const { noBan } = Config.groupAdmin
if (noBan && type) return this.reply('❎ 白名单自动解禁已处于开启状态')
if (!noBan && !type) return this.reply('❎ 白名单自动解禁已处于关闭状态')
Config.modify('groupAdmin', 'noBan', type)
this.reply(`✅ 已${type ? '开启' : '关闭'}白名单自动解禁`)
}
}

View File

@@ -1,2 +1,4 @@
#白名单QQ
whiteQQ: [10086 , 114514]
whiteQQ: []
#白名单禁言自动解禁
noBan: false