0
votes

I'm working on a bot in Discord.js. It should listen for its command being used, delete the message with the command, and post in a separate channel the command message's args.

For example, if I sent the bot -say Stack Overflow is a good place to get help it will post in the channel #said-and-repeated 'Stack Overflow is a good place to get help'. The problem is it needs to react with two emojis so the users can vote whether it's a good tip or not.


Code:

var textToEcho = args.join(" ");
        if(args.length === 0){
            message.reply('you need to add a `message` to use this command!!');
        } else {
            message.delete();
            Client.channels.cache.get('where it will send the message').send(textToEcho).then(message => {
                message.react("emoji");
                message.react("emoji");
            }
        }

But this doesn't work, and I can't see what's wrong with it. I know that custom emojis need to be written slightly differently, but the bot only reacts with two default emojis: the check and the cross.

1
I still cant understand what's the problem. is it not reacting with the custom emoji? please state the error.Radnerus
Do you have the actual unicode emoji instead of emoji?PerplexingParadox
The emoji's are unicode, but that is irrelevant, I know that I need to use the ID if it's custom @PerplexingParadoxCKStudios2018

1 Answers

0
votes

Reacting in Discord.js is completely different from sending emojis.

To react with local emoji:-

message.react("🕑")

// Don't use emoji name, use emoji symbol instead.

To react with custom emoji:-

message.react("emojiID here")

Also you said, you want to react to bot's message. So this thing is correct but, you are instructing to react to user's message i.e. *message*.react.

Here what you need is, this:-

//We declare that botMessage is bot's message send to channel

 let botMessage = await Client.channels.cache.get('where it will send the message').send(textToEcho).then{

   // We react here...
  await botMessage.react('emojiID or symbol');
  await botMessage.react('emojiID or symbol');

}

If you need any other help, tell me in comment and ping me.