GithubHelp home page GithubHelp logo

ieew / nonebot_adapter_mirai2 Goto Github PK

View Code? Open in Web Editor NEW
20.0 3.0 6.0 1.17 MB

nonebot2 的三方 adapter,用以为 nonebot2 提供 MiraiApiHttp2 协议支持

Home Page: https://ieew.github.io/nonebot_adapter_mirai2/

License: GNU Affero General Public License v3.0

Python 100.00%
nonebot2 nonebot nonebot-adapter python3 mirai-api-http mirai mirai-bot

nonebot_adapter_mirai2's Introduction

nonebot_adapter_mirai2's People

Contributors

d2814 avatar ieew avatar jiangjiu55 avatar kamijotoma avatar qubenhao avatar yabaia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nonebot_adapter_mirai2's Issues

接收到@消息会报错

nb控制台日志:

Task exception was never retrieved
future: <Task finished name='Task-86' coro=<process_event() done, defined at /usr/local/lib/python3.8/dist-packages/nonebot/adapters/mirai2/utils.py:96> exception=AttributeError("'NoneType' object has no attribute 'type'")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/nonebot/adapters/mirai2/utils.py", line 103, in process_event
    event = process_at(bot, event)
  File "/usr/local/lib/python3.8/dist-packages/nonebot/adapters/mirai2/utils.py", line 60, in process_at
    at = event.message_chain.extract_first(MessageType.AT)
  File "/usr/local/lib/python3.8/dist-packages/nonebot/adapters/mirai2/message.py", line 408, in extract_first
    if (not type) or (first.type in type):
AttributeError: 'NoneType' object has no attribute 'type'

nb版本:2.0.0-beta.2
mirai-http-api版本:2.4.0

启动后报错

报错内容为:server rejected WebSocket connection: HTTP 404
nb版本为:2.0.0-beta.2
完整的运行日志如下:

root@localhost:~/bot# nb run                                                                                       
03-04 02:43:27 [SUCCESS] nonebot | NoneBot is initializing...                                                      
03-04 02:43:27 [INFO] nonebot | Current Env: prod                                                                  
03-04 02:43:27 [SUCCESS] nonebot | Succeeded to import "nonebot.plugins.single_session"                            
03-04 02:43:29 [SUCCESS] nonebot | Succeeded to import "nonebot.plugins.echo"                                      
03-04 02:43:29 [SUCCESS] nonebot | Running NoneBot...                                                              
03-04 02:43:29 [INFO] uvicorn | Started server process [5511]                                                      
03-04 02:43:29 [INFO] uvicorn | Waiting for application startup.                                                   
03-04 02:43:29 [INFO] uvicorn | Application startup complete.                                                      
03-04 02:43:29 [INFO] uvicorn | Uvicorn running on http://127.0.0.1:8080 (Press CTRL+C to quit)                    
03-04 02:43:39 [WARNING] nonebot | Mirai V2 | server rejected WebSocket connection: HTTP 404                       
03-04 02:43:52 [WARNING] nonebot | Mirai V2 | server rejected WebSocket connection: HTTP 404                       
03-04 02:44:06 [WARNING] nonebot | Mirai V2 | server rejected WebSocket connection: HTTP 404                       
03-04 02:44:19 [WARNING] nonebot | Mirai V2 | server rejected WebSocket connection: HTTP 404                       
03-04 02:44:32 [WARNING] nonebot | Mirai V2 | server rejected WebSocket connection: HTTP 404                       
03-04 02:44:45 [WARNING] nonebot | Mirai V2 | server rejected WebSocket connection: HTTP 404                       
03-04 02:44:58 [WARNING] nonebot | Mirai V2 | server rejected WebSocket connection: HTTP 404                       
03-04 02:45:11 [WARNING] nonebot | Mirai V2 | server rejected WebSocket connection: HTTP 404                       
03-04 02:45:24 [WARNING] nonebot | Mirai V2 | server rejected WebSocket connection: HTTP 404                       
03-04 02:45:37 [WARNING] nonebot | Mirai V2 | server rejected WebSocket connection: HTTP 404                       
03-04 02:45:50 [WARNING] nonebot | Mirai V2 | server rejected WebSocket connection: HTTP 404                       
03-04 02:46:03 [WARNING] nonebot | Mirai V2 | server rejected WebSocket connection: HTTP 404                       
^C03-04 02:46:06 [INFO] uvicorn | Shutting down                                                                    
03-04 02:46:06 [INFO] uvicorn | Waiting for application shutdown.                                                  
03-04 02:46:06 [INFO] uvicorn | Application shutdown complete.                                                     
03-04 02:46:06 [INFO] uvicorn | Finished server process [5511]    

配置文件如下:

  • mirai-http-api:
adapters: 
  - http
  - ws
debug: false
enableVerify: true
verifyKey: AmiyaBot
singleMode: false
cacheSize: 4096
adapterSettings: 
  http:
    host: 127.0.0.1
    port: 8096
    cors: [*]
  ws:
    host: 127.0.0.1
    port: 8060
    reservedSyncId: -1

  • .nev.prod:
driver=nonebot.drivers.fastapi+nonebot.drivers.httpx+nonebot.drivers.websockets
VERIFY_KEY=AmiyaBot
MIRAI_HOST=127.0.0.1  
MIRAI_PORT=8096  
MIRAI_QQ=[3181952556] 

quote 无法正常使用

在使用quote类型的MessageSegment时,无法通过 mather.send(quote + "some text") 的方式正常发出,其中 quote 的构建方式如下所示,其中的内容与下方示例字典一致,可以确认的是 quote 的构建是没有问题的

image

在发送后,其中 quote 部分会被直接丢弃,发送的消息仅会保留 some text 部分。

我注意到,在bot的send方法中包含了quote字段,但根据 mah的文档,此 quote 仅需要被回复消息的 message_id,也不是 MessageSegment 中的 quote

https://github.com/ieew/nonebot_adapter_mirai2/blob/main/nonebot/adapters/mirai2/bot.py#L39

开头带at的消息不能正常分配给on_command

  • 预期情况:
    bot收到一条消息@bot /帮助,带有on_command("帮助", rule=to_me())的响应器会被执行
  • 实际情况:
    on_command("帮助", rule=to_me())不会执行,on_command("帮助")也不会执行。但是收到/帮助 @bot时会执行

以前没有这个问题,原因应该是#37 (comment) ,需要把at弹出消息链,on_command才能正常工作。(或者难道是on_command本来就不应该响应这种消息,以前是不正常的,现在才是正确的?)

获取群成员及好友资料信息错误

RT.

如何复现

member_info = await bot.member_pro_file(target=event.sender.group.id,member_id=event.sender.id)
friend_info = await bot.friend_pro_file(target=event.sender.id)

非预期报告

nonebot.exception.ActionFailed: mirai V2 | {'code': 6, 'msg': '指定操作不支持'}

Traceback

图片
图片

版本信息

mirai-api-http:2.4.0
nonebot_adapter_mirai2:0.0.11

也有可能是我使用方法有误或者上游出现问题×

适配时遇到问题

在从nonebot.adapters.onebot.v11转到nonebot_adapter_mirai2时遇到了一个问题:

onebot.v11中定义了permission=GROUP为群中所有的成员所拥有的权限,而在nonebot_adapter_mirai2中将该权限分为了GROUP_MEMBER,GROUP_ADMIN,GROUP_ADMINS,GROUP_OWNER,GROUP_OWNER_SUPERUSER,SUPERUSER

在原插件(nonebot_plugin_fortune)中部分使用的GROUP权限的代码如下:

...
plugin_help = on_command("运势帮助", permission=GROUP, priority=8, block=True)
divine = on_command("今日运势", aliases={"抽签", "运势"}, permission=GROUP, priority=8, block=True)
limit_setting = on_regex(r"指定(.*?)签", permission=GROUP, priority=8, block=True)
theme_setting = on_regex(r"设置(.*?)签", permission=SUPERUSER | GROUP_ADMIN | GROUP_OWNER, priority=8, block=True)
reset = on_command("重置抽签", permission=SUPERUSER | GROUP_ADMIN | GROUP_OWNER, priority=8, block=True)
theme_list = on_command("主题列表", permission=GROUP, priority=8, block=True)
show = on_command("抽签设置", permission=GROUP, priority=8, block=True)
...

如果我要将其改为nonebot_adapter_mirai2所拥有的权限,是需要将其全部替换为GROUP_MEMBER, GROUP_ADMIN, GROUP_OWNER吗?如果不是的话,应该怎么替换呢?

quote消息类型的一点疑问

尝试使用以下代码构造回复消息时提示错误信息

await test.finish(MessageSegment.quote(event.source.id,0,这里是sender_id,bot.self_id,MessageChain("test")))

Error

nonebot.exception.ActionFailed: mirai V2 | {'code': 500, 'msg': 'message is empty'}

附完整log
图片
图片

adapter V0.0.10
mah V2.4

请问是我的使用方法存在问题吗,十分感谢!

日志缺失

当连接失败的时候 nonebot_adapter_mirai2 缺乏日志输出。

V0.0.9 “Waiting for application startup”

没错,又双叒叕是我
这个问题一开始没有发现,因为发送/接收各种消息类型已经没有问题了
直到有一次,在开发环境中使用ctrl+c发现终止不了nb进程了(
发现日志一直显示Waiting for application startup,但可以正常发送/接收消息
v 0.0.9
图片
下面是之前正常的情况(v 0.0.6)
图片

目前发现这会导致@driver.on_startup无法启动(可能导致一些插件运行异常)

driver=get_driver()
@driver.on_startup
async def _():
    logger.warning("succ")

见上图,无法输出succ,一直卡在startup

mah 2.4.0 nonebot2 2.0.0b2 python 3.10.0
已按照wiki正确配置

不是很急( 辛苦了

mirai2适配器下发送本地语音有问题

描述问题:
mirai2适配器下发送本地语音有问题

如何复现?

from nonebot.adapters.mirai2.message import MessageSegment

await command.finish(MessageSegment.voice(path="/../../xxx.mp3"))

不知道是什么问题,试了下上传本地图片是没问题的

环境信息:

  • OS: Linux
  • Python Version: 3.10.5
  • Nonebot Version: 2.0

FriendInputStatusChangedEvent : ValueError: Event has no message!

09-01 19:46:35 [SUCCESS] nonebot | MIRAI V2 **** | [FriendInputStatusChangedEvent]: {'self_id': ****, 'type': 'FriendInputStatusChangedEvent', 'inputting': False, 'friend': {'id': ****, 'nickname': 'むきゆー', 'remark': 'むきゆー'}}
09-01 19:46:35 [WARNING] nonebot | Error while parsing command for event
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Program\Files\python\38\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "D:\Program\Files\python\38\lib\multiprocessing\spawn.py", line 129, in _main
    return self._bootstrap(parent_sentinel)
  File "D:\Program\Files\python\38\lib\multiprocessing\process.py", line 315, in _bootstrap
    self.run()
  File "D:\Program\Files\python\38\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "D:\_个人\python项目\机器人插件环境\venv\Lib\site-packages\uvicorn\_subprocess.py", line 76, in subprocess_started
    target(sockets=sockets)
  File "D:\_个人\python项目\机器人插件环境\venv\Lib\site-packages\uvicorn\server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "D:\Program\Files\python\38\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "D:\Program\Files\python\38\lib\asyncio\base_events.py", line 603, in run_until_complete
    self.run_forever()
  File "D:\Program\Files\python\38\lib\asyncio\base_events.py", line 570, in run_forever
    self._run_once()
  File "D:\Program\Files\python\38\lib\asyncio\base_events.py", line 1859, in _run_once
    handle._run()
  File "D:\Program\Files\python\38\lib\asyncio\events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "D:\_个人\python项目\机器人插件环境\venv\Lib\site-packages\nonebot\adapters\mirai2\utils.py", line 71, in process_event
    await handle_event(bot, event)
> File "D:\_个人\python项目\机器人插件环境\venv\Lib\site-packages\nonebot\message.py", line 293, in handle_event
    TrieRule.get_value(bot, event, state)
  File "D:\_个人\python项目\机器人插件环境\venv\Lib\site-packages\nonebot\rule.py", line 79, in get_value
    if event.get_type() != "message":
  File "D:\_个人\python项目\机器人插件环境\venv\Lib\site-packages\nonebot\adapters\mirai2\event\base.py", line 104, in get_type
    raise ValueError("Event has no message!")
ValueError: Event has no message!
09-01 19:46:35 [DEBUG] nonebot | Checking for matchers in priority 1...
09-01 19:46:35 [ERROR] nonebot | Rule check failed for <Matcher from plugins.群好友刷新, type=message, priority=1, temp=False>.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Program\Files\python\38\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "D:\Program\Files\python\38\lib\multiprocessing\spawn.py", line 129, in _main
    return self._bootstrap(parent_sentinel)
  File "D:\Program\Files\python\38\lib\multiprocessing\process.py", line 315, in _bootstrap
    self.run()
  File "D:\Program\Files\python\38\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "D:\_个人\python项目\机器人插件环境\venv\Lib\site-packages\uvicorn\_subprocess.py", line 76, in subprocess_started
    target(sockets=sockets)
  File "D:\_个人\python项目\机器人插件环境\venv\Lib\site-packages\uvicorn\server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "D:\Program\Files\python\38\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "D:\Program\Files\python\38\lib\asyncio\base_events.py", line 603, in run_until_complete
    self.run_forever()
  File "D:\Program\Files\python\38\lib\asyncio\base_events.py", line 570, in run_forever
    self._run_once()
  File "D:\Program\Files\python\38\lib\asyncio\base_events.py", line 1859, in _run_once
    handle._run()
  File "D:\Program\Files\python\38\lib\asyncio\events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
> File "D:\_个人\python项目\机器人插件环境\venv\Lib\site-packages\nonebot\message.py", line 130, in _check_matcher
    if not await Matcher.check_perm(
  File "D:\_个人\python项目\机器人插件环境\venv\Lib\site-packages\nonebot\internal\matcher.py", line 272, in check_perm
    event_type = event.get_type()
  File "D:\_个人\python项目\机器人插件环境\venv\Lib\site-packages\nonebot\adapters\mirai2\event\base.py", line 104, in get_type
    raise ValueError("Event has no message!")
ValueError: Event has no message!

后台Not match annotation GroupMessageEvent, ignored问题

Mirai_Api_Http 2.5.0
nonebot 2.0.0-beta.1
python 3.7.3

安装任何插件的情况下在群内发送任何消息都会出现以下问题,且插件不会响应。

下方为使用Minesweeper插件在群内输入了指令后的后台输出

04-30 17:36:08 [DEBUG] nonebot | Checking for matchers in priority 13...
04-30 17:36:08 [INFO] nonebot | Event will be handled by <Matcher from nonebot_plugin_minesweeper, type=message, priority=13, temp=False>
04-30 17:36:08 [DEBUG] nonebot | Running matcher <Matcher from nonebot_plugin_minesweeper, type=message, priority=13, temp=False>
04-30 17:36:08 [DEBUG] nonebot | Running handler <Dependent call=<function _ at 0x0000018E844ED9D0>, params=[ModelField(name='matcher', type=Matcher, required=True), ModelField(name='event', type=MessageEvent, required=True), ModelField(name='argv', type=List[str], required=True)], parameterless=[]>
04-30 17:36:08 [DEBUG] nonebot | Event type <class 'nonebot.adapters.mirai2.event.message.GroupMessage'> not match annotation MessageEvent, ignored
04-30 17:36:08 [DEBUG] nonebot | Handler <Dependent call=<function _ at 0x0000018E844ED9D0>, params=[ModelField(name='matcher', type=Matcher, required=True), ModelField(name='event', type=MessageEvent, required=True), ModelField(name='argv', type=List[str], required=True)], parameterless=[]> param event value [GroupMessage]: {'self_id': 1301951804, 'type': 'GroupMessage', 'message_chain': [{'type': 'Plain', 'data': {'text': '/minesweeper'}}], 'source': {'id': 331, 'time': '2022-04-30T09:36:08+00:00'}, 'sender': {'id': 2479860528, 'name': 'WindraiteLesd', 'permission': 'OWNER', 'group': {'id': 791647963, 'name': 'XXXX', 'permission': 'MEMBER'}}, 'to_quote': False, 'quote': None, 'to_me': False} mismatch type MessageEvent, skipped
04-30 17:36:08 [INFO] nonebot | Matcher <Matcher from nonebot_plugin_minesweeper, type=message, priority=13, temp=False> running complete
04-30 17:36:08 [DEBUG] nonebot | Stop event propagation

wiki中的.env配置项缺失

在2.0.0-beta.2版本下按照wiki中的.env文件格式编辑运行之后会报下面的错

(上略)
pydantic.error_wrappers.ValidationError: 1 validation error for Config
mirai_qq
  field required (type=value_error.missing)

经过排查后是Config类中的mirai_qq配置项没有传入,如果说SUPERUSER是NoneBot的超级用户,那么.env中应该含有与其值相同的MIRAI_QQ配置项,实测加入后也解决了报错的问题,请问这是wiki中的疏漏吗?

请问如何主动发送信息?

在写一个插件,需要在满足特定条件时(不是群消息触发)向指定群直接发送特定信息,请问有什么方法可以实现吗,谢谢!
给出变量:MESSAGE: str (消息) GROUP: int (群号)

无法连接到mirai-api-http-v2.5.0

nonebot_adapter_mirai2 0.0.10nonebot_adapter_mirai2 0.0.11无法与mirai-api-http-v2.5.0建立连接
0.0.10连接mirai-api-http-v2.5.0提示Connection Error
0.0.11连接mirai-api-http-v2.5.0提示Connection Timeout
这两个版本连接mirai-api-http-v2.4.0均正常

新增同步类事件

新增事件 GroupSyncMessage FriendSyncMessage TempSyncMessage StrangerSyncMessage

ApiNotAvailable使用的参数与定义不匹配

这个地方ApiNotAvailable有一个参数

raise ApiNotAvailable('timeout') from None

但是基类MiraiAdapterException__init__不接受参数
class MiraiAdapterException(AdapterException):
def __init__(self):
super().__init__('mirai')

日志是这样的

  File "/usr/local/lib/python3.9/site-packages/nonebot/adapters/mirai2/utils.py", line 101, in fetch_response
    raise ApiNotAvailable('timeout') from None
TypeError: __init__() takes 1 positional argument but 2 were given

通过加群申请或拒绝加群申请报错

您好,请问bot在处理加群请求的时候报这个错是为什么呀

       return await bot.api.post('/resp/memberJoinRequestEvent',
AttributeError: 'functools.partial' object has no attribute 'post'

通过和拒绝都一样,看起来是我没有post方法

调用的代码是

    await event.approve(bot)

有判断event是MemberJoinRequestEvent类

`MessageSegement.forward` 函数的参数与 `mirai-api-http` 提供的参数不同

环境

nonebot-adapter-mirai2==0.0.19
nonebot2==2.0.0rc2

相关资料

nonebot-adapter-mirai2 的实现:

@classmethod
def forward(cls, node_list: str, senderld: int, time: int, sender_name: str, message_chain: "MessageChain", messageid: int):
"""
:说明:
转发消息
:参数:
* ``node_list: str``: 节点列表
* ``senderld: int``: 发送者的ld
* ``time: int``: 时间戳
* ``sender_name: str``: 发送者的名字
* ``message_chain: MessageChain``: 消息链
* ``messageid: int``: 消息id
"""
return cls(type=MessageType.FORWARD, nodeList=node_list, senderLd=senderld, time=time, senderName=sender_name, messageChain=message_chain, messageId=messageid)

mirai-api-http 文档中的描述:
mirai-api-http | ForwardMessage 消息类型

mah 中的 nodeListobject 类型,而项目中对 node_list 的类型标注为 str

无法接收任何消息

nonebot2-2.0.0b4
nonebot_adapter_mirai2
python3.8.9
mac
现象:接收消息时messagechain为空,经过定位,这一步返回为空。
进入parser_obj_as前:
96A1100A-D5C4-447E-9C15-AAC84C2638E6
进入parser_obj_as后:
0D289D38-104C-46D8-BC81-47D619A71125

wiki和readme中对配置文件要求不相同

  • README:
driver=nonebot.drivers.fastapi+nonebot.drivers.httpx+nonebot.drivers.websockets
MIRAI_HOST=127.0.0.1  # mah2 的 host
MIRAI_PORT=5700  # mah2 的 port
MIRAI_QQ=[3181952556]  # mirai 上已登录的 qq 号
  • WIKI:
VERIFY_KEY=QDTTEGYGfOGBVcX  # MiraiApiHttp2 配置文件里的 token
driver=nonebot.drivers.fastapi+nonebot.drivers.websockets  # nonebot_adapter_mirai2 需要使用 websockets 驱动所以需要加该行
MIRAI_HOST=127.0.0.1  # MiraiApiHttp2 的 ip
MIRAI_PORT=5700  # MiraiApiHttp2 的端口
SUPERUSERS=["1234567890"]  # Mirai 上已经登录的 qq 号

应该以哪个为准?

mirai2 v0.0.8 bot发送消息时出错

又是我,别打我

将本adapter更新至0.0.8版本后,bot无法正常发送信息

最简源码

matcher=on_startswith("nb2")
@matcher.handle()
async def _():
    await matcher.finish("success")

控制台ERROR:

图片

相关配置

nb侧配置

HOST=127.0.0.1
PORT=8081
driver=nonebot.drivers.fastapi+nonebot.drivers.httpx+nonebot.drivers.websockets
MIRAI_HOST=127.0.0.1
MIRAI_PORT=8080
MIRAI_VERIFY_KEY=INITKEYr61MGWpM
MIRAI_QQ=["xxxxxxx"]

尝试过按照config.py内的指示将mirai_qq修改为int,无果

mirai-api-http 2.4.0

adapters: 
  - ws
debug: false
enableVerify: false
verifyKey: INITKEYr61MGWpM
singleMode: false
cacheSize: 4096
adapterSettings: {
  ws:
    host: 127.0.0.1
    port: 8080
    reservedSyncId: -1
}

能够成功建立连接,之前的群聊图片bug也没问题了,但发送消息出错
现已降级到0.0.6
如果是我的问题,请狠狠鞭打我

辛苦了!!

无法正确处理开头不是@的群聊消息

在做机器人的时候偶然发现这个适配器不能正确处理开头不是@的消息。

例如,当用户发送Hello @Bot的时候,接收到的event中的to_me属性为False,而不是True

适配器版本0.0.17

异常消息导致的IndexError

适配器版本 version = "0.0.22"

mirai-api-http v2.9.1
Mirai consosle 2.14.0
iTXTech MCL Version: 2.1.2-61c8bd8

2023-05-09 22:27:39 V/Bot.1943125575: Well404(1070330078) -> /start
2023-05-09 22:27:39 V/Bot.1943125575: Friend(1070330078) <- @1070330078
2023-05-09 22:28:54 V/Bot.1943125575: [test(705321823)] Well404(1070330078) -> /start
2023-05-09 22:28:54 V/Bot.1943125575: Group(705321823) <- [mirai:at:1070330078]
2023-05-09 22:28:54 V/Bot.1943125575: Well404(1070330078) -> at个人 -- 22:28:54\ntest(705321823)\n403 Forbidden(1943125575)
2023-05-09 22:28:54 V/Bot.1943125575: Well404(1070330078) -> 
05-09 22:27:39 [SUCCESS] nonebot | mirai2 1943125575 | [FriendMessage]: {'self_id': 1943125575, 'type': 'FriendMessage', 'message_chain': [{'type': 'Plain', 'data': {'text': '/start'}}], 'source': {'id': 48923, 'time': '2023-05-09T14:27:38+00:00'}, 'sender': {'id': 1070330078, 'nickname': 'Well404', 'remark': 'Well404'}, 'quote': None}
05-09 22:27:39 [DEBUG] nonebot | Checking for matchers in priority 1...
05-09 22:27:39 [INFO] nonebot | Event will be handled by Matcher(type='message', module=func_tests)
05-09 22:27:39 [DEBUG] nonebot | Running Matcher(type='message', module=func_tests)
05-09 22:27:39 [DEBUG] nonebot | Running handler Dependent(call=_)
05-09 22:27:39 [INFO] nonebot | Matcher(type='message', module=func_tests) running complete
05-09 22:27:39 [DEBUG] nonebot | Checking for matchers completed
05-09 22:28:54 [SUCCESS] nonebot | mirai2 1943125575 | [GroupMessage]: {'self_id': 1943125575, 'type': 'GroupMessage', 'message_chain': [{'type': 'Plain', 'data': {'text': '/start'}}], 'source': {'id': 18989, 'time': '2023-05-09T14:28:54+00:00'}, 'sender': {'id': 1070330078, 'name': 'Well404', 'special_title': '', 'permission': 'OWNER', 'join_timestamp': 1664369051, 'last_speak_timestamp': 1683642534, 'mute_time_remaining': 0, 'group': {'id': 705321823, 'name': 'test', 'permission': 'MEMBER'}}, 'quote': None, 'to_me': False}
05-09 22:28:54 [DEBUG] nonebot | Checking for matchers in priority 1...
05-09 22:28:54 [INFO] nonebot | Event will be handled by Matcher(type='message', module=func_tests)
05-09 22:28:54 [DEBUG] nonebot | Running Matcher(type='message', module=func_tests)
05-09 22:28:54 [DEBUG] nonebot | Running handler Dependent(call=_)
05-09 22:28:54 [INFO] nonebot | Matcher(type='message', module=func_tests) running complete
05-09 22:28:54 [DEBUG] nonebot | Checking for matchers completed
05-09 22:28:54 [SUCCESS] nonebot | mirai2 1943125575 | [FriendMessage]: {'self_id': 1943125575, 'type': 'FriendMessage', 'message_chain': [], 'source': {'id': 62270, 'time': '2023-05-09T14:28:54+00:00'}, 'sender': {'id': 1070330078, 'nickname': 'Well404', 'remark': 'Well404'}, 'quote': None}
05-09 22:28:54 [WARNING] nonebot | Error while parsing command for event
Traceback (most recent call last):
  File "c:\github\nonebot-plugin-segbuilder\bot.py", line 18, in <module>
    nonebot.run()
  File "c:\github\nonebot-plugin-segbuilder\.venv\lib\site-packages\nonebot\drivers\fastapi.py", line 198, in run
    uvicorn.run(
  File "c:\github\nonebot-plugin-segbuilder\.venv\lib\site-packages\uvicorn\main.py", line 578, in run
    server.run()
  File "c:\github\nonebot-plugin-segbuilder\.venv\lib\site-packages\uvicorn\server.py", line 
61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "c:\users\well404\appdata\local\programs\python\python38\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "c:\users\well404\appdata\local\programs\python\python38\lib\asyncio\base_events.py", 
line 603, in run_until_complete
    self.run_forever()
  File "c:\users\well404\appdata\local\programs\python\python38\lib\asyncio\windows_events.py", line 316, in run_forever
    super().run_forever()
  File "c:\users\well404\appdata\local\programs\python\python38\lib\asyncio\base_events.py", 
line 570, in run_forever
    self._run_once()
  File "c:\users\well404\appdata\local\programs\python\python38\lib\asyncio\base_events.py", 
line 1859, in _run_once
    handle._run()
  File "c:\users\well404\appdata\local\programs\python\python38\lib\asyncio\events.py", line 
81, in _run
    self._context.run(self._callback, *self._args)
  File "c:\github\nonebot-plugin-segbuilder\.venv\lib\site-packages\nonebot\adapters\mirai2\utils.py", line 80, in process_event
    await handle_event(bot, event)
> File "c:\github\nonebot-plugin-segbuilder\.venv\lib\site-packages\nonebot\message.py", line 280, in handle_event
    TrieRule.get_value(bot, event, state)
  File "c:\github\nonebot-plugin-segbuilder\.venv\lib\site-packages\nonebot\rule.py", line 107, in get_value
    message_seg: MessageSegment = message[0]
  File "c:\github\nonebot-plugin-segbuilder\.venv\lib\site-packages\nonebot\internal\adapter\message.py", line 254, in __getitem__
    return super().__getitem__(arg1)
IndexError: list index out of range

初步断定可能是 mirai 方面的问题,先发个issue留个记录

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.