📌  相关文章
📜  如何制作 discord.js 8 球命令 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:09.136000             🧑  作者: Mango

代码示例1
const Discord = require("discord.js");

module.exports.run = async (bot, message, args) => {

    //!8ball 
    if(!args[2]) return message.reply("Please ask a full question!");
    let replies = ["Yes.", "No.", "I don't know.", "Ask again later"];
    
    let result = Math.floor((Math.random() * replies.length));
    let question = args.slice(1).join(" ");
    
    let ballembed = new Discord.RichEmbed()
    .setAuthor(message.author.tag)
    .setColor("#FF9900")
    .addField("Question", question)
    .addField("Answer", replies[result]);
    
    message.channel.send(ballembed)    
}