StaticGramBot API
Раздел

Игры

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.

  • Games are a new type of content on Telegram, represented by the Game and InlineQueryResultGame objects.
  • Once you've created a game via BotFather, you can send games to chats as regular messages using the sendGame method, or use inline mode with InlineQueryResultGame.
  • If you send the game message without any buttons, it will automatically have a 'Play GameName' button. When this button is pressed, your bot gets a CallbackQuery with the game_short_name of the requested game. You provide the correct URL for this particular user and the app opens the game in the in-app browser.
  • You can manually add multiple buttons to your game message. Please note that the first button in the first row must always launch the game, using the field callback_game in InlineKeyboardButton. You can add extra buttons according to taste: e.g., for a description of the rules, or to open the game's official community.
  • To make your game more attractive, you can upload a GIF animation that demonstrates the game to the users via BotFather (see Lumberjack for example).
  • A game message will also display high scores for the current chat. Use setGameScore to post high scores to the chat with the game, add the disable_edit_message parameter to disable automatic update of the message with the current scoreboard.
  • Use getGameHighScores to get data for in-game high score tables.
  • You can also add an extra sharing button for users to share their best score to different chats.
  • For examples of what can be done using this new stuff, check the @gamebot and @gamee bots.

Методы 3

МетодСтатусОписание
sendGameПоддерживаетсяUse this method to send a game.
setGameScoreПоддерживаетсяUse this method to set the score of the specified user in a game message.
getGameHighScoresПоддерживаетсяUse this method to get data for high score tables.

Типы 3

ТипОписание
GameThis object represents a game.
CallbackGameA placeholder, currently holds no information.
GameHighScoreThis object represents one row of the high scores table for a game.

Описания методов и типов взяты из официальной документации Telegram Bot API (Bot API 10.3). Адрес API: https://api.staticgram.top