Build a warning system: /strike DMs the member the reason and who warned them and keeps the warning with its date, three warnings in 7 days time them out for an hour and five kick them, warnings expire after 30 days; /strikes shows a member\'s full history with exact dates, /note adds a private staff note, /unstrike removes the last warning, and /appeal opens a private thread with the @Staff role
Track member warnings with automatic escalation and appeals
Staff can warn members with /strike, which DMs them the reason and who warned them. Warnings are tracked with exact dates and automatically expire after 30 days.
Auto-escalation: 3 warnings in 7 days → 1 hour timeout, 5 warnings → kick
Commands:
/strike @member reason — issue a warning (auto-escalates)/note @member note — add a private staff note (doesn't count toward escalation)/strikes @member — view full warning and note history/unstrike @member — remove the most recent warning/appeal — member opens a private thread with staff to appeal warningsSet the Staff role in settings so appeals ping the right team.
Made by MEE6. Remix it to get a copy of your own and change anything you like.
⚠️ You have been warned by You. Reason: Spamming in general
⚠️ You have been warned by You. Reason: Advertising without permission
⚠️ You have been warned by You. Reason: Posting NSFW content
// Warning system: track member warnings with auto-escalation and appeals
mee6.settings({
staff_role: { type: 'role', label: 'Staff role (for appeals)', required: true, sample: 'Staff' },
});
interface Warning {
reason: string;
staff: string; // who issued it
date: number; // timestamp
type: 'warning' | 'note'; // notes don't count toward escalation
}
/** Count active warnings (not expired, not notes) in the last 7 days */
function activeWarnings(warnings: Warning[]): Warning[] {
const now = Date.now();
const sevenDays = 7 * 24 * 60 * 60 * 1000;
return warnings.filter((w) => w.type === 'warning' && now - w.date < sevenDays);
}
/** Remove warnings older than 30 days */
function pruneExpired(warnings: Warning[]): Warning[] {
const now = Date.now();
const thirtyDays = 30 * 24 * 60 * 60 * 1000;
return warnings.filter((w) => now - w.date < thirtyDays);
}
mee6.command(
'strike',
{
description: 'Warn a member — auto-escalates at 3 (timeout) and 5 (kick)',
options: [
{ name: 'member', type: 'user', description: 'Who to warn', required: true },
{ name: 'reason', type: 'string', description: 'Why', required: true },
],
},
async (ctx) => {
const targetId = ctx.option<string>('member');
const reason = ctx.option<string>('reason');
// Don't warn bots or staff
const target = await mee6.getMember(targetId);
if (!target) {
await ctx.reply({ content: 'Member not found.', ephemeral: true });
return;
}
if (target.bot) {
await ctx.reply({ content: 'You cannot warn a bot.', ephemeral: true });
return;
}
const m = mee6.store.member(targetId);
const history = await m.get<Warning[]>('warnings', []);
const pruned = pruneExpired(history);
// Add the new warning
const warning: Warning = {
reason,
staff: ctx.author.id,
date: Date.now(),
type: 'warning',
};
pruned.push(warning);
await m.set('warnings', pruned);
// DM the member
const dmSent = await mee6.dm(
targetId,
`⚠️ You have been warned by **${ctx.author.displayName}**.\n**Reason:** ${reason}`
);
// Check escalation
const active = activeWarnings(pruned);
const count = active.length;
let action = '';
if (count >= 5) {
// Kick
try {
await mee6.kick(targetId, `5 warnings in 7 days. Latest: ${reason}`);
action = ' → **kicked** (5 warnings in 7 days)';
} catch (e) {
action = ' → kick failed (check permissions/role hierarchy)';
}
} else if (count >= 3) {
// 1 hour timeout
try {
await mee6.timeout(targetId, 3600, `3 warnings in 7 days. Latest: ${reason}`);
action = ' → **timed out for 1 hour** (3 warnings in 7 days)';
} catch (e) {
action = ' → timeout failed (check permissions/role hierarchy)';
}
}
await ctx.reply({
content: `✅ Warned ${target.mention} (${count} warning${count === 1 ? '' : 's'} in the last 7 days)${action}\n${
dmSent ? '' : '⚠️ Could not DM the member.'
}`,
ephemeral: true,
});
}
);
mee6.command(
'note',
{
description: 'Add a private staff note to a member (does not count as a warning)',
options: [
{ name: 'member', type: 'user', description: 'Who', required: true },
{ name: 'note', type: 'string', description: 'Note text', required: true },
],
},
async (ctx) => {
const targetId = ctx.option<string>('member');
const noteText = ctx.option<string>('note');
const m = mee6.store.member(targetId);
const history = await m.get<Warning[]>('warnings', []);
const pruned = pruneExpired(history);
const note: Warning = {
reason: noteText,
staff: ctx.author.id,
date: Date.now(),
type: 'note',
};
pruned.push(note);
await m.set('warnings', pruned);
await ctx.reply({
content: `📝 Note added to <@${targetId}>'s record.`,
ephemeral: true,
});
}
);
mee6.command(
'strikes',
{
description: "Show a member's full warning and note history",
options: [{ name: 'member', type: 'user', description: 'Who to check', required: true }],
},
async (ctx) => {
const targetId = ctx.option<string>('member');
const target = await mee6.getMember(targetId);
if (!target) {
await ctx.reply({ content: 'Member not found.', ephemeral: true });
return;
}
const m = mee6.store.member(targetId);
const history = await m.get<Warning[]>('warnings', []);
const pruned = pruneExpired(history);
if (pruned.length === 0) {
await ctx.reply({
content: `${target.displayName} has no warnings or notes.`,
ephemeral: true,
});
return;
}
// Save pruned list if we removed anything
if (pruned.length !== history.length) {
await m.set('warnings', pruned);
}
const active = activeWarnings(pruned);
const lines = pruned.map((w, i) => {
const date = new Date(w.date).toISOString().split('T')[0]; // YYYY-MM-DD
const icon = w.type === 'warning' ? '⚠️' : '📝';
return `${icon} **${date}** by <@${w.staff}>: ${w.reason}`;
});
await ctx.reply({
embed: {
title: `${target.displayName}'s infractions`,
description: lines.join('\n'),
footer: {
text: `${active.length} active warning${active.length === 1 ? '' : 's'} in the last 7 days`,
},
color: active.length >= 3 ? 0xe74c3c : active.length > 0 ? 0xf39c12 : 0x95a5a6,
},
ephemeral: true,
});
}
);
mee6.command(
'unstrike',
{
description: "Remove a member's most recent warning (notes are not removed)",
options: [{ name: 'member', type: 'user', description: 'Who', required: true }],
},
async (ctx) => {
const targetId = ctx.option<string>('member');
const m = mee6.store.member(targetId);
const history = await m.get<Warning[]>('warnings', []);
const pruned = pruneExpired(history);
// Find the last warning (not a note)
let removed = false;
for (let i = pruned.length - 1; i >= 0; i--) {
if (pruned[i].type === 'warning') {
pruned.splice(i, 1);
removed = true;
break;
}
}
if (!removed) {
await ctx.reply({ content: 'No warnings to remove.', ephemeral: true });
return;
}
await m.set('warnings', pruned);
const active = activeWarnings(pruned);
await ctx.reply({
content: `✅ Removed the most recent warning from <@${targetId}>. They now have ${active.length} active warning${
active.length === 1 ? '' : 's'
}.`,
ephemeral: true,
});
}
);
mee6.command(
'appeal',
{
description: 'Open a private appeal thread with staff',
},
async (ctx) => {
const staffRoleId = ctx.settings.staff_role;
if (!staffRoleId) {
await ctx.reply({
content: 'Appeals are not set up yet — ask an admin to set the staff role in the dashboard.',
ephemeral: true,
});
return;
}
// Check if they already have an open appeal
const m = mee6.store.member(ctx.author.id);
const existingThreadId = await m.get<string>('appeal_thread');
if (existingThreadId) {
const existing = await mee6.getChannel(existingThreadId);
if (existing && existing.type === 'thread') {
await ctx.reply({
content: `You already have an open appeal: <#${existingThreadId}>`,
ephemeral: true,
});
return;
}
// Thread was closed or deleted, clear it
await m.delete('appeal_thread');
}
// Create a private thread in the current channel
const thread = await mee6.createThread(ctx.channelId, `Appeal: ${ctx.author.displayName}`, {
private: true,
autoArchiveMinutes: 1440,
});
await m.set('appeal_thread', thread.threadId);
// Post initial message
await ctx.send(thread.threadId, {
content: `<@&${staffRoleId}> ${ctx.author.mention} has opened an appeal.`,
// Notifies the staff role even when the server keeps it closed to pings
ping: [staffRoleId],
embed: {
title: 'New appeal',
description: `${ctx.author.mention}, please explain why you believe your warning(s) should be reconsidered. Staff will review and respond.`,
color: 0x3498db,
},
});
await ctx.reply({
content: `✅ Your appeal thread has been created: <#${thread.threadId}>`,
ephemeral: true,
});
}
);