mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-19 10:29:30 +01:00
ChanOpCommands: add mode
command (level 40)
This commit is contained in:
parent
824999b98a
commit
a7866c1250
@ -47,6 +47,31 @@ sub initialize {
|
|||||||
$pbot->{commands}->register(sub { return $self->kick_user(@_) }, "kick", 10);
|
$pbot->{commands}->register(sub { return $self->kick_user(@_) }, "kick", 10);
|
||||||
$pbot->{commands}->register(sub { return $self->checkban(@_) }, "checkban", 0);
|
$pbot->{commands}->register(sub { return $self->checkban(@_) }, "checkban", 0);
|
||||||
$pbot->{commands}->register(sub { return $self->checkmute(@_) }, "checkmute", 0);
|
$pbot->{commands}->register(sub { return $self->checkmute(@_) }, "checkmute", 0);
|
||||||
|
$pbot->{commands}->register(sub { return $self->mode(@_) }, "mode", 40);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub mode {
|
||||||
|
my ($self, $from, $nick, $user, $host, $arguments, $stuff) = @_;
|
||||||
|
|
||||||
|
if (not length $arguments) {
|
||||||
|
return "Usage: mode [channel] <arguments>";
|
||||||
|
}
|
||||||
|
|
||||||
|
# add current channel as default channel
|
||||||
|
if ($stuff->{arglist}[0] !~ m/^#/) {
|
||||||
|
if ($from =~ m/^#/) {
|
||||||
|
unshift @{$stuff->{arglist}}, $from;
|
||||||
|
} else {
|
||||||
|
return "Usage from private message: mode <channel> <arguments>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my ($channel, $args) = $self->{pbot}->{interpreter}->split_args($stuff->{arglist}, 2);
|
||||||
|
$self->{pbot}->{conn}->mode($channel, $args);
|
||||||
|
|
||||||
|
if ($from !~ m/^#/) {
|
||||||
|
return "Done.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub checkban {
|
sub checkban {
|
||||||
|
Loading…
Reference in New Issue
Block a user