O-Bot/o-bot.js
Maxwell Gorley 97c0626ed2
Change prefix from '!' to 'o!'
Prefix changed to avoid conflicts with other bots
2020-03-14 11:12:26 -04:00

40 lines
1004 B
JavaScript

const Discord = require('discord.js');
const auth = require('./auth.json');
// Create bot object
const bot = new Discord.Client({autoReconnect:true});
// Display console message when logged in
bot.once('ready', () => {
console.log('Connected');
});
bot.on('message', message => {
// Prefix is '!'
if (message.content.substring(0, 2) == 'o!') {
var args = message.content.substring(2).split(' ');
var cmd = args[0];
args = args.splice(1);
// Commands
switch(cmd) {
// o!ping
case 'ping':
message.channel.send('Pong!');
break;
// o!help
case 'help':
message.channel.send('Commands:\no!help: Display this message\no!ping: Test if bot is alive\no!pi: Make O speak');
break;
// o!pi
case 'pi':
message.channel.send('Pipi? Pipi-pipipipipi!');
break;
// End of command list
}
}
});
bot.login(auth.token);