我最近创建了一个机器人,该机器人仅允许发送消息和阅读消息历史记录.在我自己的服务器上,该漫游器似乎可以正常运行,但是某个用户尝试在其自己的服务器上使用该漫游器,并且出现错误 discord.errors.Forbidden:403 FORBIDDEN(错误代码:50013):缺少权限弹出.
I've recently created a bot which is only allowed to send messages and read message history. In my own servers, the bot seemed to work flawlessly, but a certain user tried using the bot on his own server and the error discord.errors.Forbidden: 403 FORBIDDEN (error code: 50013): Missing Permissions popped up.
await message.channel.send(file=discord.File(io.BytesIO(meme), filename="meme.png"))上面的行是导致错误的原因.我以为我需要附加文件"权限,但是由于某种原因,在我的测试服务器上,如果没有它,它就可以工作.
The line above is what's causing the error. I'm thinking that I need the 'Attach Files' permission, but for some reason it works without it on my testing servers.
完整追溯:
Traceback (most recent call last): File "/home/nemplayer/.local/lib/python3.7/site-packages/discord/client.py", line 270, in _run_event await coro(*args, **kwargs) File "bot/bot.py", line 78, in on_message await message.channel.send(file=discord.File(io.BytesIO(meme), filename="meme.png")) File "/home/nemplayer/.local/lib/python3.7/site-packages/discord/abc.py", line 806, in send content=content, tts=tts, embed=embed, nonce=nonce) File "/home/nemplayer/.local/lib/python3.7/site-packages/discord/http.py", line 218, in request raise Forbidden(r, data) discord.errors.Forbidden: 403 FORBIDDEN (error code: 50013): Missing Permissions 推荐答案如您所说,错误代码:50013 表示您无权执行该操作.
As you said, error code: 50013 means that you don't have permission to perform that action.
ATTACH_FILES 不是您必须唯一的权限有的话,您可能还需要 SEND_MESSAGES 和 VIEW_CHANNEL ,因为它们是"隐式权限",请检查您是否也拥有它们.
ATTACH_FILES is not the only permission you must have, you may also need SEND_MESSAGES and VIEW_CHANNEL as they are "Implicit Permissions", check if you have them too.
更多推荐
discord.errors.Forbidden:403 FORBIDDEN(错误代码:50013):缺少权限
发布评论