S
S
Snyper532021-11-16 14:55:54
Python
Snyper53, 2021-11-16 14:55:54

Problem with embed in discord.py. What to do?

I decided to write my python bot in discord using the discord.py library. Everything went fine, I made a few commands. The problem is the team is unbanned. It itself works correctly, but if you try to add it to embed, then nothing works, i.e. nothing is displayed and the person is not unbanned. Below is the code itself

@client.command()
@commands.has_permissions(ban_members = True)
async def unban(ctx, *, member=None):
    if member is None:
        await ctx.reply(f'Вы не указали участника!')
    bans = await ctx.guild.bans()
    member_name, member_discriminator = member.split("#")
    for ban in bans:
        user = ban.user

        if(user.name, user.discriminator) == (member_name, member_discriminator):
            await ctx.guild.unban(user)
#           await ctx.send(f'Пользователь **{user}** был разбанен')
            await ctx.send(embed = discord.Embed(title='**Модерация**', description = f"Пользователь **{user}** был разбанен\n"
                                                                                        f"Модератор: {ctx.author.mention} \n"))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-11-16
@SoreMix

We are sure that the condition

if(user.name, user.discriminator) == (member_name, member_discriminator):
performed? Your embed does not depend on the unban function in any way

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question