AI-CleverbotIO
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
my $api_user = $obj->user;
Read-only accessor to the API user. MUST be provided upon
instantiation.
METHODS
BUILD_logger
Called automatically if "logger" is not set. By default, it returns
whatever "get_logger" in Log::Any provides, but you can easily override
this in a derived class.
BUILD_ua
Called automatically if "ua" is not set. By default, it returns a plain
new instance of HTTP::Tiny, without options.
ask
my $answer = $obj->ask($some_text);
Send a ask API request. The returned $answer is a hash reference
derived by the JSON decoding of the response body, e.g.:
{
status => 'success',
response => 'Hullo'
}
create
my $answer = $obj->create();
my $other = $obj->create($other_nick);
Send a create API request. The returned $answer is a hash reference
derived by the JSON decoding of the response body, e.g.:
{
status => 'success',
nick => 'NickTheRobot',
}
If the current "nick" has already been used for creation, the API call
will fail partially in that status 200 will be returned, but the status
field in the answer will contain an error about the fact that the nick
already exists (Error: reference name already exists). You can safely
ignore this error.
You can optionally pass a different other_nick. This will be set as
"nick" and used for creation (this will overwrite whatever "nick"
contains though).
has_nick
say $obj->nick if $obj->has_nick;
say 'no nick yet' unless $obj->has_nick;
Predicate to check whether a "nick" is already set or not.
BUGS AND LIMITATIONS
Report bugs either through RT or GitHub (patches welcome).
SEE ALSO
https://cleverbot.io.
AUTHOR
Flavio Poletti <polettix@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2017 by Flavio Poletti <polettix@cpan.org>
This module is free software. You can redistribute it and/or modify it
under the terms of the Artistic License 2.0.
This program is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.873 second using v1.00-cache-2.02-grep-82fe00e-cpan-dad7e4baca0 )