From 888d10ea6085b1a5bcb244227b530b9805b64171 Mon Sep 17 00:00:00 2001 From: NekoRabi <1215791340@qq.com> Date: Sun, 6 Nov 2022 16:29:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E7=A7=81=E8=81=8A?= =?UTF-8?q?=E6=9C=BA=E5=99=A8=E4=BA=BA=E9=A2=91=E7=B9=81=E5=8F=91=E9=80=81?= =?UTF-8?q?"=E6=97=A0=E6=9D=83=E9=99=90"=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/fun/admin_controller.py | 32 +++++++++++++++----------------- plugin/__init__.py | 3 +++ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/core/fun/admin_controller.py b/core/fun/admin_controller.py index 0a67940..033ffaa 100644 --- a/core/fun/admin_controller.py +++ b/core/fun/admin_controller.py @@ -29,11 +29,11 @@ @bot.on(FriendMessage) async def addadmin(event: FriendMessage): """添加管理员""" - if event.sender.id == master: - msg = "".join(map(str, event.message_chain[Plain])) - m = re.match( - fr"^{commandpre}{commands_map['sys']['addadmin']}", msg.strip()) - if m: + msg = "".join(map(str, event.message_chain[Plain])) + m = re.match( + fr"^{commandpre}{commands_map['sys']['addadmin']}", msg.strip()) + if m: + if event.sender.id == master: qqid = int(m.group(1)) if qqid not in admin: admin.append(qqid) @@ -41,21 +41,19 @@ async def addadmin(event: FriendMessage): await messagechain_sender(event=event, msg=f"已将 {m.group(1)} 添加为机器人管理员") else: await messagechain_sender(event=event, msg=f"{m.group(1)} 已经是管理员了") - - else: - await messagechain_sender(event=event, msg=await messagechain_builder(text="抱歉,您无权这么做哦", rndimg=True)) - + else: + await messagechain_sender(event=event, msg=await messagechain_builder(text="抱歉,您无权这么做哦", rndimg=True)) return @bot.on(FriendMessage) async def deladmin(event: FriendMessage): """删除管理员""" - if event.sender.id == master: - msg = "".join(map(str, event.message_chain[Plain])) - m = re.match( - fr"^{commandpre}{commands_map['sys']['deladmin']}", msg.strip()) - if m: + msg = "".join(map(str, event.message_chain[Plain])) + m = re.match( + fr"^{commandpre}{commands_map['sys']['deladmin']}", msg.strip()) + if m: + if event.sender.id == master: qqid = int(m.group(1)) if qqid in admin: admin.remove(qqid) @@ -63,8 +61,8 @@ async def deladmin(event: FriendMessage): return await messagechain_sender(event=event, msg=f"已将 {m.group(1)} 从机器人管理员中移出") else: return await messagechain_sender(event=event, msg=f"{m.group(1)} 不是再管理员了") - else: - await bot.send(event, await messagechain_builder(text="抱歉,您无权这么做哦", rndimg=True)) + else: + await bot.send(event, await messagechain_builder(text="抱歉,您无权这么做哦", rndimg=True)) return @@ -149,8 +147,8 @@ async def tell_to_master(event: GroupMessage): msg = "".join(map(str, event.message_chain[Plain])) m = re.match( fr"^{commandpre}{commands_map['sys']['tell_master']}", msg.strip()) - qqid = event.sender.id if m: + qqid = event.sender.id if qqid in _black_list: return await bot.send(event, await messagechain_builder(text='你已被列入黑名单,禁止使用该功能')) if master != 0: diff --git a/plugin/__init__.py b/plugin/__init__.py index 268ab81..2d33546 100644 --- a/plugin/__init__.py +++ b/plugin/__init__.py @@ -21,6 +21,7 @@ print('\n所有插件加载完毕') logging.info('所有插件加载完毕') + # 'Else' # from plugin.AlarmClock import * @@ -28,10 +29,12 @@ # from plugin.BilibiliPlugin import * # from plugin.draw_wife import * # from plugin.ImgGenerator import * +# from plugin.LocalImageAutoSender import * # from plugin.MajSoulInfo import * # from plugin.paili_analysis import * # from plugin.Petpet import * # from plugin.Remake import * +# from plugin.RichiMahjongMatchControl import * # from plugin.Setu import * # from plugin.Tarot import * # from plugin.TencentCloudAPI import *