我正在为我的discord.py机器人制作一个踢出命令。以下是可能用于kick命令的一些代码:
async kick_command(self, ctx, userName: discord.User):
prefix_used = ctx.prefix
alias_used = ctx.invoked_with
text = msg[len(prefix_used) + len(alias_used):]
if discord.User permissions = "admin":
try:
kick(User)
except Exception as e:
ee = "Error: " + e
await ctx.send_message(content=ee)
我相信if语句和
kick(User)
是无效的语法。你能帮我吗?我的代码: 点击这里
NameError: name ‘kick_members’ is not defined
- user12327406async def kick_command(self, ctx, Member: discord.Member): await kick(Member)
但是它报错了:NameError: name ‘kick’ is not defined
- user12327406kick(Member)
而不是ctx.kick(Member)
。 - K. Koster