Releases: Kyle2142/PHPBot
Releases · Kyle2142/PHPBot
Fire and Forget
Long polling! File downloading!
You can now use long polling (getUpdates) by simply creating a function which accepts an update, and starting polling with handle_updates
:
function dumper($update){
var_dump($update); //do whatever you want in here
}
$bot->handle_updates('dumper'); //blocks forever
See the function docs for parameter details.
You can download files by passing a file_id
to downloadFile
, and it will do one of 3 things, depending on the type of the destination
:
null
, omitted:
content is returned directlystring
:
content is output into the given string, as a pathresource
:
content is written withfwrite
Note that this has not been extensively tested.
Implemented Exceptions
Breaking change:
API methods no longer return stdClass
all the time, they return what was the result
property from previous versions.
To make code compatible with this release, you need to do two things:
- Every time you did
$result = $bot->......(...)->result
, remove the->result
- Add Exception handling.
API calls can now throwkyle2142\TelegramException
(in case of RPC error) orRuntimeException
(in case of user or other error unrelated to Telegram API), so you will need to catch these where needed.
Pre-release
A decent set of basic features, with loads of room for extension and improvement.