Anonymous Anonymous - 3 months ago
229 0

Made a simple bot to get links to http://ephe.github.io/grimoire/spells/

Javascript

Grimoire - Discord Bot

const Discord = require('discord.js');
const bot = new Discord.Client();

let url = "http://ephe.github.io/grimoire/spells/";
let d = "-";
let prefix = "!";
let x = 0


bot.on('ready', () => {
  console.log('I am ready!');
});

bot.on('message', message => {
	
	if (message.content.startsWith(prefix + "spell")) {
		let args = message.content.split(" ").slice(1);
				
			br:if (args[0] !== undefined && args[1] === undefined){
				let s1 = args[0];
				let spell = url.concat(s1);
				message.reply(spell);
							}else {break br;}
					
							
			br2:if (args[1] !== undefined && args[2] === undefined){
				let s1 = args[0];
				let s2 = args[1];
				let spell = url.concat(s1,d,s2);
				message.reply(spell);
		
								}else{break br2;}
	
								
			br3:if (args[2] !== undefined && args[3] === undefined) {
				let s1 = args[0];
				let s2 = args[1];
				let s3 = args[2];
				let spell = url.concat(s1,d,s2,d,s3);
				message.reply(spell);
		
								}else{break br3;}
								
			br4:if (args[3] !== undefined && args[4] === undefined) {
				let s1 = args[0];
				let s2 = args[1];
				let s3 = args[2];
				let s4 = args[3];
				let spell = url.concat(s1,d,s2,d,s3,d,s4);
				message.reply(spell);
		
								}else{break br4;}
			br5:if (args[4] !== undefined && args[5] === undefined) {
				let s1 = args[0];
				let s2 = args[1];
				let s3 = args[2];
				let s4 = args[3];
				let s5 = args[4];
				let spell = url.concat(s1,d,s2,d,s3,d,s4,d,s5);
				message.reply(spell);
		
								}else{break br5;}
}});

bot.login('MjIzODE1MzIxMjg5NDkwNDMy.CrRb5g.c6krjPtOs9ixSkpn6xbYOCVNgGY');