[Python] How to unban a user?

Discussão em 'Python' iniciado por Stack, Agosto 8, 2025.

  1. Stack

    Stack Membro Participativo

    I know how to ban members and I know how to kick them, but I don't know how to unban them. I have the following code which outputs the error:


    discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'generator' object has no attribute 'id'
    ​

    Code:

    @bot.command(pass_context=True)
    @commands.has_role("Moderator")
    async def unban2(ctx):
    mesg = ctx.message.content[8:]
    banned = client.get_user_info(mesg)
    await bot.unban(ctx.message.server, banned)
    await bot.say("Unbanned!")

    Continue reading...

Compartilhe esta Página