mirror of
https://github.com/reality/dbot.git
synced 2024-12-24 11:42:36 +01:00
rmconfig and small changes
This commit is contained in:
parent
2307f164f8
commit
a77c6296f1
@ -41,6 +41,16 @@ var commands = function(dbot) {
|
|||||||
dbot.instance.mode(event, channel, ' +o ' + event.user);
|
dbot.instance.mode(event, channel, ' +o ' + event.user);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Op via OperServ in order to work with channels dbot is not joined to, or joined to without having +o itself
|
||||||
|
'~forceopme': function(event) {
|
||||||
|
var channel = event.params[1];
|
||||||
|
|
||||||
|
if(!_.has(event.allChannels, channel)) {
|
||||||
|
channel = event.channel.name;
|
||||||
|
}
|
||||||
|
dbot.say('tripsit', 'OperServ', ' MODE ' + channel + ' +o ' + event.user);
|
||||||
|
},
|
||||||
|
|
||||||
// Do a git pull and reload
|
// Do a git pull and reload
|
||||||
'~greload': function(event) {
|
'~greload': function(event) {
|
||||||
exec("git pull", function (error, stdout, stderr) {
|
exec("git pull", function (error, stdout, stderr) {
|
||||||
@ -229,8 +239,32 @@ var commands = function(dbot) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'~rmconfig': function(event) {
|
||||||
|
var configPath = event.input[1],
|
||||||
|
rmOption = event.input[2];
|
||||||
|
|
||||||
|
if(!_.include(noChangeConfig, configPath)) {
|
||||||
|
this.internalAPI.getCurrentConfig(configPath, function(config) {
|
||||||
|
if(config !== null) {
|
||||||
|
if(_.isArray(config)) {
|
||||||
|
event.reply(configPath + ": " + config + " - " + rmOption);
|
||||||
|
config = _.without(config, rmOption)
|
||||||
|
this.internalAPI.setConfig(configPath, config, function(err) {});
|
||||||
|
} else {
|
||||||
|
event.reply(dbot.t("config_array", { "alternate": "nope" }));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.reply(dbot.t("no_config_key", { 'path': configPath }));
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
|
} else {
|
||||||
|
event.reply(dbot.t("config_lock"));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
'~showconfig': function(event) {
|
'~showconfig': function(event) {
|
||||||
var configPath = event.params[1];
|
var configPath = event.params[1];
|
||||||
|
if(configPath.indexOf('servers') != -1) { return false; }
|
||||||
if(configPath) {
|
if(configPath) {
|
||||||
this.internalAPI.getCurrentConfig(configPath, function(config) {
|
this.internalAPI.getCurrentConfig(configPath, function(config) {
|
||||||
if(config !== null) {
|
if(config !== null) {
|
||||||
@ -294,13 +328,17 @@ var commands = function(dbot) {
|
|||||||
command.access = 'admin';
|
command.access = 'admin';
|
||||||
});
|
});
|
||||||
|
|
||||||
commands['~showconfig'].access = 'moderator';
|
commands['~showconfig'].access = 'admin';
|
||||||
commands['~join'].access = 'moderator';
|
commands['~join'].access = 'power_user';
|
||||||
commands['~part'].access = 'moderator';
|
commands['~part'].access = 'power_user';
|
||||||
commands['~opme'].access = 'moderator';
|
commands['~opme'].access = 'moderator';
|
||||||
commands['~say'].access = 'moderator';
|
commands['~forceopme'].access = 'power_user';
|
||||||
|
commands['~say'].access = 'power_user';
|
||||||
|
commands['~pushconfig'].access = 'moderator';
|
||||||
|
commands['~rmconfig'].access = 'moderator';
|
||||||
|
|
||||||
commands['~pushconfig'].regex = [/pushconfig ([^ ]+) ([^ ]+)/, 3];
|
commands['~pushconfig'].regex = [/pushconfig ([^ ]+) ([^ ]+)/, 3];
|
||||||
|
commands['~rmconfig'].regex = [/rmconfig ([^ ]+) ([^ ]+)/, 3];
|
||||||
commands['~setconfig'].regex = [/setconfig ([^ ]+) ([^ ]+)/, 3];
|
commands['~setconfig'].regex = [/setconfig ([^ ]+) ([^ ]+)/, 3];
|
||||||
|
|
||||||
return commands;
|
return commands;
|
||||||
|
Loading…
Reference in New Issue
Block a user