~notify command

This commit is contained in:
reality 2013-06-02 13:34:51 +00:00
parent 71b9e482c1
commit 17070adcb6
3 changed files with 30 additions and 0 deletions

View File

@ -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 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 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. 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.

View File

@ -43,9 +43,29 @@ var report = function(dbot) {
} else { } else {
event.reply(dbot.t('not_in_channel', { 'channel': channelName })); 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['~report'].regex = [/^~report ([^ ]+) ([^ ]+) (.+)$/, 4];
commands['~notify'].regex = [/^~notify ([^ ]+) (.+)$/, 3];
this.commands = commands; this.commands = commands;
}; };

View File

@ -26,5 +26,11 @@
"cy": "Dydw i ddim yn bresennol yn {channel}.", "cy": "Dydw i ddim yn bresennol yn {channel}.",
"nl": "Ik ben niet aanwezig in {channel}.", "nl": "Ik ben niet aanwezig in {channel}.",
"de": "Ich bin nicht in {channel} aktiv." "de": "Ich bin nicht in {channel} aktiv."
},
"notify": {
"en": "Attention {channel}: {notifier}: {message}"
},
"notified": {
"en": "{user}: {channel} staff notified."
} }
} }