【问题标题】:Why don't my discord privileged intents work?为什么我的不和谐特权意图不起作用?
【发布时间】:2021-11-09 04:37:12
【问题描述】:

discord 开发门户中启用了出席意图和成员意图。我正在使用 discord.py 制作这个机器人,我有这个代码:

_intents = discord.Intents(presences = True, members = True)
bot = commands.Bot(command_prefix=["m/", "M/", "m.", "M."], status=discord.Status.online, activity=discord.Activity(type=discord.ActivityType.playing, name="Loading...", intents = _intents))

有人告诉我,这可以实现这两种意图。但是,只有拥有这些意图才能做的事情是不可能的。当我尝试获取成员的状态时,它是未知的。当我使用 jishaku 扩展时,它说这两个意图都被禁用了。为什么他们仍然被禁用?如何启用它们?

【问题讨论】:

  • 尝试使用discord.Intents.all()。您当前正在执行的操作是禁用除成员和存在之外的所有意图,机器人运行所需的一些绝对最低意图是您已禁用的。

标签: python discord discord.py


【解决方案1】:

试试这个:-

bot = commands.Bot(("prefix"), intents=discord.Intents.all())

【讨论】:

    【解决方案2】:

    由于意图是获取用户数据的一种快速方法,您应该只启用required intents

    intents = discord.Intents.defaults()
    intents.members = True
    bot = commands.Bot(command_prefix="prefix"),intents=intents)
    

    要获取有关intents 的更多信息,请查看文档。

    【讨论】:

      猜你喜欢
      • 2022-01-04
      • 2021-08-05
      • 2021-02-25
      • 2021-07-26
      • 1970-01-01
      • 2021-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多