Games

Your bot can offer users HTML5 games to play solo or to compete against each other in groups and one-on-one chats. Create games via @BotFather using the /newgame command. Please note that this kind of power requires responsibility: you will need to accept the terms for each game that your bots will be offering.

sendGame

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

Parameter Type Required Description
business_connection_id String Optional Unique identifier of the business connection on behalf of which the message will be sent
chat_id Integer Yes Unique identifier for the target chat. Games can't be sent to channel direct messages chats and channel chats.
message_thread_id Integer Optional Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
game_short_name String Yes Short name of the game, serves as the unique identifier for the game. Set up your games via @BotFather.
disable_notification Boolean Optional Sends the message silently. Users will receive a notification with no sound.
protect_content Boolean Optional Protects the contents of the sent message from forwarding and saving
allow_paid_broadcast Boolean Optional Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_id String Optional Unique identifier of the message effect to be added to the message; for private chats only
reply_parameters ReplyParameters Optional Description of the message to reply to
reply_markup InlineKeyboardMarkup Optional 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.

Game

This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.

Field Type Description
title String Title of the game
description String Description of the game
photo Array of PhotoSize Photo that will be displayed in the game message in chats.
text String Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
text_entities Array of MessageEntity Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc.
animation Animation Optional. Animation that will be displayed in the game message in chats. Upload via BotFather

CallbackGame

A placeholder, currently holds no information. Use BotFather to set up your game.

setGameScore

Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.

Parameter Type Required Description
user_id Integer Yes User identifier
score Integer Yes New score, must be non-negative
force Boolean Optional Pass True if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters
disable_edit_message Boolean Optional Pass True if the game message should not be automatically edited to include the current scoreboard
chat_id Integer Optional Required if inline_message_id is not specified. Unique identifier for the target chat
message_id Integer Optional Required if inline_message_id is not specified. Identifier of the sent message
inline_message_id String Optional Required if chat_id and message_id are not specified. Identifier of the inline message

getGameHighScores

Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects.

This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and their neighbors are not among them. Please note that this behavior is subject to change.

Parameter Type Required Description
user_id Integer Yes Target user id
chat_id Integer Optional Required if inline_message_id is not specified. Unique identifier for the target chat
message_id Integer Optional Required if inline_message_id is not specified. Identifier of the sent message
inline_message_id String Optional Required if chat_id and message_id are not specified. Identifier of the inline message

GameHighScore

This object represents one row of the high scores table for a game.

Field Type Description
position Integer Position in high score table for the game
user User User
score Integer Score

And that's about all we've got for now.
If you've got any questions, please check out our Bot FAQ ยป