pyTelegramBotAPI 4.22.0__tar.gz → 4.24.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/.github/workflows/setup_python.yml +1 -1
  2. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/.travis.yml +1 -1
  3. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/PKG-INFO +5 -8
  4. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/README.md +2 -2
  5. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/conf.py +1 -1
  6. pytelegrambotapi-4.24.0/examples/asynchronous_telebot/custom_states.py +157 -0
  7. pytelegrambotapi-4.24.0/examples/asynchronous_telebot/mini_app.py +33 -0
  8. pytelegrambotapi-4.24.0/examples/custom_states.py +156 -0
  9. pytelegrambotapi-4.24.0/examples/mini_app.py +32 -0
  10. pytelegrambotapi-4.24.0/examples/mini_app_web/index.html +163 -0
  11. pytelegrambotapi-4.24.0/examples/mini_app_web/script.js +318 -0
  12. pytelegrambotapi-4.24.0/examples/mini_app_web/style.css +338 -0
  13. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/pyproject.toml +47 -48
  14. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/requirements.txt +4 -4
  15. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/__init__.py +396 -71
  16. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/apihelper.py +95 -28
  17. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/async_telebot.py +409 -71
  18. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/asyncio_filters.py +23 -27
  19. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/asyncio_handler_backends.py +98 -137
  20. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/asyncio_helper.py +104 -29
  21. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/asyncio_storage/__init__.py +13 -13
  22. pytelegrambotapi-4.24.0/telebot/asyncio_storage/base_storage.py +123 -0
  23. pytelegrambotapi-4.24.0/telebot/asyncio_storage/memory_storage.py +225 -0
  24. pytelegrambotapi-4.24.0/telebot/asyncio_storage/pickle_storage.py +274 -0
  25. pytelegrambotapi-4.24.0/telebot/asyncio_storage/redis_storage.py +339 -0
  26. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/custom_filters.py +21 -28
  27. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/handler_backends.py +258 -295
  28. pytelegrambotapi-4.24.0/telebot/states/__init__.py +128 -0
  29. pytelegrambotapi-4.24.0/telebot/states/asyncio/__init__.py +7 -0
  30. pytelegrambotapi-4.24.0/telebot/states/asyncio/context.py +153 -0
  31. pytelegrambotapi-4.24.0/telebot/states/asyncio/middleware.py +21 -0
  32. pytelegrambotapi-4.24.0/telebot/states/sync/__init__.py +7 -0
  33. pytelegrambotapi-4.24.0/telebot/states/sync/context.py +143 -0
  34. pytelegrambotapi-4.24.0/telebot/states/sync/middleware.py +21 -0
  35. pytelegrambotapi-4.24.0/telebot/storage/__init__.py +13 -0
  36. pytelegrambotapi-4.24.0/telebot/storage/base_storage.py +118 -0
  37. pytelegrambotapi-4.24.0/telebot/storage/memory_storage.py +225 -0
  38. pytelegrambotapi-4.24.0/telebot/storage/pickle_storage.py +263 -0
  39. pytelegrambotapi-4.24.0/telebot/storage/redis_storage.py +324 -0
  40. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/types.py +292 -121
  41. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/util.py +720 -700
  42. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/version.py +1 -1
  43. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/tests/test_handler_backends.py +285 -285
  44. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/tests/test_telebot.py +705 -703
  45. pytelegrambotapi-4.22.0/examples/asynchronous_telebot/custom_states.py +0 -91
  46. pytelegrambotapi-4.22.0/examples/custom_states.py +0 -106
  47. pytelegrambotapi-4.22.0/telebot/asyncio_storage/base_storage.py +0 -68
  48. pytelegrambotapi-4.22.0/telebot/asyncio_storage/memory_storage.py +0 -66
  49. pytelegrambotapi-4.22.0/telebot/asyncio_storage/pickle_storage.py +0 -110
  50. pytelegrambotapi-4.22.0/telebot/asyncio_storage/redis_storage.py +0 -179
  51. pytelegrambotapi-4.22.0/telebot/storage/__init__.py +0 -13
  52. pytelegrambotapi-4.22.0/telebot/storage/base_storage.py +0 -68
  53. pytelegrambotapi-4.22.0/telebot/storage/memory_storage.py +0 -69
  54. pytelegrambotapi-4.22.0/telebot/storage/pickle_storage.py +0 -116
  55. pytelegrambotapi-4.22.0/telebot/storage/redis_storage.py +0 -183
  56. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/.github/ISSUE_TEMPLATE +0 -0
  57. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  58. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/.gitignore +0 -0
  59. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/.readthedocs.yml +0 -0
  60. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/LICENSE +0 -0
  61. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/doc_req.txt +0 -0
  62. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/Makefile +0 -0
  63. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/_static/logo.png +0 -0
  64. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/_static/logo2.png +0 -0
  65. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/async_version/index.rst +0 -0
  66. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/calldata.rst +0 -0
  67. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/formatting.rst +0 -0
  68. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/index.rst +0 -0
  69. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/install.rst +0 -0
  70. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/en/LC_MESSAGES/async_version.po +0 -0
  71. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/en/LC_MESSAGES/calldata.po +0 -0
  72. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/en/LC_MESSAGES/formatting.po +0 -0
  73. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/en/LC_MESSAGES/index.po +0 -0
  74. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/en/LC_MESSAGES/install.po +0 -0
  75. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/en/LC_MESSAGES/quick_start.po +0 -0
  76. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/en/LC_MESSAGES/sync_version.po +0 -0
  77. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/en/LC_MESSAGES/types.po +0 -0
  78. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/en/LC_MESSAGES/util.po +0 -0
  79. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/ru/LC_MESSAGES/async_version.po +0 -0
  80. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/ru/LC_MESSAGES/calldata.po +0 -0
  81. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/ru/LC_MESSAGES/formatting.po +0 -0
  82. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/ru/LC_MESSAGES/index.po +0 -0
  83. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/ru/LC_MESSAGES/install.po +0 -0
  84. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/ru/LC_MESSAGES/quick_start.po +0 -0
  85. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/ru/LC_MESSAGES/sync_version.po +0 -0
  86. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/ru/LC_MESSAGES/types.po +0 -0
  87. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/locales/ru/LC_MESSAGES/util.po +0 -0
  88. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/quick_start.rst +0 -0
  89. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/sync_version/index.rst +0 -0
  90. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/types.rst +0 -0
  91. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/docs/source/util.rst +0 -0
  92. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/anonymous_bot.py +0 -0
  93. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/callback_data_examples/advanced_calendar_example/filters.py +0 -0
  94. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/callback_data_examples/advanced_calendar_example/keyboards.py +0 -0
  95. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/callback_data_examples/advanced_calendar_example/main.py +0 -0
  96. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/callback_data_examples/simple_products_example.py +0 -0
  97. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/chat_join_request.py +0 -0
  98. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/chat_member_example.py +0 -0
  99. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/continue_handling.py +0 -0
  100. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/custom_filters/admin_filter_example.py +0 -0
  101. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/custom_filters/advanced_text_filter.py +0 -0
  102. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/custom_filters/general_custom_filters.py +0 -0
  103. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/custom_filters/id_filter_example.py +0 -0
  104. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/custom_filters/is_filter_example.py +0 -0
  105. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/custom_filters/text_filter_example.py +0 -0
  106. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/detect_changes.py +0 -0
  107. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/download_file_example.py +0 -0
  108. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/echo_bot.py +0 -0
  109. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/exception_handler.py +0 -0
  110. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/formatting_example.py +0 -0
  111. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/message_reaction_example.py +0 -0
  112. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/middleware/flooding_middleware.py +0 -0
  113. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/middleware/i18n.py +0 -0
  114. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/middleware/i18n_middleware_example/i18n_base_midddleware.py +0 -0
  115. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/middleware/i18n_middleware_example/keyboards.py +0 -0
  116. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/middleware/i18n_middleware_example/locales/en/LC_MESSAGES/messages.po +0 -0
  117. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/middleware/i18n_middleware_example/locales/ru/LC_MESSAGES/messages.po +0 -0
  118. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/middleware/i18n_middleware_example/locales/uz_Latn/LC_MESSAGES/messages.po +0 -0
  119. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/middleware/i18n_middleware_example/main.py +0 -0
  120. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/multibot/README.MD +0 -0
  121. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/multibot/config.py +0 -0
  122. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/multibot/handlers.py +0 -0
  123. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/multibot/main.py +0 -0
  124. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/multibot/nginx_conf.conf +0 -0
  125. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/register_handler.py +0 -0
  126. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/send_file_example.py +0 -0
  127. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/set_command_example.py +0 -0
  128. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/skip_updates_example.py +0 -0
  129. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/timer_bot_async.py +0 -0
  130. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/update_listener.py +0 -0
  131. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/webhooks/async_webhook_aiohttp_echo_bot.py +0 -0
  132. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/webhooks/run_webhooks.py +0 -0
  133. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/asynchronous_telebot/webhooks/webhook_starlette_echo_bot.py +0 -0
  134. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/callback_data_examples/advanced_calendar_example/filters.py +0 -0
  135. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/callback_data_examples/advanced_calendar_example/keyboards.py +0 -0
  136. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/callback_data_examples/advanced_calendar_example/main.py +0 -0
  137. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/callback_data_examples/simple_products_example.py +0 -0
  138. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/chat_join_request.py +0 -0
  139. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/chat_member_example.py +0 -0
  140. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/continue_handling.py +0 -0
  141. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/create_invite_link.py +0 -0
  142. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/custom_filters/admin_filter_example.py +0 -0
  143. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/custom_filters/advanced_text_filter.py +0 -0
  144. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/custom_filters/general_custom_filters.py +0 -0
  145. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/custom_filters/id_filter_example.py +0 -0
  146. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/custom_filters/is_filter_example.py +0 -0
  147. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/custom_filters/text_filter_example.py +0 -0
  148. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/deep_linking.py +0 -0
  149. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/detailed_example/detailed_example.py +0 -0
  150. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/detailed_example/kitten.jpg +0 -0
  151. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/detailed_example/rooster.jpg +0 -0
  152. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/detect_changes.py +0 -0
  153. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/download_file_example.py +0 -0
  154. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/echo_bot.py +0 -0
  155. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/formatting_example.py +0 -0
  156. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/inline_example.py +0 -0
  157. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/inline_keyboard_example.py +0 -0
  158. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/message_reaction_example.py +0 -0
  159. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/README.md +0 -0
  160. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/class_based/antiflood_middleware.py +0 -0
  161. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/class_based/basic_example.py +0 -0
  162. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/class_based/i18n_middleware/i18n_base_middleware.py +0 -0
  163. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/class_based/i18n_middleware/keyboards.py +0 -0
  164. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/class_based/i18n_middleware/locales/en/LC_MESSAGES/messages.po +0 -0
  165. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/class_based/i18n_middleware/locales/ru/LC_MESSAGES/messages.po +0 -0
  166. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/class_based/i18n_middleware/locales/uz_Latn/LC_MESSAGES/messages.po +0 -0
  167. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/class_based/i18n_middleware/main.py +0 -0
  168. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/function_based/i18n.py +0 -0
  169. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/function_based/i18n_gettext/i18n_class.py +0 -0
  170. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/function_based/i18n_gettext/keyboards.py +0 -0
  171. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/function_based/i18n_gettext/locales/en/LC_MESSAGES/messages.po +0 -0
  172. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/function_based/i18n_gettext/locales/ru/LC_MESSAGES/messages.po +0 -0
  173. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/function_based/i18n_gettext/locales/uz_Latn/LC_MESSAGES/messages.po +0 -0
  174. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/function_based/i18n_gettext/main.py +0 -0
  175. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/middleware/function_based/session.py +0 -0
  176. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/multibot/README.MD +0 -0
  177. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/multibot/config.py +0 -0
  178. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/multibot/handlers.py +0 -0
  179. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/multibot/main.py +0 -0
  180. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/multibot/nginx_conf.conf +0 -0
  181. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/payments_example.py +0 -0
  182. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/poll_example.py +0 -0
  183. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/register_handler.py +0 -0
  184. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/reply_keyboard_markup_example.py +0 -0
  185. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/serverless/aws_lambda_function.py +0 -0
  186. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/serverless/azure_functions +0 -0
  187. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/serverless/flask_google_cloud_bot/.gcloudignore +0 -0
  188. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/serverless/flask_google_cloud_bot/app.yaml +0 -0
  189. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/serverless/flask_google_cloud_bot/main.py +0 -0
  190. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/serverless/flask_google_cloud_bot/requirements.txt +0 -0
  191. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/set_command_example.py +0 -0
  192. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/skip_updates_example.py +0 -0
  193. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/step_example.py +0 -0
  194. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/telebot_bot/telebot_bot.py +0 -0
  195. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/timer_bot.py +0 -0
  196. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/webhook_examples/README.md +0 -0
  197. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/webhook_examples/run_webhooks.py +0 -0
  198. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/webhook_examples/webhook_aiohttp_echo_bot.py +0 -0
  199. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/webhook_examples/webhook_cherrypy_echo_bot.py +0 -0
  200. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/webhook_examples/webhook_cpython_echo_bot.py +0 -0
  201. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/webhook_examples/webhook_fastapi_echo_bot.py +0 -0
  202. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/webhook_examples/webhook_flask_echo_bot.py +0 -0
  203. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/webhook_examples/webhook_flask_heroku_echo.py +0 -0
  204. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/webhook_examples/webhook_tornado_echo_bot.py +0 -0
  205. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/examples/webhook_examples/webhook_twisted_echo_bot.py +0 -0
  206. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/callback_data.py +0 -0
  207. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/ext/__init__.py +0 -0
  208. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/ext/aio/__init__.py +0 -0
  209. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/ext/aio/webhooks.py +0 -0
  210. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/ext/reloader.py +0 -0
  211. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/ext/sync/__init__.py +0 -0
  212. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/ext/sync/webhooks.py +0 -0
  213. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/formatting.py +0 -0
  214. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/telebot/service_utils.py +0 -0
  215. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/tests/__init__.py +0 -0
  216. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/tests/test_data/record.mp3 +0 -0
  217. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/tests/test_data/record.ogg +0 -0
  218. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/tests/test_data/record.wav +0 -0
  219. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/tests/test_data/test_video.mp4 +0 -0
  220. {pytelegrambotapi-4.22.0 → pytelegrambotapi-4.24.0}/tests/test_types.py +0 -0
@@ -20,7 +20,7 @@ jobs:
20
20
  runs-on: ubuntu-latest
21
21
  strategy:
22
22
  matrix:
23
- python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.9', 'pypy-3.10']
23
+ python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10']
24
24
  name: ${{ matrix.python-version }} and tests
25
25
  steps:
26
26
  - uses: actions/checkout@v2
@@ -1,10 +1,10 @@
1
1
  language: python
2
2
  python:
3
- - "3.8"
4
3
  - "3.9"
5
4
  - "3.10"
6
5
  - "3.11"
7
6
  - "3.12"
7
+ - "3.13"
8
8
  - "pypy3"
9
9
  install: "pip install -r requirements.txt"
10
10
  script:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyTelegramBotAPI
3
- Version: 4.22.0
3
+ Version: 4.24.0
4
4
  Summary: Python Telegram bot api.
5
5
  Project-URL: Homepage, https://github.com/eternnoir/pyTelegramBotAPI
6
6
  Project-URL: Documentation, https://pytba.readthedocs.org
@@ -8,23 +8,20 @@ Project-URL: Repository, https://github.com/eternnoir/pyTelegramBotAPI
8
8
  Project-URL: Issues, https://github.com/eternnoir/pyTelegramBotAPI/issues
9
9
  Author-email: eternnoir <eternnoir@gmail.com>
10
10
  License: GPL2
11
- License-File: LICENSE
12
11
  Keywords: api,bot,telegram,tools
13
12
  Classifier: Development Status :: 5 - Production/Stable
14
13
  Classifier: Environment :: Console
15
14
  Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
16
15
  Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.8
18
16
  Classifier: Programming Language :: Python :: 3.9
19
17
  Classifier: Programming Language :: Python :: 3.10
20
18
  Classifier: Programming Language :: Python :: 3.11
21
19
  Classifier: Programming Language :: Python :: 3.12
22
- Requires-Python: >=3.8
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Requires-Python: >=3.9
23
22
  Requires-Dist: requests
24
23
  Provides-Extra: aiohttp
25
24
  Requires-Dist: aiohttp; extra == 'aiohttp'
26
- Provides-Extra: aioredis
27
- Requires-Dist: aioredis; extra == 'aioredis'
28
25
  Provides-Extra: coloredlogs
29
26
  Requires-Dist: coloredlogs; extra == 'coloredlogs'
30
27
  Provides-Extra: fastapi
@@ -55,7 +52,7 @@ Description-Content-Type: text/markdown
55
52
  <p align="center">A simple, but extensible Python implementation for the <a href="https://core.telegram.org/bots/api">Telegram Bot API</a>.</p>
56
53
  <p align="center">Both synchronous and asynchronous.</p>
57
54
 
58
- ## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api-changelog#july-31-2024">7.8</a>!
55
+ ## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#october-31-2024"><img src="https://img.shields.io/badge/Bot%20API-7.11-blue?logo=telegram" alt="Supported Bot API version"></a>
59
56
 
60
57
  <h2><a href='https://pytba.readthedocs.io/en/latest/index.html'>Official documentation</a></h2>
61
58
  <h2><a href='https://pytba.readthedocs.io/ru/latest/index.html'>Official ru documentation</a></h2>
@@ -114,7 +111,7 @@ Description-Content-Type: text/markdown
114
111
 
115
112
  ## Getting started
116
113
 
117
- This API is tested with Python 3.8-3.12 and Pypy 3.
114
+ This API is tested with Python 3.9-3.13 and Pypy 3.
118
115
  There are two ways to install the library:
119
116
 
120
117
  * Installation using pip (a Python package manager):
@@ -10,7 +10,7 @@
10
10
  <p align="center">A simple, but extensible Python implementation for the <a href="https://core.telegram.org/bots/api">Telegram Bot API</a>.</p>
11
11
  <p align="center">Both synchronous and asynchronous.</p>
12
12
 
13
- ## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api-changelog#july-31-2024">7.8</a>!
13
+ ## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#october-31-2024"><img src="https://img.shields.io/badge/Bot%20API-7.11-blue?logo=telegram" alt="Supported Bot API version"></a>
14
14
 
15
15
  <h2><a href='https://pytba.readthedocs.io/en/latest/index.html'>Official documentation</a></h2>
16
16
  <h2><a href='https://pytba.readthedocs.io/ru/latest/index.html'>Official ru documentation</a></h2>
@@ -69,7 +69,7 @@
69
69
 
70
70
  ## Getting started
71
71
 
72
- This API is tested with Python 3.8-3.12 and Pypy 3.
72
+ This API is tested with Python 3.9-3.13 and Pypy 3.
73
73
  There are two ways to install the library:
74
74
 
75
75
  * Installation using pip (a Python package manager):
@@ -22,7 +22,7 @@ author = 'coder2020official'
22
22
  copyright = f'2022-{datetime.now().year}, {author}'
23
23
 
24
24
  # The full version, including alpha/beta/rc tags
25
- release = '4.22.0'
25
+ release = '4.24.0'
26
26
 
27
27
 
28
28
  # -- General configuration ---------------------------------------------------
@@ -0,0 +1,157 @@
1
+ from telebot import async_telebot, asyncio_filters, types
2
+ from telebot.asyncio_storage import StateMemoryStorage
3
+ from telebot.states import State, StatesGroup
4
+ from telebot.states.asyncio.context import StateContext
5
+ from telebot.types import ReplyParameters
6
+
7
+ # Initialize the bot
8
+ state_storage = StateMemoryStorage() # don't use this in production; switch to redis
9
+ bot = async_telebot.AsyncTeleBot("TOKEN", state_storage=state_storage)
10
+
11
+
12
+ # Define states
13
+ class MyStates(StatesGroup):
14
+ name = State()
15
+ age = State()
16
+ color = State()
17
+ hobby = State()
18
+
19
+
20
+ # Start command handler
21
+ @bot.message_handler(commands=["start"])
22
+ async def start_ex(message: types.Message, state: StateContext):
23
+ await state.set(MyStates.name)
24
+ await bot.send_message(
25
+ message.chat.id,
26
+ "Hello! What is your first name?",
27
+ reply_parameters=ReplyParameters(message_id=message.message_id),
28
+ )
29
+
30
+
31
+ # Cancel command handler
32
+ @bot.message_handler(state="*", commands=["cancel"])
33
+ async def any_state(message: types.Message, state: StateContext):
34
+ await state.delete()
35
+ await bot.send_message(
36
+ message.chat.id,
37
+ "Your information has been cleared. Type /start to begin again.",
38
+ reply_parameters=ReplyParameters(message_id=message.message_id),
39
+ )
40
+
41
+
42
+ # Handler for name input
43
+ @bot.message_handler(state=MyStates.name)
44
+ async def name_get(message: types.Message, state: StateContext):
45
+ await state.set(MyStates.age)
46
+ await bot.send_message(
47
+ message.chat.id, "How old are you?",
48
+ reply_parameters=ReplyParameters(message_id=message.message_id),
49
+ )
50
+ await state.add_data(name=message.text)
51
+
52
+
53
+ # Handler for age input
54
+ @bot.message_handler(state=MyStates.age, is_digit=True)
55
+ async def ask_color(message: types.Message, state: StateContext):
56
+ await state.set(MyStates.color)
57
+ await state.add_data(age=message.text)
58
+
59
+ # Define reply keyboard for color selection
60
+ keyboard = types.ReplyKeyboardMarkup(row_width=2)
61
+ colors = ["Red", "Green", "Blue", "Yellow", "Purple", "Orange", "Other"]
62
+ buttons = [types.KeyboardButton(color) for color in colors]
63
+ keyboard.add(*buttons)
64
+
65
+ await bot.send_message(
66
+ message.chat.id,
67
+ "What is your favorite color? Choose from the options below.",
68
+ reply_markup=keyboard,
69
+ reply_parameters=ReplyParameters(message_id=message.message_id),
70
+ )
71
+
72
+
73
+ # Handler for color input
74
+ @bot.message_handler(state=MyStates.color)
75
+ async def ask_hobby(message: types.Message, state: StateContext):
76
+ await state.set(MyStates.hobby)
77
+ await state.add_data(color=message.text)
78
+
79
+ # Define reply keyboard for hobby selection
80
+ keyboard = types.ReplyKeyboardMarkup(row_width=2)
81
+ hobbies = ["Reading", "Traveling", "Gaming", "Cooking"]
82
+ buttons = [types.KeyboardButton(hobby) for hobby in hobbies]
83
+ keyboard.add(*buttons)
84
+
85
+ await bot.send_message(
86
+ message.chat.id,
87
+ "What is one of your hobbies? Choose from the options below.",
88
+ reply_markup=keyboard,
89
+ reply_parameters=ReplyParameters(message_id=message.message_id),
90
+ )
91
+
92
+
93
+ # Handler for hobby input; use filters to ease validation
94
+ @bot.message_handler(
95
+ state=MyStates.hobby, text=["Reading", "Traveling", "Gaming", "Cooking"]
96
+ )
97
+ async def finish(message: types.Message, state: StateContext):
98
+ async with state.data() as data:
99
+ name = data.get("name")
100
+ age = data.get("age")
101
+ color = data.get("color")
102
+ hobby = message.text # Get the hobby from the message text
103
+
104
+ # Provide a fun fact based on color
105
+ color_facts = {
106
+ "Red": "Red is often associated with excitement and passion.",
107
+ "Green": "Green is the color of nature and tranquility.",
108
+ "Blue": "Blue is known for its calming and serene effects.",
109
+ "Yellow": "Yellow is a cheerful color often associated with happiness.",
110
+ "Purple": "Purple signifies royalty and luxury.",
111
+ "Orange": "Orange is a vibrant color that stimulates enthusiasm.",
112
+ "Other": "Colors have various meanings depending on context.",
113
+ }
114
+ color_fact = color_facts.get(
115
+ color, "Colors have diverse meanings, and yours is unique!"
116
+ )
117
+
118
+ msg = (
119
+ f"Thank you for sharing! Here is a summary of your information:\n"
120
+ f"First Name: {name}\n"
121
+ f"Age: {age}\n"
122
+ f"Favorite Color: {color}\n"
123
+ f"Fun Fact about your color: {color_fact}\n"
124
+ f"Favorite Hobby: {hobby}"
125
+ )
126
+
127
+ await bot.send_message(
128
+ message.chat.id, msg, parse_mode="html",
129
+ reply_parameters=ReplyParameters(message_id=message.message_id),
130
+ )
131
+ await state.delete()
132
+
133
+
134
+ # Handler for incorrect age input
135
+ @bot.message_handler(state=MyStates.age, is_digit=False)
136
+ async def age_incorrect(message: types.Message):
137
+ await bot.send_message(
138
+ message.chat.id,
139
+ "Please enter a valid number for age.",
140
+ reply_parameters=ReplyParameters(message_id=message.message_id),
141
+ )
142
+
143
+
144
+ # Add custom filters
145
+ bot.add_custom_filter(asyncio_filters.StateFilter(bot))
146
+ bot.add_custom_filter(asyncio_filters.IsDigitFilter())
147
+ bot.add_custom_filter(asyncio_filters.TextMatchFilter())
148
+
149
+ # necessary for state parameter in handlers.
150
+ from telebot.states.asyncio.middleware import StateMiddleware
151
+
152
+ bot.setup_middleware(StateMiddleware(bot))
153
+
154
+ # Start polling
155
+ import asyncio
156
+
157
+ asyncio.run(bot.polling())
@@ -0,0 +1,33 @@
1
+ # The source of the "https://pytelegrambotminiapp.vercel.app" can be found in https://github.com/eternnoir/pyTelegramBotAPI/tree/master/examples/mini_app_web
2
+
3
+ import asyncio
4
+ from telebot.async_telebot import AsyncTeleBot
5
+ from telebot.types import (
6
+ ReplyKeyboardMarkup,
7
+ KeyboardButton,
8
+ WebAppInfo,
9
+ InlineKeyboardMarkup,
10
+ InlineKeyboardButton
11
+ )
12
+
13
+ BOT_TOKEN = ""
14
+ WEB_URL = "https://pytelegrambotminiapp.vercel.app"
15
+
16
+ bot = AsyncTeleBot(BOT_TOKEN)
17
+
18
+ @bot.message_handler(commands=["start"])
19
+ async def start(message):
20
+ reply_keyboard_markup = ReplyKeyboardMarkup(resize_keyboard=True)
21
+ reply_keyboard_markup.row(KeyboardButton("Start MiniApp", web_app=WebAppInfo(WEB_URL)))
22
+
23
+ inline_keyboard_markup = InlineKeyboardMarkup()
24
+ inline_keyboard_markup.row(InlineKeyboardButton('Start MiniApp', web_app=WebAppInfo(WEB_URL)))
25
+
26
+ await bot.reply_to(message, "Click the bottom inline button to start MiniApp", reply_markup=inline_keyboard_markup)
27
+ await bot.reply_to(message, "Click keyboard button to start MiniApp", reply_markup=reply_keyboard_markup)
28
+
29
+ @bot.message_handler(content_types=['web_app_data'])
30
+ async def web_app(message):
31
+ await bot.reply_to(message, f'Your message is "{message.web_app_data.data}"')
32
+
33
+ asyncio.run(bot.polling())
@@ -0,0 +1,156 @@
1
+ import telebot
2
+ from telebot import custom_filters, types
3
+ from telebot.states import State, StatesGroup
4
+ from telebot.states.sync.context import StateContext
5
+ from telebot.storage import StateMemoryStorage
6
+ from telebot.types import ReplyParameters
7
+
8
+ # Initialize the bot
9
+ state_storage = StateMemoryStorage() # don't use this in production; switch to redis
10
+ bot = telebot.TeleBot("TOKEN", state_storage=state_storage, use_class_middlewares=True)
11
+
12
+
13
+ # Define states
14
+ class MyStates(StatesGroup):
15
+ name = State()
16
+ age = State()
17
+ color = State()
18
+ hobby = State()
19
+
20
+
21
+ # Start command handler
22
+ @bot.message_handler(commands=["start"])
23
+ def start_ex(message: types.Message, state: StateContext):
24
+ state.set(MyStates.name)
25
+ bot.send_message(
26
+ message.chat.id,
27
+ "Hello! What is your first name?",
28
+ reply_parameters=ReplyParameters(message_id=message.message_id),
29
+ )
30
+
31
+
32
+ # Cancel command handler
33
+ @bot.message_handler(state="*", commands=["cancel"])
34
+ def any_state(message: types.Message, state: StateContext):
35
+ state.delete()
36
+ bot.send_message(
37
+ message.chat.id,
38
+ "Your information has been cleared. Type /start to begin again.",
39
+ reply_parameters=ReplyParameters(message_id=message.message_id),
40
+ )
41
+
42
+
43
+ # Handler for name input
44
+ @bot.message_handler(state=MyStates.name)
45
+ def name_get(message: types.Message, state: StateContext):
46
+ state.set(MyStates.age)
47
+ bot.send_message(
48
+ message.chat.id, "How old are you?",
49
+ reply_parameters=ReplyParameters(message_id=message.message_id),
50
+ )
51
+ state.add_data(name=message.text)
52
+
53
+
54
+ # Handler for age input
55
+ @bot.message_handler(state=MyStates.age, is_digit=True)
56
+ def ask_color(message: types.Message, state: StateContext):
57
+ state.set(MyStates.color)
58
+ state.add_data(age=message.text)
59
+
60
+ # Define reply keyboard for color selection
61
+ keyboard = types.ReplyKeyboardMarkup(row_width=2)
62
+ colors = ["Red", "Green", "Blue", "Yellow", "Purple", "Orange", "Other"]
63
+ buttons = [types.KeyboardButton(color) for color in colors]
64
+ keyboard.add(*buttons)
65
+
66
+ bot.send_message(
67
+ message.chat.id,
68
+ "What is your favorite color? Choose from the options below.",
69
+ reply_markup=keyboard,
70
+ reply_parameters=ReplyParameters(message_id=message.message_id),
71
+ )
72
+
73
+
74
+ # Handler for color input
75
+ @bot.message_handler(state=MyStates.color)
76
+ def ask_hobby(message: types.Message, state: StateContext):
77
+ state.set(MyStates.hobby)
78
+ state.add_data(color=message.text)
79
+
80
+ # Define reply keyboard for hobby selection
81
+ keyboard = types.ReplyKeyboardMarkup(row_width=2)
82
+ hobbies = ["Reading", "Traveling", "Gaming", "Cooking"]
83
+ buttons = [types.KeyboardButton(hobby) for hobby in hobbies]
84
+ keyboard.add(*buttons)
85
+
86
+ bot.send_message(
87
+ message.chat.id,
88
+ "What is one of your hobbies? Choose from the options below.",
89
+ reply_markup=keyboard,
90
+ reply_parameters=ReplyParameters(message_id=message.message_id),
91
+ )
92
+
93
+
94
+ # Handler for hobby input
95
+ @bot.message_handler(
96
+ state=MyStates.hobby, text=["Reading", "Traveling", "Gaming", "Cooking"]
97
+ )
98
+ def finish(message: types.Message, state: StateContext):
99
+ with state.data() as data:
100
+ name = data.get("name")
101
+ age = data.get("age")
102
+ color = data.get("color")
103
+ hobby = message.text # Get the hobby from the message text
104
+
105
+ # Provide a fun fact based on color
106
+ color_facts = {
107
+ "Red": "Red is often associated with excitement and passion.",
108
+ "Green": "Green is the color of nature and tranquility.",
109
+ "Blue": "Blue is known for its calming and serene effects.",
110
+ "Yellow": "Yellow is a cheerful color often associated with happiness.",
111
+ "Purple": "Purple signifies royalty and luxury.",
112
+ "Orange": "Orange is a vibrant color that stimulates enthusiasm.",
113
+ "Other": "Colors have various meanings depending on context.",
114
+ }
115
+ color_fact = color_facts.get(
116
+ color, "Colors have diverse meanings, and yours is unique!"
117
+ )
118
+
119
+ msg = (
120
+ f"Thank you for sharing! Here is a summary of your information:\n"
121
+ f"First Name: {name}\n"
122
+ f"Age: {age}\n"
123
+ f"Favorite Color: {color}\n"
124
+ f"Fun Fact about your color: {color_fact}\n"
125
+ f"Favorite Hobby: {hobby}"
126
+ )
127
+
128
+ bot.send_message(
129
+ message.chat.id, msg, parse_mode="html",
130
+ reply_parameters=ReplyParameters(message_id=message.message_id),
131
+ )
132
+ state.delete()
133
+
134
+
135
+ # Handler for incorrect age input
136
+ @bot.message_handler(state=MyStates.age, is_digit=False)
137
+ def age_incorrect(message: types.Message):
138
+ bot.send_message(
139
+ message.chat.id,
140
+ "Please enter a valid number for age.",
141
+ reply_parameters=ReplyParameters(message_id=message.message_id),
142
+ )
143
+
144
+
145
+ # Add custom filters
146
+ bot.add_custom_filter(custom_filters.StateFilter(bot))
147
+ bot.add_custom_filter(custom_filters.IsDigitFilter())
148
+ bot.add_custom_filter(custom_filters.TextMatchFilter())
149
+
150
+ # necessary for state parameter in handlers.
151
+ from telebot.states.sync.middleware import StateMiddleware
152
+
153
+ bot.setup_middleware(StateMiddleware(bot))
154
+
155
+ # Start polling
156
+ bot.infinity_polling()
@@ -0,0 +1,32 @@
1
+ # The source of the "https://pytelegrambotminiapp.vercel.app" can be found in https://github.com/eternnoir/pyTelegramBotAPI/tree/master/examples/mini_app_web
2
+
3
+ from telebot import TeleBot
4
+ from telebot.types import (
5
+ ReplyKeyboardMarkup,
6
+ KeyboardButton,
7
+ WebAppInfo,
8
+ InlineKeyboardMarkup,
9
+ InlineKeyboardButton
10
+ )
11
+
12
+ BOT_TOKEN = ""
13
+ WEB_URL = "https://pytelegrambotminiapp.vercel.app"
14
+
15
+ bot = TeleBot(BOT_TOKEN)
16
+
17
+ @bot.message_handler(commands=["start"])
18
+ def start(message):
19
+ reply_keyboard_markup = ReplyKeyboardMarkup(resize_keyboard=True)
20
+ reply_keyboard_markup.row(KeyboardButton("Start MiniApp", web_app=WebAppInfo(WEB_URL)))
21
+
22
+ inline_keyboard_markup = InlineKeyboardMarkup()
23
+ inline_keyboard_markup.row(InlineKeyboardButton('Start MiniApp', web_app=WebAppInfo(WEB_URL)))
24
+
25
+ bot.reply_to(message, "Click the bottom inline button to start MiniApp", reply_markup=inline_keyboard_markup)
26
+ bot.reply_to(message, "Click keyboard button to start MiniApp", reply_markup=reply_keyboard_markup)
27
+
28
+ @bot.message_handler(content_types=['web_app_data'])
29
+ def web_app(message):
30
+ bot.reply_to(message, f'Your message is "{message.web_app_data.data}"')
31
+
32
+ bot.infinity_polling()
@@ -0,0 +1,163 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <script src="https://telegram.org/js/telegram-web-app.js"></script>
7
+ <title>PyTelegramBotApi MiniApp</title>
8
+ <link href="style.css" rel="stylesheet">
9
+ </head>
10
+ <body class='body'>
11
+ <div class='content-block content-block_send-message send-message'>
12
+ <input class="send-message__input" type="text" placeholder="type your message here">
13
+ <button class="send-message__button" id="send-message-button"> send the message </button>
14
+ </div>
15
+
16
+ <p class="header-text"> client buttons </p>
17
+ <div class="content-block content-block_client-btn client">
18
+ <button class="default-button default-button_disable" id='back-button' value="disable"> back </button>
19
+ <button class="default-button" id='main-button' value="enable"> main </button>
20
+ <button class="default-button default-button_disable" id='settings-button' value="disable"> settings </button>
21
+ </div>
22
+ <p class="header-text"> hapticFeedback (notification) </p>
23
+ <div class="content-block content-block_haptic-feedback haptic_feedback">
24
+ <button class="default-button" id='success-button'> success </button>
25
+ <button class="default-button default-button_yellow" id='warning-button'> warning </button>
26
+ <button class="default-button default-button_red" id='error-button'> error </button>
27
+ </div>
28
+
29
+ <p class="header-text"> tweak color [Bot API 6.1+]</p>
30
+ <div class="content-block content-block_tweak-color tweak-color">
31
+ <div class="tweak-color__header">
32
+ <p class="tweak-color__text">Header color: </p>
33
+ <div class="tweak-color__circle-block">
34
+ <div class="tweak-color__circle tweak-color__circle_yellow" id="header-yellow"> </div>
35
+ <div class="tweak-color__circle tweak-color__circle_button" id="header-button_color"> </div>
36
+ <div class="tweak-color__circle tweak-color__circle_red" id="header-red"> </div>
37
+ <div class="tweak-color__circle tweak-color__circle_header" id="header-default"> </div>
38
+ </div>
39
+ </div>
40
+ <div class="tweak-color__background">
41
+ <p class="tweak-color__text">Background color: </p>
42
+ <div class="tweak-color__circle-block">
43
+ <div class="tweak-color__circle tweak-color__circle_yellow" id="background-yellow"> </div>
44
+ <div class="tweak-color__circle tweak-color__circle_button" id="background-button_color"> </div>
45
+ <div class="tweak-color__circle tweak-color__circle_red" id="background-red"> </div>
46
+ <div class="tweak-color__circle tweak-color__circle_background" id="background-default"> </div>
47
+ </div>
48
+ </div>
49
+ </div>
50
+
51
+ <p class="header-text"> popup and alert [Bot API 6.2+] </p>
52
+ <div class="content-block content-block_popup-alert popup-alert">
53
+ <button class="default-button" id="popup-button"> popup </button>
54
+ <button class="default-button" id="alert-button"> alert </button>
55
+ <button class="default-button" id="confirm-button"> confirm </button>
56
+ </div>
57
+
58
+ <p class="header-text"> request [Bot API 6.9+]</p>
59
+ <div class="content-block content-block_request block_request">
60
+ <button class="default-button" id="contact-button"> contact </button>
61
+ <button class="default-button" id="write-access-button"> write access </button>
62
+ <button class="default-button" id="biometrics-button"> biometrics </button>
63
+ </div>
64
+
65
+ <p class="header-text"> story [Bot API 7.8+]</p>
66
+ <div class="content-block content-block_story story">
67
+ <button class="default-button" id="post-story-photo-button"> story (photo) </button>
68
+ <button class="default-button" id="post-story-video-button"> story (video) </button>
69
+ <button class="default-button" id="post-story-with-link-button"> story + link</button>
70
+ </div>
71
+
72
+ <p class="header-text"> cloud storage [Bot API 6.9+] </p>
73
+ <div class="content-block content-block_cloud-storage cloud-storage">
74
+ <div class="cloud-storage__input-block">
75
+ <input class="cloud-storage__input cloud-storage__input_add-key" type="text" name="" value="" placeholder="key">
76
+ <input class="cloud-storage__input cloud-storage__input_add-value" type="text" name="" value="" placeholder="value">
77
+ </div>
78
+ <button class="cloud-storage__button cloud-storage__button_add" id="cloud-add-button"> add to cloud storage </button>
79
+ <table class="cloud-storage__table" id="cloud-storage-table">
80
+ <tr>
81
+ <th id="cloud-storage-key"> key </th>
82
+ <th id="cloud-storage-value"> value </th>
83
+ </tr>
84
+ <tr id="null-storage-row">
85
+ <td> - </td>
86
+ <td> - </td>
87
+ </tr>
88
+ </table>
89
+ <div class="cloud-storage__input-block cloud-storage__input-block_remove">
90
+ <input class="cloud-storage__input cloud-storage__input_remove" type="text" value="" placeholder="key">
91
+ <button class="cloud-storage__button cloud-storage__button_remove" id='cloud-remove-button'> remove from cloud storage </button>
92
+ </div>
93
+ </div>
94
+ <p class="header-text"> data from telegram </p>
95
+ <div class="content-block content-block_data">
96
+ <div class="data__content" id="initDataUnsafe-block">
97
+ <p class="content-block__text"> initDataUnsafe </p>
98
+ </div>
99
+ <div class="data__content" id="themeParams-block">
100
+ <p class="content-block__text"> ThemeParams </p>
101
+ </div>
102
+ <div class="data__content" id="biometrics-block">
103
+ <p class="content-block__text"> Biometrics Manager</p>
104
+ <table class="biometrics__table" id="biometrics-table">
105
+ <tr id="null-biometrics-row">
106
+ <td>support</td>
107
+ <td>Unsupported in this platform</td>
108
+ </tr>
109
+ </table>
110
+ </div>
111
+ </div>
112
+
113
+ <p class="header-text"> event from telegram </p>
114
+ <div class="content-block content-block_event event">
115
+ <div class="event__content" id="event-block">
116
+ </div>
117
+ </div>
118
+
119
+ <p class="header-text"> vertical scroll behaviour [Bot API 7.7+] </p>
120
+ <div class="content-block content-block_scroll-behaviour scroll-behaviour">
121
+ <p class="content-block__text"> close the miniapp when scroll vertically </p>
122
+ <div class="scroll-behaviour__toggle-box">
123
+ <button class="default-button" id="enable-scroll-button" value="enable"> Enable </button>
124
+ <button class="default-button default-button_disable" id="disable-scroll-button" value="disable"> Disable </button>
125
+ </div>
126
+ </div>
127
+
128
+ <p class="header-text"> closing confirmation [Bot API 6.2+]</p>
129
+ <div class="content-block content-block_close-confirmation close-confirmation">
130
+ <p class="content-block__text"> Confimation dialog when closing miniapp </p>
131
+ <div class="content-block__toggle-box">
132
+ <button class="default-button default-button_disable" id="enable-close-confirm-button" value="disable"> Enable </button>
133
+ <button class="default-button" id="disable-close-confirm-button" value="enable"> Disable </button>
134
+ </div>
135
+ </div>
136
+
137
+ <p class="header-text"> links </p>
138
+ <div class="content-block content-block_link link">
139
+ <ul class="link__list">
140
+ <li>
141
+ <p class="link__text"> <a class="link__text link__text_blue" id="telegram-link" href="javascript:telegram.openTelegramLink(https://t.me/joinchat/Bn4ixj84FIZVkwhk2jag6A)"> pyTelegramBotApi </a> - opens telegram link in telegram </p>
142
+ </li>
143
+ <li>
144
+ <p class="link__text"> <a class="link__text link__text_blue" id="internal-link" href="javascript:telegram.openLink(https://telegram.org)"> Telegram </a> - opens link inside telegram in browser. </p>
145
+ </li>
146
+ </ul>
147
+ </div>
148
+
149
+ <p class="header-text"> other </p>
150
+ <div class="content-block content-block_other other">
151
+ <button class="default-button" id="show-QR-button"> show QR </button>
152
+ <button class="default-button" id="expand-button"> expand </button>
153
+ <button class="default-button default-button_red" id="close-button"> close </button>
154
+ </div>
155
+
156
+ <div class="description-block">
157
+ <pre class="description__text" id="version-text"> version: </pre>
158
+ <pre class="description__text" id="platform-text"> platform: </pre>
159
+ <pre class="description__text" id="color-scheme-text"> color scheme: </pre>
160
+ </div>
161
+ </body>
162
+ <script src="script.js"></script>
163
+ </html>