mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-30 07:49:38 +01:00
Plugins: add replug
command
This commit is contained in:
parent
3c3a96461e
commit
207fcba402
@ -36,9 +36,8 @@ sub initialize {
|
||||
|
||||
$self->{pbot}->{commands}->register(sub { $self->load_cmd(@_) }, "plug", 90);
|
||||
$self->{pbot}->{commands}->register(sub { $self->unload_cmd(@_) }, "unplug", 90);
|
||||
$self->{pbot}->{commands}->register(sub { $self->reload_cmd(@_) }, "replug", 90);
|
||||
$self->{pbot}->{commands}->register(sub { $self->list_cmd(@_) }, "pluglist", 0);
|
||||
|
||||
$self->autoload(%conf);
|
||||
}
|
||||
|
||||
sub autoload {
|
||||
@ -119,6 +118,22 @@ sub unload {
|
||||
}
|
||||
}
|
||||
|
||||
sub reload_cmd {
|
||||
my ($self, $from, $nick, $user, $host, $arguments) = @_;
|
||||
|
||||
if (not length $arguments) {
|
||||
return "Usage: replug <plugin>";
|
||||
}
|
||||
|
||||
my $unload_result = $self->unload_cmd($from, $nick, $user, $host, $arguments);
|
||||
my $load_result = $self->load_cmd($from, $nick, $user, $host, $arguments);
|
||||
|
||||
my $result = "";
|
||||
$result .= "$unload_result " if $unload_result =~ m/^Unloaded/;
|
||||
$result .= $load_result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub load_cmd {
|
||||
my ($self, $from, $nick, $user, $host, $arguments) = @_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user