【问题标题】:How can I embed the bot's reply? discord.js如何嵌入机器人的回复?不和谐.js
【发布时间】:2021-06-03 02:59:04
【问题描述】:

我做了一个“funnyrate”命令,效果很好。但是我认为如果嵌入机器人的回复会更好看。有人可以帮我让机器人回复嵌入吗?这是代码:

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"
}

【问题讨论】:

标签: discord discord.js


【解决方案1】:

首先如果你不知道如何制作嵌入,你应该访问:https://discord.js.org/#/docs/main/stable/class/MessageEmbed?scrollTo=setTitlelink。 这是 discord.js 嵌入文档页面的链接。

我还没有尝试过,但这应该可以: 祝你有美好的一天!

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"
 }

【讨论】:

    猜你喜欢
    • 2019-04-11
    • 1970-01-01
    • 2020-12-25
    • 2021-01-21
    • 2021-01-13
    • 1970-01-01
    • 2017-10-08
    • 2021-03-28
    • 2019-02-14
    相关资源
    最近更新 更多