#Discord Js Emojis As options slash commands
131 messages · Page 1 of 1 (latest)
• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.
The emoji must be with an id
• Custom emojis: \:name: ➞ <a:name:id>
• Twemojis: \:name: ➞ unicode representation
• Emoji picker: WIN + . / CMD + CTRL + SPACE / CTRL + .
• Right-clicking any emoji will not copy its id!
What is that before the (
I tried that didn't work
With
The way to get Unicode emoji in a message content
.
Still don't get it
When I do
message.react("\:name:")
It dosen't work and dosen't find the emoji
Put \:emojiname: here, in discord. Then copy paste that into the string
Like they showed here
But I want to make
Reaction role command
And I have something like :emojiname:
Or
<a:name:id>
For the customs its easy
But how I make it with the default ones?
This what he said here
This is
I showed you how to get a Unicode emoji. The same described in the tag.
With that you're getting an Unicode emoji in a message content.
Like \🎉
Copy that Unicode emoji and use it in your code
We have already told you how to get it. Put \ before the emoji.
\❤️
How many times I told you to use it in a message content?
Get an Unicode emoji from a message content and use it in the react
What are you trying to do?
Interaction string option returns an Unicode emojis.
Reaction role command
I used string option the value was something elsw
E
Oh I know maybe there is other property
On the option object for this
Because the value was like :emojiname: with the string option
{ name: 'emoji', type: 3, value: '👁️' },
{ name: 'emoji', type: 3, value: ':eye:' },
this is the option object
[
{
name: 'channel',
type: 7,
value: '1048301149918330974',
channel: TextChannel {
type: 0,
guild: [Guild],
guildId: '1048301149918330971',
parentId: '1048301149918330972',
permissionOverwrites: [PermissionOverwriteManager],
messages: [MessageManager],
threads: [GuildTextThreadManager],
nsfw: false,
flags: [ChannelFlagsBitField],
id: '1048301149918330974',
name: 'general',
rawPosition: 0,
topic: null,
lastMessageId: '1048517089318686760',
rateLimitPerUser: 0
}
},
{ name: 'message', type: 3, value: '1048516996913967154' },
{ name: 'emoji', type: 3, value: ':eye:' },
{
name: 'role',
type: 8,
value: '1048301149918330971',
role: Role {
guild: [Guild],
icon: null,
unicodeEmoji: null,
id: '1048301149918330971',
name: '@everyone',
color: 0,
hoist: false,
rawPosition: 0,
permissions: [PermissionsBitField],
managed: false,
mentionable: false,
tags: null
}
}
]
@digital yacht this is what I get
What about thiss
I found this
const name = require("emoji-name-map");
console.log(name.get("heart_eyes"));
// :heart_eyes:
console.log(name.get(":heart_eyes:"));
// :heart_eyes:
The value should be \👁️ not 👁️
We told you so many times, copy paste the unicode emoji in your code
not \:eye:
But this is what user uses
On reaction roles command
Even on big famous bots..
What is the problem...
Use the unicode emoji and you're done
All you need to do is put \:emoji_name: in here and copy paste it in your code
message.react('💖') will literally add the 💖 reaction to that message
^
But what I have at the emoji option value is :emojiname:
Then either make a map of those emojis you have in those choices to their unicode equivalent or add the unicode to the choice as value but the :bla: as name
Wdym in the second one
how do the users enter/send the emoji to your interaction?
a free input StringOption? or with choices?
Are you sure?
even without getString it shouldn't be :bla: but the unicode character...
discord converts those before sending the payload
Wdym
Just use Unicode emojis in your code
Okay
I have two questions
const args = optionsData.map(option => {
switch (option.type) {
case ApplicationCommandOptionType.Attachment:
return options.getAttachment(option.name);
case ApplicationCommandOptionType.Boolean:
return options.getBoolean(option.name);
case ApplicationCommandOptionType.Channel:
return options.getChannel(option.name);
case ApplicationCommandOptionType.Integer:
return options.getInteger(option.name);
case ApplicationCommandOptionType.Mentionable:
return options.getMentionable(option.name);
case ApplicationCommandOptionType.Number:
return options.getNumber(option.name);
case ApplicationCommandOptionType.Role:
return options.getRole(option.name);
case ApplicationCommandOptionType.String:
return options.getString(option.name);
case ApplicationCommandOptionType.Subcommand:
return options.getSubcommand(option.name);
case ApplicationCommandOptionType.SubcommandGroup:
return options.getSubcommandGroup(option.name);
case ApplicationCommandOptionType.User:
return options.getUser(option.name);
}
});
Is there is a another way to do it?
this is what I DID
it showed me string
but :emojiname:
and not what You sent
console.log(options.getString("emoji"))
Even when I do this
still :emojiname:
Yes there is. Pass the interaction to your command and have it get the exact options it has when handling, instead of downgrading your typesafety to arbitrary values.
But I want it like this
As array of arga
S
Like on the old system
Without the slah commands
then don't use slash commands
if you want to use slash commands, use them like slash commands. it's not hard.
can't
becaus
e
what discord said
@digital yacht so why I get it as :emojiname: while You are getting it as unicode emoji?
which this I am still getting :emojiname:
How does the user enter the emoji into that option?
just emoji
That is a what, not a how
wdym