Z
Z
ztx5112021-03-24 22:58:47
Python
ztx511, 2021-03-24 22:58:47

How to clear the role of all participants?

Hello , can anyone help write a command to allow !clrole @role mention, and have it cleared for all members.

In general, as I understand it, the point is that you need to remove it through the iterator, but you also need to check whether this person has this role.

In short, I did not succeed, help someone who can

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeniy _, 2021-03-24
@GeneD88

@bot.command()
@commands.has_permissions(ban_members=True)
async def swipe(ctx):
    role_name = ("Тостер")
    role = tuple(get(ctx.guild.roles, name=n) for n in role_names)
    for m in ctx.guild.members:
        try:
            await member.remove_roles(*role)
        except:
            print(f"Не удалось удалить роль для {m} либо её у него нет.")
    await ctx.send("Удалено.")

M
Maxim Nevzorov, 2021-03-25
@fixator10

How to remove/add a role to all server members?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question