blob: 469137b54096a3b245863c195aedae3e5002ff88 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
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('guildMemberAdd', (member) => {
const role = member.guild.roles.find('name', 'Trainers');
member.addRole(role);
});
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);
|