Interface BotAPI

  • All Known Implementing Classes:
    TelegramBot

    public interface BotAPI
    Interface to build Telegrams Bots Telegram Bot API version 4.6
    • Method Detail

      • startUpdatesPoller

        void startUpdatesPoller()
        Starts the updates thread
      • stopUpdatesPoller

        void stopUpdatesPoller()
        Stop the updates thread
      • getUpdatesPoller

        BotUpdatesPoller getUpdatesPoller()
        Get the UpdatesPoller instance
        Returns:
        the updates poller instance
      • getInstance

        BotAPI getInstance()
        Get Bot instance
        Returns:
        BotAPI
      • getMe

        User getMe()
            throws TelegramException
        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.
        Returns:
        User
        Throws:
        TelegramException - if the method fails in Telegram servers if the method failed on Telegram servers
      • sendMessage

        default Message sendMessage​(Object chat_id,
                                    String text)
                             throws TelegramException
        Use this method to send text messages. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        text - Text of the message to be sent
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendMessage

        Message sendMessage​(Object chat_id,
                            String text,
                            ParseMode parse_mode,
                            Boolean disable_notification,
                            Boolean disable_web_page_preview,
                            Integer reply_to_message_id,
                            Object reply_markup)
                     throws TelegramException
        Use this method to send text messages. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        text - Text of the message to be sent
        parse_mode - Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
        disable_web_page_preview - Disables link previews for links in this message
        disable_notification - Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
        reply_to_message_id - If the message is a reply, ID of the original message
        reply_markup - Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can be ReplyKeyboardMarkup, ReplyKeyboardRemove or ForceReply.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • forwardMessage

        default Message forwardMessage​(Object chat_id,
                                       Integer from_chat_id,
                                       Integer message_id)
                                throws TelegramException
        Use this method to forward messages of any kind. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        from_chat_id - Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
        message_id - Unique message identifier
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • forwardMessage

        Message forwardMessage​(Object chat_id,
                               Integer from_chat_id,
                               Boolean disable_notification,
                               Integer message_id)
                        throws TelegramException
        Use this method to forward messages of any kind. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        from_chat_id - Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
        disable_notification - Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
        message_id - Unique message identifier
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendPhoto

        default Message sendPhoto​(Object chat_id,
                                  String photo)
                           throws TelegramException
        Use this method to send photos. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        photo - Photo to send. You can either pass a file_id as String to resend a photo that is already on the Telegram servers, or upload a new photo using multipart/form-data.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendPhoto

        default Message sendPhoto​(Object chat_id,
                                  File photo)
                           throws TelegramException
        Use this method to send photos. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        photo - Photo to send. You can either pass a file_id as String to resend a photo that is already on the Telegram servers, or upload a new photo using multipart/form-data.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendPhoto

        Message sendPhoto​(Object chat_id,
                          Object photo,
                          String caption,
                          Boolean disable_notification,
                          Integer reply_to_message_id,
                          Object reply_markup)
                   throws TelegramException
        Use this method to send photos. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        photo - Photo to send. You can either pass a file_id as String to resend a photo that is already on the Telegram servers, or upload a new photo using multipart/form-data.
        caption - Photo caption (may also be used when resending photos by file_id).
        disable_notification - Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
        reply_to_message_id - If the message is a reply, ID of the original message
        reply_markup - Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can be ReplyKeyboardMarkup, ReplyKeyboardRemove or ForceReply.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendAudio

        default Message sendAudio​(Object chat_id,
                                  String audio)
                           throws TelegramException
        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.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        audio - 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.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendAudio

        default Message sendAudio​(Object chat_id,
                                  File audio)
                           throws TelegramException
        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.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        audio - 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.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendAudio

        Message sendAudio​(Object chat_id,
                          Object audio,
                          String caption,
                          Integer duration,
                          String performer,
                          String title,
                          Boolean disable_notification,
                          Integer reply_to_message_id,
                          Object reply_markup)
                   throws TelegramException
        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.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        audio - 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.
        caption - Audio caption, 0-200 characters
        duration - Duration of the audio in seconds
        performer - Performer
        title - Track name
        disable_notification - Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
        reply_to_message_id - If the message is a reply, ID of the original message
        reply_markup - Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can be ReplyKeyboardMarkup, ReplyKeyboardRemove or ForceReply.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendDocument

        default Message sendDocument​(Object chat_id,
                                     String document)
                              throws TelegramException
        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.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        document - File to send. You can either pass a file_id as String to resend a file that is already on the Telegram servers, or upload a new file using multipart/form-data.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendDocument

        default Message sendDocument​(Object chat_id,
                                     File document)
                              throws TelegramException
        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.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        document - File to send. You can either pass a file_id as String to resend a file that is already on the Telegram servers, or upload a new file using multipart/form-data.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendDocument

        Message sendDocument​(Object chat_id,
                             Object document,
                             Boolean disable_notification,
                             Integer reply_to_message_id,
                             Object reply_markup)
                      throws TelegramException
        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.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        document - File to send. You can either pass a file_id as String to resend a file that is already on the Telegram servers, or upload a new file using multipart/form-data.
        disable_notification - Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
        reply_to_message_id - If the message is a reply, ID of the original message
        reply_markup - Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can be ReplyKeyboardMarkup, ReplyKeyboardRemove or ForceReply.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendVideo

        default Message sendVideo​(Object chat_id,
                                  String video)
                           throws TelegramException
        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.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        video - Video to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendVideo

        default Message sendVideo​(Object chat_id,
                                  File video)
                           throws TelegramException
        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.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        video - Video to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendVideo

        Message sendVideo​(Object chat_id,
                          Object video,
                          Integer duration,
                          Integer width,
                          Integer height,
                          String caption,
                          ParseMode parse_mode,
                          Boolean supports_streaming,
                          Boolean disable_notification,
                          Integer reply_to_message_id,
                          Object reply_markup)
                   throws TelegramException
        Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        video - Video 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 - Duration of the video in seconds
        width - Video width
        height - Video height
        caption - Video caption (may also be used when resending videos by file_id), 0-200 characters
        parse_mode - Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
        supports_streaming - Pass True, if the uploaded video is suitable for streaming
        disable_notification - Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
        reply_to_message_id - If the message is a reply, ID of the original message
        reply_markup - Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can be ReplyKeyboardMarkup, ReplyKeyboardRemove or ForceReply.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendAnimation

        default Message sendAnimation​(Object chat_id,
                                      String animation)
                               throws TelegramException
        Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        animation - Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendAnimation

        default Message sendAnimation​(Object chat_id,
                                      File animation)
                               throws TelegramException
        Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        animation - Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendAnimation

        Message sendAnimation​(Object chat_id,
                              Object animation,
                              Integer duration,
                              Integer width,
                              Integer height,
                              Object thumb,
                              String caption,
                              ParseMode parse_mode,
                              Boolean disable_notification,
                              Integer reply_to_message_id,
                              Object reply_markup)
                       throws TelegramException
        Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        animation - Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data.
        duration - Duration of the animation in seconds
        width - Animation width
        height - Animation height
        thumb - Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 90. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
        caption - Animation caption (may also be used when resending videos by file_id), 0-1024 characters
        parse_mode - Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
        disable_notification - Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
        reply_to_message_id - If the message is a reply, ID of the original message
        reply_markup - Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can be ReplyKeyboardMarkup, ReplyKeyboardRemove or ForceReply.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendVoice

        default Message sendVoice​(Object chat_id,
                                  String voice)
                           throws TelegramException
        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.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        voice - Audio file to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendVoice

        default Message sendVoice​(Object chat_id,
                                  File voice)
                           throws TelegramException
        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.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        voice - Audio file to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendVoice

        Message sendVoice​(Object chat_id,
                          Object voice,
                          String caption,
                          Integer duration,
                          Boolean disable_notification,
                          Integer reply_to_message_id,
                          Object reply_markup)
                   throws TelegramException
        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.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        voice - Audio file to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.
        caption - Voice message caption, 0-200 characters
        duration - Duration of the audio in seconds
        disable_notification - Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
        reply_to_message_id - If the message is a reply, ID of the original message
        reply_markup - Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can be ReplyKeyboardMarkup, ReplyKeyboardRemove or ForceReply.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendMediaGroup

        default Message sendMediaGroup​(Object chat_id,
                                       List<InputMedia> media)
                                throws TelegramException
        Use this method to send a group of photos or videos as an album.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        media - A JSON-serialized array describing photos and videos to be sent, must include 2–10 items
        Returns:
        An array of the sent Messages is returned on success
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendMediaGroup

        Message sendMediaGroup​(Object chat_id,
                               List<InputMedia> media,
                               Boolean disable_notification,
                               Integer reply_to_message_id)
                        throws TelegramException
        Use this method to send a group of photos or videos as an album.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        media - A JSON-serialized array describing photos and videos to be sent, must include 2–10 items
        disable_notification - Sends the messages silently. Users will receive a notification with no sound.
        reply_to_message_id - If the messages are a reply, ID of the original message
        Returns:
        An array of the sent Messages is returned on success
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendLocation

        default Message sendLocation​(Object chat_id,
                                     Float latitude,
                                     Float longitude)
                              throws TelegramException
        Use this method to send point on the map. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        latitude - Latitude of location
        longitude - Longitude of location
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendLocation

        Message sendLocation​(Object chat_id,
                             Float latitude,
                             Float longitude,
                             Integer live_period,
                             Boolean disable_notification,
                             Integer reply_to_message_id,
                             Object reply_markup)
                      throws TelegramException
        Use this method to send point on the map. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        latitude - Latitude of location
        longitude - Longitude of location
        live_period - Period in seconds for which the location will be updated (should be between 60 and 86400).
        disable_notification - Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
        reply_to_message_id - If the message is a reply, ID of the original message
        reply_markup - Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can be ReplyKeyboardMarkup, ReplyKeyboardRemove or ForceReply.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • editMessageLiveLocation

        Object editMessageLiveLocation​(Object chat_id,
                                       Integer message_id,
                                       String inline_message_id,
                                       Float latitude,
                                       Float longitude,
                                       InlineKeyboardMarkup reply_markup)
                                throws TelegramException
        Use this method to edit live location messages sent by the bot or via the bot (for inline bots). A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation.
        Parameters:
        chat_id - Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        message_id - Required if inline_message_id is not specified. Identifier of the sent message
        inline_message_id - Required if chat_id and message_id are not specified. Identifier of the inline message
        latitude - Latitude of new location
        longitude - Longitude of new location
        reply_markup - A JSON-serialized object for a new inline keyboard.
        Returns:
        if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • stopMessageLiveLocation

        Object stopMessageLiveLocation​(Object chat_id,
                                       Integer message_id,
                                       String inline_message_id,
                                       InlineKeyboardMarkup reply_markup)
                                throws TelegramException
        Use this method to stop updating a live location message sent by the bot or via the bot (for inline bots) before live_period expires.
        Parameters:
        chat_id - Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        message_id - Required if inline_message_id is not specified. Identifier of the sent message
        inline_message_id - Required if chat_id and message_id are not specified. Identifier of the inline message
        reply_markup - A JSON-serialized object for a new inline keyboard.
        Returns:
        if the message was sent by the bot, the sent Message is returned, otherwise True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendVideoNote

        default Message sendVideoNote​(Object chat_id,
                                      String video_note)
                               throws TelegramException
        As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned. 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.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        video_note - Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More info on Sending Files ». Sending video notes by a URL is currently unsupported
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendVideoNote

        default Message sendVideoNote​(Object chat_id,
                                      File video_note)
                               throws TelegramException
        As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned. 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.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        video_note - Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More info on Sending Files ». Sending video notes by a URL is currently unsupported
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendVideoNote

        Message sendVideoNote​(Object chat_id,
                              Object video_note,
                              Integer duration,
                              Integer length,
                              Boolean disable_notification,
                              Integer reply_to_message_id,
                              Object reply_markup)
                       throws TelegramException
        As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        video_note - Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More info on Sending Files ». Sending video notes by a URL is currently unsupported
        duration - Duration of sent video in seconds
        length - Video width and height
        disable_notification - Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
        reply_to_message_id - If the message is a reply, ID of the original message
        reply_markup - Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can be ReplyKeyboardMarkup, ReplyKeyboardRemove or ForceReply.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendVenue

        default Message sendVenue​(Object chat_id,
                                  Float latitude,
                                  Float longitude,
                                  String title,
                                  String address)
                           throws TelegramException
        Use this method to send information about a venue. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        latitude - Latitude of the venue
        longitude - Longitude of the venue
        title - Name of the venue
        address - Address of the venue
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendVenue

        Message sendVenue​(Object chat_id,
                          Float latitude,
                          Float longitude,
                          String title,
                          String address,
                          String foursquare_id,
                          String foursquare_type,
                          Boolean disable_notification,
                          Integer reply_to_message_id,
                          Object reply_markup)
                   throws TelegramException
        Use this method to send information about a venue. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        latitude - Latitude of the venue
        longitude - Longitude of the venue
        title - Name of the venue
        address - Address of the venue
        foursquare_id - Foursquare identifier of the venue
        foursquare_type - Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
        disable_notification - Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
        reply_to_message_id - If the message is a reply, ID of the original message
        reply_markup - Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can be ReplyKeyboardMarkup, ReplyKeyboardRemove or ForceReply.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendContact

        default Message sendContact​(Object chat_id,
                                    String phone_number,
                                    String first_name)
                             throws TelegramException
        Use this method to send phone contacts. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        phone_number - Contact's phone number
        first_name - Contact's first name
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendContact

        Message sendContact​(Object chat_id,
                            String phone_number,
                            String first_name,
                            String last_name,
                            String vcard,
                            Boolean disable_notification,
                            Integer reply_to_message_id,
                            Object reply_markup)
                     throws TelegramException
        Use this method to send phone contacts. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        phone_number - Contact's phone number
        first_name - Contact's first name
        last_name - Contact's last name
        vcard - Additional data about the contact in the form of a vCard, 0-2048 bytes
        disable_notification - Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
        reply_to_message_id - If the message is a reply, ID of the original message
        reply_markup - Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can be ReplyKeyboardMarkup, ReplyKeyboardRemove or ForceReply.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendPoll

        default Message sendPoll​(Object chat_id,
                                 String question,
                                 List<String> options)
                          throws TelegramException
        Use this method to send a native poll. A native poll can't be sent to a private chat. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername). A native poll can't be sent to a private chat.
        question - Poll question, 1-255 characters
        options - List of answer options, 2-10 strings 1-100 characters each
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendPoll

        Message sendPoll​(Object chat_id,
                         String question,
                         List<String> options,
                         Boolean is_anonymous,
                         String type,
                         Boolean allows_multiple_answers,
                         Integer correct_option_id,
                         Boolean is_closed,
                         Boolean disable_notification,
                         Integer reply_to_message_id,
                         Object reply_markup)
                  throws TelegramException
        Use this method to send a native poll. A native poll can't be sent to a private chat. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername). A native poll can't be sent to a private chat.
        question - Poll question, 1-255 characters
        options - List of answer options, 2-10 strings 1-100 characters each
        is_anonymous - True, if the poll needs to be anonymous, defaults to True
        type - Poll type, “quiz” or “regular”, defaults to “regular”
        allows_multiple_answers - True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False
        correct_option_id - 0-based identifier of the correct answer option, required for polls in quiz mode
        is_closed - Pass True, if the poll needs to be immediately closed
        disable_notification - Sends the message silently. Users will receive a notification with no sound.
        reply_to_message_id - If the message is a reply, ID of the original message
        reply_markup - Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can be ReplyKeyboardMarkup, ReplyKeyboardRemove or ForceReply.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendDice

        Message sendDice​(Object chat_id,
                         Boolean disable_notification,
                         Integer reply_to_message_id,
                         Object reply_markup)
                  throws TelegramException
        Use this method to send a dice, which will have a random value from 1 to 6.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        disable_notification - Sends the message silently. Users will receive a notification with no sound.
        reply_to_message_id - If the message is a reply, ID of the original message
        reply_markup - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
        Returns:
        On success, the sent Message is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendChatAction

        Boolean sendChatAction​(Object chat_id,
                               String action)
                        throws TelegramException
        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). We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive. Watch more in https://core.telegram.org/bots/api#sendchataction
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        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.
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendChatAction

        default Boolean sendChatAction​(Object chat_id,
                                       BotAPI.ChatAction action)
                                throws TelegramException
        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). We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive. Watch more in https://core.telegram.org/bots/api#sendchataction
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        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.
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • getUserProfilePhotos

        UserProfilePhotos getUserProfilePhotos​(Integer user_id,
                                               Integer offset,
                                               Integer limit)
                                        throws TelegramException
        Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
        Parameters:
        user_id - Unique identifier of the target user
        offset - Sequential number of the first photo to be returned. By default, all photos are returned.
        limit - Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.
        Returns:
        UserProfilePhotos
        Throws:
        TelegramException - if the method fails in Telegram servers
      • getFile

        File getFile​(String file_id)
              throws TelegramException
        Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
        Parameters:
        file_id - File identifier to get info about
        Returns:
        File
        Throws:
        TelegramException - if the method fails in Telegram servers
      • kickChatMember

        default Boolean kickChatMember​(Object chat_id,
                                       Integer user_id)
                                throws TelegramException
        Use this method to kick a user from a group or a supergroup. In the case of supergroups, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the group for this to work. Returns True on success.
        Parameters:
        chat_id - Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername)
        user_id - Unique identifier of the target user
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • kickChatMember

        Boolean kickChatMember​(Object chat_id,
                               Integer user_id,
                               Integer until_date)
                        throws TelegramException
        Use this method to kick a user from a group or a supergroup. In the case of supergroups, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the group for this to work. Returns True on success.
        Parameters:
        chat_id - Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername)
        user_id - Unique identifier of the target user
        until_date - Optional. Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • leaveChat

        Boolean leaveChat​(Object chat_id)
                   throws TelegramException
        Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • unbanChatMember

        Boolean unbanChatMember​(Object chat_id,
                                Integer user_id)
                         throws TelegramException
        Use this method to unban a previously kicked user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. Returns True on success.
        Parameters:
        chat_id - Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername)
        user_id - Unique identifier of the target user
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • restrictChatMember

        default Boolean restrictChatMember​(Object chat_id,
                                           Integer user_id,
                                           ChatPermissions permissions)
                                    throws TelegramException
        Use this method to restrict a user in a supergroup.The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
        user_id - Unique identifier of the target user
        permissions - New user permissions
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • restrictChatMember

        Boolean restrictChatMember​(Object chat_id,
                                   Integer user_id,
                                   ChatPermissions permissions,
                                   Integer until_date)
                            throws TelegramException
        * Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
        user_id - Unique identifier of the target user
        permissions - New user permissions
        until_date - Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • promoteChatMember

        default Boolean promoteChatMember​(Object chat_id,
                                          Integer user_id)
                                   throws TelegramException
        Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
        user_id - Unique identifier of the target user
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • promoteChatMember

        Boolean promoteChatMember​(Object chat_id,
                                  Integer user_id,
                                  Boolean can_change_info,
                                  Boolean can_post_messages,
                                  Boolean can_edit_messages,
                                  Boolean can_delete_messages,
                                  Boolean can_invite_users,
                                  Boolean can_restrict_members,
                                  Boolean can_pin_messages,
                                  Boolean can_promote_members)
                           throws TelegramException
        Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
        user_id - Unique identifier of the target user
        can_change_info - Pass True, if the administrator can change chat title, photo and other settings
        can_post_messages - Pass True, if the administrator can create channel posts, channels only
        can_edit_messages - Pass True, if the administrator can edit messages of other users and can pin messages, channels only
        can_delete_messages - Pass True, if the administrator can delete messages of other users
        can_invite_users - Pass True, if the administrator can invite new users to the chat
        can_restrict_members - Pass True, if the administrator can restrict, ban or unban chat members
        can_pin_messages - Pass True, if the administrator can pin messages, supergroups only
        can_promote_members - Pass True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • setChatAdministratorCustomTitle

        Boolean setChatAdministratorCustomTitle​(Object chat_id,
                                                Integer user_id,
                                                String custom_title)
                                         throws TelegramException
        Use this method to set a custom title for an administrator in a supergroup promoted by the bot
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
        user_id - Unique identifier of the target user
        custom_title - New custom title for the administrator; 0-16 characters, emoji are not allowed
        Returns:
        True on success.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • setChatPermissions

        Boolean setChatPermissions​(Object chat_id,
                                   ChatPermissions permissions)
                            throws TelegramException
        Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members admin rights.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
        permissions - New default chat permissions
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • exportChatInviteLink

        String exportChatInviteLink​(Object chat_id)
                             throws TelegramException
        Use this method to generate a new invite link for a chat; any previously generated link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        Returns:
        the new invite link as String on success.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • setChatPhoto

        Boolean setChatPhoto​(Object chat_id,
                             File photo)
                      throws TelegramException
        Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. * Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off in the target group.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
        photo - New chat photo, uploaded using multipart/form-data
        Returns:
        True on success
        Throws:
        TelegramException - if the method fails in Telegram servers
      • deleteChatPhoto

        Boolean deleteChatPhoto​(Object chat_id)
                         throws TelegramException
        Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
        Returns:
        True on success
        Throws:
        TelegramException - if the method fails in Telegram servers
      • setChatTitle

        Boolean setChatTitle​(Object chat_id,
                             String title)
                      throws TelegramException
        Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off in the target group.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        title - New chat title, 1-255 characters
        Returns:
        True on success
        Throws:
        TelegramException - if the method fails in Telegram servers
      • setChatDescription

        default Boolean setChatDescription​(Object chat_id)
                                    throws TelegramException
        Use this method to change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        Returns:
        True on success
        Throws:
        TelegramException - if the method fails in Telegram servers
      • setChatDescription

        Boolean setChatDescription​(Object chat_id,
                                   String description)
                            throws TelegramException
        Use this method to change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        description - New chat description, 0-255 characters
        Returns:
        True on success
        Throws:
        TelegramException - if the method fails in Telegram servers
      • pinChatMessage

        default Boolean pinChatMessage​(Object chat_id,
                                       Integer message_id)
                                throws TelegramException
        Use this method to pin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        message_id - Identifier of a message to pin
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • pinChatMessage

        Boolean pinChatMessage​(Object chat_id,
                               Integer message_id,
                               Boolean disable_notification)
                        throws TelegramException
        Use this method to pin a message in a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        message_id - Identifier of a message to pin
        disable_notification - Pass True, if it is not necessary to send a notification to all group members about the new pinned message
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • unpinChatMessage

        Boolean unpinChatMessage​(Object chat_id)
                          throws TelegramException
        Use this method to unpin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • getChat

        Chat getChat​(Object chat_id)
              throws TelegramException
        Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
        Returns:
        Chat
        Throws:
        TelegramException - if the method fails in Telegram servers
      • getChatAdministrators

        List<ChatMember> getChatAdministrators​(Object chat_id)
                                        throws TelegramException
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
        Returns:
        Array of ChatMember
        Throws:
        TelegramException - if the method fails in Telegram servers
      • getChatMembersCount

        Integer getChatMembersCount​(Object chat_id)
                             throws TelegramException
        Use this method to get the number of members in a chat. Returns Int on success.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
        Returns:
        Number of members in a chat
        Throws:
        TelegramException - if the method fails in Telegram servers
      • getChatMember

        ChatMember getChatMember​(Object chat_id,
                                 Integer user_id)
                          throws TelegramException
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
        user_id - Unique identifier of the target user
        Returns:
        ChatMember
        Throws:
        TelegramException - if the method fails in Telegram servers
      • setChatStickerSet

        Boolean setChatStickerSet​(Object chat_id,
                                  String sticker_set_name)
                           throws TelegramException
        Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
        sticker_set_name - Name of the sticker set to be set as the group sticker set
        Returns:
        True on success.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • deleteChatStickerSet

        Boolean deleteChatStickerSet​(Object chat_id)
                              throws TelegramException
        Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method.
        Parameters:
        chat_id - True on success.
        Returns:
        True on success.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • answerCallbackQuery

        default Boolean answerCallbackQuery​(String callback_query_id)
                                     throws TelegramException
        Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
        Parameters:
        callback_query_id - Unique identifier for the query to be answered
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • answerCallbackQuery

        Boolean answerCallbackQuery​(String callback_query_id,
                                    String text,
                                    Boolean show_alert,
                                    String url,
                                    Integer cache_time)
                             throws TelegramException
        Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert.
        Parameters:
        callback_query_id - Unique identifier for the query to be answered
        text - Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters
        show_alert - If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false.
        url - URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game – note that this will only work if the query comes from a callback_game button. Otherwise, you may use links like telegram.me/your_bot?start=XXXX that open your bot with a parameter.
        cache_time - The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0.
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • setMyCommands

        Boolean setMyCommands​(List<BotCommand> commands)
                       throws TelegramException
        Use this method to change the list of the bot's commands.
        Parameters:
        commands - A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.
        Returns:
        True on success.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • getMyCommands

        List<BotCommand> getMyCommands()
                                throws TelegramException
        Use this method to get the current list of the bot's commands. Requires no parameters.
        Returns:
        Array of BotCommand on success.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • editMessageText

        Message editMessageText​(Object chat_id,
                                Integer message_id,
                                String inline_message_id,
                                String text,
                                ParseMode parse_mode,
                                Boolean disable_web_page_preview,
                                InlineKeyboardMarkup reply_markup)
                         throws TelegramException
        Use this method to edit text and game messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
        Parameters:
        chat_id - Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        message_id - Required if inline_message_id is not specified. Unique identifier of the sent message
        inline_message_id - Required if chat_id and message_id are not specified. Identifier of the inline message
        text - New text of the message
        parse_mode - Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
        disable_web_page_preview - Disables link previews for links in this message
        reply_markup - A JSON-serialized object for an inline keyboard.
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • editMessageCaption

        Message editMessageCaption​(Object chat_id,
                                   Integer message_id,
                                   String inline_message_id,
                                   String caption,
                                   ParseMode parseMode,
                                   InlineKeyboardMarkup reply_markup)
                            throws TelegramException
        Use this method to edit captions of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
        Parameters:
        chat_id - Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        message_id - Required if inline_message_id is not specified. Unique identifier of the sent message
        inline_message_id - Required if chat_id and message_id are not specified. Identifier of the inline message
        caption - New caption of the message
        reply_markup - A JSON-serialized object for an inline keyboard.
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • editMessageMedia

        Message editMessageMedia​(Object chat_id,
                                 Integer message_id,
                                 String inline_message_id,
                                 InputMedia media,
                                 InlineKeyboardMarkup reply_markup)
                          throws TelegramException
        Use this method to edit audio, document, photo, or video messages. If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded. Use previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.
        Parameters:
        chat_id - Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        message_id - Required if inline_message_id is not specified. Identifier of the sent message
        inline_message_id - Required if chat_id and message_id are not specified. Identifier of the inline message
        media - A JSON-serialized object for a new media content of the message
        reply_markup - A JSON-serialized object for a new inline keyboard.
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • editMessageReplyMarkup

        Message editMessageReplyMarkup​(Object chat_id,
                                       Integer message_id,
                                       String inline_message_id,
                                       InlineKeyboardMarkup reply_markup)
                                throws TelegramException
        Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
        Parameters:
        chat_id - Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        message_id - Required if inline_message_id is not specified. Unique identifier of the sent message
        inline_message_id - Required if chat_id and message_id are not specified. Identifier of the inline message
        reply_markup - A JSON-serialized object for an inline keyboard.
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • stopPoll

        default Poll stopPoll​(Object chat_id,
                              Integer message_id)
                       throws TelegramException
        Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with the final results is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        message_id - Identifier of the original message with the poll
        Returns:
        Poll
        Throws:
        TelegramException - if the method fails in Telegram servers
      • stopPoll

        Poll stopPoll​(Object chat_id,
                      Integer message_id,
                      InlineKeyboardMarkup reply_markup)
               throws TelegramException
        Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with the final results is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        message_id - Identifier of the original message with the poll
        reply_markup - Optional. A JSON-serialized object for a new message inline keyboard.
        Returns:
        Poll
        Throws:
        TelegramException - if the method fails in Telegram servers
      • deleteMessage

        Boolean deleteMessage​(Object chat_id,
                              Integer message_id)
                       throws TelegramException
        Use this method to delete a message, including service messages, with the following limitations: - A message can only be deleted if it was sent less than 48 hours ago. - Bots can delete outgoing messages in private chats, groups, and supergroups. - Bots can delete incoming messages in private chats. - Bots granted can_post_messages permissions can delete outgoing messages in channels. - If the bot is an administrator of a group, it can delete any message there. - If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.
        Parameters:
        chat_id - Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        message_id - Required if inline_message_id is not specified. Unique identifier of the sent message
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • getUpdates

        List<Update> getUpdates​(Integer offset,
                                Integer limit,
                                Integer timeout,
                                List<String> allowed_updates)
                         throws TelegramException
        Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
        Parameters:
        offset - 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. Watch more in https://core.telegram.org/bots/api#getupdates
        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
        allowed_updates - Optional. List the types of updates you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used.
        Returns:
        An Array of Update objects
        Throws:
        TelegramException - if the method fails in Telegram servers
      • setWebhook

        Boolean setWebhook​(String url,
                           File certificate,
                           Integer max_connections,
                           List<String> allowed_updates)
                    throws TelegramException
        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. https://www.example.com/<token>. Since nobody else knows your bot‘s token, you can be pretty sure it’s us. Notes
        • You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.ǘ
        • We currently do not support self-signed certificates.
        • Ports currently supported for Webhooks: 443, 80, 88, 8443.
        Parameters:
        url - 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. See our self-signed guide for details.
        max_connections - Optional. Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot‘s server, and higher values to increase your bot’s throughput.
        allowed_updates - Optional. List the types of updates you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used.
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendSticker

        default Message sendSticker​(Object chat_id,
                                    String sticker)
                             throws TelegramException
        Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        sticker - Sticker to send. You can either pass a file_id as String to resend a sticker that is already on the Telegram servers, or upload a new sticker using multipart/form-data.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendSticker

        default Message sendSticker​(Object chat_id,
                                    File sticker)
                             throws TelegramException
        Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        sticker - Sticker to send. You can either pass a file_id as String to resend a sticker that is already on the Telegram servers, or upload a new sticker using multipart/form-data.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendSticker

        Message sendSticker​(Object chat_id,
                            Object sticker,
                            Boolean disable_notification,
                            Integer reply_to_message_id,
                            Object reply_markup)
                     throws TelegramException
        Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
        sticker - Sticker to send. You can either pass a file_id as String to resend a sticker that is already on the Telegram servers, or upload a new sticker using multipart/form-data.
        reply_to_message_id - If the message is a reply, ID of the original message
        disable_notification - Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
        reply_markup - Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can be ReplyKeyboardMarkup, ReplyKeyboardRemove or ForceReply.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • getStickerSet

        StickerSet getStickerSet​(String name)
                          throws TelegramException
        Use this method to get a sticker set. On success, a StickerSet object is returned.
        Parameters:
        name - Name of the sticker set
        Returns:
        StickerSet
        Throws:
        TelegramException - if the method fails in Telegram servers
      • uploadStickerFile

        File uploadStickerFile​(Integer user_id,
                               File png_sticker)
                        throws TelegramException
        Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success.
        Parameters:
        user_id - User identifier of sticker file owner
        png_sticker - Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px.
        Returns:
        The uploaded File on success.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • createNewStickerSet

        default Boolean createNewStickerSet​(Integer user_id,
                                            String name,
                                            String title,
                                            File png_sticker,
                                            File tgs_sticker,
                                            String emojis)
                                     throws TelegramException
        Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success.
        Parameters:
        user_id - User identifier of created sticker set owner
        name - Short name of sticker set, to be used in t.me/addstickers/ URLs. Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”. <bot_username> is case insensitive. 1-64 characters.
        title - Sticker set title, 1-64 characters
        png_sticker - Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using
        tgs_sticker - TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements
        emojis - One or more emoji corresponding to the sticker
        Returns:
        True on success.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • createNewStickerSet

        default Boolean createNewStickerSet​(Integer user_id,
                                            String name,
                                            String title,
                                            String png_sticker,
                                            File tgs_sticker,
                                            String emojis)
                                     throws TelegramException
        Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success.
        Parameters:
        user_id - User identifier of created sticker set owner
        name - Short name of sticker set, to be used in t.me/addstickers/ URLs. Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”. <bot_username> is case insensitive. 1-64 characters.
        title - Sticker set title, 1-64 characters
        png_sticker - Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using
        tgs_sticker - TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements
        emojis - One or more emoji corresponding to the sticker
        Returns:
        True on success.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • createNewStickerSet

        Boolean createNewStickerSet​(Integer user_id,
                                    String name,
                                    String title,
                                    Object png_sticker,
                                    File tgs_sticker,
                                    String emojis,
                                    Boolean contains_masks,
                                    MaskPosition mask_position)
                             throws TelegramException
        Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success.
        Parameters:
        user_id - User identifier of created sticker set owner
        name - Short name of sticker set, to be used in t.me/addstickers/ URLs. Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”. <bot_username> is case insensitive. 1-64 characters.
        title - Sticker set title, 1-64 characters
        png_sticker - Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using
        emojis - One or more emoji corresponding to the sticker
        contains_masks - Optional. Pass True, if a set of mask stickers should be created
        mask_position - Optional. A JSON-serialized object for position where the mask should be placed on faces
        Returns:
        True on success.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • addStickerToSet

        default Boolean addStickerToSet​(Integer user_id,
                                        String name,
                                        File png_sticker,
                                        File tgs_sticker,
                                        String emojis)
                                 throws TelegramException
        Use this method to add a new sticker to a set created by the bot. Returns True on success.
        Parameters:
        user_id - User identifier of sticker set owner
        name - Sticker set name
        png_sticker - Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data
        tgs_sticker - TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements
        emojis - One or more emoji corresponding to the sticker
        Returns:
        True on success.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • addStickerToSet

        default Boolean addStickerToSet​(Integer user_id,
                                        String name,
                                        String png_sticker,
                                        String emojis)
                                 throws TelegramException
        Use this method to add a new sticker to a set created by the bot. Returns True on success.
        Parameters:
        user_id - User identifier of sticker set owner
        name - Sticker set name
        png_sticker - Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data
        emojis - One or more emoji corresponding to the sticker
        Returns:
        True on success.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • addStickerToSet

        Boolean addStickerToSet​(Integer user_id,
                                String name,
                                Object png_sticker,
                                String emojis,
                                MaskPosition mask_position)
                         throws TelegramException
        Use this method to add a new sticker to a set created by the bot. Returns True on success.
        Parameters:
        user_id - User identifier of sticker set owner
        name - Sticker set name
        png_sticker - Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data
        emojis - One or more emoji corresponding to the sticker
        mask_position - Optional. A JSON-serialized object for position where the mask should be placed on faces
        Returns:
        True on success.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • setStickerPositionInSet

        Boolean setStickerPositionInSet​(String sticker,
                                        Integer position)
                                 throws TelegramException
        Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success.
        Parameters:
        sticker - File identifier of the sticker
        position - New sticker position in the set, zero-based
        Returns:
        True on success.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • deleteStickerFromSet

        Boolean deleteStickerFromSet​(String sticker)
                              throws TelegramException
        Use this method to delete a sticker from a set created by the bot. Returns True on success.
        Parameters:
        sticker - File identifier of the sticker
        Returns:
        True on success.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • setStickerSetThumb

        Boolean setStickerSetThumb​(String name,
                                   Integer user_id,
                                   File thumb)
                            throws TelegramException
        Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only
        Parameters:
        name - Sticker set name
        user_id - User identifier of the sticker set owner
        thumb - A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/animated_stickers#technical-requirements for animated sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files ». Animated sticker set thumbnail can't be uploaded via HTTP URL.
        Returns:
        True on success.
        Throws:
        TelegramException
      • setStickerSetThumb

        Boolean setStickerSetThumb​(String name,
                                   Integer user_id,
                                   String thumb)
                            throws TelegramException
        Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only
        Parameters:
        name - Sticker set name
        user_id - User identifier of the sticker set owner
        thumb - A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/animated_stickers#technical-requirements for animated sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files ». Animated sticker set thumbnail can't be uploaded via HTTP URL.
        Returns:
        True on success.
        Throws:
        TelegramException
      • answerInlineQuery

        default Boolean answerInlineQuery​(String inlineQueryId,
                                          List<InlineQueryResult> results)
                                   throws TelegramException
        Use this method to send answers to an inline query. On success, True is returned. No more than 50 results per query are allowed.
        Parameters:
        inlineQueryId - Unique identifier for the answered query
        results - A JSON-serialized array of results for the inline query
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • answerInlineQuery

        Boolean answerInlineQuery​(String inlineQueryId,
                                  List<InlineQueryResult> results,
                                  Integer cache_time,
                                  Boolean is_personal,
                                  String next_offset,
                                  String switch_pm_text,
                                  String switch_pm_parameter)
                           throws TelegramException
        Use this method to send answers to an inline query. On success, True is returned. No more than 50 results per query are allowed.
        Parameters:
        inlineQueryId - Unique identifier for the answered query
        results - A JSON-serialized array of results for the inline query
        cache_time - The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.
        is_personal - Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query
        next_offset - Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes.
        switch_pm_text - If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter
        switch_pm_parameter - Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.
        Returns:
        On success, True is returned.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendInvoice

        default Message sendInvoice​(Integer chat_id,
                                    String title,
                                    String description,
                                    String payload,
                                    String provider_token,
                                    String start_parameter,
                                    String currency,
                                    List<LabeledPrice> prices)
                             throws TelegramException
        Use this method to send invoices. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target private chat
        title - Product name
        description - Product description
        payload - Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
        provider_token - Payments provider token, obtained via Botfather
        start_parameter - Unique deep-linking parameter that can be used to generate this invoice when used as a start parameter
        currency - Three-letter ISO 4217 currency code, see more on https://core.telegram.org/bots/payments#supported-currencies
        prices - Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendInvoice

        Message sendInvoice​(Integer chat_id,
                            String title,
                            String description,
                            String payload,
                            String provider_token,
                            String start_parameter,
                            String currency,
                            List<LabeledPrice> prices,
                            String provider_data,
                            String photo_url,
                            Integer photo_size,
                            Integer photo_width,
                            Integer photo_height,
                            Boolean need_name,
                            Boolean need_phone_number,
                            Boolean need_email,
                            Boolean need_shipping_address,
                            Boolean send_phone_number_to_provider,
                            Boolean send_email_to_provider,
                            Boolean is_flexible,
                            Boolean disable_notification,
                            Integer reply_to_message_id,
                            InlineKeyboardMarkup reply_markup)
                     throws TelegramException
        Use this method to send invoices. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target private chat
        title - Product name
        description - Product description
        payload - Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
        provider_token - Payments provider token, obtained via Botfather
        start_parameter - Unique deep-linking parameter that can be used to generate this invoice when used as a start parameter
        currency - Three-letter ISO 4217 currency code, see more on https://core.telegram.org/bots/payments#supported-currencies
        prices - Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
        provider_data - JSON-encoded data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
        photo_url - URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.
        photo_size - Photo size
        photo_width - Photo width
        photo_height - Photo height
        need_name - Pass True, if you require the user's full name to complete the order
        need_phone_number - Pass True, if you require the user's phone number to complete the order
        need_email - Pass True, if you require the user's email to complete the order
        need_shipping_address - Pass True, if you require the user's shipping address to complete the order
        send_phone_number_to_provider - Pass True, if user's phone number should be sent to provider
        send_email_to_provider - Pass True, if user's email address should be sent to provider
        is_flexible - Pass True, if the final price depends on the shipping method
        disable_notification - Sends the message silently. Users will receive a notification with no sound.
        reply_to_message_id - If the message is a reply, ID of the original message
        reply_markup - A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button.
        Returns:
        Message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • answerShippingQuery

        default Boolean answerShippingQuery​(String shipping_query_id,
                                            Boolean ok)
                                     throws TelegramException
        If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.
        Parameters:
        shipping_query_id - Unique identifier for the query to be answered
        ok - Specify True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)
        Returns:
        True on success
        Throws:
        TelegramException - if the method fails in Telegram servers
      • answerShippingQuery

        Boolean answerShippingQuery​(String shipping_query_id,
                                    Boolean ok,
                                    List<ShippingOption> shipping_options,
                                    String error_message)
                             throws TelegramException
        If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.
        Parameters:
        shipping_query_id - Unique identifier for the query to be answered
        ok - Specify True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)
        shipping_options - Required if ok is True. A JSON-serialized array of available shipping options.
        error_message - Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.
        Returns:
        True on success
        Throws:
        TelegramException - if the method fails in Telegram servers
      • answerPreCheckoutQuery

        default Boolean answerPreCheckoutQuery​(String pre_checkout_query_id,
                                               Boolean ok)
                                        throws TelegramException
        Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
        Parameters:
        pre_checkout_query_id - Unique identifier for the query to be answered
        ok - Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.
        Returns:
        On success, True is returned
        Throws:
        TelegramException - if the method fails in Telegram servers
      • answerPreCheckoutQuery

        Boolean answerPreCheckoutQuery​(String pre_checkout_query_id,
                                       Boolean ok,
                                       String error_message)
                                throws TelegramException
        Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
        Parameters:
        pre_checkout_query_id - Unique identifier for the query to be answered
        ok - Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.
        error_message - Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.
        Returns:
        On success, True is returned
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendGame

        default Message sendGame​(Object chat_id,
                                 String game_short_name)
                          throws TelegramException
        Use this method to send a game. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat
        game_short_name - Short name of the game, serves as the unique identifier for the game.
        Returns:
        On success, the sent message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • sendGame

        Message sendGame​(Object chat_id,
                         String game_short_name,
                         Boolean disable_notification,
                         Integer reply_to_message_id,
                         InlineKeyboardMarkup reply_markup)
                  throws TelegramException
        Use this method to send a game. On success, the sent Message is returned.
        Parameters:
        chat_id - Unique identifier for the target chat
        game_short_name - Short name of the game, serves as the unique identifier for the game.
        disable_notification - Sends the message silently. Users will receive a notification with no sound.
        reply_to_message_id - If the message is a reply, ID of the original message
        reply_markup - A JSON-serialized object for an inline keyboard. If empty, one ‘Play game_title’ button will be shown. If not empty, the first button must launch the game.
        Returns:
        On success, the sent message
        Throws:
        TelegramException - if the method fails in Telegram servers
      • setGameScore

        default Object setGameScore​(Integer user_id,
                                    Integer score)
                             throws TelegramException
        Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.
        Parameters:
        user_id - User identifier
        score - New score, must be non-negative
        Returns:
        the Message, true or false
        Throws:
        TelegramException - if the method fails in Telegram servers
      • setGameScore

        Object setGameScore​(Integer user_id,
                            Integer score,
                            Boolean force,
                            Boolean disable_edit_message,
                            Object chat_id,
                            Integer message_id,
                            String inline_message_id)
                     throws TelegramException
        Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.
        Parameters:
        user_id - User identifier
        score - New score, must be non-negative
        force - Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters
        disable_edit_message - Pass True, if the game message should not be automatically edited to include the current scoreboard
        chat_id - Required if inline_message_id is not specified. Unique identifier for the target chat
        message_id - Required if inline_message_id is not specified. Identifier of the sent message
        inline_message_id - Required if chat_id and message_id are not specified. Identifier of the inline message
        Returns:
        the Message, true or false
        Throws:
        TelegramException - if the method fails in Telegram servers
      • getGameHighScores

        default List<GameHighScore> getGameHighScores​(Integer user_id)
                                               throws TelegramException
        Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game.
        Parameters:
        user_id - Target user id
        Returns:
        On success, returns an Array of GameHighScore objects.
        Throws:
        TelegramException - if the method fails in Telegram servers
      • getGameHighScores

        List<GameHighScore> getGameHighScores​(Integer user_id,
                                              Object chat_id,
                                              Integer message_id,
                                              String inline_message_id)
                                       throws TelegramException
        Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game.
        Parameters:
        user_id - Target user id
        chat_id - Required if inline_message_id is not specified. Unique identifier for the target chat
        message_id - Required if inline_message_id is not specified. Identifier of the sent message
        inline_message_id - Required if chat_id and message_id are not specified. Identifier of the inline message
        Returns:
        On success, returns an Array of GameHighScore objects.
        Throws:
        TelegramException - if the method fails in Telegram servers