3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 22:09:26 +01:00

unban command can now take comma-separated list of targets; can also opt to use unban queue or not

This commit is contained in:
Pragmatic Software 2017-11-08 11:11:43 -08:00
parent 34fee863e0
commit 7e9c116712

View File

@ -106,13 +106,14 @@ sub unban_user {
return ""; return "";
} }
my ($target, $channel) = split /\s+/, $arguments; my ($target, $channel, $immediately) = split /\s+/, $arguments;
if(not defined $target) { if(not defined $target) {
return "/msg $nick Usage: unban <mask> [channel]"; return "/msg $nick Usage: unban <mask> [channel]";
} }
$channel = $from if not defined $channel; $channel = $from if not defined $channel;
$immediately = 1 if not defined $immediately;
return "/msg $nick Usage for /msg: unban <nick/mask> <channel>" if $channel !~ /^#/; return "/msg $nick Usage for /msg: unban <nick/mask> <channel>" if $channel !~ /^#/;
@ -120,7 +121,13 @@ sub unban_user {
return "/msg $nick You are not an admin for $channel."; return "/msg $nick You are not an admin for $channel.";
} }
$self->{pbot}->{chanops}->unban_user($target, $channel, 1); my @targets = split /,/, $target;
$immediately = 0 if @targets > 2;
foreach my $t (@targets) {
$self->{pbot}->{chanops}->unban_user($t, $channel, $immediately);
}
return "/msg $nick $target has been unbanned from $channel."; return "/msg $nick $target has been unbanned from $channel.";
} }