spluspy 2.0.4__tar.gz → 2.0.6__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.0.6/.gitignore +50 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/CHANGELOG.md +25 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/Dockerfile +3 -2
- {spluspy-2.0.4 → spluspy-2.0.6}/MANIFEST.in +1 -1
- {spluspy-2.0.4 → spluspy-2.0.6}/PKG-INFO +6 -3
- {spluspy-2.0.4 → spluspy-2.0.6}/README.md +3 -2
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/01_hello_bot.py +1 -2
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/02_echo_bot.py +1 -1
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/04_private_only.py +3 -4
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/05_group_only.py +3 -4
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/06_regex_bot.py +6 -7
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/07_user_filter.py +5 -6
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/09_inline_keyboard.py +8 -9
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/10_reply_keyboard.py +7 -8
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/11_message_actions.py +10 -12
- spluspy-2.0.6/examples/12_media_bot.py +36 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/13_fsm_bot.py +12 -13
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/14_plugin_bot.py +7 -5
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/15_middleware_bot.py +2 -2
- {spluspy-2.0.4 → spluspy-2.0.6}/pyproject.toml +2 -1
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/__init__.py +17 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/__version__.py +1 -1
- spluspy-2.0.6/spluspy/admin.py +285 -0
- spluspy-2.0.6/spluspy/afk.py +202 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/client/client.py +2403 -1467
- spluspy-2.0.6/spluspy/compat.py +50 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/config.py +3 -3
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/events/base.py +6 -14
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/filters/__init__.py +2 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/filters/filters.py +38 -20
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/fsm/state.py +9 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/middleware/base.py +121 -101
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/middleware/rate_limit.py +6 -1
- spluspy-2.0.6/spluspy/mirror.py +207 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/models/bot.py +8 -44
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/models/chat.py +4 -4
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/models/media.py +11 -11
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/models/message.py +15 -80
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/models/objects.py +6 -6
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/models/user.py +1 -1
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/network/__init__.py +5 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/network/client.py +483 -396
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/network/connection.py +167 -167
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/network/mtproto.py +41 -0
- spluspy-2.0.6/spluspy/network/protocols.py +104 -0
- spluspy-2.0.6/spluspy/network/spluspy_adapter.py +343 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/network/telethon_adapter.py +155 -153
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/network/transport.py +32 -62
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/plugins/loader.py +150 -150
- spluspy-2.0.6/spluspy/py.typed +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/scheduler/__init__.py +2 -2
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/scheduler/scheduler.py +140 -2
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/session/sqlite.py +10 -13
- spluspy-2.0.6/spluspy/spluspy2/__init__.py +13 -0
- spluspy-2.0.6/spluspy/spluspy2/_updates/__init__.py +3 -0
- spluspy-2.0.6/spluspy/spluspy2/_updates/entitycache.py +59 -0
- spluspy-2.0.6/spluspy/spluspy2/_updates/messagebox.py +830 -0
- spluspy-2.0.6/spluspy/spluspy2/_updates/session.py +195 -0
- spluspy-2.0.6/spluspy/spluspy2/client/__init__.py +25 -0
- spluspy-2.0.6/spluspy/spluspy2/client/account.py +247 -0
- spluspy-2.0.6/spluspy/spluspy2/client/auth.py +740 -0
- spluspy-2.0.6/spluspy/spluspy2/client/bots.py +72 -0
- spluspy-2.0.6/spluspy/spluspy2/client/buttons.py +101 -0
- spluspy-2.0.6/spluspy/spluspy2/client/chats.py +1339 -0
- spluspy-2.0.6/spluspy/spluspy2/client/dialogs.py +614 -0
- spluspy-2.0.6/spluspy/spluspy2/client/downloads.py +1096 -0
- spluspy-2.0.6/spluspy/spluspy2/client/messageparse.py +233 -0
- spluspy-2.0.6/spluspy/spluspy2/client/messages.py +1528 -0
- spluspy-2.0.6/spluspy/spluspy2/client/soroushclient.py +13 -0
- spluspy-2.0.6/spluspy/spluspy2/client/telegrambaseclient.py +1016 -0
- spluspy-2.0.6/spluspy/spluspy2/client/updates.py +777 -0
- spluspy-2.0.6/spluspy/spluspy2/client/uploads.py +867 -0
- spluspy-2.0.6/spluspy/spluspy2/client/users.py +631 -0
- spluspy-2.0.6/spluspy/spluspy2/crypto/__init__.py +10 -0
- spluspy-2.0.6/spluspy/spluspy2/crypto/aes.py +111 -0
- spluspy-2.0.6/spluspy/spluspy2/crypto/aesctr.py +42 -0
- spluspy-2.0.6/spluspy/spluspy2/crypto/authkey.py +63 -0
- spluspy-2.0.6/spluspy/spluspy2/crypto/cdndecrypter.py +109 -0
- spluspy-2.0.6/spluspy/spluspy2/crypto/factorization.py +67 -0
- spluspy-2.0.6/spluspy/spluspy2/crypto/libssl.py +138 -0
- spluspy-2.0.6/spluspy/spluspy2/crypto/rsa.py +268 -0
- spluspy-2.0.6/spluspy/spluspy2/custom.py +1 -0
- spluspy-2.0.6/spluspy/spluspy2/errors/__init__.py +46 -0
- spluspy-2.0.6/spluspy/spluspy2/errors/common.py +180 -0
- spluspy-2.0.6/spluspy/spluspy2/errors/rpcbaseerrors.py +135 -0
- spluspy-2.0.6/spluspy/spluspy2/errors/rpcerrorlist.py +5356 -0
- spluspy-2.0.6/spluspy/spluspy2/events/__init__.py +140 -0
- spluspy-2.0.6/spluspy/spluspy2/events/album.py +345 -0
- spluspy-2.0.6/spluspy/spluspy2/events/callbackquery.py +345 -0
- spluspy-2.0.6/spluspy/spluspy2/events/chataction.py +458 -0
- spluspy-2.0.6/spluspy/spluspy2/events/common.py +186 -0
- spluspy-2.0.6/spluspy/spluspy2/events/inlinequery.py +247 -0
- spluspy-2.0.6/spluspy/spluspy2/events/messagedeleted.py +57 -0
- spluspy-2.0.6/spluspy/spluspy2/events/messageedited.py +52 -0
- spluspy-2.0.6/spluspy/spluspy2/events/messageread.py +143 -0
- spluspy-2.0.6/spluspy/spluspy2/events/newmessage.py +223 -0
- spluspy-2.0.6/spluspy/spluspy2/events/raw.py +53 -0
- spluspy-2.0.6/spluspy/spluspy2/events/userupdate.py +310 -0
- spluspy-2.0.6/spluspy/spluspy2/extensions/__init__.py +6 -0
- spluspy-2.0.6/spluspy/spluspy2/extensions/binaryreader.py +210 -0
- spluspy-2.0.6/spluspy/spluspy2/extensions/html.py +208 -0
- spluspy-2.0.6/spluspy/spluspy2/extensions/markdown.py +193 -0
- spluspy-2.0.6/spluspy/spluspy2/extensions/messagepacker.py +122 -0
- spluspy-2.0.6/spluspy/spluspy2/functions.py +1 -0
- spluspy-2.0.6/spluspy/spluspy2/helpers.py +434 -0
- spluspy-2.0.6/spluspy/spluspy2/hints.py +72 -0
- spluspy-2.0.6/spluspy/spluspy2/network/__init__.py +14 -0
- spluspy-2.0.6/spluspy/spluspy2/network/authenticator.py +212 -0
- spluspy-2.0.6/spluspy/spluspy2/network/connection/__init__.py +13 -0
- spluspy-2.0.6/spluspy/spluspy2/network/connection/connection.py +455 -0
- spluspy-2.0.6/spluspy/spluspy2/network/connection/http.py +39 -0
- spluspy-2.0.6/spluspy/spluspy2/network/connection/tcpabridged.py +33 -0
- spluspy-2.0.6/spluspy/spluspy2/network/connection/tcpfull.py +58 -0
- spluspy-2.0.6/spluspy/spluspy2/network/connection/tcpintermediate.py +46 -0
- spluspy-2.0.6/spluspy/spluspy2/network/connection/tcpmtproxy.py +165 -0
- spluspy-2.0.6/spluspy/spluspy2/network/connection/tcpobfuscated.py +62 -0
- spluspy-2.0.6/spluspy/spluspy2/network/connection/websocket.py +387 -0
- spluspy-2.0.6/spluspy/spluspy2/network/mtprotoplainsender.py +56 -0
- spluspy-2.0.6/spluspy/spluspy2/network/mtprotosender.py +979 -0
- spluspy-2.0.6/spluspy/spluspy2/network/mtprotostate.py +285 -0
- spluspy-2.0.6/spluspy/spluspy2/network/requeststate.py +19 -0
- spluspy-2.0.6/spluspy/spluspy2/password.py +194 -0
- spluspy-2.0.6/spluspy/spluspy2/requestiter.py +134 -0
- spluspy-2.0.6/spluspy/spluspy2/sessions/__init__.py +4 -0
- spluspy-2.0.6/spluspy/spluspy2/sessions/abstract.py +172 -0
- spluspy-2.0.6/spluspy/spluspy2/sessions/memory.py +260 -0
- spluspy-2.0.6/spluspy/spluspy2/sessions/sqlite.py +389 -0
- spluspy-2.0.6/spluspy/spluspy2/sessions/string.py +72 -0
- spluspy-2.0.6/spluspy/spluspy2/sync.py +74 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/__init__.py +1 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/alltlobjects.py +1696 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/core/__init__.py +26 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/core/gzippacked.py +48 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/core/messagecontainer.py +47 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/core/rpcresult.py +35 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/core/tlmessage.py +34 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/__init__.py +14 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/adminlogevent.py +475 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/button.py +346 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/chatgetter.py +154 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/conversation.py +529 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/dialog.py +161 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/draft.py +194 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/file.py +146 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/forward.py +51 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/inlinebuilder.py +450 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/inlineresult.py +176 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/inlineresults.py +83 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/inputsizedfile.py +9 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/message.py +1250 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/messagebutton.py +160 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/participantpermissions.py +138 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/qrlogin.py +119 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/sendergetter.py +106 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/custom/types.py +38 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/__init__.py +452 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/account.py +1581 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/auth.py +593 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/bots.py +112 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/channels.py +1672 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/chatlists.py +325 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/conference.py +437 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/contacts.py +476 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/folders.py +44 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/help.py +259 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/langpack.py +146 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/messages.py +5469 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/payments.py +292 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/phone.py +809 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/photos.py +282 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/premium.py +152 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/stats.py +300 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/stories.py +765 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/thirdParty.py +67 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/updates.py +139 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/upload.py +168 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/functions/users.py +170 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/patched/__init__.py +20 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/tlobject.py +222 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/__init__.py +40056 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/account.py +1096 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/auth.py +809 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/bots.py +43 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/channels.py +232 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/chatlists.py +273 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/conference.py +69 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/contacts.py +478 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/help.py +1206 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/messages.py +3000 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/payments.py +633 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/phone.py +313 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/photos.py +135 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/premium.py +209 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/stats.py +368 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/stickers.py +35 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/storage.py +197 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/stories.py +317 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/thirdParty.py +94 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/update.py +39 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/updates.py +447 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/upload.py +196 -0
- spluspy-2.0.6/spluspy/spluspy2/tl/types/users.py +131 -0
- spluspy-2.0.6/spluspy/spluspy2/types.py +1 -0
- spluspy-2.0.6/spluspy/spluspy2/utils.py +1570 -0
- spluspy-2.0.6/spluspy/spluspy2/version.py +3 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/storage/base.py +9 -2
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/storage/sqlite.py +4 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/utils/__init__.py +6 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/utils/batch.py +1 -1
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/utils/cache.py +54 -3
- spluspy-2.0.6/spluspy/utils/chat_lock.py +96 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/utils/file_transfer.py +85 -15
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/utils/logger.py +62 -64
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/utils/rate_limiter.py +211 -211
- spluspy-2.0.6/spluspy/utils/resolver.py +372 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/tests/test_client.py +33 -21
- {spluspy-2.0.4 → spluspy-2.0.6}/tests/test_filters.py +3 -3
- {spluspy-2.0.4 → spluspy-2.0.6}/tests/test_fsm_enhanced.py +12 -12
- spluspy-2.0.6/tests/test_resolver.py +411 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/tests/test_storage.py +12 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/tests/test_types.py +6 -6
- spluspy-2.0.4/debug_client.py +0 -829
- spluspy-2.0.4/examples/12_media_bot.py +0 -38
- spluspy-2.0.4/rename_splusthon.py +0 -280
- spluspy-2.0.4/spluspy/.mimocode/.cron-lock +0 -1
- spluspy-2.0.4/spluspy/compat.py +0 -51
- spluspy-2.0.4/spluspy/network/spluspy_adapter.py +0 -208
- spluspy-2.0.4/spluspy.spluspy +0 -0
- spluspy-2.0.4/tempCodeRunnerFile.py +0 -6
- spluspy-2.0.4/test_handlers.py +0 -85
- spluspy-2.0.4/testbots/main.py +0 -283
- spluspy-2.0.4/tests/.vscode/PythonImportHelper-v2-Completion.json +0 -843
- spluspy-2.0.4/tests/test_storage_backends.py +0 -52
- {spluspy-2.0.4 → spluspy-2.0.6}/CONTRIBUTING.md +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/LICENSE +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/README.rst +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/03_command_bot.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/08_combined_filters.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/16_scheduler_bot.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/17_conversation.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/18_chat_management.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/19_event_types.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/20_sync_bot.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/21_album_handler.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/22_download_bot.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/23_url_button.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/24_string_session.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/25_error_handling.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/25_working_bot.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/26_message_entities.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/27_search_messages.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/28_poll_bot.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/29_dice_bot.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/30_cache_bot.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/31_reaction_bot.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/32_mark_read_bot.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/33_context_manager.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/34_user_info.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/35_chat_info.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/36_forward_copy.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/37_admin_bot.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/38_media_filters.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/39_status_bot.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/40_delete_detection.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/41_read_detection.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/42_raw_events.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/43_poll_handler.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/44_reaction_handler.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/45_typing_handler.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/46_get_messages.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/47_iter_messages.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/48_get_members.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/49_resolve_username.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/examples/50_invoke.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/cli.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/client/__init__.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/client/conversation.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/errors/__init__.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/errors/exceptions.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/events/__init__.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/events/album.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/events/callback.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/events/chat_action.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/events/edited.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/events/inline.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/events/message.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/events/message_deleted.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/events/message_read.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/events/user_update.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/fsm/__init__.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/middleware/__init__.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/models/__init__.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/models/enums.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/network/http_client.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/plugins/__init__.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/session/__init__.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/session/base.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/session/memory.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/session/string.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/storage/__init__.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/storage/memory.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/storage/postgres.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/storage/redis.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/sync/__init__.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/sync/client.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/utils/helpers.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/spluspy/utils/version_check.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/tests/__init__.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/tests/test_fsm.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/tests/test_middleware.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/tests/test_rate_limiter.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/tests/test_scheduler.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/tests/test_session.py +0 -0
- {spluspy-2.0.4 → spluspy-2.0.6}/tests/test_utils.py +0 -0
spluspy-2.0.6/.gitignore
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.egg-info/
|
|
7
|
+
*.egg
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
*.whl
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
venv/
|
|
14
|
+
.venv/
|
|
15
|
+
env/
|
|
16
|
+
|
|
17
|
+
# IDE
|
|
18
|
+
.vscode/
|
|
19
|
+
.idea/
|
|
20
|
+
*.swp
|
|
21
|
+
*.swo
|
|
22
|
+
*~
|
|
23
|
+
|
|
24
|
+
# Testing
|
|
25
|
+
.pytest_cache/
|
|
26
|
+
.coverage
|
|
27
|
+
htmlcov/
|
|
28
|
+
.mypy_cache/
|
|
29
|
+
|
|
30
|
+
# Logs
|
|
31
|
+
*.log
|
|
32
|
+
logs/
|
|
33
|
+
|
|
34
|
+
# Database files
|
|
35
|
+
*.sqlite
|
|
36
|
+
*.sqlite3
|
|
37
|
+
|
|
38
|
+
# Environment
|
|
39
|
+
.env
|
|
40
|
+
.env.*
|
|
41
|
+
|
|
42
|
+
# OS
|
|
43
|
+
Thumbs.db
|
|
44
|
+
Desktop.ini
|
|
45
|
+
.DS_Store
|
|
46
|
+
|
|
47
|
+
# Temporary files
|
|
48
|
+
tempCodeRunnerFile.py
|
|
49
|
+
*.tmp
|
|
50
|
+
*.bak
|
|
@@ -5,6 +5,31 @@ All notable changes to SplusPy will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
7
7
|
|
|
8
|
+
## [2.0.6] - 2026-07-11
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Fixed missing `Union` import in `batch.py` that caused `NameError` at runtime
|
|
12
|
+
- Fixed missing `copy_messages` method call in sync wrapper that caused `AttributeError`
|
|
13
|
+
- Removed unused `SplusConnectionError` import in `client.py`
|
|
14
|
+
- Fixed deprecated `asyncio.get_event_loop()` replaced with `asyncio.get_running_loop()` in network client
|
|
15
|
+
- Fixed FSM `on_enter`/`on_leave` hooks that were registered but never invoked
|
|
16
|
+
- Fixed `RateLimitMiddleware` that incremented counter but didn't actually rate-limit updates
|
|
17
|
+
|
|
18
|
+
### Removed
|
|
19
|
+
- Removed unused `HttpTransport` class from transport module
|
|
20
|
+
- Removed duplicate `test_storage_backends.py` (merged TTL test into `test_storage.py`)
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
- Renamed `FloodWait` in `rate_limiter.py` to `FloodWaitState` to avoid confusion with `errors.FloodWait`
|
|
24
|
+
- Moved inline `import inspect` and `import re` to module-level imports in `client.py`
|
|
25
|
+
- Added `FloodWaitState` docstring clarification in rate limiter
|
|
26
|
+
|
|
27
|
+
### Documentation
|
|
28
|
+
- Fixed README.md project structure: `types/` corrected to `models/`
|
|
29
|
+
- Fixed README.md FSM example that accessed data after `reset()`
|
|
30
|
+
- Fixed Dockerfile `COPY bot.py` that failed when file doesn't exist
|
|
31
|
+
- Added docstring for `Regex` filter side effect (`pattern_match`)
|
|
32
|
+
|
|
8
33
|
## [3.0.0] - 2026-07-10
|
|
9
34
|
|
|
10
35
|
### Added
|
|
@@ -14,8 +14,9 @@ COPY spluspy/ spluspy/
|
|
|
14
14
|
# Install the package
|
|
15
15
|
RUN pip install --no-cache-dir ".[all]"
|
|
16
16
|
|
|
17
|
-
# Copy bot script
|
|
18
|
-
|
|
17
|
+
# Copy bot script (pass as build arg)
|
|
18
|
+
ARG BOT_SCRIPT=bot.py
|
|
19
|
+
COPY ${BOT_SCRIPT} ./
|
|
19
20
|
|
|
20
21
|
# Run the bot
|
|
21
22
|
CMD ["python", "bot.py"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spluspy
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.6
|
|
4
4
|
Summary: A modern async Python library for interacting with Soroush Plus
|
|
5
5
|
Project-URL: Homepage, https://github.com/Itskillmaster/spluspy
|
|
6
6
|
Project-URL: Documentation, https://github.com/Itskillmaster/spluspy#readme
|
|
@@ -36,6 +36,7 @@ Requires-Dist: pytest-cov>=4.0; extra == 'all'
|
|
|
36
36
|
Requires-Dist: pytest>=7.0; extra == 'all'
|
|
37
37
|
Requires-Dist: redis>=4.0; extra == 'all'
|
|
38
38
|
Requires-Dist: ruff>=0.1.0; extra == 'all'
|
|
39
|
+
Requires-Dist: uvloop>=0.19.0; (sys_platform != 'win32') and extra == 'all'
|
|
39
40
|
Provides-Extra: dev
|
|
40
41
|
Requires-Dist: black>=23.0; extra == 'dev'
|
|
41
42
|
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
@@ -50,6 +51,7 @@ Requires-Dist: redis>=4.0; extra == 'redis'
|
|
|
50
51
|
Provides-Extra: speed
|
|
51
52
|
Requires-Dist: cryptg; extra == 'speed'
|
|
52
53
|
Requires-Dist: orjson>=3.9.0; extra == 'speed'
|
|
54
|
+
Requires-Dist: uvloop>=0.19.0; (sys_platform != 'win32') and extra == 'speed'
|
|
53
55
|
Description-Content-Type: text/markdown
|
|
54
56
|
|
|
55
57
|
<div align="center">
|
|
@@ -309,8 +311,9 @@ async def process_form(client, message):
|
|
|
309
311
|
await message.reply("How old are you?")
|
|
310
312
|
elif state == Form.age:
|
|
311
313
|
await ctx.set_data(age=message.text)
|
|
314
|
+
data = await ctx.get_data()
|
|
312
315
|
await ctx.reset()
|
|
313
|
-
await message.reply(f"Registered! Name: {
|
|
316
|
+
await message.reply(f"Registered! Name: {data.get('name')}")
|
|
314
317
|
```
|
|
315
318
|
|
|
316
319
|
#### Advanced FSM: State Routing with Decorators
|
|
@@ -542,7 +545,7 @@ spluspy/
|
|
|
542
545
|
├── config.py # Configuration
|
|
543
546
|
├── compat.py # Compatibility layer
|
|
544
547
|
├── client/ # Client and conversation API
|
|
545
|
-
├──
|
|
548
|
+
├── models/ # Domain models (Message, User, Chat, Media, etc.)
|
|
546
549
|
├── events/ # Event types and builders
|
|
547
550
|
├── filters/ # Composable message filters
|
|
548
551
|
├── errors/ # Custom exception hierarchy
|
|
@@ -255,8 +255,9 @@ async def process_form(client, message):
|
|
|
255
255
|
await message.reply("How old are you?")
|
|
256
256
|
elif state == Form.age:
|
|
257
257
|
await ctx.set_data(age=message.text)
|
|
258
|
+
data = await ctx.get_data()
|
|
258
259
|
await ctx.reset()
|
|
259
|
-
await message.reply(f"Registered! Name: {
|
|
260
|
+
await message.reply(f"Registered! Name: {data.get('name')}")
|
|
260
261
|
```
|
|
261
262
|
|
|
262
263
|
#### Advanced FSM: State Routing with Decorators
|
|
@@ -488,7 +489,7 @@ spluspy/
|
|
|
488
489
|
├── config.py # Configuration
|
|
489
490
|
├── compat.py # Compatibility layer
|
|
490
491
|
├── client/ # Client and conversation API
|
|
491
|
-
├──
|
|
492
|
+
├── models/ # Domain models (Message, User, Chat, Media, etc.)
|
|
492
493
|
├── events/ # Event types and builders
|
|
493
494
|
├── filters/ # Composable message filters
|
|
494
495
|
├── errors/ # Custom exception hierarchy
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
Only responds to messages in private chats.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from spluspy import Client
|
|
7
|
-
from spluspy import filters
|
|
6
|
+
from spluspy import Client, filters
|
|
8
7
|
|
|
9
8
|
bot = Client("private_session")
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
@bot.on_message(filters.private)
|
|
13
|
-
async def private_handler(
|
|
12
|
+
async def private_handler(client, message):
|
|
14
13
|
"""Handle messages in private chats only."""
|
|
15
|
-
await
|
|
14
|
+
await message.reply("This is a private chat!")
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
if __name__ == "__main__":
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
Only responds to messages in group chats.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from spluspy import Client
|
|
7
|
-
from spluspy import filters
|
|
6
|
+
from spluspy import Client, filters
|
|
8
7
|
|
|
9
8
|
bot = Client("group_session")
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
@bot.on_message(filters.group)
|
|
13
|
-
async def group_handler(
|
|
12
|
+
async def group_handler(client, message):
|
|
14
13
|
"""Handle messages in group chats only."""
|
|
15
|
-
await
|
|
14
|
+
await message.reply("This is a group chat!")
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
if __name__ == "__main__":
|
|
@@ -3,23 +3,22 @@
|
|
|
3
3
|
Matches messages using regex patterns.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from spluspy import Client
|
|
7
|
-
from spluspy import filters
|
|
6
|
+
from spluspy import Client, filters
|
|
8
7
|
|
|
9
8
|
bot = Client("regex_session")
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
@bot.on_message(filters.regex(r"\d+"))
|
|
13
|
-
async def number_handler(
|
|
12
|
+
async def number_handler(client, message):
|
|
14
13
|
"""Handle messages containing numbers."""
|
|
15
|
-
numbers =
|
|
16
|
-
await
|
|
14
|
+
numbers = message.pattern_match.group()
|
|
15
|
+
await message.reply(f"I found a number: {numbers}")
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
@bot.on_message(filters.regex(r"(?i)hello|hi|hey"))
|
|
20
|
-
async def greeting_handler(
|
|
19
|
+
async def greeting_handler(client, message):
|
|
21
20
|
"""Handle greeting messages."""
|
|
22
|
-
await
|
|
21
|
+
await message.reply("Hey there!")
|
|
23
22
|
|
|
24
23
|
|
|
25
24
|
if __name__ == "__main__":
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
Responds only to specific users.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from spluspy import Client
|
|
7
|
-
from spluspy import filters
|
|
6
|
+
from spluspy import Client, filters
|
|
8
7
|
|
|
9
8
|
bot = Client("user_filter_session")
|
|
10
9
|
|
|
@@ -13,15 +12,15 @@ ALLOWED_USERS = [123456, 789012]
|
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
@bot.on_message(filters.user(*ALLOWED_USERS))
|
|
16
|
-
async def allowed_handler(
|
|
15
|
+
async def allowed_handler(client, message):
|
|
17
16
|
"""Handle messages from allowed users only."""
|
|
18
|
-
await
|
|
17
|
+
await message.reply("Hello authorized user!")
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
@bot.on_message()
|
|
22
|
-
async def unauthorized_handler(
|
|
21
|
+
async def unauthorized_handler(client, message):
|
|
23
22
|
"""Handle messages from unauthorized users."""
|
|
24
|
-
await
|
|
23
|
+
await message.reply("Sorry, you are not authorized.")
|
|
25
24
|
|
|
26
25
|
|
|
27
26
|
if __name__ == "__main__":
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
Demonstrates inline keyboard buttons and callback queries.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from spluspy import Client
|
|
7
|
-
from spluspy import Button, filters
|
|
6
|
+
from spluspy import Client, Button, filters
|
|
8
7
|
|
|
9
8
|
bot = Client("keyboard_session")
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
@bot.on_message(filters.command("menu"))
|
|
13
|
-
async def menu_handler(
|
|
12
|
+
async def menu_handler(client, message):
|
|
14
13
|
"""Show an inline keyboard menu."""
|
|
15
14
|
keyboard = Button.build_inline(
|
|
16
15
|
[
|
|
@@ -18,19 +17,19 @@ async def menu_handler(m):
|
|
|
18
17
|
[Button.inline("Option 3", b"opt3")],
|
|
19
18
|
]
|
|
20
19
|
)
|
|
21
|
-
await
|
|
20
|
+
await message.reply("Choose an option:", buttons=keyboard)
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
@bot.on_callback_query()
|
|
25
|
-
async def callback_handler(
|
|
24
|
+
async def callback_handler(client, callback):
|
|
26
25
|
"""Handle inline button clicks."""
|
|
27
|
-
data =
|
|
26
|
+
data = callback.text
|
|
28
27
|
if data == "opt1":
|
|
29
|
-
await
|
|
28
|
+
await callback.answer("You chose Option 1!")
|
|
30
29
|
elif data == "opt2":
|
|
31
|
-
await
|
|
30
|
+
await callback.answer("You chose Option 2!")
|
|
32
31
|
elif data == "opt3":
|
|
33
|
-
await
|
|
32
|
+
await callback.answer("You chose Option 3!")
|
|
34
33
|
|
|
35
34
|
|
|
36
35
|
if __name__ == "__main__":
|
|
@@ -3,32 +3,31 @@
|
|
|
3
3
|
Demonstrates reply keyboards (replacing the user's keyboard).
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from spluspy import Client
|
|
7
|
-
from spluspy import Button, filters
|
|
6
|
+
from spluspy import Client, Button, filters
|
|
8
7
|
|
|
9
8
|
bot = Client("reply_keyboard_session")
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
@bot.on_message(filters.command("menu"))
|
|
13
|
-
async def menu_handler(
|
|
12
|
+
async def menu_handler(client, message):
|
|
14
13
|
"""Show a reply keyboard."""
|
|
15
14
|
keyboard = Button.build_reply(
|
|
16
15
|
[Button.text("Settings"), Button.text("Profile")],
|
|
17
16
|
[Button.text("Help")],
|
|
18
17
|
)
|
|
19
|
-
await
|
|
18
|
+
await message.reply("Choose:", buttons=keyboard)
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
@bot.on_message(filters.command("clear"))
|
|
23
|
-
async def clear_handler(
|
|
22
|
+
async def clear_handler(client, message):
|
|
24
23
|
"""Clear the keyboard."""
|
|
25
|
-
await
|
|
24
|
+
await message.reply("Keyboard cleared!", buttons=Button.clear())
|
|
26
25
|
|
|
27
26
|
|
|
28
27
|
@bot.on_message(filters.text)
|
|
29
|
-
async def text_handler(
|
|
28
|
+
async def text_handler(client, message):
|
|
30
29
|
"""Handle text messages."""
|
|
31
|
-
await
|
|
30
|
+
await message.reply(f"You pressed: {message.text}")
|
|
32
31
|
|
|
33
32
|
|
|
34
33
|
if __name__ == "__main__":
|
|
@@ -3,38 +3,36 @@
|
|
|
3
3
|
Demonstrates various message actions like edit, delete, forward, pin.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from spluspy import Client
|
|
7
|
-
from spluspy import filters
|
|
6
|
+
from spluspy import Client, filters
|
|
8
7
|
|
|
9
8
|
bot = Client("actions_session")
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
@bot.on_message(filters.command("edit"))
|
|
13
|
-
async def edit_example(
|
|
12
|
+
async def edit_example(client, message):
|
|
14
13
|
"""Demonstrate message editing."""
|
|
15
|
-
sent = await
|
|
14
|
+
sent = await message.reply("This message will be edited...")
|
|
16
15
|
await sent.edit("Message edited successfully!")
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
@bot.on_message(filters.command("pin"))
|
|
20
|
-
async def pin_example(
|
|
19
|
+
async def pin_example(client, message):
|
|
21
20
|
"""Demonstrate message pinning."""
|
|
22
|
-
sent = await
|
|
21
|
+
sent = await message.reply("This message will be pinned!")
|
|
23
22
|
await sent.pin(notify=True)
|
|
24
23
|
|
|
25
24
|
|
|
26
25
|
@bot.on_message(filters.command("forward"))
|
|
27
|
-
async def forward_example(
|
|
26
|
+
async def forward_example(client, message):
|
|
28
27
|
"""Demonstrate message forwarding."""
|
|
29
|
-
await
|
|
30
|
-
# await m.forward(target_chat_id)
|
|
28
|
+
await message.reply("Forwarding this message...")
|
|
31
29
|
|
|
32
30
|
|
|
33
31
|
@bot.on_message(filters.command("react"))
|
|
34
|
-
async def react_example(
|
|
32
|
+
async def react_example(client, message):
|
|
35
33
|
"""Demonstrate reactions."""
|
|
36
|
-
await
|
|
37
|
-
await
|
|
34
|
+
await message.react("❤️")
|
|
35
|
+
await message.reply("Reaction added!")
|
|
38
36
|
|
|
39
37
|
|
|
40
38
|
if __name__ == "__main__":
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Example 12: Media Bot
|
|
2
|
+
|
|
3
|
+
Demonstrates sending different types of media.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from spluspy import Client, filters
|
|
7
|
+
|
|
8
|
+
bot = Client("media_session")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@bot.on_message(filters.command("photo"))
|
|
12
|
+
async def photo_example(client, message):
|
|
13
|
+
"""Send a photo."""
|
|
14
|
+
await message.reply_photo("https://example.com/photo.jpg", caption="Here is a photo!")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@bot.on_message(filters.command("video"))
|
|
18
|
+
async def video_example(client, message):
|
|
19
|
+
"""Send a video."""
|
|
20
|
+
await message.reply_video("https://example.com/video.mp4", caption="Here is a video!")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@bot.on_message(filters.command("document"))
|
|
24
|
+
async def document_example(client, message):
|
|
25
|
+
"""Send a document."""
|
|
26
|
+
await message.reply_document("https://example.com/file.pdf", caption="Here is a document!")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@bot.on_message(filters.command("location"))
|
|
30
|
+
async def location_example(client, message):
|
|
31
|
+
"""Send a location."""
|
|
32
|
+
await message.reply("Sending location...")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if __name__ == "__main__":
|
|
36
|
+
bot.run()
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
Demonstrates the Finite State Machine for conversational flows.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from spluspy import Client
|
|
7
|
-
from spluspy import filters
|
|
6
|
+
from spluspy import Client, filters
|
|
8
7
|
from spluspy.fsm import State, StateMachine
|
|
9
8
|
from spluspy.storage import MemoryStorage
|
|
10
9
|
|
|
@@ -22,40 +21,40 @@ class RegistrationForm:
|
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
@bot.on_message(filters.command("register"))
|
|
25
|
-
async def start_registration(
|
|
24
|
+
async def start_registration(client, message):
|
|
26
25
|
"""Start the registration flow."""
|
|
27
|
-
ctx = fsm.context(
|
|
26
|
+
ctx = fsm.context(message.sender_id)
|
|
28
27
|
await ctx.set_state(RegistrationForm.name)
|
|
29
|
-
await
|
|
28
|
+
await message.reply("What is your name?")
|
|
30
29
|
|
|
31
30
|
|
|
32
31
|
@bot.on_message(filters.private)
|
|
33
|
-
async def process_form(
|
|
32
|
+
async def process_form(client, message):
|
|
34
33
|
"""Process form responses based on current state."""
|
|
35
|
-
ctx = fsm.context(
|
|
34
|
+
ctx = fsm.context(message.sender_id)
|
|
36
35
|
state = await ctx.get_state()
|
|
37
36
|
|
|
38
37
|
if state is None:
|
|
39
38
|
return
|
|
40
39
|
|
|
41
40
|
if state == RegistrationForm.name:
|
|
42
|
-
await ctx.set_data(name=
|
|
41
|
+
await ctx.set_data(name=message.text)
|
|
43
42
|
await ctx.set_state(RegistrationForm.age)
|
|
44
|
-
await
|
|
43
|
+
await message.reply("How old are you?")
|
|
45
44
|
|
|
46
45
|
elif state == RegistrationForm.age:
|
|
47
|
-
await ctx.set_data(age=
|
|
46
|
+
await ctx.set_data(age=message.text)
|
|
48
47
|
await ctx.set_state(RegistrationForm.city)
|
|
49
|
-
await
|
|
48
|
+
await message.reply("Which city are you from?")
|
|
50
49
|
|
|
51
50
|
elif state == RegistrationForm.city:
|
|
52
51
|
data = await ctx.get_data()
|
|
53
52
|
await ctx.reset()
|
|
54
|
-
await
|
|
53
|
+
await message.reply(
|
|
55
54
|
f"Registration complete!\n"
|
|
56
55
|
f"Name: {data.get('name')}\n"
|
|
57
56
|
f"Age: {data.get('age')}\n"
|
|
58
|
-
f"City: {
|
|
57
|
+
f"City: {message.text}"
|
|
59
58
|
)
|
|
60
59
|
|
|
61
60
|
|
|
@@ -6,6 +6,8 @@ Demonstrates the plugin loading system.
|
|
|
6
6
|
# plugins/greetings.py
|
|
7
7
|
"""Greeting plugin."""
|
|
8
8
|
|
|
9
|
+
from spluspy import filters
|
|
10
|
+
|
|
9
11
|
GREETINGS = {
|
|
10
12
|
"hello": "Hello there!",
|
|
11
13
|
"hi": "Hey!",
|
|
@@ -18,14 +20,14 @@ def register(client):
|
|
|
18
20
|
"""Register plugin handlers with the client."""
|
|
19
21
|
|
|
20
22
|
@client.on_message(filters.command("greet"))
|
|
21
|
-
async def greet_handler(
|
|
22
|
-
await
|
|
23
|
+
async def greet_handler(client, message):
|
|
24
|
+
await message.reply("Available greetings: hello, hi, salam, bye")
|
|
23
25
|
|
|
24
26
|
@client.on_message(filters.text)
|
|
25
|
-
async def auto_greet(
|
|
26
|
-
text =
|
|
27
|
+
async def auto_greet(client, message):
|
|
28
|
+
text = message.text.lower().strip()
|
|
27
29
|
if text in GREETINGS:
|
|
28
|
-
await
|
|
30
|
+
await message.reply(GREETINGS[text])
|
|
29
31
|
|
|
30
32
|
|
|
31
33
|
# main.py
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "spluspy"
|
|
7
|
-
version = "2.0.
|
|
7
|
+
version = "2.0.6"
|
|
8
8
|
description = "A modern async Python library for interacting with Soroush Plus"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -43,6 +43,7 @@ dependencies = [
|
|
|
43
43
|
speed = [
|
|
44
44
|
"cryptg",
|
|
45
45
|
"orjson>=3.9.0",
|
|
46
|
+
"uvloop>=0.19.0; sys_platform != 'win32'",
|
|
46
47
|
]
|
|
47
48
|
redis = [
|
|
48
49
|
"redis>=4.0",
|
|
@@ -64,6 +64,7 @@ from spluspy.fsm import State, StateMachine, FSMContext, StateTransition
|
|
|
64
64
|
from spluspy.storage import Storage, MemoryStorage, SQLiteStorage, get_storage
|
|
65
65
|
from spluspy.middleware.base import Middleware, MiddlewareManager
|
|
66
66
|
from spluspy.middleware.rate_limit import RateLimitMiddleware
|
|
67
|
+
from spluspy.network.protocols import IAdapter, ITransport, IStorage, IEventDispatcher
|
|
67
68
|
from spluspy.utils.logger import (
|
|
68
69
|
setup_logging,
|
|
69
70
|
get_logger,
|
|
@@ -72,6 +73,11 @@ from spluspy.utils.logger import (
|
|
|
72
73
|
)
|
|
73
74
|
from spluspy.utils.rate_limiter import RateLimiter, FloodWaitError
|
|
74
75
|
from spluspy.utils.cache import LRUCache, EntityCache
|
|
76
|
+
from spluspy.utils.resolver import TargetResolver, TargetResolution, resolve_reply_sender
|
|
77
|
+
from spluspy.afk import AfkManager
|
|
78
|
+
from spluspy.admin import ChatAdmin
|
|
79
|
+
from spluspy.mirror import MessageMirror
|
|
80
|
+
from spluspy.scheduler.scheduler import MessageScheduler
|
|
75
81
|
|
|
76
82
|
__all__ = [
|
|
77
83
|
"__version__",
|
|
@@ -124,10 +130,21 @@ __all__ = [
|
|
|
124
130
|
"Middleware",
|
|
125
131
|
"MiddlewareManager",
|
|
126
132
|
"RateLimitMiddleware",
|
|
133
|
+
"IAdapter",
|
|
134
|
+
"ITransport",
|
|
135
|
+
"IStorage",
|
|
136
|
+
"IEventDispatcher",
|
|
127
137
|
"RateLimiter",
|
|
128
138
|
"FloodWaitError",
|
|
129
139
|
"LRUCache",
|
|
130
140
|
"EntityCache",
|
|
141
|
+
"TargetResolver",
|
|
142
|
+
"TargetResolution",
|
|
143
|
+
"resolve_reply_sender",
|
|
144
|
+
"AfkManager",
|
|
145
|
+
"ChatAdmin",
|
|
146
|
+
"MessageMirror",
|
|
147
|
+
"MessageScheduler",
|
|
131
148
|
"setup_logging",
|
|
132
149
|
"get_logger",
|
|
133
150
|
"set_level",
|