mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-23 11:12:42 +01:00
Commands now check for execute-process
metadata
This commit is contained in:
parent
7d2a746c2c
commit
2ce5f8688d
@ -121,11 +121,21 @@ sub interpreter {
|
||||
}
|
||||
|
||||
$stuff->{no_nickoverride} = 1;
|
||||
my $result = &{ $ref->{subref} }($stuff->{from}, $stuff->{nick}, $stuff->{user}, $stuff->{host}, $stuff->{arguments}, $stuff);
|
||||
if ($self->get_meta($keyword, 'execute-process')) {
|
||||
my $timeout = $self->{pbot}->{registry}->get_value('processmanager', 'default_timeout');
|
||||
$self->{pbot}->{process_manager}->execute_process(
|
||||
$stuff,
|
||||
sub { $stuff->{result} = $ref->{subref}->($stuff->{from}, $stuff->{nick}, $stuff->{user}, $stuff->{host}, $stuff->{arguments}, $stuff) },
|
||||
$timeout
|
||||
);
|
||||
return "";
|
||||
} else {
|
||||
my $result = $ref->{subref}->($stuff->{from}, $stuff->{nick}, $stuff->{user}, $stuff->{host}, $stuff->{arguments}, $stuff);
|
||||
return undef if $stuff->{referenced} and $result =~ m/(?:usage:|no results)/i;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
@ -99,8 +99,7 @@ sub wttrcmd {
|
||||
delete $options{default};
|
||||
}
|
||||
|
||||
$self->{pbot}->{process_manager}->execute_process($stuff, sub { $stuff->{result} = $self->get_wttr($arguments, %options) });
|
||||
return "";
|
||||
return $self->get_wttr($arguments, %options);
|
||||
}
|
||||
|
||||
sub get_wttr {
|
||||
|
4
data/commands
vendored
4
data/commands
vendored
@ -175,6 +175,7 @@
|
||||
},
|
||||
"export" : {
|
||||
"_name" : "export",
|
||||
"execute-process" : "1",
|
||||
"help" : "Exports specified list to HTML file. See https://github.com/pragma-/pbot/blob/master/doc/Admin.md#export",
|
||||
"requires_cap" : 1
|
||||
},
|
||||
@ -400,6 +401,7 @@
|
||||
},
|
||||
"recall" : {
|
||||
"_name" : "recall",
|
||||
"execute-process" : "1",
|
||||
"help" : "Recalls previous chat history for a channel. See https://github.com/pragma-/pbot/blob/master/doc/Commands.md#recall",
|
||||
"requires_cap" : 0
|
||||
},
|
||||
@ -562,11 +564,13 @@
|
||||
},
|
||||
"weather" : {
|
||||
"_name" : "weather",
|
||||
"execute-process" : "1",
|
||||
"help" : "Fetches and displays weather data. You may set `!my location ...` to remember your location.",
|
||||
"requires_cap" : 0
|
||||
},
|
||||
"wttr" : {
|
||||
"_name" : "wttr",
|
||||
"execute-process" : "1",
|
||||
"help" : "",
|
||||
"requires_cap" : "0"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user