Skip to content

Long polling! File downloading!

Pre-release
Pre-release
Compare
Choose a tag to compare
@Kyle2142 Kyle2142 released this 01 Aug 23:52
· 15 commits to master since this release

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 directly
  • string:
    content is output into the given string, as a path
  • resource:
    content is written with fwrite

Note that this has not been extensively tested.