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." } }