簡體   English   中英

我目前正在嘗試使用 discord.js 編寫一個船舶代碼,但我無法讓它工作

[英]I am currently trying to write a ship code with discord.js but i can't get it to work

當我在 Visual Studio Code 上運行機器人並且它正常運行時,所有其他命令,但是當我嘗試運行這個 ship 命令時沒有任何反應,我的機器人沒有發送任何內容並且 VS Code 沒有向我發送任何錯誤。

const Discord = require('discord.js');
require('discord-reply');
const getMember = require('functions.js')
const bot = new Discord.Client();

bot.on('ready', () => {
    console.log('hello mother')
    bot.user.setActivity('bia info')
});

module.exports.run = async (bot, message, args, prefix) => {
bot.on('message', (message) => {
    if (message.content == 'bia ship') { 
  let user = message.mentions.users.first()
  let RN = Math.floor(Math.random() * 100) 

  const UnLoveEmbed = new Discord.MessageEmbed()
  .setColor('#A14EFF')
  .setTitle('Uhm.. There is not a match. 💔 😭')
  .setDescription(`'${message.author} shipped with ${user} gives ${RN}%'`)


  const LoveEmbed = new Discord.MessageEmbed()
  .setColor('#A14EFF')
  .setTitle('Looks like we have a couple here! 💖 😍')
  .setDescription(`${message.author} shipped with ${user} gives ${RN}%`)


    if (RN > 50) {
    message.channel.send(LoveEmbed)
  } else {
    if (RN < 50) {
      message.channel.send(UnLoveEmbed)
    }
  }
}}
)};

我相信在 DiscordJS v13 中,您必須指定要發送這樣的嵌入:

channel.send({ embeds: [ExampleEmbed] });

所以在你的情況下:

message.channel.send({ embeds: [LoveEmbed] });
//In stead of:
message.channel.send(LoveEmbed);

來源

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM