diff --git a/docs/channel-telegram-games.md b/docs/channel-telegram-games.md new file mode 100644 index 000000000..819da396c --- /dev/null +++ b/docs/channel-telegram-games.md @@ -0,0 +1,42 @@ +--- +id: channel-telegram-games +title: Gaming Platform +--- + +https://core.telegram.org/bots/games +https://core.telegram.org/bots/api#games + +To get started, send the `/newgame` command to `@BotFather`. + +## Sending Games to Chats as Regular Messages + +```js +async function App(context) { + await context.sendGame('your-game'); +} +``` + +game button + +```js +async function App(context) { + await context.sendGame('your-game', { + replyMarkup: [[{ text: 'Play Now!', callbackGame: {} }]], + }); +} +``` + +> **Note:** This type of button must always be the first button in the first row. + +```js +async function App(context) { + if ( + context.event.isCallbackQuery && + context.event.callbackQuery.gameShortName === 'your-game' + ) { + await context.answerCallbackQuery({ + url: 'https://your-game.tld', + }); + } +} +``` diff --git a/website/sidebars.json b/website/sidebars.json index ad9cd26eb..178ccc444 100755 --- a/website/sidebars.json +++ b/website/sidebars.json @@ -16,13 +16,14 @@ "channel-messenger-profile" ], "Guides (LINE)": [ - "channel-line-setup", + "channel-line-setup", "channel-line-handling-events", "channel-line-flex" ], "Guides (Telegram)": [ "channel-telegram-setup", - "channel-telegram-handling-events" + "channel-telegram-handling-events", + "channel-telegram-games" ], "Guides (Slack)": ["channel-slack-setup", "channel-slack-handling-events"], "Guides (Viber)": ["channel-viber-setup", "channel-viber-handling-events"],