Add a /verify command that posts a message with a button, and give the @Verified role to whoever clicks it
Simple verification system for Discord servers.
/verify in a channel to post the verification buttonConfigure the Verified role setting in the dashboard โ pick which role should be granted when members verify themselves.
Made by MEE6. Remix it to get a copy of your own and change anything you like.
โ Click the button below to verify yourself and gain access to the server!
// Verification system โ posts a button that grants a role when clicked
mee6.settings({
verified_role: {
type: 'role',
label: 'Verified role',
required: true,
sample: 'Verified',
},
});
mee6.command(
'verify',
{
description: 'Post verification button',
},
async (ctx) => {
const roleId = ctx.settings.verified_role;
if (!roleId) {
await ctx.reply('No verified role set yet โ an admin can choose one in the dashboard.');
return;
}
await ctx.reply({
content: 'โ
Click the button below to verify yourself and gain access to the server!',
buttons: [
{
label: 'Verify',
customId: 'verify',
style: 'success',
},
],
});
}
);
mee6.on('button', async (ctx) => {
if (ctx.customId === 'verify') {
const roleId = ctx.settings.verified_role;
if (!roleId) {
await ctx.reply({ content: 'Verification is not set up yet.', ephemeral: true });
return;
}
// Check if they already have the role
if (ctx.author.roles.includes(roleId)) {
await ctx.reply({ content: 'โ
You are already verified!', ephemeral: true });
return;
}
// Grant the role
try {
await ctx.addRole(roleId);
await ctx.reply({ content: 'โ
Verified! You now have access to the server.', ephemeral: true });
} catch (err) {
await ctx.reply({
content: 'Failed to grant the role. Please contact an admin.',
ephemeral: true,
});
mee6.log(`Failed to grant role ${roleId}: ${err}`);
}
}
});