使用命令时出错.Discord.py Rewrite中的贪心

时间:2018-10-04 22:39:11

标签: discord discord.py discord.py-rewrite

每当我尝试使用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

1 个答案:

答案 0 :(得分:0)

我重新安装了discord.py,原来我有一个没有this

的旧版本