This commit is contained in:
reality 2014-02-04 00:58:09 +00:00
parent 27f26da0e5
commit 1751c197b6
2 changed files with 7 additions and 3 deletions

View File

@ -13,10 +13,14 @@ var commands = function(dbot) {
}, },
'~report': function(event) { '~report': function(event) {
var channelName = event.input[1], var channelName = (event.input[1] || event.channel),
nick = event.input[2], nick = event.input[2],
reason = event.input[3].trim(); reason = event.input[3].trim();
if(channelName == event.user) {
channelName = dbot.config.servers[event.server].admin_channel;
}
if(reason.charAt(reason.length - 1) != '.') reason += '.'; if(reason.charAt(reason.length - 1) != '.') reason += '.';
dbot.api.users.resolveUser(event.server, nick, function(reportee) { dbot.api.users.resolveUser(event.server, nick, function(reportee) {
@ -124,7 +128,7 @@ var commands = function(dbot) {
}.bind(this)); }.bind(this));
} }
}; };
commands['~report'].regex = [/^report ([^ ]+) ([^ ]+) (.+)$/, 4]; commands['~report'].regex = /^report (#[^ ]+ )?([^ ]+) (.*)$/;
commands['~notify'].regex = [/^notify ([^ ]+) (.+)$/, 3]; commands['~notify'].regex = [/^notify ([^ ]+) (.+)$/, 3];
commands['~nunsub'].regex = [/^nunsub ([^ ]+)$/, 2]; commands['~nunsub'].regex = [/^nunsub ([^ ]+)$/, 2];
commands['~ununsub'].regex = [/^ununsub ([^ ]+)$/, 2]; commands['~ununsub'].regex = [/^ununsub ([^ ]+)$/, 2];

View File

@ -1,4 +1,4 @@
{ {
"~report": "~report [#channel] [username] [reason for reporting]", "~report": "~report ([#channel]) [username] [reason for reporting]",
"~notify": "~notify [#channel] [message]" "~notify": "~notify [#channel] [message]"
} }