如何嵌入机器人的回复?不和谐.js

时间:2021-06-02 17:30:44

标签: discord discord.js

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

version: '3.7'
services:
  mongodb:
    image: mongo:latest
    restart: always
    logging:
      driver: local
    environment:
      MONGO_INITDB_ROOT_USERNAME: ${DB_ADMIN_USERNAME}
      MONGO_INITDB_ROOT_PASSWORD: ${DB_ADMIN_PASSWORD}
    ports:
      - 27017:27017
    volumes:
      - mongodb_data:/data/db
  callingapp:
    image: <some-img>
    restart: always
    logging:
      driver: local
    env_file:
      - callingApp.env
    ports:
      - ${CALLING_APP_PORT}:${CALLING_APP_PORT}
    depends_on:
      - mongodb
    network_mode: host // << Add this line
  app:
    image: <another-img>
    restart: always
    logging:
      driver: local
    depends_on:
      - mongodb
    env_file:
      - app.env
    ports:
      - ${APP_PORT}:${APP_PORT}

volumes:
  mongodb_data:

1 个答案:

答案 0 :(得分:0)

首先,如果您不知道如何制作嵌入,您应该访问: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"
 }