mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 11:42:35 +01:00
Rename as
to in
This commit is contained in:
parent
e5bea54ecd
commit
263366bdfa
@ -41,7 +41,7 @@ sub initialize {
|
||||
|
||||
$pbot->{commands}->register(sub { return $self->login(@_) }, "login", 0);
|
||||
$pbot->{commands}->register(sub { return $self->logout(@_) }, "logout", 0);
|
||||
$pbot->{commands}->register(sub { return $self->as_admin(@_) }, "as", 0);
|
||||
$pbot->{commands}->register(sub { return $self->in_channel(@_) }, "in", 1);
|
||||
$pbot->{commands}->register(sub { return $self->join_channel(@_) }, "join", 40);
|
||||
$pbot->{commands}->register(sub { return $self->part_channel(@_) }, "part", 40);
|
||||
$pbot->{commands}->register(sub { return $self->ack_die(@_) }, "die", 90);
|
||||
@ -63,10 +63,10 @@ sub sl {
|
||||
return "";
|
||||
}
|
||||
|
||||
sub as_admin {
|
||||
sub in_channel {
|
||||
my ($self, $from, $nick, $user, $host, $arguments, $stuff) = @_;
|
||||
|
||||
my $usage = "Usage: as <channel> <command>";
|
||||
my $usage = "Usage: in <channel> <command>";
|
||||
|
||||
if (not $arguments) {
|
||||
return $usage;
|
||||
@ -75,7 +75,7 @@ sub as_admin {
|
||||
my ($channel, $command) = split / /, $arguments, 2;
|
||||
return $usage if not defined $channel or not defined $command;
|
||||
|
||||
$stuff->{as_admin} = $channel;
|
||||
$stuff->{admin_channel_override} = $channel;
|
||||
$stuff->{command} = $command;
|
||||
return $self->{pbot}->{interpreter}->interpret($stuff);
|
||||
}
|
||||
|
@ -62,10 +62,10 @@ sub ban_user {
|
||||
if ($channel !~ m/^#/) {
|
||||
$length = "$channel $length";
|
||||
$length = undef if $length eq ' ';
|
||||
$channel = exists $stuff->{as_admin} ? $stuff->{as_admin} : $from;
|
||||
$channel = exists $stuff->{admin_channel_override} ? $stuff->{admin_channel_override} : $from;
|
||||
}
|
||||
|
||||
$channel = exists $stuff->{as_admin} ? $stuff->{as_admin} : $from if not defined $channel or not length $channel;
|
||||
$channel = exists $stuff->{admin_channel_override} ? $stuff->{admin_channel_override} : $from if not defined $channel or not length $channel;
|
||||
|
||||
if (not defined $target) {
|
||||
return "/msg $nick Usage: ban <mask> [channel [timeout (default: 24 hours)]]";
|
||||
@ -112,7 +112,7 @@ sub unban_user {
|
||||
return "/msg $nick Usage: unban <mask> [[channel] [false value to use unban queue]]";
|
||||
}
|
||||
|
||||
$channel = exists $stuff->{as_admin} ? $stuff->{as_admin} : $from if not defined $channel;
|
||||
$channel = exists $stuff->{admin_channel_override} ? $stuff->{admin_channel_override} : $from if not defined $channel;
|
||||
$immediately = 1 if not defined $immediately;
|
||||
|
||||
return "/msg $nick Usage for /msg: unban <nick/mask> <channel> [true value to use unban queue]" if $channel !~ /^#/;
|
||||
@ -148,10 +148,10 @@ sub mute_user {
|
||||
if ($channel !~ m/^#/) {
|
||||
$length = "$channel $length";
|
||||
$length = undef if $length eq ' ';
|
||||
$channel = exists $stuff->{as_admin} ? $stuff->{as_admin} : $from;
|
||||
$channel = exists $stuff->{admin_channel_override} ? $stuff->{admin_channel_override} : $from;
|
||||
}
|
||||
|
||||
$channel = exists $stuff->{as_admin} ? $stuff->{as_admin} : $from if not defined $channel;
|
||||
$channel = exists $stuff->{admin_channel_override} ? $stuff->{admin_channel_override} : $from if not defined $channel;
|
||||
|
||||
if ($channel !~ m/^#/) {
|
||||
return "/msg $nick Please specify a channel.";
|
||||
@ -202,7 +202,7 @@ sub unmute_user {
|
||||
return "/msg $nick Usage: unmute <mask> [channel]";
|
||||
}
|
||||
|
||||
$channel = exists $stuff->{as_admin} ? $stuff->{as_admin} : $from if not defined $channel;
|
||||
$channel = exists $stuff->{admin_channel_override} ? $stuff->{admin_channel_override} : $from if not defined $channel;
|
||||
|
||||
return "/msg $nick Usage for /msg: unmute <mask> <channel>" if $channel !~ /^#/;
|
||||
|
||||
@ -236,7 +236,7 @@ sub kick_user {
|
||||
if ($arguments =~ s/^(#\S+)\s+(\S+)\s*//) {
|
||||
($channel, $victim) = ($1, $2);
|
||||
} elsif ($arguments =~ s/^(\S+)\s*//) {
|
||||
($victim, $channel) = ($1, exists $stuff->{as_admin} ? $stuff->{as_admin} : $from);
|
||||
($victim, $channel) = ($1, exists $stuff->{admin_channel_override} ? $stuff->{admin_channel_override} : $from);
|
||||
} else {
|
||||
return "/msg $nick Usage: kick [channel] <nick> [reason]";
|
||||
}
|
||||
|
@ -98,7 +98,8 @@ sub interpreter {
|
||||
$self->{pbot}->{logger}->log(Dumper $stuff);
|
||||
}
|
||||
|
||||
my $admin = $self->{pbot}->{admins}->loggedin($stuff->{from}, "$stuff->{nick}!$stuff->{user}\@$stuff->{host}");
|
||||
my $from = exists $stuff->{admin_channel_override} ? $stuff->{admin_channel_override} : $stuff->{from};
|
||||
my $admin = $self->{pbot}->{admins}->loggedin($from, "$stuff->{nick}!$stuff->{user}\@$stuff->{host}");
|
||||
my $level = defined $admin ? $admin->{level} : 0;
|
||||
my $keyword = lc $stuff->{keyword};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user