nonebot / adapter-satori

NoneBot2 Satori 适配器 / Satori Protocol adapter for nonebot2
MIT License
85 stars 5 forks source link

[Bug]: 发送消息 'NoneType' object is not iterable #25

Closed EnchantedHay closed 2 months ago

EnchantedHay commented 2 months ago

确认项

操作系统

Windows

Python 版本

3.10

NoneBot 版本

2.3.1

适配器

0.12.0

协议端

Chronocat 0.2.10

描述问题

发送消息时报错:

06-13 16:04:15 [ERROR] nonebot | Running Matcher(type='message', module=src.plugins.dead_or_not, lineno=5) failed.
Traceback (most recent call last):
  File "D:\Desktop\pytech\bot\haybot\bot.py", line 16, in <module>
    nonebot.run()
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\__init__.py", line 335, in run
    get_driver().run(*args, **kwargs)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\drivers\none.py", line 56, in run
    loop.run_until_complete(self._serve())
  File "D:\Python\lib\asyncio\base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "D:\Python\lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "D:\Python\lib\asyncio\base_events.py", line 603, in run_forever
    self._run_once()
  File "D:\Python\lib\asyncio\base_events.py", line 1909, in _run_once
    handle._run()
  File "D:\Python\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
> File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 850, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 825, in simple_run
    await handler(
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\dependencies\__init__.py", line 94, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "D:\Desktop\pytech\bot\haybot\src\plugins\dead_or_not\__init__.py", line 10, in start
    await dead_or_not.send(message="你才死了,吵什么吵")
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 566, in send
    return await bot.send(event=event, message=_message, **kwargs)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\adapters\satori\bot.py", line 256, in send
    return await self.send_message(event.channel.id, message)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\adapters\satori\bot.py", line 270, in send_message
    return await self.message_create(channel_id=channel_id, content=str(message))
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\internal\adapter\bot.py", line 122, in call_api
    raise exception
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\internal\adapter\bot.py", line 97, in call_api
    result = await self.adapter._call_api(self, api, **data)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\adapters\satori\adapter.py", line 283, in _call_api
    return await api_handler(bot, **data)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\adapters\satori\utils.py", line 39, in __call__
    return await self.func(inst, *args, **kwds)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\adapters\satori\bot.py", line 316, in message_create
    return [type_validate_python(SatoriMessage, i) for i in res]
TypeError: 'NoneType' object is not iterable

该报错不影响正常回复。将adapter-satori回退至0.11.5后不会出现此报错。

复现步骤

该错误由一个非常简单的插件引发:

dead_or_not = on_command("dead_or_not", rule=to_me(), aliases={"死了吗", "死了没"}, priority=4)

@dead_or_not.handle()
async def start():
    await dead_or_not.finish(message="你才死了,吵什么吵")

期望的结果

No response

截图或日志

No response

Nonebot 配置项

No response