Python Discord.py ban命令错误:name错误:name';客户';没有定义

Python Discord.py ban命令错误:name错误:name';客户';没有定义,python,discord.py,Python,Discord.py,我尝试使用discord.py创建Kick-and-ban命令,它返回此错误 Traceback (most recent call last): File "main.py", line 58, in <module> @client.command() NameError: name 'client' is not defined  KeyboardInterrupt  谢谢, cassiecodes@bot.command() @com

我尝试使用discord.py创建Kick-and-ban命令,它返回此错误

Traceback (most recent call last):
  File "main.py", line 58, in <module>
    @client.command()
NameError: name 'client' is not defined
 
KeyboardInterrupt


谢谢, cassiecodes

@bot.command()
@commands.has_权限(kick_members=True)
异步def kick(ctx,用户:discord.Member,*,reason=None):
等待用户。踢(原因=原因)
等待ctx.send(f“{user}已成功踢出”)

尝试使用
bot
而不是
client

您得到的错误是由于python查找名为“client”的变量而没有找到。如果看不到您的导入语句或其他代码,我们无法提供太多帮助。在这里显示的部分中,没有使用名为“client”的变量。正如Matt所说,也许你的机器人的变量不是“客户机”,也许是“机器人”或其他什么,但为了帮助你,我们必须查看发生错误的函数和(可能)机器人的启动代码,即“客户机”变量应该在哪里defined@CassieCodes我能看一下你的全部代码吗?我只能在那时帮你。不幸的是,我已经有一段时间没有检查这个了,实际上我已经辞去了这个项目。谢谢你的帮助!这样不行。您必须首先了解bot变量是如何声明的。
@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, user: discord.Member, *, reason=None):
  await user.kick(reason=reason)
  await ctx.send(f"{user} have been kicked sucessfully")