3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-04 18:38:47 +02:00

Can now kick comma-separated nicks

This commit is contained in:
Pragmatic Software 2017-11-11 12:59:27 -08:00
parent 7b4d9cc4cc
commit 8997534ce6

View File

@ -250,22 +250,31 @@ sub kick_user {
$channel = $1;
}
if (not $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host")) {
return "/msg $nick You are not an admin for $channel.";
}
my @insults;
if (not length $reason) {
if (open my $fh, '<', $self->{pbot}->{registry}->get_value('general', 'module_dir') . '/insults.txt') {
my @insults = <$fh>;
@insults = <$fh>;
close $fh;
$reason = $insults[rand @insults];
chomp $reason;
$reason =~ s/\s+$//;
} else {
$reason = 'Bye!';
}
}
if (not $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host")) {
return "/msg $nick You are not an admin for $channel.";
my @nicks = split /,/, $victim;
foreach my $n (@nicks) {
$self->{pbot}->{chanops}->add_op_command($channel, "kick $channel $n $reason");
if (@insults) {
$reason = $insults[rand @insults];
$reason =~ s/\s+$//;
}
}
$self->{pbot}->{chanops}->add_op_command($channel, "kick $channel $victim $reason");
$self->{pbot}->{chanops}->gain_ops($channel);
return "";