problem getting original emojis from discord [discord.js/discordjs v14] #1599
-
Hi everyone !!! I am trying to create a discord bot to assign roles based on a reaction to a message from the bot. const GET_EMOJI = (name) => client.emojis.cache.find(emoji => emoji.name === name); But not with the original emojis. index.js: const { Client, GatewayIntentBits} = require("discord.js");
const { TOKEN } = require("./config.json");
const ROLE_CLAMED = require("./utils/roleClaimed");
const BOT = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages]
});
BOT.once("ready", () => {
console.log("Hello I'm ready !!!");
ROLE_CLAMED(BOT);
});
BOT.login(TOKEN); roleClaimed.js: const { Client } = require("discord.js");
const FIRST_MSG = require("./firstMsg");
const ROLE_CHANEL_NAME = "roles";
const EMOJIS = {
// custom emojis
valorant: "0valo",
// destiny2: "0dest",
// LeagueOfLegends: "0lol",
// original emojis
test_1: "milky_way",
// test_2: ":gun:",
// test_3: ":milky_way:",
}
module.exports = (client) => {
const CHANNEL = client.channels.cache.find(e => e.name === ROLE_CHANEL_NAME);
const GET_EMOJI = (name) => client.emojis.cache.find(e => e.name === name);
const CHOICE = [];
let txt = "test msg\n\n";
for (const KEY in EMOJIS) {
const ROLE = KEY;
const EMOJI= GET_EMOJI(EMOJIS[KEY]);
CHOICE.push(EMOJI);
txt += `${EMOJI} : ${ROLE}\n`;
}
FIRST_MSG(CHANNEL, txt, CHOICE)
} So I have Could you help me solve my problem? Pe@cE |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Emojis uploaded to a guild are called custom emojis. That's it. Once you understand that, you will see your problem—you cannot find Unicode emojis (which you dubbed as "original discord emojis") in a guild as they are not custom emojis. They simply exist universally and you do not need to do anything special to get them. Copy Irrelevant to your issue: guild onboarding replaces "reaction roles". |
Beta Was this translation helpful? Give feedback.
Emojis uploaded to a guild are called custom emojis. That's it. Once you understand that, you will see your problem—you cannot find Unicode emojis (which you dubbed as "original discord emojis") in a guild as they are not custom emojis. They simply exist universally and you do not need to do anything special to get them. Copy
❌
and place it in your code and ta-da! You have your Unicode emoji.Irrelevant to your issue: guild onboarding replaces "reaction roles".