Add /snipe which shows the last deleted message of the channel with its author, and /editsnipe which shows the last edit with the text before and after
Message Snipe tracks the last deleted and edited message in each channel.
/snipe โ Shows the last deleted message with its author and when it was deleted/editsnipe โ Shows the last edited message with the text before and after the editMessages are tracked for up to 1 hour after deletion or editing. Each channel maintains its own history.
Made by MEE6. Remix it to get a copy of your own and change anything you like.
I can't believe I just said that...
Before: This server is amzing!
After: This server is amazing!
// Message Snipe โ track deleted and edited messages
// Store the last deleted message per channel
mee6.on('message_delete', async (ctx) => {
await mee6.store.set(
`snipe_${ctx.channelId}`,
{
content: ctx.message.content,
authorId: ctx.author.id,
authorName: ctx.author.username,
timestamp: Date.now(),
},
{ ttl: 3600 }
); // Keep for 1 hour
});
// Store the last edited message per channel
mee6.on('message_edit', async (ctx) => {
await mee6.store.set(
`editsnipe_${ctx.channelId}`,
{
before: ctx.previousContent,
after: ctx.message.content,
authorId: ctx.author.id,
authorName: ctx.author.username,
timestamp: Date.now(),
},
{ ttl: 3600 }
); // Keep for 1 hour
});
// Show the last deleted message
mee6.command('snipe', { description: 'Show the last deleted message in this channel' }, async (ctx) => {
const data = await mee6.store.get<{
content: string;
authorId: string;
authorName: string;
timestamp: number;
}>(`snipe_${ctx.channelId}`);
if (!data) {
await ctx.reply('No recently deleted messages in this channel.');
return;
}
const secondsAgo = Math.floor((Date.now() - data.timestamp) / 1000);
await ctx.reply({
embed: {
title: '๐ Sniped Message',
description: data.content || '*No text content*',
color: '#e74c3c',
author: {
name: data.authorName,
},
footer: {
text: `Deleted ${secondsAgo}s ago`,
},
},
});
});
// Show the last edited message
mee6.command('editsnipe', { description: 'Show the last edited message in this channel' }, async (ctx) => {
const data = await mee6.store.get<{
before: string;
after: string;
authorId: string;
authorName: string;
timestamp: number;
}>(`editsnipe_${ctx.channelId}`);
if (!data) {
await ctx.reply('No recently edited messages in this channel.');
return;
}
const secondsAgo = Math.floor((Date.now() - data.timestamp) / 1000);
await ctx.reply({
embed: {
title: 'โ๏ธ Edit Sniped',
description: `**Before:**\n${data.before || '*No text content*'}\n\n**After:**\n${
data.after || '*No text content*'
}`,
color: '#3498db',
author: {
name: data.authorName,
},
footer: {
text: `Edited ${secondsAgo}s ago`,
},
},
});
});