forked from GitHub/dbot
add ~ prefix to admin commands :( [Close #465]
This commit is contained in:
parent
710b9bda49
commit
051b59504a
@ -46,7 +46,7 @@ var commands = function(dbot) {
|
|||||||
|
|
||||||
var commands = {
|
var commands = {
|
||||||
// Join a channel
|
// Join a channel
|
||||||
'join': function(event) {
|
'~join': function(event) {
|
||||||
var channel = event.params[1];
|
var channel = event.params[1];
|
||||||
if(_.has(event.allChannels, channel)) {
|
if(_.has(event.allChannels, channel)) {
|
||||||
event.reply(dbot.t('already_in_channel', {'channel': channel}));
|
event.reply(dbot.t('already_in_channel', {'channel': channel}));
|
||||||
@ -57,7 +57,7 @@ var commands = function(dbot) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Leave a channel
|
// Leave a channel
|
||||||
'part': function(event) {
|
'~part': function(event) {
|
||||||
var channel = event.params[1];
|
var channel = event.params[1];
|
||||||
if(!_.has(event.allChannels, channel)) {
|
if(!_.has(event.allChannels, channel)) {
|
||||||
event.reply(dbot.t('not_in_channel', {'channel': channel}));
|
event.reply(dbot.t('not_in_channel', {'channel': channel}));
|
||||||
@ -68,7 +68,7 @@ var commands = function(dbot) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Op admin caller in given channel
|
// Op admin caller in given channel
|
||||||
'opme': function(event) {
|
'~opme': function(event) {
|
||||||
var channel = event.params[1];
|
var channel = event.params[1];
|
||||||
|
|
||||||
// If given channel isn't valid just op in current one.
|
// If given channel isn't valid just op in current one.
|
||||||
@ -79,12 +79,12 @@ var commands = function(dbot) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 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) {
|
||||||
exec("git submodule update", function (error, stdout, stderr) {
|
exec("git submodule update", function (error, stdout, stderr) {
|
||||||
event.reply(dbot.t('gpull'));
|
event.reply(dbot.t('gpull'));
|
||||||
commands.reload(event);
|
commands['~reload'](event);
|
||||||
event.message = 'version';
|
event.message = '~version';
|
||||||
event.action = 'PRIVMSG';
|
event.action = 'PRIVMSG';
|
||||||
event.params = event.message.split(' ');
|
event.params = event.message.split(' ');
|
||||||
dbot.instance.emit(event);
|
dbot.instance.emit(event);
|
||||||
@ -93,7 +93,7 @@ var commands = function(dbot) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Display commit information for part of dbot
|
// Display commit information for part of dbot
|
||||||
'version': function(event){
|
'~version': function(event){
|
||||||
var cmd = "git log --pretty=format:'%h (%s): %ar' -n 1 -- ";
|
var cmd = "git log --pretty=format:'%h (%s): %ar' -n 1 -- ";
|
||||||
if(event.params[1]){
|
if(event.params[1]){
|
||||||
var input = event.params[1].trim();
|
var input = event.params[1].trim();
|
||||||
@ -115,7 +115,7 @@ var commands = function(dbot) {
|
|||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
'status': function(event) {
|
'~status': function(event) {
|
||||||
var moduleName = event.params[1];
|
var moduleName = event.params[1];
|
||||||
if(_.has(dbot.status, moduleName)) {
|
if(_.has(dbot.status, moduleName)) {
|
||||||
var status = dbot.status[moduleName];
|
var status = dbot.status[moduleName];
|
||||||
@ -130,14 +130,14 @@ var commands = function(dbot) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Reload DB, translations and modules.
|
// Reload DB, translations and modules.
|
||||||
'reload': function(event) {
|
'~reload': function(event) {
|
||||||
dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8'));
|
dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8'));
|
||||||
dbot.reloadModules();
|
dbot.reloadModules();
|
||||||
event.reply(dbot.t('reload'));
|
event.reply(dbot.t('reload'));
|
||||||
},
|
},
|
||||||
|
|
||||||
// Say something in a channel
|
// Say something in a channel
|
||||||
'say': function(event) {
|
'~say': function(event) {
|
||||||
var channel = event.params[1];
|
var channel = event.params[1];
|
||||||
if(event.params[1] === "@") {
|
if(event.params[1] === "@") {
|
||||||
channel = event.channel.name;
|
channel = event.channel.name;
|
||||||
@ -147,7 +147,7 @@ var commands = function(dbot) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Load new module
|
// Load new module
|
||||||
'load': function(event) {
|
'~load': function(event) {
|
||||||
var moduleName = event.params[1];
|
var moduleName = event.params[1];
|
||||||
if(!_.include(dbot.config.moduleNames, moduleName)) {
|
if(!_.include(dbot.config.moduleNames, moduleName)) {
|
||||||
dbot.config.moduleNames.push(moduleName);
|
dbot.config.moduleNames.push(moduleName);
|
||||||
@ -167,7 +167,7 @@ var commands = function(dbot) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Unload a loaded module
|
// Unload a loaded module
|
||||||
'unload': function(event) {
|
'~unload': function(event) {
|
||||||
var moduleNames = dbot.config.moduleNames;
|
var moduleNames = dbot.config.moduleNames;
|
||||||
var moduleName = event.params[1];
|
var moduleName = event.params[1];
|
||||||
if(_.include(moduleNames, moduleName)) {
|
if(_.include(moduleNames, moduleName)) {
|
||||||
@ -187,7 +187,7 @@ var commands = function(dbot) {
|
|||||||
|
|
||||||
/*** Config options ***/
|
/*** Config options ***/
|
||||||
|
|
||||||
'setconfig': function(event) {
|
'~setconfig': function(event) {
|
||||||
var configPathString = event.params[1],
|
var configPathString = event.params[1],
|
||||||
configKey = _.last(configPathString.split('.')),
|
configKey = _.last(configPathString.split('.')),
|
||||||
newOption = event.params[2];
|
newOption = event.params[2];
|
||||||
@ -223,7 +223,7 @@ var commands = function(dbot) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'pushconfig': function(event) {
|
'~pushconfig': function(event) {
|
||||||
var configPathString = event.params[1],
|
var configPathString = event.params[1],
|
||||||
configKey = _.last(configPathString.split('.')),
|
configKey = _.last(configPathString.split('.')),
|
||||||
newOption = event.params[2];
|
newOption = event.params[2];
|
||||||
@ -247,7 +247,7 @@ var commands = function(dbot) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'showconfig': function(event) {
|
'~showconfig': function(event) {
|
||||||
var configPathString = event.params[1];
|
var configPathString = event.params[1];
|
||||||
var configPath = getCurrentConfig(configPathString);
|
var configPath = getCurrentConfig(configPathString);
|
||||||
|
|
||||||
@ -275,11 +275,11 @@ var commands = function(dbot) {
|
|||||||
command.access = 'admin';
|
command.access = 'admin';
|
||||||
});
|
});
|
||||||
|
|
||||||
commands['showconfig'].access = 'moderator';
|
commands['~showconfig'].access = 'moderator';
|
||||||
commands['join'].access = 'moderator';
|
commands['~join'].access = 'moderator';
|
||||||
commands['part'].access = 'moderator';
|
commands['~part'].access = 'moderator';
|
||||||
commands['opme'].access = 'moderator';
|
commands['~opme'].access = 'moderator';
|
||||||
commands['say'].access = 'moderator';
|
commands['~say'].access = 'moderator';
|
||||||
|
|
||||||
return commands;
|
return commands;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user