From c8c8dd5a46255ad317cb563d87b387c2e73f1bae Mon Sep 17 00:00:00 2001 From: yeyang <746659424@qq.com> Date: Mon, 8 Apr 2024 18:16:38 +0800 Subject: [PATCH] =?UTF-8?q?=E2=8F=AA=20=E5=9B=9E=E9=80=80`#=E6=88=91?= =?UTF-8?q?=E8=A6=81=E8=87=AA=E9=97=AD`=E5=8A=9F=E8=83=BD=20closes=20=20#1?= =?UTF-8?q?10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/groupAdmin/groupAdmin.js | 23 +++++++++++++++++++++++ config/system/gpAdmin_system.js | 5 +++++ 2 files changed, 28 insertions(+) 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 } ] }, {