Packages

class TelegramBotApi extends AnyRef

TelegramBotApi

Official Telegram Bot API wrapper.

Self Type
TelegramBotApi with HttpClient
Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TelegramBotApi
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new TelegramBotApi(token: String)

    token

    Bot token

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apiCall(action: String, params: (String, Any)*): Future[JValue]
    Attributes
    protected
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def asyncSetWebhook(url: Option[String], certificate: Option[InputFile] = None): Unit
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. implicit val formats: DefaultFormats.type
  11. def forwardMessage(chatId: Long, fromChatId: Int, messageId: Int): Future[Message]

    forwardMessage

    forwardMessage

    Use this method to forward messages of any kind. On success, the sent Message is returned.

    chatId

    Unique identifier for the message recipient — User or GroupChat id

    fromChatId

    Unique identifier for the chat where the original message was sent — User or GroupChat id

    messageId

    Unique message identifier

  12. def getAs[R](action: String, params: (String, Any)*)(implicit arg0: Manifest[R]): Future[R]
    Attributes
    protected
  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. def getMe: Future[User]

    getMe

    getMe

    A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a User object.

  15. def getUpdates(offset: Option[Int] = None, limit: Option[Int] = None, timeout: Option[Int] = None): Future[Array[Update]]

    getUpdates

    getUpdates

    Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.

    offset

    Optional Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id.

    limit

    Optional Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults to 100

    timeout

    Optional Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling Notes

    1. This method will not work if an outgoing webhook is set up. 2. In order to avoid getting duplicate updates, recalculate offset after each server response.
  16. def getUserProfilePhotos(userId: Int, offset: Option[Int] = None, limit: Option[Int] = None): Future[UserProfilePhotos]

    getUserProfilePhotos

    getUserProfilePhotos

    Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.

    userId

    Unique identifier of the target user

    offset

    Optional Sequential number of the first photo to be returned. By default, all photos are returned.

    limit

    Optional Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.

  17. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  22. def sendAudio(chatId: Long, audioFile: InputFile, duration: Option[Int] = None, performer: Option[String] = None, title: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]

    sendAudio

    sendAudio

    Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. For backward compatibility, when the fields title and performer are both empty and the mime-type of the file to be sent is not audio/mpeg, the file will be sent as a playable voice message. For this to work, the audio must be in an .ogg file encoded with OPUS. This behavior will be phased out in the future. For sending voice messages, use the sendVoice method instead.

    chatId

    Unique identifier for the message recipient — User or GroupChat id

    audioFile

    Audio file to send. You can either pass a fileId as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data.

    duration

    Optional Duration of sent audio in seconds

    performer

    Optional. Performer of the audio as defined by sender or by audio tags

    title

    Optional. Title of the audio as defined by sender or by audio tags

    replyToMessageId

    Optional If the message is a reply, ID of the original message

    replyMarkup

    Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.

  23. def sendAudioId(chatId: Long, audioId: String, duration: Option[Int] = None, performer: Option[String] = None, title: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
  24. def sendChatAction(chatId: Long, action: ChatAction): Unit

    sendChatAction

    sendChatAction

    Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use sendChatAction with action = upload_photo. The user will see a “sending photo” status for the bot. We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.

    chatId

    Unique identifier for the message recipient — User or GroupChat id

    action

    Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_audio or upload_audio for audio files, upload_document for general files, find_location for location data.

  25. def sendDocument(chatId: Long, documentFile: InputFile, caption: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]

    sendDocument

    sendDocument

    Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.

    chatId

    Unique identifier for the message recipient — User or GroupChat id

    documentFile

    File to send. You can either pass a fileId as String to resend a file that is already on the Telegram servers, or upload a new file using multipart/form-data.

    replyToMessageId

    Optional If the message is a reply, ID of the original message

    replyMarkup

    Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.

  26. def sendDocumentId(chatId: Long, documentId: String, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
  27. def sendLocation(chatId: Long, latitude: Float, longitude: Float, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]

    sendLocation

    sendLocation

    Use this method to send point on the map. On success, the sent Message is returned.

    chatId

    Unique identifier for the message recipient — User or GroupChat id

    latitude

    Latitude of location

    longitude

    Longitude of location

    replyToMessageId

    Optional If the message is a reply, ID of the original message

    replyMarkup

    Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.

  28. def sendMessage(chatId: Long, text: String, disableWebPagePreview: Option[Boolean] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]

    sendMessage

    sendMessage

    Use this method to send text messages. On success, the sent Message is returned.

    chatId

    Unique identifier for the message recipient — User or GroupChat id

    text

    Text of the message to be sent

    disableWebPagePreview

    Optional Disables link previews for links in this message

    replyToMessageId

    Optional If the message is a reply, ID of the original message

    replyMarkup

    Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.

  29. def sendPhoto(chatId: Long, photoFile: InputFile, caption: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]

    sendPhotoId

    sendPhotoId

    Use this method to send photos. On success, the sent Message is returned.

    chatId

    Unique identifier for the message recipient — User or GroupChat id

    photoFile

    Photo to send. You can either pass a fileId as String to resend a photo that is already on the Telegram servers, or upload a new photo using multipart/form-data.

    caption

    Optional Photo caption (may also be used when resending photos by fileId).

    replyToMessageId

    Optional If the message is a reply, ID of the original message

    replyMarkup

    Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.

  30. def sendPhotoId(chatId: Long, photoId: String, caption: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
  31. def sendSticker(chatId: Long, stickerFile: InputFile, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]

    sendSticker

    sendSticker

    Use this method to send .webp stickers. On success, the sent Message is returned.

    chatId

    Unique identifier for the message recipient — User or GroupChat id

    stickerFile

    Sticker to send. You can either pass a fileId as String to resend a sticker that is already on the Telegram servers, or upload a new sticker using multipart/form-data.

    replyToMessageId

    Optional If the message is a reply, ID of the original message

    replyMarkup

    Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.

  32. def sendStickerId(chatId: Long, stickerId: String, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
  33. def sendVideo(chatId: Long, videoFile: InputFile, duration: Option[Int] = None, caption: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]

    sendVideo

    sendVideo

    Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.

    chatId

    Unique identifier for the message recipient — User or GroupChat id

    videoFile

    Video to send. You can either pass a fileId as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.

    duration

    Optional Duration of sent video in seconds

    caption

    Optional Video caption (may also be used when resending videos by fileId).

    replyToMessageId

    Optional If the message is a reply, ID of the original message

    replyMarkup

    Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.

  34. def sendVideoId(chatId: Long, videoId: String, duration: Option[Int] = None, caption: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
  35. def sendVoice(chatId: Long, audioFile: InputFile, duration: Option[Int] = None, performer: Option[String] = None, title: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]

    sendVoice

    sendVoice

    Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.

    chatId

    Unique identifier for the message recipient — User or GroupChat id

    audioFile

    Audio file to send. You can either pass a file_id as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data.

    duration

    Optional Duration of sent audio in seconds

    replyToMessageId

    Optional If the message is a reply, ID of the original message

    replyMarkup

    Optional Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.

  36. def sendVoiceId(chatId: Long, audioId: String, duration: Option[Int] = None, performer: Option[String] = None, title: Option[String] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None): Future[Message]
  37. def setWebhook(url: Option[String], certificate: Option[InputFile] = None): Unit

    setWebhook

    setWebhook

    Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. www.example.com/<token>. Since nobody else knows your bot‘s token, you can be pretty sure it’s us.

    url

    Optional HTTPS url to send updates to. Use an empty string to remove webhook integration

    certificate

    Optional Upload your public key certificate so that the root certificate in use can be checked Notes

    1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up. 2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work. 3. Ports currently supported for Webhooks: 443, 80, 88, 8443.
  38. def syncApiCall(action: String, params: (String, Any)*): JValue
    Attributes
    protected
  39. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  40. def toString(): String
    Definition Classes
    AnyRef → Any
  41. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  42. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  43. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped