I'm a newbie so I would like to apologize in advance if this sounds like a stupid question. I couldn't figure out how to make my discord bot programmed in python delete the second to last recent message.
I know that there are various ways to delete messages upon user input like: await message.channel.purge(limit=1)
which simply removes the latest message in the server based on different conditions in the if-statement set up above it. However, I'm not sure how to skip the latest message and remove the second message in line.
For example, if I have two messages currently present in the discord channel:
# Message One (sent before)
# Message Two (sent after)
Message One is sent before message Two and I would like to remove Message One without the removal of Message Two. Message One has a special part (content) attached to it, but I couldn't find any methods that would remove a message based on the message's content.
Any help would be much appreciated and thanks in advance!