Python 安装pynacl后无法调用成员
我正在创建一个Python 安装pynacl后无法调用成员,python,discord.py,Python,Discord.py,我正在创建一个discordbot,但是在安装pynacl模块之后,我无法调用构建成员 这是代码 @bot.command() async def dm(ctx, who, * ,msg): await ctx.guild.get_member_named(who).send() 这是一个关于代码的错误 The above exception was the direct cause of the following exception: Traceback (most recent
discord
bot,但是在安装pynacl
模块之后,我无法调用构建成员
这是代码
@bot.command()
async def dm(ctx, who, * ,msg):
await ctx.guild.get_member_named(who).send()
这是一个关于代码的错误
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 859, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'send'
您正在使用旧版本的discord.py。我宁愿你跑
pip install discord -U
pip install discord.py -U
在终端中,因为它们是文档中的一个主要变化
那么
谢谢,但是公会会员还是不工作。这有什么问题吗?你用的是名字,当你不标记某人,而是用它的用户名来标记。guild.members返回公会中的成员列表。如果您的代码中有更多类似的问题,或者您有任何问题,您可以联系他们的开发团队,在他们的
@bot.command()
async def dm(ctx, user:discord.Member, *, msg):
await user.send(msg)