【问题标题】:discord.errors.Forbidden: 403 FORBIDDEN (error code: 50013): Missing Permissionsdiscord.errors.Forbidden:403 FORBIDDEN(错误代码:50013):缺少权限
【发布时间】:2019-11-11 07:52:25
【问题描述】:

我最近创建了一个机器人,它只允许发送消息和阅读消息历史记录。在我自己的服务器中,该机器人似乎可以完美运行,但某个用户尝试在他自己的服务器上使用该机器人,并弹出错误discord.errors.Forbidden: 403 FORBIDDEN (error code: 50013): Missing Permissions

await message.channel.send(file=discord.File(io.BytesIO(meme), filename="meme.png"))

上面的行是导致错误的原因。我认为我需要“附加文件”权限,但由于某种原因,它在我的测试服务器上没有它也可以工作。

完整的追溯:

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

【问题讨论】:

    标签: python python-3.x discord.py


    【解决方案1】:

    如您所说,error code: 50013 表示您无权执行该操作。

    ATTACH_FILES 不是您必须拥有的唯一 permission,您可能还需要 SEND_MESSAGESVIEW_CHANNEL,因为它们是 "Implicit Permissions",请检查您是否也拥有它们。

    【讨论】:

    • 我很困惑我的机器人在我的 Discord 服务器上的工作方式,只有发送消息和读取消息历史记录权限。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-07-22
    • 2020-11-15
    • 2020-11-28
    • 2022-01-17
    • 2011-10-02
    • 2022-10-09
    • 2021-10-31
    相关资源
    最近更新 更多