pyTelegramBotAPI 4.30.0__tar.gz → 4.32.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 (214) hide show
  1. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/PKG-INFO +3 -3
  2. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/README.md +2 -2
  3. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/conf.py +1 -1
  4. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/chat_member_example.py +46 -34
  5. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/custom_states.py +157 -157
  6. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/formatting_example.py +71 -54
  7. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/mini_app.py +33 -33
  8. pytelegrambotapi-4.32.0/examples/asynchronous_telebot/send_message_draft_example.py +22 -0
  9. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/chat_member_example.py +45 -33
  10. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/custom_states.py +156 -156
  11. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/formatting_example.py +70 -53
  12. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/mini_app.py +32 -32
  13. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/mini_app_web/index.html +163 -163
  14. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/mini_app_web/script.js +318 -318
  15. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/mini_app_web/style.css +338 -338
  16. pytelegrambotapi-4.32.0/examples/send_message_draft_example.py +22 -0
  17. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/serverless/flask_google_cloud_bot/requirements.txt +2 -2
  18. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/stars_payment.py +64 -64
  19. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/pyproject.toml +46 -46
  20. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/requirements.txt +4 -4
  21. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/__init__.py +82 -5
  22. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/apihelper.py +32 -1
  23. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/async_telebot.py +79 -5
  24. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/asyncio_filters.py +450 -450
  25. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/asyncio_handler_backends.py +98 -98
  26. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/asyncio_helper.py +35 -2
  27. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/asyncio_storage/__init__.py +13 -13
  28. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/asyncio_storage/base_storage.py +147 -147
  29. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/asyncio_storage/memory_storage.py +225 -225
  30. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/asyncio_storage/pickle_storage.py +274 -274
  31. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/asyncio_storage/redis_storage.py +339 -339
  32. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/custom_filters.py +455 -455
  33. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/formatting.py +497 -479
  34. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/handler_backends.py +257 -257
  35. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/states/__init__.py +128 -128
  36. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/states/asyncio/__init__.py +7 -7
  37. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/states/asyncio/context.py +153 -153
  38. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/states/asyncio/middleware.py +21 -21
  39. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/states/sync/__init__.py +6 -6
  40. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/states/sync/context.py +142 -142
  41. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/states/sync/middleware.py +21 -21
  42. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/storage/__init__.py +13 -13
  43. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/storage/base_storage.py +142 -142
  44. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/storage/memory_storage.py +225 -225
  45. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/storage/pickle_storage.py +263 -263
  46. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/storage/redis_storage.py +324 -324
  47. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/types.py +270 -30
  48. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/util.py +724 -724
  49. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/version.py +1 -1
  50. pytelegrambotapi-4.32.0/tests/test_apihelper_95.py +45 -0
  51. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/tests/test_handler_backends.py +285 -285
  52. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/tests/test_telebot.py +726 -726
  53. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/tests/test_types.py +377 -311
  54. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/.github/ISSUE_TEMPLATE +0 -0
  55. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  56. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/.github/workflows/setup_python.yml +0 -0
  57. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/.gitignore +0 -0
  58. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/.readthedocs.yml +0 -0
  59. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/.travis.yml +0 -0
  60. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/LICENSE +0 -0
  61. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/doc_req.txt +0 -0
  62. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/Makefile +0 -0
  63. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/_static/logo.png +0 -0
  64. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/_static/logo2.png +0 -0
  65. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/async_version/index.rst +0 -0
  66. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/calldata.rst +0 -0
  67. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/formatting.rst +0 -0
  68. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/index.rst +0 -0
  69. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/install.rst +0 -0
  70. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/en/LC_MESSAGES/async_version.po +0 -0
  71. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/en/LC_MESSAGES/calldata.po +0 -0
  72. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/en/LC_MESSAGES/formatting.po +0 -0
  73. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/en/LC_MESSAGES/index.po +0 -0
  74. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/en/LC_MESSAGES/install.po +0 -0
  75. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/en/LC_MESSAGES/quick_start.po +0 -0
  76. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/en/LC_MESSAGES/sync_version.po +0 -0
  77. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/en/LC_MESSAGES/types.po +0 -0
  78. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/en/LC_MESSAGES/util.po +0 -0
  79. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/ru/LC_MESSAGES/async_version.po +0 -0
  80. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/ru/LC_MESSAGES/calldata.po +0 -0
  81. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/ru/LC_MESSAGES/formatting.po +0 -0
  82. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/ru/LC_MESSAGES/index.po +0 -0
  83. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/ru/LC_MESSAGES/install.po +0 -0
  84. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/ru/LC_MESSAGES/quick_start.po +0 -0
  85. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/ru/LC_MESSAGES/sync_version.po +0 -0
  86. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/ru/LC_MESSAGES/types.po +0 -0
  87. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/locales/ru/LC_MESSAGES/util.po +0 -0
  88. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/quick_start.rst +0 -0
  89. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/sync_version/index.rst +0 -0
  90. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/types.rst +0 -0
  91. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/docs/source/util.rst +0 -0
  92. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/anonymous_bot.py +0 -0
  93. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/callback_data_examples/advanced_calendar_example/filters.py +0 -0
  94. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/callback_data_examples/advanced_calendar_example/keyboards.py +0 -0
  95. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/callback_data_examples/advanced_calendar_example/main.py +0 -0
  96. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/callback_data_examples/simple_products_example.py +0 -0
  97. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/chat_join_request.py +0 -0
  98. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/continue_handling.py +0 -0
  99. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/custom_filters/admin_filter_example.py +0 -0
  100. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/custom_filters/advanced_text_filter.py +0 -0
  101. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/custom_filters/general_custom_filters.py +0 -0
  102. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/custom_filters/id_filter_example.py +0 -0
  103. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/custom_filters/is_filter_example.py +0 -0
  104. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/custom_filters/text_filter_example.py +0 -0
  105. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/detect_changes.py +0 -0
  106. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/download_file_example.py +0 -0
  107. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/echo_bot.py +0 -0
  108. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/exception_handler.py +0 -0
  109. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/message_reaction_example.py +0 -0
  110. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/middleware/flooding_middleware.py +0 -0
  111. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/middleware/i18n.py +0 -0
  112. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/middleware/i18n_middleware_example/i18n_base_midddleware.py +0 -0
  113. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/middleware/i18n_middleware_example/keyboards.py +0 -0
  114. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/middleware/i18n_middleware_example/locales/en/LC_MESSAGES/messages.po +0 -0
  115. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/middleware/i18n_middleware_example/locales/ru/LC_MESSAGES/messages.po +0 -0
  116. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/middleware/i18n_middleware_example/locales/uz_Latn/LC_MESSAGES/messages.po +0 -0
  117. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/middleware/i18n_middleware_example/main.py +0 -0
  118. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/multibot/README.MD +0 -0
  119. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/multibot/config.py +0 -0
  120. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/multibot/handlers.py +0 -0
  121. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/multibot/main.py +0 -0
  122. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/multibot/nginx_conf.conf +0 -0
  123. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/register_handler.py +0 -0
  124. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/send_file_example.py +0 -0
  125. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/set_command_example.py +0 -0
  126. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/skip_updates_example.py +0 -0
  127. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/timer_bot_async.py +0 -0
  128. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/update_listener.py +0 -0
  129. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/webhooks/async_webhook_aiohttp_echo_bot.py +0 -0
  130. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/webhooks/run_webhooks.py +0 -0
  131. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/asynchronous_telebot/webhooks/webhook_starlette_echo_bot.py +0 -0
  132. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/callback_data_examples/advanced_calendar_example/filters.py +0 -0
  133. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/callback_data_examples/advanced_calendar_example/keyboards.py +0 -0
  134. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/callback_data_examples/advanced_calendar_example/main.py +0 -0
  135. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/callback_data_examples/simple_products_example.py +0 -0
  136. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/chat_join_request.py +0 -0
  137. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/continue_handling.py +0 -0
  138. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/create_invite_link.py +0 -0
  139. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/custom_filters/admin_filter_example.py +0 -0
  140. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/custom_filters/advanced_text_filter.py +0 -0
  141. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/custom_filters/general_custom_filters.py +0 -0
  142. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/custom_filters/id_filter_example.py +0 -0
  143. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/custom_filters/is_filter_example.py +0 -0
  144. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/custom_filters/text_filter_example.py +0 -0
  145. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/deep_linking.py +0 -0
  146. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/detailed_example/detailed_example.py +0 -0
  147. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/detailed_example/kitten.jpg +0 -0
  148. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/detailed_example/rooster.jpg +0 -0
  149. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/detect_changes.py +0 -0
  150. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/download_file_example.py +0 -0
  151. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/echo_bot.py +0 -0
  152. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/inline_example.py +0 -0
  153. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/inline_keyboard_example.py +0 -0
  154. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/message_reaction_example.py +0 -0
  155. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/README.md +0 -0
  156. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/class_based/antiflood_middleware.py +0 -0
  157. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/class_based/basic_example.py +0 -0
  158. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/class_based/i18n_middleware/i18n_base_middleware.py +0 -0
  159. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/class_based/i18n_middleware/keyboards.py +0 -0
  160. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/class_based/i18n_middleware/locales/en/LC_MESSAGES/messages.po +0 -0
  161. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/class_based/i18n_middleware/locales/ru/LC_MESSAGES/messages.po +0 -0
  162. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/class_based/i18n_middleware/locales/uz_Latn/LC_MESSAGES/messages.po +0 -0
  163. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/class_based/i18n_middleware/main.py +0 -0
  164. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/function_based/i18n.py +0 -0
  165. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/function_based/i18n_gettext/i18n_class.py +0 -0
  166. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/function_based/i18n_gettext/keyboards.py +0 -0
  167. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/function_based/i18n_gettext/locales/en/LC_MESSAGES/messages.po +0 -0
  168. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/function_based/i18n_gettext/locales/ru/LC_MESSAGES/messages.po +0 -0
  169. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/function_based/i18n_gettext/locales/uz_Latn/LC_MESSAGES/messages.po +0 -0
  170. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/function_based/i18n_gettext/main.py +0 -0
  171. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/middleware/function_based/session.py +0 -0
  172. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/multibot/README.MD +0 -0
  173. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/multibot/config.py +0 -0
  174. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/multibot/handlers.py +0 -0
  175. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/multibot/main.py +0 -0
  176. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/multibot/nginx_conf.conf +0 -0
  177. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/payments_example.py +0 -0
  178. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/poll_example.py +0 -0
  179. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/register_handler.py +0 -0
  180. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/reply_keyboard_markup_example.py +0 -0
  181. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/serverless/aws_lambda_function.py +0 -0
  182. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/serverless/azure_functions +0 -0
  183. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/serverless/flask_google_cloud_bot/.gcloudignore +0 -0
  184. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/serverless/flask_google_cloud_bot/app.yaml +0 -0
  185. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/serverless/flask_google_cloud_bot/main.py +0 -0
  186. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/set_command_example.py +0 -0
  187. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/skip_updates_example.py +0 -0
  188. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/step_example.py +0 -0
  189. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/telebot_bot/telebot_bot.py +0 -0
  190. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/timer_bot.py +0 -0
  191. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/webhook_examples/README.md +0 -0
  192. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/webhook_examples/run_webhooks.py +0 -0
  193. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/webhook_examples/webhook_aiohttp_echo_bot.py +0 -0
  194. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/webhook_examples/webhook_cherrypy_echo_bot.py +0 -0
  195. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/webhook_examples/webhook_cpython_echo_bot.py +0 -0
  196. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/webhook_examples/webhook_fastapi_echo_bot.py +0 -0
  197. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/webhook_examples/webhook_flask_echo_bot.py +0 -0
  198. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/webhook_examples/webhook_flask_heroku_echo.py +0 -0
  199. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/webhook_examples/webhook_tornado_echo_bot.py +0 -0
  200. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/examples/webhook_examples/webhook_twisted_echo_bot.py +0 -0
  201. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/callback_data.py +0 -0
  202. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/ext/__init__.py +0 -0
  203. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/ext/aio/__init__.py +0 -0
  204. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/ext/aio/webhooks.py +0 -0
  205. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/ext/reloader.py +0 -0
  206. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/ext/sync/__init__.py +0 -0
  207. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/ext/sync/webhooks.py +0 -0
  208. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/py.typed +0 -0
  209. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/telebot/service_utils.py +0 -0
  210. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/tests/__init__.py +0 -0
  211. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/tests/test_data/record.mp3 +0 -0
  212. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/tests/test_data/record.ogg +0 -0
  213. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/tests/test_data/record.wav +0 -0
  214. {pytelegrambotapi-4.30.0 → pytelegrambotapi-4.32.0}/tests/test_data/test_video.mp4 +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyTelegramBotAPI
3
- Version: 4.30.0
3
+ Version: 4.32.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
@@ -51,7 +51,7 @@ Description-Content-Type: text/markdown
51
51
  <p align="center">A simple, but extensible Python implementation for the <a href="https://core.telegram.org/bots/api">Telegram Bot API</a>.</p>
52
52
  <p align="center">Both synchronous and asynchronous.</p>
53
53
 
54
- ## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#august-15-2025"><img src="https://img.shields.io/badge/Bot%20API-9.2-blue?logo=telegram" alt="Supported Bot API version"></a>
54
+ ## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#march-1-2026"><img src="https://img.shields.io/badge/Bot%20API-9.5-blue?logo=telegram" alt="Supported Bot API version"></a>
55
55
 
56
56
  <h2><a href='https://pytba.readthedocs.io/en/latest/index.html'>Official documentation</a></h2>
57
57
  <h2><a href='https://pytba.readthedocs.io/ru/latest/index.html'>Official ru documentation</a></h2>
@@ -843,7 +843,7 @@ Bot instances that were idle for a long time might be rejected by the server whe
843
843
 
844
844
  Get help. Discuss. Chat.
845
845
 
846
- * Join the [pyTelegramBotAPI Telegram Chat Group](https://telegram.me/joinchat/Bn4ixj84FIZVkwhk2jag6A)
846
+ * Join the [pyTelegramBotAPI Telegram Chat Group](https://t.me/+GNAFesxfJ-o5OTRl)
847
847
 
848
848
  ## Telegram Channel
849
849
 
@@ -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#august-15-2025"><img src="https://img.shields.io/badge/Bot%20API-9.2-blue?logo=telegram" alt="Supported Bot API version"></a>
13
+ ## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#march-1-2026"><img src="https://img.shields.io/badge/Bot%20API-9.5-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>
@@ -802,7 +802,7 @@ Bot instances that were idle for a long time might be rejected by the server whe
802
802
 
803
803
  Get help. Discuss. Chat.
804
804
 
805
- * Join the [pyTelegramBotAPI Telegram Chat Group](https://telegram.me/joinchat/Bn4ixj84FIZVkwhk2jag6A)
805
+ * Join the [pyTelegramBotAPI Telegram Chat Group](https://t.me/+GNAFesxfJ-o5OTRl)
806
806
 
807
807
  ## Telegram Channel
808
808
 
@@ -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.30.0'
25
+ release = '4.32.0'
26
26
 
27
27
 
28
28
  # -- General configuration ---------------------------------------------------
@@ -1,34 +1,46 @@
1
- from telebot import types,util
2
- from telebot.async_telebot import AsyncTeleBot
3
-
4
- bot = AsyncTeleBot('TOKEN')
5
-
6
- #chat_member_handler. When status changes, telegram gives update. check status from old_chat_member and new_chat_member.
7
- @bot.chat_member_handler()
8
- async def chat_m(message: types.ChatMemberUpdated):
9
- old = message.old_chat_member
10
- new = message.new_chat_member
11
- if new.status == "member":
12
- await bot.send_message(message.chat.id,"Hello {name}!".format(name=new.user.first_name)) # Welcome message
13
-
14
- #if bot is added to group, this handler will work
15
- @bot.my_chat_member_handler()
16
- async def my_chat_m(message: types.ChatMemberUpdated):
17
- old = message.old_chat_member
18
- new = message.new_chat_member
19
- if new.status == "member":
20
- await bot.send_message(message.chat.id,"Somebody added me to group") # Welcome message, if bot was added to group
21
- await bot.leave_chat(message.chat.id)
22
-
23
- #content_Type_service is:
24
- #'new_chat_members', 'left_chat_member', 'new_chat_title', 'new_chat_photo', 'delete_chat_photo', 'group_chat_created',
25
- #'supergroup_chat_created', 'channel_chat_created', 'migrate_to_chat_id', 'migrate_from_chat_id', 'pinned_message',
26
- #'proximity_alert_triggered', 'video_chat_scheduled', 'video_chat_started', 'video_chat_ended',
27
- #'video_chat_participants_invited', 'message_auto_delete_timer_changed'
28
- # this handler deletes service messages
29
-
30
- @bot.message_handler(content_types=util.content_type_service)
31
- async def delall(message: types.Message):
32
- await bot.delete_message(message.chat.id,message.message_id)
33
- import asyncio
34
- asyncio.run(bot.polling(allowed_updates=util.update_types))
1
+ from telebot import types,util
2
+ from telebot.async_telebot import AsyncTeleBot
3
+
4
+ bot = AsyncTeleBot('TOKEN')
5
+
6
+ #chat_member_handler. When status changes, telegram gives update. check status from old_chat_member and new_chat_member.
7
+ @bot.chat_member_handler()
8
+ async def chat_m(message: types.ChatMemberUpdated):
9
+ old = message.old_chat_member
10
+ new = message.new_chat_member
11
+ if new.status == "member":
12
+ await bot.send_message(message.chat.id,"Hello {name}!".format(name=new.user.first_name)) # Welcome message
13
+
14
+ #if bot is added to group, this handler will work
15
+ @bot.my_chat_member_handler()
16
+ async def my_chat_m(message: types.ChatMemberUpdated):
17
+ old = message.old_chat_member
18
+ new = message.new_chat_member
19
+ if new.status == "member":
20
+ await bot.send_message(message.chat.id,"Somebody added me to group") # Welcome message, if bot was added to group
21
+ await bot.leave_chat(message.chat.id)
22
+
23
+ #content_Type_service is:
24
+ #'new_chat_members', 'left_chat_member', 'new_chat_title', 'new_chat_photo', 'delete_chat_photo', 'group_chat_created',
25
+ #'supergroup_chat_created', 'channel_chat_created', 'migrate_to_chat_id', 'migrate_from_chat_id', 'pinned_message',
26
+ #'proximity_alert_triggered', 'video_chat_scheduled', 'video_chat_started', 'video_chat_ended',
27
+ #'video_chat_participants_invited', 'message_auto_delete_timer_changed'
28
+ # this handler deletes service messages
29
+
30
+ @bot.message_handler(content_types=util.content_type_service)
31
+ async def delall(message: types.Message):
32
+ await bot.delete_message(message.chat.id,message.message_id)
33
+
34
+
35
+ @bot.message_handler(commands=['set_tag'])
36
+ async def set_tag(message: types.Message):
37
+ tag = util.extract_arguments(message.text)
38
+ if not tag:
39
+ await bot.reply_to(message, "Usage: /set_tag your_tag")
40
+ return
41
+ await bot.set_chat_member_tag(message.chat.id, message.from_user.id, tag=tag)
42
+ await bot.reply_to(message, f"Tag updated: {tag}")
43
+
44
+
45
+ import asyncio
46
+ asyncio.run(bot.polling(allowed_updates=util.update_types))
@@ -1,157 +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())
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())
@@ -1,54 +1,71 @@
1
- from telebot.async_telebot import AsyncTeleBot
2
- from telebot import formatting
3
-
4
- bot = AsyncTeleBot('token')
5
-
6
-
7
- @bot.message_handler(commands=['start'])
8
- async def start_message(message):
9
- await bot.send_message(
10
- message.chat.id,
11
- # function which connects all strings
12
- formatting.format_text(
13
- formatting.mbold(message.from_user.first_name),
14
- formatting.mitalic(message.from_user.first_name),
15
- formatting.munderline(message.from_user.first_name),
16
- formatting.mstrikethrough(message.from_user.first_name),
17
- formatting.mcode(message.from_user.first_name),
18
- separator=" " # separator separates all strings
19
- ),
20
- parse_mode='MarkdownV2'
21
- )
22
-
23
- # just a bold text using markdownv2
24
- await bot.send_message(
25
- message.chat.id,
26
- formatting.mbold(message.from_user.first_name),
27
- parse_mode='MarkdownV2'
28
- )
29
-
30
- # html
31
- await bot.send_message(
32
- message.chat.id,
33
- formatting.format_text(
34
- formatting.hbold(message.from_user.first_name),
35
- formatting.hitalic(message.from_user.first_name),
36
- formatting.hunderline(message.from_user.first_name),
37
- formatting.hstrikethrough(message.from_user.first_name),
38
- formatting.hcode(message.from_user.first_name),
39
- # hide_link is only for html
40
- formatting.hide_link('https://telegra.ph/file/c158e3a6e2a26a160b253.jpg'),
41
- separator=" "
42
- ),
43
- parse_mode='HTML'
44
- )
45
-
46
- # just a bold text in html
47
- await bot.send_message(
48
- message.chat.id,
49
- formatting.hbold(message.from_user.first_name),
50
- parse_mode='HTML'
51
- )
52
-
53
- import asyncio
54
- asyncio.run(bot.polling())
1
+ from telebot.async_telebot import AsyncTeleBot
2
+ from telebot import formatting, types
3
+
4
+ bot = AsyncTeleBot('token')
5
+
6
+
7
+ @bot.message_handler(commands=['start'])
8
+ async def start_message(message):
9
+ await bot.send_message(
10
+ message.chat.id,
11
+ # function which connects all strings
12
+ formatting.format_text(
13
+ formatting.mbold(message.from_user.first_name),
14
+ formatting.mitalic(message.from_user.first_name),
15
+ formatting.munderline(message.from_user.first_name),
16
+ formatting.mstrikethrough(message.from_user.first_name),
17
+ formatting.mcode(message.from_user.first_name),
18
+ separator=" " # separator separates all strings
19
+ ),
20
+ parse_mode='MarkdownV2'
21
+ )
22
+
23
+ # just a bold text using markdownv2
24
+ await bot.send_message(
25
+ message.chat.id,
26
+ formatting.mbold(message.from_user.first_name),
27
+ parse_mode='MarkdownV2'
28
+ )
29
+
30
+ # html
31
+ await bot.send_message(
32
+ message.chat.id,
33
+ formatting.format_text(
34
+ formatting.hbold(message.from_user.first_name),
35
+ formatting.hitalic(message.from_user.first_name),
36
+ formatting.hunderline(message.from_user.first_name),
37
+ formatting.hstrikethrough(message.from_user.first_name),
38
+ formatting.hcode(message.from_user.first_name),
39
+ # hide_link is only for html
40
+ formatting.hide_link('https://telegra.ph/file/c158e3a6e2a26a160b253.jpg'),
41
+ separator=" "
42
+ ),
43
+ parse_mode='HTML'
44
+ )
45
+
46
+ # just a bold text in html
47
+ await bot.send_message(
48
+ message.chat.id,
49
+ formatting.hbold(message.from_user.first_name),
50
+ parse_mode='HTML'
51
+ )
52
+
53
+ # Bot API 9.5: date_time entity example
54
+ date_text = "2026-03-01 12:00:00"
55
+ text = f"Local time: {date_text}"
56
+ await bot.send_message(
57
+ message.chat.id,
58
+ text,
59
+ entities=[
60
+ types.MessageEntity(
61
+ type='date_time',
62
+ offset=len("Local time: "),
63
+ length=len(date_text),
64
+ unix_time=1772366400,
65
+ date_time_format='short'
66
+ )
67
+ ]
68
+ )
69
+
70
+ import asyncio
71
+ asyncio.run(bot.polling())
@@ -1,33 +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())
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())