F
F
FrOms2021-03-25 07:12:19
Python
FrOms, 2021-03-25 07:12:19

How to make a bot in discord.py that will delete a role after a certain message?

I need that after the message "delete the role", the bot deletes the role. Tried to do like this:

async def remove_roles(self, message, ctx, member: discord.Member=None):
        if message.content == 'удали роль':
            role = discord.utils.get(ctx.guild.roles, id=айди роли)
            await member.remove_roles(role)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FrOms, 2021-03-25
@FrOms

Found a solution:

from discord.utils import get
async def on_message(self, message):
        if message.content.startswith('удали роль'):
                 member = message.author
                 role = get(member.guild.roles, id=айди роли)
                 await member.remove_roles(role, reason=None)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question