3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 22:39:26 +01:00

Used access parameter on all elevated access commadns I can think of [#124]

This commit is contained in:
reality 2013-01-12 09:49:41 +00:00
parent f8d4896eb6
commit 6b903407ed
3 changed files with 62 additions and 64 deletions

View File

@ -22,17 +22,17 @@ var js = function(dbot) {
// Run JS code un-sandboxed, with access to DBot memory (admin-only). // Run JS code un-sandboxed, with access to DBot memory (admin-only).
'~ajs': function(event) { '~ajs': function(event) {
if(dbot.config.admins.include(event.user) ) {
var ret = eval(event.input[1]); var ret = eval(event.input[1]);
if(ret !== undefined) { if(ret !== undefined) {
event.reply(ret); event.reply(ret);
} }
} }
}
}; };
commands['~js'].regex = [/^~js (.*)/, 2]; commands['~js'].regex = [/^~js (.*)/, 2];
commands['~ajs'].regex = [/^~ajs (.*)/, 2]; commands['~ajs'].regex = [/^~ajs (.*)/, 2];
commands['~ajs'].access = 'admin';
return { return {
'name': 'js', 'name': 'js',
'ignorable': true, 'ignorable': true,

View File

@ -93,16 +93,13 @@ var quotes = function(dbot) {
}, },
'~rmconfirm': function(event) { '~rmconfirm': function(event) {
if(dbot.config.admins.include(event.user)) {
var rmCacheCount = rmCache.length; var rmCacheCount = rmCache.length;
rmCache.length = 0; rmCache.length = 0;
event.reply(dbot.t('quote_cache_cleared', event.reply(dbot.t('quote_cache_cleared',
{ 'count': rmCacheCount })); { 'count': rmCacheCount }));
}
}, },
'~rmdeny': function(event) { '~rmdeny': function(event) {
if(dbot.config.admins.include(event.user)) {
var rmCacheCount = rmCache.length; var rmCacheCount = rmCache.length;
for(var i=0;i<rmCacheCount;i++) { for(var i=0;i<rmCacheCount;i++) {
if(!quotes.hasOwnProperty(rmCache[i].key)) { if(!quotes.hasOwnProperty(rmCache[i].key)) {
@ -114,7 +111,6 @@ var quotes = function(dbot) {
event.reply(dbot.t('quote_cache_reinstated', event.reply(dbot.t('quote_cache_reinstated',
{ 'count': rmCacheCount })); { 'count': rmCacheCount }));
}
}, },
@ -271,6 +267,9 @@ var quotes = function(dbot) {
commands['~rmlast'].regex = [/^~rmlast ([\d\w\s-]*)/, 2]; commands['~rmlast'].regex = [/^~rmlast ([\d\w\s-]*)/, 2];
commands['~qadd'].regex = [/^~qadd ([\d\w\s-]+?)[ ]?=[ ]?(.+)$/, 3]; commands['~qadd'].regex = [/^~qadd ([\d\w\s-]+?)[ ]?=[ ]?(.+)$/, 3];
commands['~rmconfirm'].access = 'moderator';
commands['~rmdeny'].access = 'moderator';
var pages = { var pages = {
// Lists quotes in a category // Lists quotes in a category
'/quotes/:key': function(req, res) { '/quotes/:key': function(req, res) {

View File

@ -95,7 +95,6 @@ var users = function(dbot) {
}, },
'~setaliasparent': function(event) { '~setaliasparent': function(event) {
if(dbot.config.admins.include(event.user)) {
var knownUsers = getServerUsers(event.server); var knownUsers = getServerUsers(event.server);
var newParent = event.params[1]; var newParent = event.params[1];
@ -124,11 +123,9 @@ var users = function(dbot) {
} else { } else {
event.reply(dbot.t('unknown_alias', { 'alias': newParent})); event.reply(dbot.t('unknown_alias', { 'alias': newParent}));
} }
}
}, },
'~mergeusers': function(event) { '~mergeusers': function(event) {
if(dbot.config.admins.include(event.user)) {
var knownUsers = getServerUsers(event.server); var knownUsers = getServerUsers(event.server);
var primaryUser = event.params[1]; var primaryUser = event.params[1];
var secondaryUser = event.params[2]; var secondaryUser = event.params[2];
@ -149,9 +146,11 @@ var users = function(dbot) {
event.reply(dbot.t('unprimary_error')); event.reply(dbot.t('unprimary_error'));
} }
} }
}
}; };
commands['~setaliasparent'].access = 'moderator';
commands['~mergeusers'].access = 'moderator';
return { return {
'name': 'users', 'name': 'users',
'ignorable': false, 'ignorable': false,