mirror of
https://github.com/pragma-/pbot.git
synced 2025-05-02 20:57:28 +02:00
Factoids: add usage
metadata to show usage message if no arguments supplied
This commit is contained in:
parent
63b523dbc7
commit
f87e3c7cd8
@ -945,6 +945,11 @@ sub interpreter {
|
|||||||
|
|
||||||
if ($action =~ m{^/code\s+([^\s]+)\s+(.+)$}i) {
|
if ($action =~ m{^/code\s+([^\s]+)\s+(.+)$}i) {
|
||||||
my ($lang, $code) = ($1, $2);
|
my ($lang, $code) = ($1, $2);
|
||||||
|
|
||||||
|
if (exists $self->{factoids}->hash->{$channel}->{$keyword}->{usage} and not length $stuff->{arguments}) {
|
||||||
|
return $self->{factoids}->hash->{$channel}->{$keyword}->{usage};
|
||||||
|
}
|
||||||
|
|
||||||
$stuff->{lang} = $lang;
|
$stuff->{lang} = $lang;
|
||||||
$stuff->{code} = $code;
|
$stuff->{code} = $code;
|
||||||
$self->execute_code_factoid($stuff);
|
$self->execute_code_factoid($stuff);
|
||||||
@ -1007,10 +1012,14 @@ sub handle_action {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
# no arguments supplied, replace $args with $nick/$tonick, etc
|
# no arguments supplied, replace $args with $nick/$tonick, etc
|
||||||
if ($self->{factoids}->hash->{$channel}->{$keyword}->{'allow_empty_args'}) {
|
if (exists $self->{factoids}->hash->{$channel}->{$keyword}->{usage}) {
|
||||||
$action = $self->expand_action_arguments($action, undef, '');
|
$action = "/say " . $self->{factoids}->hash->{$channel}->{$keyword}->{usage};
|
||||||
} else {
|
} else {
|
||||||
$action = $self->expand_action_arguments($action, undef, $stuff->{nick});
|
if ($self->{factoids}->hash->{$channel}->{$keyword}->{'allow_empty_args'}) {
|
||||||
|
$action = $self->expand_action_arguments($action, undef, '');
|
||||||
|
} else {
|
||||||
|
$action = $self->expand_action_arguments($action, undef, $stuff->{nick});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$stuff->{no_nickoverride} = 0;
|
$stuff->{no_nickoverride} = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user