3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-25 12:12:34 +01:00

Allow kicking from private message

This commit is contained in:
Pragmatic Software 2014-04-19 10:35:27 +00:00
parent b3ab3bae8f
commit 030fed38f2
2 changed files with 14 additions and 5 deletions

View File

@ -100,15 +100,24 @@ sub kick_user {
return ""; return "";
} }
# used in private message
if(not $from =~ /^#/) { if(not $from =~ /^#/) {
$self->{pbot}->logger->log("$nick!$user\@$host attempted to /msg kick\n"); if(not $arguments =~ /(^#\S+) (\S+) (.*)/) {
return "/msg $nick Kick must be used in the channel."; $self->{pbot}->logger->log("$nick!$user\@$host: invalid arguments to kick\n");
return "/msg $nick Usage from private message: kick <channel> <nick> <reason>";
} }
$self->{pbot}->chanops->add_op_command($1, "kick $1 $2 $3");
$self->{pbot}->chanops->gain_ops($1);
return "/msg $nick Kicking $2 from $1 with reason '$3'";
}
# used in channel
if(not $arguments =~ /(.*?) (.*)/) { if(not $arguments =~ /(.*?) (.*)/) {
$self->{pbot}->logger->log("$nick!$user\@$host: invalid arguments to kick\n"); $self->{pbot}->logger->log("$nick!$user\@$host: invalid arguments to kick\n");
return "/msg $nick Usage: !kick <nick> <reason>"; return "/msg $nick Usage: kick <nick> <reason>";
} }
unshift @{ $self->{pbot}->chanops->{op_commands}->{$from} }, "kick $from $1 $2";
$self->{pbot}->chanops->add_op_command($from, "kick $from $1 $2");
$self->{pbot}->chanops->gain_ops($from); $self->{pbot}->chanops->gain_ops($from);
} }

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script # These are set automatically by the build/commit script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 545, BUILD_REVISION => 546,
BUILD_DATE => "2014-04-19", BUILD_DATE => "2014-04-19",
}; };