diff --git a/src/plugins/nonebot_plugin_addFriend/__init__.py b/src/plugins/nonebot_plugin_addFriend/__init__.py index 5045694..6c0d2ac 100644 --- a/src/plugins/nonebot_plugin_addFriend/__init__.py +++ b/src/plugins/nonebot_plugin_addFriend/__init__.py @@ -1,457 +1,354 @@ -# python3 -# -*- coding: utf-8 -*- -# @Time : 2021/2/15 16:49 -# @Author : wziru -# @File : __init__.py.py -# @Software: PyCharm from datetime import datetime - -try: - import ujson as json -except ModuleNotFoundError: - import json +import json import re from asyncio import sleep -from os.path import dirname, exists +from os.path import dirname,exists from typing import Union -from nonebot import on_command, on_request, on_notice, require -from nonebot.adapters.onebot.v11 import ( - Bot, - MessageEvent, - PrivateMessageEvent, - GroupMessageEvent, - MessageSegment, - RequestEvent, - GroupRequestEvent, - FriendRequestEvent, - NoticeEvent, - GroupDecreaseNoticeEvent, - GroupIncreaseNoticeEvent, -) +from nonebot import on_command,on_request,on_notice,require +from nonebot.adapters.onebot.v11 import Bot, MessageEvent,PrivateMessageEvent,GroupMessageEvent, MessageSegment,RequestEvent,GroupRequestEvent, FriendRequestEvent,NoticeEvent,GroupDecreaseNoticeEvent,GroupIncreaseNoticeEvent from nonebot.message import event_preprocessor from nonebot import get_driver from nonebot.permission import SUPERUSER from nonebot.adapters.onebot.v11.permission import GROUP_ADMIN, GROUP_OWNER from nonebot.params import CommandArg from nonebot.adapters import Message -from .configUtil import ( - config, - requestorDict, - basedir, - numPath, - configPath, - requestorPath, - writeData, - blackLogPath, -) -from .utils import ( - getReferIdList, - read_data, - sendMsg, - getExist, - parseMsg, - isNormalAdd, - writeLog, - filterFriend, - parseTime, -) - +from .configUtil import check_dict_key_bot_id, config,requestorDict,basedir,configPath,requestorDictPath,writeData,blackLogPath,numDict,numDictPath +from .utils import getReferIdList,sendMsg,getExist,parseMsg,isNormalAdd,writeLog,filterFriend,parseTime,writeTime # try: # scheduler = require('nonebot_plugin_apscheduler').scheduler # except: # import nonebot_plugin_apscheduler # scheduler = nonebot_plugin_apscheduler.scheduler -# 初始化完毕,num文件单独初始化 -parseRequest = on_request(priority=1, block=True) - +#初始化完毕,num文件单独初始化 +parseRequest = on_request(priority=1, block=True) # @event_preprocessor @parseRequest.handle() async def _(bot: Bot, event: RequestEvent): - num, now, old = read_data(numPath) - time = str(now) - if isinstance(event, FriendRequestEvent): - notice_msg = config["friend_msg"]["notice_msg"] - welcome_msg = config["friend_msg"]["welcome_msg"] + check_dict_key_bot_id(config,requestorDict,numDict,bot) + now=datetime.now() + time=str(now) + if isinstance(event,FriendRequestEvent): + notice_msg=config[bot.self_id]["friend_msg"]["notice_msg"] + welcome_msg=config[bot.self_id]["friend_msg"]["welcome_msg"] id = str(event.user_id) - autoType = "friend" - agreeAutoApprove = config["agreeAutoApprove"][autoType] - addInfo = await bot.get_stranger_info(user_id=int(id), no_cache=True) - msg = id + notice_msg + event.comment + "\n时间:{}".format(time) - elif isinstance(event, GroupRequestEvent): - if event.sub_type != "invite": + autoType='friend' + agreeAutoApprove=config[bot.self_id]['agreeAutoApprove'][autoType] + addInfo=await bot.get_stranger_info(user_id=int(id),no_cache=True) + msg=id+notice_msg+event.comment+'\n时间:{}'.format(time) + elif isinstance(event,GroupRequestEvent): + if event.sub_type!='invite': print(event.sub_type) return print(event.sub_type) - notice_msg = config["group_msg"]["notice_msg"] - welcome_msg = config["group_msg"]["welcome_msg"] + notice_msg=config[bot.self_id]["group_msg"]["notice_msg"] + welcome_msg=config[bot.self_id]["group_msg"]["welcome_msg"] id = str(event.group_id) - autoType = "group" - agreeAutoApprove = config["agreeAutoApprove"][autoType] + autoType='group' + agreeAutoApprove=config[bot.self_id]['agreeAutoApprove'][autoType] await sleep(0.5) - addInfo = await bot.get_group_info(group_id=int(id), no_cache=True) - print(autoType, addInfo, agreeAutoApprove) - msg = ( - "群号" - + id - + "," - + event.get_user_id() - + notice_msg - + event.comment - + "\n时间:{}".format(time) - ) - if addInfo["member_count"] != 0: - status = "\n或因群人数少,已经添加成功" - await sendMsg(bot, config["recipientList"], msg + status, 0) + addInfo=await bot.get_group_info(group_id=int(id),no_cache=True) + print(autoType,addInfo,agreeAutoApprove) + msg='群号'+id+','+event.get_user_id()+notice_msg+event.comment+'\n时间:{}'.format(time) + if addInfo["member_count"]!=0: + status='\n或因群人数少,已经添加成功' + await sendMsg(bot,config[bot.self_id]['recipientList'],msg+status,0) await bot.send_private_msg(user_id=event.user_id, message=welcome_msg) return else: return - agreeAutoApprove, status = isNormalAdd(config, autoType, addInfo, agreeAutoApprove) - if agreeAutoApprove == -1: + # num,now,old=read_data(numPath,autoType) + agreeAutoApprove,status=isNormalAdd(config[bot.self_id],autoType,addInfo,agreeAutoApprove) #正常添加判断,过滤无意义添加,类似xx通知群 + if agreeAutoApprove==-1: #黑名单结果 await event.reject(bot) - await sendMsg(bot, config["recipientList"], msg + status, 0) # 黑名单警告,转发给设定的人 - forwardId = config["blackDict"]["forward"].get(id) - if forwardId != None and autoType == "group": - friendList = await getReferIdList(bot, "user_id") + await sendMsg(bot,config[bot.self_id]['recipientList'],msg+status,0) #黑名单警告,转发给设定的人 + forwardId=config[bot.self_id]["blackDict"]["forward"].get(id) + if forwardId!=None and autoType=="group": + friendList=await getReferIdList(bot,'user_id') if forwardId in friendList: - await bot.send_private_msg(user_id=forwardId, message=msg + status) + await bot.send_private_msg(user_id=forwardId,message=msg+status) else: - del config["blackDict"]["forward"][id] - writeLog(blackLogPath, msg + status + "\n") + del config[bot.self_id]["blackDict"]["forward"][id] + writeLog(blackLogPath,msg+status+'\n') return - if not filterFriend(event.comment, autoType, config["allowAddFriednText"]): # 验证信息 - status = "\n未通过验证消息,已拒绝" - await sendMsg(bot, config["recipientList"], msg + status, 0) # 不记录 + if not filterFriend(event.comment,autoType,config[bot.self_id]['allowAddFriednText']): #验证信息 + status='\n未通过验证消息,已拒绝' + await sendMsg(bot,config[bot.self_id]['recipientList'],msg+status,0)#不记录 await event.reject(bot) return - num = parseTime(config["numControl"], num, old, now) - if agreeAutoApprove == 0 or num == -1: - if num == -1: - status = "\n此时增满{}人,未能再自动添加".format(config["numControl"]["maxNum"]) + num=parseTime(config[bot.self_id]['numControl'],numDict[bot.self_id][autoType],now) + if agreeAutoApprove==0 or num==-1: + if num==-1: + status='\n此时增满{}人,未能再自动添加'.format(config[bot.self_id]['numControl']['maxNum']) else: - status = "\n未允许自动添加" - requestorDict[autoType][id] = { - "flag": event.flag, - "comment": event.comment, - "notice_msg": notice_msg, - "staus": status, - "requestorId": event.user_id, - "time": time, - } - writeData(requestorPath, requestorDict) - await sendMsg(bot, config["recipientList"], msg + status, 0) + status='\n未允许自动添加' + requestorDict[bot.self_id][autoType][id]={'flag':event.flag,'comment':event.comment,"notice_msg":notice_msg,'staus':status,'requestorId':event.user_id,'time':time} + writeData(requestorDictPath,requestorDict) + await sendMsg(bot,config[bot.self_id]['recipientList'],msg+status,0) else: - # 既自动添加又条件合适 - with open(numPath, "w", encoding="utf-8") as fp: - fp.write(str(num) + "," + str(now)) + #既自动添加又条件合适 + writeTime(numDictPath,numDict) await event.approve(bot) - await sendMsg(bot, config["recipientList"], msg + status, 0) - # 等待腾讯服务器更新 + await sendMsg(bot,config[bot.self_id]['recipientList'],msg+status,0) + #等待腾讯服务器更新 await sleep(1.5) await bot.send_private_msg(user_id=event.user_id, message=welcome_msg) -againReadConfig = on_command( - "重载配置", - aliases={"更改自动同意", "更改最大加好友数量", "更改查看加返回数量", "更改加好友时间单位"}, - priority=5, - block=True, - permission=SUPERUSER, -) - +againReadConfig= on_command("重载配置",aliases={"更改自动同意","更改最大加数量","更改加时间","更改加时间单位","更改查看加返回数量"},priority=5,block=True,permission=SUPERUSER) @againReadConfig.handle() -async def _(bot: Bot, event: MessageEvent, args: Message = CommandArg()): +async def _(bot: Bot, event: MessageEvent,args: Message = CommandArg()): global config - with open(configPath, "r", encoding="utf-8") as fp: - config = json.loads(fp.read()) - text = event.get_plaintext().strip() - argsText = args.extract_plain_text() - commandText = getExist("", text, argsText) - print(commandText) + #下个版本把其他俩json也重载一下,不知道为啥这次就不想改 + with open(configPath,'r',encoding='utf-8') as fp: + config=json.loads(fp.read()) + check_dict_key_bot_id(config,requestorDict,numDict,bot) + text=event.get_plaintext().strip() + argsText=args.extract_plain_text().strip() + commandText=getExist('',text,argsText) + print(argsText) + if '群聊' in argsText: + argsText=argsText.replace('群聊','').strip() + autoType='group' + elif '好友' in argsText: + argsText=argsText.replace('好友','').strip() + autoType='friend' + else: + autoType='all' if "更改自动同意" in commandText: print(1) - text = args.extract_plain_text() - if "群聊" in argsText: - argsText = argsText.replace("群聊", "").strip() - autoType = "group" - elif "好友" in argsText: - argsText = argsText.replace("好友", "").strip() - autoType = "friend" - else: - autoType = "all" - if argsText.isdigit() and autoType != "all": - if int(argsText) > 0: - config["agreeAutoApprove"][autoType] = 1 + if argsText.isdigit() and autoType!='all': + if int(argsText)>0: + config[bot.self_id]['agreeAutoApprove'][autoType]=1 else: - config["agreeAutoApprove"][autoType] = 0 - elif autoType == "all": - setList = argsText.split() - i = 0 - setKeyList = list(config["agreeAutoApprove"].keys()) + config[bot.self_id]['agreeAutoApprove'][autoType]=0 + elif autoType=='all': + setList=argsText.split() + i=0 + setKeyList=list(config[bot.self_id]['agreeAutoApprove'].keys()) for set in setList[:2]: if set.isdigit(): - if int(set) > 0: - config["agreeAutoApprove"][setKeyList[i]] = 1 + if int(set)>0: + config[bot.self_id]['agreeAutoApprove'][setKeyList[i]]=1 else: - config["agreeAutoApprove"][setKeyList[i]] = 0 - i += 1 + config[bot.self_id]['agreeAutoApprove'][setKeyList[i]]=0 + i+=1 else: - await againReadConfig.finish("格式") - resMsg = "更改成功,为\n{}".format(config["agreeAutoApprove"]) + await againReadConfig.finish('格式') + resMsg='更改成功,为\n{}'.format(config[bot.self_id]['agreeAutoApprove']) - elif "更改最大加好友数量" in commandText: + elif "更改最大加数量" in commandText: print(2) if argsText.isdigit(): - maxNum = int(argsText) - if maxNum > 0: - config["numControl"]["maxNum"] = maxNum + maxNum=int(argsText) + if maxNum>0: + config[bot.self_id]['numControl'][autoType]['maxNum']=maxNum else: - config["numControl"]["maxNum"] = 0 - resMsg = "更改成功,为{}".format(config["numControl"]["maxNum"]) - elif "更改加好友时间单位" in commandText: - print(argsText, 1) - if "时" in argsText: - config["numControl"]["unit"] = "h" - elif "分" in argsText: - config["numControl"]["unit"] = "m" + config[bot.self_id]['numControl'][autoType]['maxNum']=0 + resMsg='更改成功,为{}'.format(config[bot.self_id]['numControl'][autoType]['maxNum']) + elif "更改最大加时间" in commandText: + print(2) + if argsText.isdigit(): + time=int(argsText) + if time>0: + config[bot.self_id]['numControl'][autoType]['time']=time + resMsg='更改成功,为{}'.format(config[bot.self_id]['numControl'][autoType]['time']) + elif "更改加时间单位" in commandText: + print(argsText,1) + if '时' in argsText: + config[bot.self_id]['numControl'][autoType]['unit']='h' + elif '分' in argsText: + config[bot.self_id]['numControl'][autoType]['unit']='m' else: - config["numControl"]["unit"] = "d" - resMsg = "更改成功,为{}".format(config["numControl"]["unit"]) + config[bot.self_id]['numControl'][autoType]['unit']='d' + resMsg='更改成功,为{}'.format(config[bot.self_id]['numControl'][autoType]['unit']) elif "更改查看加返回数量" in commandText: print(3) if argsText.isdigit(): - maxViewNum = int(argsText) - if maxViewNum > 0 and maxViewNum < 120: - config["maxViewNum"] = maxViewNum - resMsg = "更改成功,为\n{}".format(config["maxViewNum"]) + maxViewNum=int(argsText) + if maxViewNum>0 and maxViewNum<120: + config[bot.self_id]['maxViewNum']=maxViewNum + resMsg='更改成功,为\n{}'.format(config[bot.self_id]['maxViewNum']) else: print(4) - resMsg = "重载成功:\n{}".format(config) - if "重载配置" not in commandText: - writeData(configPath, config) - resMsg = await parseMsg(commandText, resMsg) + resMsg='重载成功:\n{}'.format(config[bot.self_id]) + if '重载配置' not in commandText: + writeData(configPath,config) + resMsg=await parseMsg(commandText,resMsg) await againReadConfig.finish(resMsg) -addFriend = on_command("同意加", aliases={"拒绝加", "查看加"}, priority=5, block=True) - - +addFriend = on_command("同意加",aliases={'拒绝加','查看加'},priority=5,block=True) @addFriend.handle() -async def _(bot: Bot, event: MessageEvent, args: Message = CommandArg()): - if event.get_user_id() not in config["recipientList"]: - await addFriend.finish("无权限") - text = event.get_plaintext().strip() - argsText = args.extract_plain_text().strip() - commandText = getExist("", text, argsText) - if "群" in commandText: - autoType = "group" +async def _(bot: Bot, event: MessageEvent,args: Message = CommandArg()): + check_dict_key_bot_id(config,requestorDict,numDict,bot) + if event.get_user_id() not in config[bot.self_id]['recipientList']: + await addFriend.finish('无权限') + text=event.get_plaintext().strip() + argsText=args.extract_plain_text().strip() + commandText=getExist("",text,argsText) + print(argsText) + if '群' in argsText: + autoType='group' + argsText=argsText.replace("群聊","").replace("群","").strip() else: - autoType = "friend" + argsText=argsText.replace("好友","").strip() + autoType='friend' if "同意加" in commandText: - approve = True - status = "添加成功" - elif "拒绝" in commandText: - approve = False - status = "拒绝成功" + approve=True + status='添加成功' + elif '拒绝' in commandText: + approve=False + status='拒绝成功' else: - num = argsText + num=argsText if num.isdigit(): - num = int(num) + num=int(num) else: - num = config["maxViewNum"] - requestorValueList = list(requestorDict[autoType].values())[:num] - requestorInfos = str(requestorValueList) - resMsg = await parseMsg(commandText, requestorInfos) - await againReadConfig.finish(resMsg) - if argsText == "": - await addFriend.finish("格式") + num=config[bot.self_id]['maxViewNum'] + requestorValueList=list(requestorDict[bot.self_id][autoType].items())[:num] + requestorInfos=str(requestorValueList) + print(autoType,requestorInfos) + resMsg=await parseMsg(commandText,requestorInfos) + print(resMsg) + await addFriend.finish(resMsg) + if argsText=='': + await addFriend.finish('格式') # 预处理完毕,开始设置参数 - argsText = argsText.split() - QQOrGroupId = argsText[0] - if requestorDict[autoType].get(QQOrGroupId) == None: - await addFriend.finish("没有此请求") - - flag = requestorDict[autoType][QQOrGroupId]["flag"] - notice_msg = requestorDict[autoType][QQOrGroupId]["notice_msg"] - comment = requestorDict[autoType][QQOrGroupId]["comment"] - requestorId = requestorDict[autoType][QQOrGroupId]["requestorId"] - time = requestorDict[autoType][QQOrGroupId]["time"] + QQOrGroupId=argsText.split()[0] + print(QQOrGroupId) + if requestorDict[bot.self_id][autoType].get(QQOrGroupId)==None: + await addFriend.finish('没有此请求') + + flag=requestorDict[bot.self_id][autoType][QQOrGroupId]['flag'] + notice_msg=requestorDict[bot.self_id][autoType][QQOrGroupId]['notice_msg'] + comment=requestorDict[bot.self_id][autoType][QQOrGroupId]['comment'] + requestorId=requestorDict[bot.self_id][autoType][QQOrGroupId]['requestorId'] + time=requestorDict[bot.self_id][autoType][QQOrGroupId]['time'] # 参数设置完毕,开始处理请求 try: - if autoType == "group": - resMsg = ( - "群号{},邀请者{}".format(QQOrGroupId, requestorId) - + notice_msg - + comment - + "\n时间:{}\n".format(time) - ) - msgType = "group_msg" - groupList = await getReferIdList(bot) + if autoType=="group": + resMsg='群号{},邀请者{}'.format(QQOrGroupId,requestorId)+notice_msg+comment+'\n时间:{}\n'.format(time) + msgType='group_msg' + groupList=await getReferIdList(bot) + if int(QQOrGroupId) in groupList: - status = "已经添加成功,勿复添加" + print(1) + status='已经添加成功,勿复添加' else: - await bot.set_group_add_request(flag=flag, approve=approve) + print(2) + await bot.set_group_add_request(flag=flag,approve=approve) else: - resMsg = QQOrGroupId + notice_msg + comment + "\n{}\n".format(time) - msgType = "friend_msg" - friendList = await getReferIdList(bot, "user_id") + resMsg=QQOrGroupId+notice_msg+comment+'\n{}\n'.format(time) + msgType='friend_msg' + friendList=await getReferIdList(bot,'user_id') if int(QQOrGroupId) in friendList: - status = "已经添加成功,勿复添加" + status='已经添加成功,勿复添加' else: - if len(argsText) >= 2 and argsText[1] != "" and approve == True: - remark = argsText[1] + if len(argsText)>=2 and argsText[1]!='' and approve==True: + remark=argsText[1] # 备注似乎无用 - await bot.set_friend_add_request( - flag=flag, approve=approve, remark=remark - ) + await bot.set_friend_add_request(flag=flag,approve=approve,remark=remark) else: - await bot.set_friend_add_request(flag=flag, approve=approve) + await bot.set_friend_add_request(flag=flag,approve=approve) except: - status = "为何手动添加而后又删好友或退群又来这里同意?" + status='为何手动添加而后又删好友或退群又来这里同意?' finally: # 请求处理完毕,开始更易数据 - del requestorDict[autoType][QQOrGroupId] - writeData(requestorPath, requestorDict) - resMsg += status + del requestorDict[bot.self_id][autoType][QQOrGroupId] + writeData(requestorDictPath,requestorDict) + resMsg+=status # 数据更易完毕,开始用户交互,返回结果,发送欢迎 await addFriend.send(resMsg) # await bot.send_private_msg(user_id=event.user_id, message=resMsg) - # await sendMsg(bot,config['recipientList'],resMsg,0) - if status == "添加成功": + # await sendMsg(bot,config[bot.self_id]['recipientList'],resMsg,0) + if status=='添加成功': # 等待腾讯数据更新 await sleep(1.5) - welcome_msg = config[msgType]["welcome_msg"] + welcome_msg=config[bot.self_id][msgType]['welcome_msg'] await bot.send_private_msg(user_id=requestorId, message=welcome_msg) - # @scheduler.scheduled_job('interval', hour=1, id='check_outdate', timezone="Asia/Shanghai") -delRequestorDict = on_command("清理请求表", priority=5, block=True, permission=SUPERUSER) - - +delRequestorDict = on_command("清理请求表",priority=5, block=True,permission=SUPERUSER) @delRequestorDict.handle() -async def check_outdate(bot: Bot, event: MessageEvent): - delList = [] - for requestorType in requestorDict: - if requestorType != "friend": - ReferIdList = await getReferIdList(bot, "group_id") +async def check_outdate(bot:Bot, event: MessageEvent): + check_dict_key_bot_id(config,requestorDict,numDict,bot) + delList=[] + for requestorType in requestorDict: + if requestorType!='friend': + ReferIdList=await getReferIdList(bot,'group_id') else: - ReferIdList = await getReferIdList(bot, "user_id") - requestorList = list(requestorDict[requestorType]) + ReferIdList=await getReferIdList(bot,'user_id') + requestorList=list(requestorDict[bot.self_id][requestorType]) print(ReferIdList) for requestor in requestorList: if int(requestor) in ReferIdList: delList.append(requestor) - del requestorDict[requestorType][requestor] - writeData(requestorPath, requestorDict) - msg = "已清理如下:\n" + str(delList)[1:-1].replace(", ", " ") + del requestorDict[bot.self_id][requestorType][requestor] + writeData(requestorDictPath,requestorDict) + msg='已清理如下:\n'+str(delList)[1:-1].replace(', ',' ') await delRequestorDict.send(msg) -reFriendReqNum = on_command("重置好友请求", block=True, priority=5, permission=SUPERUSER) - - +reFriendReqNum = on_command("重置请求次数",block=True,priority=5,permission=SUPERUSER) @reFriendReqNum.handle() -async def _(bot: Bot, event: MessageEvent): - text = event.get_plaintext().strip() - max = config["numControl"]["maxNum"] - num, now, old = read_data(numPath) - if parseTime(config["numControl"], num, old, now) != -1: - await reFriendReqNum.send(message="未增满{}人,人数为{}上次添加时间{}".format(max, num, now)) - if "为" in text: - plaintext = re.findall("[0-9]", text) - if len(plaintext) == 0: - num = "0" - else: - num = plaintext[0] +async def _(bot: Bot, event: MessageEvent,args: Message = CommandArg()): + check_dict_key_bot_id(config,requestorDict,numDict,bot) + # text=event.get_plaintext().strip() + argsText=args.extract_plain_text().strip() + if '群聊' in argsText: + argsText=argsText.replace('群聊','').strip() + autoType='group' + elif '好友' in argsText: + argsText=argsText.replace('好友','').strip() + autoType='friend' else: - num = "0" - with open(numPath, "w", encoding="utf-8") as fp: - fp.write(num + "," + str(now)) - await reFriendReqNum.finish("重置成功,为{}".format(num)) - - -addRecipient = on_command( - "添加请求接收者", aliases={"删除请求接收者"}, block=True, priority=5, permission=SUPERUSER -) - + autoType='all' + max=config[bot.self_id]['numControl'][autoType]['maxNum'] + now=datetime.now() + # num,now,old=read_data(numPath) + if parseTime(config[bot.self_id]['numControl'][autoType],numDict[bot.self_id][autoType],now)!=-1: + await reFriendReqNum.send(message='未增满{}人,人数为{}上次添加时间{}'.format(max,numDict[bot.self_id][autoType]['count'],now)) + argsText=argsText.replace('为','').strip() + if argsText.isdigit(): + numDict[bot.self_id][autoType]['count']=int(argsText) + else: + numDict[bot.self_id][autoType]['count']=0 + numDict[bot.self_id][autoType]['time']=now + writeTime(numDictPath,numDict) + await reFriendReqNum.finish('重置成功,为{}'.format(numDict[bot.self_id][autoType]['count'])) +addRecipient = on_command("添加请求接收者",aliases={"删除请求接收者"},block=True,priority=5,permission=SUPERUSER) @addRecipient.handle() -async def _(bot: Bot, event: MessageEvent, args: Message = CommandArg()): - friend_list = await getReferIdList(bot, "user_id") +async def _(bot: Bot, event: MessageEvent,args: Message = CommandArg()): + check_dict_key_bot_id(config,requestorDict,numDict,bot) + friend_list=await getReferIdList(bot,'user_id') print(friend_list) - text = event.get_plaintext().strip() - argsText = args.extract_plain_text() - recipient = argsText - if recipient == "": - await addRecipient.send("格式") + text=event.get_plaintext().strip() + argsText=args.extract_plain_text() + recipient=argsText + if recipient=='': + await addRecipient.send('格式') if int(recipient) in friend_list: - if getExist("添加", text, argsText): - op = "添加" - if recipient not in config["recipientList"]: - config["recipientList"].append(recipient) + if getExist('添加',text,argsText): + op='添加' + if recipient not in config[bot.self_id]['recipientList']: + config[bot.self_id]['recipientList'].append(recipient) else: - op = "删除" - if recipient in config["recipientList"]: - config["recipientList"].remove(recipient) - writeData(configPath, config) - await addRecipient.send(op + "{}成功".format(recipient)) - else: - await addRecipient.finish("不是{}的好友或者格式错误".format(config["botName"])) - - -agreeForward = on_command("设置bot私聊转发", block=True, priority=5, permission=SUPERUSER) - - -@agreeForward.handle() -async def _(bot: Bot, event: MessageEvent): - # forwardSet=config['forwardSet'] - if config["forwardSet"] == 0: - config["forwardSet"] = 1 - msg = "开启成功哦" + op='删除' + if recipient in config[bot.self_id]['recipientList']: + config[bot.self_id]['recipientList'].remove(recipient) + writeData(configPath,config) + await addRecipient.send(op+'{}成功'.format(recipient)) else: - config["forwardSet"] = 0 - msg = "关闭成功哦" - writeData(configPath, config) - await agreeForward.send(msg) - - -msgControl = [0, datetime.now(), 1] - - -@event_preprocessor -async def sendPrivate(bot: Bot, event: PrivateMessageEvent): - if config["recipientList"] == [] or config["forwardSet"] == 0: - return - if msgControl[2] == 0: # - if (datetime.now() - msgControl[1]).seconds > 20: - msgControl[2] = 1 - else: - return - msgControl[0] += 1 - if msgControl[0] / ((datetime.now() - msgControl[1]).seconds + 1) > 10: - msgControl[2] = 0 - msgControl[1] = datetime.now() - msgControl[0] = 0 - if event.get_user_id() != config["recipientList"][0]: - plaintext = event.get_message() - await bot.send_private_msg( - user_id=int(config["recipientList"][0]), - message="叮~私聊消息\nqq:{}\n昵称:{}\n消息:{}".format( - event.user_id, event.sender.nickname, plaintext - ), - auto_escape=False, - ) - - -friendHelp = on_command("加好友帮助", block=True, priority=5, permission=SUPERUSER) - + await addRecipient.finish('不是{}的好友或者格式错误'.format(config[bot.self_id]['botName'])) +friendHelp=on_command("加好友帮助",block=True,priority=5,permission=SUPERUSER) @friendHelp.handle() async def _(bot: Bot, event: MessageEvent): - msg = "重载配置\n更改自动同意,更改最大加好友数量,更改查看加返回数量,更改加好友时间单位\n同意加,拒绝加,查看加(群、好友)\n清理请求表\n重置好友请求\n添加请求接收者,删除请求接收者" + msg='重载配置\n更改自动同意,更改最大加数量,更改查看加返回数量,更改加时间,更改加时间单位(群聊、好友)\n同意加,拒绝加,查看加(群聊、好友)\n清理请求表\n重置请求次数(群聊、好友)\n添加请求接收者,删除请求接收者' await friendHelp.send(msg) diff --git a/src/plugins/nonebot_plugin_addFriend/config.json b/src/plugins/nonebot_plugin_addFriend/config.json index fa0e541..0ba77eb 100644 --- a/src/plugins/nonebot_plugin_addFriend/config.json +++ b/src/plugins/nonebot_plugin_addFriend/config.json @@ -1,37 +1,46 @@ { - "agreeAutoApprove": { "friend": 1, "group": 0 }, - "numControl": { "maxNum": 5, "time": 2, "unit": "h" }, - "maxViewNum": 20, - "recipientList": ["1990248284"], - "forwardSet": 0, - "blackDict": { - "friend": { "text": [], "id": [] }, - "group": { "text": [], "id": [] }, - "forward": {} - }, - "warnDict": { - "friend": { "text": [], "id": [] }, - "group": { "text": [], "id": [] }, - "forward": {} - }, - "allowAddFriednText": [], - "botName": "姚奕", - "friend_msg": { - "notice_msg": "请求添加好友,验证消息为", - "welcome_msg": "你吼,我是姚奕!我的信息都会在我的说说更新,绝对不会骚扰到你滴!\n同时,如果有疑问,可以发送help哦" - }, - "group_msg": { - "notice_msg": "发送群邀请,验证消息为", - "welcome_msg": "很高兴有你的邀请,但要等我一下!" - }, - "statusDict": { + "1184441051": { + "agreeAutoApprove": { "friend": 1, "group": 1 }, + "recipientList": ["1990248284"], + "forwardSet": 0, + "numControl": { + "useAlgorithm": 0, + "maxNum": 6, + "time": 2, + "unit": "h", + "friend": { "maxNum": 6, "time": 2, "unit": "h" }, + "group": { "maxNum": 5, "time": 2, "unit": "h" } + }, + "maxViewNum": 20, "blackDict": { - "friend": { "status": "拉黑QQ,已拒绝,仅作提示" }, - "group": { "status": "拉黑群聊,已拒绝,仅作提示" } + "friend": { "text": [], "id": [] }, + "group": { "text": [], "id": [] }, + "forward": {} }, "warnDict": { - "friend": { "status": "警告QQ,手动同意,是否同意" }, - "group": { "status": "警告群聊,手动同意,是否同意" } + "friend": { "text": [], "id": [] }, + "group": { "text": [], "id": [] }, + "forward": {} + }, + "allowAddFriednText": [], + "botName": "姚奕", + "friend_msg": { + "notice_msg": "请求添加好友,验证消息为", + "welcome_msg": "你吼,我是姚奕!我的信息都会在我的说说更新,绝对不会骚扰到你滴!\n同时,如果有疑问,可以发送help哦" + }, + "group_msg": { + "notice_msg": "发送群邀请,验证消息为", + "welcome_msg": "很高兴有你的邀请,但要等我一下!" + }, + "statusDict": { + "blackDict": { + "friend": { "status": "拉黑QQ,已拒绝,仅作提示" }, + "group": { "status": "拉黑群聊,已拒绝,仅作提示" } + }, + "warnDict": { + "friend": { "status": "警告QQ,手动同意,是否同意" }, + "group": { "status": "警告群聊,手动同意,是否同意" } + } } } } diff --git a/src/plugins/nonebot_plugin_addFriend/configUtil.py b/src/plugins/nonebot_plugin_addFriend/configUtil.py index 131f488..f3d24ba 100644 --- a/src/plugins/nonebot_plugin_addFriend/configUtil.py +++ b/src/plugins/nonebot_plugin_addFriend/configUtil.py @@ -1,64 +1,107 @@ - - - -from os.path import dirname,exists +import copy +from datetime import datetime +from os.path import dirname, exists from nonebot import get_driver import json +from nonebot.adapters.onebot.v11 import Bot +from .utils import writeTime basedir = dirname(__file__) -numPath=basedir+'/num.txt' -configPath=basedir+'/config.json' -requestorPath=basedir+'/requestor.json' -max=5 -blackLogPath=basedir+'/.json' -def readData(path,content={}): +# numDictPath=basedir+'/num.txt' +configPath = f"{basedir}/config.json" +requestorDictPath = f"{basedir}/requestor.json" +numDictPath = f"{basedir}/num.json" +max = 6 +blackLogPath = f"{basedir}/blackLog.txt" + + +def check_dict_key_bot_id(config: dict, requestorDict: dict, numDict: dict, bot: Bot): + print(1) + if config.get(bot.self_id) is None: + config[bot.self_id] = copy.deepcopy(configModel) + writeData(configPath, config) + if requestorDict.get(bot.self_id) is None: + requestorDict[bot.self_id] = copy.deepcopy(requestorDictModel) + writeData(requestorDictPath, requestorDict) + if numDict.get(bot.self_id) is None: + numDict[bot.self_id] = copy.deepcopy(numDictModel) + for type in numDict[bot.self_id].keys(): + numDict[bot.self_id][type]["time"] = datetime.strptime( + numDict[bot.self_id][type]["time"], "%Y-%m-%d %H:%M:%S.%f" + ) + writeTime(numDictPath, numDict) + # return True + + +def readData(path, content={}, update=0) -> dict: if not exists(path): - with open(path,'w',encoding='utf-8') as fp: - json.dump(content,fp,ensure_ascii=False) - with open(path,'r',encoding='utf-8') as fp: + with open(path, "w", encoding="utf-8") as fp: + json.dump(content, fp, ensure_ascii=False) + with open(path, "r", encoding="utf-8") as fp: data = json.loads(fp.read()) return data -def writeData(path,content): - with open(path,'w',encoding='utf-8') as fp: - json.dump(content,fp,ensure_ascii=False) + + +def writeData(path, content): + with open(path, "w", encoding="utf-8") as fp: + json.dump(content, fp, ensure_ascii=False) + + # if not exists(configPath): -recipientList=list(get_driver().config.superusers) +recipientList = list(get_driver().config.superusers) # recipients=str(recipients)[1:-1].replace(' ','').replace("'",'') -configModel={ - "agreeAutoApprove": { "friend": 1, "group": 0 }, - "numControl": {"maxNum":5,"time":2,"unit":'h'}, - "maxViewNum":20, +# 可以在这里修改默认模板哦 +configModel = { + "agreeAutoApprove": {"friend": 1, "group": 0}, "recipientList": recipientList[:2], - "forwardSet":0, - "blackDict":{"friend":{"text":[],"id":[]},"group":{"text":[],"id":[]},"forward":{}},#"群号":"管理员号,转发给其用来揪出在群里拉人头的人" - "warnDict":{"friend":{"text":[],"id":[]},"group":{"text":[],"id":[]},"forward":{}}, - "allowAddFriednText":[], + "forwardSet": 0, + "numControl": { + "useAlgorithm": 0, + "maxNum": 6, + "time": 2, + "unit": "h", + "friend": {"maxNum": 6, "time": 2, "unit": "h"}, + "group": {"maxNum": 2, "time": 8, "unit": "h"}, + }, + "maxViewNum": 20, + "blackDict": { + "friend": {"text": [], "id": []}, + "group": {"text": [], "id": []}, + "forward": {}, + }, # "群号":"管理员号,转发给其用来揪出在群里拉人头的人" + "warnDict": { + "friend": {"text": [], "id": []}, + "group": {"text": [], "id": []}, + "forward": {}, + }, + "allowAddFriednText": [], "botName": "我", "friend_msg": { "notice_msg": "请求添加好友,验证消息为", - "welcome_msg": "我未知的的朋友啊,很高兴你添加我为qq好友哦!\n同时,如果有疑问,可以发送/help哦" + "welcome_msg": "我未知的的朋友啊,很高兴你添加我为qq好友哦!\n同时,如果有疑问,可以发送/help哦", }, - "group_msg": { - "notice_msg": "发送群邀请,验证消息为", - "welcome_msg": "我亲爱的的朋友啊,很高兴你邀请我哦!" + "group_msg": {"notice_msg": "发送群邀请,验证消息为", "welcome_msg": "我亲爱的的朋友啊,很高兴你邀请我哦!"}, + "statusDict": { + "blackDict": { + "friend": {"status": "拉黑QQ,已拒绝,仅作提示"}, + "group": {"status": "拉黑群聊,已拒绝,仅作提示"}, + }, + "warnDict": { + "friend": {"status": "警告QQ,手动同意,是否同意"}, + "group": {"status": "警告群聊,手动同意,是否同意"}, + }, }, - "statusDict":{ - "blackDict":{"friend":{"status":"拉黑QQ,已拒绝,仅作提示"},"group":{"status":"拉黑群聊,已拒绝,仅作提示"}}, - "warnDict":{"friend":{"status":"警告QQ,手动同意,是否同意"},"group":{"status":"警告群聊,手动同意,是否同意"}} - } } -config=readData(configPath,configModel) -requestorDict=readData(requestorPath,{"friend":{},"group":{}}) -# if not exists(requestorPath): -# requestorDict={} -# with open(requestorPath,'w',encoding='utf-8') as fp: -# json.dump(requestorDict,fp,ensure_ascii=False) - -# with open(requestorPath,'r',encoding='utf-8') as fp: -# requestorDict=json.loads(fp.read()) -# blackDictFriend=config["blackDict"]['friend'] -# warnDictFriend=config["warnDict"]['friend'] -# blackDictGroup=config["blackDict"]['group'] -# warnDictGroup=config["warnDict"]['group'] - - +requestorDictModel = {"friend": {}, "group": {}} +numDictModel = { + "friend": {"count": 0, "time": str(datetime.now())}, + "group": {"count": 0, "time": str(datetime.now())}, +} +config = readData(configPath) +requestorDict = readData(requestorDictPath) +numDict = readData(numDictPath) +for bot_id in numDict.keys(): + for type in numDict[bot_id].keys(): + numDict[bot_id][type]["time"] = datetime.strptime( + numDict[bot_id][type]["time"], "%Y-%m-%d %H:%M:%S.%f" + ) diff --git a/src/plugins/nonebot_plugin_addFriend/num.json b/src/plugins/nonebot_plugin_addFriend/num.json new file mode 100644 index 0000000..52c2f2c --- /dev/null +++ b/src/plugins/nonebot_plugin_addFriend/num.json @@ -0,0 +1 @@ +{"1184441051": {"friend": {"count": 0, "time": "2024-01-08 01:53:02.962721"}, "group": {"count": 0, "time": "2024-01-08 01:53:02.962741"}}} \ No newline at end of file diff --git a/src/plugins/nonebot_plugin_addFriend/num.txt b/src/plugins/nonebot_plugin_addFriend/num.txt deleted file mode 100644 index 381f984..0000000 --- a/src/plugins/nonebot_plugin_addFriend/num.txt +++ /dev/null @@ -1 +0,0 @@ -0,2024-01-07 22:49:52.680101 \ No newline at end of file diff --git a/src/plugins/nonebot_plugin_addFriend/requestor.json b/src/plugins/nonebot_plugin_addFriend/requestor.json index 7aa9bc8..ee9e789 100644 --- a/src/plugins/nonebot_plugin_addFriend/requestor.json +++ b/src/plugins/nonebot_plugin_addFriend/requestor.json @@ -1 +1 @@ -{"friend": {"3520349790": {"flag": "1691314504000000", "comment": "我是尚鱔若水", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3520349790, "time": "2023-08-06 17:35:16.476177"}, "3166168122": {"flag": "1691584112000000", "comment": "我是懒大羊", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3166168122, "time": "2023-08-09 20:30:26.922089"}, "2303316042": {"flag": "1691585518000000", "comment": "我是命运", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2303316042, "time": "2023-08-09 20:53:06.713139"}, "1510170938": {"flag": "1691745635000000", "comment": "", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1510170938, "time": "2023-08-11 17:27:50.268334"}, "1096741477": {"flag": "1691751250000000", "comment": " ", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1096741477, "time": "2023-08-11 18:54:21.685378"}, "2060595483": {"flag": "1691830707000000", "comment": "我是鹿行川", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2060595483, "time": "2023-08-12 16:58:27.933504"}, "3249474422": {"flag": "1691845606000000", "comment": "我是。。。。", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3249474422, "time": "2023-08-12 21:07:36.083797"}, "1206880084": {"flag": "1691992237000000", "comment": "我是河南第一深情🌷", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1206880084, "time": "2023-08-14 13:50:39.841484"}, "1615991754": {"flag": "1692024017000000", "comment": "我是", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1615991754, "time": "2023-08-14 22:40:17.447220"}, "485159068": {"flag": "1692026223000000", "comment": "", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 485159068, "time": "2023-08-14 23:21:16.956828"}, "2729390436": {"flag": "1692026842000000", "comment": "我是列车会准点吗", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2729390436, "time": "2023-08-14 23:29:02.356859"}, "39713397": {"flag": "1692523359000000", "comment": "我是黄某人", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 39713397, "time": "2023-08-20 17:22:58.960707"}, "1179087025": {"flag": "1692524975000000", "comment": "", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1179087025, "time": "2023-08-20 17:50:58.619678"}, "3272457094": {"flag": "1692548574000000", "comment": "我是小萌新", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3272457094, "time": "2023-08-21 00:25:04.405106"}, "2311434418": {"flag": "1692609891000000", "comment": "我是(恐龙(须佐能乎))", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2311434418, "time": "2023-08-21 17:24:53.564442"}, "1364275374": {"flag": "1692631531000000", "comment": "", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1364275374, "time": "2023-08-21 23:25:32.617722"}, "3052427173": {"flag": "1692687631000000", "comment": "你好", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3052427173, "time": "2023-08-22 15:01:03.221201"}, "255615990": {"flag": "1692703422000000", "comment": "我是🐸", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 255615990, "time": "2023-08-22 19:26:32.800864"}, "2153739924": {"flag": "1692703273000000", "comment": "我是傻鸟", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2153739924, "time": "2023-08-22 19:21:14.053363"}, "1708199722": {"flag": "1692761485000000", "comment": "我是树叶", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1708199722, "time": "2023-08-23 11:31:39.325427"}, "3652444511": {"flag": "1692765680000000", "comment": "我是y_笙", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3652444511, "time": "2023-08-23 12:44:46.879976"}, "1730474274": {"flag": "1692856526000000", "comment": "你好", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1730474274, "time": "2023-08-24 13:55:26.617197"}, "3629699397": {"flag": "1692861033000000", "comment": "我是zixi_ovo", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3629699397, "time": "2023-08-24 15:10:33.316581"}, "278041054": {"flag": "1693035303000000", "comment": "我是谂", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 278041054, "time": "2023-08-26 15:38:55.337236"}, "2682747563": {"flag": "1693112164000000", "comment": "(。・ω・。)ノ♡", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2682747563, "time": "2023-08-27 12:57:05.184135"}, "1693884596": {"flag": "1693129391000000", "comment": "我是ㅤㅤ", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1693884596, "time": "2023-08-27 17:47:34.885807"}, "2624957221": {"flag": "1693112503000000", "comment": "我是新纪元大神集合体:小昂昂", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2624957221, "time": "2023-08-27 13:02:05.648027"}, "246037201": {"flag": "1693131762000000", "comment": "", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 246037201, "time": "2023-08-27 18:23:10.611708"}, "3379799406": {"flag": "1693131907000000", "comment": "机器人我要邀请你进群(", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3379799406, "time": "2023-08-27 18:27:36.040196"}, "3545319560": {"flag": "1693132159000000", "comment": "我是事白勺", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3545319560, "time": "2023-08-27 18:29:48.383389"}, "2802874919": {"flag": "1694921191000000", "comment": "我是泰拉麻花", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2802874919, "time": "2023-09-17 11:26:31.544107"}, "2374215392": {"flag": "1694921333000000", "comment": "我是Error", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2374215392, "time": "2023-09-17 11:28:57.461410"}, "979882792": {"flag": "1694923107000000", "comment": "你说的对 但是我要玩原神", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 979882792, "time": "2023-09-17 11:59:38.673322"}, "746299121": {"flag": "1694925992000000", "comment": "", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 746299121, "time": "2023-09-17 12:51:28.662472"}, "1798252821": {"flag": "1696041509000000", "comment": "我是真正的耗子出现在你面前", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1798252821, "time": "2023-09-30 10:40:47.853253"}, "2468655725": {"flag": "1696042830000000", "comment": "我是🤨", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2468655725, "time": "2023-09-30 11:00:30.445372"}, "1686512300": {"flag": "1696055570000000", "comment": "🤓", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1686512300, "time": "2023-09-30 14:32:59.407667"}, "2304026423": {"flag": "1696057068000000", "comment": "我是o", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2304026423, "time": "2023-09-30 15:00:09.034996"}, "1793984627": {"flag": "1701868260000000", "comment": "我是小瑞", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1793984627, "time": "2023-12-06 21:11:16.299343"}, "3094654088": {"flag": "1701871476000000", "comment": "请输入文本", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3094654088, "time": "2023-12-06 22:04:47.401521"}, "2706676077": {"flag": "1702225047000000", "comment": "", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2706676077, "time": "2023-12-11 00:26:11.815658"}, "563778584": {"flag": "1702829312000000", "comment": "😃", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 563778584, "time": "2023-12-18 00:08:42.550461"}, "58273493": {"flag": "1703067631000000", "comment": "我是人", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 58273493, "time": "2023-12-20 18:27:17.898896"}, "3649686977": {"flag": "1703162412000000", "comment": "我是静夜思", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3649686977, "time": "2023-12-21 20:40:23.297562"}, "1120365460": {"flag": "1703166071000000", "comment": "", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1120365460, "time": "2023-12-21 21:42:32.859878"}, "1761239011": {"flag": "1703338064000000", "comment": "我为什么要介绍", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1761239011, "time": "2023-12-23 21:27:50.312187"}, "64296511": {"flag": "1703339248000000", "comment": "你好", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 64296511, "time": "2023-12-23 21:47:36.384717"}, "2665719042": {"flag": "1703396188000000", "comment": "我是🍪", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2665719042, "time": "2023-12-24 13:36:28.920982"}, "3656261329": {"flag": "1703400034000000", "comment": "我是杨骐鸣", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3656261329, "time": "2023-12-24 14:40:35.202027"}, "1481034179": {"flag": "1703988270000000", "comment": "我是banana", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1481034179, "time": "2023-12-31 10:04:56.666795"}, "408760785": {"flag": "1703988473000000", "comment": "你好", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 408760785, "time": "2023-12-31 10:08:30.493599"}, "3100129374": {"flag": "1704008559000000", "comment": "。", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3100129374, "time": "2023-12-31 15:42:44.948807"}, "506838923": {"flag": "1704008664000000", "comment": "我是我是小翼的狗", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 506838923, "time": "2023-12-31 15:44:33.616257"}, "3170455924": {"flag": "1704009984000000", "comment": "我是。。。。。。", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3170455924, "time": "2023-12-31 16:07:16.265870"}, "2372361622": {"flag": "1704010239000000", "comment": "wu?", "notice_msg": "请求添加好友,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2372361622, "time": "2023-12-31 16:10:51.769863"}}, "group": {"826305786": {"flag": "1689901715806933", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1022716728, "time": "2023-07-21 09:08:35.985138"}, "758034077": {"flag": "1689907502963573", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1022716728, "time": "2023-07-21 10:45:03.143161"}, "873373238": {"flag": "1690246420904746", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1022716728, "time": "2023-07-25 08:53:41.070639"}, "818961543": {"flag": "1692900084523239", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3024316045, "time": "2023-08-25 02:01:24.680566"}, "904451082": {"flag": "1690594099094302", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3024316045, "time": "2023-07-29 09:28:19.384875"}, "597241846": {"flag": "1690786750298717", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2024485305, "time": "2023-07-31 14:59:10.528007"}, "747966872": {"flag": "1690936210591651", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3494696571, "time": "2023-08-02 08:30:10.770147"}, "748298062": {"flag": "1690943628872630", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2107341878, "time": "2023-08-02 10:33:49.103809"}, "636960095": {"flag": "1693302037200128", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 629528440, "time": "2023-08-29 17:40:37.409433"}, "294435613": {"flag": "1691241827781326", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 724565079, "time": "2023-08-05 21:23:47.934721"}, "365337314": {"flag": "1691309256671933", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2316488927, "time": "2023-08-06 16:07:36.802379"}, "832671733": {"flag": "1691310089039183", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1811617967, "time": "2023-08-06 16:21:29.193180"}, "892881650": {"flag": "1691337169022375", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3024316045, "time": "2023-08-06 23:52:49.224854"}, "364741240": {"flag": "1691367164679394", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1148838702, "time": "2023-08-07 08:12:44.893168"}, "343509051": {"flag": "1691378027875914", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1447494750, "time": "2023-08-07 11:13:48.059221"}, "763936515": {"flag": "1691504126481193", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3024316045, "time": "2023-08-08 22:15:26.736592"}, "787509528": {"flag": "1691507087611632", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2459358157, "time": "2023-08-08 23:04:48.088008"}, "932298934": {"flag": "1691586848935080", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1811617967, "time": "2023-08-10 10:46:54.543857"}, "702759281": {"flag": "1691632940210489", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3011344989, "time": "2023-08-10 10:02:20.363574"}, "140460663": {"flag": "1691642780836092", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2739366186, "time": "2023-08-10 12:46:23.225000"}, "791931854": {"flag": "1691644313965424", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1523226651, "time": "2023-08-10 13:11:57.466710"}, "490872332": {"flag": "1691656966416898", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2120962356, "time": "2023-08-10 16:42:47.584212"}, "436882121": {"flag": "1691662305201799", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 57163553, "time": "2023-08-10 18:11:45.419343"}, "823784615": {"flag": "1691670797542197", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3597956856, "time": "2023-08-10 20:33:18.954266"}, "744673883": {"flag": "1691676781532724", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2459358157, "time": "2023-08-10 22:13:02.904682"}, "942336692": {"flag": "1691681256454500", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3466494002, "time": "2023-08-10 23:27:36.570176"}, "897778064": {"flag": "1691772897336325", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3528622213, "time": "2023-08-12 00:54:58.824320"}, "975619532": {"flag": "1691720598164584", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1811617967, "time": "2023-08-11 10:23:18.346765"}, "775992816": {"flag": "1692029008168408", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3441696478, "time": "2023-08-15 00:03:28.355820"}, "152666722": {"flag": "1692884649703525", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2316488927, "time": "2023-08-24 21:44:29.773659"}, "523677949": {"flag": "1691752764464964", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2422024548, "time": "2023-08-11 19:19:24.638318"}, "624129547": {"flag": "1691768232791303", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 762256556, "time": "2023-08-12 15:42:18.817576"}, "903784002": {"flag": "1691818156966030", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2316488927, "time": "2023-08-12 13:29:17.997898"}, "877294907": {"flag": "1691824421539695", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 198498270, "time": "2023-08-12 15:13:41.781872"}, "303639015": {"flag": "1691826138521350", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 198498270, "time": "2023-08-12 15:57:59.444688"}, "815414253": {"flag": "1691901557823629", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1523226651, "time": "2023-08-13 12:39:17.993832"}, "174708796": {"flag": "1691907298810498", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1131454997, "time": "2023-08-13 14:14:58.979737"}, "340074013": {"flag": "1691911773025821", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2422024548, "time": "2023-08-13 15:29:33.192679"}, "62129413": {"flag": "1691913763462029", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2043711161, "time": "2023-08-13 16:02:43.596649"}, "133182074": {"flag": "1691937149196261", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2722064402, "time": "2023-08-13 22:32:29.380131"}, "640482091": {"flag": "1691937172891728", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3110365206, "time": "2023-08-13 22:32:53.068072"}, "467304622": {"flag": "1691980486462261", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1811617967, "time": "2023-08-14 10:34:46.606154"}, "608384975": {"flag": "1691985049187958", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2815143212, "time": "2023-08-14 11:50:49.362939"}, "592894542": {"flag": "1691985736075573", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2815143212, "time": "2023-08-14 12:02:16.981527"}, "110226500": {"flag": "1692011514329161", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2907054075, "time": "2023-08-14 19:11:55.759567"}, "767796428": {"flag": "1692020938752347", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2189929027, "time": "2023-08-14 21:48:58.980394"}, "752718265": {"flag": "1692022348787964", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 198498270, "time": "2023-08-14 22:12:28.983248"}, "329897640": {"flag": "1692598593932381", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1179087025, "time": "2023-08-21 14:16:34.043898"}, "689158426": {"flag": "1692089284430467", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2771411271, "time": "2023-08-15 16:48:04.595197"}, "345054313": {"flag": "1692092951122152", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1782275114, "time": "2023-08-15 17:49:11.331617"}, "856710821": {"flag": "1692151691003275", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2120404579, "time": "2023-08-16 10:08:11.143859"}, "867652526": {"flag": "1692154182567922", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1850238974, "time": "2023-08-16 10:49:42.761888"}, "897437702": {"flag": "1692332183407636", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1850238974, "time": "2023-08-18 12:16:23.541703"}, "808115274": {"flag": "1692155178175143", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3042195162, "time": "2023-08-16 11:06:18.337728"}, "720507697": {"flag": "1692157378491300", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2174846579, "time": "2023-08-16 11:42:58.726873"}, "745531182": {"flag": "1692342245992908", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 744904607, "time": "2023-08-18 15:04:06.160472"}, "631227516": {"flag": "1693147404032666", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2140275643, "time": "2023-08-27 22:43:24.172797"}, "908439534": {"flag": "1692203507541688", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3180982425, "time": "2023-08-17 00:31:47.852552"}, "1170270063": {"flag": "1692522599103789", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3195881538, "time": "2023-08-20 17:10:01.836419"}, "562295307": {"flag": "1692240210970175", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3430813376, "time": "2023-08-17 10:43:31.137357"}, "654995098": {"flag": "1692324083812002", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3202297223, "time": "2023-08-18 10:01:23.938577"}, "757128718": {"flag": "1692348920382320", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1811617967, "time": "2023-08-18 16:55:20.633944"}, "751164947": {"flag": "1692349917517620", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 198498270, "time": "2023-08-18 17:11:57.660796"}, "771514066": {"flag": "1692350453346492", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2793057967, "time": "2023-08-18 17:20:54.534543"}, "375609874": {"flag": "1692352035990688", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3569997044, "time": "2023-08-18 17:47:16.650715"}, "633947123": {"flag": "1692377021825352", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3281758814, "time": "2023-08-19 00:43:41.958379"}, "485538685": {"flag": "1692403718334383", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2593506216, "time": "2023-08-19 08:08:38.426638"}, "893180454": {"flag": "1692404542944940", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2142861386, "time": "2023-08-19 08:22:23.146901"}, "728693139": {"flag": "1692515184021757", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1790006022, "time": "2023-08-20 15:06:24.283544"}, "790867106": {"flag": "1692517217728428", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2188223078, "time": "2023-08-20 15:40:48.004229"}, "496567228": {"flag": "1692520447151634", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1625573617, "time": "2023-08-20 16:34:07.356820"}, "691895322": {"flag": "1693214478131764", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3340016430, "time": "2023-08-28 17:21:18.525486"}, "876386806": {"flag": "1692784278045022", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2422024548, "time": "2023-08-23 17:51:18.290534"}, "851875818": {"flag": "1692775995574014", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1693762705, "time": "2023-08-23 15:33:15.883957"}, "721489870": {"flag": "1692616688110273", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 255615990, "time": "2023-08-21 19:18:08.242831"}, "490225354": {"flag": "1692851607447327", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3085866680, "time": "2023-08-24 12:33:27.831746"}, "708780164": {"flag": "1692623583860829", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3085866680, "time": "2023-08-21 21:13:04.039231"}, "192041683": {"flag": "1692715733846422", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 10043007, "time": "2023-08-22 22:48:54.340771"}, "881926135": {"flag": "1692665133035969", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3389824957, "time": "2023-08-22 08:45:33.217223"}, "891534557": {"flag": "1692677883047591", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3070343264, "time": "2023-08-22 12:18:03.196461"}, "928752417": {"flag": "1692684943911434", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2060595483, "time": "2023-08-22 14:15:44.046036"}, "954192104": {"flag": "1693207853223235", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3085866680, "time": "2023-08-28 15:30:53.453028"}, "781876203": {"flag": "1692702749111978", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3598834918, "time": "2023-08-22 19:12:29.598027"}, "307677715": {"flag": "1692741958811677", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2825626653, "time": "2023-08-23 06:05:59.014167"}, "780620228": {"flag": "1692759463370169", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2825626653, "time": "2023-08-23 10:57:43.582990"}, "546285256": {"flag": "1692851218345806", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3347428037, "time": "2023-08-24 12:26:58.542669"}, "717225218": {"flag": "1692759553505314", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2825626653, "time": "2023-08-23 10:59:13.718009"}, "721407720": {"flag": "1692759557138025", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3079384033, "time": "2023-08-23 10:59:17.344516"}, "818372421": {"flag": "1692781683609328", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3310464736, "time": "2023-08-23 17:08:04.238991"}, "683925443": {"flag": "1692797120545920", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3489378713, "time": "2023-08-23 21:25:20.685100"}, "642883229": {"flag": "1692797169803484", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3489378713, "time": "2023-08-23 21:26:09.962305"}, "869867288": {"flag": "1694920442736492", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3575415934, "time": "2023-09-17 11:14:02.910797"}, "667868495": {"flag": "1692806362583242", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3079384033, "time": "2023-08-23 23:59:22.943115"}, "791979405": {"flag": "1692809364838028", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2825626653, "time": "2023-08-24 00:49:24.976883"}, "427894861": {"flag": "1692851311912011", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3347428037, "time": "2023-08-24 12:28:32.378294"}, "313334973": {"flag": "1692858256140109", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2287589216, "time": "2023-08-24 14:24:16.647369"}, "893879669": {"flag": "1692863142427261", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1915034631, "time": "2023-08-24 15:45:42.656339"}, "329792024": {"flag": "1692925759767437", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3166125294, "time": "2023-08-25 09:09:19.985016"}, "638598168": {"flag": "1693028384494401", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 823875787, "time": "2023-08-26 13:39:44.847620"}, "680741661": {"flag": "1693051244218523", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2145889305, "time": "2023-08-26 20:00:47.505777"}, "606723784": {"flag": "1693068767413942", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3083397916, "time": "2023-08-27 00:52:47.620797"}, "621692319": {"flag": "1693106462347471", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3193722980, "time": "2023-08-27 11:21:02.704219"}, "244756078": {"flag": "1693143831152060", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 227575593, "time": "2023-08-27 21:43:51.622678"}, "860141935": {"flag": "1693224236711923", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 647129071, "time": "2023-08-28 20:03:56.843997"}, "772351957": {"flag": "1693394448373104", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3080794378, "time": "2023-08-30 19:21:19.231536"}, "188362658": {"flag": "1701700494342288", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2608516940, "time": "2023-12-04 22:34:54.499171"}, "901199024": {"flag": "1694187616128227", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2608516940, "time": "2023-09-08 23:40:16.277334"}, "743142654": {"flag": "1694357837864135", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 248063738, "time": "2023-09-10 22:57:18.083037"}, "921905840": {"flag": "1694199451176267", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3080794378, "time": "2023-09-09 02:57:31.283994"}, "528656225": {"flag": "1694217233661980", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 639495727, "time": "2023-09-09 07:53:53.826741"}, "137464082": {"flag": "1694234277618789", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 227575593, "time": "2023-09-09 12:39:24.844100"}, "857087507": {"flag": "1696064565037308", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3079384033, "time": "2023-09-30 17:02:45.194164"}, "924793292": {"flag": "1694358898311869", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3528761953, "time": "2023-09-10 23:14:58.519638"}, "128528260": {"flag": "1694430709473873", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2108886360, "time": "2023-09-11 19:11:49.612526"}, "1170321520": {"flag": "1694527706195687", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 918295890, "time": "2023-09-12 22:08:26.701604"}, "343887241": {"flag": "1694529397792194", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2818016446, "time": "2023-09-12 22:36:38.121646"}, "774661360": {"flag": "1694829851600602", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2208682590, "time": "2023-09-16 10:04:12.143507"}, "300969482": {"flag": "1694838159233017", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2738404324, "time": "2023-09-16 12:22:39.593799"}, "768907308": {"flag": "1694847969829131", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 823875787, "time": "2023-09-16 15:06:10.041855"}, "884974945": {"flag": "1694850499688440", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3444179231, "time": "2023-09-16 15:48:19.902500"}, "895348873": {"flag": "1694858071419695", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2276002878, "time": "2023-09-16 17:54:31.639022"}, "908403543": {"flag": "1694870218395873", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3110449989, "time": "2023-09-16 21:16:58.973073"}, "768742148": {"flag": "1694906615732016", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3488143135, "time": "2023-09-17 07:23:35.919408"}, "345928233": {"flag": "1694920576637343", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 285391595, "time": "2023-09-17 11:16:17.022459"}, "618526479": {"flag": "1694923234875982", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 979882792, "time": "2023-09-17 12:00:35.054496"}, "866491414": {"flag": "1694928870676763", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3085866680, "time": "2023-09-17 13:34:30.852684"}, "767424319": {"flag": "1694932540107802", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3556835928, "time": "2023-09-17 14:35:40.313920"}, "1022715553": {"flag": "1694937012574177", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2089781097, "time": "2023-09-17 15:50:12.833010"}, "927441966": {"flag": "1695393596173926", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2843234417, "time": "2023-09-22 22:39:56.423844"}, "509509150": {"flag": "1694967086125843", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2825626653, "time": "2023-09-18 00:11:26.279320"}, "705815854": {"flag": "1695262527509754", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 472568351, "time": "2023-09-21 10:15:27.671493"}, "750142789": {"flag": "1695390401813050", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 767210091, "time": "2023-09-22 21:46:42.075447"}, "724255136": {"flag": "1695626824969559", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2330053791, "time": "2023-09-25 15:27:05.147642"}, "627643186": {"flag": "1695826305589241", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 918295890, "time": "2023-09-27 22:51:45.767799"}, "868750846": {"flag": "1695908551353137", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3166891167, "time": "2023-09-28 21:42:31.854698"}, "835408658": {"flag": "1695908838820583", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2406186089, "time": "2023-09-28 21:47:19.393455"}, "524887734": {"flag": "1695909077097780", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 923526525, "time": "2023-09-28 21:51:17.292840"}, "140905897": {"flag": "1695996195580841", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1690615348, "time": "2023-09-29 22:03:15.740437"}, "878358410": {"flag": "1696131473656749", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2413943352, "time": "2023-10-01 11:37:53.843642"}, "885787986": {"flag": "1696073913513639", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3166891167, "time": "2023-09-30 19:40:32.142069"}, "913367553": {"flag": "1696121851372211", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1798252821, "time": "2023-10-01 08:57:31.527247"}, "371464963": {"flag": "1696126838530891", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1356709503, "time": "2023-10-01 10:21:02.236222"}, "784599681": {"flag": "1696131572872818", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2413943352, "time": "2023-10-01 11:39:33.232096"}, "905516559": {"flag": "1701622977142492", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2276002878, "time": "2023-12-04 01:02:57.303122"}, "935788080": {"flag": "1701699628107565", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3322412138, "time": "2023-12-04 22:20:28.270966"}, "864553221": {"flag": "1701773140050658", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1958135885, "time": "2023-12-05 18:45:40.213942"}, "929458535": {"flag": "1701831381668002", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1508707313, "time": "2023-12-06 10:56:21.800209"}, "935630064": {"flag": "1701866169687777", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2438296324, "time": "2023-12-06 20:36:09.950230"}, "764502814": {"flag": "1702013903628256", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 918295890, "time": "2023-12-08 13:38:23.791594"}, "1030826471": {"flag": "1702034156726204", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3444179231, "time": "2023-12-08 19:15:56.889745"}, "476554233": {"flag": "1702102326265081", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1131183961, "time": "2023-12-09 14:12:06.404794"}, "749295107": {"flag": "1702114280689138", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 3111244174, "time": "2023-12-09 17:31:20.857521"}, "733324164": {"flag": "1702219751620275", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 372818898, "time": "2023-12-10 22:49:12.122853"}, "738792048": {"flag": "1702177627428557", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 730571926, "time": "2023-12-10 11:07:07.592569"}, "322595003": {"flag": "1702189319897914", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 1639390020, "time": "2023-12-10 14:22:00.079246"}, "790858527": {"flag": "1704640009640374", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3045245078, "time": "2024-01-07 23:06:49.787916"}, "737776934": {"flag": "1702909111592871", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2388871922, "time": "2023-12-18 22:18:31.782203"}, "346415085": {"flag": "1703250928328482", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3328036975, "time": "2023-12-22 21:15:28.506719"}, "611985038": {"flag": "1703299135199173", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3111244174, "time": "2023-12-23 10:38:55.363383"}, "733839011": {"flag": "1703304185142797", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3638361566, "time": "2023-12-23 12:03:05.396709"}, "754102171": {"flag": "1703305772325421", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3349427217, "time": "2023-12-23 12:29:32.580128"}, "439897623": {"flag": "1703305837939425", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3349427217, "time": "2023-12-23 12:30:38.161892"}, "214323192": {"flag": "1703952900474518", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2181717284, "time": "2023-12-31 00:15:01.014049"}, "943152011": {"flag": "1703320304957915", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 3349427217, "time": "2023-12-23 16:31:45.155696"}, "763127660": {"flag": "1703324537733919", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2120962356, "time": "2023-12-23 17:42:17.943246"}, "829590531": {"flag": "1703352603286786", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1450625289, "time": "2023-12-24 01:30:03.463269"}, "732248619": {"flag": "1703512529541114", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 239182965, "time": "2023-12-25 21:55:29.768840"}, "627090292": {"flag": "1703559831208496", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 2119397703, "time": "2023-12-26 11:03:51.359338"}, "692782189": {"flag": "1703991569139218", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n此时增满5人,未能再自动添加", "requestorId": 2105285926, "time": "2023-12-31 10:59:29.287785"}, "934180647": {"flag": "1703998454840629", "comment": "", "notice_msg": "发送群邀请,验证消息为", "staus": "\n未允许自动添加", "requestorId": 1130326579, "time": "2023-12-31 12:54:15.416350"}}} \ No newline at end of file +{"1184441051": {"friend": {}, "group": {}}} \ No newline at end of file diff --git a/src/plugins/nonebot_plugin_addFriend/utils.py b/src/plugins/nonebot_plugin_addFriend/utils.py index 0bb4a51..692d872 100644 --- a/src/plugins/nonebot_plugin_addFriend/utils.py +++ b/src/plugins/nonebot_plugin_addFriend/utils.py @@ -1,26 +1,24 @@ - - - - - - +import copy +import json from nonebot import get_driver from nonebot.adapters.onebot.v11 import Bot, MessageSegment import os import datetime + + # from nonebot_plugin_txt2img import Txt2Img def filterFriend(comment,type,allowTextList): - if type=='friend': - if allowTextList==[]: - return True - for allowText in allowTextList: - if allowText in comment: - return True - return False - else: + if type != 'friend': + return True + if allowTextList==[]: return True + return any(allowText in comment for allowText in allowTextList) async def parseMsg(commandText,resMsg,font_size = 32,isText=1): + if type(resMsg)==list: + temp = ''.join(str(item)+'\n' for item in resMsg) + temp=temp.replace("'","").replace('"','') + resMsg=temp return resMsg[:400] # if len(resMsg)<=300 and isText==1: # return resMsg @@ -37,12 +35,9 @@ async def getReferIdList(bot:Bot,idName='group_id',no_cache=True): else: idName='group_id' referInfoList=await bot.get_group_list(no_cache=no_cache) - referIdList=[] - for temp in referInfoList: - referIdList.append(temp[idName]) - return referIdList + return [temp[idName] for temp in referInfoList] + - async def sendMsg(bot:Bot,recipientList,msg:str,op=0): '''群发消息''' if not isinstance(recipientList,list): @@ -61,30 +56,41 @@ async def sendMsg(bot:Bot,recipientList,msg:str,op=0): def getExist(plainCommandtext:str,wholeMessageText:str,argsText:str): '''返回命令''' commandText=wholeMessageText[::-1].replace(argsText[::-1],'',1)[::-1].strip() - if plainCommandtext=='': - return commandText - else: - return plainCommandtext in commandText + return commandText if not plainCommandtext else plainCommandtext in commandText - -def read_data(numPath): - '''读时间''' - global num,now,old - if not os.path.exists(numPath): - now = datetime.datetime.now() - with open(numPath, "w", encoding="utf-8") as fp: - fp.write('1'+','+str(now)) - with open(numPath,'r',encoding='utf-8') as fp: - data_list=fp.read().split(',') - if len(data_list)<2: - now = datetime.datetime.now() - data_list=['1',str(now)] - num=int(data_list[0]) - old=datetime.datetime.strptime(data_list[1], "%Y-%m-%d %H:%M:%S.%f") - now = datetime.datetime.now() - return num,now,old +# def read_time(numPath:str)->dict: +def readTime(numDict:dict) -> dict: + '''读时间''' + # global num,now,old + # if not os.path.exists(numPath): + # now = datetime.datetime.now() + # with open(numPath, "w", encoding="utf-8") as fp: + # fp.write('1'+','+str(now)) + # with open(numPath,'r',encoding='utf-8') as fp: + # data_list=fp.read().split(',') + # if len(data_list)<2: + # now = datetime.datetime.now() + # data_list=['1',str(now)] + # num=int(data_list[0])sssssssss + # old=datetime.datetime.strptime(data[type]["time"], "%Y-%m-%d %H:%M:%S.%f") + # now = datetime.datetime.now() + for id in numDict: + for type in numDict[id].keys(): + numDict[id][type]["time"]=datetime.datetime.strptime(numDict[id][type]["time"], "%Y-%m-%d %H:%M:%S.%f") + # now = datetime.datetime.now() + return numDict +def writeTime(numDictPath,numDict:dict) -> dict: + '''写时间''' + numDictTemp=copy.deepcopy(numDict) + for id in numDictTemp: + for type in numDictTemp[id].keys(): + numDictTemp[id][type]["time"]=str(numDictTemp[id][type]["time"]) + with open(numDictPath,'w',encoding='utf-8') as fp: + json.dump(numDictTemp,fp,ensure_ascii=False) + # now = datetime.datetime.now() + return numDictTemp def writeLog(logPath,logContent): with open(logPath, "a", encoding="utf-8") as fp: fp.write(logContent) @@ -107,34 +113,33 @@ def isNormalAdd(config,autoType,addInfo,agreeAutoApprove): for balckText in blackDict["text"]: if balckText in name: return -1,status - status=warnStatusDict["status"]+"\n昵称{}\n是否同意".format(name) + status = warnStatusDict["status"] + f"\n昵称{name}\n是否同意" if id in warnDict["id"]: return 0,status for warnText in warnDict["text"]: if warnText in name: return 0,status if agreeAutoApprove==1: - status='\nqq{}昵称{}添加成功'.format(id,name) + status = f'\nqq{id}昵称{name}添加成功' return agreeAutoApprove,status - status="\n昵称{}\n是否同意".format(name) + #当初应该没在agreeAutoApprove上区分警告和非自动同意,状态里区分了 + status = f"\n昵称{name}\n是否同意" return agreeAutoApprove,status def parseTimeInterval(old='2022-06-21 20:57',now='',op='int'): if isinstance(old,str): - old=datetime.datetime.strptime(old, "%Y-%m-%d %H:%M") + old=datetime.datetime.strptime(old, "%Y-%m-%d %H:%M:%S.%f") if now=='': now=datetime.datetime.now() elif isinstance(now,str): - now=datetime.datetime.strptime(now, "%Y-%m-%d %H:%M") + now=datetime.datetime.strptime(now, "%Y-%m-%d %H:%M:%S.%f") symbol=1 if now.date()<=old.date(): temp=datetime.datetime.strptime(str(now.date()), "%Y-%m-%d") if (now-temp).seconds<(old-temp).seconds: - temp=old - old=now - now=temp - symbol=-1 + old, now = now, old + symbol=-1 interval=now-old days=interval.days seconds=interval.seconds @@ -144,18 +149,18 @@ def parseTimeInterval(old='2022-06-21 20:57',now='',op='int'): return {'days':days*3600*24*symbol,'seconds':seconds*symbol} -def parseTime(numControl:dict,num,old,now): - time=parseTimeInterval(old,now) +def parseTime(numControl:dict,numTypedDict,now): + time=parseTimeInterval(numTypedDict["time"],now) if numControl['unit']=='h': if time/3600>numControl['time']: - num=0 + numTypedDict["count"]=0 elif numControl['unit']=='m': if time/60>numControl['time']: - num=0 - else: - if time/3600/24>numControl['time']: - num=0 - if num>=numControl["maxNum"]: + numTypedDict["count"]=0 + elif time/3600/24>numControl['time']: + numTypedDict["count"]=0 + if numTypedDict["count"]>=numControl["maxNum"]: return -1 - else: - return num+1 + numTypedDict["count"]=numTypedDict["count"]+1 + numTypedDict['time']=now + return numTypedDict["count"] \ No newline at end of file diff --git a/src/plugins/waifu/__init__.py b/src/plugins/waifu/__init__.py index 9d95301..dcebb57 100644 --- a/src/plugins/waifu/__init__.py +++ b/src/plugins/waifu/__init__.py @@ -87,7 +87,7 @@ async def reset_record(): from nonebot import require scheduler = require("nonebot_plugin_apscheduler").scheduler -scheduler.add_job(reset_record, "cron", hour=0, misfire_grace_time=120) +scheduler.add_job(reset_record, "cron", hour=3, misfire_grace_time=120) async def waifu_rule(bot: Bot, event: GroupMessageEvent, state: T_State) -> bool: