botpy icon indicating copy to clipboard operation
botpy copied to clipboard

botpy.errors.ServerError: message id invalid

Open b3601993 opened this issue 1 year ago • 5 comments

就你的example中公告的例子。

我这里贴出修改的地方:

# 输入/xxx后的处理
        # 修改了这里、修改了这里、修改了这里
        message_id = message.id
        # 08a0e699f5d3ebc1a47e10bae790a401386248c0aabfa106
        print(message_id)
        if "/建公告" in message.content:
            await self.api.create_announce(message.guild_id, message.channel_id, message_id)

        elif "/删公告" in message.content:
            await self.api.delete_announce(message.guild_id, message_id)

报错:

[ERROR] (http.py:73)_handle_response [botpy] 接口请求异常,请求连接: https://api.sgroup.qq.com/guilds/9099812619143246624/announces/08a0e699f5d3ebc1a47e10bae790a40138664884b4bfa106, 错误代码: 500, 返回内容: {'code': 501008, 'message': 'message id invalid'}, trace_id:a410df568d94e7569c3f9d2098cd0d8c Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/botpy/client.py", line 279, in _run_event await coro(*args, **kwargs) File "/Users/yutao/vscodeproject/qqbotpy/announce.py", line 31, in on_at_message_create await self.api.delete_announce(message.guild_id, message_id) File "/usr/local/lib/python3.11/site-packages/botpy/api.py", line 888, in delete_announce return await self._http.request(route) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/botpy/http.py", line 186, in request return await _handle_response(response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/botpy/http.py", line 83, in _handle_response raise error_dict_get(msg=message) from None botpy.errors.ServerError: message id invalid

官网的居然都错了,我不李姐,请求支援~~~

b3601993 avatar Apr 07 '23 09:04 b3601993

我找下后台同学看看

traveler-vee avatar Apr 12 '23 02:04 traveler-vee

请问下,你有先调用 create_announce 把这条消息设置为频道公告吗?

AlexiosNine avatar Apr 13 '23 04:04 AlexiosNine

请问下,你有先调用 create_announce 把这条消息设置为频道公告吗?

有的,先创建公告,再执行删公告,然后后台日志,提示报错了。且公告没有删除掉。如果把删公告的参数改为“all”,就正常删除.

b3601993 avatar Apr 13 '23 06:04 b3601993

你好,我也有这个问题,请问解决了嘛

owerbai avatar Jun 29 '23 15:06 owerbai

请检查下新建公告的message_id和删除时的message_id是否相同,很可能是删除的那条消息没有被设置为公告,或者删除的并不是之前新建的那条

liaoyanglay avatar Dec 19 '23 07:12 liaoyanglay