为什么我的不和谐特权意图不起作用?



在discord dev portal中同时启用了presence intent和members intent。我使用discord.py来制作这个bot,我有这样的代码:

_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扩展时,它说两个意图都被禁用了。为什么他们还是残疾?如何启用它们?

试试这个:-

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

由于intent是获取用户数据的一种快速方式,因此您应该只启用required intents

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

要获得更多关于意图的信息,请查看文档。

相关内容

最新更新