forked from GitHub/dbot
timed quiet maybe
This commit is contained in:
parent
5a67f85ce1
commit
539d0106e2
@ -3,20 +3,33 @@ var _ = require('underscore')._;
|
|||||||
var commands = function(dbot) {
|
var commands = function(dbot) {
|
||||||
var commands = {
|
var commands = {
|
||||||
/*** Kick Management ***/
|
/*** Kick Management ***/
|
||||||
|
|
||||||
'~quiet': function(event) {
|
'~quiet': function(event) {
|
||||||
var server = event.server,
|
var server = event.server,
|
||||||
quieter = event.user,
|
quieter = event.user,
|
||||||
channel = event.input[1],
|
minutes = event.input[1],
|
||||||
quietee = event.input[2].trim();
|
channel = event.input[2],
|
||||||
|
quietee = event.input[3].trim();
|
||||||
|
|
||||||
if(_.isUndefined(channel)) {
|
if(_.isUndefined(channel)) {
|
||||||
channel = event.channel.name;
|
channel = event.channel.name;
|
||||||
}
|
}
|
||||||
channel = channel.trim();
|
channel = channel.trim();
|
||||||
|
|
||||||
this.api.quiet(server, quietee, channel);
|
if(!isUndefined(minutes)) {
|
||||||
|
minutes = parseFloat(minutes.trim());
|
||||||
|
var msTimeout = new Date(new Date().getTime() + (timeout * 3600000));
|
||||||
|
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 }));
|
event.reply(dbot.t('quieted', { 'quietee': quietee }));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.api.quiet(server, quietee, channel);
|
||||||
},
|
},
|
||||||
|
|
||||||
'~unquiet': function(event) {
|
'~unquiet': function(event) {
|
||||||
@ -254,7 +267,7 @@ var commands = function(dbot) {
|
|||||||
|
|
||||||
commands['~ckick'].regex = [/^~ckick ([^ ]+) ([^ ]+) (.+)$/, 4];
|
commands['~ckick'].regex = [/^~ckick ([^ ]+) ([^ ]+) (.+)$/, 4];
|
||||||
commands['~nban'].regex = /^~nban ([\d\.^ ]+)?([^ ]+) (.+)$/;
|
commands['~nban'].regex = /^~nban ([\d\.^ ]+)?([^ ]+) (.+)$/;
|
||||||
commands['~quiet'].regex = /^~quiet (#[^ ]+ )?([^ ]+) ?$/;
|
commands['~quiet'].regex = /^~quiet ([\d\.^ ]+)?(#[^ ]+ )?([^ ]+) ?$/;
|
||||||
commands['~unquiet'].regex = /^~unquiet (#[^ ]+ )?([^ ]+) ?$/;
|
commands['~unquiet'].regex = /^~unquiet (#[^ ]+ )?([^ ]+) ?$/;
|
||||||
|
|
||||||
return commands;
|
return commands;
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
"quieted": {
|
"quieted": {
|
||||||
"en": "Quieted {quietee}. Remember: don't be a coconut."
|
"en": "Quieted {quietee}. Remember: don't be a coconut."
|
||||||
},
|
},
|
||||||
|
"tquieted": {
|
||||||
|
"en": "Quieted {quietee} for {minutes} minutes. Remember: don't be a coconut."
|
||||||
|
},
|
||||||
"unquieted": {
|
"unquieted": {
|
||||||
"en": "Unquieted {quietee}. Remember: don't be a coconut."
|
"en": "Unquieted {quietee}. Remember: don't be a coconut."
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user