mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-26 13:59:47 +01:00
Add invite
command
This commit is contained in:
parent
b4f63a0be4
commit
54e75d934b
@ -48,6 +48,29 @@ sub initialize {
|
||||
$pbot->{commands}->register(sub { return $self->checkban(@_) }, "checkban", 0);
|
||||
$pbot->{commands}->register(sub { return $self->checkmute(@_) }, "checkmute", 0);
|
||||
$pbot->{commands}->register(sub { return $self->mode(@_) }, "mode", 40);
|
||||
$pbot->{commands}->register(sub { return $self->invite(@_) }, "invite", 10);
|
||||
}
|
||||
|
||||
sub invite {
|
||||
my ($self, $from, $nick, $user, $host, $arguments, $stuff) = @_;
|
||||
|
||||
if (not length $arguments) {
|
||||
return "Usage: invite [channel] <nick>";
|
||||
}
|
||||
|
||||
# add current channel as default channel
|
||||
if ($stuff->{arglist}[0] !~ m/^#/) {
|
||||
if ($from =~ m/^#/) {
|
||||
unshift @{$stuff->{arglist}}, $from;
|
||||
} else {
|
||||
return "Usage from private message: invite <channel> <nick>";
|
||||
}
|
||||
}
|
||||
|
||||
my ($channel, $target) = $self->{pbot}->{interpreter}->split_args($stuff->{arglist}, 2);
|
||||
$self->{pbot}->{chanops}->add_op_command($channel, "sl invite $target $channel");
|
||||
$self->{pbot}->{chanops}->gain_ops($channel);
|
||||
return "";
|
||||
}
|
||||
|
||||
sub mode {
|
||||
|
@ -126,6 +126,9 @@ sub perform_op_commands {
|
||||
} elsif ($command =~ /^kick (.*?) (.*?) (.*)/i) {
|
||||
$self->{pbot}->{conn}->kick($1, $2, $3) unless $1 =~ /\Q$botnick\E/i;
|
||||
$self->{pbot}->{logger}->log(" executing kick on $1 $2 $3\n");
|
||||
} elsif ($command =~ /^sl (.*)/i) {
|
||||
$self->{pbot}->{conn}->sl($1);
|
||||
$self->{pbot}->{logger}->log(" executing sl $1\n");
|
||||
}
|
||||
}
|
||||
$self->{pbot}->{logger}->log("Done.\n");
|
||||
|
Loading…
Reference in New Issue
Block a user