Python Discord.py with Atom:错误作者是缺少的必需参数,未定义消息

Python Discord.py with Atom:错误作者是缺少的必需参数,未定义消息,python,discord.py,Python,Discord.py,抛出代码的代码块 进口不和 导入操作系统 随机输入 导入系统 导入RS9_列表 从discord.ext导入命令 从discord.utils导入获取 intents=discord.intents().all() intents.members=True client=commands.Bot(命令前缀='.',意图=意图) 获取\u脱机\u成员=True @命令(别名=['in9','in9','I9','I9']) 异步def i9(ctx): 如果ctx.author==client.

抛出代码的代码块


进口不和
导入操作系统
随机输入
导入系统
导入RS9_列表
从discord.ext导入命令
从discord.utils导入获取
intents=discord.intents().all()
intents.members=True
client=commands.Bot(命令前缀='.',意图=意图)
获取\u脱机\u成员=True
@命令(别名=['in9','in9','I9','I9'])
异步def i9(ctx):
如果ctx.author==client.user:
返回
wait ctx.author.send(“{ctx.author.display_name}已加入一个红星9 Que”)
我已经被困在这段代码上三天了。我希望得到命令。我回复时提到作者。这是这段代码将要做的第一步,我似乎无法让它工作

我遇到的问题有,定义作者,定义成员,等等。我不熟悉编码,花了几天时间阅读文档。做练习守则和其他练习。我仍然有麻烦

任何帮助、资源、解决方案、见解等,我都乐于接受

我非常感谢你花时间和精力处理这件事

Ignoring exception in command i9:
Traceback (most recent call last):
  File "C:\Users\Mike\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\Mike\Desktop\Discordbot\Seymourlist.py", line 36, in i9
    await ctx.author.send('Joined Red Star 9-->{}'.format(message.author.name))
NameError: name 'message' is not defined

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Mike\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Mike\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 859, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Mike\AppData\Local\Programs\Python\Python39\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: NameError: name 'message' is not defined

如果ctx.author==client.user
没有意义,您可以尝试:

异步def i9(ctx):
wait ctx.author.send(f'{ctx.author.display_name}已加入红星9')

您可以添加整个回溯吗?您提供的代码不应该抛出标题中提到的错误。请编辑您的问题并将其添加到那里,而不是添加到注释中