Jon Pitans TA
DIAdiscord.js - Imagine an app
•Created by Jon Pitans TA on 1/16/2024 in #djs-questions
Getting messages from a channel
that was really helpful, I was trying to fire it off using a slash command. This is what worked for anyone else in my situation
async execute(interaction) {
await interaction.reply("last 10 messages are : ");
const channel = interaction.client.channels.cache.get(
"my channel id as a string"
);
await channel.messages
.fetch({ limit: 10, cache: false })
.then((messages) =>
messages.forEach((e, i) => interaction.followUp(e.content))
);
},
5 replies