mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-22 11:59:43 +01:00
Update Plang submodule and plugin
This commit is contained in:
parent
e73f2127d4
commit
b63006f9a6
2
Plang
2
Plang
@ -1 +1 @@
|
||||
Subproject commit 56528a5f36e2a60d773f52e73554504cf51b70ce
|
||||
Subproject commit 3e99c6f7b3d30e5a45c92e171fc329c91d7e25e2
|
@ -47,7 +47,9 @@ sub initialize {
|
||||
[['TYPE', 'String'], 'text', undef]
|
||||
],
|
||||
['TYPE', 'String'], # return type
|
||||
sub { $self->plang_builtin_factset(@_) });
|
||||
sub { $self->plang_builtin_factset(@_) },
|
||||
sub { $self->plang_validate_builtin_factset(@_) }
|
||||
);
|
||||
|
||||
$self->{plang}->add_builtin_function('factget',
|
||||
[
|
||||
@ -56,7 +58,9 @@ sub initialize {
|
||||
[['TYPE', 'String'], 'meta', [['TYPE', 'String'], 'action']]
|
||||
],
|
||||
['TYPE', 'String'],
|
||||
sub { $self->plang_builtin_factget(@_) });
|
||||
sub { $self->plang_builtin_factget(@_) },
|
||||
sub { $self->plang_validate_builtin_factget(@_) },
|
||||
);
|
||||
|
||||
$self->{plang}->add_builtin_function('factappend',
|
||||
[
|
||||
@ -65,14 +69,18 @@ sub initialize {
|
||||
[['TYPE', 'String'], 'text', undef]
|
||||
],
|
||||
['TYPE', 'String'],
|
||||
sub { $self->plang_builtin_factappend(@_) });
|
||||
sub { $self->plang_builtin_factappend(@_) },
|
||||
sub { $self->plang_validate_builtin_factappend(@_) },
|
||||
);
|
||||
|
||||
$self->{plang}->add_builtin_function('userget',
|
||||
[
|
||||
[['TYPE', 'String'], 'name', undef]
|
||||
],
|
||||
['TYPELIST', [['TYPE', 'Map'], ['TYPE', 'Null']]],
|
||||
sub { $self->plang_builtin_userget(@_) });
|
||||
sub { $self->plang_builtin_userget(@_) },
|
||||
sub { $self->plang_validate_builtin_userget(@_) },
|
||||
);
|
||||
|
||||
# override the built-in `print` function to send to our output buffer instead
|
||||
$self->{plang}->add_builtin_function('print',
|
||||
@ -81,7 +89,9 @@ sub initialize {
|
||||
[['TYPE', 'String'], 'end', [['TYPE', 'String'], "\n"]]
|
||||
],
|
||||
['TYPE', 'Null'],
|
||||
sub { $self->plang_builtin_print(@_) });
|
||||
sub { $self->plang_builtin_print(@_) },
|
||||
sub { $self->plang_validate_builtin_print(@_) },
|
||||
);
|
||||
|
||||
# register the `plang` command
|
||||
$self->{pbot}->{commands}->register(sub { $self->cmd_plang(@_) }, "plang", 0);
|
||||
@ -151,6 +161,10 @@ sub plang_builtin_print {
|
||||
return [['TYPE', 'Null'], undef];
|
||||
}
|
||||
|
||||
sub plang_validate_builtin_print {
|
||||
return [['TYPE', 'Null'], undef];
|
||||
}
|
||||
|
||||
# our custom PBot built-in functions for Plang
|
||||
|
||||
sub is_locked {
|
||||
@ -165,6 +179,10 @@ sub plang_builtin_factget {
|
||||
return [['TYPE', 'String'], $result];
|
||||
}
|
||||
|
||||
sub plang_validate_builtin_factget {
|
||||
return [['TYPE', 'String'], ""];
|
||||
}
|
||||
|
||||
sub plang_builtin_factset {
|
||||
my ($self, $plang, $context, $name, $arguments) = @_;
|
||||
my ($channel, $keyword, $text) = ($arguments->[0]->[1], $arguments->[1]->[1], $arguments->[2]->[1]);
|
||||
@ -173,6 +191,10 @@ sub plang_builtin_factset {
|
||||
return [['TYPE', 'String'], $text];
|
||||
}
|
||||
|
||||
sub plang_validate_builtin_factset {
|
||||
return [['TYPE', 'String'], ""];
|
||||
}
|
||||
|
||||
sub plang_builtin_factappend {
|
||||
my ($self, $plang, $context, $name, $arguments) = @_;
|
||||
my ($channel, $keyword, $text) = ($arguments->[0]->[1], $arguments->[1]->[1], $arguments->[2]->[1]);
|
||||
@ -184,6 +206,10 @@ sub plang_builtin_factappend {
|
||||
return [['TYPE', 'String'], $action];
|
||||
}
|
||||
|
||||
sub plang_validate_builtin_factappend {
|
||||
return [['TYPE', 'String'], ""];
|
||||
}
|
||||
|
||||
sub plang_builtin_userget {
|
||||
my ($self, $plang, $context, $name, $arguments) = @_;
|
||||
my ($username) = ($arguments->[0], $arguments->[1]);
|
||||
@ -204,4 +230,8 @@ sub plang_builtin_userget {
|
||||
return [['TYPE', 'Map'], $hash];
|
||||
}
|
||||
|
||||
sub plang_validate_builtin_userget {
|
||||
return [['TYPE', 'Map'], {}];
|
||||
}
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user