From 71b9e482c17eab0a8229b531bac44af3b8b5ad2d Mon Sep 17 00:00:00 2001 From: reality Date: Sat, 1 Jun 2013 19:38:44 +0000 Subject: [PATCH 1/8] move rq to new interpolatedquotes api --- modules/quotes/commands.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/quotes/commands.js b/modules/quotes/commands.js index 751a4e6..6b4e20a 100644 --- a/modules/quotes/commands.js +++ b/modules/quotes/commands.js @@ -198,7 +198,8 @@ var commands = function(dbot) { '~rq': function(event) { if(_.keys(quotes).length > 0) { var category = _.keys(quotes)[_.random(0, _.size(quotes) -1)]; - event.reply(category + ': ' + this.internalAPI.interpolatedQuote(event.server, event.channel.name, category)); + event.reply(category + ': ' + + this.internalAPI.interpolatedQuote(event.server, event.channel.name, event.user, category)); } else { event.reply(dbot.t('no_results')); } From 17070adcb6ba6de7815039628c5df87b5a6b1f47 Mon Sep 17 00:00:00 2001 From: reality Date: Sun, 2 Jun 2013 13:34:51 +0000 Subject: [PATCH 2/8] ~notify command --- modules/report/README.md | 4 ++++ modules/report/report.js | 20 ++++++++++++++++++++ modules/report/strings.json | 6 ++++++ 3 files changed, 30 insertions(+) diff --git a/modules/report/README.md b/modules/report/README.md index e0ca6ae..b1bf067 100644 --- a/modules/report/README.md +++ b/modules/report/README.md @@ -17,3 +17,7 @@ will be that all of the users which are currently marked as operators in the reporting channel will receive a PM telling them a user has been reported, by whom, in which channel and why. If there is an administrative channel for the reporting channel (e.g. ##channel), the report will be posted there as well. + +#### ~notify [#channel] [message] +Notify staff of a channel of a message. This can be run in either PM or in the +channel. If notifyVoice is set, voiced users will also receive notifications. diff --git a/modules/report/report.js b/modules/report/report.js index 1f545df..9819f43 100644 --- a/modules/report/report.js +++ b/modules/report/report.js @@ -43,9 +43,29 @@ var report = function(dbot) { } else { event.reply(dbot.t('not_in_channel', { 'channel': channelName })); } + }, + + '~notify': function(event) { + var channelName = event.input[1]; + var message = event.input[2]; + + if(_.has(event.allChannels, channelName)) { + this.api.notify(event.server, channelName, dbot.t('notify', { + 'channel': channelName, + 'notifier': event.user, + 'message': message + })); + event.reply(dbot.t('notified', { + 'user': event.user, + 'channel': channelName + })); + } else { + event.reply(dbot.t('not_in_channel', { 'channel': channelName })); + } } }; commands['~report'].regex = [/^~report ([^ ]+) ([^ ]+) (.+)$/, 4]; + commands['~notify'].regex = [/^~notify ([^ ]+) (.+)$/, 3]; this.commands = commands; }; diff --git a/modules/report/strings.json b/modules/report/strings.json index 47295d4..469326d 100644 --- a/modules/report/strings.json +++ b/modules/report/strings.json @@ -26,5 +26,11 @@ "cy": "Dydw i ddim yn bresennol yn {channel}.", "nl": "Ik ben niet aanwezig in {channel}.", "de": "Ich bin nicht in {channel} aktiv." + }, + "notify": { + "en": "Attention {channel}: {notifier}: {message}" + }, + "notified": { + "en": "{user}: {channel} staff notified." } } From e43b6ea71524098ad50a96d32dac6ddd26401cef Mon Sep 17 00:00:00 2001 From: reality Date: Wed, 5 Jun 2013 18:07:19 +0000 Subject: [PATCH 3/8] stagger kickbanning --- modules/kick/commands.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index 75fed4c..85ca5aa 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -48,9 +48,11 @@ var commands = function(dbot) { channels = dbot.config.servers[server].channels; _.each(channels, function(channel) { - this.api.ban(server, banee, channel); - this.api.kick(server, banee, channel, reason + - ' (network-wide ban requested by ' + banner + ')'); + setTimeout(function(channel) { + this.api.ban(server, banee, channel); + this.api.kick(server, banee, channel, reason + + ' (network-wide ban requested by ' + banner + ')'); + }, 1000); }, this); var notifyString = dbot.t('nbanned', { From 50801f7afb8da148423646095bacc65d982c1c9c Mon Sep 17 00:00:00 2001 From: reality Date: Wed, 5 Jun 2013 18:09:11 +0000 Subject: [PATCH 4/8] forgot the bind.. --- 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 85ca5aa..0707a2d 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -52,7 +52,7 @@ var commands = function(dbot) { this.api.ban(server, banee, channel); this.api.kick(server, banee, channel, reason + ' (network-wide ban requested by ' + banner + ')'); - }, 1000); + }.bind(this), 1000); }, this); var notifyString = dbot.t('nbanned', { From bff59d34247ca295ac9316e271427b372ad66da4 Mon Sep 17 00:00:00 2001 From: reality Date: Wed, 5 Jun 2013 18:13:39 +0000 Subject: [PATCH 5/8] channels in function loop --- modules/kick/commands.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/kick/commands.js b/modules/kick/commands.js index 0707a2d..fc7fe1b 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -47,13 +47,18 @@ var commands = function(dbot) { reason = event.input[2], channels = dbot.config.servers[server].channels; - _.each(channels, function(channel) { - setTimeout(function(channel) { - this.api.ban(server, banee, channel); - this.api.kick(server, banee, channel, reason + - ' (network-wide ban requested by ' + banner + ')'); - }.bind(this), 1000); - }, this); + var i = 0; + var banChannel = function(channels) { + if(i >= channels.length) return; + var channel = channels[i]; + this.api.ban(server, banee, channel); + this.api.kick(server, banee, channel, reason + + ' (network-wide ban requested by ' + banner + ')'); + setTimeout(function(channels) { + i++; banChannel(channels); + }, 1000); + } + banChannel(channels); var notifyString = dbot.t('nbanned', { 'banner': banner, From e03be0f7d6279aa7ca229216880bc379cfd54a02 Mon Sep 17 00:00:00 2001 From: reality Date: Wed, 5 Jun 2013 18:15:51 +0000 Subject: [PATCH 6/8] forgot the bind again, reality pls --- 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 fc7fe1b..7fa1e75 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -57,7 +57,7 @@ var commands = function(dbot) { setTimeout(function(channels) { i++; banChannel(channels); }, 1000); - } + }.bind(this); banChannel(channels); var notifyString = dbot.t('nbanned', { From a93b5adbb85e1ba04acb28444b5eed7a1477204e Mon Sep 17 00:00:00 2001 From: reality Date: Wed, 5 Jun 2013 18:19:38 +0000 Subject: [PATCH 7/8] extra param knocked out scope --- 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 7fa1e75..29df25f 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -54,7 +54,7 @@ var commands = function(dbot) { this.api.ban(server, banee, channel); this.api.kick(server, banee, channel, reason + ' (network-wide ban requested by ' + banner + ')'); - setTimeout(function(channels) { + setTimeout(function() { i++; banChannel(channels); }, 1000); }.bind(this); From 8805c7e08169305984990fcf51b7cdce5bf186a6 Mon Sep 17 00:00:00 2001 From: reality Date: Wed, 5 Jun 2013 20:10:17 +0000 Subject: [PATCH 8/8] looks like one of the , was . in command.strings --- modules/command/strings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/command/strings.json b/modules/command/strings.json index 40f6a6a..3f531b1 100644 --- a/modules/command/strings.json +++ b/modules/command/strings.json @@ -19,7 +19,7 @@ "en": "Usage for {command}: {usage}.", "na'vi": "Nga tsun sivar ìlä {command}: {usage}.", "cy": "Defnydd o {command}: {usage}.", - "nl": "{command} wordt op de volgende manier gebruikt: {usage}.". + "nl": "{command} wordt op de volgende manier gebruikt: {usage}.", "de": "Benutzung von {command}: [usage}." }, "no_usage_info": {