NewJS
NewJS

Reputation: 55

How to use message.react with embed - Discord.js V13

I want to react to a user's message after sending a command. I tried changing the position of the code, but it's not working.

let channel = message.member.voice.channel;

if (!channel) {

 // This Code was working without using embeds.
 // message.reply(`>>> Please join a voice channel`) && message.react('🙄')


  return message.reply({
    embeds: [
      new MessageEmbed()
        .setColor('#FFA400')
        .setDescription(`>>> Please join a voice channel`)
        // .message.react('🙄')
        .setFooter(
          `Hey ${message.author.username}`,
          message.author.displayAvatarURL({ dynamic: true })
        ),
    ],
  });
}

Upvotes: 2

Views: 95

Answers (1)

MrMythical
MrMythical

Reputation: 9041

Message.react and Message.reply are separate methods. Make sure to put it before your return statement!

if (!channel) {
  message.react('🙄')
  return message.reply({
    embeds: [
      new MessageEmbed()
        .setColor('#FFA400')
        .setDescription(`>>> Please join a voice channel`)
        .setFooter(
          `Hey ${message.author.username}`,
          message.author.displayAvatarURL({ dynamic: true })
        ),
    ],
  });
}

Upvotes: 1

Related Questions