@commands.slash_command()
@commands.has_any_role()
async def purge(self, inter, member: disnake.Member = None, amount: int = None, *, reason: str):
message_history = await inter.channel.purge()
```how would I go about performing a lambda check inside of the purge function to only delete messages in the channel that are from the member provided based off the members id?
#Purge Command To Filter Messages From Specific User
1 messages · Page 1 of 1 (latest)
check = lambda message: message.author.id == member.id
deleted_messages = await inter.channel.purge(limit=amount, check=check)
i think this should work
if I return a list of members using the auto complete, will casting member to disnake.Member in the parameters turn that selection into a member object or will I need to cast again in my command to do that?
if ur passing disnake.Member to the autocomplete itll just show all members regardless. you gotta pull the members from within the autocomplete and pass it back that way.
nevermind. I changed that parameter cast to a string and recasted inside of my command. Thank you for your help ❤️