mirror of
https://github.com/reality/dbot.git
synced 2024-12-18 00:22:35 +01:00
some additions to the strings file and the entire program should now be using the string entries
This commit is contained in:
parent
b6f281d88c
commit
95eaa7f948
@ -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, 'Git pulled that shit.');
|
dbot.say(data.channel, dbot.strings[dbot.language].gpull);
|
||||||
commands.reload(data, params);
|
commands.reload(data, params);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
@ -33,7 +33,7 @@ var adminCommands = function(dbot) {
|
|||||||
'reload': function(data, params) {
|
'reload': function(data, params) {
|
||||||
dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8'));
|
dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8'));
|
||||||
dbot.reloadModules();
|
dbot.reloadModules();
|
||||||
dbot.say(data.channel, 'Reloaded that shit.');
|
dbot.say(data.channel, dbot.strings[dbot.language].reload);
|
||||||
},
|
},
|
||||||
|
|
||||||
'say': function(data, params) {
|
'say': function(data, params) {
|
||||||
@ -59,7 +59,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, 'Loaded new module: ' + params[1]);
|
dbot.say(data.channel, dbot.strings[dbot.language].load_module + params[1]);
|
||||||
},
|
},
|
||||||
|
|
||||||
'unload': function(data, params) {
|
'unload': function(data, params) {
|
||||||
@ -71,9 +71,9 @@ var adminCommands = function(dbot) {
|
|||||||
dbot.moduleNames.splice(moduleIndex, 1);
|
dbot.moduleNames.splice(moduleIndex, 1);
|
||||||
|
|
||||||
dbot.reloadModules();
|
dbot.reloadModules();
|
||||||
dbot.say(data.channel, 'Turned off module: ' + params[1]);
|
dbot.say(data.channel, dbot.strings[dbot.language].unload_module + params[1]);
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'Module ' + params[1] + ' isn\'t loaded... Idiot...');
|
dbot.say(data.channel, params[1] + dbot.strings[dbot.language].unload_error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -83,31 +83,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, params[1] + ' banned from ' + params[2]);
|
dbot.say(data.channel, params[1] + dbot.strings[dbot.language].banned + 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, params[1] + ' unbanned from ' + params[2]);
|
dbot.say(data.channel, params[1] + dbot.strings[dbot.language].unbanned + params[2]);
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'It appears ' + params[1] + 'wasn\'t banned from that command, you fool.');
|
dbot.say(data.channel, params[1] + dbot.strings[dbot.language].unban_error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'modehate': function(data, params) {
|
'modehate': function(data, params) {
|
||||||
dbot.db.modehate.push(params[1]);
|
dbot.db.modehate.push(params[1]);
|
||||||
dbot.say(data.channel, 'Now modehating on ' + params[1]);
|
dbot.say(data.channel, dbot.strings[dbot.language].modehate + 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, 'No longer modehating on ' + params[1]);
|
dbot.say(data.channel, dbot.strings[dbot.language].unmodehate + 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, 'Locked ' + params[1] + ' quotes.');
|
dbot.say(data.channel, dbot.strings[dbot.language].qlock + params[1]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -53,7 +53,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, 'Nobody loves ' + q[1]);
|
dbot.say(data.channel, dbot.strings[dbot.language].category_not_found + q[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -70,7 +70,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 = "Largest categories: ";
|
var qString = dbot.strings[dbot.language].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] + "), ";
|
||||||
@ -81,12 +81,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, 'Next time provide a search parameter. Commence incineration.');
|
dbot.say(data.channel, dbot.strings[dbot.language].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, 'That category has no quotes in it. Commence incineration.');
|
dbot.say(data.channel, dbot.strings[dbot.language].empty_category);
|
||||||
} else {
|
} else {
|
||||||
var matches = [];
|
var matches = [];
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ var quotes = function(dbot) {
|
|||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
if(matches.length == 0) {
|
if(matches.length == 0) {
|
||||||
dbot.say(data.channel, 'No results found.');
|
dbot.say(data.channel, dbot.strings[dbot.language].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]');
|
||||||
}
|
}
|
||||||
@ -118,9 +118,10 @@ var quotes = function(dbot) {
|
|||||||
delete quotes[key];
|
delete quotes[key];
|
||||||
}
|
}
|
||||||
rmAllowed = false;
|
rmAllowed = false;
|
||||||
dbot.say(data.channel, '\'' + quote + '\' removed from ' + q[1]);
|
dbot.say(data.channel, '\'' + quote + '\'' +
|
||||||
|
dbot.strings[dbot.language].removed_from + q[1]);
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, q[1] + ' is locked. Commence incineration.');
|
dbot.say(data.channel, q[1] + dbot.strings[dbot.language].locked_category);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'No quotes exist under ' + q[1]);
|
dbot.say(data.channel, 'No quotes exist under ' + q[1]);
|
||||||
@ -131,16 +132,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, 'Last quote removed from ' + last + '.');
|
dbot.say(data.channel, dbot.strings[dbot.language].last_removed + last + '.');
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, last + ' is locked. Commence incineration.');
|
dbot.say(data.channel, last + dbot.strings[dbot.language].locked_category);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'No quotes were added recently.');
|
dbot.say(data.channel, dbot.strings[dbot.language].no_recent_adds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'No spamming that shit. Try again in a few minutes...');
|
dbot.say(data.channel, dbot.strings[dbot.language].rmlast_spam);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -157,21 +158,23 @@ var quotes = function(dbot) {
|
|||||||
delete quotes[q[1]];
|
delete quotes[q[1]];
|
||||||
}
|
}
|
||||||
rmAllowed = false;
|
rmAllowed = false;
|
||||||
dbot.say(data.channel, '\'' + q[2] + '\' removed from ' + q[1]);
|
dbot.say(data.channel, '\'' + q[2] + '\'' +
|
||||||
|
dbot.strings[dbot.language].removed_from + q[1]);
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, '\'' + q[2] + '\' doesn\'t exist under user \'' + q[1] + '\'.');
|
dbot.say(data.channel, '\'' + q[2] + '\'' +
|
||||||
|
dbot.strings[dbot.language].q_not_exist_under + '\'' + q[1] + '\'.');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, q[1] + ' is locked. Initiate incineration.');
|
dbot.say(data.channel, q[1] + dbot.strings[dbot.language].locked_category);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'No quotes exist under ' + q[1]);
|
dbot.say(data.channel, dbot.strings[dbot.language].no_quotes + q[1]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'Invalid syntax. Initiate incineration.');
|
dbot.say(data.channel, dbot.strings[dbot.language].syntax_error);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'No spamming that shit. Try again in a few minutes...');
|
dbot.say(data.channel, dbot.strings[dbot.language].rmlast_spam);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -190,7 +193,7 @@ var quotes = function(dbot) {
|
|||||||
for(var category in quotes) {
|
for(var category in quotes) {
|
||||||
totalQuoteCount += category.length;
|
totalQuoteCount += category.length;
|
||||||
}
|
}
|
||||||
dbot.say(data.channel, 'There are ' + totalQuoteCount + ' quotes in total.');
|
dbot.say(data.channel, dbot.strings[dbot.language].total_quotes + totalQuoteCount + '.');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -202,16 +205,17 @@ 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, 'Quote already in DB. Initiate incineration.');
|
dbot.say(data.channel, dbot.strings[dbot.language].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, 'Quote saved in \'' + q[1] + '\' (' + quotes[key].length + ')');
|
dbot.say(data.channel, dbot.strings[dbot.language].quote_saved +
|
||||||
|
'\'' + q[1] + '\' (' + quotes[key].length + ')');
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'Invalid syntax. Initiate incineration.');
|
dbot.say(data.channel, dbot.strings[dbot.language].syntax_error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -223,9 +227,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, 'Quote saved as ' + q[1]);
|
dbot.say(data.channel, dbot.strings[dbot.language].quote_saved + q[1]);
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'No replacing arrays, you whore.');
|
dbot.say(data.channel, dbot.strings[dbot.language].quote_replace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -241,7 +245,7 @@ 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, 'Syntax error. Commence incineration.');
|
dbot.say(data.channel, dbot.strings[dbot.language].syntax_error);
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'Link to "'+params[1]+'" - http://nc.no.de:443/quotes/'+params[1]);
|
dbot.say(data.channel, 'Link to "'+params[1]+'" - http://nc.no.de:443/quotes/'+params[1]);
|
||||||
}
|
}
|
||||||
@ -258,9 +262,9 @@ var quotes = function(dbot) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(pruned.length > 0) {
|
if(pruned.length > 0) {
|
||||||
dbot.say(data.channel, "Pruning empty quote categories: " + pruned.join(", "));
|
dbot.say(data.channel, dbot.strings[dbot.language].prune + pruned.join(", "));
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, "No empty quote categories. Commence incineration.");
|
dbot.say(data.channel, dbot.strings[dbot.language].no_prune);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -42,11 +42,12 @@ 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, e.correcter + ' meant: ' + e.fix);
|
dbot.say(data.channel, e.correcter + dbot.strings[dbot.language].spelling_self + e.fix);
|
||||||
});
|
});
|
||||||
} 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, e.correcter + ' thinks ' + e.candidate + ' meant: ' + e.fix);
|
dbot.say(data.channel, e.correcter + dbot.strings[dbot.language].spelling_other +
|
||||||
|
e.candidate + dbot.strings[dbot.language].spelling_self + e.fix);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if(last.hasOwnProperty(data.channel)) {
|
if(last.hasOwnProperty(data.channel)) {
|
||||||
|
6
run.js
6
run.js
@ -40,6 +40,9 @@ var DBot = function(timers) {
|
|||||||
this.db.locks = [];
|
this.db.locks = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load the strings file
|
||||||
|
this.strings = fs.readFileSync('strings.json', 'utf-8');
|
||||||
|
|
||||||
// Populate bot properties with config data
|
// Populate bot properties with config data
|
||||||
this.name = this.config.name || 'dbox';
|
this.name = this.config.name || 'dbox';
|
||||||
this.admin = this.config.admin || [ 'reality' ];
|
this.admin = this.config.admin || [ 'reality' ];
|
||||||
@ -49,6 +52,7 @@ var DBot = function(timers) {
|
|||||||
this.port = this.config.port || 6667;
|
this.port = this.config.port || 6667;
|
||||||
this.webPort = this.config.webPort || 443;
|
this.webPort = this.config.webPort || 443;
|
||||||
this.moduleNames = this.config.modules || [ 'command', 'js', 'admin', 'kick', 'modehate', 'quotes', 'puns', 'spelling', 'web', 'youare' ];
|
this.moduleNames = this.config.modules || [ 'command', 'js', 'admin', 'kick', 'modehate', 'quotes', 'puns', 'spelling', 'web', 'youare' ];
|
||||||
|
this.language = this.config.language || 'english';
|
||||||
this.sessionData = {};
|
this.sessionData = {};
|
||||||
|
|
||||||
this.timers = timers.create();
|
this.timers = timers.create();
|
||||||
@ -113,7 +117,7 @@ DBot.prototype.reloadModules = function() {
|
|||||||
try {
|
try {
|
||||||
this.rawModules.push(require('./modules/' + name));
|
this.rawModules.push(require('./modules/' + name));
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.log('Failed to load module: ' + name);
|
console.log(this.strings[this.language].module_load_error + name);
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
@ -26,13 +26,14 @@
|
|||||||
"load_module": "Loaded new module: ",
|
"load_module": "Loaded new module: ",
|
||||||
"unload_module": "Turned off module: ",
|
"unload_module": "Turned off module: ",
|
||||||
"unload_error": " isn't loaded. Idiot.",
|
"unload_error": " isn't loaded. Idiot.",
|
||||||
|
"banned": " banned from ",
|
||||||
|
"unbanned": " unbanned from ",
|
||||||
"unban_error": " wasn't banned from that command, fool.",
|
"unban_error": " wasn't banned from that command, fool.",
|
||||||
"modehate": "Hating on ",
|
"modehate": "Hating on ",
|
||||||
"unmodehate": "No longer hating on ",
|
"unmodehate": "No longer hating on ",
|
||||||
"qlock": "Locked quote category: ",
|
"qlock": "Locked quote category: ",
|
||||||
"spelling_self": " meant: ",
|
"spelling_self": " meant: ",
|
||||||
"spelling_other_1": " thinks ",
|
"spelling_other": " thinks ",
|
||||||
"spelling_other_2": " meant:"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"spanish": {
|
"spanish": {
|
||||||
@ -62,6 +63,8 @@
|
|||||||
"load_module": "",
|
"load_module": "",
|
||||||
"unload_module": "",
|
"unload_module": "",
|
||||||
"unload_error": "",
|
"unload_error": "",
|
||||||
|
"banned": "",
|
||||||
|
"unbanned": "",
|
||||||
"unban_error": ".",
|
"unban_error": ".",
|
||||||
"modehate": "",
|
"modehate": "",
|
||||||
"unmodehate": "",
|
"unmodehate": "",
|
||||||
|
Loading…
Reference in New Issue
Block a user