I have the id of the message, the id of the guild, and the channel id i just want to know how to delete a message with just those three things
I have looked everywhere and haven't found something that works
I have the id of the message, the id of the guild, and the channel id i just want to know how to delete a message with just those three things
I have looked everywhere and haven't found something that works
"I have looked everywhere and haven't found something that works."
Did you not look at the djs docs? I found the answer to your question on the docs in seconds. Not to mention, dozens of other StackOverflow questions found in one google search, such as this one. Regardless, I'll show you how to do it.
All you really need is the ID of the message and channel. And the client
instance. You don't even need the guild ID. Here's the code:
const channelId = "insert channel id here";
const messageId = "insert message id here";
client.channels.fetch(channelId).then(channel => {
channel.messages.delete(messageId);
});
That code is the easiest way to delete a message by ID, assuming you only have access to the client
. If you have access to a channel
instance already (e.g. message.channel
), the only code you need to do is the code within the .then()
shown above.