先驱社区

先驱Nonebot的一些问题

在我开发自动好友同意出现了未知的错误
代码:

#oding = utf-8
# -*- coding:utf-8 -*-
from nonebot import on_request, RequestSession
import nonebot

bot = nonebot.get_bot()  # 在此之前必须已经 init
sid=1806267337

@on_request('friend')
async def auto_add_friend(session: RequestSession):
    await session.bot.set_friend_add_request(flag=session.event['flag'],self_id=sid,approve=True)
    await bot.set_friend_add_request(flag=session.event['flag'],self_id=sid)
    await bot.send_private_msg(user_id=session.event['flag'],message="[YBOT-AUTO]已自动添加好友",self_id=sid)

这是控制台日志

[2021-08-15 16:21:06,574 nonebot] INFO: Request: <Event, {'comment': '', 'flag': 2581487884, 'post_type': 'request', 'request_type': 'friend', 'self_id': 1806267337, 'time': 0, 'user_id': 1806267337}>
[2021-08-15 16:21:06,574 nonebot] DEBUG: Emitting event: request.friend
[2021-08-15 16:21:06,570] INFO in __init__: received event: request.friend

并没有同意好友和发送消息,但是先驱框架内日志显示了
先驱日志如下

1|16:20:48|框架|公告|欢迎使用先驱机器人!
2|16:20:48|框架|公告|禁止用于一切违法违规用途
3|16:20:48|框架|自检|正在检测是否需要更新文件...
4|16:20:49|框架|自检|更新检测执行完成..
5|16:20:49|框架|提示|正在测试能用的服务器..
6|16:20:51|框架|提示|正在解析服务器列表..
7|16:20:51|框架|提示|已自动选用111.161.107.179作为UDP登录服务器.
8|16:20:52|OneBot-YaYa|提示|加载插件:OneBot-YaYa 初始耗时->0.031秒
9|16:20:52|先驱|插件|事件依赖注入...2
10|16:20:52|赛马|提示|加载插件:赛马 初始耗时->0.235秒
11|16:20:52|赛马|自检|(此插件Sdk版本略旧,在未来版本中可能会无法使用此插件,请及时升级...)
12|16:20:52|OneBot-YaYa|插件|[INFO] 夜夜は世界一かわいい
13|16:20:52|OneBot-YaYa|插件|[WARN] !!!!!!!!配置文件版本更新了,请重新配置配置文件
14|16:20:52|OneBot-YaYa|插件|[INFO] おはようございます。
15|16:20:52|OneBot-YaYa|插件|[INFO] [心跳] XQ ==> ==> Plugins
16|16:20:52|1806267337|登录|连接UDP服务器->111.161.107.179
17|16:20:52|1806267337|登录|接触服务器->OK
18|16:20:52|OneBot-YaYa|插件|[INFO] [连接][反向WS][1806267337] BOT ==> ==> ws://127.0.0.1:8080/ws 
19|16:20:52|OneBot-YaYa|插件|[INFO] [监听][反向WS][1806267337] BOT ==> ==> ws://127.0.0.1:8080/ws 
20|16:20:53|OneBot-YaYa|插件|[INFO] [连接][反向WS][2581487884] BOT ==> ==> ws://127.0.0.1:8080/ws 
21|16:20:53|OneBot-YaYa|插件|[INFO] [监听][反向WS][2581487884] BOT ==> ==> ws://127.0.0.1:8080/ws 
22|16:20:53|1806267337|登录|置上线状态中..
23|16:20:53|1806267337|登录|上线状态->OK
24|16:20:53|1806267337|自检|Skey获取->OK
25|16:20:53|1806267337|登录|登录完成->上线完成
26|16:20:53|1806267337|事件|勋章墙等级加速->OK 获得了0.2天加速
27|16:20:53|1806267337|事件|手Q游戏等级加速->OK 获得了0.2天加速
28|16:20:53|OneBot-YaYa|插件|[INFO] [上报][反向WS][1806267337] BOT ==> ==> ws://127.0.0.1:8080/ws 
29|16:20:53|OneBot-YaYa|插件|[INFO] [上报][反向WS][2581487884] BOT ==> ==> ws://127.0.0.1:8080/ws 
30|16:20:55|1806267337|事件|QQ(2581487884)申请添加(1806267337)为好友
31|16:20:55|OneBot-YaYa|插件|[DEBUG] [上报][反向WS][1806267337] ws://127.0.0.1:8080/ws <- {"comment":"\u0001\u0001\u0001\u0001","flag":2581487884,"post_type":"request","request_type":"friend","self_id":1806267337,"time":0,"user_id":1806267337}
32|16:20:55|OneBot-YaYa|插件|[DEBUG] [响应][HTTP][1806267337] BOT <- ws://127.0.0.1:8080/ws API: set_friend_add_request Params: {"action": "set_friend_add_request", "params": {"flag": 2581487884, "self_id": 1806267337, "approve": true}, "echo": {"seq": 1}}
33|16:20:55|OneBot-YaYa|插件|[DEBUG] [上报][反向WS][1806267337] ws://127.0.0.1:8080/ws <- {"status":"ok","retcode":0,"data":{},"echo":{"seq":1}}
34|16:20:55|OneBot-YaYa|插件|[DEBUG] [响应][HTTP][1806267337] BOT <- ws://127.0.0.1:8080/ws API: set_friend_add_request Params: {"action": "set_friend_add_request", "params": {"flag": 2581487884, "self_id": 1806267337}, "echo": {"seq": 2}}
35|16:20:55|OneBot-YaYa|插件|[DEBUG] [上报][反向WS][1806267337] ws://127.0.0.1:8080/ws <- {"status":"ok","retcode":0,"data":{},"echo":{"seq":2}}
36|16:20:55|OneBot-YaYa|插件|[DEBUG] [响应][HTTP][1806267337] BOT <- ws://127.0.0.1:8080/ws API: send_private_msg Params: {"action": "send_private_msg", "params": {"user_id": 2581487884, "message": "[YBOT-AUTO]\u5df2\u81ea\u52a8\u6dfb\u52a0\u597d\u53cb", "self_id": 1806267337}, "echo": {"seq": 3}}
37|16:20:55|1806267337|请求|插件->[OneBot-YaYa]->QQ(2581487884): [YBOT-AUTO]已自动添加好友
38|16:20:55|1806267337|发送好友|QQ(2581487884): [YBOT-AUTO]已自动添加好友
39|16:20:55|1806267337|自检|长消息分包数量:1
40|16:20:56|OneBot-YaYa|插件|[DEBUG] [上报][反向WS][1806267337] ws://127.0.0.1:8080/ws <- {"status":"ok","retcode":0,"data":{"message_id":0},"echo":{"seq":3}}
41|16:20:57|1806267337|事件|安全管家等级加速->OK 获得了0.2天加速
42|16:21:06|1806267337|事件|QQ(2581487884)申请添加(1806267337)为好友
43|16:21:06|OneBot-YaYa|插件|[DEBUG] [上报][反向WS][1806267337] ws://127.0.0.1:8080/ws <- {"comment":"","flag":2581487884,"post_type":"request","request_type":"friend","self_id":1806267337,"time":0,"user_id":1806267337}
44|16:21:06|OneBot-YaYa|插件|[DEBUG] [响应][HTTP][1806267337] BOT <- ws://127.0.0.1:8080/ws API: set_friend_add_request Params: {"action": "set_friend_add_request", "params": {"flag": 2581487884, "self_id": 1806267337, "approve": true}, "echo": {"seq": 4}}
45|16:21:06|OneBot-YaYa|插件|[DEBUG] [上报][反向WS][1806267337] ws://127.0.0.1:8080/ws <- {"status":"ok","retcode":0,"data":{},"echo":{"seq":4}}
46|16:21:06|OneBot-YaYa|插件|[DEBUG] [响应][HTTP][1806267337] BOT <- ws://127.0.0.1:8080/ws API: set_friend_add_request Params: {"action": "set_friend_add_request", "params": {"flag": 2581487884, "self_id": 1806267337}, "echo": {"seq": 5}}
47|16:21:06|OneBot-YaYa|插件|[DEBUG] [上报][反向WS][1806267337] ws://127.0.0.1:8080/ws <- {"status":"ok","retcode":0,"data":{},"echo":{"seq":5}}
48|16:21:06|OneBot-YaYa|插件|[DEBUG] [响应][HTTP][1806267337] BOT <- ws://127.0.0.1:8080/ws API: send_private_msg Params: {"action": "send_private_msg", "params": {"user_id": 2581487884, "message": "[YBOT-AUTO]\u5df2\u81ea\u52a8\u6dfb\u52a0\u597d\u53cb", "self_id": 1806267337}, "echo": {"seq": 6}}
49|16:21:06|1806267337|请求|插件->[OneBot-YaYa]->QQ(2581487884): [YBOT-AUTO]已自动添加好友
50|16:21:06|1806267337|发送好友|QQ(2581487884): [YBOT-AUTO]已自动添加好友
51|16:21:06|1806267337|自检|长消息分包数量:1
52|16:21:06|OneBot-YaYa|插件|[DEBUG] [上报][反向WS][1806267337] ws://127.0.0.1:8080/ws <- {"status":"ok","retcode":0,"data":{"message_id":0},"echo":{"seq":6}}

求解答

你干了什么?