Skip to content

Sending and managing messages

const general = community.channels.find((c) => c.name === "general");
const sent = await general.send("hello");
await sent.reply("replying to myself");
const message = await general.send("typo");
await message.edit("fixed");
await message.react("👍");
await message.delete();

You can edit and delete your own messages; deleting someone else’s needs MANAGE_MESSAGES.

The client keeps no message history of its own; fetch pages from the host:

const latest = await general.messages.fetch({ limit: 50 });

An edit or deletion event only says what changed, so it carries a partial message: its id, and for an edit its new text. It still acts (reply, edit, delete, react), but fields the event didn’t include are empty.