Package com.cadiducho.telegrambotapi
Interface BotAPI
-
- All Known Implementing Classes:
TelegramBot
public interface BotAPI
Interface to build Telegrams Bots Telegram Bot API version 4.6
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
BotAPI.ChatAction
Types of ChatAction.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Boolean
addStickerToSet(Integer user_id, String name, File png_sticker, File tgs_sticker, String emojis)
Use this method to add a new sticker to a set created by the bot.Boolean
addStickerToSet(Integer user_id, String name, Object png_sticker, String emojis, MaskPosition mask_position)
Use this method to add a new sticker to a set created by the bot.default Boolean
addStickerToSet(Integer user_id, String name, String png_sticker, String emojis)
Use this method to add a new sticker to a set created by the bot.default Boolean
answerCallbackQuery(String callback_query_id)
Use this method to send answers to callback queries sent from inline keyboards.Boolean
answerCallbackQuery(String callback_query_id, String text, Boolean show_alert, String url, Integer cache_time)
Use this method to send answers to callback queries sent from inline keyboards.default Boolean
answerInlineQuery(String inlineQueryId, List<InlineQueryResult> results)
Use this method to send answers to an inline query.Boolean
answerInlineQuery(String inlineQueryId, List<InlineQueryResult> results, Integer cache_time, Boolean is_personal, String next_offset, String switch_pm_text, String switch_pm_parameter)
Use this method to send answers to an inline query.default Boolean
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.Boolean
answerPreCheckoutQuery(String pre_checkout_query_id, Boolean ok, String error_message)
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.default Boolean
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.Boolean
answerShippingQuery(String shipping_query_id, Boolean ok, List<ShippingOption> shipping_options, String error_message)
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.default Boolean
createNewStickerSet(Integer user_id, String name, String title, File png_sticker, File tgs_sticker, String emojis)
Use this method to create new sticker set owned by a user.Boolean
createNewStickerSet(Integer user_id, String name, String title, Object png_sticker, File tgs_sticker, String emojis, Boolean contains_masks, MaskPosition mask_position)
Use this method to create new sticker set owned by a user.default Boolean
createNewStickerSet(Integer user_id, String name, String title, String png_sticker, File tgs_sticker, String emojis)
Use this method to create new sticker set owned by a user.Boolean
deleteChatPhoto(Object chat_id)
Use this method to delete a chat photo.Boolean
deleteChatStickerSet(Object chat_id)
Use this method to delete a group sticker set from a supergroup.Boolean
deleteMessage(Object chat_id, Integer 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 agoBoolean
deleteStickerFromSet(String sticker)
Use this method to delete a sticker from a set created by the bot.Boolean
deleteWebhook()
Use this method to remove webhook integration if you decide to switch back togetUpdates(java.lang.Integer, java.lang.Integer, java.lang.Integer, java.util.List<java.lang.String>)
.Message
editMessageCaption(Object chat_id, Integer message_id, String inline_message_id, String caption, ParseMode parseMode, InlineKeyboardMarkup reply_markup)
Use this method to edit captions of messages sent by the bot or via the bot (for inline bots).Object
editMessageLiveLocation(Object chat_id, Integer message_id, String inline_message_id, Float latitude, Float longitude, InlineKeyboardMarkup reply_markup)
Use this method to edit live location messages sent by the bot or via the bot (for inline bots).Message
editMessageMedia(Object chat_id, Integer message_id, String inline_message_id, InputMedia media, InlineKeyboardMarkup reply_markup)
Use this method to edit audio, document, photo, or video messages.Message
editMessageReplyMarkup(Object chat_id, Integer message_id, String inline_message_id, InlineKeyboardMarkup reply_markup)
Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots).Message
editMessageText(Object chat_id, Integer message_id, String inline_message_id, String text, ParseMode parse_mode, Boolean disable_web_page_preview, InlineKeyboardMarkup reply_markup)
Use this method to edit text and game messages sent by the bot or via the bot (for inline bots).String
exportChatInviteLink(Object chat_id)
Use this method to generate a new invite link for a chat; any previously generated link is revoked.Message
forwardMessage(Object chat_id, Integer from_chat_id, Boolean disable_notification, Integer message_id)
Use this method to forward messages of any kind.default Message
forwardMessage(Object chat_id, Integer from_chat_id, Integer message_id)
Use this method to forward messages of any kind.Chat
getChat(Object chat_id)
Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.).List<ChatMember>
getChatAdministrators(Object chat_id)
ChatMember
getChatMember(Object chat_id, Integer user_id)
Integer
getChatMembersCount(Object chat_id)
Use this method to get the number of members in a chat.File
getFile(String file_id)
Use this method to get basic info about a file and prepare it for downloading.default List<GameHighScore>
getGameHighScores(Integer user_id)
Use this method to get data for high score tables.List<GameHighScore>
getGameHighScores(Integer user_id, Object chat_id, Integer message_id, String inline_message_id)
Use this method to get data for high score tables.BotAPI
getInstance()
Get Bot instanceUser
getMe()
A simple method for testing your bot's auth token.List<BotCommand>
getMyCommands()
Use this method to get the current list of the bot's commands.StickerSet
getStickerSet(String name)
Use this method to get a sticker set.List<Update>
getUpdates(Integer offset, Integer limit, Integer timeout, List<String> allowed_updates)
Use this method to receive incoming updates using long polling (wiki).BotUpdatesPoller
getUpdatesPoller()
Get the UpdatesPoller instancedefault UserProfilePhotos
getUserProfilePhotos(Integer user_id)
Use this method to get a list of profile pictures for a user.UserProfilePhotos
getUserProfilePhotos(Integer user_id, Integer offset, Integer limit)
Use this method to get a list of profile pictures for a user.WebhookInfo
getWebhookInfo()
Use this method to get current webhook status.default Boolean
kickChatMember(Object chat_id, Integer user_id)
Use this method to kick a user from a group or a supergroup.Boolean
kickChatMember(Object chat_id, Integer user_id, Integer until_date)
Use this method to kick a user from a group or a supergroup.Boolean
leaveChat(Object chat_id)
Use this method for your bot to leave a group, supergroup or channel.default Boolean
pinChatMessage(Object chat_id, Integer message_id)
Use this method to pin a message in a group, a supergroup, or a channel.Boolean
pinChatMessage(Object chat_id, Integer message_id, Boolean disable_notification)
Use this method to pin a message in a supergroup.default Boolean
promoteChatMember(Object chat_id, Integer user_id)
Use this method to promote or demote a user in a supergroup or a channel.Boolean
promoteChatMember(Object chat_id, Integer user_id, Boolean can_change_info, Boolean can_post_messages, Boolean can_edit_messages, Boolean can_delete_messages, Boolean can_invite_users, Boolean can_restrict_members, Boolean can_pin_messages, Boolean can_promote_members)
Use this method to promote or demote a user in a supergroup or a channel.default Boolean
restrictChatMember(Object chat_id, Integer 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 admin rights.Boolean
restrictChatMember(Object chat_id, Integer user_id, ChatPermissions permissions, Integer until_date)
* Use this method to restrict a user in a supergroup.default Message
sendAnimation(Object chat_id, File animation)
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).Message
sendAnimation(Object chat_id, Object animation, Integer duration, Integer width, Integer height, Object thumb, String caption, ParseMode parse_mode, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup)
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).default Message
sendAnimation(Object chat_id, String animation)
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).default Message
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.Message
sendAudio(Object chat_id, Object audio, String caption, Integer duration, String performer, String title, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup)
Use this method to send audio files, if you want Telegram clients to display them in the music player.default Message
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.default Boolean
sendChatAction(Object chat_id, BotAPI.ChatAction action)
Use this method when you need to tell the user that something is happening on the bot's side.Boolean
sendChatAction(Object chat_id, String action)
Use this method when you need to tell the user that something is happening on the bot's side.default Message
sendContact(Object chat_id, String phone_number, String first_name)
Use this method to send phone contacts.Message
sendContact(Object chat_id, String phone_number, String first_name, String last_name, String vcard, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup)
Use this method to send phone contacts.Message
sendDice(Object chat_id, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup)
Use this method to send a dice, which will have a random value from 1 to 6.default Message
sendDocument(Object chat_id, File document)
Use this method to send general files.Message
sendDocument(Object chat_id, Object document, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup)
Use this method to send general files.default Message
sendDocument(Object chat_id, String document)
Use this method to send general files.default Message
sendGame(Object chat_id, String game_short_name)
Use this method to send a game.Message
sendGame(Object chat_id, String game_short_name, Boolean disable_notification, Integer reply_to_message_id, InlineKeyboardMarkup reply_markup)
Use this method to send a game.default Message
sendInvoice(Integer chat_id, String title, String description, String payload, String provider_token, String start_parameter, String currency, List<LabeledPrice> prices)
Use this method to send invoices.Message
sendInvoice(Integer chat_id, String title, String description, String payload, String provider_token, String start_parameter, String currency, List<LabeledPrice> prices, String provider_data, String photo_url, Integer photo_size, Integer photo_width, Integer photo_height, Boolean need_name, Boolean need_phone_number, Boolean need_email, Boolean need_shipping_address, Boolean send_phone_number_to_provider, Boolean send_email_to_provider, Boolean is_flexible, Boolean disable_notification, Integer reply_to_message_id, InlineKeyboardMarkup reply_markup)
Use this method to send invoices.default Message
sendLocation(Object chat_id, Float latitude, Float longitude)
Use this method to send point on the map.Message
sendLocation(Object chat_id, Float latitude, Float longitude, Integer live_period, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup)
Use this method to send point on the map.default Message
sendMediaGroup(Object chat_id, List<InputMedia> media)
Use this method to send a group of photos or videos as an album.Message
sendMediaGroup(Object chat_id, List<InputMedia> media, Boolean disable_notification, Integer reply_to_message_id)
Use this method to send a group of photos or videos as an album.default Message
sendMessage(Object chat_id, String text)
Use this method to send text messages.Message
sendMessage(Object chat_id, String text, ParseMode parse_mode, Boolean disable_notification, Boolean disable_web_page_preview, Integer reply_to_message_id, Object reply_markup)
Use this method to send text messages.default Message
sendPhoto(Object chat_id, File photo)
Use this method to send photos.Message
sendPhoto(Object chat_id, Object photo, String caption, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup)
Use this method to send photos.default Message
sendPhoto(Object chat_id, String photo)
Use this method to send photos.default Message
sendPoll(Object chat_id, String question, List<String> options)
Use this method to send a native poll.Message
sendPoll(Object chat_id, String question, List<String> options, Boolean is_anonymous, String type, Boolean allows_multiple_answers, Integer correct_option_id, Boolean is_closed, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup)
Use this method to send a native poll.default Message
sendSticker(Object chat_id, File sticker)
Use this method to send static .WEBP or animated .TGS stickers.Message
sendSticker(Object chat_id, Object sticker, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup)
Use this method to send static .WEBP or animated .TGS stickers.default Message
sendSticker(Object chat_id, String sticker)
Use this method to send static .WEBP or animated .TGS stickers.default Message
sendVenue(Object chat_id, Float latitude, Float longitude, String title, String address)
Use this method to send information about a venue.Message
sendVenue(Object chat_id, Float latitude, Float longitude, String title, String address, String foursquare_id, String foursquare_type, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup)
Use this method to send information about a venue.default Message
sendVideo(Object chat_id, File video)
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent asDocument
).Message
sendVideo(Object chat_id, Object video, Integer duration, Integer width, Integer height, String caption, ParseMode parse_mode, Boolean supports_streaming, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup)
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent asDocument
).default Message
sendVideo(Object chat_id, String video)
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent asDocument
).default Message
sendVideoNote(Object chat_id, File video_note)
As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long.Message
sendVideoNote(Object chat_id, Object video_note, Integer duration, Integer length, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup)
As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long.default Message
sendVideoNote(Object chat_id, String video_note)
As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long.default Message
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.Message
sendVoice(Object chat_id, Object voice, String caption, Integer duration, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup)
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message.default Message
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.Boolean
setChatAdministratorCustomTitle(Object chat_id, Integer user_id, String custom_title)
Use this method to set a custom title for an administrator in a supergroup promoted by the botdefault Boolean
setChatDescription(Object chat_id)
Use this method to change the description of a supergroup or a channel.Boolean
setChatDescription(Object chat_id, String description)
Use this method to change the description of a supergroup or a channel.Boolean
setChatPermissions(Object chat_id, ChatPermissions permissions)
Use this method to set default chat permissions for all members.Boolean
setChatPhoto(Object chat_id, File photo)
Use this method to set a new profile photo for the chat.Boolean
setChatStickerSet(Object chat_id, String sticker_set_name)
Use this method to set a new group sticker set for a supergroup.Boolean
setChatTitle(Object chat_id, String title)
Use this method to change the title of a chat.default Object
setGameScore(Integer user_id, Integer score)
Use this method to set the score of the specified user in a game.Object
setGameScore(Integer user_id, Integer score, Boolean force, Boolean disable_edit_message, Object chat_id, Integer message_id, String inline_message_id)
Use this method to set the score of the specified user in a game.Boolean
setMyCommands(List<BotCommand> commands)
Use this method to change the list of the bot's commands.Boolean
setStickerPositionInSet(String sticker, Integer position)
Use this method to move a sticker in a set created by the bot to a specific position .Boolean
setStickerSetThumb(String name, Integer user_id, File thumb)
Use this method to set the thumbnail of a sticker set.Boolean
setStickerSetThumb(String name, Integer user_id, String thumb)
Use this method to set the thumbnail of a sticker set.Boolean
setWebhook(String url, File certificate, Integer max_connections, List<String> allowed_updates)
Use this method to specify a url and receive incoming updates via an outgoing webhook.void
startUpdatesPoller()
Starts the updates threadObject
stopMessageLiveLocation(Object chat_id, Integer message_id, String inline_message_id, InlineKeyboardMarkup reply_markup)
Use this method to stop updating a live location message sent by the bot or via the bot (for inline bots) before live_period expires.default Poll
stopPoll(Object chat_id, Integer message_id)
Use this method to stop a poll which was sent by the bot.Poll
stopPoll(Object chat_id, Integer message_id, InlineKeyboardMarkup reply_markup)
Use this method to stop a poll which was sent by the bot.void
stopUpdatesPoller()
Stop the updates threadBoolean
unbanChatMember(Object chat_id, Integer user_id)
Use this method to unban a previously kicked user in a supergroup or channel.Boolean
unpinChatMessage(Object chat_id)
Use this method to unpin a message in a group, a supergroup, or a channel.File
uploadStickerFile(Integer user_id, File png_sticker)
Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times).
-
-
-
Method Detail
-
startUpdatesPoller
void startUpdatesPoller()
Starts the updates thread
-
stopUpdatesPoller
void stopUpdatesPoller()
Stop the updates thread
-
getUpdatesPoller
BotUpdatesPoller getUpdatesPoller()
Get the UpdatesPoller instance- Returns:
- the updates poller instance
-
getInstance
BotAPI getInstance()
Get Bot instance- Returns:
- BotAPI
-
getMe
User getMe() throws TelegramException
A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of aUser
object.- Returns:
User
- Throws:
TelegramException
- if the method fails in Telegram servers if the method failed on Telegram servers
-
sendMessage
default Message sendMessage(Object chat_id, String text) throws TelegramException
Use this method to send text messages. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)text
- Text of the message to be sent- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendMessage
Message sendMessage(Object chat_id, String text, ParseMode parse_mode, Boolean disable_notification, Boolean disable_web_page_preview, Integer reply_to_message_id, Object reply_markup) throws TelegramException
Use this method to send text messages. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)text
- Text of the message to be sentparse_mode
- Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.disable_web_page_preview
- Disables link previews for links in this messagedisable_notification
- Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.reply_to_message_id
- If the message is a reply, ID of the original messagereply_markup
- Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can beReplyKeyboardMarkup
,ReplyKeyboardRemove
orForceReply
.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
forwardMessage
default Message forwardMessage(Object chat_id, Integer from_chat_id, Integer message_id) throws TelegramException
Use this method to forward messages of any kind. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)from_chat_id
- Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)message_id
- Unique message identifier- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
forwardMessage
Message forwardMessage(Object chat_id, Integer from_chat_id, Boolean disable_notification, Integer message_id) throws TelegramException
Use this method to forward messages of any kind. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)from_chat_id
- Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)disable_notification
- Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.message_id
- Unique message identifier- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendPhoto
default Message sendPhoto(Object chat_id, String photo) throws TelegramException
Use this method to send photos. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)photo
- Photo to send. You can either pass a file_id as String to resend a photo that is already on the Telegram servers, or upload a new photo using multipart/form-data.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendPhoto
default Message sendPhoto(Object chat_id, File photo) throws TelegramException
Use this method to send photos. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)photo
- Photo to send. You can either pass a file_id as String to resend a photo that is already on the Telegram servers, or upload a new photo using multipart/form-data.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendPhoto
Message sendPhoto(Object chat_id, Object photo, String caption, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup) throws TelegramException
Use this method to send photos. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)photo
- Photo to send. You can either pass a file_id as String to resend a photo that is already on the Telegram servers, or upload a new photo using multipart/form-data.caption
- Photo caption (may also be used when resending photos by file_id).disable_notification
- Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.reply_to_message_id
- If the message is a reply, ID of the original messagereply_markup
- Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can beReplyKeyboardMarkup
,ReplyKeyboardRemove
orForceReply
.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendAudio
default Message sendAudio(Object chat_id, String audio) throws TelegramException
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. On success, the sentMessage
is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. For backward compatibility, when the fields title and performer are both empty and the mime-type of the file to be sent is not audio/mpeg, the file will be sent as a playable voice message. For this to work, the audio must be in an .ogg file encoded with OPUS. This behavior will be phased out in the future. For sending voice messages, use the sendVoice method instead.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)audio
- Audio file to send. You can either pass a file_id as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendAudio
default Message sendAudio(Object chat_id, File audio) throws TelegramException
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. On success, the sentMessage
is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. For backward compatibility, when the fields title and performer are both empty and the mime-type of the file to be sent is not audio/mpeg, the file will be sent as a playable voice message. For this to work, the audio must be in an .ogg file encoded with OPUS. This behavior will be phased out in the future. For sending voice messages, use the sendVoice method instead.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)audio
- Audio file to send. You can either pass a file_id as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendAudio
Message sendAudio(Object chat_id, Object audio, String caption, Integer duration, String performer, String title, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup) throws TelegramException
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. On success, the sentMessage
is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. For backward compatibility, when the fields title and performer are both empty and the mime-type of the file to be sent is not audio/mpeg, the file will be sent as a playable voice message. For this to work, the audio must be in an .ogg file encoded with OPUS. This behavior will be phased out in the future. For sending voice messages, use the sendVoice method instead.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)audio
- Audio file to send. You can either pass a file_id as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data.caption
- Audio caption, 0-200 charactersduration
- Duration of the audio in secondsperformer
- Performertitle
- Track namedisable_notification
- Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.reply_to_message_id
- If the message is a reply, ID of the original messagereply_markup
- Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can beReplyKeyboardMarkup
,ReplyKeyboardRemove
orForceReply
.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendDocument
default Message sendDocument(Object chat_id, String document) throws TelegramException
Use this method to send general files. On success, the sentMessage
is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)document
- File to send. You can either pass a file_id as String to resend a file that is already on the Telegram servers, or upload a new file using multipart/form-data.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendDocument
default Message sendDocument(Object chat_id, File document) throws TelegramException
Use this method to send general files. On success, the sentMessage
is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)document
- File to send. You can either pass a file_id as String to resend a file that is already on the Telegram servers, or upload a new file using multipart/form-data.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendDocument
Message sendDocument(Object chat_id, Object document, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup) throws TelegramException
Use this method to send general files. On success, the sentMessage
is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)document
- File to send. You can either pass a file_id as String to resend a file that is already on the Telegram servers, or upload a new file using multipart/form-data.disable_notification
- Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.reply_to_message_id
- If the message is a reply, ID of the original messagereply_markup
- Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can beReplyKeyboardMarkup
,ReplyKeyboardRemove
orForceReply
.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendVideo
default Message sendVideo(Object chat_id, String video) throws TelegramException
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent asDocument
). On success, the sentMessage
is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)video
- Video to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendVideo
default Message sendVideo(Object chat_id, File video) throws TelegramException
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent asDocument
). On success, the sentMessage
is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)video
- Video to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendVideo
Message sendVideo(Object chat_id, Object video, Integer duration, Integer width, Integer height, String caption, ParseMode parse_mode, Boolean supports_streaming, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup) throws TelegramException
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent asDocument
). Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)video
- Video file to send. You can either pass a file_id as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data.duration
- Duration of the video in secondswidth
- Video widthheight
- Video heightcaption
- Video caption (may also be used when resending videos by file_id), 0-200 charactersparse_mode
- Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.supports_streaming
- Pass True, if the uploaded video is suitable for streamingdisable_notification
- Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.reply_to_message_id
- If the message is a reply, ID of the original messagereply_markup
- Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can beReplyKeyboardMarkup
,ReplyKeyboardRemove
orForceReply
.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendAnimation
default Message sendAnimation(Object chat_id, String animation) throws TelegramException
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sentMessage
is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)animation
- Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendAnimation
default Message sendAnimation(Object chat_id, File animation) throws TelegramException
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sentMessage
is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)animation
- Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendAnimation
Message sendAnimation(Object chat_id, Object animation, Integer duration, Integer width, Integer height, Object thumb, String caption, ParseMode parse_mode, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup) throws TelegramException
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sentMessage
is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)animation
- Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data.duration
- Duration of the animation in secondswidth
- Animation widthheight
- Animation heightthumb
- Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 90. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.caption
- Animation caption (may also be used when resending videos by file_id), 0-1024 charactersparse_mode
- Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.disable_notification
- Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.reply_to_message_id
- If the message is a reply, ID of the original messagereply_markup
- Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can beReplyKeyboardMarkup
,ReplyKeyboardRemove
orForceReply
.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendVoice
default Message sendVoice(Object chat_id, String voice) throws TelegramException
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent asAudio
orDocument
). On success, the sentMessage
is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)voice
- Audio file to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendVoice
default Message sendVoice(Object chat_id, File voice) throws TelegramException
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent asAudio
orDocument
). On success, the sentMessage
is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)voice
- Audio file to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendVoice
Message sendVoice(Object chat_id, Object voice, String caption, Integer duration, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup) throws TelegramException
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent asAudio
orDocument
). On success, the sentMessage
is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)voice
- Audio file to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.caption
- Voice message caption, 0-200 charactersduration
- Duration of the audio in secondsdisable_notification
- Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.reply_to_message_id
- If the message is a reply, ID of the original messagereply_markup
- Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can beReplyKeyboardMarkup
,ReplyKeyboardRemove
orForceReply
.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendMediaGroup
default Message sendMediaGroup(Object chat_id, List<InputMedia> media) throws TelegramException
Use this method to send a group of photos or videos as an album.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)media
- A JSON-serialized array describing photos and videos to be sent, must include 2–10 items- Returns:
- An array of the sent Messages is returned on success
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendMediaGroup
Message sendMediaGroup(Object chat_id, List<InputMedia> media, Boolean disable_notification, Integer reply_to_message_id) throws TelegramException
Use this method to send a group of photos or videos as an album.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)media
- A JSON-serialized array describing photos and videos to be sent, must include 2–10 itemsdisable_notification
- Sends the messages silently. Users will receive a notification with no sound.reply_to_message_id
- If the messages are a reply, ID of the original message- Returns:
- An array of the sent Messages is returned on success
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendLocation
default Message sendLocation(Object chat_id, Float latitude, Float longitude) throws TelegramException
Use this method to send point on the map. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)latitude
- Latitude of locationlongitude
- Longitude of location- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendLocation
Message sendLocation(Object chat_id, Float latitude, Float longitude, Integer live_period, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup) throws TelegramException
Use this method to send point on the map. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)latitude
- Latitude of locationlongitude
- Longitude of locationlive_period
- Period in seconds for which the location will be updated (should be between 60 and 86400).disable_notification
- Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.reply_to_message_id
- If the message is a reply, ID of the original messagereply_markup
- Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can beReplyKeyboardMarkup
,ReplyKeyboardRemove
orForceReply
.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
editMessageLiveLocation
Object editMessageLiveLocation(Object chat_id, Integer message_id, String inline_message_id, Float latitude, Float longitude, InlineKeyboardMarkup reply_markup) throws TelegramException
Use this method to edit live location messages sent by the bot or via the bot (for inline bots). A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation.- Parameters:
chat_id
- Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Required if inline_message_id is not specified. Identifier of the sent messageinline_message_id
- Required if chat_id and message_id are not specified. Identifier of the inline messagelatitude
- Latitude of new locationlongitude
- Longitude of new locationreply_markup
- A JSON-serialized object for a new inline keyboard.- Returns:
- if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
stopMessageLiveLocation
Object stopMessageLiveLocation(Object chat_id, Integer message_id, String inline_message_id, InlineKeyboardMarkup reply_markup) throws TelegramException
Use this method to stop updating a live location message sent by the bot or via the bot (for inline bots) before live_period expires.- Parameters:
chat_id
- Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Required if inline_message_id is not specified. Identifier of the sent messageinline_message_id
- Required if chat_id and message_id are not specified. Identifier of the inline messagereply_markup
- A JSON-serialized object for a new inline keyboard.- Returns:
- if the message was sent by the bot, the sent Message is returned, otherwise True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendVideoNote
default Message sendVideoNote(Object chat_id, String video_note) throws TelegramException
As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent asAudio
orDocument
). On success, the sentMessage
is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)video_note
- Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More info on Sending Files ». Sending video notes by a URL is currently unsupported- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendVideoNote
default Message sendVideoNote(Object chat_id, File video_note) throws TelegramException
As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent asAudio
orDocument
). On success, the sentMessage
is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)video_note
- Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More info on Sending Files ». Sending video notes by a URL is currently unsupported- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendVideoNote
Message sendVideoNote(Object chat_id, Object video_note, Integer duration, Integer length, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup) throws TelegramException
As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)video_note
- Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More info on Sending Files ». Sending video notes by a URL is currently unsupportedduration
- Duration of sent video in secondslength
- Video width and heightdisable_notification
- Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.reply_to_message_id
- If the message is a reply, ID of the original messagereply_markup
- Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can beReplyKeyboardMarkup
,ReplyKeyboardRemove
orForceReply
.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendVenue
default Message sendVenue(Object chat_id, Float latitude, Float longitude, String title, String address) throws TelegramException
Use this method to send information about a venue. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)latitude
- Latitude of the venuelongitude
- Longitude of the venuetitle
- Name of the venueaddress
- Address of the venue- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendVenue
Message sendVenue(Object chat_id, Float latitude, Float longitude, String title, String address, String foursquare_id, String foursquare_type, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup) throws TelegramException
Use this method to send information about a venue. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)latitude
- Latitude of the venuelongitude
- Longitude of the venuetitle
- Name of the venueaddress
- Address of the venuefoursquare_id
- Foursquare identifier of the venuefoursquare_type
- Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)disable_notification
- Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.reply_to_message_id
- If the message is a reply, ID of the original messagereply_markup
- Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can beReplyKeyboardMarkup
,ReplyKeyboardRemove
orForceReply
.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendContact
default Message sendContact(Object chat_id, String phone_number, String first_name) throws TelegramException
Use this method to send phone contacts. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)phone_number
- Contact's phone numberfirst_name
- Contact's first name- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendContact
Message sendContact(Object chat_id, String phone_number, String first_name, String last_name, String vcard, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup) throws TelegramException
Use this method to send phone contacts. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)phone_number
- Contact's phone numberfirst_name
- Contact's first namelast_name
- Contact's last namevcard
- Additional data about the contact in the form of a vCard, 0-2048 bytesdisable_notification
- Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.reply_to_message_id
- If the message is a reply, ID of the original messagereply_markup
- Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can beReplyKeyboardMarkup
,ReplyKeyboardRemove
orForceReply
.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendPoll
default Message sendPoll(Object chat_id, String question, List<String> options) throws TelegramException
Use this method to send a native poll. A native poll can't be sent to a private chat. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername). A native poll can't be sent to a private chat.question
- Poll question, 1-255 charactersoptions
- List of answer options, 2-10 strings 1-100 characters each- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendPoll
Message sendPoll(Object chat_id, String question, List<String> options, Boolean is_anonymous, String type, Boolean allows_multiple_answers, Integer correct_option_id, Boolean is_closed, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup) throws TelegramException
Use this method to send a native poll. A native poll can't be sent to a private chat. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername). A native poll can't be sent to a private chat.question
- Poll question, 1-255 charactersoptions
- List of answer options, 2-10 strings 1-100 characters eachis_anonymous
- True, if the poll needs to be anonymous, defaults to Truetype
- Poll type, “quiz” or “regular”, defaults to “regular”allows_multiple_answers
- True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to Falsecorrect_option_id
- 0-based identifier of the correct answer option, required for polls in quiz modeis_closed
- Pass True, if the poll needs to be immediately closeddisable_notification
- Sends the message silently. Users will receive a notification with no sound.reply_to_message_id
- If the message is a reply, ID of the original messagereply_markup
- Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can beReplyKeyboardMarkup
,ReplyKeyboardRemove
orForceReply
.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendDice
Message sendDice(Object chat_id, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup) throws TelegramException
Use this method to send a dice, which will have a random value from 1 to 6.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)disable_notification
- Sends the message silently. Users will receive a notification with no sound.reply_to_message_id
- If the message is a reply, ID of the original messagereply_markup
- Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.- Returns:
- On success, the sent Message is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendChatAction
Boolean sendChatAction(Object chat_id, String action) throws TelegramException
Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive. Watch more in https://core.telegram.org/bots/api#sendchataction- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)action
- Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_audio or upload_audio for audio files, upload_document for general files, find_location for location data.- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendChatAction
default Boolean sendChatAction(Object chat_id, BotAPI.ChatAction action) throws TelegramException
Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive. Watch more in https://core.telegram.org/bots/api#sendchataction- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)action
- Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_audio or upload_audio for audio files, upload_document for general files, find_location for location data.- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
getUserProfilePhotos
default UserProfilePhotos getUserProfilePhotos(Integer user_id) throws TelegramException
Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.- Parameters:
user_id
- Unique identifier of the target user- Returns:
UserProfilePhotos
- Throws:
TelegramException
- if the method fails in Telegram servers
-
getUserProfilePhotos
UserProfilePhotos getUserProfilePhotos(Integer user_id, Integer offset, Integer limit) throws TelegramException
Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.- Parameters:
user_id
- Unique identifier of the target useroffset
- Sequential number of the first photo to be returned. By default, all photos are returned.limit
- Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.- Returns:
UserProfilePhotos
- Throws:
TelegramException
- if the method fails in Telegram servers
-
getFile
File getFile(String file_id) throws TelegramException
Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.- Parameters:
file_id
- File identifier to get info about- Returns:
File
- Throws:
TelegramException
- if the method fails in Telegram servers
-
kickChatMember
default Boolean kickChatMember(Object chat_id, Integer user_id) throws TelegramException
Use this method to kick a user from a group or a supergroup. In the case of supergroups, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the group for this to work. Returns True on success.- Parameters:
chat_id
- Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername)user_id
- Unique identifier of the target user- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
kickChatMember
Boolean kickChatMember(Object chat_id, Integer user_id, Integer until_date) throws TelegramException
Use this method to kick a user from a group or a supergroup. In the case of supergroups, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the group for this to work. Returns True on success.- Parameters:
chat_id
- Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername)user_id
- Unique identifier of the target useruntil_date
- Optional. Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
leaveChat
Boolean leaveChat(Object chat_id) throws TelegramException
Use this method for your bot to leave a group, supergroup or channel. Returns True on success.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
unbanChatMember
Boolean unbanChatMember(Object chat_id, Integer user_id) throws TelegramException
Use this method to unban a previously kicked user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. Returns True on success.- Parameters:
chat_id
- Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername)user_id
- Unique identifier of the target user- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
restrictChatMember
default Boolean restrictChatMember(Object chat_id, Integer user_id, ChatPermissions permissions) throws TelegramException
Use this method to restrict a user in a supergroup.The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)user_id
- Unique identifier of the target userpermissions
- New user permissions- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
restrictChatMember
Boolean restrictChatMember(Object chat_id, Integer user_id, ChatPermissions permissions, Integer until_date) throws TelegramException
* Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)user_id
- Unique identifier of the target userpermissions
- New user permissionsuntil_date
- Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
promoteChatMember
default Boolean promoteChatMember(Object chat_id, Integer user_id) throws TelegramException
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)user_id
- Unique identifier of the target user- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
promoteChatMember
Boolean promoteChatMember(Object chat_id, Integer user_id, Boolean can_change_info, Boolean can_post_messages, Boolean can_edit_messages, Boolean can_delete_messages, Boolean can_invite_users, Boolean can_restrict_members, Boolean can_pin_messages, Boolean can_promote_members) throws TelegramException
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)user_id
- Unique identifier of the target usercan_change_info
- Pass True, if the administrator can change chat title, photo and other settingscan_post_messages
- Pass True, if the administrator can create channel posts, channels onlycan_edit_messages
- Pass True, if the administrator can edit messages of other users and can pin messages, channels onlycan_delete_messages
- Pass True, if the administrator can delete messages of other userscan_invite_users
- Pass True, if the administrator can invite new users to the chatcan_restrict_members
- Pass True, if the administrator can restrict, ban or unban chat memberscan_pin_messages
- Pass True, if the administrator can pin messages, supergroups onlycan_promote_members
- Pass True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
setChatAdministratorCustomTitle
Boolean setChatAdministratorCustomTitle(Object chat_id, Integer user_id, String custom_title) throws TelegramException
Use this method to set a custom title for an administrator in a supergroup promoted by the bot- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)user_id
- Unique identifier of the target usercustom_title
- New custom title for the administrator; 0-16 characters, emoji are not allowed- Returns:
- True on success.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
setChatPermissions
Boolean setChatPermissions(Object chat_id, ChatPermissions permissions) throws TelegramException
Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members admin rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)permissions
- New default chat permissions- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
exportChatInviteLink
String exportChatInviteLink(Object chat_id) throws TelegramException
Use this method to generate a new invite link for a chat; any previously generated link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)- Returns:
- the new invite link as String on success.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
setChatPhoto
Boolean setChatPhoto(Object chat_id, File photo) throws TelegramException
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. * Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off in the target group.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)photo
- New chat photo, uploaded using multipart/form-data- Returns:
- True on success
- Throws:
TelegramException
- if the method fails in Telegram servers
-
deleteChatPhoto
Boolean deleteChatPhoto(Object chat_id) throws TelegramException
Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)- Returns:
- True on success
- Throws:
TelegramException
- if the method fails in Telegram servers
-
setChatTitle
Boolean setChatTitle(Object chat_id, String title) throws TelegramException
Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off in the target group.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)title
- New chat title, 1-255 characters- Returns:
- True on success
- Throws:
TelegramException
- if the method fails in Telegram servers
-
setChatDescription
default Boolean setChatDescription(Object chat_id) throws TelegramException
Use this method to change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)- Returns:
- True on success
- Throws:
TelegramException
- if the method fails in Telegram servers
-
setChatDescription
Boolean setChatDescription(Object chat_id, String description) throws TelegramException
Use this method to change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)description
- New chat description, 0-255 characters- Returns:
- True on success
- Throws:
TelegramException
- if the method fails in Telegram servers
-
pinChatMessage
default Boolean pinChatMessage(Object chat_id, Integer message_id) throws TelegramException
Use this method to pin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Identifier of a message to pin- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
pinChatMessage
Boolean pinChatMessage(Object chat_id, Integer message_id, Boolean disable_notification) throws TelegramException
Use this method to pin a message in a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Identifier of a message to pindisable_notification
- Pass True, if it is not necessary to send a notification to all group members about the new pinned message- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
unpinChatMessage
Boolean unpinChatMessage(Object chat_id) throws TelegramException
Use this method to unpin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
getChat
Chat getChat(Object chat_id) throws TelegramException
Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns aChat
object on success.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)- Returns:
Chat
- Throws:
TelegramException
- if the method fails in Telegram servers
-
getChatAdministrators
List<ChatMember> getChatAdministrators(Object chat_id) throws TelegramException
- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)- Returns:
- Array of
ChatMember
- Throws:
TelegramException
- if the method fails in Telegram servers
-
getChatMembersCount
Integer getChatMembersCount(Object chat_id) throws TelegramException
Use this method to get the number of members in a chat. Returns Int on success.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)- Returns:
- Number of members in a chat
- Throws:
TelegramException
- if the method fails in Telegram servers
-
getChatMember
ChatMember getChatMember(Object chat_id, Integer user_id) throws TelegramException
- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)user_id
- Unique identifier of the target user- Returns:
ChatMember
- Throws:
TelegramException
- if the method fails in Telegram servers
-
setChatStickerSet
Boolean setChatStickerSet(Object chat_id, String sticker_set_name) throws TelegramException
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)sticker_set_name
- Name of the sticker set to be set as the group sticker set- Returns:
- True on success.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
deleteChatStickerSet
Boolean deleteChatStickerSet(Object chat_id) throws TelegramException
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method.- Parameters:
chat_id
- True on success.- Returns:
- True on success.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
answerCallbackQuery
default Boolean answerCallbackQuery(String callback_query_id) throws TelegramException
Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.- Parameters:
callback_query_id
- Unique identifier for the query to be answered- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
answerCallbackQuery
Boolean answerCallbackQuery(String callback_query_id, String text, Boolean show_alert, String url, Integer cache_time) throws TelegramException
Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert.- Parameters:
callback_query_id
- Unique identifier for the query to be answeredtext
- Text of the notification. If not specified, nothing will be shown to the user, 0-200 charactersshow_alert
- If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false.url
- URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game – note that this will only work if the query comes from a callback_game button. Otherwise, you may use links like telegram.me/your_bot?start=XXXX that open your bot with a parameter.cache_time
- The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0.- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
setMyCommands
Boolean setMyCommands(List<BotCommand> commands) throws TelegramException
Use this method to change the list of the bot's commands.- Parameters:
commands
- A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.- Returns:
- True on success.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
getMyCommands
List<BotCommand> getMyCommands() throws TelegramException
Use this method to get the current list of the bot's commands. Requires no parameters.- Returns:
- Array of BotCommand on success.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
editMessageText
Message editMessageText(Object chat_id, Integer message_id, String inline_message_id, String text, ParseMode parse_mode, Boolean disable_web_page_preview, InlineKeyboardMarkup reply_markup) throws TelegramException
Use this method to edit text and game messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the editedMessage
is returned, otherwise True is returned.- Parameters:
chat_id
- Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Required if inline_message_id is not specified. Unique identifier of the sent messageinline_message_id
- Required if chat_id and message_id are not specified. Identifier of the inline messagetext
- New text of the messageparse_mode
- Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.disable_web_page_preview
- Disables link previews for links in this messagereply_markup
- A JSON-serialized object for an inline keyboard.- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
editMessageCaption
Message editMessageCaption(Object chat_id, Integer message_id, String inline_message_id, String caption, ParseMode parseMode, InlineKeyboardMarkup reply_markup) throws TelegramException
Use this method to edit captions of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.- Parameters:
chat_id
- Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Required if inline_message_id is not specified. Unique identifier of the sent messageinline_message_id
- Required if chat_id and message_id are not specified. Identifier of the inline messagecaption
- New caption of the messagereply_markup
- A JSON-serialized object for an inline keyboard.- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
editMessageMedia
Message editMessageMedia(Object chat_id, Integer message_id, String inline_message_id, InputMedia media, InlineKeyboardMarkup reply_markup) throws TelegramException
Use this method to edit audio, document, photo, or video messages. If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded. Use previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.- Parameters:
chat_id
- Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Required if inline_message_id is not specified. Identifier of the sent messageinline_message_id
- Required if chat_id and message_id are not specified. Identifier of the inline messagemedia
- A JSON-serialized object for a new media content of the messagereply_markup
- A JSON-serialized object for a new inline keyboard.- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
editMessageReplyMarkup
Message editMessageReplyMarkup(Object chat_id, Integer message_id, String inline_message_id, InlineKeyboardMarkup reply_markup) throws TelegramException
Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.- Parameters:
chat_id
- Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Required if inline_message_id is not specified. Unique identifier of the sent messageinline_message_id
- Required if chat_id and message_id are not specified. Identifier of the inline messagereply_markup
- A JSON-serialized object for an inline keyboard.- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
stopPoll
default Poll stopPoll(Object chat_id, Integer message_id) throws TelegramException
Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with the final results is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Identifier of the original message with the poll- Returns:
Poll
- Throws:
TelegramException
- if the method fails in Telegram servers
-
stopPoll
Poll stopPoll(Object chat_id, Integer message_id, InlineKeyboardMarkup reply_markup) throws TelegramException
Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with the final results is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Identifier of the original message with the pollreply_markup
- Optional. A JSON-serialized object for a new message inline keyboard.- Returns:
Poll
- Throws:
TelegramException
- if the method fails in Telegram servers
-
deleteMessage
Boolean deleteMessage(Object chat_id, Integer message_id) throws TelegramException
Use this method to delete a message, including service messages, with the following limitations: - A message can only be deleted if it was sent less than 48 hours ago. - Bots can delete outgoing messages in private chats, groups, and supergroups. - Bots can delete incoming messages in private chats. - Bots granted can_post_messages permissions can delete outgoing messages in channels. - If the bot is an administrator of a group, it can delete any message there. - If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.- Parameters:
chat_id
- Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)message_id
- Required if inline_message_id is not specified. Unique identifier of the sent message- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
getUpdates
List<Update> getUpdates(Integer offset, Integer limit, Integer timeout, List<String> allowed_updates) throws TelegramException
Use this method to receive incoming updates using long polling (wiki). An Array ofUpdate
objects is returned.- Parameters:
offset
- Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. Watch more in https://core.telegram.org/bots/api#getupdateslimit
- Optional. Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults to 100timeout
- Optional. Timeout in seconds for long polling. Defaults to 0, i.e. usual short pollingallowed_updates
- Optional. List the types of updates you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used.- Returns:
- An Array of
Update
objects - Throws:
TelegramException
- if the method fails in Telegram servers
-
getWebhookInfo
WebhookInfo getWebhookInfo() throws TelegramException
Use this method to get current webhook status. Requires no parameters. On success, returns aWebhookInfo
object. If the bot is usinggetUpdates(java.lang.Integer, java.lang.Integer, java.lang.Integer, java.util.List<java.lang.String>)
, will return an object with the url field empty.- Returns:
WebhookInfo
- Throws:
TelegramException
- if the method fails in Telegram servers
-
setWebhook
Boolean setWebhook(String url, File certificate, Integer max_connections, List<String> allowed_updates) throws TelegramException
Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. https://www.example.com/<token>. Since nobody else knows your bot‘s token, you can be pretty sure it’s us. Notes- You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.ǘ
- We currently do not support self-signed certificates.
- Ports currently supported for Webhooks: 443, 80, 88, 8443.
- Parameters:
url
- HTTPS url to send updates to. Use an empty string to remove webhook integrationcertificate
- Optional. Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details.max_connections
- Optional. Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot‘s server, and higher values to increase your bot’s throughput.allowed_updates
- Optional. List the types of updates you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. SeeUpdate
for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used.- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
deleteWebhook
Boolean deleteWebhook() throws TelegramException
Use this method to remove webhook integration if you decide to switch back togetUpdates(java.lang.Integer, java.lang.Integer, java.lang.Integer, java.util.List<java.lang.String>)
. Returns True on success. Requires no parameters.- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendSticker
default Message sendSticker(Object chat_id, String sticker) throws TelegramException
Use this method to send static .WEBP or animated .TGS stickers. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)sticker
- Sticker to send. You can either pass a file_id as String to resend a sticker that is already on the Telegram servers, or upload a new sticker using multipart/form-data.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendSticker
default Message sendSticker(Object chat_id, File sticker) throws TelegramException
Use this method to send static .WEBP or animated .TGS stickers. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)sticker
- Sticker to send. You can either pass a file_id as String to resend a sticker that is already on the Telegram servers, or upload a new sticker using multipart/form-data.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendSticker
Message sendSticker(Object chat_id, Object sticker, Boolean disable_notification, Integer reply_to_message_id, Object reply_markup) throws TelegramException
Use this method to send static .WEBP or animated .TGS stickers. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chat or username of the target channel (in the format @channelusername)sticker
- Sticker to send. You can either pass a file_id as String to resend a sticker that is already on the Telegram servers, or upload a new sticker using multipart/form-data.reply_to_message_id
- If the message is a reply, ID of the original messagedisable_notification
- Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.reply_markup
- Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user. It can beReplyKeyboardMarkup
,ReplyKeyboardRemove
orForceReply
.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
getStickerSet
StickerSet getStickerSet(String name) throws TelegramException
Use this method to get a sticker set. On success, a StickerSet object is returned.- Parameters:
name
- Name of the sticker set- Returns:
- StickerSet
- Throws:
TelegramException
- if the method fails in Telegram servers
-
uploadStickerFile
File uploadStickerFile(Integer user_id, File png_sticker) throws TelegramException
Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success.- Parameters:
user_id
- User identifier of sticker file ownerpng_sticker
- Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px.- Returns:
- The uploaded File on success.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
createNewStickerSet
default Boolean createNewStickerSet(Integer user_id, String name, String title, File png_sticker, File tgs_sticker, String emojis) throws TelegramException
Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success.- Parameters:
user_id
- User identifier of created sticker set ownername
- Short name of sticker set, to be used in t.me/addstickers/ URLs. Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”. <bot_username> is case insensitive. 1-64 characters.title
- Sticker set title, 1-64 characterspng_sticker
- Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one usingtgs_sticker
- TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirementsemojis
- One or more emoji corresponding to the sticker- Returns:
- True on success.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
createNewStickerSet
default Boolean createNewStickerSet(Integer user_id, String name, String title, String png_sticker, File tgs_sticker, String emojis) throws TelegramException
Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success.- Parameters:
user_id
- User identifier of created sticker set ownername
- Short name of sticker set, to be used in t.me/addstickers/ URLs. Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”. <bot_username> is case insensitive. 1-64 characters.title
- Sticker set title, 1-64 characterspng_sticker
- Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one usingtgs_sticker
- TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirementsemojis
- One or more emoji corresponding to the sticker- Returns:
- True on success.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
createNewStickerSet
Boolean createNewStickerSet(Integer user_id, String name, String title, Object png_sticker, File tgs_sticker, String emojis, Boolean contains_masks, MaskPosition mask_position) throws TelegramException
Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success.- Parameters:
user_id
- User identifier of created sticker set ownername
- Short name of sticker set, to be used in t.me/addstickers/ URLs. Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”. <bot_username> is case insensitive. 1-64 characters.title
- Sticker set title, 1-64 characterspng_sticker
- Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one usingemojis
- One or more emoji corresponding to the stickercontains_masks
- Optional. Pass True, if a set of mask stickers should be createdmask_position
- Optional. A JSON-serialized object for position where the mask should be placed on faces- Returns:
- True on success.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
addStickerToSet
default Boolean addStickerToSet(Integer user_id, String name, File png_sticker, File tgs_sticker, String emojis) throws TelegramException
Use this method to add a new sticker to a set created by the bot. Returns True on success.- Parameters:
user_id
- User identifier of sticker set ownername
- Sticker set namepng_sticker
- Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-datatgs_sticker
- TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirementsemojis
- One or more emoji corresponding to the sticker- Returns:
- True on success.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
addStickerToSet
default Boolean addStickerToSet(Integer user_id, String name, String png_sticker, String emojis) throws TelegramException
Use this method to add a new sticker to a set created by the bot. Returns True on success.- Parameters:
user_id
- User identifier of sticker set ownername
- Sticker set namepng_sticker
- Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-dataemojis
- One or more emoji corresponding to the sticker- Returns:
- True on success.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
addStickerToSet
Boolean addStickerToSet(Integer user_id, String name, Object png_sticker, String emojis, MaskPosition mask_position) throws TelegramException
Use this method to add a new sticker to a set created by the bot. Returns True on success.- Parameters:
user_id
- User identifier of sticker set ownername
- Sticker set namepng_sticker
- Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-dataemojis
- One or more emoji corresponding to the stickermask_position
- Optional. A JSON-serialized object for position where the mask should be placed on faces- Returns:
- True on success.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
setStickerPositionInSet
Boolean setStickerPositionInSet(String sticker, Integer position) throws TelegramException
Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success.- Parameters:
sticker
- File identifier of the stickerposition
- New sticker position in the set, zero-based- Returns:
- True on success.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
deleteStickerFromSet
Boolean deleteStickerFromSet(String sticker) throws TelegramException
Use this method to delete a sticker from a set created by the bot. Returns True on success.- Parameters:
sticker
- File identifier of the sticker- Returns:
- True on success.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
setStickerSetThumb
Boolean setStickerSetThumb(String name, Integer user_id, File thumb) throws TelegramException
Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only- Parameters:
name
- Sticker set nameuser_id
- User identifier of the sticker set ownerthumb
- A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/animated_stickers#technical-requirements for animated sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files ». Animated sticker set thumbnail can't be uploaded via HTTP URL.- Returns:
- True on success.
- Throws:
TelegramException
-
setStickerSetThumb
Boolean setStickerSetThumb(String name, Integer user_id, String thumb) throws TelegramException
Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only- Parameters:
name
- Sticker set nameuser_id
- User identifier of the sticker set ownerthumb
- A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/animated_stickers#technical-requirements for animated sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files ». Animated sticker set thumbnail can't be uploaded via HTTP URL.- Returns:
- True on success.
- Throws:
TelegramException
-
answerInlineQuery
default Boolean answerInlineQuery(String inlineQueryId, List<InlineQueryResult> results) throws TelegramException
Use this method to send answers to an inline query. On success, True is returned. No more than 50 results per query are allowed.- Parameters:
inlineQueryId
- Unique identifier for the answered queryresults
- A JSON-serialized array of results for the inline query- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
answerInlineQuery
Boolean answerInlineQuery(String inlineQueryId, List<InlineQueryResult> results, Integer cache_time, Boolean is_personal, String next_offset, String switch_pm_text, String switch_pm_parameter) throws TelegramException
Use this method to send answers to an inline query. On success, True is returned. No more than 50 results per query are allowed.- Parameters:
inlineQueryId
- Unique identifier for the answered queryresults
- A JSON-serialized array of results for the inline querycache_time
- The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.is_personal
- Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same querynext_offset
- Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes.switch_pm_text
- If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameterswitch_pm_parameter
- Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.- Returns:
- On success, True is returned.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendInvoice
default Message sendInvoice(Integer chat_id, String title, String description, String payload, String provider_token, String start_parameter, String currency, List<LabeledPrice> prices) throws TelegramException
Use this method to send invoices. On success, the sent Message is returned.- Parameters:
chat_id
- Unique identifier for the target private chattitle
- Product namedescription
- Product descriptionpayload
- Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.provider_token
- Payments provider token, obtained via Botfatherstart_parameter
- Unique deep-linking parameter that can be used to generate this invoice when used as a start parametercurrency
- Three-letter ISO 4217 currency code, see more on https://core.telegram.org/bots/payments#supported-currenciesprices
- Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendInvoice
Message sendInvoice(Integer chat_id, String title, String description, String payload, String provider_token, String start_parameter, String currency, List<LabeledPrice> prices, String provider_data, String photo_url, Integer photo_size, Integer photo_width, Integer photo_height, Boolean need_name, Boolean need_phone_number, Boolean need_email, Boolean need_shipping_address, Boolean send_phone_number_to_provider, Boolean send_email_to_provider, Boolean is_flexible, Boolean disable_notification, Integer reply_to_message_id, InlineKeyboardMarkup reply_markup) throws TelegramException
Use this method to send invoices. On success, the sent Message is returned.- Parameters:
chat_id
- Unique identifier for the target private chattitle
- Product namedescription
- Product descriptionpayload
- Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.provider_token
- Payments provider token, obtained via Botfatherstart_parameter
- Unique deep-linking parameter that can be used to generate this invoice when used as a start parametercurrency
- Three-letter ISO 4217 currency code, see more on https://core.telegram.org/bots/payments#supported-currenciesprices
- Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)provider_data
- JSON-encoded data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.photo_url
- URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.photo_size
- Photo sizephoto_width
- Photo widthphoto_height
- Photo heightneed_name
- Pass True, if you require the user's full name to complete the orderneed_phone_number
- Pass True, if you require the user's phone number to complete the orderneed_email
- Pass True, if you require the user's email to complete the orderneed_shipping_address
- Pass True, if you require the user's shipping address to complete the ordersend_phone_number_to_provider
- Pass True, if user's phone number should be sent to providersend_email_to_provider
- Pass True, if user's email address should be sent to provideris_flexible
- Pass True, if the final price depends on the shipping methoddisable_notification
- Sends the message silently. Users will receive a notification with no sound.reply_to_message_id
- If the message is a reply, ID of the original messagereply_markup
- A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button.- Returns:
Message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
answerShippingQuery
default Boolean answerShippingQuery(String shipping_query_id, Boolean ok) throws TelegramException
If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.- Parameters:
shipping_query_id
- Unique identifier for the query to be answeredok
- Specify True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)- Returns:
- True on success
- Throws:
TelegramException
- if the method fails in Telegram servers
-
answerShippingQuery
Boolean answerShippingQuery(String shipping_query_id, Boolean ok, List<ShippingOption> shipping_options, String error_message) throws TelegramException
If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.- Parameters:
shipping_query_id
- Unique identifier for the query to be answeredok
- Specify True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)shipping_options
- Required if ok is True. A JSON-serialized array of available shipping options.error_message
- Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.- Returns:
- True on success
- Throws:
TelegramException
- if the method fails in Telegram servers
-
answerPreCheckoutQuery
default Boolean answerPreCheckoutQuery(String pre_checkout_query_id, Boolean ok) throws TelegramException
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.- Parameters:
pre_checkout_query_id
- Unique identifier for the query to be answeredok
- Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.- Returns:
- On success, True is returned
- Throws:
TelegramException
- if the method fails in Telegram servers
-
answerPreCheckoutQuery
Boolean answerPreCheckoutQuery(String pre_checkout_query_id, Boolean ok, String error_message) throws TelegramException
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.- Parameters:
pre_checkout_query_id
- Unique identifier for the query to be answeredok
- Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.error_message
- Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.- Returns:
- On success, True is returned
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendGame
default Message sendGame(Object chat_id, String game_short_name) throws TelegramException
Use this method to send a game. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chatgame_short_name
- Short name of the game, serves as the unique identifier for the game.- Returns:
- On success, the sent message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
sendGame
Message sendGame(Object chat_id, String game_short_name, Boolean disable_notification, Integer reply_to_message_id, InlineKeyboardMarkup reply_markup) throws TelegramException
Use this method to send a game. On success, the sentMessage
is returned.- Parameters:
chat_id
- Unique identifier for the target chatgame_short_name
- Short name of the game, serves as the unique identifier for the game.disable_notification
- Sends the message silently. Users will receive a notification with no sound.reply_to_message_id
- If the message is a reply, ID of the original messagereply_markup
- A JSON-serialized object for an inline keyboard. If empty, one ‘Play game_title’ button will be shown. If not empty, the first button must launch the game.- Returns:
- On success, the sent message
- Throws:
TelegramException
- if the method fails in Telegram servers
-
setGameScore
default Object setGameScore(Integer user_id, Integer score) throws TelegramException
Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.- Parameters:
user_id
- User identifierscore
- New score, must be non-negative- Returns:
- the Message, true or false
- Throws:
TelegramException
- if the method fails in Telegram servers
-
setGameScore
Object setGameScore(Integer user_id, Integer score, Boolean force, Boolean disable_edit_message, Object chat_id, Integer message_id, String inline_message_id) throws TelegramException
Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.- Parameters:
user_id
- User identifierscore
- New score, must be non-negativeforce
- Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheatersdisable_edit_message
- Pass True, if the game message should not be automatically edited to include the current scoreboardchat_id
- Required if inline_message_id is not specified. Unique identifier for the target chatmessage_id
- Required if inline_message_id is not specified. Identifier of the sent messageinline_message_id
- Required if chat_id and message_id are not specified. Identifier of the inline message- Returns:
- the Message, true or false
- Throws:
TelegramException
- if the method fails in Telegram servers
-
getGameHighScores
default List<GameHighScore> getGameHighScores(Integer user_id) throws TelegramException
Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game.- Parameters:
user_id
- Target user id- Returns:
- On success, returns an Array of GameHighScore objects.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
getGameHighScores
List<GameHighScore> getGameHighScores(Integer user_id, Object chat_id, Integer message_id, String inline_message_id) throws TelegramException
Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game.- Parameters:
user_id
- Target user idchat_id
- Required if inline_message_id is not specified. Unique identifier for the target chatmessage_id
- Required if inline_message_id is not specified. Identifier of the sent messageinline_message_id
- Required if chat_id and message_id are not specified. Identifier of the inline message- Returns:
- On success, returns an Array of GameHighScore objects.
- Throws:
TelegramException
- if the method fails in Telegram servers
-
-