Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to make a discord.js 8 ball command

const Discord = require("discord.js");

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

	//!8ball <question fjdksf>
	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)	
}
Source by # #
 
PREVIOUS NEXT
Tagged: #ball #command
ADD COMMENT
Topic
Name
6+6 =