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

关于收到@信息后发送私聊信息错误 #113

Closed
MaGua-Bishop opened this issue Jul 9, 2022 · 2 comments
Closed

关于收到@信息后发送私聊信息错误 #113

MaGua-Bishop opened this issue Jul 9, 2022 · 2 comments

Comments

@MaGua-Bishop
Copy link

你好,我在使用python版sdk开发的时候遇到了一个错误无法解决
async def sendDms(self, message, **data): """发送私信""" await self.api.create_dms(guild_id=message.guild_id, user_id=message.author.id) # await self.api.post_dms(guild_id=message.guild_id, **data) await self.api.post_dms(guild_id=message.guild_id, content="123123",msg_id=message.id)
写了一个方法专门用于来发送私聊信息,不知道哪儿出现了问题,返回报错为
File "C:/Users/16917/Desktop/qq/qqbot_django/QQ_bot/bot_main2.py", line 126, in sendDms await self.api.post_dms(guild_id=message.guild_id, content="123123",msg_id=message.id) File "C:\Users\16917\AppData\Local\Programs\Python\Python38\lib\site-packages\botpy\api.py", line 628, in post_dms return await self._http.request(route, json=payload) File "C:\Users\16917\AppData\Local\Programs\Python\Python38\lib\site-packages\botpy\http.py", line 121, in request return await _handle_response(route.url, response) File "C:\Users\16917\AppData\Local\Programs\Python\Python38\lib\site-packages\botpy\http.py", line 44, in _handle_response raise error_dict_get(msg=message) botpy.errors.ServerError: internal error: direct message error

@GLGDLY
Copy link
Contributor

GLGDLY commented Jul 9, 2022

await self.api.create_dms(guild_id=message.guild_id, user_id=message.author.id)之后会返回一个私信频道的guild id,因此你await self.api.post_dms(guild_id=message.guild_id, **data)这里的guild id不应该是message.guild_id,而是创建私信时返回的私信频道id

@SaucePlum
Copy link
Collaborator

检查是否使用了正确的guild_id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants