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.
- litegram/__init__.py +32 -0
- litegram/__main__.py +6 -0
- litegram/__meta__.py +2 -0
- litegram/cli/__init__.py +3 -0
- litegram/cli/main.py +132 -0
- litegram/client/__init__.py +0 -0
- litegram/client/bot.py +5828 -0
- litegram/client/context_controller.py +34 -0
- litegram/client/default.py +80 -0
- litegram/client/session/__init__.py +0 -0
- litegram/client/session/base.py +268 -0
- litegram/client/session/httpx.py +107 -0
- litegram/client/session/middlewares/__init__.py +0 -0
- litegram/client/session/middlewares/base.py +54 -0
- litegram/client/session/middlewares/manager.py +62 -0
- litegram/client/session/middlewares/request_logging.py +40 -0
- litegram/client/telegram.py +108 -0
- litegram/dispatcher/__init__.py +0 -0
- litegram/dispatcher/dispatcher.py +683 -0
- litegram/dispatcher/event/__init__.py +0 -0
- litegram/dispatcher/event/bases.py +36 -0
- litegram/dispatcher/event/event.py +56 -0
- litegram/dispatcher/event/handler.py +113 -0
- litegram/dispatcher/event/telegram.py +147 -0
- litegram/dispatcher/flags.py +133 -0
- litegram/dispatcher/middlewares/__init__.py +0 -0
- litegram/dispatcher/middlewares/base.py +31 -0
- litegram/dispatcher/middlewares/data.py +95 -0
- litegram/dispatcher/middlewares/error.py +39 -0
- litegram/dispatcher/middlewares/manager.py +68 -0
- litegram/dispatcher/middlewares/user_context.py +178 -0
- litegram/dispatcher/router.py +295 -0
- litegram/enums/__init__.py +71 -0
- litegram/enums/bot_command_scope_type.py +19 -0
- litegram/enums/chat_action.py +34 -0
- litegram/enums/chat_boost_source_type.py +15 -0
- litegram/enums/chat_member_status.py +18 -0
- litegram/enums/chat_type.py +17 -0
- litegram/enums/content_type.py +81 -0
- litegram/enums/currency.py +98 -0
- litegram/enums/dice_emoji.py +18 -0
- litegram/enums/encrypted_passport_element.py +25 -0
- litegram/enums/inline_query_result_type.py +25 -0
- litegram/enums/input_media_type.py +17 -0
- litegram/enums/input_paid_media_type.py +14 -0
- litegram/enums/input_profile_photo_type.py +14 -0
- litegram/enums/input_story_content_type.py +14 -0
- litegram/enums/keyboard_button_poll_type_type.py +14 -0
- litegram/enums/mask_position_point.py +16 -0
- litegram/enums/menu_button_type.py +15 -0
- litegram/enums/message_entity_type.py +31 -0
- litegram/enums/message_origin_type.py +16 -0
- litegram/enums/owned_gift_type.py +14 -0
- litegram/enums/paid_media_type.py +15 -0
- litegram/enums/parse_mode.py +15 -0
- litegram/enums/passport_element_error_type.py +21 -0
- litegram/enums/poll_type.py +14 -0
- litegram/enums/reaction_type_type.py +15 -0
- litegram/enums/revenue_withdrawal_state_type.py +15 -0
- litegram/enums/sticker_format.py +15 -0
- litegram/enums/sticker_type.py +15 -0
- litegram/enums/story_area_type_type.py +17 -0
- litegram/enums/topic_icon_color.py +18 -0
- litegram/enums/transaction_partner_type.py +19 -0
- litegram/enums/transaction_partner_user_transaction_type_enum.py +17 -0
- litegram/enums/update_type.py +35 -0
- litegram/exceptions.py +209 -0
- litegram/filters/__init__.py +51 -0
- litegram/filters/base.py +57 -0
- litegram/filters/callback_data.py +185 -0
- litegram/filters/chat_member_updated.py +195 -0
- litegram/filters/command.py +292 -0
- litegram/filters/exception.py +61 -0
- litegram/filters/logic.py +79 -0
- litegram/filters/magic_data.py +30 -0
- litegram/filters/state.py +55 -0
- litegram/fsm/__init__.py +0 -0
- litegram/fsm/context.py +48 -0
- litegram/fsm/middleware.py +119 -0
- litegram/fsm/scene.py +958 -0
- litegram/fsm/state.py +179 -0
- litegram/fsm/storage/__init__.py +0 -0
- litegram/fsm/storage/base.py +212 -0
- litegram/fsm/storage/memory.py +99 -0
- litegram/fsm/storage/mongo.py +151 -0
- litegram/fsm/storage/pymongo.py +145 -0
- litegram/fsm/storage/redis.py +182 -0
- litegram/fsm/strategy.py +38 -0
- litegram/handlers/__init__.py +25 -0
- litegram/handlers/base.py +44 -0
- litegram/handlers/callback_query.py +44 -0
- litegram/handlers/chat_member.py +16 -0
- litegram/handlers/chosen_inline_result.py +20 -0
- litegram/handlers/error.py +19 -0
- litegram/handlers/inline_query.py +20 -0
- litegram/handlers/message.py +32 -0
- litegram/handlers/poll.py +20 -0
- litegram/handlers/pre_checkout_query.py +16 -0
- litegram/handlers/shipping_query.py +16 -0
- litegram/loggers.py +9 -0
- litegram/methods/__init__.py +353 -0
- litegram/methods/add_sticker_to_set.py +44 -0
- litegram/methods/answer_callback_query.py +56 -0
- litegram/methods/answer_inline_query.py +79 -0
- litegram/methods/answer_pre_checkout_query.py +46 -0
- litegram/methods/answer_shipping_query.py +53 -0
- litegram/methods/answer_web_app_query.py +39 -0
- litegram/methods/approve_chat_join_request.py +35 -0
- litegram/methods/approve_suggested_post.py +44 -0
- litegram/methods/ban_chat_member.py +53 -0
- litegram/methods/ban_chat_sender_chat.py +41 -0
- litegram/methods/base.py +90 -0
- litegram/methods/close.py +14 -0
- litegram/methods/close_forum_topic.py +41 -0
- litegram/methods/close_general_forum_topic.py +33 -0
- litegram/methods/convert_gift_to_stars.py +42 -0
- litegram/methods/copy_message.py +128 -0
- litegram/methods/copy_messages.py +67 -0
- litegram/methods/create_chat_invite_link.py +55 -0
- litegram/methods/create_chat_subscription_invite_link.py +51 -0
- litegram/methods/create_forum_topic.py +51 -0
- litegram/methods/create_invoice_link.py +125 -0
- litegram/methods/create_new_sticker_set.py +70 -0
- litegram/methods/decline_chat_join_request.py +35 -0
- litegram/methods/decline_suggested_post.py +41 -0
- litegram/methods/delete_business_messages.py +42 -0
- litegram/methods/delete_chat_photo.py +33 -0
- litegram/methods/delete_chat_sticker_set.py +33 -0
- litegram/methods/delete_forum_topic.py +41 -0
- litegram/methods/delete_message.py +55 -0
- litegram/methods/delete_messages.py +41 -0
- litegram/methods/delete_my_commands.py +41 -0
- litegram/methods/delete_sticker_from_set.py +30 -0
- litegram/methods/delete_sticker_set.py +30 -0
- litegram/methods/delete_story.py +42 -0
- litegram/methods/delete_webhook.py +35 -0
- litegram/methods/edit_chat_invite_link.py +59 -0
- litegram/methods/edit_chat_subscription_invite_link.py +42 -0
- litegram/methods/edit_forum_topic.py +53 -0
- litegram/methods/edit_general_forum_topic.py +35 -0
- litegram/methods/edit_message_caption.py +72 -0
- litegram/methods/edit_message_checklist.py +55 -0
- litegram/methods/edit_message_live_location.py +79 -0
- litegram/methods/edit_message_media.py +59 -0
- litegram/methods/edit_message_reply_markup.py +55 -0
- litegram/methods/edit_message_text.py +89 -0
- litegram/methods/edit_story.py +63 -0
- litegram/methods/edit_user_star_subscription.py +46 -0
- litegram/methods/export_chat_invite_link.py +35 -0
- litegram/methods/forward_message.py +76 -0
- litegram/methods/forward_messages.py +63 -0
- litegram/methods/get_available_gifts.py +15 -0
- litegram/methods/get_business_account_gifts.py +88 -0
- litegram/methods/get_business_account_star_balance.py +31 -0
- litegram/methods/get_business_connection.py +32 -0
- litegram/methods/get_chat.py +31 -0
- litegram/methods/get_chat_administrators.py +31 -0
- litegram/methods/get_chat_gifts.py +79 -0
- litegram/methods/get_chat_member.py +33 -0
- litegram/methods/get_chat_member_count.py +33 -0
- litegram/methods/get_chat_menu_button.py +31 -0
- litegram/methods/get_custom_emoji_stickers.py +31 -0
- litegram/methods/get_file.py +32 -0
- litegram/methods/get_forum_topic_icon_stickers.py +15 -0
- litegram/methods/get_game_high_scores.py +53 -0
- litegram/methods/get_me.py +15 -0
- litegram/methods/get_my_commands.py +39 -0
- litegram/methods/get_my_default_administrator_rights.py +31 -0
- litegram/methods/get_my_description.py +31 -0
- litegram/methods/get_my_name.py +31 -0
- litegram/methods/get_my_short_description.py +31 -0
- litegram/methods/get_my_star_balance.py +15 -0
- litegram/methods/get_star_transactions.py +39 -0
- litegram/methods/get_sticker_set.py +31 -0
- litegram/methods/get_updates.py +57 -0
- litegram/methods/get_user_chat_boosts.py +33 -0
- litegram/methods/get_user_gifts.py +71 -0
- litegram/methods/get_user_profile_photos.py +42 -0
- litegram/methods/get_webhook_info.py +15 -0
- litegram/methods/gift_premium_subscription.py +61 -0
- litegram/methods/hide_general_forum_topic.py +33 -0
- litegram/methods/leave_chat.py +33 -0
- litegram/methods/log_out.py +14 -0
- litegram/methods/pin_chat_message.py +53 -0
- litegram/methods/post_story.py +71 -0
- litegram/methods/promote_chat_member.py +109 -0
- litegram/methods/read_business_message.py +46 -0
- litegram/methods/refund_star_payment.py +42 -0
- litegram/methods/remove_business_account_profile_photo.py +42 -0
- litegram/methods/remove_chat_verification.py +33 -0
- litegram/methods/remove_user_verification.py +30 -0
- litegram/methods/reopen_forum_topic.py +41 -0
- litegram/methods/reopen_general_forum_topic.py +33 -0
- litegram/methods/replace_sticker_in_set.py +53 -0
- litegram/methods/repost_story.py +59 -0
- litegram/methods/restrict_chat_member.py +57 -0
- litegram/methods/revoke_chat_invite_link.py +33 -0
- litegram/methods/save_prepared_inline_message.py +59 -0
- litegram/methods/send_animation.py +145 -0
- litegram/methods/send_audio.py +138 -0
- litegram/methods/send_chat_action.py +57 -0
- litegram/methods/send_checklist.py +67 -0
- litegram/methods/send_contact.py +118 -0
- litegram/methods/send_dice.py +106 -0
- litegram/methods/send_document.py +129 -0
- litegram/methods/send_game.py +92 -0
- litegram/methods/send_gift.py +66 -0
- litegram/methods/send_invoice.py +183 -0
- litegram/methods/send_location.py +126 -0
- litegram/methods/send_media_group.py +92 -0
- litegram/methods/send_message.py +129 -0
- litegram/methods/send_message_draft.py +61 -0
- litegram/methods/send_paid_media.py +111 -0
- litegram/methods/send_photo.py +128 -0
- litegram/methods/send_poll.py +152 -0
- litegram/methods/send_sticker.py +111 -0
- litegram/methods/send_venue.py +134 -0
- litegram/methods/send_video.py +158 -0
- litegram/methods/send_video_note.py +120 -0
- litegram/methods/send_voice.py +124 -0
- litegram/methods/set_business_account_bio.py +38 -0
- litegram/methods/set_business_account_gift_settings.py +49 -0
- litegram/methods/set_business_account_name.py +46 -0
- litegram/methods/set_business_account_profile_photo.py +49 -0
- litegram/methods/set_business_account_username.py +42 -0
- litegram/methods/set_chat_administrator_custom_title.py +44 -0
- litegram/methods/set_chat_description.py +41 -0
- litegram/methods/set_chat_menu_button.py +41 -0
- litegram/methods/set_chat_permissions.py +49 -0
- litegram/methods/set_chat_photo.py +35 -0
- litegram/methods/set_chat_sticker_set.py +41 -0
- litegram/methods/set_chat_title.py +35 -0
- litegram/methods/set_custom_emoji_sticker_set_thumbnail.py +38 -0
- litegram/methods/set_game_score.py +63 -0
- litegram/methods/set_message_reaction.py +53 -0
- litegram/methods/set_my_commands.py +44 -0
- litegram/methods/set_my_default_administrator_rights.py +41 -0
- litegram/methods/set_my_description.py +38 -0
- litegram/methods/set_my_name.py +38 -0
- litegram/methods/set_my_short_description.py +42 -0
- litegram/methods/set_passport_data_errors.py +42 -0
- litegram/methods/set_sticker_emoji_list.py +32 -0
- litegram/methods/set_sticker_keywords.py +38 -0
- litegram/methods/set_sticker_mask_position.py +41 -0
- litegram/methods/set_sticker_position_in_set.py +32 -0
- litegram/methods/set_sticker_set_thumbnail.py +47 -0
- litegram/methods/set_sticker_set_title.py +32 -0
- litegram/methods/set_user_emoji_status.py +49 -0
- litegram/methods/set_webhook.py +75 -0
- litegram/methods/stop_message_live_location.py +55 -0
- litegram/methods/stop_poll.py +51 -0
- litegram/methods/transfer_business_account_stars.py +42 -0
- litegram/methods/transfer_gift.py +50 -0
- litegram/methods/unban_chat_member.py +49 -0
- litegram/methods/unban_chat_sender_chat.py +41 -0
- litegram/methods/unhide_general_forum_topic.py +33 -0
- litegram/methods/unpin_all_chat_messages.py +33 -0
- litegram/methods/unpin_all_forum_topic_messages.py +41 -0
- litegram/methods/unpin_all_general_forum_topic_messages.py +33 -0
- litegram/methods/unpin_chat_message.py +49 -0
- litegram/methods/upgrade_gift.py +50 -0
- litegram/methods/upload_sticker_file.py +47 -0
- litegram/methods/verify_chat.py +41 -0
- litegram/methods/verify_user.py +38 -0
- litegram/py.typed +0 -0
- litegram/types/__init__.py +669 -0
- litegram/types/accepted_gift_types.py +51 -0
- litegram/types/affiliate_info.py +55 -0
- litegram/types/animation.py +70 -0
- litegram/types/audio.py +70 -0
- litegram/types/background_fill.py +15 -0
- litegram/types/background_fill_freeform_gradient.py +35 -0
- litegram/types/background_fill_gradient.py +47 -0
- litegram/types/background_fill_solid.py +35 -0
- litegram/types/background_fill_union.py +9 -0
- litegram/types/background_type.py +16 -0
- litegram/types/background_type_chat_theme.py +35 -0
- litegram/types/background_type_fill.py +41 -0
- litegram/types/background_type_pattern.py +59 -0
- litegram/types/background_type_union.py +10 -0
- litegram/types/background_type_wallpaper.py +54 -0
- litegram/types/base.py +53 -0
- litegram/types/birthdate.py +38 -0
- litegram/types/bot_command.py +29 -0
- litegram/types/bot_command_scope.py +19 -0
- litegram/types/bot_command_scope_all_chat_administrators.py +33 -0
- litegram/types/bot_command_scope_all_group_chats.py +33 -0
- litegram/types/bot_command_scope_all_private_chats.py +33 -0
- litegram/types/bot_command_scope_chat.py +39 -0
- litegram/types/bot_command_scope_chat_administrators.py +39 -0
- litegram/types/bot_command_scope_chat_member.py +42 -0
- litegram/types/bot_command_scope_default.py +33 -0
- litegram/types/bot_command_scope_union.py +23 -0
- litegram/types/bot_description.py +27 -0
- litegram/types/bot_name.py +27 -0
- litegram/types/bot_short_description.py +27 -0
- litegram/types/business_bot_rights.py +96 -0
- litegram/types/business_connection.py +69 -0
- litegram/types/business_intro.py +41 -0
- litegram/types/business_location.py +38 -0
- litegram/types/business_messages_deleted.py +46 -0
- litegram/types/business_opening_hours.py +38 -0
- litegram/types/business_opening_hours_interval.py +35 -0
- litegram/types/callback_game.py +11 -0
- litegram/types/callback_query.py +108 -0
- litegram/types/chat.py +1307 -0
- litegram/types/chat_administrator_rights.py +95 -0
- litegram/types/chat_background.py +30 -0
- litegram/types/chat_boost.py +51 -0
- litegram/types/chat_boost_added.py +27 -0
- litegram/types/chat_boost_removed.py +52 -0
- litegram/types/chat_boost_source.py +15 -0
- litegram/types/chat_boost_source_gift_code.py +39 -0
- litegram/types/chat_boost_source_giveaway.py +55 -0
- litegram/types/chat_boost_source_premium.py +39 -0
- litegram/types/chat_boost_source_union.py +9 -0
- litegram/types/chat_boost_updated.py +33 -0
- litegram/types/chat_full_info.py +255 -0
- litegram/types/chat_id_union.py +5 -0
- litegram/types/chat_invite_link.py +79 -0
- litegram/types/chat_join_request.py +2911 -0
- litegram/types/chat_location.py +32 -0
- litegram/types/chat_member.py +18 -0
- litegram/types/chat_member_administrator.py +115 -0
- litegram/types/chat_member_banned.py +43 -0
- litegram/types/chat_member_left.py +39 -0
- litegram/types/chat_member_member.py +43 -0
- litegram/types/chat_member_owner.py +51 -0
- litegram/types/chat_member_restricted.py +108 -0
- litegram/types/chat_member_union.py +14 -0
- litegram/types/chat_member_updated.py +1483 -0
- litegram/types/chat_permissions.py +87 -0
- litegram/types/chat_photo.py +47 -0
- litegram/types/chat_shared.py +54 -0
- litegram/types/checklist.py +55 -0
- litegram/types/checklist_task.py +60 -0
- litegram/types/checklist_tasks_added.py +39 -0
- litegram/types/checklist_tasks_done.py +46 -0
- litegram/types/chosen_inline_result.py +58 -0
- litegram/types/contact.py +51 -0
- litegram/types/copy_text_button.py +27 -0
- litegram/types/custom.py +32 -0
- litegram/types/date_time_union.py +6 -0
- litegram/types/dice.py +38 -0
- litegram/types/direct_message_price_changed.py +39 -0
- litegram/types/direct_messages_topic.py +38 -0
- litegram/types/document.py +58 -0
- litegram/types/downloadable.py +8 -0
- litegram/types/encrypted_credentials.py +31 -0
- litegram/types/encrypted_passport_element.py +74 -0
- litegram/types/error_event.py +26 -0
- litegram/types/external_reply_info.py +156 -0
- litegram/types/file.py +49 -0
- litegram/types/force_reply.py +50 -0
- litegram/types/forum_topic.py +51 -0
- litegram/types/forum_topic_closed.py +11 -0
- litegram/types/forum_topic_created.py +47 -0
- litegram/types/forum_topic_edited.py +35 -0
- litegram/types/forum_topic_reopened.py +11 -0
- litegram/types/game.py +60 -0
- litegram/types/game_high_score.py +37 -0
- litegram/types/general_forum_topic_hidden.py +11 -0
- litegram/types/general_forum_topic_unhidden.py +11 -0
- litegram/types/gift.py +88 -0
- litegram/types/gift_background.py +43 -0
- litegram/types/gift_info.py +75 -0
- litegram/types/gifts.py +30 -0
- litegram/types/giveaway.py +71 -0
- litegram/types/giveaway_completed.py +50 -0
- litegram/types/giveaway_created.py +27 -0
- litegram/types/giveaway_winners.py +84 -0
- litegram/types/inaccessible_message.py +3003 -0
- litegram/types/inline_keyboard_button.py +82 -0
- litegram/types/inline_keyboard_markup.py +35 -0
- litegram/types/inline_query.py +113 -0
- litegram/types/inline_query_result.py +34 -0
- litegram/types/inline_query_result_article.py +85 -0
- litegram/types/inline_query_result_audio.py +82 -0
- litegram/types/inline_query_result_cached_audio.py +70 -0
- litegram/types/inline_query_result_cached_document.py +78 -0
- litegram/types/inline_query_result_cached_gif.py +78 -0
- litegram/types/inline_query_result_cached_mpeg4_gif.py +78 -0
- litegram/types/inline_query_result_cached_photo.py +82 -0
- litegram/types/inline_query_result_cached_sticker.py +56 -0
- litegram/types/inline_query_result_cached_video.py +82 -0
- litegram/types/inline_query_result_cached_voice.py +74 -0
- litegram/types/inline_query_result_contact.py +80 -0
- litegram/types/inline_query_result_document.py +94 -0
- litegram/types/inline_query_result_game.py +51 -0
- litegram/types/inline_query_result_gif.py +98 -0
- litegram/types/inline_query_result_location.py +92 -0
- litegram/types/inline_query_result_mpeg4_gif.py +98 -0
- litegram/types/inline_query_result_photo.py +94 -0
- litegram/types/inline_query_result_union.py +47 -0
- litegram/types/inline_query_result_venue.py +96 -0
- litegram/types/inline_query_result_video.py +104 -0
- litegram/types/inline_query_result_voice.py +78 -0
- litegram/types/inline_query_results_button.py +41 -0
- litegram/types/input_checklist.py +59 -0
- litegram/types/input_checklist_task.py +50 -0
- litegram/types/input_contact_message_content.py +47 -0
- litegram/types/input_file.py +151 -0
- litegram/types/input_file_union.py +7 -0
- litegram/types/input_invoice_message_content.py +114 -0
- litegram/types/input_location_message_content.py +55 -0
- litegram/types/input_media.py +17 -0
- litegram/types/input_media_animation.py +82 -0
- litegram/types/input_media_audio.py +74 -0
- litegram/types/input_media_document.py +66 -0
- litegram/types/input_media_photo.py +65 -0
- litegram/types/input_media_union.py +11 -0
- litegram/types/input_media_video.py +95 -0
- litegram/types/input_message_content.py +17 -0
- litegram/types/input_message_content_union.py +17 -0
- litegram/types/input_paid_media.py +14 -0
- litegram/types/input_paid_media_photo.py +39 -0
- litegram/types/input_paid_media_union.py +8 -0
- litegram/types/input_paid_media_video.py +73 -0
- litegram/types/input_poll_option.py +47 -0
- litegram/types/input_poll_option_union.py +7 -0
- litegram/types/input_profile_photo.py +14 -0
- litegram/types/input_profile_photo_animated.py +48 -0
- litegram/types/input_profile_photo_static.py +40 -0
- litegram/types/input_profile_photo_union.py +8 -0
- litegram/types/input_sticker.py +55 -0
- litegram/types/input_story_content.py +14 -0
- litegram/types/input_story_content_photo.py +37 -0
- litegram/types/input_story_content_union.py +8 -0
- litegram/types/input_story_content_video.py +53 -0
- litegram/types/input_text_message_content.py +61 -0
- litegram/types/input_venue_message_content.py +63 -0
- litegram/types/invoice.py +51 -0
- litegram/types/keyboard_button.py +76 -0
- litegram/types/keyboard_button_poll_type.py +27 -0
- litegram/types/keyboard_button_request_chat.py +78 -0
- litegram/types/keyboard_button_request_user.py +46 -0
- litegram/types/keyboard_button_request_users.py +59 -0
- litegram/types/labeled_price.py +29 -0
- litegram/types/link_preview_options.py +52 -0
- litegram/types/location.py +55 -0
- litegram/types/location_address.py +47 -0
- litegram/types/login_url.py +50 -0
- litegram/types/mask_position.py +41 -0
- litegram/types/maybe_inaccessible_message.py +14 -0
- litegram/types/maybe_inaccessible_message_union.py +8 -0
- litegram/types/media_union.py +10 -0
- litegram/types/menu_button.py +47 -0
- litegram/types/menu_button_commands.py +33 -0
- litegram/types/menu_button_default.py +33 -0
- litegram/types/menu_button_union.py +9 -0
- litegram/types/menu_button_web_app.py +42 -0
- litegram/types/message.py +4458 -0
- litegram/types/message_auto_delete_timer_changed.py +27 -0
- litegram/types/message_entity.py +66 -0
- litegram/types/message_id.py +27 -0
- litegram/types/message_origin.py +16 -0
- litegram/types/message_origin_channel.py +56 -0
- litegram/types/message_origin_chat.py +52 -0
- litegram/types/message_origin_hidden_user.py +42 -0
- litegram/types/message_origin_union.py +10 -0
- litegram/types/message_origin_user.py +43 -0
- litegram/types/message_reaction_count_updated.py +52 -0
- litegram/types/message_reaction_updated.py +65 -0
- litegram/types/order_info.py +50 -0
- litegram/types/owned_gift.py +14 -0
- litegram/types/owned_gift_regular.py +98 -0
- litegram/types/owned_gift_union.py +8 -0
- litegram/types/owned_gift_unique.py +74 -0
- litegram/types/owned_gifts.py +41 -0
- litegram/types/paid_media.py +15 -0
- litegram/types/paid_media_info.py +38 -0
- litegram/types/paid_media_photo.py +39 -0
- litegram/types/paid_media_preview.py +42 -0
- litegram/types/paid_media_purchased.py +40 -0
- litegram/types/paid_media_union.py +9 -0
- litegram/types/paid_media_video.py +39 -0
- litegram/types/paid_message_price_changed.py +27 -0
- litegram/types/passport_data.py +39 -0
- litegram/types/passport_element_error.py +21 -0
- litegram/types/passport_element_error_data_field.py +52 -0
- litegram/types/passport_element_error_file.py +42 -0
- litegram/types/passport_element_error_files.py +48 -0
- litegram/types/passport_element_error_front_side.py +42 -0
- litegram/types/passport_element_error_reverse_side.py +42 -0
- litegram/types/passport_element_error_selfie.py +42 -0
- litegram/types/passport_element_error_translation_file.py +42 -0
- litegram/types/passport_element_error_translation_files.py +48 -0
- litegram/types/passport_element_error_union.py +27 -0
- litegram/types/passport_element_error_unspecified.py +48 -0
- litegram/types/passport_file.py +50 -0
- litegram/types/photo_size.py +51 -0
- litegram/types/poll.py +92 -0
- litegram/types/poll_answer.py +51 -0
- litegram/types/poll_option.py +46 -0
- litegram/types/pre_checkout_query.py +98 -0
- litegram/types/prepared_inline_message.py +38 -0
- litegram/types/proximity_alert_triggered.py +41 -0
- litegram/types/reaction_count.py +38 -0
- litegram/types/reaction_type.py +15 -0
- litegram/types/reaction_type_custom_emoji.py +36 -0
- litegram/types/reaction_type_emoji.py +36 -0
- litegram/types/reaction_type_paid.py +33 -0
- litegram/types/reaction_type_union.py +9 -0
- litegram/types/refunded_payment.py +51 -0
- litegram/types/reply_keyboard_markup.py +58 -0
- litegram/types/reply_keyboard_remove.py +35 -0
- litegram/types/reply_markup_union.py +10 -0
- litegram/types/reply_parameters.py +68 -0
- litegram/types/response_parameters.py +35 -0
- litegram/types/result_chat_member_union.py +14 -0
- litegram/types/result_menu_button_union.py +9 -0
- litegram/types/revenue_withdrawal_state.py +15 -0
- litegram/types/revenue_withdrawal_state_failed.py +33 -0
- litegram/types/revenue_withdrawal_state_pending.py +33 -0
- litegram/types/revenue_withdrawal_state_succeeded.py +42 -0
- litegram/types/revenue_withdrawal_state_union.py +11 -0
- litegram/types/sent_web_app_message.py +27 -0
- litegram/types/shared_user.py +54 -0
- litegram/types/shipping_address.py +55 -0
- litegram/types/shipping_option.py +41 -0
- litegram/types/shipping_query.py +90 -0
- litegram/types/star_amount.py +35 -0
- litegram/types/star_transaction.py +59 -0
- litegram/types/star_transactions.py +30 -0
- litegram/types/sticker.py +152 -0
- litegram/types/sticker_set.py +71 -0
- litegram/types/story.py +32 -0
- litegram/types/story_area.py +39 -0
- litegram/types/story_area_position.py +55 -0
- litegram/types/story_area_type.py +17 -0
- litegram/types/story_area_type_link.py +37 -0
- litegram/types/story_area_type_location.py +52 -0
- litegram/types/story_area_type_suggested_reaction.py +52 -0
- litegram/types/story_area_type_union.py +13 -0
- litegram/types/story_area_type_unique_gift.py +37 -0
- litegram/types/story_area_type_weather.py +49 -0
- litegram/types/successful_payment.py +74 -0
- litegram/types/suggested_post_approval_failed.py +39 -0
- litegram/types/suggested_post_approved.py +48 -0
- litegram/types/suggested_post_declined.py +38 -0
- litegram/types/suggested_post_info.py +42 -0
- litegram/types/suggested_post_paid.py +51 -0
- litegram/types/suggested_post_parameters.py +39 -0
- litegram/types/suggested_post_price.py +29 -0
- litegram/types/suggested_post_refunded.py +38 -0
- litegram/types/switch_inline_query_chosen_chat.py +51 -0
- litegram/types/text_quote.py +50 -0
- litegram/types/transaction_partner.py +19 -0
- litegram/types/transaction_partner_affiliate_program.py +47 -0
- litegram/types/transaction_partner_chat.py +43 -0
- litegram/types/transaction_partner_fragment.py +39 -0
- litegram/types/transaction_partner_other.py +33 -0
- litegram/types/transaction_partner_telegram_ads.py +33 -0
- litegram/types/transaction_partner_telegram_api.py +36 -0
- litegram/types/transaction_partner_union.py +21 -0
- litegram/types/transaction_partner_user.py +78 -0
- litegram/types/unique_gift.py +82 -0
- litegram/types/unique_gift_backdrop.py +41 -0
- litegram/types/unique_gift_backdrop_colors.py +47 -0
- litegram/types/unique_gift_colors.py +55 -0
- litegram/types/unique_gift_info.py +72 -0
- litegram/types/unique_gift_model.py +41 -0
- litegram/types/unique_gift_symbol.py +41 -0
- litegram/types/update.py +218 -0
- litegram/types/user.py +144 -0
- litegram/types/user_chat_boosts.py +30 -0
- litegram/types/user_profile_photos.py +38 -0
- litegram/types/user_rating.py +47 -0
- litegram/types/user_shared.py +32 -0
- litegram/types/users_shared.py +46 -0
- litegram/types/venue.py +62 -0
- litegram/types/video.py +80 -0
- litegram/types/video_chat_ended.py +27 -0
- litegram/types/video_chat_participants_invited.py +30 -0
- litegram/types/video_chat_scheduled.py +30 -0
- litegram/types/video_chat_started.py +11 -0
- litegram/types/video_note.py +58 -0
- litegram/types/voice.py +51 -0
- litegram/types/web_app_data.py +29 -0
- litegram/types/web_app_info.py +27 -0
- litegram/types/webhook_info.py +70 -0
- litegram/types/write_access_allowed.py +43 -0
- litegram/utils/__init__.py +0 -0
- litegram/utils/auth_widget.py +38 -0
- litegram/utils/backoff.py +84 -0
- litegram/utils/callback_answer.py +223 -0
- litegram/utils/chat_action.py +381 -0
- litegram/utils/chat_member.py +33 -0
- litegram/utils/class_attrs_resolver.py +91 -0
- litegram/utils/dataclass.py +41 -0
- litegram/utils/deep_linking.py +155 -0
- litegram/utils/formatting.py +708 -0
- litegram/utils/i18n/__init__.py +21 -0
- litegram/utils/i18n/context.py +26 -0
- litegram/utils/i18n/core.py +141 -0
- litegram/utils/i18n/lazy_proxy.py +16 -0
- litegram/utils/i18n/middleware.py +196 -0
- litegram/utils/keyboard.py +412 -0
- litegram/utils/link.py +76 -0
- litegram/utils/magic_filter/__init__.py +17 -0
- litegram/utils/magic_filter/attrdict.py +16 -0
- litegram/utils/magic_filter/exceptions.py +26 -0
- litegram/utils/magic_filter/helper.py +12 -0
- litegram/utils/magic_filter/magic.py +333 -0
- litegram/utils/magic_filter/operations/__init__.py +26 -0
- litegram/utils/magic_filter/operations/base.py +12 -0
- litegram/utils/magic_filter/operations/call.py +19 -0
- litegram/utils/magic_filter/operations/cast.py +22 -0
- litegram/utils/magic_filter/operations/combination.py +41 -0
- litegram/utils/magic_filter/operations/comparator.py +23 -0
- litegram/utils/magic_filter/operations/extract.py +22 -0
- litegram/utils/magic_filter/operations/function.py +37 -0
- litegram/utils/magic_filter/operations/getattr.py +20 -0
- litegram/utils/magic_filter/operations/getitem.py +27 -0
- litegram/utils/magic_filter/operations/selector.py +21 -0
- litegram/utils/magic_filter/py.typed +0 -0
- litegram/utils/magic_filter/util.py +42 -0
- litegram/utils/markdown.py +211 -0
- litegram/utils/media_group.py +364 -0
- litegram/utils/mixins.py +95 -0
- litegram/utils/mypy_hacks.py +21 -0
- litegram/utils/payload.py +114 -0
- litegram/utils/serialization.py +93 -0
- litegram/utils/text_decorations.py +271 -0
- litegram/utils/token.py +44 -0
- litegram/utils/warnings.py +9 -0
- litegram/utils/web_app.py +195 -0
- litegram/utils/web_app_signature.py +78 -0
- litegram/webhook/__init__.py +0 -0
- litegram/webhook/litestar_server.py +187 -0
- litegram/webhook/security.py +47 -0
- litegram-1.0.0.dist-info/METADATA +140 -0
- litegram-1.0.0.dist-info/RECORD +636 -0
- litegram-1.0.0.dist-info/WHEEL +4 -0
- litegram-1.0.0.dist-info/entry_points.txt +2 -0
- 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
litegram/__meta__.py
ADDED
litegram/cli/__init__.py
ADDED
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
|