From 7ec1e5f6bb30ec406b7d2d0d66353ac81f6e39ab Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 1 Jul 2013 17:03:04 +0000 Subject: [PATCH 01/16] ~quiet command --- modules/kick/commands.js | 14 ++++++++++++++ modules/kick/strings.json | 3 +++ 2 files changed, 17 insertions(+) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index c64aa46..6ab46c7 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -4,6 +4,20 @@ var commands = function(dbot) { var commands = { /*** Kick Management ***/ + '~quiet': function(event) { + var server = event.server, + quieter = event.user, + channel = event.input[1], + quietee = event.input[2]; + + if(!channel) { + channel = event.channel.name; + } + + this.api.quiet(server, quietee, channel); + event.reply(dbot.t('quieted', { 'quietee': quietee })); + }, + '~ckick': function(event) { var server = event.server, kicker = event.user, diff --git a/modules/kick/strings.json b/modules/kick/strings.json index 07d8064..a00df1b 100644 --- a/modules/kick/strings.json +++ b/modules/kick/strings.json @@ -7,6 +7,9 @@ "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." + }, "kicked_dbot": { "en": "Thou shalt not kick {botname}", "es": "No expulsás {botname}", From 3ed36188fa9ca9f7137a2c6bf1f6f280720c9c7e Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 1 Jul 2013 17:04:14 +0000 Subject: [PATCH 02/16] quiet command [Close #522] --- modules/kick/commands.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index 6ab46c7..9c00e51 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -238,6 +238,7 @@ var commands = function(dbot) { commands['~ckick'].regex = [/^~ckick ([^ ]+) ([^ ]+) (.+)$/, 4]; commands['~nban'].regex = /^~nban ([\d\.^ ]+)?([^ ]+) (.+)$/; + commands['~quiet'].regex = /^~quiet ([\d\.^ ]+)?([^ ]+)$/; return commands; }; From 5d4faadc8822cf3728b50cea658ad22ffffadfc5 Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 1 Jul 2013 17:11:57 +0000 Subject: [PATCH 03/16] fix ~quiet regex? --- modules/kick/commands.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index 9c00e51..b2d94c2 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -238,7 +238,7 @@ var commands = function(dbot) { commands['~ckick'].regex = [/^~ckick ([^ ]+) ([^ ]+) (.+)$/, 4]; commands['~nban'].regex = /^~nban ([\d\.^ ]+)?([^ ]+) (.+)$/; - commands['~quiet'].regex = /^~quiet ([\d\.^ ]+)?([^ ]+)$/; + commands['~quiet'].regex = /^~quiet ([^ ]+)?([^ ]+)$/; return commands; }; From e11893c0ef2512276957e45e96606763a2e7433c Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 1 Jul 2013 17:23:15 +0000 Subject: [PATCH 04/16] lol live debugging --- modules/kick/commands.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index b2d94c2..6616269 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -10,6 +10,8 @@ var commands = function(dbot) { channel = event.input[1], quietee = event.input[2]; + console.log(event.input); + if(!channel) { channel = event.channel.name; } @@ -238,7 +240,7 @@ var commands = function(dbot) { commands['~ckick'].regex = [/^~ckick ([^ ]+) ([^ ]+) (.+)$/, 4]; commands['~nban'].regex = /^~nban ([\d\.^ ]+)?([^ ]+) (.+)$/; - commands['~quiet'].regex = /^~quiet ([^ ]+)?([^ ]+)$/; + commands['~quiet'].regex = /^~quiet (#[^ ]+ )?([^ ]+)$/; return commands; }; From e1fe601269b074b9fec6aa06675304c45f3f0aa2 Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 1 Jul 2013 17:24:05 +0000 Subject: [PATCH 05/16] reality is a dumbass --- modules/kick/commands.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index 6616269..7486a90 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -10,9 +10,7 @@ var commands = function(dbot) { channel = event.input[1], quietee = event.input[2]; - console.log(event.input); - - if(!channel) { + if(_.isUndefined(channel)) { channel = event.channel.name; } From 5cf57146408d11a116cbe057bb1bd7ad4faec716 Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 1 Jul 2013 17:33:19 +0000 Subject: [PATCH 06/16] fix regex & trim --- modules/kick/commands.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index 7486a90..5ee7da7 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -8,11 +8,12 @@ var commands = function(dbot) { var server = event.server, quieter = event.user, channel = event.input[1], - quietee = event.input[2]; + quietee = event.input[2].trim(); if(_.isUndefined(channel)) { channel = event.channel.name; } + channel = channel.trim(); this.api.quiet(server, quietee, channel); event.reply(dbot.t('quieted', { 'quietee': quietee })); @@ -238,7 +239,7 @@ var commands = function(dbot) { commands['~ckick'].regex = [/^~ckick ([^ ]+) ([^ ]+) (.+)$/, 4]; commands['~nban'].regex = /^~nban ([\d\.^ ]+)?([^ ]+) (.+)$/; - commands['~quiet'].regex = /^~quiet (#[^ ]+ )?([^ ]+)$/; + commands['~quiet'].regex = /^~quiet (#[^ ]+ )?([^ ]+) ?$/; return commands; }; From a9e9aaef36fb1f6a4e0dc515cf915bb84cbb9db2 Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 1 Jul 2013 17:38:25 +0000 Subject: [PATCH 07/16] unquiet command --- modules/kick/commands.js | 16 ++++++++++++++++ modules/kick/kick.js | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index 5ee7da7..a162fee 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -19,6 +19,21 @@ var commands = function(dbot) { event.reply(dbot.t('quieted', { 'quietee': quietee })); }, + '~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.quiet(server, quietee, channel); + event.reply(dbot.t('unquieted', { 'quietee': quietee })); + }, + '~ckick': function(event) { var server = event.server, kicker = event.user, @@ -240,6 +255,7 @@ var commands = function(dbot) { commands['~ckick'].regex = [/^~ckick ([^ ]+) ([^ ]+) (.+)$/, 4]; commands['~nban'].regex = /^~nban ([\d\.^ ]+)?([^ ]+) (.+)$/; commands['~quiet'].regex = /^~quiet (#[^ ]+ )?([^ ]+) ?$/; + commands['~unquiet'].regex = /^~unquiet (#[^ ]+ )?([^ ]+) ?$/; return commands; }; diff --git a/modules/kick/kick.js b/modules/kick/kick.js index 6197b0d..fcb90f4 100644 --- a/modules/kick/kick.js +++ b/modules/kick/kick.js @@ -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); }, From 2ee4acc99467d6407e1145d4edc1f6be54b43153 Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 1 Jul 2013 17:39:03 +0000 Subject: [PATCH 08/16] coconut --- modules/kick/strings.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/kick/strings.json b/modules/kick/strings.json index a00df1b..cd2b0bc 100644 --- a/modules/kick/strings.json +++ b/modules/kick/strings.json @@ -10,6 +10,9 @@ "quieted": { "en": "Quieted {quietee}. 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}", From e0ece997f8fdf3f807dc1d999d710b6df3211a68 Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 1 Jul 2013 17:47:05 +0000 Subject: [PATCH 09/16] DO NOT CALL QUIET IN UNQUIET --- modules/kick/commands.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index a162fee..21001a9 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -30,7 +30,7 @@ var commands = function(dbot) { } channel = channel.trim(); - this.api.quiet(server, quietee, channel); + this.api.unquiet(server, quietee, channel); event.reply(dbot.t('unquieted', { 'quietee': quietee })); }, From 5a67f85ce19613963e634c719546c8270c6f1552 Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 1 Jul 2013 17:59:54 +0000 Subject: [PATCH 10/16] power_users [#521] --- config.json.sample | 1 + modules/command/api.js | 1 + 2 files changed, 2 insertions(+) diff --git a/config.json.sample b/config.json.sample index 043afd6..87190a7 100644 --- a/config.json.sample +++ b/config.json.sample @@ -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, diff --git a/modules/command/api.js b/modules/command/api.js index 5fb8aa4..b071f55 100644 --- a/modules/command/api.js +++ b/modules/command/api.js @@ -23,6 +23,7 @@ var api = function(dbot) { if(accessNeeded == 'admin' || accessNeeded == 'moderator') { 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)) { callback(false); From 539d0106e2f1f06271032da5a903391cbfb5d521 Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 1 Jul 2013 18:34:02 +0000 Subject: [PATCH 11/16] timed quiet maybe --- modules/kick/commands.js | 23 ++++++++++++++++++----- modules/kick/strings.json | 3 +++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index 21001a9..c778743 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -3,20 +3,33 @@ var _ = require('underscore')._; var commands = function(dbot) { var commands = { /*** Kick Management ***/ - '~quiet': function(event) { var server = event.server, quieter = event.user, - channel = event.input[1], - quietee = event.input[2].trim(); + 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() + (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 })); + } + this.api.quiet(server, quietee, channel); - event.reply(dbot.t('quieted', { 'quietee': quietee })); }, '~unquiet': function(event) { @@ -254,7 +267,7 @@ var commands = function(dbot) { commands['~ckick'].regex = [/^~ckick ([^ ]+) ([^ ]+) (.+)$/, 4]; commands['~nban'].regex = /^~nban ([\d\.^ ]+)?([^ ]+) (.+)$/; - commands['~quiet'].regex = /^~quiet (#[^ ]+ )?([^ ]+) ?$/; + commands['~quiet'].regex = /^~quiet ([\d\.^ ]+)?(#[^ ]+ )?([^ ]+) ?$/; commands['~unquiet'].regex = /^~unquiet (#[^ ]+ )?([^ ]+) ?$/; return commands; diff --git a/modules/kick/strings.json b/modules/kick/strings.json index cd2b0bc..e81cceb 100644 --- a/modules/kick/strings.json +++ b/modules/kick/strings.json @@ -10,6 +10,9 @@ "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." }, From e05eb7396ec95332fa9bf46bca8cc548e1b3aa9b Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 1 Jul 2013 18:36:43 +0000 Subject: [PATCH 12/16] add _ --- modules/kick/commands.js | 2 +- modules/web/config.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index c778743..21a4174 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -15,7 +15,7 @@ var commands = function(dbot) { } channel = channel.trim(); - if(!isUndefined(minutes)) { + if(!_.isUndefined(minutes)) { minutes = parseFloat(minutes.trim()); var msTimeout = new Date(new Date().getTime() + (timeout * 3600000)); dbot.api.timers.addTimeout(msTimeout, function() { diff --git a/modules/web/config.json b/modules/web/config.json index e6b635e..fcb0381 100644 --- a/modules/web/config.json +++ b/modules/web/config.json @@ -1,6 +1,6 @@ { "webHost": "nourishedcloud.com", - "webPort": 8080, + "webPort": 9005, "externalPath": false, "help": "https://github.com/reality/depressionbot/blob/master/modules/web/README.md" } From b986f2eec924adcc8cc305282b1df4036e55ca8d Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 1 Jul 2013 18:36:54 +0000 Subject: [PATCH 13/16] whoops --- modules/web/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/web/config.json b/modules/web/config.json index fcb0381..e6b635e 100644 --- a/modules/web/config.json +++ b/modules/web/config.json @@ -1,6 +1,6 @@ { "webHost": "nourishedcloud.com", - "webPort": 9005, + "webPort": 8080, "externalPath": false, "help": "https://github.com/reality/depressionbot/blob/master/modules/web/README.md" } From ffac94623547796355971e9df0f7b23c74d4c530 Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 1 Jul 2013 18:39:51 +0000 Subject: [PATCH 14/16] jaja --- modules/kick/commands.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index 21a4174..9602691 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -17,7 +17,7 @@ var commands = function(dbot) { if(!_.isUndefined(minutes)) { minutes = parseFloat(minutes.trim()); - var msTimeout = new Date(new Date().getTime() + (timeout * 3600000)); + var msTimeout = new Date(new Date().getTime() + (minutes * 3600000)); dbot.api.timers.addTimeout(msTimeout, function() { this.api.unquiet(server, quietee, channel); }.bind(this)); From 362510c46854d41d7a72d074fb557e655e18cb3d Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 1 Jul 2013 18:46:09 +0000 Subject: [PATCH 15/16] minutes not hours! --- modules/kick/commands.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index 9602691..a18f717 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -17,7 +17,7 @@ var commands = function(dbot) { if(!_.isUndefined(minutes)) { minutes = parseFloat(minutes.trim()); - var msTimeout = new Date(new Date().getTime() + (minutes * 3600000)); + var msTimeout = new Date(new Date().getTime() + (minutes * 60000)); dbot.api.timers.addTimeout(msTimeout, function() { this.api.unquiet(server, quietee, channel); }.bind(this)); From 227dbbd8e4837017b4e47f53f51e13e655ccf17b Mon Sep 17 00:00:00 2001 From: reality Date: Tue, 2 Jul 2013 10:39:55 +0000 Subject: [PATCH 16/16] whoops.. --- modules/command/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/command/api.js b/modules/command/api.js index b071f55..6af230b 100644 --- a/modules/command/api.js +++ b/modules/command/api.js @@ -20,7 +20,7 @@ var api = function(dbot) { 'hasAccess': function(server, 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);