我正在制作一个discord机器人,但是在安装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'发布于 2020-10-29 09:38:22
您使用的是discord.py的旧版本。我宁愿你跑
pip install discord -U
pip install discord.py -U在终端机中,它们是文档中的一个重大变化。
然后,
@bot.command()
async def dm(ctx, user:discord.Member, *, msg):
await user.send(msg)https://stackoverflow.com/questions/64585919
复制相似问题