From 154defbc62fbdd64a592cdc7c98961746f7c849a Mon Sep 17 00:00:00 2001 From: Schwarzwald Date: Sun, 23 Jul 2023 21:51:13 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E6=96=B0=E5=A2=9Eevent=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_eventmonitor/__init__.py | 178 +++--------------------- 1 file changed, 18 insertions(+), 160 deletions(-) diff --git a/nonebot_plugin_eventmonitor/__init__.py b/nonebot_plugin_eventmonitor/__init__.py index 443694a..a18d1ef 100644 --- a/nonebot_plugin_eventmonitor/__init__.py +++ b/nonebot_plugin_eventmonitor/__init__.py @@ -1,171 +1,29 @@ -import nonebot -from nonebot.rule import Rule -from nonebot.plugin import on_notice, on_command -from nonebot.permission import SUPERUSER -from nonebot.adapters.onebot.v11.permission import GROUP_OWNER, GROUP_ADMIN -from nonebot.adapters.onebot.v11 import ( - Bot, Event, Message, - PokeNotifyEvent, - HonorNotifyEvent, - GroupUploadNoticeEvent, - GroupDecreaseNoticeEvent, - GroupIncreaseNoticeEvent, - GroupAdminNoticeEvent, - LuckyKingNotifyEvent, - MessageSegment, - GroupMessageEvent -) +import contextlib -from .stamp import chuo_send_msg -from .honour import monitor_rongyu -from .admin import del_user_bye, add_user_wecome, admin_changer from .utils import * -# 获取戳一戳状态 -async def _is_poke(event: Event) -> bool: - return isinstance(event, PokeNotifyEvent) and event.is_tome() -# 获取群荣誉变更 -async def _is_rongyu(event: Event) -> bool: - return isinstance(event, HonorNotifyEvent) -# 获取文件上传 -async def _is_checker(event: Event) -> bool: - return isinstance(event, GroupUploadNoticeEvent) -# 群成员减少 -async def _is_del_user(event: Event) -> bool: - return isinstance(event, GroupDecreaseNoticeEvent) -# 群成员增加 -async def _is_add_user(event: Event) -> bool: - return isinstance(event, GroupIncreaseNoticeEvent) -# 管理员变动 -async def _is_admin_change(event: Event) -> bool: - return isinstance(event, GroupAdminNoticeEvent) -# 红包运气王 -async def _is_red_packet(event: Event) -> bool: - return isinstance(event, LuckyKingNotifyEvent) - -# 戳一戳 -chuo = on_notice(Rule(_is_poke), priority=50, block=True) -# 群荣誉 -qrongyu = on_notice(Rule(_is_rongyu), priority=50, block=True) -# 群文件 -files = on_notice(Rule(_is_checker), priority=50, block=True) -# 群员减少 -del_user = on_notice(Rule(_is_del_user), priority=50, block=True) -# 群员增加 -add_user = on_notice(Rule(_is_add_user), priority=50, block=True) -# 群管理 -group_admin = on_notice(Rule(_is_admin_change), priority=50, block=True) -# 红包 -red_packet = on_notice(Rule(_is_red_packet), priority=50, block=True) - -switch_command = on_command("开启", aliases={"关闭"}, permission=SUPERUSER | GROUP_ADMIN | GROUP_OWNER, - priority=1, block=True) +#初始化配置配置文件 @driver.on_bot_connect async def _(): await init(g_temp) await config_check() - - -@chuo.handle() -async def send_chuo(event: PokeNotifyEvent): - if not (await check_chuo(g_temp, str(event.group_id))): - await chuo.finish(notAllow, at_sender=True) - uid = event.get_user_id() # 获取用户id - try: - cd = event.time - chuo_CD_dir[uid] # 计算cd - except KeyError: - cd = chuo_cd + 1 # 没有记录则cd为cd_time+1 - if ( - cd > chuo_cd - or event.get_user_id() in nonebot.get_driver().config.superusers - ): # 记录cd - chuo_CD_dir.update({uid: event.time}) - rely_msg = await chuo_send_msg() - await chuo.finish(message=Message(rely_msg)) - -@qrongyu.handle() #群荣誉变化 -async def send_rongyu(event: HonorNotifyEvent, bot: Bot): - if not (await check_honor(g_temp, str(event.group_id))): - await qrongyu.finish(notAllow, at_sender=True) - bot_qq = int(bot.self_id) - rely_msg = await monitor_rongyu(event.honor_type, event.user_id, bot_qq) - await qrongyu.finish(message=Message(rely_msg)) - -@files.handle() #上传群文件 -async def handle_first_receive(event: GroupUploadNoticeEvent): - if not (await check_file(g_temp, str(event.group_id))): - await files.finish(notAllow, at_sender=True) - rely = MessageSegment.at(event.user_id) + '\n' + \ - MessageSegment.image(f'https://q4.qlogo.cn/headimg_dl?dst_uin={event.user_id}&spec=640') + \ - '\n 上传了新文件,感谢你一直为群里做贡献喵~' + MessageSegment.face(175) - await files.finish(message=rely) - -@del_user.handle() #退群事件 -async def user_bye(event: GroupDecreaseNoticeEvent): - if not (await check_del_user(g_temp, str(event.group_id))): - await del_user.finish(notAllow, at_sender=True) - rely_msg = await del_user_bye(event.time, event.user_id) - await del_user.finish(message=Message(rely_msg)) - - -@add_user.handle() #入群事件 -async def user_welcome(event: GroupIncreaseNoticeEvent, bot: Bot): - if not (await check_add_user(g_temp, str(event.group_id))): - await add_user.finish(notAllow, at_sender=True) - bot_qq = int(bot.self_id) - rely_msg = await add_user_wecome(event.time, event.user_id, bot_qq) - await add_user.finish(message=Message(rely_msg)) - - -@group_admin.handle() #管理员变动 -async def admin_chance(event: GroupAdminNoticeEvent, bot: Bot): - if not (await check_admin(g_temp, str(event.group_id))): - await group_admin.finish(notAllow, at_sender=True) - bot_qq = int(bot.self_id) - rely_msg = await admin_changer(event.sub_type, event.user_id, bot_qq) - await group_admin.finish(message=Message(rely_msg)) - -@red_packet.handle() #红包运气王 -async def hongbao(event: LuckyKingNotifyEvent): - if not (await check_red_package(g_temp, str(event.group_id))): - await red_packet.finish(notAllow, at_sender=True) - rely_msg = MessageSegment.at(event.user_id) + "\n" + "本次红包运气王为:" + MessageSegment.at(event.target_id) - await red_packet.finish(message=rely_msg) - - -def get_command_type(command: str) -> str: - """根据指令内容获取开关类型""" - return next( - ( - key - for key, keywords in path.items() - if any(keyword in command for keyword in keywords) - ), - "", - ) -@switch_command.handle() -async def switch(event: GroupMessageEvent): - # 获取开关指令的参数,即用户输入的指令内容 - command = str(event.get_message()).strip() - # 获取群组ID - gid = str(event.group_id) - # 判断指令是否包含"开启"或"关闭"关键字 - if "开启" in command or "开始" in command: - if key := get_command_type(command): - g_temp[gid][key] = True - write_group_data(g_temp) - name = get_function_name(key) - await switch_command.finish(f"{name}功能已开启喵") - elif "禁止" in command or "关闭" in command: - if key := get_command_type(command): - g_temp[gid][key] = False - write_group_data(g_temp) - name = get_function_name(key) - await switch_command.finish(f"{name}功能已禁用喵") -def get_function_name(key: str) -> str: - """根据关键词获取对应功能名称""" - return path[key][0] \ No newline at end of file +with contextlib.suppress(Exception): + from nonebot.plugin import PluginMetadata + + __plugin_meta__ = PluginMetadata( + name="eventmonitor", + description="监控群事件的插件,支持戳一戳,成员变动,群荣誉变化等提示的插件", + usage=utils.usage, + type="application", + homepage="https://github.com/Reversedeer/nonebot_plugin_eventmonitor", + supported_adapters={"onebot.v11"}, + extra={ + "author": "Reversedeer", + "version": "0.1.8", + "priority": 50, + }, + ) \ No newline at end of file From 4cb337f0e0cf68ef5e9a77464ff464933879d3ca Mon Sep 17 00:00:00 2001 From: Schwarzwald Date: Sun, 23 Jul 2023 21:52:25 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dfiles=E5=AD=97=E6=AF=8D?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils.py | 188 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 utils.py diff --git a/utils.py b/utils.py new file mode 100644 index 0000000..008cfd9 --- /dev/null +++ b/utils.py @@ -0,0 +1,188 @@ +import os +import nonebot +import json +from pathlib import Path +from typing import Optional + +g_temp = {} +config_path = Path() / 'data/eventmonitor' +address = config_path / 'config.json' + +async def init(g_temp): + """ + 初始化配置文件 + :return: + """ + # 如果数据文件路径不存在,则创建目录,并初始化群组数据为空字典,并写入对应的文件 + if not os.path.exists(config_path): + os.makedirs(config_path) + if os.path.exists(address): + # 如果数据文件路径存在,尝试读取数据文件(config.json) + with open(address, "r", encoding="utf-8") as f: + g_temp.update(json.load(f)) + else: + # 如果群数据文件不存在,则初始化g_temp为空字典,并写入对应的文件 + bot = nonebot.get_bot() + group_list = (await bot.get_group_list()) + #从group_list中遍历每个群组 + for group in group_list: + # 为每个群组创建一个临时字典temp,用于存储群组的配置信息 + temp = {} + for g_name in path: + # 将群组的每个配置项设置为默认值True + temp[g_name] = True + # 特殊情况下(g_name为'red_package'),将该配置项设为False + if g_name in ['red_package']: + temp[g_name] = False + # 获取群组ID并转换为字符串类型 + gid = str(group["group_id"]) + # 将临时字典temp作为值,群组ID作为键,添加到g_temp字典中 + g_temp[gid] = temp + # 将更新后的g_temp字典写入群组数据 + write_group_data(g_temp) + + +async def config_check(): + # 获取机器人实例 + bot = nonebot.get_bot() + # 获取所有群组的列表 + group_list = (await bot.get_group_list()) + # 加载配置文件,得到一个包含配置信息的字典 + config_dict = json_load(address) + # 遍历所有群组 + for group in group_list: + gid = str(group['group_id']) + # 如果配置字典中没有该群组的信息,将其添加到配置字典中 + if not config_dict.get(gid): + config_dict[gid] = {} + # 遍历配置文件路径中的所有配置项,并初始化为默认值 + for group_name in path: + config_dict[gid][group_name] = True + # 特殊情况下(group_name为'red_package'),将该配置项设为False + if group_name in ['red_package']: + config_dict[gid][group_name] = False + else: + # 如果配置字典中已存在该群组的信息,检查是否有缺失的配置项,并添加默认值 + other_group = config_dict[gid] + for group_name in path: + if other_group.get(group_name) is None: + other_group[gid][group_name] = True + # 特殊情况下(group_name为'red_package'),将该配置项设为False + if group_name in ['red_package']: + other_group[gid][group_name] = False + + # 将更新后的配置字典上传到配置文件中 + json_upload(address, config_dict) + + +def json_load(path) -> Optional[dict]: + """ + 加载json文件 + :return: Optional[dict] + """ + try: + with open(path, mode='r', encoding='utf-8') as f: + return json.load(f) + except FileNotFoundError: + return None + + +def json_upload(path, dict_content) -> None: + """ + 更新json文件 + :param path: 路径 + :param dict_content: python对象,字典 + """ + with open(path, mode='w', encoding='utf-8') as c: + c.write(json.dumps(dict_content, ensure_ascii=False, indent=4)) + + +#写入群配置 +def write_group_data(g_temp): + with open('data/eventmonitor/config.json', 'w', encoding='utf-8') as f: + json.dump(g_temp, f, indent=4, ensure_ascii=False) + + +#检查戳一戳是否允许 +async def check_chuo(g_temp, gid: str) -> bool: + if gid in g_temp and not g_temp[gid]["chuo"]: + return False + return g_temp[gid]["chuo"] + +#检查群荣誉是否允许 +async def check_honor(g_temp, gid: str) -> bool: + if gid in g_temp and not g_temp[gid]["honor"]: + return False + return g_temp[gid]["honor"] + +#检查群文件是否允许 +async def check_file(g_temp, gid: str) -> bool: + if gid in g_temp and not g_temp[gid]["files"]: + return False + return g_temp[gid]["files"] + +#检查群成员减少是否允许 +async def check_del_user(g_temp, gid: str) -> bool: + if gid in g_temp and not g_temp[gid]["del_user"]: + return False + return g_temp[gid]["del_user"] + +#检查群成员增加是否允许 +async def check_add_user(g_temp, gid: str) -> bool: + if gid in g_temp and not g_temp[gid]["add_user"]: + return False + return g_temp[gid]["add_user"] + +#检查管理员是否允许 +async def check_admin(g_temp, gid: str) -> bool: + if gid in g_temp and not g_temp[gid]["admin"]: + return False + return g_temp[gid]["admin"] + +#检查运气王是否允许 +async def check_red_package(g_temp, gid: str) -> bool: + if gid in g_temp and not g_temp[gid]["red_package"]: + return False + return g_temp[gid]["red_package"] + +#根据关键词获取对应功能名称 +async def get_function_name(key: str) -> str: + return path[key][0] + +#戳一戳cd默认值 +try: + chuo_cd = nonebot.get_driver().config.chuo_cd +except Exception: + chuo_cd = 0 + +#从 配置文件中获取SUPERUSER, NICKNAME +config = nonebot.get_driver().config +superusers = {int(uid) for uid in config.superusers} +nickname = next(iter(config.nickname)) +#戳一戳cd,感觉很鸡肋,自行调整 +chuo_CD_dir = {} +driver = nonebot.get_driver() +notAllow = "功能未开启" + + +path = { + 'chuo': ['戳一戳'], + 'honor': ['群荣誉检测'], + 'files': ['群文件检测'], + 'del_user': ['群成员减少检测'], + 'add_user': ['群成员增加检测'], + 'admin': ['管理员变动检测'], + 'red_package': ['运气王检测'] +} + +class Utils: + usage = """ + 指令1:戳一戳(戳一戳bot获取文案) + 指令2:群荣誉监测(检测群聊中龙王,群聊之火,快乐源泉的获得并发送提示,当 bot获得群荣誉时有特殊消息) + 指令3:群文件检测(检测所有人发送群文件并发送提示) + 指令4:群成员减少检测(当有人退群时,发送退群消息;当主人/superuser退群有特殊回复) + 指令5:群成员增加检测(当有人入群时,发送入群欢迎,当bot首次入群会乞讨管理,当主人/superuser入群会有特殊回复) + 指令6:管理员变动检测(当新增管理员或取消管理员时发送消息提示,当bot自身被上/下管理时有特殊回复) + 指令7:运气王检测(检测抢红包检测后的运气王并发送提示消息) + """ +utils = Utils() \ No newline at end of file From dc93d775f37b430cebadfbd879cdc6df89847d53 Mon Sep 17 00:00:00 2001 From: Schwarzwald Date: Sun, 23 Jul 2023 21:53:12 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=92=8C=E4=BB=A3=E7=A0=81=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin.py | 63 ++++++++++++++++++ handle.py | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ honour.py | 41 ++++++++++++ stamp.py | 57 ++++++++++++++++ 4 files changed, 353 insertions(+) create mode 100644 admin.py create mode 100644 handle.py create mode 100644 honour.py create mode 100644 stamp.py diff --git a/admin.py b/admin.py new file mode 100644 index 0000000..16f0bca --- /dev/null +++ b/admin.py @@ -0,0 +1,63 @@ +from datetime import datetime +from .utils import superusers + + +async def admin_changer(sub_type, user_id, bot_qq) : + admin_msg = "" + + # 根据管理员变动类型选择不同的消息 + if sub_type == "set": + # 如果用户ID等于机器人的QQ号,返回特定消息 + admin_msg = ( + "我也是管理啦,你们要小心喵~" + if user_id == bot_qq + else f"🚔 管理员变动\n恭喜@{user_id}喜提本群管理喵~" + ) + elif sub_type == "unset": + # 如果用户ID等于机器人的QQ号,返回特定消息 + admin_msg = ( + "呜呜,别下咱管理呀QwQ,喵呜~" + if user_id == bot_qq + else f"🚔 管理员变动\n@{user_id}痛失本群管理喵~" + ) + + return admin_msg + + +async def del_user_bye(add_time, user_id): + global del_user_msg + del_time = datetime.fromtimestamp(add_time) + + # 检查用户ID是否在超级用户列表superusers中 + if user_id in superusers: + # 如果是超级用户,生成特定的离开消息 + del_user_msg = f"⌈{del_time}⌋\n@{user_id}恭送主人离开喵~" + print(superusers) + else: + # 如果不是超级用户,生成通用的离开消息,包含用户的QQ号和头像图片 + del_user_msg = f"✈️ 成员变动 ✈️ \n时间: ⌈{del_time}⌋\nQQ号为:{user_id}的小可爱退群喵~" \ + f"[CQ:image,file=https://q4.qlogo.cn/headimg_dl?dst_uin={user_id}&spec=640]" + + return del_user_msg + + +async def add_user_wecome(add_time, user_id, bot_qq): + global groups_all, add_user_msg + # 将时间戳转换为datetime类型的时间add_time + add_time = datetime.fromtimestamp(add_time) + # 判断用户ID是否等于机器人的QQ号 + if user_id == bot_qq: + # 如果是机器人自己加入群组,生成特定的欢迎消息 + add_user_msg = f"本喵被邀进入贵群喵~\n" \ + f"火速上个管理喵~" + # 判断用户ID是否在超级用户列表superusers中 + elif user_id in superusers: + # 如果是超级用户加入群组,生成特定的欢迎消息,包含用户ID和CQ表情 + add_user_msg = f"✨ 成员变动 ✨\n@{user_id}欢迎主人进群喵~[CQ:face,id=175]" + else: + # 如果是普通用户加入群组,生成通用的欢迎消息,包含用户ID、加入时间和用户头像图片的链接 + add_user_msg = f"✨ 成员变动 ✨\n欢迎@{user_id}的加入喵~\n加入时间:⌈{add_time}⌋,请在群内积极发言喵~" \ + f"[CQ:image,file=https://q4.qlogo.cn/headimg_dl?dst_uin={user_id}&spec=640]" + + return add_user_msg + diff --git a/handle.py b/handle.py new file mode 100644 index 0000000..d9c7e67 --- /dev/null +++ b/handle.py @@ -0,0 +1,192 @@ +import nonebot +from nonebot.rule import Rule +from nonebot.matcher import Matcher +from nonebot.plugin import on_notice, on_command +from nonebot.permission import SUPERUSER +from nonebot.adapters.onebot.v11.permission import GROUP_OWNER, GROUP_ADMIN +from nonebot.adapters.onebot.v11 import ( + Bot, Event, Message, + PokeNotifyEvent, + HonorNotifyEvent, + GroupUploadNoticeEvent, + GroupDecreaseNoticeEvent, + GroupIncreaseNoticeEvent, + GroupAdminNoticeEvent, + LuckyKingNotifyEvent, + MessageSegment, + GroupMessageEvent +) + +from .stamp import chuo_send_msg +from .honour import monitor_rongyu +from .admin import del_user_bye, add_user_wecome, admin_changer +from .utils import * + + +# 获取戳一戳状态 +async def _is_poke(event: Event) -> bool: + return isinstance(event, PokeNotifyEvent) and event.is_tome() +# 获取群荣誉变更 +async def _is_rongyu(event: Event) -> bool: + return isinstance(event, HonorNotifyEvent) +# 获取文件上传 +async def _is_checker(event: Event) -> bool: + return isinstance(event, GroupUploadNoticeEvent) +# 群成员减少 +async def _is_del_user(event: Event) -> bool: + return isinstance(event, GroupDecreaseNoticeEvent) +# 群成员增加 +async def _is_add_user(event: Event) -> bool: + return isinstance(event, GroupIncreaseNoticeEvent) +# 管理员变动 +async def _is_admin_change(event: Event) -> bool: + return isinstance(event, GroupAdminNoticeEvent) +# 红包运气王 +async def _is_red_packet(event: Event) -> bool: + return isinstance(event, LuckyKingNotifyEvent) + +# 戳一戳 +chuo = on_notice(Rule(_is_poke), priority=50, block=True) +# 群荣誉 +qrongyu = on_notice(Rule(_is_rongyu), priority=50, block=True) +# 群文件 +files = on_notice(Rule(_is_checker), priority=50, block=True) +# 群员减少 +del_user = on_notice(Rule(_is_del_user), priority=50, block=True) +# 群员增加 +add_user = on_notice(Rule(_is_add_user), priority=50, block=True) +# 群管理 +group_admin = on_notice(Rule(_is_admin_change), priority=50, block=True) +# 红包 +red_packet = on_notice(Rule(_is_red_packet), priority=50, block=True) +# 功能开关 +switch_command = on_command("开启", aliases={"关闭"}, + permission=SUPERUSER | GROUP_ADMIN | GROUP_OWNER, + priority=10, + block=False + ) +#功能状态 +state = on_command("event配置", aliases={"event状态"}, + permission=SUPERUSER | GROUP_ADMIN | GROUP_OWNER, + priority=10, + block=False + ) +#初始化配置配置文件 +@driver.on_bot_connect +async def _(): + await init(g_temp) + await config_check() + +@chuo.handle() +async def send_chuo(event: PokeNotifyEvent): + if not (await check_chuo(g_temp, str(event.group_id))): + await chuo.finish(notAllow, at_sender=True) + # 获取用户id + uid = event.get_user_id() + # 计算cd + try: + cd = event.time - chuo_CD_dir[uid] + except KeyError: + # 没有记录则cd为cd_time+1 + cd = chuo_cd + 1 + if ( + cd > chuo_cd + or event.get_user_id() in nonebot.get_driver().config.superusers + ):# 记录cd + chuo_CD_dir.update({uid: event.time}) + rely_msg = await chuo_send_msg() + await chuo.finish(message=Message(rely_msg)) +#群荣誉变化 +@qrongyu.handle() +async def send_rongyu(event: HonorNotifyEvent, bot: Bot): + if not (await check_honor(g_temp, str(event.group_id))): + await qrongyu.finish(notAllow, at_sender=True) + bot_qq = int(bot.self_id) + rely_msg = await monitor_rongyu(event.honor_type, event.user_id, bot_qq) + await qrongyu.finish(message=Message(rely_msg)) +#上传群文件 +@files.handle() +async def handle_first_receive(event: GroupUploadNoticeEvent): + if not (await check_file(g_temp, str(event.group_id))): + await files.finish(notAllow, at_sender=True) + rely = MessageSegment.at(event.user_id) + '\n' + \ + MessageSegment.image(f'https://q4.qlogo.cn/headimg_dl?dst_uin={event.user_id}&spec=640') + \ + '\n 上传了新文件,感谢你一直为群里做贡献喵~' + MessageSegment.face(175) + await files.finish(message=rely) +#退群事件 +@del_user.handle() +async def user_bye(event: GroupDecreaseNoticeEvent): + if not (await check_del_user(g_temp, str(event.group_id))): + await del_user.finish(notAllow, at_sender=True) + rely_msg = await del_user_bye(event.time, event.user_id) + await del_user.finish(message=Message(rely_msg)) +#入群事件 +@add_user.handle() +async def user_welcome(event: GroupIncreaseNoticeEvent, bot: Bot): + if not (await check_add_user(g_temp, str(event.group_id))): + await add_user.finish(notAllow, at_sender=True) + bot_qq = int(bot.self_id) + rely_msg = await add_user_wecome(event.time, event.user_id, bot_qq) + await add_user.finish(message=Message(rely_msg)) +#管理员变动 +@group_admin.handle() +async def admin_chance(event: GroupAdminNoticeEvent, bot: Bot): + if not (await check_admin(g_temp, str(event.group_id))): + await group_admin.finish(notAllow, at_sender=True) + bot_qq = int(bot.self_id) + rely_msg = await admin_changer(event.sub_type, event.user_id, bot_qq) + await group_admin.finish(message=Message(rely_msg)) +#红包运气王 +@red_packet.handle() +async def hongbao(event: LuckyKingNotifyEvent): + if not (await check_red_package(g_temp, str(event.group_id))): + await red_packet.finish(notAllow, at_sender=True) + rely_msg = MessageSegment.at(event.user_id) + "\n" + "本次红包运气王为:" + MessageSegment.at(event.target_id) + await red_packet.finish(message=rely_msg) + + +def get_command_type(command: str) -> str: + """根据指令内容获取开关类型""" + return next( + ( + key + for key, keywords in path.items() + if any(keyword in command for keyword in keywords) + ), + "", + ) + +@switch_command.handle() +async def switch(event: GroupMessageEvent, matcher: Matcher): + # 获取开关指令的参数,即用户输入的指令内容 + command = str(event.get_message()).strip() + # 获取群组ID + gid = str(event.group_id) + # 判断指令是否包含"开启"或"关闭"关键字 + if "开启" in command or "开始" in command: + if key := get_command_type(command): + g_temp[gid][key] = True + write_group_data(g_temp) + name = get_function_name(key) + await switch_command.finish(f"{name}功能已开启喵") + elif "禁止" in command or "关闭" in command: + if key := get_command_type(command): + g_temp[gid][key] = False + write_group_data(g_temp) + name = get_function_name(key) + await switch_command.finish(f"{name}功能已禁用喵") + +@state.handle() +async def event_state(event:GroupMessageEvent, matcher: Matcher): + gid = str(event.group_id) + with open(address, "r", encoding="utf-8") as f: + group_status = json.load(f) + if gid not in group_status: + await config_check() + else: + await matcher.finish(f"群{gid}的Event配置状态:\n" + "\n".join + ( + [f"{path[func][0]}: {'开启' if group_status[gid][func] else '关闭'}" for func in + path] + ) + ) \ No newline at end of file diff --git a/honour.py b/honour.py new file mode 100644 index 0000000..4859a16 --- /dev/null +++ b/honour.py @@ -0,0 +1,41 @@ +from .utils import superusers + + +async def monitor_rongyu(honor_type, user_id, bot_qq): + rely = "" + # 根据honor_type选择不同的消息 + if honor_type == "emotion": + # 如果用户ID等于机器人的QQ号,不作任何操作 + if user_id == bot_qq: + pass + # 如果用户ID在superusers列表中,返回特定消息 + elif user_id in superusers: + rely = f"@{user_id}恭喜主人荣获快乐源泉🤣标识喵~" + # 否则,返回通用消息 + else: + rely = f"恭喜@{user_id}荣获快乐源泉🤣标识喵~" + + elif honor_type == "performer": + # 如果用户ID等于机器人的QQ号,不作任何操作 + if user_id == bot_qq: + pass + # 如果用户ID在superusers列表中,返回特定消息 + elif user_id in superusers: + rely = f"@{user_id}恭喜主人荣获群聊之火🔥标识喵~" + # 否则,返回通用消息 + else: + rely = f"恭喜@{user_id}荣获群聊之火🔥标识喵~" + + elif honor_type == "talkative": + # 如果用户ID等于机器人的QQ号,返回特定消息 + if user_id == bot_qq: + rely = "你们又不行了,本喵喜提龙王🐲~" + # 如果用户ID在superusers列表中,返回特定消息 + elif user_id in superusers: + rely = f"@{user_id}恭喜主人荣获龙王🐲标识喵~" + # 否则,返回通用消息 + else: + rely = f"恭喜@{user_id}荣获龙王🐲标识喵~" + + return rely + diff --git a/stamp.py b/stamp.py new file mode 100644 index 0000000..2d8debf --- /dev/null +++ b/stamp.py @@ -0,0 +1,57 @@ +import random +from .utils import nickname + + +async def chuo_send_msg(): + # 使用 random.randint() 生成一个随机整数,作为选择消息的索引 + rand_num = random.randint(0, len(chuo_msg) - 1) + # 返回位于随机索引处的消息 + return chuo_msg[rand_num] + +#戳一戳文案 +chuo_msg = [ + f"别戳了,{nickname}怕疼QwQ", + f"呜呜,再戳{nickname}脸都要肿了", + f"戳坏了{nickname},你赔得起吗?", + f"再戳{nickname},我要叫我主人了", + f"别老戳{nickname}了,您歇会吧~", + f"再戳{nickname},咬你了嗷~", + f"请不要戳{nickname} >_<", + f"喂(#`O′) 戳{nickname}干嘛!", + "想好了再戳,(*-`ω´-)✄", + "喂,110吗,有人老戳我", + "嗷呜嗷呜...恶龙咆哮┗|`O′|┛", + "有事恁叫我,别天天一个劲戳戳戳!", + "再戳我让你变成女人,嘿嘿", + "不要戳我了 >_<", + "不要这样子啦(*/ω\*)", + "不要再戳了(害怕ing)", + "还戳,哼(つд⊂)(生气)", + "再戳,小心我顺着网线找你.", + "咱要型气了o(>﹏<)o", + "嘿嘿,好舒服呀(bushi)", + "乖,好了好了,别戳了~", + "我爪巴爪巴,球球别再戳了", + "别再戳我了,行🐎?!", + "啊呜,你有什么事吗?", + "lsp你再戳?", + "连个可爱美少女都要戳的肥宅真恶心啊。", + "你再戳!", + "?再戳试试?", + "别戳了别戳了再戳就坏了555", + "我爪巴爪巴,球球别再戳了", + "你戳你🐎呢?!", + "放手啦,不给戳QAQ", + "戳坏了,赔钱!", + "戳坏了", + "嗯……不可以……啦……不要乱戳", + "那...那里...那里不能戳...绝对...", + "(。´・ω・)ん?", + "有事恁叫我,别天天一个劲戳戳戳!", + "欸很烦欸!你戳🔨呢", + "再戳一下试试?", + "正在关闭对您的所有服务...关闭成功", + "啊呜,太舒服刚刚竟然睡着了。什么事?", + "正在定位您的真实地址...定位成功。轰炸机已起飞" + "再戳就更大了qwq" +] From de11f572bd9d0d96b4e71fda79cd437f4f14a167 Mon Sep 17 00:00:00 2001 From: Schwarzwald Date: Sun, 23 Jul 2023 21:55:52 +0800 Subject: [PATCH 04/11] Delete admin.py --- admin.py | 63 -------------------------------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 admin.py diff --git a/admin.py b/admin.py deleted file mode 100644 index 16f0bca..0000000 --- a/admin.py +++ /dev/null @@ -1,63 +0,0 @@ -from datetime import datetime -from .utils import superusers - - -async def admin_changer(sub_type, user_id, bot_qq) : - admin_msg = "" - - # 根据管理员变动类型选择不同的消息 - if sub_type == "set": - # 如果用户ID等于机器人的QQ号,返回特定消息 - admin_msg = ( - "我也是管理啦,你们要小心喵~" - if user_id == bot_qq - else f"🚔 管理员变动\n恭喜@{user_id}喜提本群管理喵~" - ) - elif sub_type == "unset": - # 如果用户ID等于机器人的QQ号,返回特定消息 - admin_msg = ( - "呜呜,别下咱管理呀QwQ,喵呜~" - if user_id == bot_qq - else f"🚔 管理员变动\n@{user_id}痛失本群管理喵~" - ) - - return admin_msg - - -async def del_user_bye(add_time, user_id): - global del_user_msg - del_time = datetime.fromtimestamp(add_time) - - # 检查用户ID是否在超级用户列表superusers中 - if user_id in superusers: - # 如果是超级用户,生成特定的离开消息 - del_user_msg = f"⌈{del_time}⌋\n@{user_id}恭送主人离开喵~" - print(superusers) - else: - # 如果不是超级用户,生成通用的离开消息,包含用户的QQ号和头像图片 - del_user_msg = f"✈️ 成员变动 ✈️ \n时间: ⌈{del_time}⌋\nQQ号为:{user_id}的小可爱退群喵~" \ - f"[CQ:image,file=https://q4.qlogo.cn/headimg_dl?dst_uin={user_id}&spec=640]" - - return del_user_msg - - -async def add_user_wecome(add_time, user_id, bot_qq): - global groups_all, add_user_msg - # 将时间戳转换为datetime类型的时间add_time - add_time = datetime.fromtimestamp(add_time) - # 判断用户ID是否等于机器人的QQ号 - if user_id == bot_qq: - # 如果是机器人自己加入群组,生成特定的欢迎消息 - add_user_msg = f"本喵被邀进入贵群喵~\n" \ - f"火速上个管理喵~" - # 判断用户ID是否在超级用户列表superusers中 - elif user_id in superusers: - # 如果是超级用户加入群组,生成特定的欢迎消息,包含用户ID和CQ表情 - add_user_msg = f"✨ 成员变动 ✨\n@{user_id}欢迎主人进群喵~[CQ:face,id=175]" - else: - # 如果是普通用户加入群组,生成通用的欢迎消息,包含用户ID、加入时间和用户头像图片的链接 - add_user_msg = f"✨ 成员变动 ✨\n欢迎@{user_id}的加入喵~\n加入时间:⌈{add_time}⌋,请在群内积极发言喵~" \ - f"[CQ:image,file=https://q4.qlogo.cn/headimg_dl?dst_uin={user_id}&spec=640]" - - return add_user_msg - From f4e39ec0c2f70046076737c733a618db60557a6d Mon Sep 17 00:00:00 2001 From: Schwarzwald Date: Sun, 23 Jul 2023 21:56:04 +0800 Subject: [PATCH 05/11] Delete handle.py --- handle.py | 192 ------------------------------------------------------ 1 file changed, 192 deletions(-) delete mode 100644 handle.py diff --git a/handle.py b/handle.py deleted file mode 100644 index d9c7e67..0000000 --- a/handle.py +++ /dev/null @@ -1,192 +0,0 @@ -import nonebot -from nonebot.rule import Rule -from nonebot.matcher import Matcher -from nonebot.plugin import on_notice, on_command -from nonebot.permission import SUPERUSER -from nonebot.adapters.onebot.v11.permission import GROUP_OWNER, GROUP_ADMIN -from nonebot.adapters.onebot.v11 import ( - Bot, Event, Message, - PokeNotifyEvent, - HonorNotifyEvent, - GroupUploadNoticeEvent, - GroupDecreaseNoticeEvent, - GroupIncreaseNoticeEvent, - GroupAdminNoticeEvent, - LuckyKingNotifyEvent, - MessageSegment, - GroupMessageEvent -) - -from .stamp import chuo_send_msg -from .honour import monitor_rongyu -from .admin import del_user_bye, add_user_wecome, admin_changer -from .utils import * - - -# 获取戳一戳状态 -async def _is_poke(event: Event) -> bool: - return isinstance(event, PokeNotifyEvent) and event.is_tome() -# 获取群荣誉变更 -async def _is_rongyu(event: Event) -> bool: - return isinstance(event, HonorNotifyEvent) -# 获取文件上传 -async def _is_checker(event: Event) -> bool: - return isinstance(event, GroupUploadNoticeEvent) -# 群成员减少 -async def _is_del_user(event: Event) -> bool: - return isinstance(event, GroupDecreaseNoticeEvent) -# 群成员增加 -async def _is_add_user(event: Event) -> bool: - return isinstance(event, GroupIncreaseNoticeEvent) -# 管理员变动 -async def _is_admin_change(event: Event) -> bool: - return isinstance(event, GroupAdminNoticeEvent) -# 红包运气王 -async def _is_red_packet(event: Event) -> bool: - return isinstance(event, LuckyKingNotifyEvent) - -# 戳一戳 -chuo = on_notice(Rule(_is_poke), priority=50, block=True) -# 群荣誉 -qrongyu = on_notice(Rule(_is_rongyu), priority=50, block=True) -# 群文件 -files = on_notice(Rule(_is_checker), priority=50, block=True) -# 群员减少 -del_user = on_notice(Rule(_is_del_user), priority=50, block=True) -# 群员增加 -add_user = on_notice(Rule(_is_add_user), priority=50, block=True) -# 群管理 -group_admin = on_notice(Rule(_is_admin_change), priority=50, block=True) -# 红包 -red_packet = on_notice(Rule(_is_red_packet), priority=50, block=True) -# 功能开关 -switch_command = on_command("开启", aliases={"关闭"}, - permission=SUPERUSER | GROUP_ADMIN | GROUP_OWNER, - priority=10, - block=False - ) -#功能状态 -state = on_command("event配置", aliases={"event状态"}, - permission=SUPERUSER | GROUP_ADMIN | GROUP_OWNER, - priority=10, - block=False - ) -#初始化配置配置文件 -@driver.on_bot_connect -async def _(): - await init(g_temp) - await config_check() - -@chuo.handle() -async def send_chuo(event: PokeNotifyEvent): - if not (await check_chuo(g_temp, str(event.group_id))): - await chuo.finish(notAllow, at_sender=True) - # 获取用户id - uid = event.get_user_id() - # 计算cd - try: - cd = event.time - chuo_CD_dir[uid] - except KeyError: - # 没有记录则cd为cd_time+1 - cd = chuo_cd + 1 - if ( - cd > chuo_cd - or event.get_user_id() in nonebot.get_driver().config.superusers - ):# 记录cd - chuo_CD_dir.update({uid: event.time}) - rely_msg = await chuo_send_msg() - await chuo.finish(message=Message(rely_msg)) -#群荣誉变化 -@qrongyu.handle() -async def send_rongyu(event: HonorNotifyEvent, bot: Bot): - if not (await check_honor(g_temp, str(event.group_id))): - await qrongyu.finish(notAllow, at_sender=True) - bot_qq = int(bot.self_id) - rely_msg = await monitor_rongyu(event.honor_type, event.user_id, bot_qq) - await qrongyu.finish(message=Message(rely_msg)) -#上传群文件 -@files.handle() -async def handle_first_receive(event: GroupUploadNoticeEvent): - if not (await check_file(g_temp, str(event.group_id))): - await files.finish(notAllow, at_sender=True) - rely = MessageSegment.at(event.user_id) + '\n' + \ - MessageSegment.image(f'https://q4.qlogo.cn/headimg_dl?dst_uin={event.user_id}&spec=640') + \ - '\n 上传了新文件,感谢你一直为群里做贡献喵~' + MessageSegment.face(175) - await files.finish(message=rely) -#退群事件 -@del_user.handle() -async def user_bye(event: GroupDecreaseNoticeEvent): - if not (await check_del_user(g_temp, str(event.group_id))): - await del_user.finish(notAllow, at_sender=True) - rely_msg = await del_user_bye(event.time, event.user_id) - await del_user.finish(message=Message(rely_msg)) -#入群事件 -@add_user.handle() -async def user_welcome(event: GroupIncreaseNoticeEvent, bot: Bot): - if not (await check_add_user(g_temp, str(event.group_id))): - await add_user.finish(notAllow, at_sender=True) - bot_qq = int(bot.self_id) - rely_msg = await add_user_wecome(event.time, event.user_id, bot_qq) - await add_user.finish(message=Message(rely_msg)) -#管理员变动 -@group_admin.handle() -async def admin_chance(event: GroupAdminNoticeEvent, bot: Bot): - if not (await check_admin(g_temp, str(event.group_id))): - await group_admin.finish(notAllow, at_sender=True) - bot_qq = int(bot.self_id) - rely_msg = await admin_changer(event.sub_type, event.user_id, bot_qq) - await group_admin.finish(message=Message(rely_msg)) -#红包运气王 -@red_packet.handle() -async def hongbao(event: LuckyKingNotifyEvent): - if not (await check_red_package(g_temp, str(event.group_id))): - await red_packet.finish(notAllow, at_sender=True) - rely_msg = MessageSegment.at(event.user_id) + "\n" + "本次红包运气王为:" + MessageSegment.at(event.target_id) - await red_packet.finish(message=rely_msg) - - -def get_command_type(command: str) -> str: - """根据指令内容获取开关类型""" - return next( - ( - key - for key, keywords in path.items() - if any(keyword in command for keyword in keywords) - ), - "", - ) - -@switch_command.handle() -async def switch(event: GroupMessageEvent, matcher: Matcher): - # 获取开关指令的参数,即用户输入的指令内容 - command = str(event.get_message()).strip() - # 获取群组ID - gid = str(event.group_id) - # 判断指令是否包含"开启"或"关闭"关键字 - if "开启" in command or "开始" in command: - if key := get_command_type(command): - g_temp[gid][key] = True - write_group_data(g_temp) - name = get_function_name(key) - await switch_command.finish(f"{name}功能已开启喵") - elif "禁止" in command or "关闭" in command: - if key := get_command_type(command): - g_temp[gid][key] = False - write_group_data(g_temp) - name = get_function_name(key) - await switch_command.finish(f"{name}功能已禁用喵") - -@state.handle() -async def event_state(event:GroupMessageEvent, matcher: Matcher): - gid = str(event.group_id) - with open(address, "r", encoding="utf-8") as f: - group_status = json.load(f) - if gid not in group_status: - await config_check() - else: - await matcher.finish(f"群{gid}的Event配置状态:\n" + "\n".join - ( - [f"{path[func][0]}: {'开启' if group_status[gid][func] else '关闭'}" for func in - path] - ) - ) \ No newline at end of file From 99d023a168f9dcc5171e79c473b3bb6eecdb363a Mon Sep 17 00:00:00 2001 From: Schwarzwald Date: Sun, 23 Jul 2023 21:56:19 +0800 Subject: [PATCH 06/11] Delete honour.py --- honour.py | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 honour.py diff --git a/honour.py b/honour.py deleted file mode 100644 index 4859a16..0000000 --- a/honour.py +++ /dev/null @@ -1,41 +0,0 @@ -from .utils import superusers - - -async def monitor_rongyu(honor_type, user_id, bot_qq): - rely = "" - # 根据honor_type选择不同的消息 - if honor_type == "emotion": - # 如果用户ID等于机器人的QQ号,不作任何操作 - if user_id == bot_qq: - pass - # 如果用户ID在superusers列表中,返回特定消息 - elif user_id in superusers: - rely = f"@{user_id}恭喜主人荣获快乐源泉🤣标识喵~" - # 否则,返回通用消息 - else: - rely = f"恭喜@{user_id}荣获快乐源泉🤣标识喵~" - - elif honor_type == "performer": - # 如果用户ID等于机器人的QQ号,不作任何操作 - if user_id == bot_qq: - pass - # 如果用户ID在superusers列表中,返回特定消息 - elif user_id in superusers: - rely = f"@{user_id}恭喜主人荣获群聊之火🔥标识喵~" - # 否则,返回通用消息 - else: - rely = f"恭喜@{user_id}荣获群聊之火🔥标识喵~" - - elif honor_type == "talkative": - # 如果用户ID等于机器人的QQ号,返回特定消息 - if user_id == bot_qq: - rely = "你们又不行了,本喵喜提龙王🐲~" - # 如果用户ID在superusers列表中,返回特定消息 - elif user_id in superusers: - rely = f"@{user_id}恭喜主人荣获龙王🐲标识喵~" - # 否则,返回通用消息 - else: - rely = f"恭喜@{user_id}荣获龙王🐲标识喵~" - - return rely - From 9bfd5ccb0e64516f6f7bbb88f7100b66979d27cc Mon Sep 17 00:00:00 2001 From: Schwarzwald Date: Sun, 23 Jul 2023 21:56:31 +0800 Subject: [PATCH 07/11] Delete utils.py --- utils.py | 188 ------------------------------------------------------- 1 file changed, 188 deletions(-) delete mode 100644 utils.py diff --git a/utils.py b/utils.py deleted file mode 100644 index 008cfd9..0000000 --- a/utils.py +++ /dev/null @@ -1,188 +0,0 @@ -import os -import nonebot -import json -from pathlib import Path -from typing import Optional - -g_temp = {} -config_path = Path() / 'data/eventmonitor' -address = config_path / 'config.json' - -async def init(g_temp): - """ - 初始化配置文件 - :return: - """ - # 如果数据文件路径不存在,则创建目录,并初始化群组数据为空字典,并写入对应的文件 - if not os.path.exists(config_path): - os.makedirs(config_path) - if os.path.exists(address): - # 如果数据文件路径存在,尝试读取数据文件(config.json) - with open(address, "r", encoding="utf-8") as f: - g_temp.update(json.load(f)) - else: - # 如果群数据文件不存在,则初始化g_temp为空字典,并写入对应的文件 - bot = nonebot.get_bot() - group_list = (await bot.get_group_list()) - #从group_list中遍历每个群组 - for group in group_list: - # 为每个群组创建一个临时字典temp,用于存储群组的配置信息 - temp = {} - for g_name in path: - # 将群组的每个配置项设置为默认值True - temp[g_name] = True - # 特殊情况下(g_name为'red_package'),将该配置项设为False - if g_name in ['red_package']: - temp[g_name] = False - # 获取群组ID并转换为字符串类型 - gid = str(group["group_id"]) - # 将临时字典temp作为值,群组ID作为键,添加到g_temp字典中 - g_temp[gid] = temp - # 将更新后的g_temp字典写入群组数据 - write_group_data(g_temp) - - -async def config_check(): - # 获取机器人实例 - bot = nonebot.get_bot() - # 获取所有群组的列表 - group_list = (await bot.get_group_list()) - # 加载配置文件,得到一个包含配置信息的字典 - config_dict = json_load(address) - # 遍历所有群组 - for group in group_list: - gid = str(group['group_id']) - # 如果配置字典中没有该群组的信息,将其添加到配置字典中 - if not config_dict.get(gid): - config_dict[gid] = {} - # 遍历配置文件路径中的所有配置项,并初始化为默认值 - for group_name in path: - config_dict[gid][group_name] = True - # 特殊情况下(group_name为'red_package'),将该配置项设为False - if group_name in ['red_package']: - config_dict[gid][group_name] = False - else: - # 如果配置字典中已存在该群组的信息,检查是否有缺失的配置项,并添加默认值 - other_group = config_dict[gid] - for group_name in path: - if other_group.get(group_name) is None: - other_group[gid][group_name] = True - # 特殊情况下(group_name为'red_package'),将该配置项设为False - if group_name in ['red_package']: - other_group[gid][group_name] = False - - # 将更新后的配置字典上传到配置文件中 - json_upload(address, config_dict) - - -def json_load(path) -> Optional[dict]: - """ - 加载json文件 - :return: Optional[dict] - """ - try: - with open(path, mode='r', encoding='utf-8') as f: - return json.load(f) - except FileNotFoundError: - return None - - -def json_upload(path, dict_content) -> None: - """ - 更新json文件 - :param path: 路径 - :param dict_content: python对象,字典 - """ - with open(path, mode='w', encoding='utf-8') as c: - c.write(json.dumps(dict_content, ensure_ascii=False, indent=4)) - - -#写入群配置 -def write_group_data(g_temp): - with open('data/eventmonitor/config.json', 'w', encoding='utf-8') as f: - json.dump(g_temp, f, indent=4, ensure_ascii=False) - - -#检查戳一戳是否允许 -async def check_chuo(g_temp, gid: str) -> bool: - if gid in g_temp and not g_temp[gid]["chuo"]: - return False - return g_temp[gid]["chuo"] - -#检查群荣誉是否允许 -async def check_honor(g_temp, gid: str) -> bool: - if gid in g_temp and not g_temp[gid]["honor"]: - return False - return g_temp[gid]["honor"] - -#检查群文件是否允许 -async def check_file(g_temp, gid: str) -> bool: - if gid in g_temp and not g_temp[gid]["files"]: - return False - return g_temp[gid]["files"] - -#检查群成员减少是否允许 -async def check_del_user(g_temp, gid: str) -> bool: - if gid in g_temp and not g_temp[gid]["del_user"]: - return False - return g_temp[gid]["del_user"] - -#检查群成员增加是否允许 -async def check_add_user(g_temp, gid: str) -> bool: - if gid in g_temp and not g_temp[gid]["add_user"]: - return False - return g_temp[gid]["add_user"] - -#检查管理员是否允许 -async def check_admin(g_temp, gid: str) -> bool: - if gid in g_temp and not g_temp[gid]["admin"]: - return False - return g_temp[gid]["admin"] - -#检查运气王是否允许 -async def check_red_package(g_temp, gid: str) -> bool: - if gid in g_temp and not g_temp[gid]["red_package"]: - return False - return g_temp[gid]["red_package"] - -#根据关键词获取对应功能名称 -async def get_function_name(key: str) -> str: - return path[key][0] - -#戳一戳cd默认值 -try: - chuo_cd = nonebot.get_driver().config.chuo_cd -except Exception: - chuo_cd = 0 - -#从 配置文件中获取SUPERUSER, NICKNAME -config = nonebot.get_driver().config -superusers = {int(uid) for uid in config.superusers} -nickname = next(iter(config.nickname)) -#戳一戳cd,感觉很鸡肋,自行调整 -chuo_CD_dir = {} -driver = nonebot.get_driver() -notAllow = "功能未开启" - - -path = { - 'chuo': ['戳一戳'], - 'honor': ['群荣誉检测'], - 'files': ['群文件检测'], - 'del_user': ['群成员减少检测'], - 'add_user': ['群成员增加检测'], - 'admin': ['管理员变动检测'], - 'red_package': ['运气王检测'] -} - -class Utils: - usage = """ - 指令1:戳一戳(戳一戳bot获取文案) - 指令2:群荣誉监测(检测群聊中龙王,群聊之火,快乐源泉的获得并发送提示,当 bot获得群荣誉时有特殊消息) - 指令3:群文件检测(检测所有人发送群文件并发送提示) - 指令4:群成员减少检测(当有人退群时,发送退群消息;当主人/superuser退群有特殊回复) - 指令5:群成员增加检测(当有人入群时,发送入群欢迎,当bot首次入群会乞讨管理,当主人/superuser入群会有特殊回复) - 指令6:管理员变动检测(当新增管理员或取消管理员时发送消息提示,当bot自身被上/下管理时有特殊回复) - 指令7:运气王检测(检测抢红包检测后的运气王并发送提示消息) - """ -utils = Utils() \ No newline at end of file From 13214fdfd655a7fe47553b8c4d9a5c8a307993a5 Mon Sep 17 00:00:00 2001 From: Schwarzwald Date: Sun, 23 Jul 2023 21:56:46 +0800 Subject: [PATCH 08/11] Delete stamp.py --- stamp.py | 57 -------------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 stamp.py diff --git a/stamp.py b/stamp.py deleted file mode 100644 index 2d8debf..0000000 --- a/stamp.py +++ /dev/null @@ -1,57 +0,0 @@ -import random -from .utils import nickname - - -async def chuo_send_msg(): - # 使用 random.randint() 生成一个随机整数,作为选择消息的索引 - rand_num = random.randint(0, len(chuo_msg) - 1) - # 返回位于随机索引处的消息 - return chuo_msg[rand_num] - -#戳一戳文案 -chuo_msg = [ - f"别戳了,{nickname}怕疼QwQ", - f"呜呜,再戳{nickname}脸都要肿了", - f"戳坏了{nickname},你赔得起吗?", - f"再戳{nickname},我要叫我主人了", - f"别老戳{nickname}了,您歇会吧~", - f"再戳{nickname},咬你了嗷~", - f"请不要戳{nickname} >_<", - f"喂(#`O′) 戳{nickname}干嘛!", - "想好了再戳,(*-`ω´-)✄", - "喂,110吗,有人老戳我", - "嗷呜嗷呜...恶龙咆哮┗|`O′|┛", - "有事恁叫我,别天天一个劲戳戳戳!", - "再戳我让你变成女人,嘿嘿", - "不要戳我了 >_<", - "不要这样子啦(*/ω\*)", - "不要再戳了(害怕ing)", - "还戳,哼(つд⊂)(生气)", - "再戳,小心我顺着网线找你.", - "咱要型气了o(>﹏<)o", - "嘿嘿,好舒服呀(bushi)", - "乖,好了好了,别戳了~", - "我爪巴爪巴,球球别再戳了", - "别再戳我了,行🐎?!", - "啊呜,你有什么事吗?", - "lsp你再戳?", - "连个可爱美少女都要戳的肥宅真恶心啊。", - "你再戳!", - "?再戳试试?", - "别戳了别戳了再戳就坏了555", - "我爪巴爪巴,球球别再戳了", - "你戳你🐎呢?!", - "放手啦,不给戳QAQ", - "戳坏了,赔钱!", - "戳坏了", - "嗯……不可以……啦……不要乱戳", - "那...那里...那里不能戳...绝对...", - "(。´・ω・)ん?", - "有事恁叫我,别天天一个劲戳戳戳!", - "欸很烦欸!你戳🔨呢", - "再戳一下试试?", - "正在关闭对您的所有服务...关闭成功", - "啊呜,太舒服刚刚竟然睡着了。什么事?", - "正在定位您的真实地址...定位成功。轰炸机已起飞" - "再戳就更大了qwq" -] From d4240f0ca57ed8021944c99b1b9d78ccba96c108 Mon Sep 17 00:00:00 2001 From: Schwarzwald Date: Sun, 23 Jul 2023 21:57:56 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E5=92=8C=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_eventmonitor/admin.py | 35 +++-- nonebot_plugin_eventmonitor/handle.py | 192 ++++++++++++++++++++++++++ nonebot_plugin_eventmonitor/honour.py | 29 ++-- nonebot_plugin_eventmonitor/stamp.py | 6 +- 4 files changed, 243 insertions(+), 19 deletions(-) create mode 100644 nonebot_plugin_eventmonitor/handle.py diff --git a/nonebot_plugin_eventmonitor/admin.py b/nonebot_plugin_eventmonitor/admin.py index 7c925d8..16f0bca 100644 --- a/nonebot_plugin_eventmonitor/admin.py +++ b/nonebot_plugin_eventmonitor/admin.py @@ -4,41 +4,60 @@ async def admin_changer(sub_type, user_id, bot_qq) : admin_msg = "" - + + # 根据管理员变动类型选择不同的消息 if sub_type == "set": + # 如果用户ID等于机器人的QQ号,返回特定消息 admin_msg = ( "我也是管理啦,你们要小心喵~" if user_id == bot_qq - else f"🚔 管理员变动\n恭喜[CQ:at,qq={user_id}]喜提本群管理喵~" + else f"🚔 管理员变动\n恭喜@{user_id}喜提本群管理喵~" ) elif sub_type == "unset": + # 如果用户ID等于机器人的QQ号,返回特定消息 admin_msg = ( "呜呜,别下咱管理呀QwQ,喵呜~" if user_id == bot_qq - else f"🚔 管理员变动\n[CQ:at,qq={user_id}]痛失本群管理喵~" + else f"🚔 管理员变动\n@{user_id}痛失本群管理喵~" ) + return admin_msg + async def del_user_bye(add_time, user_id): global del_user_msg del_time = datetime.fromtimestamp(add_time) + + # 检查用户ID是否在超级用户列表superusers中 if user_id in superusers: + # 如果是超级用户,生成特定的离开消息 del_user_msg = f"⌈{del_time}⌋\n@{user_id}恭送主人离开喵~" print(superusers) else: - del_user_msg = f"✈️ 成员变动⌈{del_time}⌋\nQQ号为:{user_id}的小可爱退群喵~" \ + # 如果不是超级用户,生成通用的离开消息,包含用户的QQ号和头像图片 + del_user_msg = f"✈️ 成员变动 ✈️ \n时间: ⌈{del_time}⌋\nQQ号为:{user_id}的小可爱退群喵~" \ f"[CQ:image,file=https://q4.qlogo.cn/headimg_dl?dst_uin={user_id}&spec=640]" + return del_user_msg + async def add_user_wecome(add_time, user_id, bot_qq): - global groups_all, add_user_msg - add_time = datetime.fromtimestamp(add_time) + global groups_all, add_user_msg + # 将时间戳转换为datetime类型的时间add_time + add_time = datetime.fromtimestamp(add_time) + # 判断用户ID是否等于机器人的QQ号 if user_id == bot_qq: + # 如果是机器人自己加入群组,生成特定的欢迎消息 add_user_msg = f"本喵被邀进入贵群喵~\n" \ f"火速上个管理喵~" + # 判断用户ID是否在超级用户列表superusers中 elif user_id in superusers: - add_user_msg = f"✨ 成员变动 ✨\n@{user_id}[CQ:at,qq={user_id}]欢迎主人进群喵~[CQ:face,id=175]" + # 如果是超级用户加入群组,生成特定的欢迎消息,包含用户ID和CQ表情 + add_user_msg = f"✨ 成员变动 ✨\n@{user_id}欢迎主人进群喵~[CQ:face,id=175]" else: - add_user_msg = f"✨ 成员变动 ✨\n欢迎[CQ:at,qq={user_id}]的加入喵~\n加入时间:⌈{add_time}⌋,请在群内积极发言喵~" \ + # 如果是普通用户加入群组,生成通用的欢迎消息,包含用户ID、加入时间和用户头像图片的链接 + add_user_msg = f"✨ 成员变动 ✨\n欢迎@{user_id}的加入喵~\n加入时间:⌈{add_time}⌋,请在群内积极发言喵~" \ f"[CQ:image,file=https://q4.qlogo.cn/headimg_dl?dst_uin={user_id}&spec=640]" + return add_user_msg + diff --git a/nonebot_plugin_eventmonitor/handle.py b/nonebot_plugin_eventmonitor/handle.py new file mode 100644 index 0000000..d9c7e67 --- /dev/null +++ b/nonebot_plugin_eventmonitor/handle.py @@ -0,0 +1,192 @@ +import nonebot +from nonebot.rule import Rule +from nonebot.matcher import Matcher +from nonebot.plugin import on_notice, on_command +from nonebot.permission import SUPERUSER +from nonebot.adapters.onebot.v11.permission import GROUP_OWNER, GROUP_ADMIN +from nonebot.adapters.onebot.v11 import ( + Bot, Event, Message, + PokeNotifyEvent, + HonorNotifyEvent, + GroupUploadNoticeEvent, + GroupDecreaseNoticeEvent, + GroupIncreaseNoticeEvent, + GroupAdminNoticeEvent, + LuckyKingNotifyEvent, + MessageSegment, + GroupMessageEvent +) + +from .stamp import chuo_send_msg +from .honour import monitor_rongyu +from .admin import del_user_bye, add_user_wecome, admin_changer +from .utils import * + + +# 获取戳一戳状态 +async def _is_poke(event: Event) -> bool: + return isinstance(event, PokeNotifyEvent) and event.is_tome() +# 获取群荣誉变更 +async def _is_rongyu(event: Event) -> bool: + return isinstance(event, HonorNotifyEvent) +# 获取文件上传 +async def _is_checker(event: Event) -> bool: + return isinstance(event, GroupUploadNoticeEvent) +# 群成员减少 +async def _is_del_user(event: Event) -> bool: + return isinstance(event, GroupDecreaseNoticeEvent) +# 群成员增加 +async def _is_add_user(event: Event) -> bool: + return isinstance(event, GroupIncreaseNoticeEvent) +# 管理员变动 +async def _is_admin_change(event: Event) -> bool: + return isinstance(event, GroupAdminNoticeEvent) +# 红包运气王 +async def _is_red_packet(event: Event) -> bool: + return isinstance(event, LuckyKingNotifyEvent) + +# 戳一戳 +chuo = on_notice(Rule(_is_poke), priority=50, block=True) +# 群荣誉 +qrongyu = on_notice(Rule(_is_rongyu), priority=50, block=True) +# 群文件 +files = on_notice(Rule(_is_checker), priority=50, block=True) +# 群员减少 +del_user = on_notice(Rule(_is_del_user), priority=50, block=True) +# 群员增加 +add_user = on_notice(Rule(_is_add_user), priority=50, block=True) +# 群管理 +group_admin = on_notice(Rule(_is_admin_change), priority=50, block=True) +# 红包 +red_packet = on_notice(Rule(_is_red_packet), priority=50, block=True) +# 功能开关 +switch_command = on_command("开启", aliases={"关闭"}, + permission=SUPERUSER | GROUP_ADMIN | GROUP_OWNER, + priority=10, + block=False + ) +#功能状态 +state = on_command("event配置", aliases={"event状态"}, + permission=SUPERUSER | GROUP_ADMIN | GROUP_OWNER, + priority=10, + block=False + ) +#初始化配置配置文件 +@driver.on_bot_connect +async def _(): + await init(g_temp) + await config_check() + +@chuo.handle() +async def send_chuo(event: PokeNotifyEvent): + if not (await check_chuo(g_temp, str(event.group_id))): + await chuo.finish(notAllow, at_sender=True) + # 获取用户id + uid = event.get_user_id() + # 计算cd + try: + cd = event.time - chuo_CD_dir[uid] + except KeyError: + # 没有记录则cd为cd_time+1 + cd = chuo_cd + 1 + if ( + cd > chuo_cd + or event.get_user_id() in nonebot.get_driver().config.superusers + ):# 记录cd + chuo_CD_dir.update({uid: event.time}) + rely_msg = await chuo_send_msg() + await chuo.finish(message=Message(rely_msg)) +#群荣誉变化 +@qrongyu.handle() +async def send_rongyu(event: HonorNotifyEvent, bot: Bot): + if not (await check_honor(g_temp, str(event.group_id))): + await qrongyu.finish(notAllow, at_sender=True) + bot_qq = int(bot.self_id) + rely_msg = await monitor_rongyu(event.honor_type, event.user_id, bot_qq) + await qrongyu.finish(message=Message(rely_msg)) +#上传群文件 +@files.handle() +async def handle_first_receive(event: GroupUploadNoticeEvent): + if not (await check_file(g_temp, str(event.group_id))): + await files.finish(notAllow, at_sender=True) + rely = MessageSegment.at(event.user_id) + '\n' + \ + MessageSegment.image(f'https://q4.qlogo.cn/headimg_dl?dst_uin={event.user_id}&spec=640') + \ + '\n 上传了新文件,感谢你一直为群里做贡献喵~' + MessageSegment.face(175) + await files.finish(message=rely) +#退群事件 +@del_user.handle() +async def user_bye(event: GroupDecreaseNoticeEvent): + if not (await check_del_user(g_temp, str(event.group_id))): + await del_user.finish(notAllow, at_sender=True) + rely_msg = await del_user_bye(event.time, event.user_id) + await del_user.finish(message=Message(rely_msg)) +#入群事件 +@add_user.handle() +async def user_welcome(event: GroupIncreaseNoticeEvent, bot: Bot): + if not (await check_add_user(g_temp, str(event.group_id))): + await add_user.finish(notAllow, at_sender=True) + bot_qq = int(bot.self_id) + rely_msg = await add_user_wecome(event.time, event.user_id, bot_qq) + await add_user.finish(message=Message(rely_msg)) +#管理员变动 +@group_admin.handle() +async def admin_chance(event: GroupAdminNoticeEvent, bot: Bot): + if not (await check_admin(g_temp, str(event.group_id))): + await group_admin.finish(notAllow, at_sender=True) + bot_qq = int(bot.self_id) + rely_msg = await admin_changer(event.sub_type, event.user_id, bot_qq) + await group_admin.finish(message=Message(rely_msg)) +#红包运气王 +@red_packet.handle() +async def hongbao(event: LuckyKingNotifyEvent): + if not (await check_red_package(g_temp, str(event.group_id))): + await red_packet.finish(notAllow, at_sender=True) + rely_msg = MessageSegment.at(event.user_id) + "\n" + "本次红包运气王为:" + MessageSegment.at(event.target_id) + await red_packet.finish(message=rely_msg) + + +def get_command_type(command: str) -> str: + """根据指令内容获取开关类型""" + return next( + ( + key + for key, keywords in path.items() + if any(keyword in command for keyword in keywords) + ), + "", + ) + +@switch_command.handle() +async def switch(event: GroupMessageEvent, matcher: Matcher): + # 获取开关指令的参数,即用户输入的指令内容 + command = str(event.get_message()).strip() + # 获取群组ID + gid = str(event.group_id) + # 判断指令是否包含"开启"或"关闭"关键字 + if "开启" in command or "开始" in command: + if key := get_command_type(command): + g_temp[gid][key] = True + write_group_data(g_temp) + name = get_function_name(key) + await switch_command.finish(f"{name}功能已开启喵") + elif "禁止" in command or "关闭" in command: + if key := get_command_type(command): + g_temp[gid][key] = False + write_group_data(g_temp) + name = get_function_name(key) + await switch_command.finish(f"{name}功能已禁用喵") + +@state.handle() +async def event_state(event:GroupMessageEvent, matcher: Matcher): + gid = str(event.group_id) + with open(address, "r", encoding="utf-8") as f: + group_status = json.load(f) + if gid not in group_status: + await config_check() + else: + await matcher.finish(f"群{gid}的Event配置状态:\n" + "\n".join + ( + [f"{path[func][0]}: {'开启' if group_status[gid][func] else '关闭'}" for func in + path] + ) + ) \ No newline at end of file diff --git a/nonebot_plugin_eventmonitor/honour.py b/nonebot_plugin_eventmonitor/honour.py index c3ff157..4859a16 100644 --- a/nonebot_plugin_eventmonitor/honour.py +++ b/nonebot_plugin_eventmonitor/honour.py @@ -1,30 +1,41 @@ from .utils import superusers -async def monitor_rongyu(honor_type, user_id, bot_qq): - rely = "" - +async def monitor_rongyu(honor_type, user_id, bot_qq): + rely = "" + # 根据honor_type选择不同的消息 if honor_type == "emotion": + # 如果用户ID等于机器人的QQ号,不作任何操作 if user_id == bot_qq: pass + # 如果用户ID在superusers列表中,返回特定消息 elif user_id in superusers: - rely = f"[CQ:at,qq={user_id}]恭喜主人荣获快乐源泉🤣标识喵~" + rely = f"@{user_id}恭喜主人荣获快乐源泉🤣标识喵~" + # 否则,返回通用消息 else: - rely = f"恭喜[CQ:at,qq={user_id}]荣获快乐源泉🤣标识喵~" + rely = f"恭喜@{user_id}荣获快乐源泉🤣标识喵~" + elif honor_type == "performer": + # 如果用户ID等于机器人的QQ号,不作任何操作 if user_id == bot_qq: pass + # 如果用户ID在superusers列表中,返回特定消息 elif user_id in superusers: - rely = f"[CQ:at,qq={user_id}]恭喜主人荣获群聊之火🔥标识喵~" + rely = f"@{user_id}恭喜主人荣获群聊之火🔥标识喵~" + # 否则,返回通用消息 else: - rely = f"恭喜[CQ:at,qq={user_id}]荣获群聊之火🔥标识喵~" + rely = f"恭喜@{user_id}荣获群聊之火🔥标识喵~" elif honor_type == "talkative": + # 如果用户ID等于机器人的QQ号,返回特定消息 if user_id == bot_qq: rely = "你们又不行了,本喵喜提龙王🐲~" + # 如果用户ID在superusers列表中,返回特定消息 elif user_id in superusers: - rely = f"[CQ:at,qq={user_id}]恭喜主人荣获龙王🐲标识喵~" + rely = f"@{user_id}恭喜主人荣获龙王🐲标识喵~" + # 否则,返回通用消息 else: - rely = f"恭喜[CQ:at,qq={user_id}]荣获龙王🐲标识喵~" + rely = f"恭喜@{user_id}荣获龙王🐲标识喵~" return rely + diff --git a/nonebot_plugin_eventmonitor/stamp.py b/nonebot_plugin_eventmonitor/stamp.py index 959b9d0..2d8debf 100644 --- a/nonebot_plugin_eventmonitor/stamp.py +++ b/nonebot_plugin_eventmonitor/stamp.py @@ -3,10 +3,12 @@ async def chuo_send_msg(): - rand_num = random.randint(0, len(chuo_msg) - 1) + # 使用 random.randint() 生成一个随机整数,作为选择消息的索引 + rand_num = random.randint(0, len(chuo_msg) - 1) + # 返回位于随机索引处的消息 return chuo_msg[rand_num] - +#戳一戳文案 chuo_msg = [ f"别戳了,{nickname}怕疼QwQ", f"呜呜,再戳{nickname}脸都要肿了", From c7be7a0dc615e58da8ce40aa1fd3f5de240b0ae5 Mon Sep 17 00:00:00 2001 From: Schwarzwald Date: Sun, 23 Jul 2023 22:01:31 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=20=F0=9F=9A=A8v0.1.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e7d222f..90317fb 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="nonebot_plugin_eventmonitor", - version="0.1.7", + version="0.1.8", author="schwarzwald", description="监控群事件的插件,支持戳一戳,成员变动,群荣誉,运气王变化等提示", long_description=long_description, From 4b9d9f9d5b30c01fa13b31b90bd0f48030d347ff Mon Sep 17 00:00:00 2001 From: Schwarzwald Date: Sun, 23 Jul 2023 22:01:56 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E2=9C=85README=E2=9C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 67 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 5d61dad..13633c6 100644 --- a/README.md +++ b/README.md @@ -25,22 +25,6 @@ _✨ 基于NoneBot2实现的 监测QQ群事件 插件 ✨_ > > 群成员荣誉变更时,发送变更通知 -## 指令结构: - -``` -path = { - 'chuo': ['戳一戳'], - 'honor': ['群荣誉检测'], - 'files': ['群文件检测'], - 'del_user': ['群成员减少检测'], - 'add_user': ['群成员增加检测'], - 'admin': ['管理员变动检测'], - 'red_package': ['运气王检测'] -} -``` - - - ## 安装方式 ### nb-cli安装(推荐) @@ -79,39 +63,55 @@ pip install --upgrade nonebot-plugin-eventmonitor | :-----: | :--: | :-----: | :----------: | :----------------: | | chuo_cd | int | 0 | chuo_cd = 10 | 戳一戳的cd(选填) | +## 指令结构帮助: + +``` +usage = """ + 指令1:戳一戳(戳一戳bot获取文案) + 指令2:群荣誉监测(检测群聊中龙王,群聊之火,快乐源泉的获得并发送提示,当 bot获得群荣誉时有特殊消息) + 指令3:群文件检测(检测所有人发送群文件并发送提示) + 指令4:群成员减少检测(当有人退群时,发送退群消息;当主人/superuser退群有特殊回复) + 指令5:群成员增加检测(当有人入群时,发送入群欢迎,当bot首次入群会乞讨管理,当主人/superuser入群会有特殊回复) + 指令6:管理员变动检测(当新增管理员或取消管理员时发送消息提示,当bot自身被上/下管理时有特殊回复) + 指令7:运气王检测(检测抢红包检测后的运气王并发送提示消息) + """ +``` +

更新日志

-- v0.1.7 +- v0.1.8 - - 新增所有功能开关[#issue5](https://github.com/Reversedeer/nonebot_plugin_eventmonitor/issues/9) - - - 增加权限控制 - - 修复潜在的bug + - 🚨增加功能开关指令:event状态/event配置 + - 🐛修复群文件不能检测bug(少写一个字母qwq) + - 优化目录结构 -- v0.1.6 - - 修复bug +- v0.1.7 + - 🚨新增所有功能开关[#issue5](https://github.com/Reversedeer/nonebot_plugin_eventmonitor/issues/9) + - 🚨新增权限控制 + - 🐛修复潜在的bug +- v0.1.6 + - 🐛修复bug - v0.1.5 + - 🐛修复获取superusers数值bug - 优化配置文件 [#issue4](https://github.com/Reversedeer/nonebot_plugin_eventmonitor/issues/6) - 删除冗余代码 - - 修复获取superusers数值bug - - v0.1.3 - - 修复配置文件bug + - 🐛修复配置文件bug - v0.1.2 - - 增加了戳一戳的文案 + - 🚨增加戳一戳的文案 - - 修改一些bug + - 🐛修复bug - v0.1.1 - - 好像改了什么..忘了... + - 🐛修复bug - v0.1.0 + - 🚨新增戳一戳加了cd(本人觉得功能鸡肋) + - 🐛修复管理员变动时API报错问题[#issue1](https://github.com/Reversedeer/nonebot_plugin_eventmonitor/issues/1) - 抛弃原有的配置模式 - - 给戳一戳加了cd(本人觉得功能鸡肋) - - 修复管理员变动时API报错问题[#issue1](https://github.com/Reversedeer/nonebot_plugin_eventmonitor/issues/1) - v0.0.6 - - 修复了大量的bug + - 🐛修复了大量的bug
## 关于 ISSUE @@ -134,6 +134,7 @@ pip install --upgrade nonebot-plugin-eventmonitor ## 其他插件 +[舔狗日记](https://github.com/Reversedeer/nonebot_plugin_dog) + [使用API的chatGPTQQ聊天机器人](https://github.com/Reversedeer/nonebot_plugin_chatGPT_openai) -[舔狗日记](https://github.com/Reversedeer/nonebot_plugin_dog)