每当我尝试使用commands.Greedy
时,我都会得到AttributeError: module 'discord.ext.commands' has no attribute 'Greedy'
。这是我的代码:
@client.command(description="Kicks user", usage="[@user(s)]", brief="Kicks user")
@commands.has_role(settings.admin_role_name)
async def kick(self, ctx, targets: commands.Greedy[discord.Member], *reason: str):
for target in targets:
await target.kick(reason="{} ({}) used .kick command with the reason {}".format(ctx.message.author.name, ctx.message.author.id, reason))
await ctx.send("<@{}> kicked <@{}>\n**Reason:** {}".format(ctx.message.author.id, target.id, reason))
@client.command(description="Bans user", usage="[@user]", brief="Bans user")
@commands.has_role(settings.admin_role_name)
async def ban(self, ctx, targets: commands.Greedy[discord.Member], *reason: str):
for target in targets:
await target.ban(reason="{} ({}) used .kick command with the reason {}".format(ctx.message.author.name, ctx.message.author.id, reason))
await ctx.message.channel.send("{} banned <@{}>\n**Reason:** {}".format(ctx.message.author.id, target.id, reason))
我的Discord版本是discord.py 1.0.0a1561 + g53433bc