devoice on quiet

This commit is contained in:
reality 2014-07-23 16:08:05 +00:00
parent dd8e1fccd7
commit 311f8034f4
2 changed files with 15 additions and 0 deletions

View File

@ -20,9 +20,13 @@ var commands = function(dbot) {
if(!_.isUndefined(minutes)) { if(!_.isUndefined(minutes)) {
minutes = parseFloat(minutes.trim()); minutes = parseFloat(minutes.trim());
var msTimeout = new Date(new Date().getTime() + (minutes * 60000)); var msTimeout = new Date(new Date().getTime() + (minutes * 60000));
var vStatus = dbot.instance.connections[server].channels[channel].nicks[quietee].voice;
dbot.api.timers.addTimeout(msTimeout, function() { dbot.api.timers.addTimeout(msTimeout, function() {
if(_.has(this.hosts[server], quietee)) { if(_.has(this.hosts[server], quietee)) {
this.api.unquiet(server, this.hosts[server][quietee], channel); this.api.unquiet(server, this.hosts[server][quietee], channel);
if(vStatus === true) {
this.api.voice(server, quietee, channel);
}
dbot.api.users.resolveUser(server, dbot.config.name, function(user) { dbot.api.users.resolveUser(server, dbot.config.name, function(user) {
dbot.api.report.notify('unquiet', server, user, channel, dbot.api.report.notify('unquiet', server, user, channel,
@ -55,6 +59,9 @@ var commands = function(dbot) {
})); }));
} }
if(dbot.instance.connections[server].channels[channel].nicks[quietee].voice === true) {
this.api.devoice(server, quietee, channel);
}
this.api.quiet(server, host, channel); this.api.quiet(server, host, channel);
if(reason.indexOf('#warn') !== -1) { if(reason.indexOf('#warn') !== -1) {

View File

@ -14,6 +14,14 @@ var kick = function(dbot) {
dbot.instance.connections[server].send('MODE ' + channel + ' -q *!*@' + host); dbot.instance.connections[server].send('MODE ' + channel + ' -q *!*@' + host);
}, },
'devoice': function(server, nick, channel) {
dbot.instance.connections[server].send('MODE ' + channel + ' -v ' +nick);
},
'voice': function(server, nick, channel) {
dbot.instance.connections[server].send('MODE ' + channel + ' +v ' +nick);
},
'kick': function(server, user, channel, msg) { 'kick': function(server, user, channel, msg) {
dbot.instance.connections[server].send('KICK ' + channel + ' ' + user + ' :' + msg); dbot.instance.connections[server].send('KICK ' + channel + ' ' + user + ' :' + msg);
}, },