Greet new members in a channel I choose with one of five welcome lines from the code picked at random, their mention outside the embed, delete the previous welcome message, ignore bots, and DM them the rules only once they gain the @Verified role
Welcomes new members with a random greeting in your chosen channel, automatically deletes the previous welcome message to keep it clean, and DMs the server rules once when a member receives the verified role. Ignores bots and only sends rules once per member.
Made by MEE6. Remix it to get a copy of your own and change anything you like.
@Jordan
Welcome to the server! We're glad to have you here.
// Welcome & Rules — greet new members and DM rules when verified
const WELCOME_MESSAGES = [
"Welcome to the server! We're glad to have you here.",
'Great to see you! Make yourself at home.',
'Hey there! Welcome aboard, excited to have you with us!',
'Welcome! Feel free to explore and join the conversation.',
'A warm welcome to you! Hope you enjoy your stay.',
];
mee6.settings({
welcome_channel: {
type: 'channel',
label: 'Welcome channel',
required: true,
sample: 'welcome',
},
verified_role: {
type: 'role',
label: 'Verified role (triggers rules DM)',
required: true,
sample: 'Verified',
},
rules: {
type: 'string',
label: 'Rules text to DM',
default: 'Please read our rules:\n1. Be respectful\n2. No spam\n3. Follow Discord ToS',
sample: 'Please read our rules:\n1. Be respectful\n2. No spam\n3. Follow Discord ToS',
},
});
// Greet new members
mee6.on('member_join', async (ctx) => {
if (ctx.author.bot) return; // Ignore bots
const channelId = ctx.settings.welcome_channel;
if (!channelId) {
mee6.log('Welcome channel not configured');
return;
}
// Pick a random welcome message
const message = WELCOME_MESSAGES[Math.floor(Math.random() * WELCOME_MESSAGES.length)];
// Delete the previous welcome message if it exists
const lastMessageId = await mee6.store.get<string>('last_welcome_message');
if (lastMessageId) {
try {
await mee6.deleteMessage(channelId, lastMessageId);
} catch (e) {
// Message might already be deleted or not exist
mee6.log(`Could not delete previous welcome: ${e}`);
}
}
// Send the new welcome
const sent = await ctx.send(channelId, {
content: `${ctx.author.mention}`,
embed: {
description: message,
color: '#5865F2',
thumbnail_url: ctx.author.avatarUrl,
},
});
// Store this message ID for next time
await mee6.store.set('last_welcome_message', sent.messageId);
});
// DM rules when verified role is added
mee6.on('member_update', async (ctx) => {
const verifiedRoleId = ctx.settings.verified_role;
if (!verifiedRoleId) {
mee6.log('Verified role not configured');
return;
}
// Check if the verified role was just added
if (!ctx.addedRoles.includes(verifiedRoleId)) return;
// Check if we've already sent rules to this member
const m = mee6.store.member(ctx.author.id);
const alreadySent = await m.get<boolean>('rules_sent');
if (alreadySent) return;
// Send the rules via DM
const rules = ctx.settings.rules || 'Welcome! Please follow the server rules.';
const delivered = await mee6.dm(ctx.author.id, {
embed: {
title: '📜 Server Rules',
description: rules,
color: '#5865F2',
},
});
if (delivered) {
// Mark that we've sent the rules
await m.set('rules_sent', true);
mee6.log(`Sent rules to ${ctx.author.username}`);
} else {
mee6.log(`Could not DM rules to ${ctx.author.username} (DMs closed)`);
}
});