Let moderators right-click a picture to blacklist it; when anyone posts that picture again, as a file or a link, delete it, time them out for an hour and report it in a log channel, with commands to list and remove blacklisted pictures
Moderators blacklist a picture with one right-click — Apps → Blacklist this picture — and the module removes the message. From then on, anyone posting that picture again, as a file or as a pasted link, recompressed or resized, has the message deleted, is timed out, and is told why in DMs; the log channel keeps the record.
Recognition uses the fingerprint Discord computes for every picture it serves — nothing is downloaded, and only the fingerprint is stored, never the picture. /blacklist list shows the entries with how often each was caught; /blacklist remove takes one off.
Made by MEE6. Remix it to get a copy of your own and change anything you like.
@Jordan blacklisted 1 picture(s) posted by @Alex in #general. The message was removed.
@Sam posted a blacklisted picture in #general (blacklisted by Jordan). Timed out for 60 minutes.
// Image blacklist: moderators right-click a picture → Apps → "Blacklist this picture";
// the same picture posted again — as a file or as a link, recompressed or resized —
// is removed and its author timed out. Recognition uses Discord's own fingerprint
// of each picture (mee6.samePicture): nothing is downloaded, nothing is stored but
// the fingerprint.
mee6.settings({
staff_role: {
type: 'role',
label: 'Moderator role (may blacklist; exempt from the filter)',
required: true,
sample: 'Staff',
},
log_channel: { type: 'channel', label: 'Log channel', required: true, sample: 'mod-logs' },
timeout_minutes: {
type: 'integer',
label: 'Timeout for posting a blacklisted picture (minutes, 0 = none)',
default: 60,
sample: 60,
},
});
interface Banned {
placeholder: string;
reason: string;
by: string;
at: number;
hits: number;
}
const list = () => mee6.store.get<Banned[]>('banned', []);
function isStaff(ctx: { author: { roles: string[] }; settings: Record<string, unknown> }): boolean {
const role = ctx.settings.staff_role as string | null;
return !!role && ctx.author.roles.includes(role);
}
// Right-click a message → Apps → Blacklist this picture (moderators only)
mee6.messageCommand('Blacklist this picture', { ephemeral: true }, async (ctx) => {
if (!isStaff(ctx)) return ctx.reply('Only moderators can blacklist pictures.');
const pictures = ctx.message.pictures.filter((p) => p.placeholder);
if (!pictures.length) return ctx.reply('That message has no picture to blacklist.');
const banned = await list();
let added = 0;
for (const picture of pictures) {
if (banned.some((b) => mee6.samePicture(picture, b.placeholder))) continue;
banned.push({
placeholder: picture.placeholder!,
reason: `blacklisted by ${ctx.author.username}`,
by: ctx.author.id,
at: Date.now(),
hits: 0,
});
added++;
}
await mee6.store.set('banned', banned);
await mee6.deleteMessage(ctx.message.channelId, ctx.message.id);
// The log shows blurred previews decoded from the fingerprints — the banned picture itself never goes anywhere.
await ctx.send(ctx.settings.log_channel as string, {
embed: {
title: '🚫 Picture blacklisted',
description: `${ctx.author.mention} blacklisted ${pictures.length} picture(s) posted by <@${ctx.message.authorId}> in <#${ctx.message.channelId}>. The message was removed.`,
color: 0xe74c3c,
thumbnail_url: 'attachment://picture-1.png',
},
files: pictures.slice(0, 10).map((p, i) => ({ preview: p, name: `picture-${i + 1}.png` })),
});
await ctx.reply(
added ? `Blacklisted ${added} picture(s). Total: ${banned.length}.` : 'Already on the blacklist — message removed.'
);
});
// Files come with the message; a pasted link becomes a picture once Discord
// unfurls it, which is the link_preview event. A message with both fires both
// events, so each looks only at its own pictures and the message is removed once.
mee6.on('message', { hasAttachment: true }, (ctx) => check(ctx, 'attachment'));
mee6.on('link_preview', (ctx) => check(ctx, 'embed'));
async function check(ctx, source: 'attachment' | 'embed') {
if (isStaff(ctx)) return;
const banned = await list();
if (!banned.length) return;
for (const picture of ctx.message.pictures.filter((p) => p.source === source)) {
const index = banned.findIndex((b) => mee6.samePicture(picture, b.placeholder));
if (index < 0) continue;
await ctx.delete();
banned[index].hits++;
await mee6.store.set('banned', banned);
const minutes = Number(ctx.settings.timeout_minutes ?? 0);
if (minutes > 0) await mee6.timeout(ctx.author.id, minutes * 60, 'Posted a blacklisted picture');
await mee6.dm(
ctx.author.id,
`Your message in <#${ctx.channelId}> was removed: that picture is blacklisted on this server.` +
(minutes > 0 ? ` You are timed out for ${minutes} minutes.` : '')
);
await ctx.send(ctx.settings.log_channel as string, {
embed: {
title: '🚨 Blacklisted picture removed',
description:
`${ctx.author.mention} posted a blacklisted picture in <#${ctx.channelId}> (${banned[index].reason}).` +
(minutes > 0 ? ` Timed out for ${minutes} minutes.` : ''),
color: 0xe74c3c,
thumbnail_url: 'attachment://picture.png',
},
files: [{ preview: picture, name: 'picture.png' }],
});
return;
}
}
// The list is a numbered gallery: one blurred preview per entry, decoded from
// its fingerprint — enough to recognise a picture, nothing worth looking at.
const PAGE = 10; // Discord shows at most 10 files on a message
mee6.command(
'blacklist list',
{
description: 'Show the blacklisted pictures',
ephemeral: true,
options: [{ name: 'page', type: 'integer', description: 'Which page, 10 pictures each', required: false }],
},
async (ctx) => {
const banned = await list();
if (!banned.length)
return ctx.reply('The blacklist is empty. Right-click a picture → Apps → Blacklist this picture.');
const pages = Math.ceil(banned.length / PAGE);
const page = Math.min(Math.max(Number(ctx.option<number>('page') ?? 1), 1), pages);
const start = (page - 1) * PAGE;
const entries = banned.slice(start, start + PAGE);
const lines = entries.map(
(b, i) => `**${start + i + 1}.** ${b.reason} — added <t:${Math.floor(b.at / 1000)}:R>, caught ${b.hits} time(s)`
);
await ctx.reply({
embed: {
title: `🚫 Image blacklist (${banned.length})`,
description: lines.join('\n'),
color: 0xe74c3c,
footer: {
text:
pages > 1
? `Page ${page} of ${pages} — /blacklist list page:${page < pages ? page + 1 : 1} for the next`
: 'Previews below, in the same order',
},
},
files: entries.map((b, i) => ({ preview: b.placeholder, name: `${start + i + 1}.png` })),
});
}
);
mee6.command(
'blacklist remove',
{
description: 'Take a picture off the blacklist',
ephemeral: true,
options: [{ name: 'number', type: 'integer', description: 'Its number in /blacklist list', required: true }],
},
async (ctx) => {
if (!isStaff(ctx)) return ctx.reply('Only moderators can edit the blacklist.');
const banned = await list();
const index = ctx.option<number>('number') - 1;
if (index < 0 || index >= banned.length) return ctx.reply(`There is no entry ${index + 1}. Check /blacklist list.`);
banned.splice(index, 1);
await mee6.store.set('banned', banned);
await ctx.reply(`Removed entry ${index + 1}. ${banned.length} picture(s) remain blacklisted.`);
}
);