A
A
A_Z-Z2021-10-06 12:28:54
Python
A_Z-Z, 2021-10-06 12:28:54

Why is the unbanned command not working?

@bot.command() 
@commands.has_permissions(administrator=True)
async def unban(ctx, member:discord.Member, *reason):
    channel = bot.get_channel(894969274966368288)
    embed = discord.Embed( color=0xff0000, title='unban')
    embed.add_field(name='Модератор', value=ctx.message.author.mention)
    embed.add_field(name='Пользователь', value=member.mention)
    embed.add_field(name='Причина', value=' '. join(reason))
    await member.unban()
    await ctx.send(embed=embed)
    await channel.send(embed=embed)


I write a command and the bot does not respond

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sasha Filinsky, 2021-10-11
@UkaUkaa

There is an assumption that the bot simply does not see the member, because it is not in the guild.
As I suggest. By ID, get not a member, but a user, and unban. Like this

async def unban(ctx, ID, *reason):
    user = await bot.fetch_user(ID)
    await ctx.guild.unban(user)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question