discord.errors.Forbidden:403 FORBIDDEN(错误代码:50013):缺少权限

编程入门 行业动态 更新时间:2024-10-27 21:22:06
本文介绍了discord.errors.Forbidden:403 FORBIDDEN(错误代码:50013):缺少权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我最近创建了一个机器人,该机器人仅允许发送消息和阅读消息历史记录.在我自己的服务器上,该漫游器似乎可以正常运行,但是某个用户尝试在其自己的服务器上使用该漫游器,并且出现错误 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):缺少权限

本文发布于:2023-10-09 21:10:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1476794.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误代码   权限   Forbidden   errors   discord

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!