diff --git a/apps/groupAdmin/groupAdmin.js b/apps/groupAdmin/groupAdmin.js index cfa0d6f..99eb984 100644 --- a/apps/groupAdmin/groupAdmin.js +++ b/apps/groupAdmin/groupAdmin.js @@ -13,6 +13,8 @@ const TimeUnitReg = Object.keys(Time_unit).join("|") /** 清理多久没发言的人正则 */ const noactivereg = new RegExp(`^#(查看|清理|确认清理|获取)(${Numreg})个?(${TimeUnitReg})没发言的人(第(${Numreg})页)?$`) +/** 我要自闭正则 */ +const Autisticreg = new RegExp(`^#?我要(自闭|禅定)(${Numreg})?个?(${TimeUnitReg})?$`, "i") // 获取定时任务 const redisTask = await Ga.getRedisMuteTask() || false export class GroupAdmin extends plugin { @@ -149,6 +151,10 @@ export class GroupAdmin extends plugin { { reg: "^#?(开启|关闭)白名单(自动)?解禁", fnc: "noBan" + }, + { + reg: Autisticreg, // 我要自闭 + fnc: "Autistic" } ] }) @@ -702,6 +708,23 @@ export class GroupAdmin extends plugin { e.reply(res || `${isAdd}精失败`) } + // 我要自闭 + async Autistic(e) { + // 判断是否有管理 + if (!e.group.is_admin && !e.group.is_owner) return + if (e.isMaster) return e.reply("别自闭啦~~", true) + if (e.member.is_admin && !e.group.is_owner) return e.reply("别自闭啦~~", true) + // 解析正则 + let regRet = Autisticreg.exec(e.msg) + // 获取数字 + let TabooTime = translateChinaNum(regRet[2] || 5) + + let Company = Time_unit[_.toUpper(regRet[3]) || "分"] + + await e.group.muteMember(e.user_id, TabooTime * Company) + e.reply("那我就不手下留情了~", true) + } + /** * 加白名单 */ diff --git a/config/system/gpAdmin_system.js b/config/system/gpAdmin_system.js index 655fa73..d435530 100644 --- a/config/system/gpAdmin_system.js +++ b/config/system/gpAdmin_system.js @@ -123,6 +123,11 @@ export const helpList = [ title: "#加|移精", desc: "回复消息进行加/移精", icon: 18 + }, + { + title: "#我要自闭 <时间>", + desc: "自闭一会", + icon: 20 } ] }, {