nonebot / aiocqhttp

A Python SDK with async I/O for CQHTTP (OneBot).
https://aiocqhttp.nonebot.dev
MIT License
280 stars 39 forks source link

在发送群消息时出现异常 #37

Closed z6189949 closed 4 years ago

z6189949 commented 4 years ago

@bot.on_message('group') async def (event: Event): message = TklToMine(event.message)

await bot.send_group_msg(group_id=12, message=message)

await bot.send_msg(message_type='group',group_id=102,message=message) return 这里是代码 使用两种发送群消息的方式都抛出异常,更换电脑,ip,账号 也均会抛出异常,但如果私聊机器人,一切正常,可以正常执行代码片段,以下是异常详情 Task exception was never retrieved future: <Task finished coro=<CQHttp.handle_event_with_response() done, defined at C:\Python\Python37\lib\site-packages\aiocqhttp_init.py:464> exception=<ActionFailed, retcode=100>> Traceback (most recent call last): File "C:\Python\Python37\lib\site-packages\aiocqhttp_init.py", line 466, in _handle_event_with_response response = await self.handle_event(payload) File "C:\Python\Python37\lib\site-packages\aiocqhttp_init.py", line 460, in _handle_event await self.bus.emit(event_name, ev))) File "C:\Python\Python37\lib\site-packages\aiocqhttp\bus.py", line 35, in emit results += await asyncio.gather(*coros) File "C:/Users/admin/PycharmProjects/example/Tbyhj/qBot.py", line 28, in await bot.send_msg(message_type='group',group_id=1098715042,message=message) File "C:\Python\Python37\lib\site-packages\aiocqhttp_init.py", line 219, in call_action return await self._api.call_action(action=action, params) File "C:\Python\Python37\lib\site-packages\aiocqhttp\api_impl.py", line 186, in call_action result = await self._wsr_api.call_action(action, params) File "C:\Python\Python37\lib\site-packages\aiocqhttp\api_impl.py", line 162, in call_action await ResultStore.fetch(seq, self._timeout_sec)) File "C:\Python\Python37\lib\site-packages\aiocqhttp\api_impl.py", line 51, in _handle_api_result raise ActionFailed(retcode=result.get('retcode')) aiocqhttp.exceptions.ActionFailed: <ActionFailed, retcode=100> 请问这个如何解决

cleoold commented 4 years ago

酷q会不定时抽风。参数缺失或参数无效会触发这个错误,可能是群号或消息写的不对。也有可能是酷q抽风觉得你的群号和消息有错。 先 close 了,有问题可以随时打开。

ExerciseBook commented 4 years ago

image 100 错误一般是你发送的消息不对劲。 你可以把出 100 错误的那条请求 print 出来查一下。