fix alias and add swtiching playing game #15

Closed
MSFTserver wants to merge 1 commit from patch-4 into master

View file

@ -9,7 +9,10 @@ config = config.get('bot');
var aliases; var aliases;
try { try {
aliases = require('./alias.json'); aliases = require('./alias.json');
console.log('aliases')
console.log(aliases)
} catch (e) { } catch (e) {
console.log('No aliases defined')
//No aliases defined //No aliases defined
aliases = { aliases = {
test: { test: {
@ -27,7 +30,18 @@ bot.on('ready', function() {
console.log('Logged in! Serving in ' + bot.guilds.array().length + ' servers'); console.log('Logged in! Serving in ' + bot.guilds.array().length + ' servers');
require('./plugins.js').init(); require('./plugins.js').init();
console.log('type ' + config.prefix + 'help in Discord for a commands list.'); console.log('type ' + config.prefix + 'help in Discord for a commands list.');
bot.user.setGame(config.prefix + 'tip'); bot.user.setActivity(config.prefix + 'Intialized!');
var text = ['tip', 'multitip', 'roletip'];
var counter = 0;
setInterval(change, 10000);
function change() {
bot.user.setActivity(config.prefix + text[counter]);
counter++;
if (counter >= text.length) {
counter = 0;
}
}
}); });
bot.on('disconnected', function() { bot.on('disconnected', function() {
@ -53,7 +67,7 @@ function checkMessageForCommand(msg, isEdit) {
} }
let alias = aliases[cmdTxt]; let alias = aliases[cmdTxt];
if (alias) { if (alias) {
var cmd = alias; var cmd = commands[alias];
} else { } else {
var cmd = commands[cmdTxt]; var cmd = commands[cmdTxt];
} }