From 12f7f2f77d366382db24dfe2439682a2489aac07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wuyi=E6=97=A0=E7=96=91?= <444835641@qq.com> Date: Thu, 30 Dec 2021 23:08:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=BC=80=E5=90=AF&?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E8=87=AA=E5=8A=A8=E7=AD=BE=E5=88=B0/?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E6=9C=8D=E5=8A=A1=EF=BC=8C=E5=8F=AF=E7=94=B1?= =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86=E5=91=98=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __init__.py | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/__init__.py b/__init__.py index 73ac311d..9652838a 100644 --- a/__init__.py +++ b/__init__.py @@ -311,10 +311,20 @@ async def setting(ctx): async def _(bot:HoshinoBot, ev: CQEvent): message = ev.message.extract_plain_text() m = ''.join(re.findall('[\u4e00-\u9fa5]',message)) + + qid = ev.sender["user_id"] + at = re.search(r"\[CQ:at,qq=(\d*)\]", message) + if m == "自动签到": try: + if at and ev.user_id in bot.config.SUPERUSERS: + qid = at.group(1) + elif at and at.group(1) != qid: + await bot.send(ev,"你没有权限。",at_sender=True) + return + else: + pass gid = ev.group_id - qid = ev.sender["user_id"] uid = await selectDB(ev.sender['user_id'],mode = "uid") im = await OpenPush(int(uid[0]),ev.sender['user_id'],str(gid),"StatusB") await bot.send(ev,im,at_sender=True) @@ -322,8 +332,14 @@ async def _(bot:HoshinoBot, ev: CQEvent): await bot.send(ev,"未绑定uid信息!",at_sender=True) elif m == "推送": try: + if at and ev.user_id in bot.config.SUPERUSERS: + qid = at.group(1) + elif at and at.group(1) != qid: + await bot.send(ev,"你没有权限。",at_sender=True) + return + else: + pass gid = ev.group_id - qid = ev.sender["user_id"] uid = await selectDB(ev.sender['user_id'],mode = "uid") im = await OpenPush(int(uid[0]),ev.sender['user_id'],str(gid),"StatusA") await bot.send(ev,im,at_sender=True) @@ -335,10 +351,20 @@ async def _(bot:HoshinoBot, ev: CQEvent): async def _(bot:HoshinoBot, ev: CQEvent): message = ev.message.extract_plain_text() m = ''.join(re.findall('[\u4e00-\u9fa5]',message)) + + qid = ev.sender["user_id"] + at = re.search(r"\[CQ:at,qq=(\d*)\]", message) + if m == "自动签到": try: + if at and ev.user_id in bot.config.SUPERUSERS: + qid = at.group(1) + elif at and at.group(1) != qid: + await bot.send(ev,"你没有权限。",at_sender=True) + return + else: + pass gid = ev.group_id - qid = ev.sender["user_id"] uid = await selectDB(ev.sender['user_id'],mode = "uid") im = await OpenPush(int(uid[0]),ev.sender['user_id'],"off","StatusB") await bot.send(ev,im,at_sender=True) @@ -346,8 +372,14 @@ async def _(bot:HoshinoBot, ev: CQEvent): await bot.send(ev,"未绑定uid信息!",at_sender=True) elif m == "推送": try: + if at and ev.user_id in bot.config.SUPERUSERS: + qid = at.group(1) + elif at and at.group(1) != qid: + await bot.send(ev,"你没有权限。",at_sender=True) + return + else: + pass gid = ev.group_id - qid = ev.sender["user_id"] uid = await selectDB(ev.sender['user_id'],mode = "uid") im = await OpenPush(int(uid[0]),ev.sender['user_id'],"off","StatusA") await bot.send(ev,im,at_sender=True)