3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 13:59:47 +01:00

Update Plang submodule and plugin

This commit is contained in:
Pragmatic Software 2020-08-24 20:46:34 -07:00
parent e73f2127d4
commit b63006f9a6
2 changed files with 36 additions and 6 deletions

2
Plang

@ -1 +1 @@
Subproject commit 56528a5f36e2a60d773f52e73554504cf51b70ce Subproject commit 3e99c6f7b3d30e5a45c92e171fc329c91d7e25e2

View File

@ -47,7 +47,9 @@ sub initialize {
[['TYPE', 'String'], 'text', undef] [['TYPE', 'String'], 'text', undef]
], ],
['TYPE', 'String'], # return type ['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', $self->{plang}->add_builtin_function('factget',
[ [
@ -56,7 +58,9 @@ sub initialize {
[['TYPE', 'String'], 'meta', [['TYPE', 'String'], 'action']] [['TYPE', 'String'], 'meta', [['TYPE', 'String'], 'action']]
], ],
['TYPE', 'String'], ['TYPE', 'String'],
sub { $self->plang_builtin_factget(@_) }); sub { $self->plang_builtin_factget(@_) },
sub { $self->plang_validate_builtin_factget(@_) },
);
$self->{plang}->add_builtin_function('factappend', $self->{plang}->add_builtin_function('factappend',
[ [
@ -65,14 +69,18 @@ sub initialize {
[['TYPE', 'String'], 'text', undef] [['TYPE', 'String'], 'text', undef]
], ],
['TYPE', 'String'], ['TYPE', 'String'],
sub { $self->plang_builtin_factappend(@_) }); sub { $self->plang_builtin_factappend(@_) },
sub { $self->plang_validate_builtin_factappend(@_) },
);
$self->{plang}->add_builtin_function('userget', $self->{plang}->add_builtin_function('userget',
[ [
[['TYPE', 'String'], 'name', undef] [['TYPE', 'String'], 'name', undef]
], ],
['TYPELIST', [['TYPE', 'Map'], ['TYPE', 'Null']]], ['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 # override the built-in `print` function to send to our output buffer instead
$self->{plang}->add_builtin_function('print', $self->{plang}->add_builtin_function('print',
@ -81,7 +89,9 @@ sub initialize {
[['TYPE', 'String'], 'end', [['TYPE', 'String'], "\n"]] [['TYPE', 'String'], 'end', [['TYPE', 'String'], "\n"]]
], ],
['TYPE', 'Null'], ['TYPE', 'Null'],
sub { $self->plang_builtin_print(@_) }); sub { $self->plang_builtin_print(@_) },
sub { $self->plang_validate_builtin_print(@_) },
);
# register the `plang` command # register the `plang` command
$self->{pbot}->{commands}->register(sub { $self->cmd_plang(@_) }, "plang", 0); $self->{pbot}->{commands}->register(sub { $self->cmd_plang(@_) }, "plang", 0);
@ -151,6 +161,10 @@ sub plang_builtin_print {
return [['TYPE', 'Null'], undef]; return [['TYPE', 'Null'], undef];
} }
sub plang_validate_builtin_print {
return [['TYPE', 'Null'], undef];
}
# our custom PBot built-in functions for Plang # our custom PBot built-in functions for Plang
sub is_locked { sub is_locked {
@ -165,6 +179,10 @@ sub plang_builtin_factget {
return [['TYPE', 'String'], $result]; return [['TYPE', 'String'], $result];
} }
sub plang_validate_builtin_factget {
return [['TYPE', 'String'], ""];
}
sub plang_builtin_factset { sub plang_builtin_factset {
my ($self, $plang, $context, $name, $arguments) = @_; my ($self, $plang, $context, $name, $arguments) = @_;
my ($channel, $keyword, $text) = ($arguments->[0]->[1], $arguments->[1]->[1], $arguments->[2]->[1]); 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]; return [['TYPE', 'String'], $text];
} }
sub plang_validate_builtin_factset {
return [['TYPE', 'String'], ""];
}
sub plang_builtin_factappend { sub plang_builtin_factappend {
my ($self, $plang, $context, $name, $arguments) = @_; my ($self, $plang, $context, $name, $arguments) = @_;
my ($channel, $keyword, $text) = ($arguments->[0]->[1], $arguments->[1]->[1], $arguments->[2]->[1]); 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]; return [['TYPE', 'String'], $action];
} }
sub plang_validate_builtin_factappend {
return [['TYPE', 'String'], ""];
}
sub plang_builtin_userget { sub plang_builtin_userget {
my ($self, $plang, $context, $name, $arguments) = @_; my ($self, $plang, $context, $name, $arguments) = @_;
my ($username) = ($arguments->[0], $arguments->[1]); my ($username) = ($arguments->[0], $arguments->[1]);
@ -204,4 +230,8 @@ sub plang_builtin_userget {
return [['TYPE', 'Map'], $hash]; return [['TYPE', 'Map'], $hash];
} }
sub plang_validate_builtin_userget {
return [['TYPE', 'Map'], {}];
}
1; 1;