From fafed73b94cd63fb7f141619960d9fe09e95de72 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Thu, 18 Jul 2024 02:14:10 +0530 Subject: [PATCH 01/25] Added introductory paragraph to payments section --- docs/source/telegram.payments-tree.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/source/telegram.payments-tree.rst b/docs/source/telegram.payments-tree.rst index 0db0ba21959..9b2a50b3a51 100644 --- a/docs/source/telegram.payments-tree.rst +++ b/docs/source/telegram.payments-tree.rst @@ -1,6 +1,10 @@ Payments -------- +Your bot can accept payments from Telegram users. Please see the `introduction to payments`_ for more details on the process and how to set up payments for your bot. + +.. _introduction to payments: https://core.telegram.org/bots/payments + .. toctree:: :titlesonly: From a4e1514ee42d376abd05862a1f63c72989cc0ec8 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Thu, 18 Jul 2024 02:19:26 +0530 Subject: [PATCH 02/25] Added introductory paragraph to passport section --- docs/source/telegram.passportfile.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/source/telegram.passportfile.rst b/docs/source/telegram.passportfile.rst index 643ba3df897..b8c58b820d3 100644 --- a/docs/source/telegram.passportfile.rst +++ b/docs/source/telegram.passportfile.rst @@ -1,6 +1,10 @@ PassportFile ============ +Passport is a unified authorization method for services that require personal identification. Users can upload their documents once, then instantly share their data with services that require real-world ID (finance, ICOs, etc.). Please see the `manual`_ for details. + +.. _manual: https://core.telegram.org/passport + .. autoclass:: telegram.PassportFile :members: :show-inheritance: From 7d4e4fa897d02ae37dfdb4ef84f5f83ce19226bb Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Thu, 18 Jul 2024 02:21:03 +0530 Subject: [PATCH 03/25] Added introductory paragraph to games section --- docs/source/telegram.games-tree.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/source/telegram.games-tree.rst b/docs/source/telegram.games-tree.rst index 64f399d86a9..8bd5297ed25 100644 --- a/docs/source/telegram.games-tree.rst +++ b/docs/source/telegram.games-tree.rst @@ -1,6 +1,34 @@ 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 demostrates 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 edit_message parameter to automatically update 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. + +.. _@BotFather: https://t.me/botfather +.. _Game: https://docs.python-telegram-bot.org/en/v21.4/telegram.game.html +.. _InlineQueryResultGame: https://docs.python-telegram-bot.org/en/v21.4/telegram.inlinequeryresultgame.html +.. _BotFather: https://t.me/botfather +.. _sendGame: https://core.telegram.org/bots/api#sendgame +.. _inline mode: https://docs.python-telegram-bot.org/en/v21.4/telegram.inline-tree.html +.. _CallbackQuery: https://docs.python-telegram-bot.org/en/v21.4/telegram.callbackquery.html +.. _InlineKeyboardButton: https://docs.python-telegram-bot.org/en/v21.4/telegram.inlinekeyboardbutton.html +.. _Lumberjack: https://t.me/gamebot?game=lumberjack +.. _setGameScore: https://core.telegram.org/bots/api#setgamescore +.. _getGameHighScores: https://core.telegram.org/bots/api#getgamehighscores +.. _sharing button: https://core.telegram.org/bots/games#sharing-your-game-to-telegram-chats +.. _@gamebot: https://t.me/gamebot +.. _@gamee: https://t.me/gamee + + .. toctree:: :titlesonly: From 07501df99cd6aa4014e089a262b5986ba0f42365 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Thu, 18 Jul 2024 02:22:05 +0530 Subject: [PATCH 04/25] Added introductory paragraph to inline mode section --- docs/source/telegram.inline-tree.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/source/telegram.inline-tree.rst b/docs/source/telegram.inline-tree.rst index 7fa52a94b58..5e20ddfd4a9 100644 --- a/docs/source/telegram.inline-tree.rst +++ b/docs/source/telegram.inline-tree.rst @@ -1,6 +1,15 @@ Inline Mode ----------- +The following methods and objects allow your bot to work in `inline mode`_. +Please see our `Introduction to Inline bots`_ for more details. + +To enable this option, send the /setinline command to `@BotFather`_ and provide the placeholder text that the user will see in the input field after typing your bot's name. + +.. _inline mode: https://docs.python-telegram-bot.org/en/v21.4/telegram.inline-tree.html +.. _Introduction to Inline bots: https://core.telegram.org/bots/inline +.. _@BotFather: https://t.me/botfather + .. toctree:: :titlesonly: From 15b50aabcf4ceae4ccc73d09a2cf49fcd0451649 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Thu, 18 Jul 2024 02:23:07 +0530 Subject: [PATCH 05/25] Added introductory paragraph to stickers section --- docs/source/telegram.stickers-tree.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/telegram.stickers-tree.rst b/docs/source/telegram.stickers-tree.rst index 783b90ec0c7..2ea687183c0 100644 --- a/docs/source/telegram.stickers-tree.rst +++ b/docs/source/telegram.stickers-tree.rst @@ -1,6 +1,8 @@ Stickers -------- +The following methods and objects allow your bot to handle stickers and sticker sets. + .. toctree:: :titlesonly: From fb7ef673f8b560802818e48d068e7f9cd0835ad1 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Thu, 18 Jul 2024 02:24:03 +0530 Subject: [PATCH 06/25] Added introductory paragraph to available types section --- docs/source/telegram.at-tree.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/source/telegram.at-tree.rst b/docs/source/telegram.at-tree.rst index 8d3238a27e4..1d8ea7e04e8 100644 --- a/docs/source/telegram.at-tree.rst +++ b/docs/source/telegram.at-tree.rst @@ -1,6 +1,12 @@ Available Types --------------- +All types used in the Bot API responses are represented as JSON-objects. + +It is safe to use 32-bit signed integers for storing all **Integer** fields unless otherwise noted. + +Optional fields may be not returned when irrelevant. + .. toctree:: :titlesonly: From 3cffbe7fbfd2cca6b5eb492b03d37087cf408de1 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Thu, 18 Jul 2024 09:30:33 +0530 Subject: [PATCH 07/25] Add my name to AUTHORS.rst file --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 403362aaab0..04e14f683d4 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -87,6 +87,7 @@ The following wonderful people contributed directly or indirectly to this projec - `Miguel C. R. `_ - `miles `_ - `Mischa Krüger `_ +- `Mohd Yusuf `_ - `naveenvhegde `_ - `neurrone `_ - `NikitaPirate `_ From 57912f2f53352533473aa6e651a9c5938ecd29d1 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Thu, 18 Jul 2024 09:41:12 +0530 Subject: [PATCH 08/25] Update .gitignore to exclude myenv/ --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 470d2a2aac1..e6b139b044d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ __pycache__/ # Distribution / packaging .Python +myenv/ env/ build/ develop-eggs/ From def2d30749b5106740fdad3c913920ef212b0daa Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Thu, 18 Jul 2024 10:19:35 +0530 Subject: [PATCH 09/25] Remove the introductory paragraph that I mistakenly added to passportfile.rst instead of passport-tree.rst --- docs/source/telegram.passportfile.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/source/telegram.passportfile.rst b/docs/source/telegram.passportfile.rst index b8c58b820d3..643ba3df897 100644 --- a/docs/source/telegram.passportfile.rst +++ b/docs/source/telegram.passportfile.rst @@ -1,10 +1,6 @@ PassportFile ============ -Passport is a unified authorization method for services that require personal identification. Users can upload their documents once, then instantly share their data with services that require real-world ID (finance, ICOs, etc.). Please see the `manual`_ for details. - -.. _manual: https://core.telegram.org/passport - .. autoclass:: telegram.PassportFile :members: :show-inheritance: From 47724dfb1d9f820ddc062558993f99f87bae146b Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Thu, 18 Jul 2024 10:20:52 +0530 Subject: [PATCH 10/25] Added introductory paragraph to Passport section --- docs/source/telegram.passport-tree.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/source/telegram.passport-tree.rst b/docs/source/telegram.passport-tree.rst index fb4e3b4ffde..f31ad6c0a67 100644 --- a/docs/source/telegram.passport-tree.rst +++ b/docs/source/telegram.passport-tree.rst @@ -1,6 +1,10 @@ Passport -------- +Passport is a unified authorization method for services that require personal identification. Users can upload their documents once, then instantly share their data with services that require real-world ID (finance, ICOs, etc.). Please see the `manual`_ for details. + +.. _manual: https://core.telegram.org/passport + .. toctree:: :titlesonly: From 3bc40953a2ff3bd557838b5a8b22526852d04020 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Thu, 18 Jul 2024 19:53:56 +0530 Subject: [PATCH 11/25] Address maintainer feedback: revert unnecessary changes --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index e6b139b044d..470d2a2aac1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ __pycache__/ # Distribution / packaging .Python -myenv/ env/ build/ develop-eggs/ From 7f5643b9afbb69db9eb365080e52c460ffeefdef Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Thu, 18 Jul 2024 19:56:29 +0530 Subject: [PATCH 12/25] Address maintainer feedback: revert unnecessary changes --- docs/source/telegram.at-tree.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/source/telegram.at-tree.rst b/docs/source/telegram.at-tree.rst index 1d8ea7e04e8..8d3238a27e4 100644 --- a/docs/source/telegram.at-tree.rst +++ b/docs/source/telegram.at-tree.rst @@ -1,12 +1,6 @@ Available Types --------------- -All types used in the Bot API responses are represented as JSON-objects. - -It is safe to use 32-bit signed integers for storing all **Integer** fields unless otherwise noted. - -Optional fields may be not returned when irrelevant. - .. toctree:: :titlesonly: From e45e9a56c7a9ce3ade46a3203b281e6491113dce Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Fri, 19 Jul 2024 01:42:39 +0530 Subject: [PATCH 13/25] Update games section to use internal Sphinx links --- docs/source/telegram.games-tree.rst | 35 +++++++++-------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/docs/source/telegram.games-tree.rst b/docs/source/telegram.games-tree.rst index 8bd5297ed25..d3f060549e8 100644 --- a/docs/source/telegram.games-tree.rst +++ b/docs/source/telegram.games-tree.rst @@ -1,32 +1,17 @@ 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. +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 demostrates 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 edit_message parameter to automatically update 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. - -.. _@BotFather: https://t.me/botfather -.. _Game: https://docs.python-telegram-bot.org/en/v21.4/telegram.game.html -.. _InlineQueryResultGame: https://docs.python-telegram-bot.org/en/v21.4/telegram.inlinequeryresultgame.html -.. _BotFather: https://t.me/botfather -.. _sendGame: https://core.telegram.org/bots/api#sendgame -.. _inline mode: https://docs.python-telegram-bot.org/en/v21.4/telegram.inline-tree.html -.. _CallbackQuery: https://docs.python-telegram-bot.org/en/v21.4/telegram.callbackquery.html -.. _InlineKeyboardButton: https://docs.python-telegram-bot.org/en/v21.4/telegram.inlinekeyboardbutton.html -.. _Lumberjack: https://t.me/gamebot?game=lumberjack -.. _setGameScore: https://core.telegram.org/bots/api#setgamescore -.. _getGameHighScores: https://core.telegram.org/bots/api#getgamehighscores -.. _sharing button: https://core.telegram.org/bots/games#sharing-your-game-to-telegram-chats -.. _@gamebot: https://t.me/gamebot -.. _@gamee: https://t.me/gamee +* Games are a new type of content on Telegram, represented by the :doc:`Game ` and :doc:`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 :doc:`inline mode ` with :doc:`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 :doc:`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 :doc:`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 demostrates 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 edit_message parameter to automatically update 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. .. toctree:: From ec863230a01effc93010a9ae5ac0a52a7226d1c0 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Fri, 19 Jul 2024 01:43:47 +0530 Subject: [PATCH 14/25] Update inline mode section to use internal Sphinx links --- docs/source/telegram.inline-tree.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/source/telegram.inline-tree.rst b/docs/source/telegram.inline-tree.rst index 5e20ddfd4a9..26b1c0eb2bf 100644 --- a/docs/source/telegram.inline-tree.rst +++ b/docs/source/telegram.inline-tree.rst @@ -2,13 +2,10 @@ Inline Mode ----------- The following methods and objects allow your bot to work in `inline mode`_. -Please see our `Introduction to Inline bots`_ for more details. +Please see our `Introduction to Inline bots `_ for more details. -To enable this option, send the /setinline command to `@BotFather`_ and provide the placeholder text that the user will see in the input field after typing your bot's name. +To enable this option, send the /setinline command to `@BotFather `_ and provide the placeholder text that the user will see in the input field after typing your bot's name. -.. _inline mode: https://docs.python-telegram-bot.org/en/v21.4/telegram.inline-tree.html -.. _Introduction to Inline bots: https://core.telegram.org/bots/inline -.. _@BotFather: https://t.me/botfather .. toctree:: :titlesonly: From 9b48b2cbd9854ea22e3bfe3221a8c06af0e71d72 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Fri, 19 Jul 2024 01:44:37 +0530 Subject: [PATCH 15/25] Update payment section to use internal Sphinx links --- docs/source/telegram.payments-tree.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/source/telegram.payments-tree.rst b/docs/source/telegram.payments-tree.rst index 9b2a50b3a51..74b9a7eb5cd 100644 --- a/docs/source/telegram.payments-tree.rst +++ b/docs/source/telegram.payments-tree.rst @@ -1,9 +1,8 @@ Payments -------- -Your bot can accept payments from Telegram users. Please see the `introduction to payments`_ for more details on the process and how to set up payments for your bot. +Your bot can accept payments from Telegram users. Please see the `introduction to payments `_ for more details on the process and how to set up payments for your bot. -.. _introduction to payments: https://core.telegram.org/bots/payments .. toctree:: :titlesonly: From 65966ce99845c54bca63a3d37b9160fc9e892288 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Fri, 19 Jul 2024 01:45:05 +0530 Subject: [PATCH 16/25] Update passport section to use internal Sphinx links --- docs/source/telegram.passport-tree.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/source/telegram.passport-tree.rst b/docs/source/telegram.passport-tree.rst index f31ad6c0a67..079ce948924 100644 --- a/docs/source/telegram.passport-tree.rst +++ b/docs/source/telegram.passport-tree.rst @@ -1,9 +1,8 @@ Passport -------- -Passport is a unified authorization method for services that require personal identification. Users can upload their documents once, then instantly share their data with services that require real-world ID (finance, ICOs, etc.). Please see the `manual`_ for details. +Passport is a unified authorization method for services that require personal identification. Users can upload their documents once, then instantly share their data with services that require real-world ID (finance, ICOs, etc.). Please see the `manual `_ for details. -.. _manual: https://core.telegram.org/passport .. toctree:: :titlesonly: From 30f76373ee773888f501cc6339de0361fce0a1e5 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Mon, 22 Jul 2024 13:23:13 +0530 Subject: [PATCH 17/25] Address maintainer feedback: Inline mode points to https://core.telegram.org/bots/inline, update a line from please see ours to please see telegrams and setinline to ensure its rendored correctly. --- docs/source/telegram.inline-tree.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/telegram.inline-tree.rst b/docs/source/telegram.inline-tree.rst index 26b1c0eb2bf..d02d36960cf 100644 --- a/docs/source/telegram.inline-tree.rst +++ b/docs/source/telegram.inline-tree.rst @@ -1,10 +1,10 @@ Inline Mode ----------- -The following methods and objects allow your bot to work in `inline mode`_. -Please see our `Introduction to Inline bots `_ for more details. +The following methods and objects allow your bot to work in `inline mode `_. +Please see Telegrams `Introduction to Inline bots `_ for more details. -To enable this option, send the /setinline command to `@BotFather `_ and provide the placeholder text that the user will see in the input field after typing your bot's name. +To enable this option, send the ``/setinline`` command to `@BotFather `_ and provide the placeholder text that the user will see in the input field after typing your bot's name. .. toctree:: From a50f90eeb3ea0d33491ab50dc7cf5ea86897c224 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Mon, 22 Jul 2024 13:25:57 +0530 Subject: [PATCH 18/25] Address maintainer feedback: Update documentation links --- docs/source/telegram.games-tree.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/source/telegram.games-tree.rst b/docs/source/telegram.games-tree.rst index d3f060549e8..4e2588b3da1 100644 --- a/docs/source/telegram.games-tree.rst +++ b/docs/source/telegram.games-tree.rst @@ -1,14 +1,14 @@ 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. +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 :doc:`Game ` and :doc:`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 :doc:`inline mode ` with :doc:`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 :doc:`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 :doc:`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. +* Games are a new type of content on Telegram, represented by the :class:`telegram.Game` and :class:`telegram.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 :class:`telegram.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 :class:`telegram.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 :class:`telegram.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 demostrates 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 edit_message parameter to automatically update the message with the current scoreboard. +* 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 ``edit_message`` parameter to automatically update 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. From 3ce6714dc3dde27d022ccf1a2005300e1c77a0d2 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Mon, 22 Jul 2024 13:48:21 +0530 Subject: [PATCH 19/25] Address maintainer feedback: Update more about links that ponit to the PTB docs rather than TG docs --- telegram/_message.py | 16 ++++++++++------ telegram/_reply.py | 8 ++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/telegram/_message.py b/telegram/_message.py index fceb8cb8768..5b9a5e213ff 100644 --- a/telegram/_message.py +++ b/telegram/_message.py @@ -358,7 +358,7 @@ class Message(MaybeInaccessibleMessage): about the animation. For backward compatibility, when this field is set, the document field will also be set. game (:class:`telegram.Game`, optional): Message is a game, information about the game. - `More about games >> `_. + `More about games >> `_. photo (Sequence[:class:`telegram.PhotoSize`], optional): Message is a photo, available sizes of the photo. This list is empty if the message does not contain a photo. @@ -431,10 +431,12 @@ class Message(MaybeInaccessibleMessage): :class:`telegram.InaccessibleMessage`. invoice (:class:`telegram.Invoice`, optional): Message is an invoice for a payment, information about the invoice. - `More about payments >> `_. + `More about payments >> \ + `_. successful_payment (:class:`telegram.SuccessfulPayment`, optional): Message is a service message about a successful payment, information about the payment. - `More about payments >> `_. + `More about payments >> \ + `_. connected_website (:obj:`str`, optional): The domain name of the website on which the user has logged in. `More about Telegram Login >> `_. @@ -675,7 +677,7 @@ class Message(MaybeInaccessibleMessage): .. seealso:: :wiki:`Working with Files and Media ` game (:class:`telegram.Game`): Optional. Message is a game, information about the game. - `More about games >> `_. + `More about games >> `_. photo (Tuple[:class:`telegram.PhotoSize`]): Optional. Message is a photo, available sizes of the photo. This list is empty if the message does not contain a photo. @@ -757,10 +759,12 @@ class Message(MaybeInaccessibleMessage): :class:`telegram.InaccessibleMessage`. invoice (:class:`telegram.Invoice`): Optional. Message is an invoice for a payment, information about the invoice. - `More about payments >> `_. + `More about payments >> \ + `_. successful_payment (:class:`telegram.SuccessfulPayment`): Optional. Message is a service message about a successful payment, information about the payment. - `More about payments >> `_. + `More about payments >> \ + `_. connected_website (:obj:`str`): Optional. The domain name of the website on which the user has logged in. `More about Telegram Login >> `_. diff --git a/telegram/_reply.py b/telegram/_reply.py index 0c15844c8d5..4f2c28025d4 100644 --- a/telegram/_reply.py +++ b/telegram/_reply.py @@ -92,14 +92,14 @@ class ExternalReplyInfo(TelegramObject): about the contact. dice (:class:`telegram.Dice`, optional): Message is a dice with random value. game (:Class:`telegram.Game`. optional): Message is a game, information about the game. - `More about games >> `_. + `More about games >> `_. giveaway (:class:`telegram.Giveaway`, optional): Message is a scheduled giveaway, information about the giveaway. giveaway_winners (:class:`telegram.GiveawayWinners`, optional): A giveaway with public winners was completed. invoice (:class:`telegram.Invoice`, optional): Message is an invoice for a payment, information about the invoice. `More about payments >> - `_. + `_. location (:class:`telegram.Location`, optional): Message is a shared location, information about the location. poll (:class:`telegram.Poll`, optional): Message is a native poll, information about the @@ -142,14 +142,14 @@ class ExternalReplyInfo(TelegramObject): about the contact. dice (:class:`telegram.Dice`): Optional. Message is a dice with random value. game (:Class:`telegram.Game`): Optional. Message is a game, information about the game. - `More about games >> `_. + `More about games >> `_. giveaway (:class:`telegram.Giveaway`): Optional. Message is a scheduled giveaway, information about the giveaway. giveaway_winners (:class:`telegram.GiveawayWinners`): Optional. A giveaway with public winners was completed. invoice (:class:`telegram.Invoice`): Optional. Message is an invoice for a payment, information about the invoice. `More about payments >> - `_. + `_. location (:class:`telegram.Location`): Optional. Message is a shared location, information about the location. poll (:class:`telegram.Poll`): Optional. Message is a native poll, information about the From ddf6af1bd44d64046dee4e38bd75981a929d34b0 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Tue, 23 Jul 2024 11:27:01 +0530 Subject: [PATCH 20/25] Address maintainer feedback: Update links --- docs/source/telegram.games-tree.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/source/telegram.games-tree.rst b/docs/source/telegram.games-tree.rst index 4e2588b3da1..cbcaeacae8b 100644 --- a/docs/source/telegram.games-tree.rst +++ b/docs/source/telegram.games-tree.rst @@ -1,15 +1,17 @@ +.. _games-tree: + 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 :class:`telegram.Game` and :class:`telegram.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 :class:`telegram.InlineQueryResultGame`. +* Once you've created a game via `BotFather `_, you can send games to chats as regular messages using the :meth:`~telegram.Bot.sendGame` method, or use :ref:`inline mode ` with :class:`telegram.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 :class:`telegram.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 :class:`telegram.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 demostrates 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 ``edit_message`` parameter to automatically update the message with the current scoreboard. -* Use getGameHighScores to get data for in-game high score tables. +* A game message will also display high scores for the current chat. Use :meth:`~telegram.Bot.setGameScore` to post high scores to the chat with the game, add the :paramref:`~telegram.Bot.set_game_score.paramref.edit_message` parameter to automatically update the message with the current scoreboard. +* Use :meth:`~telegram.Bot.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. From bc9afd34245047a94301e1a278cf603abad2c27e Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Tue, 23 Jul 2024 12:03:40 +0530 Subject: [PATCH 21/25] Made inline mode section reference-able --- docs/source/telegram.inline-tree.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/telegram.inline-tree.rst b/docs/source/telegram.inline-tree.rst index d02d36960cf..c187219e0f6 100644 --- a/docs/source/telegram.inline-tree.rst +++ b/docs/source/telegram.inline-tree.rst @@ -1,3 +1,5 @@ +.. _inline-tree: + Inline Mode ----------- From 429b6dc9f4528ce24190d46a336d6c6e8802875c Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Tue, 23 Jul 2024 12:04:44 +0530 Subject: [PATCH 22/25] Made payments section reference-able --- docs/source/telegram.payments-tree.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/telegram.payments-tree.rst b/docs/source/telegram.payments-tree.rst index 74b9a7eb5cd..ba4c838cae7 100644 --- a/docs/source/telegram.payments-tree.rst +++ b/docs/source/telegram.payments-tree.rst @@ -1,3 +1,5 @@ +.. _payments-tree: + Payments -------- From 787f77586cfb8c37eb8db49d3d35100d4fbaf7ac Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Tue, 23 Jul 2024 12:09:10 +0530 Subject: [PATCH 23/25] Address maintainer feedback: these links works with sphinx referencing system --- telegram/_reply.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/telegram/_reply.py b/telegram/_reply.py index 4f2c28025d4..222e522a6a4 100644 --- a/telegram/_reply.py +++ b/telegram/_reply.py @@ -92,14 +92,13 @@ class ExternalReplyInfo(TelegramObject): about the contact. dice (:class:`telegram.Dice`, optional): Message is a dice with random value. game (:Class:`telegram.Game`. optional): Message is a game, information about the game. - `More about games >> `_. + :ref:`More about games >> `. giveaway (:class:`telegram.Giveaway`, optional): Message is a scheduled giveaway, information about the giveaway. giveaway_winners (:class:`telegram.GiveawayWinners`, optional): A giveaway with public winners was completed. invoice (:class:`telegram.Invoice`, optional): Message is an invoice for a payment, - information about the invoice. `More about payments >> - `_. + information about the invoice. :ref:`More about payments >> `. location (:class:`telegram.Location`, optional): Message is a shared location, information about the location. poll (:class:`telegram.Poll`, optional): Message is a native poll, information about the @@ -142,14 +141,13 @@ class ExternalReplyInfo(TelegramObject): about the contact. dice (:class:`telegram.Dice`): Optional. Message is a dice with random value. game (:Class:`telegram.Game`): Optional. Message is a game, information about the game. - `More about games >> `_. + :ref:`More about games >> `. giveaway (:class:`telegram.Giveaway`): Optional. Message is a scheduled giveaway, information about the giveaway. giveaway_winners (:class:`telegram.GiveawayWinners`): Optional. A giveaway with public winners was completed. invoice (:class:`telegram.Invoice`): Optional. Message is an invoice for a payment, - information about the invoice. `More about payments >> - `_. + information about the invoice. :ref:`More about payments >> `. location (:class:`telegram.Location`): Optional. Message is a shared location, information about the location. poll (:class:`telegram.Poll`): Optional. Message is a native poll, information about the From 60510c12d1c1c49b73565e3a8298db27e84b6cf3 Mon Sep 17 00:00:00 2001 From: Muhammad Yusuf Date: Tue, 23 Jul 2024 12:13:31 +0530 Subject: [PATCH 24/25] Address maintainer feedback: these links works with sphinx referencing system --- telegram/_message.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/telegram/_message.py b/telegram/_message.py index 3fee1bc8764..d362e42f59f 100644 --- a/telegram/_message.py +++ b/telegram/_message.py @@ -359,7 +359,7 @@ class Message(MaybeInaccessibleMessage): about the animation. For backward compatibility, when this field is set, the document field will also be set. game (:class:`telegram.Game`, optional): Message is a game, information about the game. - `More about games >> `_. + :ref:`More about games >> `. photo (Sequence[:class:`telegram.PhotoSize`], optional): Message is a photo, available sizes of the photo. This list is empty if the message does not contain a photo. @@ -432,12 +432,10 @@ class Message(MaybeInaccessibleMessage): :class:`telegram.InaccessibleMessage`. invoice (:class:`telegram.Invoice`, optional): Message is an invoice for a payment, information about the invoice. - `More about payments >> \ - `_. + :ref:`More about payments >> `. successful_payment (:class:`telegram.SuccessfulPayment`, optional): Message is a service message about a successful payment, information about the payment. - `More about payments >> \ - `_. + :ref:`More about payments >> `. connected_website (:obj:`str`, optional): The domain name of the website on which the user has logged in. `More about Telegram Login >> `_. @@ -678,7 +676,7 @@ class Message(MaybeInaccessibleMessage): .. seealso:: :wiki:`Working with Files and Media ` game (:class:`telegram.Game`): Optional. Message is a game, information about the game. - `More about games >> `_. + :ref:`More about games >> `. photo (Tuple[:class:`telegram.PhotoSize`]): Optional. Message is a photo, available sizes of the photo. This list is empty if the message does not contain a photo. @@ -760,12 +758,10 @@ class Message(MaybeInaccessibleMessage): :class:`telegram.InaccessibleMessage`. invoice (:class:`telegram.Invoice`): Optional. Message is an invoice for a payment, information about the invoice. - `More about payments >> \ - `_. + :ref:`More about payments >> `. successful_payment (:class:`telegram.SuccessfulPayment`): Optional. Message is a service message about a successful payment, information about the payment. - `More about payments >> \ - `_. + :ref:`More about payments >> `. connected_website (:obj:`str`): Optional. The domain name of the website on which the user has logged in. `More about Telegram Login >> `_. From 3e2a899b460a3b2e3e1e8b78008e2162d62704f0 Mon Sep 17 00:00:00 2001 From: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com> Date: Wed, 24 Jul 2024 20:39:51 +0200 Subject: [PATCH 25/25] Fix to small issues in the game paragraph --- docs/source/telegram.games-tree.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/telegram.games-tree.rst b/docs/source/telegram.games-tree.rst index cbcaeacae8b..010c3c6d1fe 100644 --- a/docs/source/telegram.games-tree.rst +++ b/docs/source/telegram.games-tree.rst @@ -9,8 +9,8 @@ Your bot can offer users **HTML5 games** to play solo or to compete against each * Once you've created a game via `BotFather `_, you can send games to chats as regular messages using the :meth:`~telegram.Bot.sendGame` method, or use :ref:`inline mode ` with :class:`telegram.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 :class:`telegram.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 :class:`telegram.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 demostrates the game to the users via `BotFather `_ (see `Lumberjack `_ for example). -* A game message will also display high scores for the current chat. Use :meth:`~telegram.Bot.setGameScore` to post high scores to the chat with the game, add the :paramref:`~telegram.Bot.set_game_score.paramref.edit_message` parameter to automatically update the message with the current scoreboard. +* 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 :meth:`~telegram.Bot.setGameScore` to post high scores to the chat with the game, optionally add the :paramref:`~telegram.Bot.set_game_score.disable_edit_message` parameter if you don't want to automatically update the message with the current scoreboard. * Use :meth:`~telegram.Bot.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.