Closed Stegosawr closed 3 years ago
As refered to here https://gowalker.org/github.com/bwmarrin/discordgo#Session_ChannelDelete this only works for messages that are created after the bot is started, right? Because of the state?
No. It will work for any message—the function is simply a shallow wrapper over the HTTP endpoint. There is no state involved.
But how are you suposed to get the existing messages? I tried using the Channel type and thats the point https://gowalker.org/github.com/bwmarrin/discordgo#Channel where I am having trouble selecting the already existing messages is there a better way? Sorry for not being specific in the first message.
It sounds like your question fundamentally relates to retrieving messages rather than deleting them, then. If you'd like to pull messages from a channel that don't exist in the state, you can use (*Session).ChannelMessages
. You need to decide how you actually want to determine what message(s) you want to delete, however—is it just the fact that it appeared in a channel? is it mentioned by a user in a command? is it replied to by another message? etc. These aren't necessarily questions I'm asking directly to you, but things to ponder: you can't fight the second law of thermodynamics—you can't produce information where there is none. You need some sort of tie to that message.
It might be late already, but not late enough for me to question general physic laws. But I guess you already help a lot. Thank you very much for that.
I was wondering if there is a way to delete already existing messages of a channel in discord via a discordgo bot. Meaning you can get existing messages via a function and delete them.