rubigramclient 1.7.35__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.
- rubigramclient-1.7.35/LICENSE +22 -0
- rubigramclient-1.7.35/PKG-INFO +222 -0
- rubigramclient-1.7.35/README.md +178 -0
- rubigramclient-1.7.35/pyproject.toml +27 -0
- rubigramclient-1.7.35/rubigram/__init__.py +19 -0
- rubigramclient-1.7.35/rubigram/ask.py +145 -0
- rubigramclient-1.7.35/rubigram/bot/__init__.py +2 -0
- rubigramclient-1.7.35/rubigram/bot/bot.py +255 -0
- rubigramclient-1.7.35/rubigram/bot/dispatcher.py +58 -0
- rubigramclient-1.7.35/rubigram/bot/enums/__init__.py +51 -0
- rubigramclient-1.7.35/rubigram/bot/enums/buttons/__init__.py +13 -0
- rubigramclient-1.7.35/rubigram/bot/enums/buttons/button_calendar_type.py +11 -0
- rubigramclient-1.7.35/rubigram/bot/enums/buttons/button_location_type.py +11 -0
- rubigramclient-1.7.35/rubigram/bot/enums/buttons/button_selection_get_type.py +11 -0
- rubigramclient-1.7.35/rubigram/bot/enums/buttons/button_selection_search_type.py +11 -0
- rubigramclient-1.7.35/rubigram/bot/enums/buttons/button_selection_type.py +12 -0
- rubigramclient-1.7.35/rubigram/bot/enums/buttons/button_textbox_type_keypad.py +11 -0
- rubigramclient-1.7.35/rubigram/bot/enums/buttons/button_textbox_type_line.py +11 -0
- rubigramclient-1.7.35/rubigram/bot/enums/buttons/button_type.py +30 -0
- rubigramclient-1.7.35/rubigram/bot/enums/chat_keypad_type.py +12 -0
- rubigramclient-1.7.35/rubigram/bot/enums/chat_type.py +13 -0
- rubigramclient-1.7.35/rubigram/bot/enums/file_type.py +16 -0
- rubigramclient-1.7.35/rubigram/bot/enums/forwarded_from_type.py +12 -0
- rubigramclient-1.7.35/rubigram/bot/enums/live_location_status.py +11 -0
- rubigramclient-1.7.35/rubigram/bot/enums/message_sender_type.py +11 -0
- rubigramclient-1.7.35/rubigram/bot/enums/metadata_type.py +18 -0
- rubigramclient-1.7.35/rubigram/bot/enums/parse_mode.py +11 -0
- rubigramclient-1.7.35/rubigram/bot/enums/payment_status_type.py +11 -0
- rubigramclient-1.7.35/rubigram/bot/enums/poll_status_type.py +11 -0
- rubigramclient-1.7.35/rubigram/bot/enums/update_endpoint_type.py +14 -0
- rubigramclient-1.7.35/rubigram/bot/enums/update_type.py +15 -0
- rubigramclient-1.7.35/rubigram/bot/errors/__init__.py +2 -0
- rubigramclient-1.7.35/rubigram/bot/errors/api_error.py +12 -0
- rubigramclient-1.7.35/rubigram/bot/errors/errors.py +34 -0
- rubigramclient-1.7.35/rubigram/bot/filters/__init__.py +1 -0
- rubigramclient-1.7.35/rubigram/bot/filters/filters.py +458 -0
- rubigramclient-1.7.35/rubigram/bot/handlers/__init__.py +14 -0
- rubigramclient-1.7.35/rubigram/bot/handlers/delete_message_handler.py +14 -0
- rubigramclient-1.7.35/rubigram/bot/handlers/edit_message_handler.py +14 -0
- rubigramclient-1.7.35/rubigram/bot/handlers/handler.py +41 -0
- rubigramclient-1.7.35/rubigram/bot/handlers/inline_query_handler.py +14 -0
- rubigramclient-1.7.35/rubigram/bot/handlers/message_handler.py +14 -0
- rubigramclient-1.7.35/rubigram/bot/handlers/start_bot_handler.py +14 -0
- rubigramclient-1.7.35/rubigram/bot/handlers/start_handler.py +14 -0
- rubigramclient-1.7.35/rubigram/bot/handlers/stop_bot_handler.py +14 -0
- rubigramclient-1.7.35/rubigram/bot/handlers/stop_handler.py +14 -0
- rubigramclient-1.7.35/rubigram/bot/methods/__init__.py +26 -0
- rubigramclient-1.7.35/rubigram/bot/methods/advanced/__init__.py +7 -0
- rubigramclient-1.7.35/rubigram/bot/methods/advanced/invoke.py +38 -0
- rubigramclient-1.7.35/rubigram/bot/methods/chat/__init__.py +18 -0
- rubigramclient-1.7.35/rubigram/bot/methods/chat/ban_chat_member.py +28 -0
- rubigramclient-1.7.35/rubigram/bot/methods/chat/get_chat.py +28 -0
- rubigramclient-1.7.35/rubigram/bot/methods/chat/get_chat_member.py +28 -0
- rubigramclient-1.7.35/rubigram/bot/methods/chat/unban_chat_member.py +28 -0
- rubigramclient-1.7.35/rubigram/bot/methods/decorators/__init__.py +17 -0
- rubigramclient-1.7.35/rubigram/bot/methods/decorators/on_deleted_message.py +24 -0
- rubigramclient-1.7.35/rubigram/bot/methods/decorators/on_edited_message.py +24 -0
- rubigramclient-1.7.35/rubigram/bot/methods/decorators/on_inline_query.py +24 -0
- rubigramclient-1.7.35/rubigram/bot/methods/decorators/on_message.py +34 -0
- rubigramclient-1.7.35/rubigram/bot/methods/decorators/on_start.py +24 -0
- rubigramclient-1.7.35/rubigram/bot/methods/decorators/on_started_bot.py +24 -0
- rubigramclient-1.7.35/rubigram/bot/methods/decorators/on_stop.py +24 -0
- rubigramclient-1.7.35/rubigram/bot/methods/decorators/on_stopped_bot.py +24 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/__init__.py +57 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/auto_delete_message.py +41 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/delete_messages.py +33 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/download_file.py +52 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/edit_chat_keypad.py +23 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/edit_message.py +32 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/edit_message_keypad.py +21 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/edit_message_text.py +32 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/forward_message.py +34 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/get_file.py +29 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/remove_chat_keypad.py +15 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/request_send_file.py +40 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/send_contact.py +47 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/send_file.py +67 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/send_gif.py +40 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/send_location.py +47 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/send_message.py +50 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/send_music.py +40 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/send_photo.py +40 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/send_poll.py +47 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/send_sticker.py +45 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/send_video.py +40 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/send_voice.py +40 -0
- rubigramclient-1.7.35/rubigram/bot/methods/messages/upload.py +56 -0
- rubigramclient-1.7.35/rubigram/bot/methods/settings/__init__.py +14 -0
- rubigramclient-1.7.35/rubigram/bot/methods/settings/set_bot_command.py +20 -0
- rubigramclient-1.7.35/rubigram/bot/methods/settings/update_bot_endpoint.py +16 -0
- rubigramclient-1.7.35/rubigram/bot/methods/updates/__init__.py +12 -0
- rubigramclient-1.7.35/rubigram/bot/methods/updates/get_update.py +22 -0
- rubigramclient-1.7.35/rubigram/bot/methods/user/__init__.py +7 -0
- rubigramclient-1.7.35/rubigram/bot/methods/user/get_me.py +26 -0
- rubigramclient-1.7.35/rubigram/bot/methods/utilities/__init__.py +20 -0
- rubigramclient-1.7.35/rubigram/bot/methods/utilities/add_handler.py +23 -0
- rubigramclient-1.7.35/rubigram/bot/methods/utilities/remove_handler.py +16 -0
- rubigramclient-1.7.35/rubigram/bot/methods/utilities/run.py +89 -0
- rubigramclient-1.7.35/rubigram/bot/methods/utilities/start.py +26 -0
- rubigramclient-1.7.35/rubigram/bot/methods/utilities/stop.py +24 -0
- rubigramclient-1.7.35/rubigram/bot/types/__init__.py +67 -0
- rubigramclient-1.7.35/rubigram/bot/types/aux_data.py +29 -0
- rubigramclient-1.7.35/rubigram/bot/types/base/__init__.py +6 -0
- rubigramclient-1.7.35/rubigram/bot/types/base/base.py +33 -0
- rubigramclient-1.7.35/rubigram/bot/types/bot.py +46 -0
- rubigramclient-1.7.35/rubigram/bot/types/bot_command.py +29 -0
- rubigramclient-1.7.35/rubigram/bot/types/buttons/__init__.py +13 -0
- rubigramclient-1.7.35/rubigram/bot/types/buttons/button.py +49 -0
- rubigramclient-1.7.35/rubigram/bot/types/buttons/button_calendar.py +33 -0
- rubigramclient-1.7.35/rubigram/bot/types/buttons/button_location.py +34 -0
- rubigramclient-1.7.35/rubigram/bot/types/buttons/button_number_picker.py +30 -0
- rubigramclient-1.7.35/rubigram/bot/types/buttons/button_selection.py +37 -0
- rubigramclient-1.7.35/rubigram/bot/types/buttons/button_selection_item.py +29 -0
- rubigramclient-1.7.35/rubigram/bot/types/buttons/button_string_picker.py +28 -0
- rubigramclient-1.7.35/rubigram/bot/types/buttons/button_text_box.py +33 -0
- rubigramclient-1.7.35/rubigram/bot/types/chat.py +50 -0
- rubigramclient-1.7.35/rubigram/bot/types/contact_message.py +32 -0
- rubigramclient-1.7.35/rubigram/bot/types/file.py +73 -0
- rubigramclient-1.7.35/rubigram/bot/types/forwarded_from.py +37 -0
- rubigramclient-1.7.35/rubigram/bot/types/keypads/__init__.py +7 -0
- rubigramclient-1.7.35/rubigram/bot/types/keypads/keypad.py +33 -0
- rubigramclient-1.7.35/rubigram/bot/types/keypads/keypad_row.py +27 -0
- rubigramclient-1.7.35/rubigram/bot/types/live_location.py +47 -0
- rubigramclient-1.7.35/rubigram/bot/types/location.py +29 -0
- rubigramclient-1.7.35/rubigram/bot/types/messages/__init__.py +7 -0
- rubigramclient-1.7.35/rubigram/bot/types/messages/inline_message.py +73 -0
- rubigramclient-1.7.35/rubigram/bot/types/messages/message.py +184 -0
- rubigramclient-1.7.35/rubigram/bot/types/metadata/__init__.py +7 -0
- rubigramclient-1.7.35/rubigram/bot/types/metadata/metadata.py +29 -0
- rubigramclient-1.7.35/rubigram/bot/types/metadata/metadata_parts.py +39 -0
- rubigramclient-1.7.35/rubigram/bot/types/payment_status.py +32 -0
- rubigramclient-1.7.35/rubigram/bot/types/poll.py +35 -0
- rubigramclient-1.7.35/rubigram/bot/types/poll_status.py +40 -0
- rubigramclient-1.7.35/rubigram/bot/types/propagation.py +9 -0
- rubigramclient-1.7.35/rubigram/bot/types/sticker.py +35 -0
- rubigramclient-1.7.35/rubigram/bot/types/updates/__init__.py +7 -0
- rubigramclient-1.7.35/rubigram/bot/types/updates/update.py +119 -0
- rubigramclient-1.7.35/rubigram/bot/types/updates/updates.py +31 -0
- rubigramclient-1.7.35/rubigram/bot/web/__init__.py +2 -0
- rubigramclient-1.7.35/rubigram/bot/web/webhook.py +89 -0
- rubigramclient-1.7.35/rubigram/bot/web/websocket.py +5 -0
- rubigramclient-1.7.35/rubigram/client.py +440 -0
- rubigramclient-1.7.35/rubigram/connection/__init__.py +6 -0
- rubigramclient-1.7.35/rubigram/connection/connection.py +77 -0
- rubigramclient-1.7.35/rubigram/crypto/__init__.py +1 -0
- rubigramclient-1.7.35/rubigram/crypto/crypto.py +144 -0
- rubigramclient-1.7.35/rubigram/dispatcher.py +59 -0
- rubigramclient-1.7.35/rubigram/enums/__init__.py +4 -0
- rubigramclient-1.7.35/rubigram/enums/auth/__init__.py +3 -0
- rubigramclient-1.7.35/rubigram/enums/auth/sent_code_status.py +7 -0
- rubigramclient-1.7.35/rubigram/enums/auth/sent_code_type.py +7 -0
- rubigramclient-1.7.35/rubigram/enums/auth/sign_in_status.py +8 -0
- rubigramclient-1.7.35/rubigram/enums/chats/__init__.py +26 -0
- rubigramclient-1.7.35/rubigram/enums/chats/chat_access.py +24 -0
- rubigramclient-1.7.35/rubigram/enums/chats/chat_message.py +7 -0
- rubigramclient-1.7.35/rubigram/enums/chats/chat_reaction.py +7 -0
- rubigramclient-1.7.35/rubigram/enums/chats/chat_status.py +9 -0
- rubigramclient-1.7.35/rubigram/enums/chats/chat_type.py +9 -0
- rubigramclient-1.7.35/rubigram/enums/chats/chat_update.py +7 -0
- rubigramclient-1.7.35/rubigram/enums/chats/folder_exclude.py +7 -0
- rubigramclient-1.7.35/rubigram/enums/chats/folder_include.py +10 -0
- rubigramclient-1.7.35/rubigram/enums/chats/folder_type.py +6 -0
- rubigramclient-1.7.35/rubigram/enums/chats/voice_chat_action.py +7 -0
- rubigramclient-1.7.35/rubigram/enums/chats/voice_chat_status.py +7 -0
- rubigramclient-1.7.35/rubigram/enums/messages/__init__.py +5 -0
- rubigramclient-1.7.35/rubigram/enums/messages/file_type.py +13 -0
- rubigramclient-1.7.35/rubigram/enums/messages/live_status_type.py +5 -0
- rubigramclient-1.7.35/rubigram/enums/messages/message_action.py +7 -0
- rubigramclient-1.7.35/rubigram/enums/messages/message_type.py +17 -0
- rubigramclient-1.7.35/rubigram/enums/messages/notification_type.py +5 -0
- rubigramclient-1.7.35/rubigram/enums/setting/__init__.py +4 -0
- rubigramclient-1.7.35/rubigram/enums/setting/online_time_type.py +6 -0
- rubigramclient-1.7.35/rubigram/enums/setting/parse_mode.py +6 -0
- rubigramclient-1.7.35/rubigram/enums/setting/platform.py +8 -0
- rubigramclient-1.7.35/rubigram/enums/setting/run_type.py +6 -0
- rubigramclient-1.7.35/rubigram/errors/__init__.py +2 -0
- rubigramclient-1.7.35/rubigram/errors/errors.py +86 -0
- rubigramclient-1.7.35/rubigram/errors/rpc_error.py +14 -0
- rubigramclient-1.7.35/rubigram/filters/__init__.py +2 -0
- rubigramclient-1.7.35/rubigram/filters/filter.py +109 -0
- rubigramclient-1.7.35/rubigram/filters/filters.py +255 -0
- rubigramclient-1.7.35/rubigram/handlers/__init__.py +11 -0
- rubigramclient-1.7.35/rubigram/handlers/connect_handler.py +14 -0
- rubigramclient-1.7.35/rubigram/handlers/disconnect_handler.py +14 -0
- rubigramclient-1.7.35/rubigram/handlers/handler.py +89 -0
- rubigramclient-1.7.35/rubigram/handlers/message_handler.py +14 -0
- rubigramclient-1.7.35/rubigram/handlers/start_handler.py +14 -0
- rubigramclient-1.7.35/rubigram/handlers/stop_handler.py +14 -0
- rubigramclient-1.7.35/rubigram/listener.py +162 -0
- rubigramclient-1.7.35/rubigram/methods/__init__.py +21 -0
- rubigramclient-1.7.35/rubigram/methods/advanced/__init__.py +13 -0
- rubigramclient-1.7.35/rubigram/methods/advanced/invoke.py +67 -0
- rubigramclient-1.7.35/rubigram/methods/advanced/request_send_file.py +21 -0
- rubigramclient-1.7.35/rubigram/methods/advanced/upload.py +157 -0
- rubigramclient-1.7.35/rubigram/methods/advanced/websocket.py +235 -0
- rubigramclient-1.7.35/rubigram/methods/auth/__init__.py +13 -0
- rubigramclient-1.7.35/rubigram/methods/auth/logout.py +8 -0
- rubigramclient-1.7.35/rubigram/methods/auth/register_device.py +24 -0
- rubigramclient-1.7.35/rubigram/methods/auth/send_code.py +33 -0
- rubigramclient-1.7.35/rubigram/methods/auth/sign_in.py +34 -0
- rubigramclient-1.7.35/rubigram/methods/chats/__init__.py +45 -0
- rubigramclient-1.7.35/rubigram/methods/chats/action_on_join_request.py +20 -0
- rubigramclient-1.7.35/rubigram/methods/chats/add_channel.py +23 -0
- rubigramclient-1.7.35/rubigram/methods/chats/add_group.py +21 -0
- rubigramclient-1.7.35/rubigram/methods/chats/ban_group_member.py +23 -0
- rubigramclient-1.7.35/rubigram/methods/chats/ban_member.py +13 -0
- rubigramclient-1.7.35/rubigram/methods/chats/delete_chat_history.py +13 -0
- rubigramclient-1.7.35/rubigram/methods/chats/edit_group_info.py +5 -0
- rubigramclient-1.7.35/rubigram/methods/chats/get_banned_group_members.py +13 -0
- rubigramclient-1.7.35/rubigram/methods/chats/get_chat_info.py +14 -0
- rubigramclient-1.7.35/rubigram/methods/chats/get_chats.py +11 -0
- rubigramclient-1.7.35/rubigram/methods/chats/get_chats_updates.py +13 -0
- rubigramclient-1.7.35/rubigram/methods/chats/get_group_admin_members.py +14 -0
- rubigramclient-1.7.35/rubigram/methods/chats/get_group_link.py +9 -0
- rubigramclient-1.7.35/rubigram/methods/chats/get_join_requests.py +9 -0
- rubigramclient-1.7.35/rubigram/methods/chats/join_channel.py +29 -0
- rubigramclient-1.7.35/rubigram/methods/chats/join_group.py +12 -0
- rubigramclient-1.7.35/rubigram/methods/chats/leave_group.py +14 -0
- rubigramclient-1.7.35/rubigram/methods/chats/set_channel_admin.py +86 -0
- rubigramclient-1.7.35/rubigram/methods/chats/set_group_admin.py +82 -0
- rubigramclient-1.7.35/rubigram/methods/chats/update_channel_username.py +14 -0
- rubigramclient-1.7.35/rubigram/methods/decorators/__init__.py +15 -0
- rubigramclient-1.7.35/rubigram/methods/decorators/on_chat_update.py +0 -0
- rubigramclient-1.7.35/rubigram/methods/decorators/on_connect.py +20 -0
- rubigramclient-1.7.35/rubigram/methods/decorators/on_delete_message.py +0 -0
- rubigramclient-1.7.35/rubigram/methods/decorators/on_disconnect.py +20 -0
- rubigramclient-1.7.35/rubigram/methods/decorators/on_edit_message.py +0 -0
- rubigramclient-1.7.35/rubigram/methods/decorators/on_message.py +34 -0
- rubigramclient-1.7.35/rubigram/methods/decorators/on_message_update.py +0 -0
- rubigramclient-1.7.35/rubigram/methods/decorators/on_sotp.py +13 -0
- rubigramclient-1.7.35/rubigram/methods/decorators/on_start.py +13 -0
- rubigramclient-1.7.35/rubigram/methods/decorators/on_update.py +0 -0
- rubigramclient-1.7.35/rubigram/methods/messages/__init__.py +30 -0
- rubigramclient-1.7.35/rubigram/methods/messages/auto_delete_message.py +41 -0
- rubigramclient-1.7.35/rubigram/methods/messages/delete_messages.py +21 -0
- rubigramclient-1.7.35/rubigram/methods/messages/edit_message.py +29 -0
- rubigramclient-1.7.35/rubigram/methods/messages/forward_messages.py +27 -0
- rubigramclient-1.7.35/rubigram/methods/messages/get_link_from_app_url.py +11 -0
- rubigramclient-1.7.35/rubigram/methods/messages/get_message_share_url.py +13 -0
- rubigramclient-1.7.35/rubigram/methods/messages/get_messages.py +49 -0
- rubigramclient-1.7.35/rubigram/methods/messages/get_messages_by_id.py +18 -0
- rubigramclient-1.7.35/rubigram/methods/messages/get_messages_interval.py +13 -0
- rubigramclient-1.7.35/rubigram/methods/messages/get_messages_updates.py +15 -0
- rubigramclient-1.7.35/rubigram/methods/messages/send_file.py +108 -0
- rubigramclient-1.7.35/rubigram/methods/messages/send_live.py +46 -0
- rubigramclient-1.7.35/rubigram/methods/messages/send_message.py +35 -0
- rubigramclient-1.7.35/rubigram/methods/settings/__init__.py +7 -0
- rubigramclient-1.7.35/rubigram/methods/settings/update_profile.py +31 -0
- rubigramclient-1.7.35/rubigram/methods/updates/__init__.py +7 -0
- rubigramclient-1.7.35/rubigram/methods/users/__init__.py +13 -0
- rubigramclient-1.7.35/rubigram/methods/users/get_contacts.py +12 -0
- rubigramclient-1.7.35/rubigram/methods/users/get_me.py +9 -0
- rubigramclient-1.7.35/rubigram/methods/users/get_user_info.py +13 -0
- rubigramclient-1.7.35/rubigram/methods/users/update_username.py +13 -0
- rubigramclient-1.7.35/rubigram/methods/utilities/__init__.py +23 -0
- rubigramclient-1.7.35/rubigram/methods/utilities/add_handler.py +33 -0
- rubigramclient-1.7.35/rubigram/methods/utilities/connect.py +15 -0
- rubigramclient-1.7.35/rubigram/methods/utilities/dsiconnect.py +15 -0
- rubigramclient-1.7.35/rubigram/methods/utilities/get_updates.py +25 -0
- rubigramclient-1.7.35/rubigram/methods/utilities/polling.py +38 -0
- rubigramclient-1.7.35/rubigram/methods/utilities/remvoe_handler.py +33 -0
- rubigramclient-1.7.35/rubigram/methods/utilities/run.py +38 -0
- rubigramclient-1.7.35/rubigram/methods/utilities/start.py +29 -0
- rubigramclient-1.7.35/rubigram/methods/utilities/stop.py +25 -0
- rubigramclient-1.7.35/rubigram/parser/__init__.py +1 -0
- rubigramclient-1.7.35/rubigram/parser/markdown.py +152 -0
- rubigramclient-1.7.35/rubigram/parser/parser.py +21 -0
- rubigramclient-1.7.35/rubigram/server/__init__.py +1 -0
- rubigramclient-1.7.35/rubigram/server/server.py +93 -0
- rubigramclient-1.7.35/rubigram/session/__init__.py +0 -0
- rubigramclient-1.7.35/rubigram/session/json.py +4 -0
- rubigramclient-1.7.35/rubigram/session/session.py +0 -0
- rubigramclient-1.7.35/rubigram/storage/__init__.py +6 -0
- rubigramclient-1.7.35/rubigram/storage/storage.py +50 -0
- rubigramclient-1.7.35/rubigram/sync.py +94 -0
- rubigramclient-1.7.35/rubigram/types/__init__.py +18 -0
- rubigramclient-1.7.35/rubigram/types/auth/__init__.py +8 -0
- rubigramclient-1.7.35/rubigram/types/auth/sent_code.py +73 -0
- rubigramclient-1.7.35/rubigram/types/auth/sign_in.py +58 -0
- rubigramclient-1.7.35/rubigram/types/avatar.py +27 -0
- rubigramclient-1.7.35/rubigram/types/base/__init__.py +9 -0
- rubigramclient-1.7.35/rubigram/types/base/base.py +26 -0
- rubigramclient-1.7.35/rubigram/types/chats/__init__.py +16 -0
- rubigramclient-1.7.35/rubigram/types/chats/chat.py +77 -0
- rubigramclient-1.7.35/rubigram/types/chats/chat_message.py +55 -0
- rubigramclient-1.7.35/rubigram/types/chats/chat_update.py +33 -0
- rubigramclient-1.7.35/rubigram/types/chats/get_chats.py +27 -0
- rubigramclient-1.7.35/rubigram/types/keypad.py +21 -0
- rubigramclient-1.7.35/rubigram/types/keypad_row.py +9 -0
- rubigramclient-1.7.35/rubigram/types/messages/__init__.py +36 -0
- rubigramclient-1.7.35/rubigram/types/messages/badge.py +18 -0
- rubigramclient-1.7.35/rubigram/types/messages/contact_message.py +25 -0
- rubigramclient-1.7.35/rubigram/types/messages/file_inline.py +44 -0
- rubigramclient-1.7.35/rubigram/types/messages/forwarded_from.py +22 -0
- rubigramclient-1.7.35/rubigram/types/messages/last_message.py +28 -0
- rubigramclient-1.7.35/rubigram/types/messages/live_data.py +24 -0
- rubigramclient-1.7.35/rubigram/types/messages/live_status.py +24 -0
- rubigramclient-1.7.35/rubigram/types/messages/location.py +22 -0
- rubigramclient-1.7.35/rubigram/types/messages/map_view.py +23 -0
- rubigramclient-1.7.35/rubigram/types/messages/message.py +75 -0
- rubigramclient-1.7.35/rubigram/types/messages/message_data.py +20 -0
- rubigramclient-1.7.35/rubigram/types/messages/message_info.py +33 -0
- rubigramclient-1.7.35/rubigram/types/messages/message_update.py +40 -0
- rubigramclient-1.7.35/rubigram/types/messages/rubino_post.py +21 -0
- rubigramclient-1.7.35/rubigram/types/messages/sticker.py +26 -0
- rubigramclient-1.7.35/rubigram/types/messages/sticker_file.py +27 -0
- rubigramclient-1.7.35/rubigram/types/online_time.py +20 -0
- rubigramclient-1.7.35/rubigram/types/server/__init__.py +8 -0
- rubigramclient-1.7.35/rubigram/types/server/request_send_file.py +32 -0
- rubigramclient-1.7.35/rubigram/types/server/upload_file.py +16 -0
- rubigramclient-1.7.35/rubigram/types/settings/__init__.py +8 -0
- rubigramclient-1.7.35/rubigram/types/settings/session.py +67 -0
- rubigramclient-1.7.35/rubigram/types/settings/sessions_info.py +27 -0
- rubigramclient-1.7.35/rubigram/types/stories/__init__.py +6 -0
- rubigramclient-1.7.35/rubigram/types/stories/story.py +17 -0
- rubigramclient-1.7.35/rubigram/types/updates/__init__.py +10 -0
- rubigramclient-1.7.35/rubigram/types/updates/notification.py +27 -0
- rubigramclient-1.7.35/rubigram/types/updates/update.py +71 -0
- rubigramclient-1.7.35/rubigram/types/updates/update_parametrs.py +27 -0
- rubigramclient-1.7.35/rubigram/types/users/__init__.py +11 -0
- rubigramclient-1.7.35/rubigram/types/users/user.py +61 -0
- rubigramclient-1.7.35/rubigram/types/users/user_info.py +107 -0
- rubigramclient-1.7.35/rubigram/types/warnings/__init__.py +7 -0
- rubigramclient-1.7.35/rubigram/types/warnings/color.py +21 -0
- rubigramclient-1.7.35/rubigram/types/warnings/warning.py +25 -0
- rubigramclient-1.7.35/rubigram/utils/__init__.py +1 -0
- rubigramclient-1.7.35/rubigram/utils/utils.py +278 -0
- rubigramclient-1.7.35/rubigramclient.egg-info/PKG-INFO +222 -0
- rubigramclient-1.7.35/rubigramclient.egg-info/SOURCES.txt +331 -0
- rubigramclient-1.7.35/rubigramclient.egg-info/dependency_links.txt +1 -0
- rubigramclient-1.7.35/rubigramclient.egg-info/requires.txt +7 -0
- rubigramclient-1.7.35/rubigramclient.egg-info/top_level.txt +1 -0
- rubigramclient-1.7.35/setup.cfg +4 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2025 Javad
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rubigramclient
|
|
3
|
+
Version: 1.7.35
|
|
4
|
+
Summary: A simple and flexible Python library for building advanced Rubika bots with powerful message handling, inline buttons, and custom filters.
|
|
5
|
+
Author-email: Javad <MrJavad.Email@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2025 Javad
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Project-URL: GitHub, https://github.com/DevJavad/rubigram
|
|
30
|
+
Classifier: Programming Language :: Python :: 3
|
|
31
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
32
|
+
Classifier: Operating System :: OS Independent
|
|
33
|
+
Requires-Python: >=3.4
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
License-File: LICENSE
|
|
36
|
+
Requires-Dist: aiohttp
|
|
37
|
+
Requires-Dist: aiofiles
|
|
38
|
+
Requires-Dist: aiocache
|
|
39
|
+
Requires-Dist: markdownify
|
|
40
|
+
Requires-Dist: filetype
|
|
41
|
+
Requires-Dist: pycryptodome
|
|
42
|
+
Requires-Dist: mutagen
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
<p align="center">
|
|
46
|
+
<img src="http://rubigram.ir/rubigram.jpg" alt="Rubigram" width="200"/>
|
|
47
|
+
</p>
|
|
48
|
+
<p align="center">
|
|
49
|
+
<strong> Python library for rubika API</strong>
|
|
50
|
+
</p>
|
|
51
|
+
<p align="center">
|
|
52
|
+
<a href="https://pypi.org/project/RubigramClient">
|
|
53
|
+
<img src="https://img.shields.io/pypi/v/RubigramClient?style=flat-square" alt="PyPI">
|
|
54
|
+
</a>
|
|
55
|
+
<a href="http://rubigram.ir/doc">
|
|
56
|
+
<img src="https://img.shields.io/badge/docs-online-blue?style=flat-square" alt="Documentation">
|
|
57
|
+
</a>
|
|
58
|
+
</p>
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
# Rubigram
|
|
62
|
+
Rubigram is a powerful asynchronous Python framework for **building advanced bots on Rubika**, offering features like concurrent message handling, advanced filtering, and support for both webhooks and polling.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## Features
|
|
66
|
+
- Asynchronous and fast: handle multiple messages concurrently.
|
|
67
|
+
- Advanced filters for private chats, commands, and text messages.
|
|
68
|
+
- Easy message and media sending (text, images, videos, files).
|
|
69
|
+
- Support for both **webhooks** and **polling**.
|
|
70
|
+
- Interactive keyboards and buttons for better user engagement.
|
|
71
|
+
- Flexible integration with databases for storing settings and data.
|
|
72
|
+
|
|
73
|
+
## Start
|
|
74
|
+
```python
|
|
75
|
+
from rubigram import Client, filters
|
|
76
|
+
from rubigram.types import Update
|
|
77
|
+
|
|
78
|
+
client = Client("bot_token")
|
|
79
|
+
|
|
80
|
+
@client.on_message(filters.command("start"))
|
|
81
|
+
async def start(client: Client, update: Update):
|
|
82
|
+
await update.reply("||Hello|| __from__ **Rubigram!**")
|
|
83
|
+
|
|
84
|
+
client.run()
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Button and Keypad
|
|
88
|
+
```python
|
|
89
|
+
from rubigram import Client, filters
|
|
90
|
+
from rubigram.enums import ChatKeypadType
|
|
91
|
+
from rubigram.types import Update, Keypad, Button, KeypadRow
|
|
92
|
+
|
|
93
|
+
client = Client("bot_token")
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@client.on_message(filters.photo)
|
|
97
|
+
async def start(client: Client, update: Update):
|
|
98
|
+
button_1 = Button("send", "send Photo")
|
|
99
|
+
button_2 = Button("save", "Save Photo")
|
|
100
|
+
row = KeypadRow([button_1, button_2])
|
|
101
|
+
keypad = Keypad([row])
|
|
102
|
+
await update.reply(
|
|
103
|
+
"Select your action:",
|
|
104
|
+
chat_keypad=keypad,
|
|
105
|
+
chat_keypad_type=ChatKeypadType.NEW
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
client.run()
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Use webhook and Get inline button data
|
|
112
|
+
```python
|
|
113
|
+
from rubigram import Client, Server, filters
|
|
114
|
+
from rubigram.types import (
|
|
115
|
+
Update,
|
|
116
|
+
Button,
|
|
117
|
+
Keypad,
|
|
118
|
+
KeypadRow,
|
|
119
|
+
InlineMessage
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
client = Client(token="bot_token")
|
|
124
|
+
server = Server(client, "webhook_url")
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
@client.on_message(filters.photo)
|
|
128
|
+
async def start(client: Client, update: Update):
|
|
129
|
+
button_1 = Button("send", "send Photo")
|
|
130
|
+
button_2 = Button("save", "Save Photo")
|
|
131
|
+
row = KeypadRow([button_1, button_2])
|
|
132
|
+
keypad = Keypad([row])
|
|
133
|
+
await update.reply("Select your action:", inline_keypad=keypad)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
@client.on_inline_message(filters.button(["send", "save"]))
|
|
137
|
+
async def inline_message(client: Client, message: InlineMessage):
|
|
138
|
+
button_id = message.aux_data.button_id
|
|
139
|
+
if button_id == "send":
|
|
140
|
+
await message.answer("You clicked the send button")
|
|
141
|
+
else:
|
|
142
|
+
await message.answer("You clicked the save button")
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@client.on_start()
|
|
146
|
+
async def start(client):
|
|
147
|
+
print("Start bot ....")
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
@client.on_stop()
|
|
151
|
+
async def stop(client):
|
|
152
|
+
print("Stop bot")
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
server.run_server()
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Auto state and save tmp data in cache
|
|
159
|
+
```python
|
|
160
|
+
from rubigram import Client, Storage, filters
|
|
161
|
+
from rubigram.types import Update
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
storage = Storage(ttl=120)
|
|
165
|
+
client = Client("bot_token", storage=storage) # You can leave the `storage` parametr empty
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
@client.on_message(filters.command("start") & filters.private)
|
|
169
|
+
async def start(client: Client, update: Update):
|
|
170
|
+
state = client.state(update.chat_id)
|
|
171
|
+
await state.set("name")
|
|
172
|
+
await update.reply("Send your name:")
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
@client.on_message(filters.state("name") & filters.text & filters.private)
|
|
176
|
+
async def save_name(client: Client, update: Update):
|
|
177
|
+
state = client.state(update.chat_id)
|
|
178
|
+
await state.set("email", name=update.text)
|
|
179
|
+
await update.reply("Send your Email:")
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
@client.on_message(filters.state("email") & filters.text & filters.private)
|
|
183
|
+
async def save_email(client: Client, update: Update):
|
|
184
|
+
state = client.state(update.chat_id)
|
|
185
|
+
data = await state.get()
|
|
186
|
+
print(data)
|
|
187
|
+
await state.delete()
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
client.run()
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
## Implementation of multiple programs
|
|
195
|
+
```python
|
|
196
|
+
from rubigram import Client
|
|
197
|
+
import asyncio
|
|
198
|
+
|
|
199
|
+
tokens = ["TOKEN_1", "TOKEN_2"]
|
|
200
|
+
|
|
201
|
+
async def main():
|
|
202
|
+
for token in tokens:
|
|
203
|
+
async with Client(token) as client:
|
|
204
|
+
info = await client.get_me()
|
|
205
|
+
print(info)
|
|
206
|
+
|
|
207
|
+
asyncio.run(main())
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Rubino
|
|
211
|
+
```python
|
|
212
|
+
from rubigram.rubino import Rubino
|
|
213
|
+
import asyncio
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
async def main():
|
|
217
|
+
async with Rubino(auth="auth_account") as client:
|
|
218
|
+
info = await client.get_my_profile_info()
|
|
219
|
+
print(info)
|
|
220
|
+
|
|
221
|
+
asyncio.run(main())
|
|
222
|
+
```
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="http://rubigram.ir/rubigram.jpg" alt="Rubigram" width="200"/>
|
|
3
|
+
</p>
|
|
4
|
+
<p align="center">
|
|
5
|
+
<strong> Python library for rubika API</strong>
|
|
6
|
+
</p>
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://pypi.org/project/RubigramClient">
|
|
9
|
+
<img src="https://img.shields.io/pypi/v/RubigramClient?style=flat-square" alt="PyPI">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="http://rubigram.ir/doc">
|
|
12
|
+
<img src="https://img.shields.io/badge/docs-online-blue?style=flat-square" alt="Documentation">
|
|
13
|
+
</a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# Rubigram
|
|
18
|
+
Rubigram is a powerful asynchronous Python framework for **building advanced bots on Rubika**, offering features like concurrent message handling, advanced filtering, and support for both webhooks and polling.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
- Asynchronous and fast: handle multiple messages concurrently.
|
|
23
|
+
- Advanced filters for private chats, commands, and text messages.
|
|
24
|
+
- Easy message and media sending (text, images, videos, files).
|
|
25
|
+
- Support for both **webhooks** and **polling**.
|
|
26
|
+
- Interactive keyboards and buttons for better user engagement.
|
|
27
|
+
- Flexible integration with databases for storing settings and data.
|
|
28
|
+
|
|
29
|
+
## Start
|
|
30
|
+
```python
|
|
31
|
+
from rubigram import Client, filters
|
|
32
|
+
from rubigram.types import Update
|
|
33
|
+
|
|
34
|
+
client = Client("bot_token")
|
|
35
|
+
|
|
36
|
+
@client.on_message(filters.command("start"))
|
|
37
|
+
async def start(client: Client, update: Update):
|
|
38
|
+
await update.reply("||Hello|| __from__ **Rubigram!**")
|
|
39
|
+
|
|
40
|
+
client.run()
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Button and Keypad
|
|
44
|
+
```python
|
|
45
|
+
from rubigram import Client, filters
|
|
46
|
+
from rubigram.enums import ChatKeypadType
|
|
47
|
+
from rubigram.types import Update, Keypad, Button, KeypadRow
|
|
48
|
+
|
|
49
|
+
client = Client("bot_token")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@client.on_message(filters.photo)
|
|
53
|
+
async def start(client: Client, update: Update):
|
|
54
|
+
button_1 = Button("send", "send Photo")
|
|
55
|
+
button_2 = Button("save", "Save Photo")
|
|
56
|
+
row = KeypadRow([button_1, button_2])
|
|
57
|
+
keypad = Keypad([row])
|
|
58
|
+
await update.reply(
|
|
59
|
+
"Select your action:",
|
|
60
|
+
chat_keypad=keypad,
|
|
61
|
+
chat_keypad_type=ChatKeypadType.NEW
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
client.run()
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Use webhook and Get inline button data
|
|
68
|
+
```python
|
|
69
|
+
from rubigram import Client, Server, filters
|
|
70
|
+
from rubigram.types import (
|
|
71
|
+
Update,
|
|
72
|
+
Button,
|
|
73
|
+
Keypad,
|
|
74
|
+
KeypadRow,
|
|
75
|
+
InlineMessage
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
client = Client(token="bot_token")
|
|
80
|
+
server = Server(client, "webhook_url")
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
@client.on_message(filters.photo)
|
|
84
|
+
async def start(client: Client, update: Update):
|
|
85
|
+
button_1 = Button("send", "send Photo")
|
|
86
|
+
button_2 = Button("save", "Save Photo")
|
|
87
|
+
row = KeypadRow([button_1, button_2])
|
|
88
|
+
keypad = Keypad([row])
|
|
89
|
+
await update.reply("Select your action:", inline_keypad=keypad)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@client.on_inline_message(filters.button(["send", "save"]))
|
|
93
|
+
async def inline_message(client: Client, message: InlineMessage):
|
|
94
|
+
button_id = message.aux_data.button_id
|
|
95
|
+
if button_id == "send":
|
|
96
|
+
await message.answer("You clicked the send button")
|
|
97
|
+
else:
|
|
98
|
+
await message.answer("You clicked the save button")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@client.on_start()
|
|
102
|
+
async def start(client):
|
|
103
|
+
print("Start bot ....")
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@client.on_stop()
|
|
107
|
+
async def stop(client):
|
|
108
|
+
print("Stop bot")
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
server.run_server()
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Auto state and save tmp data in cache
|
|
115
|
+
```python
|
|
116
|
+
from rubigram import Client, Storage, filters
|
|
117
|
+
from rubigram.types import Update
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
storage = Storage(ttl=120)
|
|
121
|
+
client = Client("bot_token", storage=storage) # You can leave the `storage` parametr empty
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
@client.on_message(filters.command("start") & filters.private)
|
|
125
|
+
async def start(client: Client, update: Update):
|
|
126
|
+
state = client.state(update.chat_id)
|
|
127
|
+
await state.set("name")
|
|
128
|
+
await update.reply("Send your name:")
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
@client.on_message(filters.state("name") & filters.text & filters.private)
|
|
132
|
+
async def save_name(client: Client, update: Update):
|
|
133
|
+
state = client.state(update.chat_id)
|
|
134
|
+
await state.set("email", name=update.text)
|
|
135
|
+
await update.reply("Send your Email:")
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@client.on_message(filters.state("email") & filters.text & filters.private)
|
|
139
|
+
async def save_email(client: Client, update: Update):
|
|
140
|
+
state = client.state(update.chat_id)
|
|
141
|
+
data = await state.get()
|
|
142
|
+
print(data)
|
|
143
|
+
await state.delete()
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
client.run()
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## Implementation of multiple programs
|
|
151
|
+
```python
|
|
152
|
+
from rubigram import Client
|
|
153
|
+
import asyncio
|
|
154
|
+
|
|
155
|
+
tokens = ["TOKEN_1", "TOKEN_2"]
|
|
156
|
+
|
|
157
|
+
async def main():
|
|
158
|
+
for token in tokens:
|
|
159
|
+
async with Client(token) as client:
|
|
160
|
+
info = await client.get_me()
|
|
161
|
+
print(info)
|
|
162
|
+
|
|
163
|
+
asyncio.run(main())
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Rubino
|
|
167
|
+
```python
|
|
168
|
+
from rubigram.rubino import Rubino
|
|
169
|
+
import asyncio
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
async def main():
|
|
173
|
+
async with Rubino(auth="auth_account") as client:
|
|
174
|
+
info = await client.get_my_profile_info()
|
|
175
|
+
print(info)
|
|
176
|
+
|
|
177
|
+
asyncio.run(main())
|
|
178
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "rubigramclient"
|
|
3
|
+
version = "1.7.35"
|
|
4
|
+
description = "A simple and flexible Python library for building advanced Rubika bots with powerful message handling, inline buttons, and custom filters."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.4"
|
|
7
|
+
license = {file = "LICENSE"}
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Javad", email="MrJavad.Email@gmail.com" }
|
|
10
|
+
]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
dependencies = [
|
|
18
|
+
"aiohttp",
|
|
19
|
+
"aiofiles",
|
|
20
|
+
"aiocache",
|
|
21
|
+
"markdownify",
|
|
22
|
+
"filetype",
|
|
23
|
+
"pycryptodome",
|
|
24
|
+
"mutagen"
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
urls = { "GitHub" = "https://github.com/DevJavad/rubigram" }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class StopPropagation(StopAsyncIteration):
|
|
2
|
+
pass
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ContinuePropagation(StopAsyncIteration):
|
|
6
|
+
pass
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
from .rubigram import handlers, sync, types
|
|
10
|
+
|
|
11
|
+
from .rubigram.storage import Storage
|
|
12
|
+
from .rubigram import enums
|
|
13
|
+
from .rubigram.client import Client
|
|
14
|
+
from .rubigram.bot import Bot
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
__version__ = "1.7.35"
|
|
18
|
+
__author__ = ["PyJavad", "DeveloperYasin"]
|
|
19
|
+
__github__ = "https://github.ocm/DevJavad/rubigram"
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# rubigram/ask.py
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
import rubigram
|
|
5
|
+
from typing import Optional, Union
|
|
6
|
+
|
|
7
|
+
from rubigram.filters import Filter
|
|
8
|
+
from rubigram.types import Update
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AskManager:
|
|
12
|
+
"""
|
|
13
|
+
Ask manager for handling interactive conversations with users
|
|
14
|
+
Compatible with Rubigram's existing Storage and State system
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(self, client:"rubigram.Client"):
|
|
18
|
+
self.client = client
|
|
19
|
+
self._pending_asks: dict[str, asyncio.Future] = {}
|
|
20
|
+
self._pending_filters: dict[str, Optional[Filter]] = {}
|
|
21
|
+
self._default_timeout = 60
|
|
22
|
+
|
|
23
|
+
# Register internal handler
|
|
24
|
+
self._register_handler()
|
|
25
|
+
|
|
26
|
+
def _register_handler(self):
|
|
27
|
+
"""Register internal handler to catch user responses"""
|
|
28
|
+
|
|
29
|
+
@self.client.on_message(group=-999) # Highest priority
|
|
30
|
+
async def _ask_response_handler(client, update: Update):
|
|
31
|
+
user_id = str(update.message.author_object_guid)
|
|
32
|
+
|
|
33
|
+
if user_id in self._pending_asks:
|
|
34
|
+
future = self._pending_asks[user_id]
|
|
35
|
+
answer_filter = self._pending_filters.get(user_id)
|
|
36
|
+
|
|
37
|
+
# Check if message passes the filter
|
|
38
|
+
if answer_filter is not None:
|
|
39
|
+
if not await self._check_filter(client,answer_filter, update):
|
|
40
|
+
return False # Don't consume, let other handlers process
|
|
41
|
+
|
|
42
|
+
if not future.done():
|
|
43
|
+
future.set_result(update)
|
|
44
|
+
del self._pending_asks[user_id]
|
|
45
|
+
del self._pending_filters[user_id]
|
|
46
|
+
return True # Consumed by ask handler
|
|
47
|
+
|
|
48
|
+
return False
|
|
49
|
+
|
|
50
|
+
async def _check_filter(self,client, filter_obj: Filter, update: Update) -> bool:
|
|
51
|
+
"""Check if update passes the filter"""
|
|
52
|
+
if callable(filter_obj):
|
|
53
|
+
result = filter_obj(client, update)
|
|
54
|
+
if asyncio.iscoroutine(result):
|
|
55
|
+
return await result
|
|
56
|
+
return result
|
|
57
|
+
return True
|
|
58
|
+
|
|
59
|
+
async def ask(
|
|
60
|
+
self,
|
|
61
|
+
user_id: Union[str, int],
|
|
62
|
+
question: str,
|
|
63
|
+
timeout: Optional[int] = None,
|
|
64
|
+
filters: Optional[Filter] = None,
|
|
65
|
+
parse_mode: Optional[str] = None,
|
|
66
|
+
reply_to_message_id: Optional[str] = None,
|
|
67
|
+
**kwargs
|
|
68
|
+
) -> Update:
|
|
69
|
+
"""
|
|
70
|
+
Send a question to user and wait for response
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
user_id: User's GUID or ID
|
|
74
|
+
question: Question text to send
|
|
75
|
+
timeout: Timeout in seconds (None = infinite)
|
|
76
|
+
filters: Filter for response (e.g., filters.text, filters.photo)
|
|
77
|
+
parse_mode: Parse mode for question message
|
|
78
|
+
reply_to_message_id: Reply to specific message
|
|
79
|
+
**kwargs: Additional arguments for send_message
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
Update object containing user's response
|
|
83
|
+
|
|
84
|
+
Raises:
|
|
85
|
+
TimeoutError: If user doesn't respond within timeout
|
|
86
|
+
"""
|
|
87
|
+
user_id = str(user_id)
|
|
88
|
+
|
|
89
|
+
# Create future for waiting
|
|
90
|
+
future = asyncio.Future()
|
|
91
|
+
|
|
92
|
+
# Store pending ask
|
|
93
|
+
self._pending_asks[user_id] = future
|
|
94
|
+
self._pending_filters[user_id] = filters
|
|
95
|
+
|
|
96
|
+
# Send question
|
|
97
|
+
x = await self.client.send_message(
|
|
98
|
+
user_id,
|
|
99
|
+
question,
|
|
100
|
+
parse_mode=parse_mode,
|
|
101
|
+
reply_to_message_id=reply_to_message_id,
|
|
102
|
+
**kwargs
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
# Handle timeout
|
|
106
|
+
timeout_seconds = timeout if timeout is not None else self._default_timeout
|
|
107
|
+
|
|
108
|
+
try:
|
|
109
|
+
if timeout_seconds > 0:
|
|
110
|
+
response = await asyncio.wait_for(future, timeout=timeout_seconds)
|
|
111
|
+
else:
|
|
112
|
+
response = await future
|
|
113
|
+
return response
|
|
114
|
+
except asyncio.TimeoutError:
|
|
115
|
+
raise TimeoutError(f"No response received from user {user_id} within {timeout_seconds} seconds")
|
|
116
|
+
finally:
|
|
117
|
+
# Cleanup
|
|
118
|
+
self._pending_asks.pop(user_id, None)
|
|
119
|
+
self._pending_filters.pop(user_id, None)
|
|
120
|
+
|
|
121
|
+
def is_waiting(self, user_id: Union[str, int]) -> bool:
|
|
122
|
+
"""Check if user has a pending ask"""
|
|
123
|
+
return str(user_id) in self._pending_asks
|
|
124
|
+
|
|
125
|
+
def cancel(self, user_id: Union[str, int]) -> bool:
|
|
126
|
+
"""Cancel pending ask for a user"""
|
|
127
|
+
user_id = str(user_id)
|
|
128
|
+
if user_id in self._pending_asks:
|
|
129
|
+
self._pending_asks[user_id].cancel()
|
|
130
|
+
del self._pending_asks[user_id]
|
|
131
|
+
self._pending_filters.pop(user_id, None)
|
|
132
|
+
return True
|
|
133
|
+
return False
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
# Mixin to add to Client class
|
|
137
|
+
class AskMixin:
|
|
138
|
+
"""Mixin to add ask functionality to Client"""
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
def ask(self) -> AskManager:
|
|
142
|
+
"""Get ask manager instance"""
|
|
143
|
+
if not hasattr(self, '_ask_manager'):
|
|
144
|
+
self._ask_manager = AskManager(self)
|
|
145
|
+
return self._ask_manager
|