#Discord Js Emojis As options slash commands

131 messages · Page 1 of 1 (latest)

lilac mauve
#

if I have like :sparkling_heart: how I can add this emoji to a reaction?
I want to make reaction roles and to get emoji option for my command.
How can I add it to message? Because It dosen't work with message.react when I pass it :sparkling_heart:

delicate wagon
#

• 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.

digital yacht
#

The emoji must be with an id

glacial prismBOT
#

• 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!

lilac mauve
#

its default emoji

#

of discord

digital yacht
#

So use Unicode emoji

#

Twemoji: 💖
Unicode: \💖 (\:sparkling_heart:)

lilac mauve
#

I tried that didn't work

#

With

digital yacht
lilac mauve
#

When I do

#
message.react("\:name:")
#

It dosen't work and dosen't find the emoji

elder hawk
elder hawk
lilac mauve
#

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?

elder hawk
#

We told you 3 times

#

Use the unicode emoji

lilac mauve
#
message.react( "\:sparkling_heart: (\:sparkling_heart:)")
#

Like this?

lilac mauve
#

This is

digital yacht
lilac mauve
#

With \:emojiname: right?

#

It dosen't work with this on mssage.react

#

*message

digital yacht
#

Copy that Unicode emoji and use it in your code

lilac mauve
#

But I don't get unicode emoju

#

I

#

I get like ❤️

#

Or other emoji

digital yacht
#

\❤️

lilac mauve
#
message.react("\:emojiname:")
#

Like this? @digital yacht

digital yacht
#

How many times I told you to use it in a message content?

lilac mauve
#

But I need this for a reaction

#

Not message content

digital yacht
#

Get an Unicode emoji from a message content and use it in the react

lilac mauve
#

Oh

#

So not from the interaction options right?

#

From the message content of it?

digital yacht
#

What are you trying to do?
Interaction string option returns an Unicode emojis.

lilac mauve
#

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

lilac mauve
#

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:
elder hawk
#

We told you so many times, copy paste the unicode emoji in your code

#

not \:eye:

lilac mauve
#

On reaction roles command

#

Even on big famous bots..

elder hawk
#

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

high pebble
elder hawk
#

^

lilac mauve
#

But what I have at the emoji option value is :emojiname:

high pebble
#

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

lilac mauve
#

Wdym in the second one

high pebble
#

how do the users enter/send the emoji to your interaction?

lilac mauve
#

Slash commans

#

D

#

With options

high pebble
#

a free input StringOption? or with choices?

digital yacht
lilac mauve
#

Oh

#

I didn't use getString

#

Oh

#

Will fix that latwr

#

Later

#

Thanks

high pebble
#

even without getString it shouldn't be :bla: but the unicode character...

#

discord converts those before sending the payload

lilac mauve
#

Wdym

digital yacht
#

Just use Unicode emojis in your code

lilac mauve
#

Okay

lilac mauve
#

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?

lilac mauve
#

it didn'T worked

lilac mauve
#

it showed me string

#

but :emojiname:

#

and not what You sent

#
    console.log(options.getString("emoji"))
#

Even when I do this

#

still :emojiname:

high pebble
lilac mauve
#

As array of arga

#

S

#

Like on the old system

#

Without the slah commands

hot cairn
#

then don't use slash commands

#

if you want to use slash commands, use them like slash commands. it's not hard.

lilac mauve
#

becaus

#

e

#

what discord said

#

@digital yacht so why I get it as :emojiname: while You are getting it as unicode emoji?

lilac mauve
high pebble
lilac mauve
#

just emoji

high pebble
#

That is a what, not a how

lilac mauve
#

wdym