Add /roles with an editable list of up to five emoji/role pairs, three starter emojis in settings, and give or remove the matching role when a member reacts Use the emoji setting type for each Unicode emoji, with a list of emoji rows when there are several.
Reaction Roles lets members assign themselves roles by reacting. Configure up to five emoji/role pairs in Setup; three starter emojis are included (๐ต ๐ข ๐ก), and only the server roles need selecting. Run /roles to post a panel. Adding a reaction grants its role; removing it removes the role. Existing panels retain the pairs they were posted with.
Made by MEE6. Remix it to get a copy of your own and change anything you like.
React to get a role!
๐ต โ @Member ๐ข โ @Gamer ๐ก โ @Creator
// Reaction roles: editable emoji/role pairs, with three ready-made emojis.
mee6.settings({
roles: {
type: 'list',
label: 'Reaction roles',
maxItems: 5,
fields: {
emoji: { type: 'emoji', label: 'Emoji', required: true, default: '๐ต' },
role: { type: 'role', label: 'Role', required: true, sample: 'Member' },
},
default: [{ emoji: '๐ต' }, { emoji: '๐ข' }, { emoji: '๐ก' }],
sample: [
{ emoji: '๐ต', role: 'Member' },
{ emoji: '๐ข', role: 'Gamer' },
{ emoji: '๐ก', role: 'Creator' },
],
},
});
type Pair = { emoji: string; role: string };
mee6.command('roles', { description: 'Post the reaction roles message' }, async (ctx) => {
const pairs = (ctx.settings.roles ?? []) as Pair[];
if (!pairs.length || pairs.some((pair) => !pair.role || !pair.emoji)) {
await ctx.reply('Choose the roles and emojis in Setup first.');
return;
}
const sent = await ctx.reply({
embed: {
title: '๐ญ Reaction Roles',
description: 'React to get a role!\n\n' + pairs.map((pair) => `${pair.emoji} โ <@&${pair.role}>`).join('\n'),
color: '#5865F2',
footer: { text: 'Click a reaction to assign yourself a role' },
},
});
if (!sent.messageId) return;
for (const pair of pairs) await mee6.addReaction(sent.channelId, sent.messageId, pair.emoji);
// Keep the posted panel's policy even if the admin later edits the settings.
await mee6.store.set(`rr_${sent.messageId}`, pairs);
});
mee6.on('reaction_add', async (ctx) => {
const pairs = await mee6.store.get<Pair[]>(`rr_${ctx.messageId}`);
const pair = pairs?.find((pair) => pair.emoji === ctx.emoji);
if (pair) await ctx.addRole(pair.role);
});
mee6.on('reaction_remove', async (ctx) => {
const pairs = await mee6.store.get<Pair[]>(`rr_${ctx.messageId}`);
const pair = pairs?.find((pair) => pair.emoji === ctx.emoji);
if (pair) await ctx.removeRole(pair.role);
});