discord.ext.commands.errors.CommandInvokeError:命令引发了异常:AttributeError:'NoneType'对象没有属性'mention'

时间:2020-10-22 11:45:13

标签: python discord discord.py

我的代码:


@commands.command(pass_context=True)
@commands.guild_only()
async def owner_mention(self, ctx):
    await ctx.send(ctx.guild.owner.mention)

错误:

discord.ext.commands.errors.CommandInvokeError:命令引发了 异常:AttributeError:'NoneType'对象没有属性 “提及”

1 个答案:

答案 0 :(得分:0)

在新版本的discord.py(1.5.x)中,Intents中有一些更改。意图就像权限。您需要定义它,以便将消息发送到频道,成员等。

import discord

intents = discord.Intents().all()
client = discord.Bot(prefix='', intents=intents)

有关更多信息,您可以检查API References

相关问题