首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >怎么修呢?"discord.errors.Forbidden: 403禁忌(错误代码: 50001):缺少访问“

怎么修呢?"discord.errors.Forbidden: 403禁忌(错误代码: 50001):缺少访问“
EN

Stack Overflow用户
提问于 2022-09-27 08:21:09
回答 2查看 106关注 0票数 1

在命令中添加斜杠后,我得到了这个错误。这有什么关系呢?谷歌提供的信息根本没有帮助。

  1. bot在服务器上具有管理员权限;
  2. 我发现帐户必须有MFA的信息,打开它--错误并没有消失。

我的代码是:

代码语言:javascript
运行
复制
    from discord.ext import commands
    from discord import app_commands
    import asyncio
    
    from config import settings
    
    bot = commands.Bot(intents=discord.Intents.all(), command_prefix=settings['prefix'])
    
    class abot(discord.Client):
        def __init__(self):
            super().__init__(intents=discord.Intents.default())
            self.synced = False
        async def on_ready(self):
            await self.wait_until_ready()
            if not self.synced:
                await tree.sync(guild=discord.Object(id=settings['id'])) #error in this stroke
                self.synced = True
            print('ONLINE')
    
    bot = abot()
    tree = app_commands.CommandTree(bot)
    
    @tree.command(name='ping', description='Ping me', guild=discord.Object(id=settings['id']))
    async def self(interaction: discord.Integration):
        author = interaction.message.author
        await interaction.response.send_message(f'hello, {author.mention}')
        
    bot.run(settings['token'])

错误是:

代码语言:javascript
运行
复制
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2022-10-09 09:57:34

问题是,我把bot ID放在guild_id中,而不是聊天ID。

票数 0
EN

Stack Overflow用户

发布于 2022-09-27 18:20:34

可能有两个原因,你的机器人不工作。

  1. 在角色层次结构中,机器人的角色可能不够高。转到您的机器人所在的服务器并进入设置。然后,去找角色,找到机器人的角色。将角色移动到尽可能高的位置,高于大多数其他角色。
  2. 您可能还没有在不和谐的开发人员门户中启用正确的特权意图。要解决这个问题,请转到不和谐开发者门户,然后找到您的机器人并单击它,转到bot选项卡并向下滚动到特权网关意图。启用所有这些设备,只需检查您的bot在启用后是否工作。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73864420

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档