spluspy 2.2.10__tar.gz → 2.2.11__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.
- {spluspy-2.2.10/spluspy.egg-info → spluspy-2.2.11}/PKG-INFO +29 -5
- {spluspy-2.2.10 → spluspy-2.2.11}/README.md +28 -4
- {spluspy-2.2.10 → spluspy-2.2.11}/pyproject.toml +1 -1
- spluspy-2.2.11/spluspy/__init__.py +20 -0
- spluspy-2.2.11/spluspy/client/__init__.py +12 -0
- spluspy-2.2.11/spluspy/client/soroushclient.py +51 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/events/__init__.py +15 -6
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/events/common.py +38 -16
- spluspy-2.2.11/spluspy/filters.py +437 -0
- spluspy-2.2.11/spluspy/hints.py +179 -0
- spluspy-2.2.11/spluspy/http_api/__init__.py +52 -0
- spluspy-2.2.11/spluspy/http_api/callbackquery.py +92 -0
- spluspy-2.2.11/spluspy/http_api/errors.py +60 -0
- spluspy-2.2.11/spluspy/http_api/keyboards.py +253 -0
- spluspy-2.2.11/spluspy/http_api/message.py +356 -0
- spluspy-2.2.11/spluspy/http_api/robot.py +2037 -0
- spluspy-2.2.11/spluspy/http_api/types.py +1065 -0
- spluspy-2.2.11/spluspy/http_api/utils.py +64 -0
- spluspy-2.2.11/spluspy/methods/__init__.py +40 -0
- spluspy-2.2.11/spluspy/methods/account/__init__.py +17 -0
- spluspy-2.2.11/spluspy/methods/account/_takeout_client.py +94 -0
- spluspy-2.2.11/spluspy/methods/account/end_takeout.py +36 -0
- spluspy-2.2.11/spluspy/methods/account/takeout.py +122 -0
- spluspy-2.2.11/spluspy/methods/auth/__init__.py +31 -0
- spluspy-2.2.11/spluspy/methods/auth/_async_context.py +15 -0
- spluspy-2.2.11/spluspy/methods/auth/_check_for_updates.py +36 -0
- spluspy-2.2.11/spluspy/methods/auth/_on_login.py +30 -0
- spluspy-2.2.11/spluspy/methods/auth/_parse_phone_and_hash.py +21 -0
- spluspy-2.2.11/spluspy/methods/auth/_start.py +120 -0
- spluspy-2.2.11/spluspy/methods/auth/edit_2fa.py +64 -0
- spluspy-2.2.11/spluspy/methods/auth/log_out.py +27 -0
- spluspy-2.2.11/spluspy/methods/auth/qr_login.py +7 -0
- spluspy-2.2.11/spluspy/methods/auth/send_code_request.py +50 -0
- spluspy-2.2.11/spluspy/methods/auth/sign_in.py +105 -0
- spluspy-2.2.11/spluspy/methods/auth/sign_up.py +14 -0
- spluspy-2.2.11/spluspy/methods/auth/start.py +154 -0
- spluspy-2.2.11/spluspy/methods/buttons/__init__.py +8 -0
- spluspy-2.2.10/spluspy/client/buttons.py → spluspy-2.2.11/spluspy/methods/buttons/build_reply_markup.py +101 -101
- spluspy-2.2.11/spluspy/methods/chats/__init__.py +31 -0
- spluspy-2.2.11/spluspy/methods/chats/_admin_log_iter.py +72 -0
- spluspy-2.2.11/spluspy/methods/chats/_chat_action.py +90 -0
- spluspy-2.2.11/spluspy/methods/chats/_participants_iter.py +152 -0
- spluspy-2.2.11/spluspy/methods/chats/_profile_photo_iter.py +103 -0
- spluspy-2.2.11/spluspy/methods/chats/action.py +108 -0
- spluspy-2.2.11/spluspy/methods/chats/edit_admin.py +159 -0
- spluspy-2.2.11/spluspy/methods/chats/edit_permissions.py +160 -0
- spluspy-2.2.11/spluspy/methods/chats/get_admin_log.py +31 -0
- spluspy-2.2.11/spluspy/methods/chats/get_participants.py +33 -0
- spluspy-2.2.11/spluspy/methods/chats/get_permissions.py +78 -0
- spluspy-2.2.11/spluspy/methods/chats/get_profile_photos.py +32 -0
- spluspy-2.2.11/spluspy/methods/chats/get_stats.py +88 -0
- spluspy-2.2.11/spluspy/methods/chats/iter_admin_log.py +180 -0
- spluspy-2.2.11/spluspy/methods/chats/iter_participants.py +105 -0
- spluspy-2.2.11/spluspy/methods/chats/iter_profile_photos.py +78 -0
- spluspy-2.2.11/spluspy/methods/chats/kick_participant.py +77 -0
- spluspy-2.2.11/spluspy/methods/chats/leave_chat.py +81 -0
- spluspy-2.2.11/spluspy/methods/dialogs/__init__.py +11 -0
- spluspy-2.2.11/spluspy/methods/dialogs/_dialogs_iter.py +101 -0
- spluspy-2.2.11/spluspy/methods/dialogs/_drafts_iter.py +35 -0
- spluspy-2.2.11/spluspy/methods/dialogs/conversation.py +144 -0
- spluspy-2.2.11/spluspy/methods/dialogs/delete_dialog.py +84 -0
- spluspy-2.2.11/spluspy/methods/dialogs/edit_folder.py +94 -0
- spluspy-2.2.11/spluspy/methods/dialogs/get_dialogs.py +39 -0
- spluspy-2.2.11/spluspy/methods/dialogs/get_drafts.py +33 -0
- spluspy-2.2.11/spluspy/methods/dialogs/iter_dialogs.py +100 -0
- spluspy-2.2.11/spluspy/methods/dialogs/iter_drafts.py +43 -0
- spluspy-2.2.11/spluspy/methods/downloads/__init__.py +33 -0
- spluspy-2.2.11/spluspy/methods/downloads/_cdn_redirect.py +3 -0
- spluspy-2.2.11/spluspy/methods/downloads/_direct_download_iter.py +227 -0
- spluspy-2.2.11/spluspy/methods/downloads/_download_cached_photo_size.py +32 -0
- spluspy-2.2.11/spluspy/methods/downloads/_download_contact.py +48 -0
- spluspy-2.2.11/spluspy/methods/downloads/_download_document.py +53 -0
- spluspy-2.2.11/spluspy/methods/downloads/_download_file.py +92 -0
- spluspy-2.2.11/spluspy/methods/downloads/_download_photo.py +52 -0
- spluspy-2.2.11/spluspy/methods/downloads/_download_web_document.py +57 -0
- spluspy-2.2.11/spluspy/methods/downloads/_generic_download_iter.py +257 -0
- spluspy-2.2.11/spluspy/methods/downloads/_get_kind_and_names.py +33 -0
- spluspy-2.2.11/spluspy/methods/downloads/_get_proper_filename.py +80 -0
- spluspy-2.2.11/spluspy/methods/downloads/_get_thumb.py +53 -0
- spluspy-2.2.11/spluspy/methods/downloads/_iter_download.py +78 -0
- spluspy-2.2.11/spluspy/methods/downloads/download_file.py +83 -0
- spluspy-2.2.11/spluspy/methods/downloads/download_media.py +132 -0
- spluspy-2.2.11/spluspy/methods/downloads/download_profile_photo.py +124 -0
- spluspy-2.2.11/spluspy/methods/downloads/iter_download.py +116 -0
- spluspy-2.2.11/spluspy/methods/extra/__init__.py +101 -0
- spluspy-2.2.11/spluspy/methods/extra/add_contact.py +23 -0
- spluspy-2.2.11/spluspy/methods/extra/archive_chat.py +19 -0
- spluspy-2.2.11/spluspy/methods/extra/ban_chat_member.py +30 -0
- spluspy-2.2.11/spluspy/methods/extra/block_user.py +18 -0
- spluspy-2.2.11/spluspy/methods/extra/copy_message.py +22 -0
- spluspy-2.2.11/spluspy/methods/extra/create_channel.py +18 -0
- spluspy-2.2.11/spluspy/methods/extra/create_group.py +22 -0
- spluspy-2.2.11/spluspy/methods/extra/delete_all_private.py +58 -0
- spluspy-2.2.11/spluspy/methods/extra/delete_contacts.py +24 -0
- spluspy-2.2.11/spluspy/methods/extra/get_active_sessions.py +13 -0
- spluspy-2.2.11/spluspy/methods/extra/get_all_groups.py +29 -0
- spluspy-2.2.11/spluspy/methods/extra/get_chat.py +22 -0
- spluspy-2.2.11/spluspy/methods/extra/get_chat_history.py +19 -0
- spluspy-2.2.11/spluspy/methods/extra/get_chat_info.py +10 -0
- spluspy-2.2.11/spluspy/methods/extra/get_chat_members.py +18 -0
- spluspy-2.2.11/spluspy/methods/extra/get_contacts.py +14 -0
- spluspy-2.2.11/spluspy/methods/extra/get_dialogs.py +14 -0
- spluspy-2.2.11/spluspy/methods/extra/get_full_chat.py +10 -0
- spluspy-2.2.11/spluspy/methods/extra/get_full_user.py +16 -0
- spluspy-2.2.11/spluspy/methods/extra/get_user.py +10 -0
- spluspy-2.2.11/spluspy/methods/extra/get_users.py +15 -0
- spluspy-2.2.11/spluspy/methods/extra/is_public_chat.py +13 -0
- spluspy-2.2.11/spluspy/methods/extra/join_chat.py +36 -0
- spluspy-2.2.11/spluspy/methods/extra/leave_all.py +43 -0
- spluspy-2.2.11/spluspy/methods/extra/pin_chat_message.py +17 -0
- spluspy-2.2.11/spluspy/methods/extra/promote_chat_member.py +29 -0
- spluspy-2.2.11/spluspy/methods/extra/read_chat_history.py +15 -0
- spluspy-2.2.11/spluspy/methods/extra/restrict_chat_member.py +27 -0
- spluspy-2.2.11/spluspy/methods/extra/search_messages.py +23 -0
- spluspy-2.2.11/spluspy/methods/extra/send_audio.py +23 -0
- spluspy-2.2.11/spluspy/methods/extra/send_document.py +23 -0
- spluspy-2.2.11/spluspy/methods/extra/send_photo.py +23 -0
- spluspy-2.2.11/spluspy/methods/extra/send_reaction.py +26 -0
- spluspy-2.2.11/spluspy/methods/extra/send_video.py +23 -0
- spluspy-2.2.11/spluspy/methods/extra/send_voice.py +24 -0
- spluspy-2.2.11/spluspy/methods/extra/set_chat_description.py +25 -0
- spluspy-2.2.11/spluspy/methods/extra/set_chat_photo.py +29 -0
- spluspy-2.2.11/spluspy/methods/extra/set_chat_title.py +34 -0
- spluspy-2.2.11/spluspy/methods/extra/terminate_session.py +16 -0
- spluspy-2.2.11/spluspy/methods/extra/unarchive_chat.py +19 -0
- spluspy-2.2.11/spluspy/methods/extra/unban_chat_member.py +28 -0
- spluspy-2.2.11/spluspy/methods/extra/unblock_user.py +18 -0
- spluspy-2.2.11/spluspy/methods/extra/unpin_all_chat_messages.py +15 -0
- spluspy-2.2.11/spluspy/methods/extra/unpin_chat_message.py +18 -0
- spluspy-2.2.11/spluspy/methods/extra/update_profile.py +21 -0
- spluspy-2.2.11/spluspy/methods/extra/update_profile_photo.py +22 -0
- spluspy-2.2.11/spluspy/methods/extra/update_username.py +16 -0
- spluspy-2.2.11/spluspy/methods/messageparse/__init__.py +22 -0
- spluspy-2.2.11/spluspy/methods/messageparse/_get_response_message.py +110 -0
- spluspy-2.2.11/spluspy/methods/messageparse/_parse_message_text.py +47 -0
- spluspy-2.2.11/spluspy/methods/messageparse/_replace_with_mention.py +23 -0
- spluspy-2.2.11/spluspy/methods/messageparse/parse_mode.py +49 -0
- spluspy-2.2.11/spluspy/methods/messages/__init__.py +47 -0
- spluspy-2.2.11/spluspy/methods/messages/_get_comment_data.py +24 -0
- spluspy-2.2.11/spluspy/methods/messages/_ids_iter.py +72 -0
- spluspy-2.2.11/spluspy/methods/messages/_messages_iter.py +280 -0
- spluspy-2.2.11/spluspy/methods/messages/_pin.py +37 -0
- spluspy-2.2.11/spluspy/methods/messages/delete_messages.py +83 -0
- spluspy-2.2.11/spluspy/methods/messages/edit_message.py +154 -0
- spluspy-2.2.11/spluspy/methods/messages/forward_messages.py +151 -0
- spluspy-2.2.11/spluspy/methods/messages/get_messages.py +62 -0
- spluspy-2.2.11/spluspy/methods/messages/iter_messages.py +223 -0
- spluspy-2.2.11/spluspy/methods/messages/pin_message.py +49 -0
- spluspy-2.2.11/spluspy/methods/messages/send_message.py +326 -0
- spluspy-2.2.11/spluspy/methods/messages/send_read_acknowledge.py +97 -0
- spluspy-2.2.11/spluspy/methods/messages/unpin_message.py +38 -0
- spluspy-2.2.11/spluspy/methods/updates/__init__.py +47 -0
- spluspy-2.2.11/spluspy/methods/updates/_constants.py +22 -0
- spluspy-2.2.11/spluspy/methods/updates/_dispatch_update.py +104 -0
- spluspy-2.2.11/spluspy/methods/updates/_preprocess_updates.py +16 -0
- spluspy-2.2.11/spluspy/methods/updates/_run_until_disconnected.py +27 -0
- spluspy-2.2.11/spluspy/methods/updates/_update_loop.py +127 -0
- spluspy-2.2.11/spluspy/methods/updates/add_event_handler.py +17 -0
- spluspy-2.2.11/spluspy/methods/updates/on_channel.py +19 -0
- spluspy-2.2.11/spluspy/methods/updates/on_chat_action.py +15 -0
- spluspy-2.2.11/spluspy/methods/updates/on_deleted_messages.py +15 -0
- spluspy-2.2.11/spluspy/methods/updates/on_edited_message.py +15 -0
- spluspy-2.2.11/spluspy/methods/updates/on_error.py +15 -0
- spluspy-2.2.11/spluspy/methods/updates/on_group.py +19 -0
- spluspy-2.2.11/spluspy/methods/updates/on_me.py +19 -0
- spluspy-2.2.11/spluspy/methods/updates/on_message.py +15 -0
- spluspy-2.2.11/spluspy/methods/updates/on_raw_update.py +15 -0
- spluspy-2.2.11/spluspy/methods/updates/on_user_status.py +15 -0
- spluspy-2.2.11/spluspy/methods/updates/remove_event_handler.py +23 -0
- spluspy-2.2.11/spluspy/methods/updates/run_until_disconnected.py +17 -0
- spluspy-2.2.11/spluspy/methods/uploads/__init__.py +8 -0
- spluspy-2.2.11/spluspy/methods/uploads/_cache_type.py +10 -0
- spluspy-2.2.11/spluspy/methods/uploads/_file_to_media.py +119 -0
- spluspy-2.2.11/spluspy/methods/uploads/_resize_photo_if_needed.py +83 -0
- spluspy-2.2.11/spluspy/methods/uploads/_send_album.py +92 -0
- spluspy-2.2.11/spluspy/methods/uploads/send_file.py +381 -0
- spluspy-2.2.11/spluspy/methods/uploads/upload_file.py +220 -0
- spluspy-2.2.11/spluspy/methods/users/__init__.py +29 -0
- spluspy-2.2.11/spluspy/methods/users/call.py +122 -0
- spluspy-2.2.11/spluspy/methods/users/get_entity.py +138 -0
- spluspy-2.2.11/spluspy/methods/users/get_entity_from_string.py +75 -0
- spluspy-2.2.11/spluspy/methods/users/get_input_dialog.py +28 -0
- spluspy-2.2.11/spluspy/methods/users/get_input_entity.py +147 -0
- spluspy-2.2.11/spluspy/methods/users/get_input_notify.py +27 -0
- spluspy-2.2.11/spluspy/methods/users/get_me.py +45 -0
- spluspy-2.2.11/spluspy/methods/users/get_peer.py +14 -0
- spluspy-2.2.11/spluspy/methods/users/get_peer_id.py +45 -0
- spluspy-2.2.11/spluspy/methods/users/helpers.py +23 -0
- spluspy-2.2.11/spluspy/methods/users/is_bot.py +23 -0
- spluspy-2.2.11/spluspy/methods/users/is_user_authorized.py +36 -0
- spluspy-2.2.11/spluspy/methods/users/self_id.py +16 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/version.py +1 -1
- {spluspy-2.2.10 → spluspy-2.2.11/spluspy.egg-info}/PKG-INFO +29 -5
- spluspy-2.2.11/spluspy.egg-info/SOURCES.txt +328 -0
- spluspy-2.2.10/spluspy/__init__.py +0 -15
- spluspy-2.2.10/spluspy/client/__init__.py +0 -24
- spluspy-2.2.10/spluspy/client/account.py +0 -247
- spluspy-2.2.10/spluspy/client/auth.py +0 -419
- spluspy-2.2.10/spluspy/client/chats.py +0 -1410
- spluspy-2.2.10/spluspy/client/dialogs.py +0 -614
- spluspy-2.2.10/spluspy/client/downloads.py +0 -1107
- spluspy-2.2.10/spluspy/client/extra.py +0 -981
- spluspy-2.2.10/spluspy/client/messageparse.py +0 -233
- spluspy-2.2.10/spluspy/client/messages.py +0 -1494
- spluspy-2.2.10/spluspy/client/soroushclient.py +0 -14
- spluspy-2.2.10/spluspy/client/updates.py +0 -376
- spluspy-2.2.10/spluspy/client/uploads.py +0 -888
- spluspy-2.2.10/spluspy/client/users.py +0 -665
- spluspy-2.2.10/spluspy/filters.py +0 -181
- spluspy-2.2.10/spluspy/hints.py +0 -72
- spluspy-2.2.10/spluspy.egg-info/SOURCES.txt +0 -159
- {spluspy-2.2.10 → spluspy-2.2.11}/LICENSE +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/setup.cfg +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/_updates/__init__.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/_updates/entitycache.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/_updates/messagebox.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/_updates/session.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/admin.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/client/telegrambaseclient.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/crypto/__init__.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/crypto/aes.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/crypto/aesctr.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/crypto/authkey.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/crypto/cdndecrypter.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/crypto/factorization.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/crypto/libssl.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/crypto/rsa.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/custom.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/enums.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/errors/__init__.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/errors/common.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/errors/exceptions.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/errors/rpcbaseerrors.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/errors/rpcerrorlist.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/events/album.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/events/chataction.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/events/messagedeleted.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/events/messageedited.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/events/messageread.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/events/newmessage.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/events/raw.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/events/userupdate.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/extensions/__init__.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/extensions/binaryreader.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/extensions/html.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/extensions/markdown.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/extensions/messagepacker.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/functions.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/helpers.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/network/__init__.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/network/authenticator.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/network/connection/__init__.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/network/connection/connection.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/network/connection/http.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/network/connection/tcpabridged.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/network/connection/tcpfull.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/network/connection/tcpintermediate.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/network/connection/tcpmtproxy.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/network/connection/tcpobfuscated.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/network/connection/websocket.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/network/mtprotoplainsender.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/network/mtprotosender.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/network/mtprotostate.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/network/requeststate.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/password.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/requestiter.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/resolvers.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/sessions/__init__.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/sessions/abstract.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/sessions/memory.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/sessions/sqlite.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/sessions/string.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/sync.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/__init__.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/alltlobjects.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/core/__init__.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/core/gzippacked.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/core/messagecontainer.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/core/rpcresult.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/core/tlmessage.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/__init__.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/adminlogevent.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/button.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/chatgetter.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/conversation.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/dialog.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/draft.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/file.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/forward.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/inputsizedfile.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/message.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/messagebutton.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/participantpermissions.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/qrlogin.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/sendergetter.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/custom/types.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/__init__.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/account.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/auth.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/bots.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/channels.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/chatlists.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/conference.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/contacts.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/folders.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/help.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/langpack.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/messages.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/payments.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/phone.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/photos.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/premium.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/stats.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/stories.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/thirdParty.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/updates.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/upload.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/functions/users.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/patched/__init__.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/tlobject.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/__init__.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/account.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/auth.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/bots.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/channels.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/chatlists.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/conference.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/contacts.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/help.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/messages.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/payments.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/phone.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/photos.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/premium.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/stats.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/stickers.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/storage.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/stories.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/thirdParty.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/update.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/updates.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/upload.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/tl/types/users.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy/utils.py +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy.egg-info/dependency_links.txt +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy.egg-info/requires.txt +0 -0
- {spluspy-2.2.10 → spluspy-2.2.11}/spluspy.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spluspy
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.11
|
|
4
4
|
Summary: High-performance Python Self-Bot Framework for Soroush Plus
|
|
5
5
|
Author: Ali Mirshekari
|
|
6
6
|
License: MIT
|
|
@@ -26,18 +26,18 @@ Requires-Dist: rsa
|
|
|
26
26
|
Requires-Dist: pyaes
|
|
27
27
|
Dynamic: license-file
|
|
28
28
|
|
|
29
|
-
# SplusPy v2.2.
|
|
29
|
+
# SplusPy v2.2.11
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
**A fast, minimal, and fully-featured self-
|
|
32
|
+
**A fast, minimal, and fully-featured framework for Soroush Plus — self-bots and official bots**
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
36
36
|
## About
|
|
37
37
|
|
|
38
|
-
SplusPy is a Python library designed specifically for building **Soroush Plus self-bots** (userbots)
|
|
38
|
+
SplusPy is a Python library designed specifically for building **Soroush Plus self-bots** (userbots) and **official bots**. It provides a clean, intuitive API for automating your personal Soroush Plus account or building bots via the official HTTP Bot API.
|
|
39
39
|
|
|
40
|
-
> ⚠️ **Note:** This
|
|
40
|
+
> ⚠️ **Note:** This framework supports both **self-bot** (personal account) and **official bot** (Bot API) modes. Please adhere to Soroush's Terms of Service.
|
|
41
41
|
|
|
42
42
|
---
|
|
43
43
|
|
|
@@ -83,6 +83,30 @@ client.run_until_disconnected()
|
|
|
83
83
|
|
|
84
84
|
---
|
|
85
85
|
|
|
86
|
+
## Official Bot (Robot)
|
|
87
|
+
|
|
88
|
+
You can also build official bots using the HTTP Bot API:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from spluspy import Robot, filters
|
|
92
|
+
|
|
93
|
+
bot = Robot("YOUR_BOT_TOKEN")
|
|
94
|
+
|
|
95
|
+
@bot.on_message(filters.text("hello"))
|
|
96
|
+
async def hello_handler(client, event):
|
|
97
|
+
await event.reply("Hi there!")
|
|
98
|
+
|
|
99
|
+
bot.run()
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### How it works
|
|
103
|
+
|
|
104
|
+
1. **Create a `Robot`** — pass your bot token.
|
|
105
|
+
2. **Register handlers** — use `@bot.on_message()` just like the self-bot.
|
|
106
|
+
3. **Run** — call `bot.run()` to start long-polling.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
86
110
|
## License
|
|
87
111
|
|
|
88
112
|
MIT License. See [LICENSE](LICENSE) for details.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# SplusPy v2.2.
|
|
1
|
+
# SplusPy v2.2.11
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
**A fast, minimal, and fully-featured self-
|
|
4
|
+
**A fast, minimal, and fully-featured framework for Soroush Plus — self-bots and official bots**
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
## About
|
|
9
9
|
|
|
10
|
-
SplusPy is a Python library designed specifically for building **Soroush Plus self-bots** (userbots)
|
|
10
|
+
SplusPy is a Python library designed specifically for building **Soroush Plus self-bots** (userbots) and **official bots**. It provides a clean, intuitive API for automating your personal Soroush Plus account or building bots via the official HTTP Bot API.
|
|
11
11
|
|
|
12
|
-
> ⚠️ **Note:** This
|
|
12
|
+
> ⚠️ **Note:** This framework supports both **self-bot** (personal account) and **official bot** (Bot API) modes. Please adhere to Soroush's Terms of Service.
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
@@ -55,6 +55,30 @@ client.run_until_disconnected()
|
|
|
55
55
|
|
|
56
56
|
---
|
|
57
57
|
|
|
58
|
+
## Official Bot (Robot)
|
|
59
|
+
|
|
60
|
+
You can also build official bots using the HTTP Bot API:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from spluspy import Robot, filters
|
|
64
|
+
|
|
65
|
+
bot = Robot("YOUR_BOT_TOKEN")
|
|
66
|
+
|
|
67
|
+
@bot.on_message(filters.text("hello"))
|
|
68
|
+
async def hello_handler(client, event):
|
|
69
|
+
await event.reply("Hi there!")
|
|
70
|
+
|
|
71
|
+
bot.run()
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### How it works
|
|
75
|
+
|
|
76
|
+
1. **Create a `Robot`** — pass your bot token.
|
|
77
|
+
2. **Register handlers** — use `@bot.on_message()` just like the self-bot.
|
|
78
|
+
3. **Run** — call `bot.run()` to start long-polling.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
58
82
|
## License
|
|
59
83
|
|
|
60
84
|
MIT License. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from .client.soroushclient import SoroushClient as Client
|
|
2
|
+
from .http_api import Robot
|
|
3
|
+
from .http_api.types import Message, CallbackQuery
|
|
4
|
+
from .http_api.keyboards import InlineKeyboardBuilder, ReplyKeyboardBuilder
|
|
5
|
+
from .http_api.callbackquery import HTTPCallbackQuery
|
|
6
|
+
from .network import connection
|
|
7
|
+
from .tl.custom import Button
|
|
8
|
+
from .tl import patched as _ # import for its side-effects
|
|
9
|
+
from . import version, events, utils, errors, functions, custom
|
|
10
|
+
from .filters import filters
|
|
11
|
+
from .enums import MessageMediaType
|
|
12
|
+
|
|
13
|
+
__version__ = version.__version__
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
'Client', 'Robot', 'Message', 'CallbackQuery', 'Button', 'filters',
|
|
17
|
+
'MessageMediaType', 'InlineKeyboardBuilder', 'ReplyKeyboardBuilder',
|
|
18
|
+
'HTTPCallbackQuery', 'functions', 'custom', 'errors',
|
|
19
|
+
'events', 'utils', 'connection',
|
|
20
|
+
]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This package defines clients as subclasses of others, and then a single
|
|
3
|
+
`spluspy.client.soroushclient.SoroushClient` which is subclass of them
|
|
4
|
+
all to provide the final unified interface while the methods can live in
|
|
5
|
+
different subclasses to be more maintainable.
|
|
6
|
+
|
|
7
|
+
The ABC is `spluspy.client.telegrambaseclient.SoroushPlusBaseClient` and
|
|
8
|
+
methods are provided via `spluspy.methods.Methods` which aggregates all
|
|
9
|
+
the individual method mixins.
|
|
10
|
+
"""
|
|
11
|
+
from .telegrambaseclient import SoroushPlusBaseClient
|
|
12
|
+
from .soroushclient import SoroushClient
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import typing
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from ..methods import Methods
|
|
6
|
+
from .telegrambaseclient import SoroushPlusBaseClient
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from ..http_api.robot import Robot
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class SoroushClient(Methods, SoroushPlusBaseClient):
|
|
13
|
+
def __init__(
|
|
14
|
+
self,
|
|
15
|
+
*args,
|
|
16
|
+
http_token: Optional[str] = None,
|
|
17
|
+
**kwargs,
|
|
18
|
+
):
|
|
19
|
+
super().__init__(*args, **kwargs)
|
|
20
|
+
self._http_robot: Optional["Robot"] = (
|
|
21
|
+
_create_robot(http_token) if http_token else None
|
|
22
|
+
)
|
|
23
|
+
self._http_polling_task: Optional[asyncio.Task] = None
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def http_robot(self) -> Optional["Robot"]:
|
|
27
|
+
"""Direct access to the HTTP Robot instance (if ``http_token`` was provided)."""
|
|
28
|
+
return self._http_robot
|
|
29
|
+
|
|
30
|
+
async def connect(self):
|
|
31
|
+
await super().connect()
|
|
32
|
+
if self._http_robot is not None:
|
|
33
|
+
self._http_robot.loop = self.loop
|
|
34
|
+
self._http_polling_task = asyncio.create_task(
|
|
35
|
+
self._http_robot._polling_loop()
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
async def _disconnect_coro(self):
|
|
39
|
+
if self._http_robot is not None and self._http_polling_task is not None:
|
|
40
|
+
self._http_polling_task.cancel()
|
|
41
|
+
try:
|
|
42
|
+
await self._http_polling_task
|
|
43
|
+
except asyncio.CancelledError:
|
|
44
|
+
pass
|
|
45
|
+
await self._http_robot.close()
|
|
46
|
+
await super()._disconnect_coro()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _create_robot(token: str) -> "Robot":
|
|
50
|
+
from ..http_api.robot import Robot
|
|
51
|
+
return Robot(token)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
1
3
|
from .raw import Raw
|
|
2
4
|
from .album import Album
|
|
3
5
|
from .chataction import ChatAction
|
|
@@ -7,6 +9,8 @@ from .messageread import MessageRead
|
|
|
7
9
|
from .newmessage import NewMessage
|
|
8
10
|
from .userupdate import UserUpdate
|
|
9
11
|
|
|
12
|
+
if typing.TYPE_CHECKING:
|
|
13
|
+
from .common import EventBuilder, EventCommon
|
|
10
14
|
|
|
11
15
|
_HANDLERS_ATTRIBUTE = '__tl.handlers'
|
|
12
16
|
|
|
@@ -38,7 +42,9 @@ class StopPropagation(Exception):
|
|
|
38
42
|
pass
|
|
39
43
|
|
|
40
44
|
|
|
41
|
-
def register(
|
|
45
|
+
def register(
|
|
46
|
+
event: 'typing.Optional[typing.Union[EventBuilder, typing.Type[EventBuilder]]]' = None
|
|
47
|
+
) -> 'typing.Callable':
|
|
42
48
|
"""
|
|
43
49
|
Decorator method to *register* event handlers. This is the client-less
|
|
44
50
|
`add_event_handler()
|
|
@@ -73,7 +79,7 @@ def register(event=None):
|
|
|
73
79
|
elif not event:
|
|
74
80
|
event = Raw()
|
|
75
81
|
|
|
76
|
-
def decorator(callback):
|
|
82
|
+
def decorator(callback: 'typing.Callable') -> 'typing.Callable':
|
|
77
83
|
handlers = getattr(callback, _HANDLERS_ATTRIBUTE, [])
|
|
78
84
|
handlers.append(event)
|
|
79
85
|
setattr(callback, _HANDLERS_ATTRIBUTE, handlers)
|
|
@@ -82,7 +88,10 @@ def register(event=None):
|
|
|
82
88
|
return decorator
|
|
83
89
|
|
|
84
90
|
|
|
85
|
-
def unregister(
|
|
91
|
+
def unregister(
|
|
92
|
+
callback: 'typing.Callable',
|
|
93
|
+
event: 'typing.Optional[typing.Union[EventBuilder, typing.Type[EventBuilder]]]' = None
|
|
94
|
+
) -> int:
|
|
86
95
|
"""
|
|
87
96
|
Inverse operation of `register` (though not a decorator). Client-less
|
|
88
97
|
`remove_event_handler
|
|
@@ -115,7 +124,7 @@ def unregister(callback, event=None):
|
|
|
115
124
|
return found
|
|
116
125
|
|
|
117
126
|
|
|
118
|
-
def is_handler(callback):
|
|
127
|
+
def is_handler(callback: 'typing.Callable') -> bool:
|
|
119
128
|
"""
|
|
120
129
|
Returns `True` if the given callback is an
|
|
121
130
|
event handler (i.e. you used `register` on it).
|
|
@@ -123,7 +132,7 @@ def is_handler(callback):
|
|
|
123
132
|
return hasattr(callback, _HANDLERS_ATTRIBUTE)
|
|
124
133
|
|
|
125
134
|
|
|
126
|
-
def list(callback):
|
|
135
|
+
def list(callback: 'typing.Callable') -> typing.List['EventBuilder']:
|
|
127
136
|
"""
|
|
128
137
|
Returns a list containing the registered event
|
|
129
138
|
builders inside the specified callback handler.
|
|
@@ -131,7 +140,7 @@ def list(callback):
|
|
|
131
140
|
return getattr(callback, _HANDLERS_ATTRIBUTE, [])[:]
|
|
132
141
|
|
|
133
142
|
|
|
134
|
-
def _get_handlers(callback):
|
|
143
|
+
def _get_handlers(callback: 'typing.Callable') -> 'typing.Optional[typing.List[EventBuilder]]':
|
|
135
144
|
"""
|
|
136
145
|
Like ``list`` but returns `None` if the callback was never registered.
|
|
137
146
|
"""
|
|
@@ -4,12 +4,14 @@ import inspect
|
|
|
4
4
|
import typing
|
|
5
5
|
import warnings
|
|
6
6
|
|
|
7
|
-
from .. import utils
|
|
7
|
+
from .. import utils, hints
|
|
8
8
|
from ..tl import TLObject, types
|
|
9
9
|
from ..tl.custom.chatgetter import ChatGetter
|
|
10
10
|
|
|
11
11
|
if typing.TYPE_CHECKING:
|
|
12
|
+
from ..client.soroushclient import SoroushClient
|
|
12
13
|
from ..filters import Filter
|
|
14
|
+
from ..hints import EventHandler, FilterFunc
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
class _CallableWrapperFilter:
|
|
@@ -19,14 +21,14 @@ class _CallableWrapperFilter:
|
|
|
19
21
|
where the callable receives only the event/message. Callables that
|
|
20
22
|
declare two positional parameters receive ``(client, message)``.
|
|
21
23
|
"""
|
|
22
|
-
def __init__(self, func):
|
|
24
|
+
def __init__(self, func: 'typing.Callable[..., typing.Union[bool, typing.Awaitable[bool]]]'):
|
|
23
25
|
self.func = func
|
|
24
26
|
try:
|
|
25
27
|
self._takes_client = len(inspect.signature(func).parameters.values()) >= 2
|
|
26
28
|
except (TypeError, ValueError):
|
|
27
29
|
self._takes_client = False
|
|
28
30
|
|
|
29
|
-
async def __call__(self, client, message) -> bool:
|
|
31
|
+
async def __call__(self, client: 'SoroushClient', message: 'typing.Any') -> bool:
|
|
30
32
|
result = (
|
|
31
33
|
self.func(client, message) if self._takes_client
|
|
32
34
|
else self.func(message)
|
|
@@ -36,7 +38,7 @@ class _CallableWrapperFilter:
|
|
|
36
38
|
return bool(result)
|
|
37
39
|
|
|
38
40
|
|
|
39
|
-
def _wrap_filter(filters):
|
|
41
|
+
def _wrap_filter(filters: 'typing.Optional[typing.Union[Filter, typing.Callable]]') -> 'typing.Optional[typing.Union[Filter, _CallableWrapperFilter]]':
|
|
40
42
|
"""Wraps plain callables into an awaitable filter, passes others through."""
|
|
41
43
|
from ..filters import Filter
|
|
42
44
|
if filters is None or isinstance(filters, Filter):
|
|
@@ -48,7 +50,10 @@ def _wrap_filter(filters):
|
|
|
48
50
|
'got {}'.format(type(filters).__name__))
|
|
49
51
|
|
|
50
52
|
|
|
51
|
-
async def _into_id_set(
|
|
53
|
+
async def _into_id_set(
|
|
54
|
+
client: 'SoroushClient',
|
|
55
|
+
chats: 'typing.Optional[typing.Union[hints.EntityLike, typing.Sequence[hints.EntityLike]]]'
|
|
56
|
+
) -> 'typing.Optional[typing.Set[int]]':
|
|
52
57
|
"""Helper util to turn the input chat or chats into a set of IDs."""
|
|
53
58
|
if chats is None:
|
|
54
59
|
return None
|
|
@@ -112,7 +117,14 @@ class EventBuilder(abc.ABC):
|
|
|
112
117
|
async def handler(event):
|
|
113
118
|
pass # code here
|
|
114
119
|
"""
|
|
115
|
-
def __init__(
|
|
120
|
+
def __init__(
|
|
121
|
+
self,
|
|
122
|
+
chats: 'typing.Optional[hints.EntityLike]' = None,
|
|
123
|
+
*,
|
|
124
|
+
blacklist_chats: bool = False,
|
|
125
|
+
func: 'typing.Optional[hints.FilterFunc]' = None,
|
|
126
|
+
filters: 'typing.Optional[typing.Union[Filter, typing.Callable]]' = None
|
|
127
|
+
):
|
|
116
128
|
self.chats = chats
|
|
117
129
|
self.blacklist_chats = bool(blacklist_chats)
|
|
118
130
|
self.resolved = False
|
|
@@ -122,7 +134,12 @@ class EventBuilder(abc.ABC):
|
|
|
122
134
|
|
|
123
135
|
@classmethod
|
|
124
136
|
@abc.abstractmethod
|
|
125
|
-
def build(
|
|
137
|
+
def build(
|
|
138
|
+
cls,
|
|
139
|
+
update: 'typing.Any',
|
|
140
|
+
others: 'typing.Optional[typing.List]' = None,
|
|
141
|
+
self_id: 'typing.Optional[int]' = None
|
|
142
|
+
) -> 'typing.Optional[EventCommon]':
|
|
126
143
|
"""
|
|
127
144
|
Builds an event for the given update if possible, or returns None.
|
|
128
145
|
|
|
@@ -134,7 +151,7 @@ class EventBuilder(abc.ABC):
|
|
|
134
151
|
"""
|
|
135
152
|
# TODO So many parameters specific to only some update types seems dirty
|
|
136
153
|
|
|
137
|
-
async def resolve(self, client):
|
|
154
|
+
async def resolve(self, client: 'SoroushClient') -> None:
|
|
138
155
|
"""Helper method to allow event builders to be resolved before usage"""
|
|
139
156
|
if self.resolved:
|
|
140
157
|
return
|
|
@@ -147,10 +164,10 @@ class EventBuilder(abc.ABC):
|
|
|
147
164
|
await self._resolve(client)
|
|
148
165
|
self.resolved = True
|
|
149
166
|
|
|
150
|
-
async def _resolve(self, client):
|
|
167
|
+
async def _resolve(self, client: 'SoroushClient') -> None:
|
|
151
168
|
self.chats = await _into_id_set(client, self.chats)
|
|
152
169
|
|
|
153
|
-
async def filter(self, event):
|
|
170
|
+
async def filter(self, event: 'EventCommon') -> 'typing.Optional[EventCommon]':
|
|
154
171
|
"""
|
|
155
172
|
Returns a truthy value if the event passed the filter and should be
|
|
156
173
|
used, or falsy otherwise. The return value may need to be awaited.
|
|
@@ -195,14 +212,19 @@ class EventCommon(ChatGetter, abc.ABC):
|
|
|
195
212
|
"""
|
|
196
213
|
_event_name = 'Event'
|
|
197
214
|
|
|
198
|
-
def __init__(
|
|
215
|
+
def __init__(
|
|
216
|
+
self,
|
|
217
|
+
chat_peer: 'typing.Optional[types.TypePeer]' = None,
|
|
218
|
+
msg_id: 'typing.Optional[int]' = None,
|
|
219
|
+
broadcast: 'typing.Optional[bool]' = None
|
|
220
|
+
):
|
|
199
221
|
super().__init__(chat_peer, broadcast=broadcast)
|
|
200
|
-
self._entities = {}
|
|
201
|
-
self._client = None
|
|
222
|
+
self._entities: 'typing.Dict[int, typing.Any]' = {}
|
|
223
|
+
self._client: 'typing.Optional[SoroushClient]' = None
|
|
202
224
|
self._message_id = msg_id
|
|
203
|
-
self.original_update = None
|
|
225
|
+
self.original_update: 'typing.Optional[types.TypeUpdate]' = None
|
|
204
226
|
|
|
205
|
-
def _set_client(self, client):
|
|
227
|
+
def _set_client(self, client: 'SoroushClient') -> None:
|
|
206
228
|
"""
|
|
207
229
|
Setter so subclasses can act accordingly when the client is set.
|
|
208
230
|
"""
|
|
@@ -214,7 +236,7 @@ class EventCommon(ChatGetter, abc.ABC):
|
|
|
214
236
|
self._chat = self._input_chat = None
|
|
215
237
|
|
|
216
238
|
@property
|
|
217
|
-
def client(self):
|
|
239
|
+
def client(self) -> 'SoroushClient':
|
|
218
240
|
"""
|
|
219
241
|
The `spluspy.SoroushClient` that created this event.
|
|
220
242
|
"""
|