forked from GitHub/dbot
Merge branch 'master' of github.com:reality/depressionbot into jsbot0.2compat
This commit is contained in:
commit
43147af804
@ -25,7 +25,7 @@ var adminCommands = function(dbot) {
|
|||||||
|
|
||||||
child = exec("git pull", function (error, stdout, stderr) {
|
child = exec("git pull", function (error, stdout, stderr) {
|
||||||
console.log(stderr);
|
console.log(stderr);
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].gpull);
|
dbot.say(data.channel, dbot.t('gpull'));
|
||||||
commands.reload(data, params);
|
commands.reload(data, params);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
@ -34,7 +34,7 @@ var adminCommands = function(dbot) {
|
|||||||
dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8'));
|
dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8'));
|
||||||
dbot.strings = JSON.parse(fs.readFileSync('strings.json', 'utf-8'));
|
dbot.strings = JSON.parse(fs.readFileSync('strings.json', 'utf-8'));
|
||||||
dbot.reloadModules();
|
dbot.reloadModules();
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].reload);
|
dbot.say(data.channel, dbot.t('reload'));
|
||||||
},
|
},
|
||||||
|
|
||||||
'say': function(data, params) {
|
'say': function(data, params) {
|
||||||
@ -60,7 +60,7 @@ var adminCommands = function(dbot) {
|
|||||||
'load': function(data, params) {
|
'load': function(data, params) {
|
||||||
dbot.moduleNames.push(params[1]);
|
dbot.moduleNames.push(params[1]);
|
||||||
dbot.reloadModules();
|
dbot.reloadModules();
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].load_module.format({'moduleName': params[1]}));
|
dbot.say(data.channel, dbot.t('load_module', {'moduleName': params[1]}));
|
||||||
},
|
},
|
||||||
|
|
||||||
'unload': function(data, params) {
|
'unload': function(data, params) {
|
||||||
@ -72,9 +72,9 @@ var adminCommands = function(dbot) {
|
|||||||
dbot.moduleNames.splice(moduleIndex, 1);
|
dbot.moduleNames.splice(moduleIndex, 1);
|
||||||
|
|
||||||
dbot.reloadModules();
|
dbot.reloadModules();
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].unload_module.format({'moduleName': params[1]}));
|
dbot.say(data.channel, dbot.t('unload_module', {'moduleName': params[1]}));
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].unload_error.format({'moduleName': params[1]}));
|
dbot.say(data.channel, dbot.t('unload_error', {'moduleName': params[1]}));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -84,31 +84,31 @@ var adminCommands = function(dbot) {
|
|||||||
} else {
|
} else {
|
||||||
dbot.db.bans[params[2]] = [ params[1] ];
|
dbot.db.bans[params[2]] = [ params[1] ];
|
||||||
}
|
}
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].banned.format({'user': params[1], 'command': params[2]}));
|
dbot.say(data.channel, dbot.t('banned', {'user': params[1], 'command': params[2]}));
|
||||||
},
|
},
|
||||||
|
|
||||||
'unban': function(data, params) {
|
'unban': function(data, params) {
|
||||||
if(dbot.db.bans.hasOwnProperty(params[2]) && dbot.db.bans[params[2]].include(params[1])) {
|
if(dbot.db.bans.hasOwnProperty(params[2]) && dbot.db.bans[params[2]].include(params[1])) {
|
||||||
dbot.db.bans[params[2]].splice(dbot.db.bans[params[2]].indexOf(params[1]), 1);
|
dbot.db.bans[params[2]].splice(dbot.db.bans[params[2]].indexOf(params[1]), 1);
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].unbanned.format({'user': params[1], 'command': params[2]}));
|
dbot.say(data.channel, dbot.t('unbanned', {'user': params[1], 'command': params[2]}));
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].unban_error.format({'user': params[1]}));
|
dbot.say(data.channel, dbot.t('unban_error', {'user': params[1]}));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'modehate': function(data, params) {
|
'modehate': function(data, params) {
|
||||||
dbot.db.modehate.push(params[1]);
|
dbot.db.modehate.push(params[1]);
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].modehate.format({'user': params[1]}));
|
dbot.say(data.channel, dbot.t('modehate', {'user': params[1]}));
|
||||||
},
|
},
|
||||||
|
|
||||||
'unmodehate': function(data, params) {
|
'unmodehate': function(data, params) {
|
||||||
dbot.db.modehate.splice(dbot.db.modehate.indexOf(params[1]), 1);
|
dbot.db.modehate.splice(dbot.db.modehate.indexOf(params[1]), 1);
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].unmodehate.format({'user': params[1]}));
|
dbot.say(data.channel, dbot.t('unmodehate', {'user': params[1]}));
|
||||||
},
|
},
|
||||||
|
|
||||||
'lock': function(data, params) {
|
'lock': function(data, params) {
|
||||||
dbot.db.locks.push(params[1]);
|
dbot.db.locks.push(params[1]);
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].qlock.format({'category': params[1]}));
|
dbot.say(data.channel, dbot.t('qlock', {'category': params[1]}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ var autoshorten = function(dbot) {
|
|||||||
http.get(options, function(res) {
|
http.get(options, function(res) {
|
||||||
res.setEncoding('utf8');
|
res.setEncoding('utf8');
|
||||||
res.on('data', function (response) {
|
res.on('data', function (response) {
|
||||||
dbot.say(data.channel, 'Shortened link from ' + data.user + ': ' + JSON.parse(response).surl);
|
dbot.say(data.channel, dbot.t('shorten_link', {'user': data.user}) + JSON.parse(response).surl);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -12,21 +12,10 @@ var badwords = function(dbot) {
|
|||||||
data.channel = '#42';
|
data.channel = '#42';
|
||||||
badWordLock = true;
|
badWordLock = true;
|
||||||
|
|
||||||
dbot.sessionData.badwords.finished = false;
|
dbot.sessionData.badwords.waiting = true;
|
||||||
|
|
||||||
dbot.say('bots', 'badwords ' + data.channel + ' list');
|
dbot.say('bots', 'badwords ' + data.channel + ' list');
|
||||||
dbot.instance.addListener('PRIVMSG', function(data) {
|
dbot.instance.addListener('PRIVMSG',
|
||||||
if(data.channel === 'bots') {
|
|
||||||
if(data.message.indexOf('bad words list is empty') != -1) {
|
|
||||||
dbot.sessionData.badwords.count = 0;
|
|
||||||
dbot.sessionData.badwords.finished = true;
|
|
||||||
} else {
|
|
||||||
var wordMatch = data.message.valMatch(/\w([1-10])\w(.*)/, 2);
|
|
||||||
dbot.say('reality', wordMatch[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dbot.sessionData.badwords = {};
|
dbot.sessionData.badwords = {};
|
||||||
badWordLock = false;
|
badWordLock = false;
|
||||||
}
|
}
|
||||||
@ -42,6 +31,20 @@ var badwords = function(dbot) {
|
|||||||
return commands;
|
return commands;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'listener': function(data) {
|
||||||
|
if(data.channel === 'bots') {
|
||||||
|
if(data.message.indexOf('bad words list is empty') != -1) {
|
||||||
|
dbot.sessionData.badwords.count = 0;
|
||||||
|
dbot.sessionData.badwords.finished = true;
|
||||||
|
} else {
|
||||||
|
var wordMatch = data.message.valMatch(/\w([1-10])\w(.*)/, 2);
|
||||||
|
dbot.say('reality', wordMatch[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
'on': 'PRIVMSG',
|
||||||
|
|
||||||
'name': name,
|
'name': name,
|
||||||
|
|
||||||
'ignorable': true
|
'ignorable': true
|
||||||
|
@ -14,14 +14,9 @@ var command = function(dbot) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var usageString = 'Usage: ~ignore [module]. Modules you can ignore are: ';
|
|
||||||
for(var i=0;i<ignorableModules.length;i++) {
|
|
||||||
usageString += ignorableModules[i] + ", ";
|
|
||||||
}
|
|
||||||
usageString = usageString.slice(0, -2) + '.';
|
|
||||||
|
|
||||||
if(params[1] == undefined) {
|
if(params[1] == undefined) {
|
||||||
dbot.say(data.channel, data.user + ': ' + usageString);
|
dbot.say(data.channel,
|
||||||
|
dbot.t('ignore_usage', {'user': data.user, 'modules': ignorableModules.join(', ')}));
|
||||||
} else {
|
} else {
|
||||||
if(dbot.moduleNames.include(params[1])) {
|
if(dbot.moduleNames.include(params[1])) {
|
||||||
if(!dbot.db.ignores.hasOwnProperty(data.user)) {
|
if(!dbot.db.ignores.hasOwnProperty(data.user)) {
|
||||||
@ -29,14 +24,13 @@ var command = function(dbot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(dbot.db.ignores[data.user].include(params[1])) {
|
if(dbot.db.ignores[data.user].include(params[1])) {
|
||||||
dbot.say(data.channel, data.user + ': You\'re already ignoring that module.');
|
dbot.say(data.channel, dbot.t('already_ignoring', {'user': data.user}));
|
||||||
} else {
|
} else {
|
||||||
dbot.db.ignores[data.user].push(params[1]);
|
dbot.db.ignores[data.user].push(params[1]);
|
||||||
dbot.say(data.channel, data.user + ': Now ignoring ' + params[1]);
|
dbot.say(data.channel, dbot.t('ignored', {'user': data.user, 'module': params[1]}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, data.user + ': That isn\'t a valid module name. ' +
|
dbot.say(data.channel, dbot.t('invalid_ignore', {'user': data.user}));
|
||||||
usageString);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -47,25 +41,15 @@ var command = function(dbot) {
|
|||||||
ignoredModules = dbot.db.ignores[data.user];
|
ignoredModules = dbot.db.ignores[data.user];
|
||||||
}
|
}
|
||||||
|
|
||||||
var usageString = 'Usage: ~unignore [module]. Modules you are currently ignoring: ';
|
|
||||||
if(ignoredModules.length == 0) {
|
|
||||||
usageString += 'None.';
|
|
||||||
} else {
|
|
||||||
for(var i=0;i<ignoredModules.length;i++) {
|
|
||||||
usageString += ignoredModules[i] + ", ";
|
|
||||||
}
|
|
||||||
usageString = usageString.slice(0, -2) + '.';
|
|
||||||
}
|
|
||||||
|
|
||||||
if(params[1] == undefined) {
|
if(params[1] == undefined) {
|
||||||
dbot.say(data.channel, data.user + ': ' + usageString);
|
dbot.say(data.channel,
|
||||||
|
dbot.t('unignore_usage', {'user': data.user, 'modules': ignoredModules.join(', ')}));
|
||||||
} else {
|
} else {
|
||||||
if(ignoredModules.include(params[1]) == false) {
|
if(ignoredModules.include(params[1]) == false) {
|
||||||
dbot.say(data.channel, data.user +
|
dbot.say(data.channel, dbot.t('invalid_unignore', {'user': data.user}));
|
||||||
': You\'re not ignoring that module or it doesn\'t exist. ' + usageString);
|
|
||||||
} else {
|
} else {
|
||||||
dbot.db.ignores[data.user].splice(dbot.db.ignores[data.user].indexOf(params[1]), 1);
|
dbot.db.ignores[data.user].splice(dbot.db.ignores[data.user].indexOf(params[1]), 1);
|
||||||
dbot.say(data.channel, data.user + ': No longer ignoring ' + params[1]);
|
dbot.say(data.channel, dbot.t('unignored', {'user': data.user, 'module': params[1]}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,8 +63,7 @@ var command = function(dbot) {
|
|||||||
if(dbot.commands.hasOwnProperty(params[0])) {
|
if(dbot.commands.hasOwnProperty(params[0])) {
|
||||||
if((dbot.db.bans.hasOwnProperty(params[0]) &&
|
if((dbot.db.bans.hasOwnProperty(params[0]) &&
|
||||||
dbot.db.bans[params[0]].include(data.user)) || dbot.db.bans['*'].include(data.user)) {
|
dbot.db.bans[params[0]].include(data.user)) || dbot.db.bans['*'].include(data.user)) {
|
||||||
dbot.say(data.channel, data.user +
|
dbot.say(data.channel, dbot.t('command_ban', {'user': data.user}));
|
||||||
' is banned from using this command. Commence incineration.');
|
|
||||||
} else {
|
} else {
|
||||||
var commandBelongsTo = dbot.commandMap[params[0]];
|
var commandBelongsTo = dbot.commandMap[params[0]];
|
||||||
if(dbot.db.ignores.hasOwnProperty(data.user) &&
|
if(dbot.db.ignores.hasOwnProperty(data.user) &&
|
||||||
@ -95,8 +78,7 @@ var command = function(dbot) {
|
|||||||
var q = data.message.valMatch(/^~([\d\w\s-]*)/, 2);
|
var q = data.message.valMatch(/^~([\d\w\s-]*)/, 2);
|
||||||
if(q) {
|
if(q) {
|
||||||
if(dbot.db.bans['*'].include(data.user)) {
|
if(dbot.db.bans['*'].include(data.user)) {
|
||||||
dbot.say(data.channel, data.user +
|
dbot.say(data.channel, dbot.t('command_ban', {'user': data.user}));
|
||||||
' is banned from using this command. Commence incineration.');
|
|
||||||
} else {
|
} else {
|
||||||
q[1] = q[1].trim();
|
q[1] = q[1].trim();
|
||||||
key = dbot.cleanNick(q[1])
|
key = dbot.cleanNick(q[1])
|
||||||
@ -123,7 +105,7 @@ var command = function(dbot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(winnerDistance < 3) {
|
if(winnerDistance < 3) {
|
||||||
dbot.say(data.channel, 'Did you mean ' + winner + '? Learn to type, hippie!');
|
dbot.say(data.channel, dbot.t('command_typo', {'command': winner}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ var kick = function(dbot) {
|
|||||||
var kicked = dbot.db.kickers[params[1]];
|
var kicked = dbot.db.kickers[params[1]];
|
||||||
}
|
}
|
||||||
|
|
||||||
dbot.say(data.channel, params[1] + ' has been kicked ' + kicks + ' times and has kicked people ' + kicked + ' times.');
|
dbot.say(data.channel, dbot.t('user_kicks', {'user': params[1], 'kicks': kicks, 'kicked': kicked}));
|
||||||
},
|
},
|
||||||
|
|
||||||
// Output a list of the people who have been kicked the most and those
|
// Output a list of the people who have been kicked the most and those
|
||||||
@ -52,7 +52,7 @@ var kick = function(dbot) {
|
|||||||
'listener': function(data) {
|
'listener': function(data) {
|
||||||
if(data.kickee == dbot.name) {
|
if(data.kickee == dbot.name) {
|
||||||
dbot.instance.join(data.channel);
|
dbot.instance.join(data.channel);
|
||||||
dbot.say(data.channel, 'Thou shalt not kick ' + dbot.name);
|
dbot.say(data.channel, dbot.t('kicked_dbot', {'botname': dbot.name}));
|
||||||
dbot.db.kicks[dbot.name] += 1;
|
dbot.db.kicks[dbot.name] += 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -78,7 +78,9 @@ var kick = function(dbot) {
|
|||||||
dbot.db.kickers[data.user] += 1;
|
dbot.db.kickers[data.user] += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbot.say(data.channel, data.kickee + '-- (' + data.kickee + ' has been kicked ' + dbot.db.kicks[data.kickee] + ' times)');
|
dbot.say(data.channel, data.kickee + '-- (' +
|
||||||
|
dbot.t('user_kicks', {'user': data.kickee, 'kicks': dbot.db.kicks[data.kickee],
|
||||||
|
'kicked': dbot.db.kickers[data.kickee]}) + ')');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ var quotes = function(dbot) {
|
|||||||
if(quotes.hasOwnProperty(key)) {
|
if(quotes.hasOwnProperty(key)) {
|
||||||
dbot.say(data.channel, q[1] + ': ' + interpolatedQuote(key));
|
dbot.say(data.channel, q[1] + ': ' + interpolatedQuote(key));
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].category_not_found.format({'category': q[1]}));
|
dbot.say(data.channel, dbot.t('category_not_found', {'category': q[1]}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -71,7 +71,7 @@ var quotes = function(dbot) {
|
|||||||
qSizes = qSizes.sort(function(a, b) { return a[1] - b[1]; });
|
qSizes = qSizes.sort(function(a, b) { return a[1] - b[1]; });
|
||||||
qSizes = qSizes.slice(qSizes.length - 10).reverse();
|
qSizes = qSizes.slice(qSizes.length - 10).reverse();
|
||||||
|
|
||||||
var qString = dbot.strings[dbot.language].large_categories;
|
var qString = dbot.t('large_categories');
|
||||||
|
|
||||||
for(var i=0;i<qSizes.length;i++) {
|
for(var i=0;i<qSizes.length;i++) {
|
||||||
qString += qSizes[i][0] + " (" + qSizes[i][1] + "), ";
|
qString += qSizes[i][0] + " (" + qSizes[i][1] + "), ";
|
||||||
@ -82,12 +82,12 @@ var quotes = function(dbot) {
|
|||||||
|
|
||||||
'~qsearch': function(data, params) {
|
'~qsearch': function(data, params) {
|
||||||
if(params[2] === undefined) {
|
if(params[2] === undefined) {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].syntax_error);
|
dbot.say(data.channel, dbot.t('syntax_error'));
|
||||||
} else {
|
} else {
|
||||||
params[1].trim();
|
params[1].trim();
|
||||||
key = params[1].toLowerCase();
|
key = params[1].toLowerCase();
|
||||||
if(!quotes.hasOwnProperty(key)) {
|
if(!quotes.hasOwnProperty(key)) {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].empty_category);
|
dbot.say(data.channel, dbot.t('empty_category'));
|
||||||
} else {
|
} else {
|
||||||
var matches = [];
|
var matches = [];
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ var quotes = function(dbot) {
|
|||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
if(matches.length == 0) {
|
if(matches.length == 0) {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].no_results);
|
dbot.say(data.channel, dbot.t('no_results'));
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, params[1] + ' (' + params[2] + '): ' + matches.random() + ' [' + matches.length + ' results]');
|
dbot.say(data.channel, params[1] + ' (' + params[2] + '): ' + matches.random() + ' [' + matches.length + ' results]');
|
||||||
}
|
}
|
||||||
@ -120,12 +120,12 @@ var quotes = function(dbot) {
|
|||||||
}
|
}
|
||||||
rmAllowed = false;
|
rmAllowed = false;
|
||||||
dbot.say(data.channel, '\'' + quote + '\'' +
|
dbot.say(data.channel, '\'' + quote + '\'' +
|
||||||
dbot.strings[dbot.language].removed_from + q[1]);
|
dbot.t('removed_from') + q[1]);
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].locked_category.format({'category': q[1]}));
|
dbot.say(data.channel, dbot.t('locked_category', {'category': q[1]}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].no_quotes.format({'category': q[1]}));
|
dbot.say(data.channel, dbot.t('no_quotes', {'category': q[1]}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var last = addStack.pop();
|
var last = addStack.pop();
|
||||||
@ -133,16 +133,16 @@ var quotes = function(dbot) {
|
|||||||
if(!dbot.db.locks.include(last)) {
|
if(!dbot.db.locks.include(last)) {
|
||||||
quotes[last].pop();
|
quotes[last].pop();
|
||||||
rmAllowed = false;
|
rmAllowed = false;
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].last_removed.format({'category': last}));
|
dbot.say(data.channel, dbot.t('last_removed', {'category': last}));
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].locked_category.format({'category': last}));
|
dbot.say(data.channel, dbot.t('locked_category', {'category': last}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].no_recent_adds);
|
dbot.say(data.channel, dbot.t('no_recent_adds'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].rmlast_spam);
|
dbot.say(data.channel, dbot.t('rmlast_spam'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -159,21 +159,21 @@ var quotes = function(dbot) {
|
|||||||
delete quotes[q[1]];
|
delete quotes[q[1]];
|
||||||
}
|
}
|
||||||
rmAllowed = false;
|
rmAllowed = false;
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].removed_from.format({'category': q[1], 'quote': q[2]}));
|
dbot.say(data.channel, dbot.t('removed_from', {'category': q[1], 'quote': q[2]}));
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].q_not_exist_under.format({'category': q[1], 'quote': q[2]}));
|
dbot.say(data.channel, dbot.t('q_not_exist_under', {'category': q[1], 'quote': q[2]}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].locked_category.format({'category': q[1]}));
|
dbot.say(data.channel, dbot.t('locked_category', {'category': q[1]}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].no_quotes.format({'category': q[1]}));
|
dbot.say(data.channel, dbot.t('no_quotes', {'category': q[1]}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].syntax_error);
|
dbot.say(data.channel, dbot.t('syntax_error'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].rmlast_spam);
|
dbot.say(data.channel, dbot.t('rmlast_spam'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -183,16 +183,16 @@ var quotes = function(dbot) {
|
|||||||
q[1] = q[1].trim();
|
q[1] = q[1].trim();
|
||||||
key = q[1].toLowerCase();
|
key = q[1].toLowerCase();
|
||||||
if(quotes.hasOwnProperty(key)) {
|
if(quotes.hasOwnProperty(key)) {
|
||||||
dbot.say(data.channel, q[1] + ' has ' + quotes[key].length + ' quotes.');
|
dbot.say(data.channel, dbot.t('quote_count', {'category': q[1], 'count': quotes[key].length}));
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'No quotes under ' + q[1]);
|
dbot.say(data.channel, dbot.t('no_quotes', {'category': q[1]}));
|
||||||
}
|
}
|
||||||
} else { // Give total quote count
|
} else { // Give total quote count
|
||||||
var totalQuoteCount = 0;
|
var totalQuoteCount = 0;
|
||||||
for(var category in quotes) {
|
for(var category in quotes) {
|
||||||
totalQuoteCount += category.length;
|
totalQuoteCount += category.length;
|
||||||
}
|
}
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].total_quotes.format({'count': totalQuoteCount}));
|
dbot.say(data.channel, dbot.t('total_quotes', {'count': totalQuoteCount}));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -204,16 +204,16 @@ var quotes = function(dbot) {
|
|||||||
quotes[key] = [];
|
quotes[key] = [];
|
||||||
} else {
|
} else {
|
||||||
if (quotes[key].include(q[2])) {
|
if (quotes[key].include(q[2])) {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].quote_exists);
|
dbot.say(data.channel, dbot.t('quote_exists'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
quotes[key].push(q[2]);
|
quotes[key].push(q[2]);
|
||||||
addStack.push(q[1]);
|
addStack.push(q[1]);
|
||||||
rmAllowed = true;
|
rmAllowed = true;
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].quote_saved.format({'category': q[1], 'count': quotes[key].length}));
|
dbot.say(data.channel, dbot.t('quote_saved', {'category': q[1], 'count': quotes[key].length}));
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].syntax_error);
|
dbot.say(data.channel, dbot.t('syntax_error'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -225,9 +225,9 @@ var quotes = function(dbot) {
|
|||||||
if(!quotes.hasOwnProperty(key) || (quotes.hasOwnProperty(key) &&
|
if(!quotes.hasOwnProperty(key) || (quotes.hasOwnProperty(key) &&
|
||||||
quotes[key].length == 1)) {
|
quotes[key].length == 1)) {
|
||||||
quotes[key] = [q[2]];
|
quotes[key] = [q[2]];
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].quote_saved.format({'category': q[1], 'count': 1}));
|
dbot.say(data.channel, dbot.t('quote_saved', {'category': q[1], 'count': 1}));
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].quote_replace);
|
dbot.say(data.channel, dbot.t('quote_replace'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -243,9 +243,10 @@ var quotes = function(dbot) {
|
|||||||
|
|
||||||
'~link': function(data, params) {
|
'~link': function(data, params) {
|
||||||
if(params[1] === undefined || !quotes.hasOwnProperty(params[1].toLowerCase())) {
|
if(params[1] === undefined || !quotes.hasOwnProperty(params[1].toLowerCase())) {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].syntax_error);
|
dbot.say(data.channel, dbot.t('syntax_error'));
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'Link to "'+params[1]+'" - http://nc.no.de:443/quotes/'+params[1]);
|
dbot.say(data.channel, dbot.t('quote_link', {'category': params[1]}) +
|
||||||
|
' - http://nc.no.de:443/quotes/' + params[1]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -260,9 +261,9 @@ var quotes = function(dbot) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(pruned.length > 0) {
|
if(pruned.length > 0) {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].prune.format({'categories': pruned.join(", ")}));
|
dbot.say(data.channel, dbot.t('prune', {'categories': pruned.join(", ")}));
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].no_prune);
|
dbot.say(data.channel, dbot.t('no_prune'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -289,7 +290,7 @@ var quotes = function(dbot) {
|
|||||||
if((dbot.db.bans.hasOwnProperty('~qadd') &&
|
if((dbot.db.bans.hasOwnProperty('~qadd') &&
|
||||||
dbot.db.bans['~qadd'].include(data.user)) ||
|
dbot.db.bans['~qadd'].include(data.user)) ||
|
||||||
dbot.db.bans['*'].include(data.user)) {
|
dbot.db.bans['*'].include(data.user)) {
|
||||||
dbot.say(data.channel, data.user + ' is banned from using this command. Commence incineration.');
|
dbot.say(data.channel, dbot.t('command_ban', {'user': data.user}));
|
||||||
} else {
|
} else {
|
||||||
if(!dbot.db.quoteArrs.hasOwnProperty('realityonce')) {
|
if(!dbot.db.quoteArrs.hasOwnProperty('realityonce')) {
|
||||||
dbot.db.quoteArrs['realityonce'] = [];
|
dbot.db.quoteArrs['realityonce'] = [];
|
||||||
|
@ -45,11 +45,11 @@ var spelling = function(dbot) {
|
|||||||
var otherQ = data.message.valMatch(/^([\d\w\s]*): (?:\*\*?([\d\w\s']*)|([\d\w\s']*)\*\*?)$/, 4);
|
var otherQ = data.message.valMatch(/^([\d\w\s]*): (?:\*\*?([\d\w\s']*)|([\d\w\s']*)\*\*?)$/, 4);
|
||||||
if(q) {
|
if(q) {
|
||||||
correct(data, q[1] || q[2], data.user, function (e) {
|
correct(data, q[1] || q[2], data.user, function (e) {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].spelling_self.format(e));
|
dbot.say(data.channel, dbot.t('spelling_self', e));
|
||||||
});
|
});
|
||||||
} else if(otherQ) {
|
} else if(otherQ) {
|
||||||
correct(data, otherQ[2] || otherQ[3], otherQ[1], function (e) {
|
correct(data, otherQ[2] || otherQ[3], otherQ[1], function (e) {
|
||||||
dbot.say(data.channel, dbot.strings[dbot.language].spelling_other.format(e));
|
dbot.say(data.channel, dbot.t('spelling_other', e));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if(last.hasOwnProperty(data.channel)) {
|
if(last.hasOwnProperty(data.channel)) {
|
||||||
|
10
run.js
10
run.js
@ -93,6 +93,16 @@ DBot.prototype.say = function(channel, data) {
|
|||||||
this.instance.say(channel, data);
|
this.instance.say(channel, data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Format given stored string in config language
|
||||||
|
DBot.prototype.t = function(string, formatData) {
|
||||||
|
var lang = this.language;
|
||||||
|
if(!this.strings[string].hasOwnProperty(lang)) {
|
||||||
|
lang = "english";
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.strings[string][lang].format(formatData);
|
||||||
|
};
|
||||||
|
|
||||||
DBot.prototype.act = function(channel, data) {
|
DBot.prototype.act = function(channel, data) {
|
||||||
this.instance.send('PRIVMSG', channel, ':\001ACTION ' + data + '\001');
|
this.instance.send('PRIVMSG', channel, ':\001ACTION ' + data + '\001');
|
||||||
}
|
}
|
||||||
|
243
strings.json
243
strings.json
@ -1,74 +1,177 @@
|
|||||||
{
|
{
|
||||||
"english": {
|
"syntax_error": {
|
||||||
"syntax_error": "Invalid syntax. Initiate incineration.",
|
"english": "Invalid syntax. Initiate incineration.",
|
||||||
"module_load_error": "Failed to load module: {moduleName}",
|
"spanish": "Sintaxis no válida. Iniciar incineración."
|
||||||
"category_not_found": "Nobody loves {category}",
|
|
||||||
"large_categories": "Largest categories: ",
|
|
||||||
"empty_category": "That category has no quotes in. Commence incineration.",
|
|
||||||
"no_results": "No results found.",
|
|
||||||
"locked_category": "{category} is locked. Commence incineration.",
|
|
||||||
"no_quotes": "No quotes exist under {category}",
|
|
||||||
"last_removed": "Last quote removed from {category}.",
|
|
||||||
"no_recent_adds": "No quotes were added recently.",
|
|
||||||
"rmlast_spam": "No spamming that shit. Try again in a few minutes...",
|
|
||||||
"removed_from": "'{quote}' removed from {category}",
|
|
||||||
"q_not_exist_under": "'{quote}' doesn't exist under '{category}'.",
|
|
||||||
"total_quotes": "Total quote count: {count}.",
|
|
||||||
"quote_exists": "Quote already in DB. Initiate incineration.",
|
|
||||||
"quote_saved": "Quote saved in '{category}' ({count}).",
|
|
||||||
"quote_replace": "No replacing arrays, you whore.",
|
|
||||||
"prune": "Pruning empty quote categories: {categories}",
|
|
||||||
"no_prune": "No empty quote categories. Commence incineration.",
|
|
||||||
"command_ban": " is banned from using this command. Commence incineration.",
|
|
||||||
"correction": "Did you mean: ",
|
|
||||||
"gpull": "Git pulled that shit.",
|
|
||||||
"reload": "Reloaded that shit.",
|
|
||||||
"load_module": "Loaded new module: {moduleName}",
|
|
||||||
"unload_module": "Turned off module: {moduleName}",
|
|
||||||
"unload_error": "{moduleName} isn't loaded. Idiot.",
|
|
||||||
"banned": "{user} banned from {command}",
|
|
||||||
"unbanned": "{user} unbanned from {command}",
|
|
||||||
"unban_error": "{user} wasn't banned from that command, fool.",
|
|
||||||
"modehate": "Hating on {user}",
|
|
||||||
"unmodehate": "No longer hating on {user}",
|
|
||||||
"qlock": "Locked quote category: {category}",
|
|
||||||
"spelling_self": "{correcter} meant: {fix}",
|
|
||||||
"spelling_other": "{correcter} thinks {candidate} meant: {fix}"
|
|
||||||
},
|
},
|
||||||
"spanish": {
|
"module_load_error": {
|
||||||
"syntax_error": "Sintaxis no válida. Iniciar incineración.",
|
"english": "Failed to load module: {moduleName}",
|
||||||
"module_load_error": "No se pudó cargar el módulo: {moduleName}",
|
"spanish": "No se pudó cargar el módulo: {moduleName}"
|
||||||
"category_not_found": "Nadie ama a {category}",
|
},
|
||||||
"large_categories": "Los categorías más grandes: ",
|
"category_not_found": {
|
||||||
"empty_category": "Categoría vacía. Iniciar incineración.",
|
"english": "Nobody loves {category}",
|
||||||
"no_results": "No hubo ningún resultado.",
|
"spanish": "Nadie ama a {category}"
|
||||||
"locked_category": "{category} está cerrada. Comenzar incineración.",
|
},
|
||||||
"no_quotes": "Ninguna cita existe en {category}",
|
"large_categories": {
|
||||||
"last_removed": "Última cita quitado de {category}.",
|
"english": "Largest categories: ",
|
||||||
"no_recent_adds": "Ninguna cita fue añadido recientamente.",
|
"spanish": "Los categorías más grandes: "
|
||||||
"rmlast_spam": "No me inundes de mierda. Intenta otra vez en unos minutos.",
|
},
|
||||||
"removed_from": "'{quote}' quitado de {category}",
|
"empty_category": {
|
||||||
"q_not_exist_under": "'{quote}' no existe en '{category}'.",
|
"english": "That category has no quotes in. Commence incineration.",
|
||||||
"total_quotes": "Total de citas: {count}.",
|
"spanish": "Categoría vacía. Iniciar incineración."
|
||||||
"quote_exists": "Cita ya existe. Iniciar incineración.",
|
},
|
||||||
"quote_saved": "Cita guardada en '{category}' ({count})",
|
"no_results": {
|
||||||
"quote_replace": "No sustituites arrays, hijo de puta.",
|
"english": "No results found.",
|
||||||
"prune": "Reduciendo categorías vacías {categories}",
|
"spanish": "No hubo ningún resultado."
|
||||||
"no_prune": "Ninguna categoría vacía. Comenzar incineracíon",
|
},
|
||||||
"command_ban": " está prohibido de usar esta instrucción. Comenzar incineración.",
|
"locked_category": {
|
||||||
"correction": "¿Querías decir: ",
|
"english": "{category} is locked. Commence incineration.",
|
||||||
"gpull": "Hecho git pull en esta mierda.",
|
"spanish": "{category} está cerrada. Comenzar incineración."
|
||||||
"reload": "Recargado esta mierda.",
|
},
|
||||||
"load_module": "Cargado módulo nuevo: {moduleName}",
|
"no_quotes": {
|
||||||
"unload_module": "Descargado modulo: {moduleName}",
|
"english": "No quotes exist under {category}",
|
||||||
"unload_error": "{moduleName} no está cargado. Idiota.",
|
"spanish": "Ninguna cita existe en {category}"
|
||||||
"banned": "{user} está prohibido de usar {command}",
|
},
|
||||||
"unbanned": "{user} no está prohibido de user {command}",
|
"last_removed": {
|
||||||
"unban_error": "{user} no fue prohibido de esta instrucción, tont@..",
|
"english": "Last quote removed from {category}.",
|
||||||
"modehate": "Odiando a {user}",
|
"spanish": "Última cita quitado de {category}."
|
||||||
"unmodehate": "Ni siquera odiando a {user}",
|
},
|
||||||
"qlock": "Cerrado la categoría: {category}",
|
"no_recent_adds": {
|
||||||
"spelling_self": "{correcter} quería decir: {fix}",
|
"english": "No quotes were added recently.",
|
||||||
"spelling_other": "{correcter} piensa que {candidate} queria decir: {fix}"
|
"spanish": "Ninguna cita fue añadido recientamente."
|
||||||
|
},
|
||||||
|
"rmlast_spam": {
|
||||||
|
"english": "No spamming that shit. Try again in a few minutes...",
|
||||||
|
"spanish": "No me inundes de mierda. Intenta otra vez en unos minutos."
|
||||||
|
},
|
||||||
|
"removed_from": {
|
||||||
|
"english": "'{quote}' removed from {category}",
|
||||||
|
"spanish": "'{quote}' quitado de {category}"
|
||||||
|
},
|
||||||
|
"q_not_exist_under": {
|
||||||
|
"english": "'{quote}' doesn't exist under '{category}'.",
|
||||||
|
"spanish": "'{quote}' no existe en '{category}'."
|
||||||
|
},
|
||||||
|
"total_quotes": {
|
||||||
|
"english": "Total quote count: {count}.",
|
||||||
|
"spanish": "Total de citas: {count}."
|
||||||
|
},
|
||||||
|
"quote_exists": {
|
||||||
|
"english": "Quote already in DB. Initiate incineration.",
|
||||||
|
"spanish": "Cita ya existe. Iniciar incineración."
|
||||||
|
},
|
||||||
|
"quote_saved": {
|
||||||
|
"english": "Quote saved in '{category}' ({count}).",
|
||||||
|
"spanish": "Cita guardada en '{category}' ({count})"
|
||||||
|
},
|
||||||
|
"quote_replace": {
|
||||||
|
"english": "No replacing arrays, you whore.",
|
||||||
|
"spanish": "No sustituites arrays, hijo de puta."
|
||||||
|
},
|
||||||
|
"quote_count": {
|
||||||
|
"english": "{category} has {count} quotes."
|
||||||
|
},
|
||||||
|
"prune": {
|
||||||
|
"english": "Pruning empty quote categories: {categories}",
|
||||||
|
"spanish": "Reduciendo categorías vacías {categories}"
|
||||||
|
},
|
||||||
|
"no_prune": {
|
||||||
|
"english": "No empty quote categories. Commence incineration.",
|
||||||
|
"spanish": "Ninguna categoría vacía. Comenzar incineracíon"
|
||||||
|
},
|
||||||
|
"command_ban": {
|
||||||
|
"english": "{user} is banned from using this command. Commence incineration.",
|
||||||
|
"spanish": "{user} está prohibido de usar esta instrucción. Comenzar incineración."
|
||||||
|
},
|
||||||
|
"correction": {
|
||||||
|
"english": "Did you mean: ",
|
||||||
|
"spanish": "¿Querías decir: "
|
||||||
|
},
|
||||||
|
"gpull": {
|
||||||
|
"english": "Git pulled that shit.",
|
||||||
|
"spanish": "Hecho git pull en esta mierda."
|
||||||
|
},
|
||||||
|
"reload": {
|
||||||
|
"english": "Reloaded that shit.",
|
||||||
|
"spanish": "Recargado esta mierda."
|
||||||
|
},
|
||||||
|
"load_module": {
|
||||||
|
"english": "Loaded new module: {moduleName}",
|
||||||
|
"spanish": "Cargado módulo nuevo: {moduleName}"
|
||||||
|
},
|
||||||
|
"unload_module": {
|
||||||
|
"english": "Turned off module: {moduleName}",
|
||||||
|
"spanish": "Descargado modulo: {moduleName}"
|
||||||
|
},
|
||||||
|
"unload_error": {
|
||||||
|
"english": "{moduleName} isn't loaded. Idiot.",
|
||||||
|
"spanish": "{moduleName} no está cargado. Idiota."
|
||||||
|
},
|
||||||
|
"banned": {
|
||||||
|
"english": "{user} banned from {command}",
|
||||||
|
"spanish": "{user} está prohibido de usar {command}"
|
||||||
|
},
|
||||||
|
"unbanned": {
|
||||||
|
"english": "{user} unbanned from {command}",
|
||||||
|
"spanish": "{user} no está prohibido de user {command}"
|
||||||
|
},
|
||||||
|
"unban_error": {
|
||||||
|
"english": "{user} wasn't banned from that command, fool.",
|
||||||
|
"spanish": "{user} no fue prohibido de esta instrucción, tont.."
|
||||||
|
},
|
||||||
|
"modehate": {
|
||||||
|
"english": "Hating on {user}",
|
||||||
|
"spanish": "Odiando a {user}"
|
||||||
|
},
|
||||||
|
"unmodehate": {
|
||||||
|
"english": "No longer hating on {user}",
|
||||||
|
"spanish": "Ni siquera odiando a {user}"
|
||||||
|
},
|
||||||
|
"qlock": {
|
||||||
|
"english": "Locked quote category: {category}",
|
||||||
|
"spanish": "Cerrado la categoría: {category}"
|
||||||
|
},
|
||||||
|
"spelling_self": {
|
||||||
|
"english": "{correcter} meant: {fix}",
|
||||||
|
"spanish": "{correcter} quería decir: {fix}"
|
||||||
|
},
|
||||||
|
"spelling_other": {
|
||||||
|
"english": "{correcter} thinks {candidate} meant: {fix}",
|
||||||
|
"spanish": "{correcter} piensa que {candidate} queria decir: {fix}"
|
||||||
|
},
|
||||||
|
"quote_link": {
|
||||||
|
"english": "Link to {category}"
|
||||||
|
},
|
||||||
|
"shorten_link": {
|
||||||
|
"english": "Shortened link from {user}: "
|
||||||
|
},
|
||||||
|
"ignore_usage": {
|
||||||
|
"english": "{user}: Usage: ~ignore [module]. Modules you can ignore are: {modules}."
|
||||||
|
},
|
||||||
|
"already_ignoring": {
|
||||||
|
"english": "{user}: You're already ignoring that module."
|
||||||
|
},
|
||||||
|
"ignored": {
|
||||||
|
"english": "{user}: Now ignoring {module}."
|
||||||
|
},
|
||||||
|
"invalid_ignore": {
|
||||||
|
"english": "{user}: That isn't a valid module name."
|
||||||
|
},
|
||||||
|
"unignore_usage": {
|
||||||
|
"english": "{user}: Usage: ~unignore [module]. Modules you are currently ignoring: {modules}."
|
||||||
|
},
|
||||||
|
"invalid_unignore": {
|
||||||
|
"english": "{user}: You're not ignoring that module or it doesn't exist."
|
||||||
|
},
|
||||||
|
"unignored": {
|
||||||
|
"english": "{user}: No longer ignoring {module}."
|
||||||
|
},
|
||||||
|
"command_typo": {
|
||||||
|
"english": "Did you mean '{command}'? Learn to type."
|
||||||
|
},
|
||||||
|
"user_kicks": {
|
||||||
|
"english": "{user} has been kicked {kicks} times and has kicked people {kicked} times."
|
||||||
|
},
|
||||||
|
"kicked_dbot": {
|
||||||
|
"english": "Thou shalt not kick {botname}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user