mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 14:29:29 +01:00
dbot.modules is now an object
This commit is contained in:
parent
8bd9f93632
commit
9f3596aa6a
@ -8,11 +8,12 @@ var ignore = function(dbot) {
|
||||
var commands = {
|
||||
'~ignore': function(event) {
|
||||
var ignorableModules = [];
|
||||
for(var i=0;i<dbot.modules.length;i++) {
|
||||
if(dbot.modules[i].ignorable != null && dbot.modules[i].ignorable == true) {
|
||||
ignorableModules.push(dbot.modules[i].name);
|
||||
|
||||
dbot.modules.each(function(module) {
|
||||
if(module.ignorable != null && module.ignorable == true) {
|
||||
ignorableModules.push(module.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
var module = event.params[1];
|
||||
|
||||
if(module === undefined) {
|
||||
|
4
run.js
4
run.js
@ -117,7 +117,7 @@ DBot.prototype.reloadModules = function() {
|
||||
}
|
||||
|
||||
this.rawModules = [];
|
||||
this.modules = [];
|
||||
this.modules = {};
|
||||
this.commands = {};
|
||||
this.commandMap = {}; // Map of which commands belong to which modules
|
||||
this.usage = {};
|
||||
@ -226,7 +226,7 @@ DBot.prototype.reloadModules = function() {
|
||||
// Invalid or no string info
|
||||
}
|
||||
|
||||
this.modules.push(module);
|
||||
this.modules[module.name] = module;
|
||||
} catch(err) {
|
||||
console.log(this.t('module_load_error', {'moduleName': name}));
|
||||
if(this.config.debugMode) {
|
||||
|
10
snippets.js
10
snippets.js
@ -204,7 +204,15 @@ Object.prototype.filter = function(fun) {
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
};
|
||||
|
||||
Object.prototype.each = function(fun) {
|
||||
for(var key in this) {
|
||||
if(this.hasOwnProperty(key)) {
|
||||
fun(this[key]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*** Integer ***/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user