litegram 1.0.0__py3-none-any.whl

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 (636) hide show
  1. litegram/__init__.py +32 -0
  2. litegram/__main__.py +6 -0
  3. litegram/__meta__.py +2 -0
  4. litegram/cli/__init__.py +3 -0
  5. litegram/cli/main.py +132 -0
  6. litegram/client/__init__.py +0 -0
  7. litegram/client/bot.py +5828 -0
  8. litegram/client/context_controller.py +34 -0
  9. litegram/client/default.py +80 -0
  10. litegram/client/session/__init__.py +0 -0
  11. litegram/client/session/base.py +268 -0
  12. litegram/client/session/httpx.py +107 -0
  13. litegram/client/session/middlewares/__init__.py +0 -0
  14. litegram/client/session/middlewares/base.py +54 -0
  15. litegram/client/session/middlewares/manager.py +62 -0
  16. litegram/client/session/middlewares/request_logging.py +40 -0
  17. litegram/client/telegram.py +108 -0
  18. litegram/dispatcher/__init__.py +0 -0
  19. litegram/dispatcher/dispatcher.py +683 -0
  20. litegram/dispatcher/event/__init__.py +0 -0
  21. litegram/dispatcher/event/bases.py +36 -0
  22. litegram/dispatcher/event/event.py +56 -0
  23. litegram/dispatcher/event/handler.py +113 -0
  24. litegram/dispatcher/event/telegram.py +147 -0
  25. litegram/dispatcher/flags.py +133 -0
  26. litegram/dispatcher/middlewares/__init__.py +0 -0
  27. litegram/dispatcher/middlewares/base.py +31 -0
  28. litegram/dispatcher/middlewares/data.py +95 -0
  29. litegram/dispatcher/middlewares/error.py +39 -0
  30. litegram/dispatcher/middlewares/manager.py +68 -0
  31. litegram/dispatcher/middlewares/user_context.py +178 -0
  32. litegram/dispatcher/router.py +295 -0
  33. litegram/enums/__init__.py +71 -0
  34. litegram/enums/bot_command_scope_type.py +19 -0
  35. litegram/enums/chat_action.py +34 -0
  36. litegram/enums/chat_boost_source_type.py +15 -0
  37. litegram/enums/chat_member_status.py +18 -0
  38. litegram/enums/chat_type.py +17 -0
  39. litegram/enums/content_type.py +81 -0
  40. litegram/enums/currency.py +98 -0
  41. litegram/enums/dice_emoji.py +18 -0
  42. litegram/enums/encrypted_passport_element.py +25 -0
  43. litegram/enums/inline_query_result_type.py +25 -0
  44. litegram/enums/input_media_type.py +17 -0
  45. litegram/enums/input_paid_media_type.py +14 -0
  46. litegram/enums/input_profile_photo_type.py +14 -0
  47. litegram/enums/input_story_content_type.py +14 -0
  48. litegram/enums/keyboard_button_poll_type_type.py +14 -0
  49. litegram/enums/mask_position_point.py +16 -0
  50. litegram/enums/menu_button_type.py +15 -0
  51. litegram/enums/message_entity_type.py +31 -0
  52. litegram/enums/message_origin_type.py +16 -0
  53. litegram/enums/owned_gift_type.py +14 -0
  54. litegram/enums/paid_media_type.py +15 -0
  55. litegram/enums/parse_mode.py +15 -0
  56. litegram/enums/passport_element_error_type.py +21 -0
  57. litegram/enums/poll_type.py +14 -0
  58. litegram/enums/reaction_type_type.py +15 -0
  59. litegram/enums/revenue_withdrawal_state_type.py +15 -0
  60. litegram/enums/sticker_format.py +15 -0
  61. litegram/enums/sticker_type.py +15 -0
  62. litegram/enums/story_area_type_type.py +17 -0
  63. litegram/enums/topic_icon_color.py +18 -0
  64. litegram/enums/transaction_partner_type.py +19 -0
  65. litegram/enums/transaction_partner_user_transaction_type_enum.py +17 -0
  66. litegram/enums/update_type.py +35 -0
  67. litegram/exceptions.py +209 -0
  68. litegram/filters/__init__.py +51 -0
  69. litegram/filters/base.py +57 -0
  70. litegram/filters/callback_data.py +185 -0
  71. litegram/filters/chat_member_updated.py +195 -0
  72. litegram/filters/command.py +292 -0
  73. litegram/filters/exception.py +61 -0
  74. litegram/filters/logic.py +79 -0
  75. litegram/filters/magic_data.py +30 -0
  76. litegram/filters/state.py +55 -0
  77. litegram/fsm/__init__.py +0 -0
  78. litegram/fsm/context.py +48 -0
  79. litegram/fsm/middleware.py +119 -0
  80. litegram/fsm/scene.py +958 -0
  81. litegram/fsm/state.py +179 -0
  82. litegram/fsm/storage/__init__.py +0 -0
  83. litegram/fsm/storage/base.py +212 -0
  84. litegram/fsm/storage/memory.py +99 -0
  85. litegram/fsm/storage/mongo.py +151 -0
  86. litegram/fsm/storage/pymongo.py +145 -0
  87. litegram/fsm/storage/redis.py +182 -0
  88. litegram/fsm/strategy.py +38 -0
  89. litegram/handlers/__init__.py +25 -0
  90. litegram/handlers/base.py +44 -0
  91. litegram/handlers/callback_query.py +44 -0
  92. litegram/handlers/chat_member.py +16 -0
  93. litegram/handlers/chosen_inline_result.py +20 -0
  94. litegram/handlers/error.py +19 -0
  95. litegram/handlers/inline_query.py +20 -0
  96. litegram/handlers/message.py +32 -0
  97. litegram/handlers/poll.py +20 -0
  98. litegram/handlers/pre_checkout_query.py +16 -0
  99. litegram/handlers/shipping_query.py +16 -0
  100. litegram/loggers.py +9 -0
  101. litegram/methods/__init__.py +353 -0
  102. litegram/methods/add_sticker_to_set.py +44 -0
  103. litegram/methods/answer_callback_query.py +56 -0
  104. litegram/methods/answer_inline_query.py +79 -0
  105. litegram/methods/answer_pre_checkout_query.py +46 -0
  106. litegram/methods/answer_shipping_query.py +53 -0
  107. litegram/methods/answer_web_app_query.py +39 -0
  108. litegram/methods/approve_chat_join_request.py +35 -0
  109. litegram/methods/approve_suggested_post.py +44 -0
  110. litegram/methods/ban_chat_member.py +53 -0
  111. litegram/methods/ban_chat_sender_chat.py +41 -0
  112. litegram/methods/base.py +90 -0
  113. litegram/methods/close.py +14 -0
  114. litegram/methods/close_forum_topic.py +41 -0
  115. litegram/methods/close_general_forum_topic.py +33 -0
  116. litegram/methods/convert_gift_to_stars.py +42 -0
  117. litegram/methods/copy_message.py +128 -0
  118. litegram/methods/copy_messages.py +67 -0
  119. litegram/methods/create_chat_invite_link.py +55 -0
  120. litegram/methods/create_chat_subscription_invite_link.py +51 -0
  121. litegram/methods/create_forum_topic.py +51 -0
  122. litegram/methods/create_invoice_link.py +125 -0
  123. litegram/methods/create_new_sticker_set.py +70 -0
  124. litegram/methods/decline_chat_join_request.py +35 -0
  125. litegram/methods/decline_suggested_post.py +41 -0
  126. litegram/methods/delete_business_messages.py +42 -0
  127. litegram/methods/delete_chat_photo.py +33 -0
  128. litegram/methods/delete_chat_sticker_set.py +33 -0
  129. litegram/methods/delete_forum_topic.py +41 -0
  130. litegram/methods/delete_message.py +55 -0
  131. litegram/methods/delete_messages.py +41 -0
  132. litegram/methods/delete_my_commands.py +41 -0
  133. litegram/methods/delete_sticker_from_set.py +30 -0
  134. litegram/methods/delete_sticker_set.py +30 -0
  135. litegram/methods/delete_story.py +42 -0
  136. litegram/methods/delete_webhook.py +35 -0
  137. litegram/methods/edit_chat_invite_link.py +59 -0
  138. litegram/methods/edit_chat_subscription_invite_link.py +42 -0
  139. litegram/methods/edit_forum_topic.py +53 -0
  140. litegram/methods/edit_general_forum_topic.py +35 -0
  141. litegram/methods/edit_message_caption.py +72 -0
  142. litegram/methods/edit_message_checklist.py +55 -0
  143. litegram/methods/edit_message_live_location.py +79 -0
  144. litegram/methods/edit_message_media.py +59 -0
  145. litegram/methods/edit_message_reply_markup.py +55 -0
  146. litegram/methods/edit_message_text.py +89 -0
  147. litegram/methods/edit_story.py +63 -0
  148. litegram/methods/edit_user_star_subscription.py +46 -0
  149. litegram/methods/export_chat_invite_link.py +35 -0
  150. litegram/methods/forward_message.py +76 -0
  151. litegram/methods/forward_messages.py +63 -0
  152. litegram/methods/get_available_gifts.py +15 -0
  153. litegram/methods/get_business_account_gifts.py +88 -0
  154. litegram/methods/get_business_account_star_balance.py +31 -0
  155. litegram/methods/get_business_connection.py +32 -0
  156. litegram/methods/get_chat.py +31 -0
  157. litegram/methods/get_chat_administrators.py +31 -0
  158. litegram/methods/get_chat_gifts.py +79 -0
  159. litegram/methods/get_chat_member.py +33 -0
  160. litegram/methods/get_chat_member_count.py +33 -0
  161. litegram/methods/get_chat_menu_button.py +31 -0
  162. litegram/methods/get_custom_emoji_stickers.py +31 -0
  163. litegram/methods/get_file.py +32 -0
  164. litegram/methods/get_forum_topic_icon_stickers.py +15 -0
  165. litegram/methods/get_game_high_scores.py +53 -0
  166. litegram/methods/get_me.py +15 -0
  167. litegram/methods/get_my_commands.py +39 -0
  168. litegram/methods/get_my_default_administrator_rights.py +31 -0
  169. litegram/methods/get_my_description.py +31 -0
  170. litegram/methods/get_my_name.py +31 -0
  171. litegram/methods/get_my_short_description.py +31 -0
  172. litegram/methods/get_my_star_balance.py +15 -0
  173. litegram/methods/get_star_transactions.py +39 -0
  174. litegram/methods/get_sticker_set.py +31 -0
  175. litegram/methods/get_updates.py +57 -0
  176. litegram/methods/get_user_chat_boosts.py +33 -0
  177. litegram/methods/get_user_gifts.py +71 -0
  178. litegram/methods/get_user_profile_photos.py +42 -0
  179. litegram/methods/get_webhook_info.py +15 -0
  180. litegram/methods/gift_premium_subscription.py +61 -0
  181. litegram/methods/hide_general_forum_topic.py +33 -0
  182. litegram/methods/leave_chat.py +33 -0
  183. litegram/methods/log_out.py +14 -0
  184. litegram/methods/pin_chat_message.py +53 -0
  185. litegram/methods/post_story.py +71 -0
  186. litegram/methods/promote_chat_member.py +109 -0
  187. litegram/methods/read_business_message.py +46 -0
  188. litegram/methods/refund_star_payment.py +42 -0
  189. litegram/methods/remove_business_account_profile_photo.py +42 -0
  190. litegram/methods/remove_chat_verification.py +33 -0
  191. litegram/methods/remove_user_verification.py +30 -0
  192. litegram/methods/reopen_forum_topic.py +41 -0
  193. litegram/methods/reopen_general_forum_topic.py +33 -0
  194. litegram/methods/replace_sticker_in_set.py +53 -0
  195. litegram/methods/repost_story.py +59 -0
  196. litegram/methods/restrict_chat_member.py +57 -0
  197. litegram/methods/revoke_chat_invite_link.py +33 -0
  198. litegram/methods/save_prepared_inline_message.py +59 -0
  199. litegram/methods/send_animation.py +145 -0
  200. litegram/methods/send_audio.py +138 -0
  201. litegram/methods/send_chat_action.py +57 -0
  202. litegram/methods/send_checklist.py +67 -0
  203. litegram/methods/send_contact.py +118 -0
  204. litegram/methods/send_dice.py +106 -0
  205. litegram/methods/send_document.py +129 -0
  206. litegram/methods/send_game.py +92 -0
  207. litegram/methods/send_gift.py +66 -0
  208. litegram/methods/send_invoice.py +183 -0
  209. litegram/methods/send_location.py +126 -0
  210. litegram/methods/send_media_group.py +92 -0
  211. litegram/methods/send_message.py +129 -0
  212. litegram/methods/send_message_draft.py +61 -0
  213. litegram/methods/send_paid_media.py +111 -0
  214. litegram/methods/send_photo.py +128 -0
  215. litegram/methods/send_poll.py +152 -0
  216. litegram/methods/send_sticker.py +111 -0
  217. litegram/methods/send_venue.py +134 -0
  218. litegram/methods/send_video.py +158 -0
  219. litegram/methods/send_video_note.py +120 -0
  220. litegram/methods/send_voice.py +124 -0
  221. litegram/methods/set_business_account_bio.py +38 -0
  222. litegram/methods/set_business_account_gift_settings.py +49 -0
  223. litegram/methods/set_business_account_name.py +46 -0
  224. litegram/methods/set_business_account_profile_photo.py +49 -0
  225. litegram/methods/set_business_account_username.py +42 -0
  226. litegram/methods/set_chat_administrator_custom_title.py +44 -0
  227. litegram/methods/set_chat_description.py +41 -0
  228. litegram/methods/set_chat_menu_button.py +41 -0
  229. litegram/methods/set_chat_permissions.py +49 -0
  230. litegram/methods/set_chat_photo.py +35 -0
  231. litegram/methods/set_chat_sticker_set.py +41 -0
  232. litegram/methods/set_chat_title.py +35 -0
  233. litegram/methods/set_custom_emoji_sticker_set_thumbnail.py +38 -0
  234. litegram/methods/set_game_score.py +63 -0
  235. litegram/methods/set_message_reaction.py +53 -0
  236. litegram/methods/set_my_commands.py +44 -0
  237. litegram/methods/set_my_default_administrator_rights.py +41 -0
  238. litegram/methods/set_my_description.py +38 -0
  239. litegram/methods/set_my_name.py +38 -0
  240. litegram/methods/set_my_short_description.py +42 -0
  241. litegram/methods/set_passport_data_errors.py +42 -0
  242. litegram/methods/set_sticker_emoji_list.py +32 -0
  243. litegram/methods/set_sticker_keywords.py +38 -0
  244. litegram/methods/set_sticker_mask_position.py +41 -0
  245. litegram/methods/set_sticker_position_in_set.py +32 -0
  246. litegram/methods/set_sticker_set_thumbnail.py +47 -0
  247. litegram/methods/set_sticker_set_title.py +32 -0
  248. litegram/methods/set_user_emoji_status.py +49 -0
  249. litegram/methods/set_webhook.py +75 -0
  250. litegram/methods/stop_message_live_location.py +55 -0
  251. litegram/methods/stop_poll.py +51 -0
  252. litegram/methods/transfer_business_account_stars.py +42 -0
  253. litegram/methods/transfer_gift.py +50 -0
  254. litegram/methods/unban_chat_member.py +49 -0
  255. litegram/methods/unban_chat_sender_chat.py +41 -0
  256. litegram/methods/unhide_general_forum_topic.py +33 -0
  257. litegram/methods/unpin_all_chat_messages.py +33 -0
  258. litegram/methods/unpin_all_forum_topic_messages.py +41 -0
  259. litegram/methods/unpin_all_general_forum_topic_messages.py +33 -0
  260. litegram/methods/unpin_chat_message.py +49 -0
  261. litegram/methods/upgrade_gift.py +50 -0
  262. litegram/methods/upload_sticker_file.py +47 -0
  263. litegram/methods/verify_chat.py +41 -0
  264. litegram/methods/verify_user.py +38 -0
  265. litegram/py.typed +0 -0
  266. litegram/types/__init__.py +669 -0
  267. litegram/types/accepted_gift_types.py +51 -0
  268. litegram/types/affiliate_info.py +55 -0
  269. litegram/types/animation.py +70 -0
  270. litegram/types/audio.py +70 -0
  271. litegram/types/background_fill.py +15 -0
  272. litegram/types/background_fill_freeform_gradient.py +35 -0
  273. litegram/types/background_fill_gradient.py +47 -0
  274. litegram/types/background_fill_solid.py +35 -0
  275. litegram/types/background_fill_union.py +9 -0
  276. litegram/types/background_type.py +16 -0
  277. litegram/types/background_type_chat_theme.py +35 -0
  278. litegram/types/background_type_fill.py +41 -0
  279. litegram/types/background_type_pattern.py +59 -0
  280. litegram/types/background_type_union.py +10 -0
  281. litegram/types/background_type_wallpaper.py +54 -0
  282. litegram/types/base.py +53 -0
  283. litegram/types/birthdate.py +38 -0
  284. litegram/types/bot_command.py +29 -0
  285. litegram/types/bot_command_scope.py +19 -0
  286. litegram/types/bot_command_scope_all_chat_administrators.py +33 -0
  287. litegram/types/bot_command_scope_all_group_chats.py +33 -0
  288. litegram/types/bot_command_scope_all_private_chats.py +33 -0
  289. litegram/types/bot_command_scope_chat.py +39 -0
  290. litegram/types/bot_command_scope_chat_administrators.py +39 -0
  291. litegram/types/bot_command_scope_chat_member.py +42 -0
  292. litegram/types/bot_command_scope_default.py +33 -0
  293. litegram/types/bot_command_scope_union.py +23 -0
  294. litegram/types/bot_description.py +27 -0
  295. litegram/types/bot_name.py +27 -0
  296. litegram/types/bot_short_description.py +27 -0
  297. litegram/types/business_bot_rights.py +96 -0
  298. litegram/types/business_connection.py +69 -0
  299. litegram/types/business_intro.py +41 -0
  300. litegram/types/business_location.py +38 -0
  301. litegram/types/business_messages_deleted.py +46 -0
  302. litegram/types/business_opening_hours.py +38 -0
  303. litegram/types/business_opening_hours_interval.py +35 -0
  304. litegram/types/callback_game.py +11 -0
  305. litegram/types/callback_query.py +108 -0
  306. litegram/types/chat.py +1307 -0
  307. litegram/types/chat_administrator_rights.py +95 -0
  308. litegram/types/chat_background.py +30 -0
  309. litegram/types/chat_boost.py +51 -0
  310. litegram/types/chat_boost_added.py +27 -0
  311. litegram/types/chat_boost_removed.py +52 -0
  312. litegram/types/chat_boost_source.py +15 -0
  313. litegram/types/chat_boost_source_gift_code.py +39 -0
  314. litegram/types/chat_boost_source_giveaway.py +55 -0
  315. litegram/types/chat_boost_source_premium.py +39 -0
  316. litegram/types/chat_boost_source_union.py +9 -0
  317. litegram/types/chat_boost_updated.py +33 -0
  318. litegram/types/chat_full_info.py +255 -0
  319. litegram/types/chat_id_union.py +5 -0
  320. litegram/types/chat_invite_link.py +79 -0
  321. litegram/types/chat_join_request.py +2911 -0
  322. litegram/types/chat_location.py +32 -0
  323. litegram/types/chat_member.py +18 -0
  324. litegram/types/chat_member_administrator.py +115 -0
  325. litegram/types/chat_member_banned.py +43 -0
  326. litegram/types/chat_member_left.py +39 -0
  327. litegram/types/chat_member_member.py +43 -0
  328. litegram/types/chat_member_owner.py +51 -0
  329. litegram/types/chat_member_restricted.py +108 -0
  330. litegram/types/chat_member_union.py +14 -0
  331. litegram/types/chat_member_updated.py +1483 -0
  332. litegram/types/chat_permissions.py +87 -0
  333. litegram/types/chat_photo.py +47 -0
  334. litegram/types/chat_shared.py +54 -0
  335. litegram/types/checklist.py +55 -0
  336. litegram/types/checklist_task.py +60 -0
  337. litegram/types/checklist_tasks_added.py +39 -0
  338. litegram/types/checklist_tasks_done.py +46 -0
  339. litegram/types/chosen_inline_result.py +58 -0
  340. litegram/types/contact.py +51 -0
  341. litegram/types/copy_text_button.py +27 -0
  342. litegram/types/custom.py +32 -0
  343. litegram/types/date_time_union.py +6 -0
  344. litegram/types/dice.py +38 -0
  345. litegram/types/direct_message_price_changed.py +39 -0
  346. litegram/types/direct_messages_topic.py +38 -0
  347. litegram/types/document.py +58 -0
  348. litegram/types/downloadable.py +8 -0
  349. litegram/types/encrypted_credentials.py +31 -0
  350. litegram/types/encrypted_passport_element.py +74 -0
  351. litegram/types/error_event.py +26 -0
  352. litegram/types/external_reply_info.py +156 -0
  353. litegram/types/file.py +49 -0
  354. litegram/types/force_reply.py +50 -0
  355. litegram/types/forum_topic.py +51 -0
  356. litegram/types/forum_topic_closed.py +11 -0
  357. litegram/types/forum_topic_created.py +47 -0
  358. litegram/types/forum_topic_edited.py +35 -0
  359. litegram/types/forum_topic_reopened.py +11 -0
  360. litegram/types/game.py +60 -0
  361. litegram/types/game_high_score.py +37 -0
  362. litegram/types/general_forum_topic_hidden.py +11 -0
  363. litegram/types/general_forum_topic_unhidden.py +11 -0
  364. litegram/types/gift.py +88 -0
  365. litegram/types/gift_background.py +43 -0
  366. litegram/types/gift_info.py +75 -0
  367. litegram/types/gifts.py +30 -0
  368. litegram/types/giveaway.py +71 -0
  369. litegram/types/giveaway_completed.py +50 -0
  370. litegram/types/giveaway_created.py +27 -0
  371. litegram/types/giveaway_winners.py +84 -0
  372. litegram/types/inaccessible_message.py +3003 -0
  373. litegram/types/inline_keyboard_button.py +82 -0
  374. litegram/types/inline_keyboard_markup.py +35 -0
  375. litegram/types/inline_query.py +113 -0
  376. litegram/types/inline_query_result.py +34 -0
  377. litegram/types/inline_query_result_article.py +85 -0
  378. litegram/types/inline_query_result_audio.py +82 -0
  379. litegram/types/inline_query_result_cached_audio.py +70 -0
  380. litegram/types/inline_query_result_cached_document.py +78 -0
  381. litegram/types/inline_query_result_cached_gif.py +78 -0
  382. litegram/types/inline_query_result_cached_mpeg4_gif.py +78 -0
  383. litegram/types/inline_query_result_cached_photo.py +82 -0
  384. litegram/types/inline_query_result_cached_sticker.py +56 -0
  385. litegram/types/inline_query_result_cached_video.py +82 -0
  386. litegram/types/inline_query_result_cached_voice.py +74 -0
  387. litegram/types/inline_query_result_contact.py +80 -0
  388. litegram/types/inline_query_result_document.py +94 -0
  389. litegram/types/inline_query_result_game.py +51 -0
  390. litegram/types/inline_query_result_gif.py +98 -0
  391. litegram/types/inline_query_result_location.py +92 -0
  392. litegram/types/inline_query_result_mpeg4_gif.py +98 -0
  393. litegram/types/inline_query_result_photo.py +94 -0
  394. litegram/types/inline_query_result_union.py +47 -0
  395. litegram/types/inline_query_result_venue.py +96 -0
  396. litegram/types/inline_query_result_video.py +104 -0
  397. litegram/types/inline_query_result_voice.py +78 -0
  398. litegram/types/inline_query_results_button.py +41 -0
  399. litegram/types/input_checklist.py +59 -0
  400. litegram/types/input_checklist_task.py +50 -0
  401. litegram/types/input_contact_message_content.py +47 -0
  402. litegram/types/input_file.py +151 -0
  403. litegram/types/input_file_union.py +7 -0
  404. litegram/types/input_invoice_message_content.py +114 -0
  405. litegram/types/input_location_message_content.py +55 -0
  406. litegram/types/input_media.py +17 -0
  407. litegram/types/input_media_animation.py +82 -0
  408. litegram/types/input_media_audio.py +74 -0
  409. litegram/types/input_media_document.py +66 -0
  410. litegram/types/input_media_photo.py +65 -0
  411. litegram/types/input_media_union.py +11 -0
  412. litegram/types/input_media_video.py +95 -0
  413. litegram/types/input_message_content.py +17 -0
  414. litegram/types/input_message_content_union.py +17 -0
  415. litegram/types/input_paid_media.py +14 -0
  416. litegram/types/input_paid_media_photo.py +39 -0
  417. litegram/types/input_paid_media_union.py +8 -0
  418. litegram/types/input_paid_media_video.py +73 -0
  419. litegram/types/input_poll_option.py +47 -0
  420. litegram/types/input_poll_option_union.py +7 -0
  421. litegram/types/input_profile_photo.py +14 -0
  422. litegram/types/input_profile_photo_animated.py +48 -0
  423. litegram/types/input_profile_photo_static.py +40 -0
  424. litegram/types/input_profile_photo_union.py +8 -0
  425. litegram/types/input_sticker.py +55 -0
  426. litegram/types/input_story_content.py +14 -0
  427. litegram/types/input_story_content_photo.py +37 -0
  428. litegram/types/input_story_content_union.py +8 -0
  429. litegram/types/input_story_content_video.py +53 -0
  430. litegram/types/input_text_message_content.py +61 -0
  431. litegram/types/input_venue_message_content.py +63 -0
  432. litegram/types/invoice.py +51 -0
  433. litegram/types/keyboard_button.py +76 -0
  434. litegram/types/keyboard_button_poll_type.py +27 -0
  435. litegram/types/keyboard_button_request_chat.py +78 -0
  436. litegram/types/keyboard_button_request_user.py +46 -0
  437. litegram/types/keyboard_button_request_users.py +59 -0
  438. litegram/types/labeled_price.py +29 -0
  439. litegram/types/link_preview_options.py +52 -0
  440. litegram/types/location.py +55 -0
  441. litegram/types/location_address.py +47 -0
  442. litegram/types/login_url.py +50 -0
  443. litegram/types/mask_position.py +41 -0
  444. litegram/types/maybe_inaccessible_message.py +14 -0
  445. litegram/types/maybe_inaccessible_message_union.py +8 -0
  446. litegram/types/media_union.py +10 -0
  447. litegram/types/menu_button.py +47 -0
  448. litegram/types/menu_button_commands.py +33 -0
  449. litegram/types/menu_button_default.py +33 -0
  450. litegram/types/menu_button_union.py +9 -0
  451. litegram/types/menu_button_web_app.py +42 -0
  452. litegram/types/message.py +4458 -0
  453. litegram/types/message_auto_delete_timer_changed.py +27 -0
  454. litegram/types/message_entity.py +66 -0
  455. litegram/types/message_id.py +27 -0
  456. litegram/types/message_origin.py +16 -0
  457. litegram/types/message_origin_channel.py +56 -0
  458. litegram/types/message_origin_chat.py +52 -0
  459. litegram/types/message_origin_hidden_user.py +42 -0
  460. litegram/types/message_origin_union.py +10 -0
  461. litegram/types/message_origin_user.py +43 -0
  462. litegram/types/message_reaction_count_updated.py +52 -0
  463. litegram/types/message_reaction_updated.py +65 -0
  464. litegram/types/order_info.py +50 -0
  465. litegram/types/owned_gift.py +14 -0
  466. litegram/types/owned_gift_regular.py +98 -0
  467. litegram/types/owned_gift_union.py +8 -0
  468. litegram/types/owned_gift_unique.py +74 -0
  469. litegram/types/owned_gifts.py +41 -0
  470. litegram/types/paid_media.py +15 -0
  471. litegram/types/paid_media_info.py +38 -0
  472. litegram/types/paid_media_photo.py +39 -0
  473. litegram/types/paid_media_preview.py +42 -0
  474. litegram/types/paid_media_purchased.py +40 -0
  475. litegram/types/paid_media_union.py +9 -0
  476. litegram/types/paid_media_video.py +39 -0
  477. litegram/types/paid_message_price_changed.py +27 -0
  478. litegram/types/passport_data.py +39 -0
  479. litegram/types/passport_element_error.py +21 -0
  480. litegram/types/passport_element_error_data_field.py +52 -0
  481. litegram/types/passport_element_error_file.py +42 -0
  482. litegram/types/passport_element_error_files.py +48 -0
  483. litegram/types/passport_element_error_front_side.py +42 -0
  484. litegram/types/passport_element_error_reverse_side.py +42 -0
  485. litegram/types/passport_element_error_selfie.py +42 -0
  486. litegram/types/passport_element_error_translation_file.py +42 -0
  487. litegram/types/passport_element_error_translation_files.py +48 -0
  488. litegram/types/passport_element_error_union.py +27 -0
  489. litegram/types/passport_element_error_unspecified.py +48 -0
  490. litegram/types/passport_file.py +50 -0
  491. litegram/types/photo_size.py +51 -0
  492. litegram/types/poll.py +92 -0
  493. litegram/types/poll_answer.py +51 -0
  494. litegram/types/poll_option.py +46 -0
  495. litegram/types/pre_checkout_query.py +98 -0
  496. litegram/types/prepared_inline_message.py +38 -0
  497. litegram/types/proximity_alert_triggered.py +41 -0
  498. litegram/types/reaction_count.py +38 -0
  499. litegram/types/reaction_type.py +15 -0
  500. litegram/types/reaction_type_custom_emoji.py +36 -0
  501. litegram/types/reaction_type_emoji.py +36 -0
  502. litegram/types/reaction_type_paid.py +33 -0
  503. litegram/types/reaction_type_union.py +9 -0
  504. litegram/types/refunded_payment.py +51 -0
  505. litegram/types/reply_keyboard_markup.py +58 -0
  506. litegram/types/reply_keyboard_remove.py +35 -0
  507. litegram/types/reply_markup_union.py +10 -0
  508. litegram/types/reply_parameters.py +68 -0
  509. litegram/types/response_parameters.py +35 -0
  510. litegram/types/result_chat_member_union.py +14 -0
  511. litegram/types/result_menu_button_union.py +9 -0
  512. litegram/types/revenue_withdrawal_state.py +15 -0
  513. litegram/types/revenue_withdrawal_state_failed.py +33 -0
  514. litegram/types/revenue_withdrawal_state_pending.py +33 -0
  515. litegram/types/revenue_withdrawal_state_succeeded.py +42 -0
  516. litegram/types/revenue_withdrawal_state_union.py +11 -0
  517. litegram/types/sent_web_app_message.py +27 -0
  518. litegram/types/shared_user.py +54 -0
  519. litegram/types/shipping_address.py +55 -0
  520. litegram/types/shipping_option.py +41 -0
  521. litegram/types/shipping_query.py +90 -0
  522. litegram/types/star_amount.py +35 -0
  523. litegram/types/star_transaction.py +59 -0
  524. litegram/types/star_transactions.py +30 -0
  525. litegram/types/sticker.py +152 -0
  526. litegram/types/sticker_set.py +71 -0
  527. litegram/types/story.py +32 -0
  528. litegram/types/story_area.py +39 -0
  529. litegram/types/story_area_position.py +55 -0
  530. litegram/types/story_area_type.py +17 -0
  531. litegram/types/story_area_type_link.py +37 -0
  532. litegram/types/story_area_type_location.py +52 -0
  533. litegram/types/story_area_type_suggested_reaction.py +52 -0
  534. litegram/types/story_area_type_union.py +13 -0
  535. litegram/types/story_area_type_unique_gift.py +37 -0
  536. litegram/types/story_area_type_weather.py +49 -0
  537. litegram/types/successful_payment.py +74 -0
  538. litegram/types/suggested_post_approval_failed.py +39 -0
  539. litegram/types/suggested_post_approved.py +48 -0
  540. litegram/types/suggested_post_declined.py +38 -0
  541. litegram/types/suggested_post_info.py +42 -0
  542. litegram/types/suggested_post_paid.py +51 -0
  543. litegram/types/suggested_post_parameters.py +39 -0
  544. litegram/types/suggested_post_price.py +29 -0
  545. litegram/types/suggested_post_refunded.py +38 -0
  546. litegram/types/switch_inline_query_chosen_chat.py +51 -0
  547. litegram/types/text_quote.py +50 -0
  548. litegram/types/transaction_partner.py +19 -0
  549. litegram/types/transaction_partner_affiliate_program.py +47 -0
  550. litegram/types/transaction_partner_chat.py +43 -0
  551. litegram/types/transaction_partner_fragment.py +39 -0
  552. litegram/types/transaction_partner_other.py +33 -0
  553. litegram/types/transaction_partner_telegram_ads.py +33 -0
  554. litegram/types/transaction_partner_telegram_api.py +36 -0
  555. litegram/types/transaction_partner_union.py +21 -0
  556. litegram/types/transaction_partner_user.py +78 -0
  557. litegram/types/unique_gift.py +82 -0
  558. litegram/types/unique_gift_backdrop.py +41 -0
  559. litegram/types/unique_gift_backdrop_colors.py +47 -0
  560. litegram/types/unique_gift_colors.py +55 -0
  561. litegram/types/unique_gift_info.py +72 -0
  562. litegram/types/unique_gift_model.py +41 -0
  563. litegram/types/unique_gift_symbol.py +41 -0
  564. litegram/types/update.py +218 -0
  565. litegram/types/user.py +144 -0
  566. litegram/types/user_chat_boosts.py +30 -0
  567. litegram/types/user_profile_photos.py +38 -0
  568. litegram/types/user_rating.py +47 -0
  569. litegram/types/user_shared.py +32 -0
  570. litegram/types/users_shared.py +46 -0
  571. litegram/types/venue.py +62 -0
  572. litegram/types/video.py +80 -0
  573. litegram/types/video_chat_ended.py +27 -0
  574. litegram/types/video_chat_participants_invited.py +30 -0
  575. litegram/types/video_chat_scheduled.py +30 -0
  576. litegram/types/video_chat_started.py +11 -0
  577. litegram/types/video_note.py +58 -0
  578. litegram/types/voice.py +51 -0
  579. litegram/types/web_app_data.py +29 -0
  580. litegram/types/web_app_info.py +27 -0
  581. litegram/types/webhook_info.py +70 -0
  582. litegram/types/write_access_allowed.py +43 -0
  583. litegram/utils/__init__.py +0 -0
  584. litegram/utils/auth_widget.py +38 -0
  585. litegram/utils/backoff.py +84 -0
  586. litegram/utils/callback_answer.py +223 -0
  587. litegram/utils/chat_action.py +381 -0
  588. litegram/utils/chat_member.py +33 -0
  589. litegram/utils/class_attrs_resolver.py +91 -0
  590. litegram/utils/dataclass.py +41 -0
  591. litegram/utils/deep_linking.py +155 -0
  592. litegram/utils/formatting.py +708 -0
  593. litegram/utils/i18n/__init__.py +21 -0
  594. litegram/utils/i18n/context.py +26 -0
  595. litegram/utils/i18n/core.py +141 -0
  596. litegram/utils/i18n/lazy_proxy.py +16 -0
  597. litegram/utils/i18n/middleware.py +196 -0
  598. litegram/utils/keyboard.py +412 -0
  599. litegram/utils/link.py +76 -0
  600. litegram/utils/magic_filter/__init__.py +17 -0
  601. litegram/utils/magic_filter/attrdict.py +16 -0
  602. litegram/utils/magic_filter/exceptions.py +26 -0
  603. litegram/utils/magic_filter/helper.py +12 -0
  604. litegram/utils/magic_filter/magic.py +333 -0
  605. litegram/utils/magic_filter/operations/__init__.py +26 -0
  606. litegram/utils/magic_filter/operations/base.py +12 -0
  607. litegram/utils/magic_filter/operations/call.py +19 -0
  608. litegram/utils/magic_filter/operations/cast.py +22 -0
  609. litegram/utils/magic_filter/operations/combination.py +41 -0
  610. litegram/utils/magic_filter/operations/comparator.py +23 -0
  611. litegram/utils/magic_filter/operations/extract.py +22 -0
  612. litegram/utils/magic_filter/operations/function.py +37 -0
  613. litegram/utils/magic_filter/operations/getattr.py +20 -0
  614. litegram/utils/magic_filter/operations/getitem.py +27 -0
  615. litegram/utils/magic_filter/operations/selector.py +21 -0
  616. litegram/utils/magic_filter/py.typed +0 -0
  617. litegram/utils/magic_filter/util.py +42 -0
  618. litegram/utils/markdown.py +211 -0
  619. litegram/utils/media_group.py +364 -0
  620. litegram/utils/mixins.py +95 -0
  621. litegram/utils/mypy_hacks.py +21 -0
  622. litegram/utils/payload.py +114 -0
  623. litegram/utils/serialization.py +93 -0
  624. litegram/utils/text_decorations.py +271 -0
  625. litegram/utils/token.py +44 -0
  626. litegram/utils/warnings.py +9 -0
  627. litegram/utils/web_app.py +195 -0
  628. litegram/utils/web_app_signature.py +78 -0
  629. litegram/webhook/__init__.py +0 -0
  630. litegram/webhook/litestar_server.py +187 -0
  631. litegram/webhook/security.py +47 -0
  632. litegram-1.0.0.dist-info/METADATA +140 -0
  633. litegram-1.0.0.dist-info/RECORD +636 -0
  634. litegram-1.0.0.dist-info/WHEEL +4 -0
  635. litegram-1.0.0.dist-info/entry_points.txt +2 -0
  636. litegram-1.0.0.dist-info/licenses/LICENSE +18 -0
litegram/__init__.py ADDED
@@ -0,0 +1,32 @@
1
+ from litegram.dispatcher.flags import FlagGenerator
2
+
3
+ from . import enums, methods, types
4
+ from .__meta__ import __api_version__, __version__
5
+ from .client import session
6
+ from .client.bot import Bot
7
+ from .dispatcher.dispatcher import Dispatcher
8
+ from .dispatcher.middlewares.base import BaseMiddleware
9
+ from .dispatcher.router import Router
10
+ from .utils.magic_filter import MagicFilter
11
+ from .utils.text_decorations import html_decoration as html
12
+ from .utils.text_decorations import markdown_decoration as md
13
+
14
+ F = MagicFilter()
15
+ flags = FlagGenerator()
16
+
17
+ __all__ = (
18
+ "BaseMiddleware",
19
+ "Bot",
20
+ "Dispatcher",
21
+ "F",
22
+ "Router",
23
+ "__api_version__",
24
+ "__version__",
25
+ "enums",
26
+ "flags",
27
+ "html",
28
+ "md",
29
+ "methods",
30
+ "session",
31
+ "types",
32
+ )
litegram/__main__.py ADDED
@@ -0,0 +1,6 @@
1
+ from __future__ import annotations
2
+
3
+ from .cli import litegram_group
4
+
5
+ if __name__ == "__main__":
6
+ litegram_group()
litegram/__meta__.py ADDED
@@ -0,0 +1,2 @@
1
+ __version__ = "1.0.0"
2
+ __api_version__ = "9.3"
@@ -0,0 +1,3 @@
1
+ from .main import litegram_group
2
+
3
+ __all__ = ("litegram_group",)
litegram/cli/main.py ADDED
@@ -0,0 +1,132 @@
1
+ from __future__ import annotations
2
+
3
+ import importlib
4
+ import sys
5
+ from typing import TYPE_CHECKING, Any
6
+
7
+ try:
8
+ import rich_click as click
9
+ except ImportError:
10
+ import click # type: ignore[no-redef]
11
+
12
+ if TYPE_CHECKING:
13
+ from litegram.dispatcher.dispatcher import Dispatcher
14
+
15
+
16
+ def import_string(import_name: str) -> Any:
17
+ if ":" in import_name:
18
+ module_name, obj_name = import_name.split(":", 1)
19
+ else:
20
+ module_name, obj_name = import_name, None
21
+
22
+ try:
23
+ module = importlib.import_module(module_name)
24
+ except ImportError as e:
25
+ raise ImportError(f"Could not import module {module_name!r}") from e
26
+
27
+ if obj_name:
28
+ try:
29
+ return getattr(module, obj_name)
30
+ except AttributeError as e:
31
+ raise ImportError(f"Module {module_name!r} has no attribute {obj_name!r}") from e
32
+
33
+ return module
34
+
35
+
36
+ @click.group(context_settings={"help_option_names": ["-h", "--help"]})
37
+ def litegram_group() -> None:
38
+ """Litegram CLI."""
39
+
40
+
41
+ @litegram_group.group()
42
+ def run() -> None:
43
+ """Run bot."""
44
+
45
+
46
+ @run.command(name="polling")
47
+ @click.argument("path")
48
+ @click.option("--token", help="Bot token", envvar="BOT_TOKEN")
49
+ @click.option("--log-level", help="Log level", default="INFO", show_default=True)
50
+ def run_polling(path: str, token: str | None, log_level: str) -> None:
51
+ """Run bot in polling mode.
52
+
53
+ PATH is a module path to a Dispatcher instance or a factory.
54
+ Example: 'my_bot:dp' or 'my_bot:create_dispatcher'
55
+ """
56
+ import asyncio
57
+ import logging
58
+
59
+ from litegram import Bot, Dispatcher
60
+
61
+ logging.basicConfig(level=log_level.upper())
62
+
63
+ try:
64
+ obj = import_string(path)
65
+ except ImportError as e:
66
+ click.secho(f"Error: {e}", fg="red", err=True)
67
+ sys.exit(1)
68
+
69
+ if isinstance(obj, Dispatcher):
70
+ dp = obj
71
+ elif callable(obj):
72
+ dp = obj()
73
+ else:
74
+ dp = obj
75
+
76
+ if not isinstance(dp, Dispatcher):
77
+ click.secho(f"Error: {path} must be a Dispatcher instance or a factory returning one.", fg="red", err=True)
78
+ sys.exit(1)
79
+
80
+ if not token:
81
+ click.secho("Error: Bot token is required. Use --token or BOT_TOKEN env var.", fg="red", err=True)
82
+ sys.exit(1)
83
+
84
+ bot = Bot(token=token)
85
+
86
+ click.echo(f"Starting polling for bot {path}...")
87
+ try:
88
+ asyncio.run(dp.start_polling(bot))
89
+ except KeyboardInterrupt:
90
+ click.echo("Stopped.")
91
+
92
+
93
+ @run.command(name="webhook")
94
+ @click.argument("path")
95
+ @click.option("--host", default="127.0.0.1", show_default=True)
96
+ @click.option("--port", default=8000, type=int, show_default=True)
97
+ @click.option("--log-level", help="Log level", default="info", show_default=True)
98
+ def run_webhook(path: str, host: str, port: int, log_level: str) -> None:
99
+ """Run bot in webhook mode using Litestar.
100
+
101
+ PATH is a module path to a Litestar instance or a factory.
102
+ Example: 'my_bot:app'
103
+ """
104
+ import uvicorn
105
+ from litestar import Litestar
106
+
107
+ try:
108
+ obj = import_string(path)
109
+ except ImportError as e:
110
+ click.secho(f"Error: {e}", fg="red", err=True)
111
+ sys.exit(1)
112
+
113
+ if isinstance(obj, Litestar):
114
+ app = obj
115
+ elif callable(obj):
116
+ app = obj()
117
+ else:
118
+ app = obj
119
+
120
+ if not isinstance(app, Litestar):
121
+ click.secho(f"Error: {path} must be a Litestar instance or a factory returning one.", fg="red", err=True)
122
+ sys.exit(1)
123
+
124
+ uvicorn.run(app, host=host, port=port, log_level=log_level.lower())
125
+
126
+
127
+ @litegram_group.command(name="version")
128
+ def version_command() -> None:
129
+ """Show litegram version."""
130
+ from litegram import __version__
131
+
132
+ click.echo(f"litegram {__version__}")
File without changes