forked from GitHub/dbot
Merge https://github.com/reality/dbot into database
This commit is contained in:
commit
6efc01e90a
@ -14,6 +14,7 @@
|
||||
},
|
||||
"admins": [ "batman" ],
|
||||
"moderators": [ "whatever" ],
|
||||
"power_users": [],
|
||||
"moduleNames": [ "ignore", "admin", "command", "dice", "js", "kick", "quotes", "spelling", "youare", "timers", "stats", "users", "link" ],
|
||||
"language": "en",
|
||||
"debugMode": false,
|
||||
|
@ -8,9 +8,10 @@ var api = function(dbot) {
|
||||
'hasAccess': function(user, command, callback) {
|
||||
var accessNeeded = dbot.commands[command].access;
|
||||
|
||||
if(accessNeeded == 'admin' || accessNeeded == 'moderator') {
|
||||
if(accessNeeded == 'admin' || accessNeeded == 'moderator' || accessNeeded == 'power_user') {
|
||||
var allowedNicks = dbot.config.admins;
|
||||
if(accessNeeded == 'moderator') allowedNicks = _.union(allowedNicks, dbot.config.moderators);
|
||||
if(accessNeeded == 'power_user') allowedNicks = _.union(allowedNicks, dbot.config.power_users);
|
||||
|
||||
if(!_.include(allowedNicks, user.primaryNick)) {
|
||||
callback(false);
|
||||
|
@ -3,6 +3,49 @@ var _ = require('underscore')._;
|
||||
var commands = function(dbot) {
|
||||
var commands = {
|
||||
/*** Kick Management ***/
|
||||
'~quiet': function(event) {
|
||||
var server = event.server,
|
||||
quieter = event.user,
|
||||
minutes = event.input[1],
|
||||
channel = event.input[2],
|
||||
quietee = event.input[3].trim();
|
||||
|
||||
if(_.isUndefined(channel)) {
|
||||
channel = event.channel.name;
|
||||
}
|
||||
channel = channel.trim();
|
||||
|
||||
if(!_.isUndefined(minutes)) {
|
||||
minutes = parseFloat(minutes.trim());
|
||||
var msTimeout = new Date(new Date().getTime() + (minutes * 60000));
|
||||
dbot.api.timers.addTimeout(msTimeout, function() {
|
||||
this.api.unquiet(server, quietee, channel);
|
||||
}.bind(this));
|
||||
event.reply(dbot.t('tquieted', {
|
||||
'quietee': quietee,
|
||||
'minutes': minutes
|
||||
}));
|
||||
} else {
|
||||
event.reply(dbot.t('quieted', { 'quietee': quietee }));
|
||||
}
|
||||
|
||||
this.api.quiet(server, quietee, channel);
|
||||
},
|
||||
|
||||
'~unquiet': function(event) {
|
||||
var server = event.server,
|
||||
quieter = event.user,
|
||||
channel = event.input[1],
|
||||
quietee = event.input[2].trim();
|
||||
|
||||
if(_.isUndefined(channel)) {
|
||||
channel = event.channel.name;
|
||||
}
|
||||
channel = channel.trim();
|
||||
|
||||
this.api.unquiet(server, quietee, channel);
|
||||
event.reply(dbot.t('unquieted', { 'quietee': quietee }));
|
||||
},
|
||||
|
||||
'~ckick': function(event) {
|
||||
var server = event.server,
|
||||
@ -223,6 +266,8 @@ var commands = function(dbot) {
|
||||
|
||||
commands['~ckick'].regex = [/^~ckick ([^ ]+) ([^ ]+) (.+)$/, 4];
|
||||
commands['~nban'].regex = /^~nban ([\d\.^ ]+)?([^ ]+) (.+)$/;
|
||||
commands['~quiet'].regex = /^~quiet ([\d\.^ ]+)?(#[^ ]+ )?([^ ]+) ?$/;
|
||||
commands['~unquiet'].regex = /^~unquiet (#[^ ]+ )?([^ ]+) ?$/;
|
||||
|
||||
return commands;
|
||||
};
|
||||
|
@ -13,6 +13,10 @@ var kick = function(dbot) {
|
||||
dbot.say(server, this.config.chanserv, 'quiet ' + channel + ' ' + user);
|
||||
},
|
||||
|
||||
'unquiet': function(server, user, channel) {
|
||||
dbot.say(server, this.config.chanserv, 'unquiet ' + channel + ' ' + user);
|
||||
},
|
||||
|
||||
'kick': function(server, user, channel, msg) {
|
||||
dbot.instance.connections[server].send('KICK ' + channel + ' ' + user + ' :' + msg);
|
||||
},
|
||||
|
@ -7,6 +7,15 @@
|
||||
"nl": "{user} is {kicks} keer gekickt en heeft anderen {kicked} keer gekickt.",
|
||||
"de": "{user} wurde {kicks} mal gekickt und hat {kicked} mal andere Benutzer gekickt."
|
||||
},
|
||||
"quieted": {
|
||||
"en": "Quieted {quietee}. Remember: don't be a coconut."
|
||||
},
|
||||
"tquieted": {
|
||||
"en": "Quieted {quietee} for {minutes} minutes. Remember: don't be a coconut."
|
||||
},
|
||||
"unquieted": {
|
||||
"en": "Unquieted {quietee}. Remember: don't be a coconut."
|
||||
},
|
||||
"kicked_dbot": {
|
||||
"en": "Thou shalt not kick {botname}",
|
||||
"es": "No expulsás {botname}",
|
||||
|
Loading…
Reference in New Issue
Block a user