When a member joins with a banned word in their nickname, kick them and log it in #mod-logs with their name and account
Automatically kicks members who join with banned words in their nickname and logs the action to a mod channel.
Configure two settings in the dashboard:
spam,scam,hack,bot)When a member joins, their display name is checked against the banned words list (case-insensitive). If a match is found, they're immediately kicked and a log embed is posted showing:
The bot needs Kick Members permission to function.
Made by MEE6. Remix it to get a copy of your own and change anything you like.
Jordan was kicked for having a banned word in their nickname.
free-nitro-spam
@Jordan
2000000000000000003
spam
// Auto-kick members who join with banned words in their nickname
mee6.settings({
log_channel: {
type: 'channel',
label: 'Mod log channel',
required: true,
sample: 'mod-logs',
},
banned_words: {
type: 'string',
label: 'Banned words (comma-separated)',
default: 'spam,scam,hack',
sample: 'spam,scam,hack,bot',
},
});
mee6.on('member_join', async (ctx) => {
const logChannelId = ctx.settings.log_channel;
if (!logChannelId) {
mee6.log('No log channel configured โ skipping filter');
return;
}
const bannedWordsStr = ctx.settings.banned_words as string;
if (!bannedWordsStr) {
return;
}
// Parse banned words list
const bannedWords = bannedWordsStr
.toLowerCase()
.split(',')
.map((w) => w.trim())
.filter((w) => w.length > 0);
if (bannedWords.length === 0) {
return;
}
// Check the member's display name (nickname or username)
const displayName = ctx.author.displayName.toLowerCase();
const foundWord = bannedWords.find((word) => displayName.includes(word));
if (foundWord) {
// Kick the member
try {
await mee6.kick(ctx.author.id, `Banned word in nickname: ${foundWord}`);
// Log to mod channel
await ctx.send(logChannelId, {
embed: {
title: '๐ซ Member Auto-Kicked',
description: `**${ctx.author.username}** was kicked for having a banned word in their nickname.`,
color: '#e74c3c',
fields: [
{ name: 'Display Name', value: ctx.author.displayName, inline: true },
{ name: 'Account', value: `<@${ctx.author.id}>`, inline: true },
{ name: 'User ID', value: ctx.author.id, inline: true },
{ name: 'Banned Word', value: `\`${foundWord}\``, inline: true },
],
timestamp: new Date().toISOString(),
},
});
mee6.log(`Kicked ${ctx.author.username} (${ctx.author.id}) for banned word: ${foundWord}`);
} catch (err) {
mee6.log(`Failed to kick ${ctx.author.id}: ${err}`);
}
}
});