1
1
1 22020-06-10 17:57:53
Python
1 2, 2020-06-10 17:57:53

Discord.py how to purge the messages of a specified user?

How to do something when a user writes <bot prefix>clear @user cleared the entire chat from all messages of the specified user?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Nevzorov, 2020-06-12
@weRifiCatoR

TextChannel.purge()

@commands.command()
async def clear(ctx, user: discord.Member):
    await ctx.channel.purge(limit=None, check=lambda m: m.author==user)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question