Add a /quote command that takes a message id, reads that message and reposts its content as an embed crediting the original author
Quote and repost messages as styled embeds.
Usage:
/quote message_id:<id> — Quote a message from the current channel/quote message_id:<id> channel:#other — Quote from a different channelThe bot reads the message, formats it as an embed with the author's name and avatar, includes any images, and adds a link back to the original message.
Made by MEE6. Remix it to get a copy of your own and change anything you like.
Helpful tip: pin the answers to common questions so new members can find them easily.
// Message Quote - reads a message and reposts it as an embed
mee6.command(
'quote',
{
description: 'Quote a message by its ID',
options: [
{
name: 'message_id',
type: 'string',
description: 'The ID of the message to quote',
required: true,
},
{
name: 'channel',
type: 'channel',
description: 'Channel where the message is (defaults to current channel)',
required: false,
},
],
},
async (ctx) => {
const messageId = ctx.option<string>('message_id');
const channelId = ctx.option<string>('channel') || ctx.channelId;
// Read the message
const msg = await mee6.getMessage(channelId, messageId);
if (!msg) {
await ctx.reply({
content:
'❌ Could not find that message. Make sure the ID is correct and I have permission to read that channel.',
ephemeral: true,
});
return;
}
// Build the embed
const embed: any = {
description: msg.content || '*No text content*',
author: {
name: msg.author.displayName,
icon_url: msg.author.avatarUrl,
},
color: '#5865F2',
footer: {
text: `Quoted from #${(await mee6.getChannel(channelId))?.name || 'unknown'}`,
},
timestamp: new Date().toISOString(),
};
// Add image if the message has one
if (msg.attachments && msg.attachments.length > 0) {
const image = msg.attachments.find((a) => a.url.match(/\.(png|jpg|jpeg|gif|webp)$/i));
if (image) {
embed.image_url = image.url;
}
}
// Add a link to the original message
embed.description += `\n\n[Jump to message](${msg.url})`;
await ctx.reply({ embed });
}
);