Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

botpy.errors.ServerError: message id invalid #131

Closed
b3601993 opened this issue Apr 7, 2023 · 5 comments
Closed

botpy.errors.ServerError: message id invalid #131

b3601993 opened this issue Apr 7, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@b3601993
Copy link

b3601993 commented Apr 7, 2023

就你的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

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

@traveler-vee
Copy link
Contributor

我找下后台同学看看

@AlexiosNine
Copy link

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

@b3601993
Copy link
Author

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

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

@traveler-vee traveler-vee added the bug Something isn't working label May 6, 2023
@owerbai
Copy link

owerbai commented Jun 29, 2023

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

@liaoyanglay
Copy link
Collaborator

liaoyanglay commented Dec 19, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants