this is a line of code to delete an amount of message in a text channel in discord
await ctx.channel.purge(limit=amount)
If i use purge
function it will delete all message everyone sent. But I only want to delete message from a specific user like mee6, not all the message from everyone in the channel.
May I know how? Thank you
You can use the check
argument of TextChannel.purge
:
user = user_to_delete
await ctx.channel.purge(limit=amount, check=lambda m: m.author == user)