Search
 
SCRIPT & CODE EXAMPLE
 

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)	
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: js inner text 
Javascript :: click on child prevent click on parent 
Javascript :: get specific item from local storage 
Javascript :: how to make chart js from zero 
Javascript :: hide warnings in expo app 
Javascript :: multi stage node js dockerfile 
Javascript :: fill all field of object in js 
Javascript :: canvas change line color 
Javascript :: Node Sass version 6.0.0 is incompatible with ^4.0.0 || ^5.0.0 
Javascript :: how 2 subtract 2 dates using moment.js 
Javascript :: chartjs line disable shadow 
Javascript :: generate random brightest color 
Javascript :: javascript dom last child 
Javascript :: how to get element position in jquery 
Javascript :: jquery slideup 
Javascript :: js add to local storage 
Javascript :: vue call method after delay 
Javascript :: vue js get width of element 
Javascript :: javascript auto save input 
Javascript :: how long old upvc 
Javascript :: get api call in jquery 
Javascript :: keyboard dismiss in react native 
Javascript :: find unique elements in array javascript 
Javascript :: create link and click javascript 
Javascript :: javascript check if object is object 
Javascript :: javascript text to speech 
Javascript :: input pattern for no whitespaces at the end or beginning 
Javascript :: javascript run function once 
Javascript :: your mom is your dad 
Javascript :: js distance from top 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =