【发布时间】:2020-08-20 23:20:14
【问题描述】:
我目前正在开发一个不和谐的机器人,但遇到了一个问题,即“机器人”这个词没有“定义”。
我已经尝试用客户端替换 bot,但是,这会产生更多问题。 这是我的代码:
@bot.command()
async def kick(ctx, user: discord.Member, * , reason=None):
if user.guild_permissions.manage_messages:
await ctx.send('I cant kick this user because they are an admin/mod.')
elif ctx.author.guild_permissions.kick_members:
if reason is None:
await ctx.guild.kick(user=user, reason='None')
await ctx.send(f'{user} has been kicked by {ctx.message.author.mention}')
else:
await ctx.guild.kick(user=user, reason=reason)
await ctx.send(f'{user} has been kicked by {ctx.message.author.mention}')
else:
await ctx.send('You do not have permissions to use this command.')
【问题讨论】:
-
请包含您的回溯。在
@bot.command之后你还缺少()它应该是这样的@bot.command() -
请生成minimal reproducible example。你在用
discord.ext.commands.Bot吗?
标签: discord discord.py