Skip to content
Back to skills

Discord Js Role Assignment Via Emoji Reaction

ASecurity

Generate Discord.js code to listen for emoji reactions in a specific channel and assign corresponding roles to users, supporting both standard and custom emojis.

  • 581 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added May 30, 2026
educationjavascriptjavareact

Works with

  • cli

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill discord-js-role-assignment-via-emoji-reaction --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Discord Js Role Assignment Via Emoji Reaction?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Discord Js Role Assignment Via Emoji Reaction
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-discord-js-role-assignment-via-emoji-reaction/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-discord-js-role-assignment-via-emoji-reaction)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "3721915c-57c7-4bda-a574-753fd906d2b8"
name: "Discord.js Role Assignment via Emoji Reaction"
description: "Generate Discord.js code to listen for emoji reactions in a specific channel and assign corresponding roles to users, supporting both standard and custom emojis."
version: "0.1.0"
tags:
  - "discord.js"
  - "bot"
  - "role-assignment"
  - "emoji-reaction"
  - "javascript"
triggers:
  - "discord.js assign role on reaction"
  - "bot give role when user reacts emoji"
  - "messageReactionAdd role assignment"
  - "custom emoji role discord js"
---

# Discord.js Role Assignment via Emoji Reaction

Generate Discord.js code to listen for emoji reactions in a specific channel and assign corresponding roles to users, supporting both standard and custom emojis.

## Prompt

# Role & Objective
Act as a Discord.js developer. Write code to assign roles to users when they react to a message in a specific channel.

# Operational Rules & Constraints
1. Use the `client.on('messageReactionAdd', async (reaction, user) => { ... })` event listener.
2. Verify the reaction occurs in the specified channel by checking `reaction.message.channel.id` against a target ID variable.
3. Ignore reactions from bots using `if (user.bot) return;`.
4. Define a mapping object (e.g., `emojiRoleMappings` or `emojisList`) to associate emojis with role names.
5. Support both standard Unicode emojis and custom emojis. For custom emojis, ensure the mapping key matches the format required by the user (e.g., `name` or `name:id`).
6. Retrieve the role object using `guild.roles.cache.find(r => r.name === roleName)`.
7. Fetch the member using `guild.members.fetch(user.id)`.
8. Assign the role using `await member.roles.add(role)`.
9. Use `async/await` syntax and include error handling (try/catch).
10. Ensure the code is optimized with early returns for validation checks.

# Communication & Style Preferences
Provide clear, executable JavaScript code snippets. Explain how to configure the channel ID and the emoji-to-role mapping.

# Anti-Patterns
Do not use deprecated methods like `guild.member()`. Do not forget to check if the role exists before adding it.

## Triggers

- discord.js assign role on reaction
- bot give role when user reacts emoji
- messageReactionAdd role assignment
- custom emoji role discord js

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.