Skip to main content

API Extensions

API extensions is a module which you may include in your project in addition to core part. In most cases this module will allow just use syntax like bot.getUpdates() instead of bot.execute(GetUpdates()), but there are several other things you will achieve with that syntax.

Bot builder

This functionality allow you to build bot in more unified and comfortable way than standard creating with telegramBot function

) {
  proxy = ProxyBuilder.socks(host = "", port = 4001) // just an example, more info on
  ktorClientConfig = {
    // configuring of ktor client
  ktorClientEngineFactory = {
   // configuring of ktor client engine 

Downloading of files

In standard library requests there are no way to download some file retrieved in updates or after requests. You may use syntax like bot.downloadFile(file) where file is TelegramMediaFile from telegram, FileId or even PathedFile from GetFile request (sources).

Live location

By default, you should handle updates of Live location by your code. But with extension bot#startLiveLocation you may provide all necessary startup parameters and handle updates with just calling updateLocation for retrieved LiveLocationProvider.

What is next?

There are several things you may read next: