khaled motasem
khaled motasem

Reputation: 23

How can I embed the bot's reply? discord.js

I made a "funnyrate" command that is working perfectly fine. However I think it would look better if the bot's reply is embedded. may someone help me make the bots reply embedded? here is the code:

module.exports.run = async (bot, message, args) => {
  var rating = Math.floor(Math.random() * 100) + 1;
  var mentionedMember = message.mentions.members.first();

  if (!mentionedMember) return message.reply(`according to my calculations, you are ${rating}% funny😂`);
  return message.channel.send(`${mentionedMember}, according to my calculations, you are ${rating}% funny😂`);
}

module.exports.help = {
name:"funnyrate"
}

Upvotes: 1

Views: 5616

Answers (1)

user15215695
user15215695

Reputation:

firstly if you don't know how to make embeds,you should visit: https://discord.js.org/#/docs/main/stable/class/MessageEmbed?scrollTo=setTitlelink. This is a link to the discord.js embed documentation page.

I haven't tried it but this should work: Have a good day!

module.exports.run = async (bot, message, args) => {
   
   var rating = Math.floor(Math.random() * 100) + 1;
 
   if (!args.length) {

      const embed = new MessageEmbed()
      .setColor("RANDOM")
      .setDescription(`according to my calculations, you are ${rating}% funny😂`)
      
      return message.channel.send(embed);
   } else {

      const embed = new MessageEmbed()
      .setColor("RANDOM")
      .setDescription(`${mentionedMember}, according to my calculations, you are ${rating}% funny😂`)
     
      return message.channel.send(embed);
   }}
 
 module.exports.help = {
 name:"funnyrate"
 }

Upvotes: 2

Related Questions