mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-23 04:19:27 +01:00
Modify the syntax of the kick command (#10)
* Modify the syntax of the kick command * Modify the syntax of the kick command * Beautify helpful comment
This commit is contained in:
parent
efe5d838f7
commit
250337927b
@ -233,15 +233,23 @@ sub kick_user {
|
||||
($channel, $victim) = ($1, $2);
|
||||
} else {
|
||||
# used in channel
|
||||
if(not $arguments =~ s/^(\S+)\s*//) {
|
||||
return "/msg $nick Usage: kick <nick> [reason]";
|
||||
if ($arguments =~ s/^(#\S+)\s+(\S+)\s*//) {
|
||||
($channel, $victim) = ($1, $2);
|
||||
} elsif ($arguments =~ s/^(\S+)\s*//) {
|
||||
($victim, $channel) = ($1, $from);
|
||||
} else {
|
||||
return "/msg $nick Usage: kick [channel] <nick> [reason]";
|
||||
}
|
||||
$victim = $1;
|
||||
$channel = $from;
|
||||
}
|
||||
|
||||
$reason = $arguments;
|
||||
|
||||
# If the user is too stupid to remember the order of the arguments,
|
||||
# we can help them out by seeing if they put the channel in the reason.
|
||||
if ($reason =~ s/^(#\S+)\s*//) {
|
||||
$channel = $1;
|
||||
}
|
||||
|
||||
if (not length $reason) {
|
||||
if (open my $fh, '<', $self->{pbot}->{registry}->get_value('general', 'module_dir') . '/insults.txt') {
|
||||
my @insults = <$fh>;
|
||||
@ -259,6 +267,7 @@ sub kick_user {
|
||||
|
||||
$self->{pbot}->{chanops}->add_op_command($channel, "kick $channel $victim $reason");
|
||||
$self->{pbot}->{chanops}->gain_ops($channel);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user