我尝试使用 discord.py 创建踢出和禁止命令,但它返回此错误。
Traceback (most recent call last):
File "main.py", line 58, in <module>
@client.command()
NameError: name 'client' is not defined
KeyboardInterrupt
代码是这样的:
@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")
谢谢, 卡西代码
答案 0 :(得分:-1)
@bot.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")
尝试使用 bot
而不是 client
。