3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-03 02:29:32 +01:00

login command now accepts optional channel argument

This commit is contained in:
Pragmatic Software 2017-11-03 12:27:59 -07:00
parent c1f57d5839
commit 9e24f43ff7

View File

@ -65,12 +65,22 @@ sub sl {
sub login { sub login {
my $self = shift; my $self = shift;
my ($from, $nick, $user, $host, $arguments) = @_; my ($from, $nick, $user, $host, $arguments) = @_;
my $channel = $from;
if($self->{pbot}->{admins}->loggedin($from, "$nick!$user\@$host")) { if (not $arguments) {
return "/msg $nick You are already logged into channel $from."; return "Usage: login [channel] password";
} }
my $result = $self->{pbot}->{admins}->login($from, "$nick!$user\@$host", $arguments); if ($arguments =~ m/^([^ ]+)\s+(.+)/) {
$channel = $1;
$arguments = $2;
}
if($self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host")) {
return "/msg $nick You are already logged into channel $channel.";
}
my $result = $self->{pbot}->{admins}->login($channel, "$nick!$user\@$host", $arguments);
return "/msg $nick $result"; return "/msg $nick $result";
} }