From d8ecd170b20296fa624195371ce6678d72b95d7e Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 23 Feb 2018 13:10:45 -0500 Subject: Useful help command --- bot.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/bot.js b/bot.js index cf97232..7657c30 100644 --- a/bot.js +++ b/bot.js @@ -2,4 +2,30 @@ const Discord = require('discord.js'); const bot = new Discord.Client(); const config = require('./config.json'); +bot.on('ready', () => { + console.log('PokeBot has finished loading.'); +}); + +bot.on('message', (msg) => { + parseCommand(msg); +}); + +function parseCommand(msg) { + if (msg.author.bot) return; + if (!msg.content.startsWith('p:')) return; + + const args = msg.content.slice(2).split(' '); + const command = args.shift(); + + switch (command) + { + case 'help': + msg.channel.send( + new Discord.RichEmbed() + .setColor (0x00ae86) + .addField('Getting Started |', '**p:help** | Displays this help message') + ); + break; + } +} bot.login(config.token); -- cgit v1.2.3