Class BotContext

java.lang.Object
io.github.natanimn.telebof.BotContext

public class BotContext extends Object
This class implemented all classes defined in io.github.natanimn.telebof.requests as directly usable methods.
Since:
March 3, 2025
  • Constructor Details

  • Method Details

    • setWebhook

      public SetWebhook setWebhook(String url)

      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

      If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secretToken. If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content.

      Parameters:
      url - holds parameters for webhook.
      See Also:
    • getWebhookInfo

      public WebhookInfo getWebhookInfo()
    • deleteWebhook

      public void deleteWebhook()
      Use this method to remove webhook integration if you decide to back getUpdates.
      See Also:
    • getMe

      public GetMe getMe()
      A simple method for testing your bot's authentication token.
      Returns:
      GetMe
    • logOut

      public LogOut logOut()
      Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes.
      Returns:
      LogOut
    • close

      public Close close()
      Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched.
      Returns:
      Close
    • sendMessage

      public SendMessage sendMessage(Object chat_id, String text)
      Use this method to send text messages.
      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, 1-4096 characters after entities parsing
      Returns:
      SendMessage
    • downloadFile

      public byte[] downloadFile(String file_path)
      Use this method to download files up to 20MB in size. On success, a File object is returned.
      Parameters:
      file_path - taken from GetFile 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(String) again
      Returns:
      array of byte
    • forward

      public ForwardMessage forward(Object chat_id, Object from_chat_id, int message_id)
      Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded.
      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 - Message identifier in the chat specified in from_chat_id
      Returns:
      ForwardMessage
    • copy

      public CopyMessage copy(Object chat_id, Object from_chat_id, int message_id)
      Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message.
      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 - Message identifier in the chat specified in from_chat_id
      Returns:
      CopyMessage
    • forwardMessages

      public ForwardMessages forwardMessages(Object chat_id, Object from_chat_id, Integer[] message_id)
      Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages.
      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 messages were sent (or channel username in the format @channelusername)
      message_id - A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order.
      Returns:
      ForwardMessages
    • sendPhoto

      public SendPhoto sendPhoto(Object chat_id, String photo)
      Use this method to send photos.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      photo - Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet
      Returns:
      SendPhoto
    • sendPhoto

      public SendPhoto sendPhoto(Object chat_id, File photo)
      Use this method to send photos.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      photo - Photo to send. Upload new photo using File. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20
      Returns:
      SendPhoto
    • sendAudio

      public SendAudio sendAudio(Object chat_id, String audio)
      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 or .M4A format. Bots can currently send audio 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)
      audio - Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), or pass an HTTP URL as a String for Telegram to get an audio file from the Internet.
      Returns:
      SendAudio
    • sendAudio

      public SendAudio sendAudio(Object chat_id, File audio)
      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 or .M4A format. Bots can currently send audio 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)
      audio - Audio file to send. Upload using File.
      Returns:
      SendAudio
    • sendDocument

      public SendDocument sendDocument(Object chat_id, String document)
      Use this method to send general files. 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. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), or pass an HTTP URL as a String for Telegram to get a file from the Internet.
      Returns:
      SendDocument
    • sendDocument

      public SendDocument sendDocument(Object chat_id, File document)
      Use this method to send general files. 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. Upload using File
      Returns:
      SendDocument
    • sendVideo

      public SendVideo sendVideo(Object chat_id, String video)
      Use this method to send video files, Telegram clients support MPEG4 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 to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), or pass an HTTP URL as a String for Telegram to get a video from the Internet
      Returns:
      SendVideo
    • sendVideo

      public SendVideo sendVideo(Object chat_id, File video)
      Use this method to send video files, Telegram clients support MPEG4 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 to send. Upload using File
      Returns:
      SendVideo
    • sendAnimation

      public SendAnimation sendAnimation(Object chat_id, String animation)
      Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). 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), or pass an HTTP URL as a String for Telegram to get an animation from the Internet.
      Returns:
      SendAnimation
    • sendAnimation

      public SendAnimation sendAnimation(Object chat_id, File animation)
      Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). 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. Upload using File.
      Returns:
      SendAnimation
    • sendVoice

      public SendVoice sendVoice(Object chat_id, String voice)
      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, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document). 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. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), or pass an HTTP URL as a String for Telegram to get a file from the Internet.
      Returns:
      SendVoice
    • sendVoice

      public SendVoice sendVoice(Object chat_id, File voice)
      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, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document). 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. Upload using File
      Returns:
      SendVoice
    • sendVideoNote

      public SendVideoNote sendVideoNote(Object chat_id, String video_note)
      As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long.
      Use this method to send video messages.
      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)
      Returns:
      SendVideoNote
    • sendVideoNote

      public SendVideoNote sendVideoNote(Object chat_id, File video_note)
      As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long.
      Use this method to send video messages.
      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. Upload using File
      Returns:
      SendVideoNote
    • sendMediaGroup

      public SendMediaGroup sendMediaGroup(Object chat_id, InputMedia[] media)
      Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      media - An array of InputMediaVideo, InputMediaAudio, InputMediaPhoto, or InputMediaDocument describing messages to be sent, must include 2-10 items.
      Returns:
      SendMediaGroup
    • sendPaidMedia

      public SendPaidMedia sendPaidMedia(Object chat_id, short star_count, InputPaidMedia[] media)
      Use this method to send paid media.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername). If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance.
      star_count - The number of Telegram Stars that must be paid to buy access to the media; 1-10000
      media - A JSON-serialized array describing the media to be sent; up to 10 items
      Returns:
      SendPaidMedia
    • sendLocation

      public SendLocation sendLocation(Object chat_id, double latitude, double longitude)
      Use this method to send point on the map.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      latitude - Latitude of the location
      longitude - Longitude of the location
      Returns:
      SendLocation
    • editMessageLiveLocation

      public EditMessageLiveLocation editMessageLiveLocation(Object chat_id, double latitude, double longitude, int message_id)
      Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, the edited Message 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)
      latitude - Latitude of new location
      longitude - Longitude of new location
      message_id - Required if inline_message_id is not specified. Identifier of the message to edit
      Returns:
      EditMessageLiveLocation
    • editMessageLiveLocation

      public EditMessageLiveLocation editMessageLiveLocation(String inline_message_id, double latitude, double longitude)
      Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, True is returned.
      Parameters:
      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
      Returns:
      EditMessageLiveLocation
    • editUserStarSubscription

      public EditUserStarSubscription editUserStarSubscription(long user_id, String telegram_charge_id, boolean is_cancelled)
      This a method that allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars.
      Parameters:
      user_id - Identifier of the user whose subscription will be edited
      telegram_charge_id - Telegram payment identifier for the subscription
      is_cancelled - Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot.
      Returns:
      EditUserStarSubscription
    • stopMessageLiveLocation

      public StopMessageLiveLocation stopMessageLiveLocation(Object chat_id, int message_id)
      Use this method to stop updating a live location message before live_period expires. On success, the edited Message 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 message with live location to stop
      Returns:
      StopMessageLiveLocation
    • stopMessageLiveLocation

      public StopMessageLiveLocation stopMessageLiveLocation(String inline_message_id)
      Use this method to stop updating a live location message before live_period expires. On success, True is returned.
      Parameters:
      inline_message_id - Required if chat_id and message_id are not specified.
      Identifier of the inline message
      Returns:
      StopMessageLiveLocation
    • editMessageChecklist

      public EditMessageChecklist editMessageChecklist(String business_connection_id, Object chat_id, Integer message_id, InputChecklist checklist)
      Use this method to edit a checklist on behalf of a connected business account.
      Parameters:
      business_connection_id - Unique identifier of the business connection on behalf of which the message will be sent
      chat_id - Unique identifier for the target chat
      message_id - Unique identifier for the target message
      checklist - A JSON-serialized object for the new checklist
      Returns:
      EditMessageChecklist
    • sendVenue

      public SendVenue sendVenue(Object chat_id, double latitude, double longitude, String title, String address)
      Use this method to send information about a venue.
      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:
      SendVenue
    • sendContact

      public SendContact sendContact(Object chat_id, String phone_number, String first_name)
      Use this method to send phone contacts.
      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:
      SendContact
    • sendPoll

      public SendPoll sendPoll(Object chat_id, String question, InputPollOption[] options)
      Use this method to send a native poll.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      question - Poll question, 1-300 characters
      options - A JSON-serialized list of 2-12 answer options
      Returns:
      SendPoll
    • sendChecklist

      public SendChecklist sendChecklist(String business_connection_id, Object chat_id, InputChecklist checklist)
      Use this method to send a checklist on behalf of a connected business account.
      Parameters:
      business_connection_id - Unique identifier of the business connection on behalf of which the message will be sent
      chat_id - Unique identifier for the target chat
      checklist - A JSON-serialized object for the checklist to send
      Returns:
      SendChecklist
    • sendDice

      public SendDice sendDice(Object chat_id)
      Use this method to send an animated emoji that will display a random value.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      Returns:
      SendDice
    • sendChatAction

      public SendChatAction sendChatAction(Object chat_id, ChatAction action)
      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).
      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: ChatAction.TYPING for text messages, ChatAction.UPLOAD_PHOTO for photos, ChatAction.RECORD_VIDEO or ChatAction.UPLOAD_VIDEO for videos, ChatAction.RECORD_VOICE or ChatAction.UPLOAD_VOICE for voice notes, ChatAction.UPLOAD_DOCUMENT for general files, ChatAction.CHOSE_STICKER for stickers, ChatAction.FIND_LOCATION for location data, ChatAction.RECORD_VIDEO_NOTE or ChatAction.UPLOAD_VIDEO_NOTE for video notes.
      Returns:
      SendChatAction
    • sendGift

      public SendGift sendGift(long user_id, String gift_id)
      Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver
      Parameters:
      user_id - Unique identifier of the target user who will receive the gift.
      gift_id - Identifier of the gift
      Returns:
      SendGift
    • sendGift

      public SendGift sendGift(Object chat_id, String gift_id)
      Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver
      Parameters:
      chat_id - Unique identifier for the chat or username of the channel (in the format @channelusername) that will receive the gift.
      gift_id - Identifier of the gift
      Returns:
      SendGift
    • giftPremiumSubscription

      public GiftPremiumSubscription giftPremiumSubscription(long user_id, Integer month_count, Integer star_count)
      Gifts a Telegram Premium subscription to the given user.
      Parameters:
      user_id - Unique identifier of the target user who will receive a Telegram Premium subscription
      month_count - Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12
      star_count - Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months
      Returns:
      GiftPremiumSubscription
    • getUserProfilePhotos

      public GetUserProfilePhotos getUserProfilePhotos(long user_id)
      Use this method to get a list of profile pictures for a user.
      Parameters:
      user_id - Unique identifier of the target user
      Returns:
      GetUserProfilePhotos
    • refundStarPayment

      public RefundStarPayment refundStarPayment(long user_id, String telegram_payment_change_id)
      Refunds a successful payment in Telegram Stars.
      Parameters:
      user_id - Identifier of the user whose payment will be refunded
      telegram_payment_change_id - Telegram payment identifier
      Returns:
      RefundStarPayment
    • verifyUser

      public VerifyUser verifyUser(long user_id)
      Verifies a user on behalf of the organization which is represented by the bot.
      Parameters:
      user_id - Unique identifier of the target user
      Returns:
      VerifyUser
    • verifyUChat

      public VerifyChat verifyUChat(Object chat_id)
      Verifies a c chat on behalf of the organization which is represented by the bot.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      Returns:
      VerifyUser
    • removeUserVerification

      public RemoveUserVerification removeUserVerification(long user_id)
      Removes verification from a user who is currently verified on behalf of the organization represented by the bot.
      Parameters:
      user_id - Unique identifier of the target user
      Returns:
      RemoveUserVerification
    • removeChatVerification

      public RemoveChatVerification removeChatVerification(Object chat_id)
      Removes verification from a chat that is currently verified on behalf of the organization represented by the bot.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      Returns:
      RemoveUserVerification
    • readBusinessMessage

      public ReadBusinessMessage readBusinessMessage(long chat_id, String business_connection_id, int message_id)
      Marks incoming message as read on behalf of a business account. Requires the can_read_messages business bot right.
      Parameters:
      chat_id - Unique identifier of the chat in which the message was received. The chat must have been active in the last 24 hours.
      business_connection_id - Unique identifier of the business connection on behalf of which to read the message
      message_id - Unique identifier of the message to mark as read
      Returns:
      ReadBusinessMessage
    • deleteBusinessMessages

      public DeleteBusinessMessages deleteBusinessMessages(String business_connection_id, Integer[] message_ids)
      Delete messages on behalf of a business account. Requires the can_delete_sent_messages business bot right to delete messages sent by the bot itself, or the can_delete_all_messages business bot right to delete any message.
      Parameters:
      business_connection_id - Unique identifier of the business connection on behalf of which to delete the messages
      message_ids - A JSON-serialized list of 1-100 identifiers of messages to delete. All messages must be from the same chat
      See deleteMessage(java.lang.Object, int) for limitations on which messages can be deleted
      Returns:
      DeleteBusinessMessages
    • setBusinessAccountName

      public SetBusinessAccountName setBusinessAccountName(String business_connection_id, String first_name)
      Changes the first and last name of a managed business account. Requires the can_change_name business bot right.
      Parameters:
      business_connection_id - Unique identifier of the business connection
      first_name - The new value of the first name for the business account; 1-64 characters
      Returns:
      SetBusinessAccountName
    • setBusinessAccountUsername

      public SetBusinessAccountUsername setBusinessAccountUsername(String business_connection_id)
      Changes the username of a managed business account. Requires the can_change_username business bot right.
      Parameters:
      business_connection_id - Unique identifier of the business connection
      Returns:
      SetBusinessAccountUsername
    • setBusinessAccountBio

      public SetBusinessAccountBio setBusinessAccountBio(String business_connection_id)
      Changes the bio of a managed business account. Requires the can_change_bio business bot right.
      Parameters:
      business_connection_id - Unique identifier of the business connection
      Returns:
      SetBusinessAccountBio
    • setBusinessAccountProfilePhoto

      public SetBusinessAccountProfilePhoto setBusinessAccountProfilePhoto(String business_connection_id, InputProfilePhoto photo)
      Changes the profile photo of a managed business account. Requires the can_edit_profile_photo business bot right.
      Parameters:
      business_connection_id - Unique identifier of the business connection
      photo - The new profile photo to set
      Returns:
      SetBusinessAccountProfilePhoto
    • removeBusinessAccountProfilePhoto

      public RemoveBusinessAccountProfilePhoto removeBusinessAccountProfilePhoto(String business_connection_id)
      Removes the current profile photo of a managed business account. Requires the can_edit_profile_photo business bot right
      Parameters:
      business_connection_id - Unique identifier of the business connection
      Returns:
      RemoveBusinessAccountProfilePhoto
    • setBusinessAccountGiftSettings

      public SetBusinessAccountGiftSettings setBusinessAccountGiftSettings(String business_connection_id, boolean show_gift_button, AcceptedGiftTypes accepted_gift_types)
      Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the can_change_gift_settings business bot right.
      Parameters:
      business_connection_id - Unique identifier of the business connection
      show_gift_button - Pass True, if a button for sending a gift to the user or by the business account must always be shown in the input field
      accepted_gift_types - Types of gifts accepted by the business account
      Returns:
      SetBusinessAccountGiftSettings
    • getBusinessAccountStarBalance

      public GetBusinessAccountStarBalance getBusinessAccountStarBalance(String business_connection_id)
      Returns the amount of Telegram Stars owned by a managed business account. Requires the can_view_gifts_and_stars business bot right.
      Parameters:
      business_connection_id - Unique identifier of the business connection
      Returns:
      GetBusinessAccountStarBalance
    • transferBusinessAccountStars

      public TransferBusinessAccountStars transferBusinessAccountStars(String business_connection_id, short star_count)
      Transfers Telegram Stars from the business account balance to the bot's balance. Requires the can_transfer_stars business bot right.
      Parameters:
      business_connection_id - Unique identifier of the business connection
      star_count - Number of Telegram Stars to transfer; 1-10000
      Returns:
      TransferBusinessAccountStars
    • getBusinessAccountGifts

      public GetBusinessAccountGifts getBusinessAccountGifts(String business_connection_id)
      Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right.
      Parameters:
      business_connection_id - Unique identifier of the business connection
      Returns:
      GetBusinessAccountGifts
    • convertGiftToStars

      public ConvertGiftToStars convertGiftToStars(String business_connection_id, String owned_gift_id)
      Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right.
      Parameters:
      business_connection_id - Unique identifier of the business connection
      owned_gift_id - Unique identifier of the regular gift that should be converted to Telegram Stars
      Returns:
      ConvertGiftToStars
    • upgradeGift

      public UpgradeGift upgradeGift(String business_connection_id, String owned_gift_id)
      Upgrades a given regular gift to a unique gift. Requires the can_transfer_and_upgrade_gifts business bot right. Additionally, requires the can_transfer_stars business bot right if the upgrade is paid.
      Parameters:
      business_connection_id - Unique identifier of the business connection
      owned_gift_id - Unique identifier of the regular gift that should be upgraded to a unique one
      Returns:
      UpgradeGift
    • transferGift

      public TransferGift transferGift(String business_connection_id, String owned_gift_id, long new_owner_chat_id)
      Transfers an owned unique gift to another user. Requires the can_transfer_and_upgrade_gifts business bot right. Requires can_transfer_stars business bot right if the transfer is paid.
      Parameters:
      business_connection_id - Unique identifier of the business connection
      owned_gift_id - Unique identifier of the regular gift that should be transferred
      new_owner_chat_id - Unique identifier of the chat which will own the gift. The chat must be active in the last 24 hours.
      Returns:
      TransferGift
    • postStory

      public PostStory postStory(String business_connection_id, InputStoryContent content, Integer active_period)
      Posts a story on behalf of a managed business account. Requires the can_manage_stories business bot right.
      Parameters:
      business_connection_id - Unique identifier of the business connection
      content - Content of the story
      active_period - Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400
      Returns:
      PostStory
    • editStory

      public EditStory editStory(String business_connection_id, Integer story_id, InputStoryContent content)
      Edits a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right.
      Parameters:
      business_connection_id - Unique identifier of the business connection
      story_id - Unique identifier of the story to edit
      content - Content of the story
      Returns:
      EditStory
    • deleteStory

      public DeleteStory deleteStory(String business_connection_id, Integer story_id)
      Deletes a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right.
      Parameters:
      business_connection_id - Unique identifier of the business connection
      story_id - Unique identifier of the story to delete
      Returns:
      DeleteStory
    • getFile

      public GetFile getFile(String file_id)
      Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. The file can then be downloaded via downloadFile(String) where field 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 information about
      Returns:
      GetFile
    • banChatMember

      public BanChatMember banChatMember(Object chat_id, long user_id)
      Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
      Parameters:
      chat_id - Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)
      user_id - Unique identifier of the target user
      Returns:
      BanChatMember
    • unbanChatMember

      public UnbanChatMember unbanChatMember(Object chat_id, long user_id)
      Use this method to unban a previously banned 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. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned.
      Parameters:
      chat_id - Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)
      user_id - Unique identifier of the target user
      Returns:
      UnbanChatMember
    • unbanChatSenderChat

      public UnbanChatSenderChat unbanChatSenderChat(Object chat_id, long sender_chat_id)
      Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      sender_chat_id - Unique identifier of the target sender chat
      Returns:
      UnbanChatSenderChat
    • restrictChatMember

      public RestrictChatMember restrictChatMember(Object chat_id, long user_id, ChatPermissions permissions)
      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 administrator rights. Pass True for all permissions to lift restrictions from 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
      permissions - A JSON-serialized object for new user permissions
      Returns:
      RestrictChatMember
    • promoteChatMember

      public PromoteChatMember promoteChatMember(Object chat_id, long user_id)
      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 administrator 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 channel (in the format @channelusername)
      user_id - Unique identifier of the target user
      Returns:
      PromoteChatMember
    • setChatAdministratorCustomTitle

      public SetChatAdministratorCustomTitle setChatAdministratorCustomTitle(Object chat_id, long user_id, String custom_title)
      Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.
      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:
      SetChatAdministratorCustomTitle
    • setUserEmojiStatus

      public SetUserEmojiStatus setUserEmojiStatus(long user_id)
      This method Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Return True on success
      Parameters:
      user_id - Unique identifier of the target user
      Returns:
      SetUserEmojiStatus
    • banChatSenderChat

      public BanChatSenderChat banChatSenderChat(Object chat_id, long sender_chat_id)
      Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      sender_chat_id - Unique identifier of the target sender chat
      Returns:
      BanChatSenderChat
    • setChatPermissions

      public SetChatPermissions setChatPermissions(Object chat_id, ChatPermissions permissions)
      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 administrator rights.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
      permissions - A JSON-serialized object for new default chat permissions
      Returns:
      SetChatPermissions
    • exportChatInviteLink

      public ExportChatInviteLink exportChatInviteLink(Object chat_id)
      Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      Returns:
      ExportChatInviteLink
    • createChatInviteLink

      public CreateChatInviteLink createChatInviteLink(Object chat_id)
      Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink(java.lang.Object, java.lang.String).
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      Returns:
      CreateChatInviteLink
    • createChatSubscriptionInviteLink

      public CreateChatSubscriptionInviteLink createChatSubscriptionInviteLink(Object chat_id, int subscription_period, int subscription_price)
      Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink(java.lang.Object, java.lang.String) or revoked using the method revokeChatInviteLink(java.lang.Object, java.lang.String).
      Parameters:
      chat_id - Unique identifier for the target channel chat or username of the target channel (in the format @channelusername)
      subscription_period - The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
      subscription_price - The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000
      Returns:
      CreateChatSubscriptionInviteLink
    • editChatInviteLink

      public EditChatInviteLink editChatInviteLink(Object chat_id, String invite_link)
      Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      invite_link - The invite link to edit
      Returns:
      EditChatInviteLink
    • editChatSubscriptionInviteLink

      public EditChatSubscriptionInviteLink editChatSubscriptionInviteLink(Object chat_id, String invite_link)
      Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      invite_link - The invite link to edit
      Returns:
      EditChatSubscriptionInviteLink
    • revokeChatInviteLink

      public RevokeChatInviteLink revokeChatInviteLink(Object chat_id, String invite_link)
      Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
      Parameters:
      chat_id - Unique identifier of the target chat or username of the target channel (in the format @channelusername)
      invite_link - The invite link to revoke
      Returns:
      RevokeChatInviteLink
    • approveChatJoinRequest

      public ApproveChatJoinRequest approveChatJoinRequest(Object chat_id, long user_id)
      Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      user_id - Unique identifier of the target user
      Returns:
      ApproveChatJoinRequest
    • declineChatJoinRequest

      public DeclineChatJoinRequest declineChatJoinRequest(Object chat_id, long user_id)
      Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      user_id - Unique identifier of the target user
      Returns:
      DeclineChatJoinRequest
    • setChatPhoto

      public SetChatPhoto setChatPhoto(Object chat_id, File photo)
      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 administrator rights.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      photo - New chat photo, uploaded using File
      Returns:
      SetChatPhoto
    • deleteChatPhoto

      public DeleteChatPhoto deleteChatPhoto(Object chat_id)
      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 administrator rights.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      Returns:
      DeleteChatPhoto
    • setChatTitle

      public SetChatTitle setChatTitle(Object chat_id, String title)
      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 administrator rights.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      title - New chat title, 1-128 characters
      Returns:
      SetChatTitle
    • setChatDescription

      public SetChatDescription setChatDescription(Object chat_id, String description)
      Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator 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:
      SetChatDescription
    • pinChatMessage

      public PinChatMessage pinChatMessage(Object chat_id, int message_id)
      Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a 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:
      PinChatMessage
    • unpinChatMessage

      public UnpinChatMessage unpinChatMessage(Object chat_id)
      Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      Returns:
      UnpinChatMessage
    • unpinAllChatMessages

      public UnpinAllChatMessages unpinAllChatMessages(Object chat_id)
      Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      Returns:
      UnpinAllChatMessages
    • getMyStarBalance

      public GetMyStarBalance getMyStarBalance()
      A method to get the current Telegram Stars balance of the bot. Requires no parameters.
      Returns:
      GetMyStarBalance
    • getStarTransactions

      public GetStarTransactions getStarTransactions()
      Returns the bot's Telegram Star transactions in chronological order.
      Returns:
      GetStarTransactions
    • leaveChat

      public LeaveChat leaveChat(Object chat_id)
      Use this method for your bot to leave a group, supergroup or channel.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
      Returns:
      LeaveChat
    • getChat

      public GetChat getChat(Object chat_id)
      Use this method to get up-to-date information about the chat.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
      Returns:
      GetChat
    • getUserChatBoosts

      public GetUserChatBoosts getUserChatBoosts(Object chat_id, long user_id)
      Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat.
      Parameters:
      chat_id - Unique identifier for the chat or username of the channel (in the format @channelusername)
      user_id - Unique identifier of the target user
      Returns:
      GetUserChatBoosts
    • getChatAdministrators

      public GetChatAdministrators getChatAdministrators(Object chat_id)
      Use this method to get a list of administrators in a chat, which aren't bots.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
      Returns:
      GetChatAdministrators
    • getChatMemberCount

      public GetChatMemberCount getChatMemberCount(Object chat_id)
      Use this method to get the number of members in a chat.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
      Returns:
      GetChatMemberCount
    • getChatMember

      public GetChatMember getChatMember(Object chat_id, long user_id)
      Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat
      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:
      GetChatMember
    • setMessageReaction

      public SetMessageReaction setMessageReaction(Object chat_id, int message_id)
      Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      message_id - Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.
      Returns:
      SetMessageReaction
    • setChatStickerSet

      public SetChatStickerSet setChatStickerSet(Object chat_id, String sticker_set_name)
      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 administrator rights. Use the field can_set_sticker_set optionally returned in getChat(java.lang.Object) 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:
      SetChatStickerSet
    • deleteChatStickerSet

      public DeleteChatStickerSet deleteChatStickerSet(Object chat_id)
      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 administrator rights. Use the field can_set_sticker_set optionally returned in getChat(java.lang.Object) 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)
      Returns:
      DeleteChatStickerSet
    • getForumTopicIconStickers

      public GetForumTopicIconStickers getForumTopicIconStickers()
      Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters.
      Returns:
      GetForumTopicIconStickers
    • createForumTopic

      public CreateForumTopic createForumTopic(Object chat_id, String name)
      Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
      name - Topic name, 1-128 characters
      Returns:
      CreateForumTopic
    • editForumTopic

      public EditForumTopic editForumTopic(Object chat_id, int message_thread_id)
      Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
      message_thread_id - Unique identifier for the target message thread of the forum topic
      Returns:
      EditForumTopic
    • closeForumTopic

      public CloseForumTopic closeForumTopic(Object chat_id, int message_thread_id)
      Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
      message_thread_id - Unique identifier for the target message thread of the forum topic
      Returns:
      CloseForumTopic
    • reopenForumTopic

      public ReopenForumTopic reopenForumTopic(Object chat_id, int message_thread_id)
      Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
      message_thread_id - Unique identifier for the target message thread of the forum topic
      Returns:
      ReopenForumTopic
    • deleteForumTopic

      public DeleteForumTopic deleteForumTopic(Object chat_id, int message_thread_id)
      Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
      message_thread_id - Unique identifier for the target message thread of the forum topic
      Returns:
      DeleteForumTopic
    • unpinAllForumTopicMessages

      public UnpinAllForumTopicMessages unpinAllForumTopicMessages(Object chat_id, int message_thread_id)
      Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
      message_thread_id - Unique identifier for the target message thread of the forum topic
      Returns:
      UnpinAllForumTopicMessages
    • editGeneralForumTopic

      public EditGeneralForumTopic editGeneralForumTopic(Object chat_id, String name)
      Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
      name - New topic name, 1-128 characters
      Returns:
      EditGeneralForumTopic
    • closeGeneralForumTopic

      public CloseGeneralForumTopic closeGeneralForumTopic(Object chat_id)
      Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
      Returns:
      CloseForumTopic
    • reopenGeneralForumTopic

      public ReopenGeneralForumTopic reopenGeneralForumTopic(Object chat_id)
      Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
      Returns:
      ReopenGeneralForumTopic
    • hideGeneralForumTopic

      public HideGeneralForumTopic hideGeneralForumTopic(Object chat_id)
      Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
      Returns:
      HideGeneralForumTopic
    • unHideGeneralForumTopic

      public UnHideGeneralForumTopic unHideGeneralForumTopic(Object chat_id)
      Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
      Returns:
      UnHideGeneralForumTopic
    • unpinAllGeneralForumTopicMessages

      public UnpinAllGeneralForumTopicMessages unpinAllGeneralForumTopicMessages(Object chat_id)
      Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
      Returns:
      UnpinAllGeneralForumTopicMessages
    • answerCallbackQuery

      public AnswerCallbackQuery answerCallbackQuery(String callback_query_id)
      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
      Returns:
      AnswerCallbackQuery
    • answerCallbackQuery

      public AnswerCallbackQuery answerCallbackQuery(String callback_query_id, String text)
      Parameters:
      callback_query_id - Unique identifier for the query to be answered
      text - text Text of the notification.
      Returns:
      AnswerCallbackQuery
    • setMyCommands

      public SetMyCommands setMyCommands(BotCommand[] commands)
      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:
      SetMyCommands
      See Also:
    • deleteMyCommands

      public DeleteMyCommands deleteMyCommands()
      Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users.
      Returns:
      DeleteMyCommands
    • getMyCommands

      public GetMyCommands getMyCommands()
      Use this method to get the current list of the bot's commands for the given scope and user language.
      Returns:
      GetMyCommands
    • setChatMenuButton

      public SetChatMenuButton setChatMenuButton()
      Use this method to change the bot's menu button in a private chat, or the default menu button.
      Returns:
      SetChatMenuButton
    • getChatMenuButton

      public GetChatMenuButton getChatMenuButton()
      Use this method to get the current value of the bot's menu button in a private chat, or the default menu button.
      Returns:
      GetChatMenuButton
    • setMyDefaultAdministratorRights

      public SetMyDefaultAdministratorRights setMyDefaultAdministratorRights()
      Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot.
      Returns:
      SetMyDefaultAdministratorRights
    • getMyDefaultAdministratorRights

      public GetMyDefaultAdministratorRights getMyDefaultAdministratorRights()
      Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.
      Returns:
      GetMyDefaultAdministratorRights
    • editMessageText

      public EditMessageText editMessageText(String text, Object chat_id, int message_id)
      Use this method to edit text and game messages. On success, the edited Message is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
      Parameters:
      text - New text of the message, 1-4096 characters after entities parsing
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      message_id - Identifier of the message to edit
      Returns:
      EditMessageText
    • editMessageText

      public EditMessageText editMessageText(String text, String inline_message_id)
      Use this method to edit text and game messages. On success, True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
      Parameters:
      text - ew text of the message, 1-4096 characters after entities parsing
      inline_message_id - Identifier of the inline message
      Returns:
      EditMessageText
    • editMessageCaption

      public EditMessageCaption editMessageCaption(Object chat_id, int message_id)
      Use this method to edit captions of messages. On success, the edited Message is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      message_id - Identifier of the message to edit
      Returns:
      EditMessageCaption
    • editMessageCaption

      public EditMessageCaption editMessageCaption(String inline_message_id)
      Use this method to edit captions of messages. On success, True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
      Parameters:
      inline_message_id - Identifier of the inline message
      Returns:
      EditMessageCaption
    • editMessageMedia

      public EditMessageMedia editMessageMedia(Object chat_id, InputMedia media, int message_id)
      Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, the edited Message is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
      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)
      media - A JSON-serialized object for a new media content of the message
      message_id - Required if inline_message_id is not specified. Identifier of the message to edit
      Returns:
      EditMessageMedia
    • editMessageMedia

      public EditMessageMedia editMessageMedia(String inline_message_id, InputMedia media)
      Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, True is returned.
      Parameters:
      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
      Returns:
      EditMessageMedia
    • editMessageReplyMarkup

      public EditMessageReplyMarkup editMessageReplyMarkup(Object chat_id, int message_id)
      Use this method to edit only the reply markup of messages. On success, the edited Message is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
      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 message to edit
      Returns:
      EditMessageReplyMarkup
    • editMessageReplyMarkup

      public EditMessageReplyMarkup editMessageReplyMarkup(String inline_message_id)
      Use this method to edit only the reply markup of messages. On success, True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
      Parameters:
      inline_message_id - Required if chat_id and message_id are not specified. Identifier of the inline message
      Returns:
      EditMessageReplyMarkup
    • stopPoll

      public StopPoll stopPoll(Object chat_id, int message_id)
      Use this method to stop a poll which was sent by the bot.
      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:
      StopPoll
    • deleteMessage

      public DeleteMessage deleteMessage(Object chat_id, int message_id)
      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.
       - Service messages about a supergroup, channel, or forum topic creation can't be deleted.
       - A dice message in a private chat can only be deleted if it was sent more than 24 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 - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      message_id - Identifier of the message to delete
      Returns:
      DeleteMessage
    • deleteMessages

      public DeleteMessages deleteMessages(Object chat_id, Integer[] message_ids)
      Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      message_ids - A JSON-serialized list of 1-100 identifiers of messages to delete.
      Returns:
    • sendSticker

      public SendSticker sendSticker(Object chat_id, File sticker)
      Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      sticker - Sticker to send. Pass .WEBM file
      Returns:
      SendSticker
    • sendSticker

      public SendSticker sendSticker(Object chat_id, String sticker)
      Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      sticker - Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, Video and animated stickers can't be sent via an HTTP URL.
      Returns:
      SendSticker
    • getStickerSet

      public GetStickerSet getStickerSet(String name)
      Use this method to get a sticker set.
      Parameters:
      name - Name of the sticker set
      Returns:
      GetStickerSet
    • getCustomEmojiStickers

      public GetCustomEmojiStickers getCustomEmojiStickers(String[] custom_emoji_ids)
      Use this method to get information about custom emoji stickers by their identifiers.
      Parameters:
      custom_emoji_ids - A JSON-serialized list of custom emoji identifiers. At most 200 custom emoji identifiers can be specified.
      Returns:
      GetCustomEmojiStickers
    • uploadStickerFile

      public UploadStickerFile uploadStickerFile(long user_id, File sticker, StickerFormat sticker_format)
      Parameters:
      user_id - User identifier of sticker file owner
      sticker - A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format.
      sticker_format - Format of the sticker
      Returns:
      UploadStickerFile
    • createNewStickerSet

      public CreateNewStickerSet createNewStickerSet(long user_id, String name, String title, InputSticker[] stickers)
      Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created.
      Parameters:
      user_id - User identifier of created sticker set owner
      name - Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in "_by_". is case-insensitive. 1-64 characters.
      title - Sticker set title, 1-64 characters
      stickers - A JSON-serialized list of 1-50 initial stickers to be added to the sticker set
      Returns:
      CreateNewStickerSet
    • addStickerToSet

      public AddStickerToSet addStickerToSet(long user_id, String name, InputSticker sticker)
      Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers.
      Parameters:
      user_id - User identifier of sticker set owner
      name - Sticker set name
      sticker - A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed.
      Returns:
      AddStickerToSet
    • setStickerPositionInSet

      public SetStickerPositionInSet setStickerPositionInSet(String sticker, int position)
      Use this method to move a sticker in a set created by the bot to a specific position.
      Parameters:
      sticker - File identifier of the sticker
      position - New sticker position in the set, zero-based
      Returns:
      SetStickerPositionInSet
    • deleteStickerFromSet

      public DeleteStickerFromSet deleteStickerFromSet(String sticker)
      Use this method to delete a sticker from a set created by the bot.
      Parameters:
      sticker - File identifier of the sticker
      Returns:
      DeleteStickerFromSet
    • setStickerEmojiList

      public SetStickerEmojiList setStickerEmojiList(String sticker, String[] emoji_list)
      Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot.
      Parameters:
      sticker - File identifier of the sticker
      emoji_list - A JSON-serialized list of 1-20 emoji associated with the sticker
      Returns:
      SetStickerEmojiList
    • setStickerKeywords

      public SetStickerKeywords setStickerKeywords(String sticker, String[] keywords)
      Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot
      Parameters:
      sticker - File identifier of the sticker
      keywords - A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters
      Returns:
      SetStickerKeywords
    • setStickerMaskPosition

      public SetStickerMaskPosition setStickerMaskPosition(String sticker)
      Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot.
      Parameters:
      sticker - File identifier of the sticker
      Returns:
      SetStickerMaskPosition
    • setStickerSetTitle

      public SetStickerSetTitle setStickerSetTitle(String name, String title)
      Use this method to set the title of a created sticker set.
      Parameters:
      name - Sticker set name
      title - Sticker set title, 1-64 characters
      Returns:
      SetStickerSetTitle
    • replaceStickerInSet

      public ReplaceStickerInSet replaceStickerInSet(long user_id, String name, String old_sticker, InputSticker sticker)
      Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling deleteStickerFromSet(java.lang.String), then addStickerToSet(long, java.lang.String, io.github.natanimn.telebof.types.input.InputSticker), then setStickerPositionInSet(java.lang.String, int).
      Parameters:
      user_id - User identifier of the sticker set owner
      name - Sticker set name
      old_sticker - File identifier of the replaced sticker
      sticker - A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged.
      Returns:
      ReplaceStickerInSet
    • setStickerSetThumbnail

      public SetStickerSetThumbnail setStickerSetThumbnail(String name, long user_id, File thumbnail, StickerFormat format)
      Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set.
      Parameters:
      name - Sticker set name
      user_id - User identifier of the sticker set owner
      thumbnail - A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size. animation-requirements for animated sticker technical requirements), or a .WEBM video with the thumbnail up to 32 kilobytes in size; see for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, or pass an HTTP URL as a String for Telegram to get a file from the Internet
      format - Format of the thumbnail, must be one of StickerFormat.STATIC for a .WEBP or .PNG image, StickerFormat.ANIMATED for a .TGS animation, or StickerFormat.VIDEO for a .WEBM video
      Returns:
      SetStickerSetThumbnail
    • setStickerSetThumbnail

      public SetStickerSetThumbnail setStickerSetThumbnail(String name, long user_id, String thumbnail, StickerFormat format)
      Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set.
      Parameters:
      name - Sticker set name
      user_id - User identifier of the sticker set owner
      thumbnail - A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size. animation-requirements for animated sticker technical requirements), or a .WEBM video with the thumbnail up to 32 kilobytes in size; see for video sticker technical requirements. Upload using File
      format - Format of the thumbnail, must be one of StickerFormat.STATIC for a .WEBP or .PNG image, StickerFormat.ANIMATED for a .TGS animation, or StickerFormat.VIDEO for a .WEBM video
      Returns:
      SetStickerSetThumbnail
    • setCustomEmojiStickerSetThumbnail

      public SetCustomEmojiStickerSetThumbnail setCustomEmojiStickerSetThumbnail(String name)
      Use this method to set the thumbnail of a custom emoji sticker set.
      Parameters:
      name - Sticker set name
      Returns:
      SetCustomEmojiStickerSetThumbnail
    • deleteStickerSet

      public DeleteStickerSet deleteStickerSet(String name)
      Use this method to delete a sticker set that was created by the bot.
      Parameters:
      name - Sticker set name
      Returns:
      DeleteStickerSet
    • getBusinessConnection

      public GetBusinessConnection getBusinessConnection(String business_connection_id)
      Use this method to get information about the connection of the bot with a business account.
      Parameters:
      business_connection_id - Unique identifier of the business connection
      Returns:
      GetBusinessConnection
    • answerInlineQuery

      public AnswerInlineQuery answerInlineQuery(String inline_query_id, InlineQueryResult[] results)
      Use this method to send answers to an inline query. No more than 50 results per query are allowed.
      Parameters:
      inline_query_id - Unique identifier for the answered query
      results - A JSON-serialized array of results for the inline query
      Returns:
      AnswerInlineQuery
    • savePreparedInlineMessage

      public SavePreparedInlineMessage savePreparedInlineMessage(long user_id, InlineQueryResult result)
      Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.
      Parameters:
      user_id - Unique identifier of the target user that can use the prepared message
      result - InlineQueryResult object describing the message to be sent
      Returns:
      SavePreparedInlineMessage
    • answerWebAppQuery

      public AnswerWebAppQuery answerWebAppQuery(String web_app_query_id, InlineQueryResult result)
      Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated.
      Parameters:
      web_app_query_id - Unique identifier for the query to be answered
      result - A JSON-serialized object describing the message to be sent
      Returns:
      AnswerWebAppQuery
    • sendInvoice

      public SendInvoice sendInvoice(Object chat_id, String title, String description, String payload, String currency, LabeledPrice[] prices)
      Use this method to send invoices.
      Parameters:
      chat_id - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
      title - Product name, 1-32 characters
      description - Product description, 1-255 characters
      payload - Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.
      currency - Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars.
      prices - Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars.
      Returns:
      SendInvoice
    • createInvoiceLink

      public CreateInvoiceLink createInvoiceLink(String title, String description, String payload, String currency, LabeledPrice[] prices)
      Use this method to create a link for an invoice.
      Parameters:
      title - Product name, 1-32 characters
      description - Product description, 1-255 characters
      payload - Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.
      currency - Three-letter ISO 4217 currency code. Pass “XTR” for payments in Telegram Stars.
      prices - Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars.
      Returns:
      CreateInvoiceLink
    • answerShippingQuery

      public AnswerShippingQuery answerShippingQuery(String shipping_query_id, boolean ok)
      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 - Pass 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:
      AnswerShippingQuery
    • answerPreCheckoutQuery

      public AnswerPreCheckoutQuery answerPreCheckoutQuery(String pre_checkout_query_id, boolean ok)
      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:
      AnswerPreCheckoutQuery
    • setPassportDataErrors

      public SetPassportDataErrors setPassportDataErrors(long user_id, PassportElementError[] errors)
      Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change).

      Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.
      Parameters:
      user_id - User identifier
      errors - A JSON-serialized array describing the errors
      Returns:
      SetPassportDataErrors
    • sendGame

      public SendGame sendGame(long chat_id, String game_short_name)
      Use this method to send a game
      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. Set up your games via @BotFather.
      Returns:
      SendGame
    • setGameScore

      public SetGameScore setGameScore(long chat_id, long user_id, int score, int message_id)
      Use this method to set the score of the specified user in a game message. On success, the Message is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.
      Parameters:
      chat_id - Required if inline_message_id is not specified. Unique identifier for the target chat
      user_id - User identifier
      score - New score, must be non-negative
      message_id - Required if inline_message_id is not specified. Identifier of the sent message
      Returns:
      SetGameScore
    • setGameScore

      public SetGameScore setGameScore(String inline_message_id, long user_id, int score)
      Use this method to set the score of the specified user in a game message. On success, True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.
      Parameters:
      inline_message_id - Required if chat_id and message_id are not specified. Identifier of the inline message
      user_id - User identifier
      score - New score, must be non-negative
      Returns:
      SetGameScore
    • getAvailableGifts

      public GetAvailableGifts getAvailableGifts()
      Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a Gifts object.
      Returns:
      GetAvailableGifts
    • getMyName

      public GetMyName getMyName()
      Use this method to get the current bot name for the given user language
      Returns:
      GetMyName
    • setMyName

      public SetMyName setMyName()
      Use this method to change the bot's name.
      Returns:
      SetMyName
    • getMyDescription

      public GetMyDescription getMyDescription()
      Use this method to get the current bot description for the given user language.
      Returns:
      GetMyDescription
    • setMyDescription

      public SetMyDescription setMyDescription()
      Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty.
      Returns:
      SetMyDescription
    • getGameHighScores

      public GetGameHighScores getGameHighScores(long chat_id, long user_id, int message_id)
      Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game.

      This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and their neighbors are not among them. Please note that this behavior is subject to change.
      Parameters:
      chat_id - Required if inline_message_id is not specified. Unique identifier for the target chat
      user_id - Target user id
      message_id - Required if inline_message_id is not specified. Identifier of the sent message
      Returns:
      GetGameHighScores
    • getGameHighScores

      public GetGameHighScores getGameHighScores(String inline_message_id, long user_id)
      Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game.

      This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and their neighbors are not among them. Please note that this behavior is subject to change.
      Parameters:
      inline_message_id - Required if chat_id and message_id are not specified. Identifier of the inline message
      user_id - Target user id
      Returns:
      GetGameHighScores
    • setState

      public void setState(long chat_id, long user_id, String name)
      Use this method to set new state in group/supergroup chat for a user
      Parameters:
      chat_id - Unique identifier for the target chat
      user_id - Target user id
      name - state name
    • setState

      public void setState(long user_id, String name)
      Use this method to set new state in private chat for a user
      Parameters:
      user_id - Target user id
      name - state name
    • clearState

      public void clearState(long chat_id, long user_id)
      Use this method to clear an existing state when it is no longer needed in a group/supergroup chat for a user.
      Parameters:
      chat_id - Unique identifier for the target chat
      user_id - Target user id
    • clearState

      public void clearState(long user_id)
      Use this method to clear an existing state when it is no longer needed in a private chat for a user.
      Parameters:
      user_id - Target user id
    • getStateData

      public Map<String,Object> getStateData(long chat_id, long user_id)
      Use this method to retrieve saved state data in a group/supergroup chat for a user
      Parameters:
      chat_id - Unique identifier for the target chat
      user_id - Target user id
      Returns:
      Map
    • getStateData

      public Map<String,Object> getStateData(long user_id)
      Use this method to retrieve saved state data in a private chat for a user
      Parameters:
      user_id - Target user id
      Returns:
      Map
    • getUpdates

      public GetUpdates getUpdates()
      Use this method to receive incoming updates using long polling
      Returns:
      GetUpdates