spluspy 2.0.2__tar.gz → 2.0.4__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.
Files changed (172) hide show
  1. spluspy-2.0.4/CHANGELOG.md +132 -0
  2. spluspy-2.0.4/Dockerfile +21 -0
  3. spluspy-2.0.4/PKG-INFO +1084 -0
  4. spluspy-2.0.4/README.md +1030 -0
  5. spluspy-2.0.4/README.rst +504 -0
  6. spluspy-2.0.4/debug_client.py +829 -0
  7. {spluspy-2.0.2 → spluspy-2.0.4}/examples/01_hello_bot.py +4 -3
  8. {spluspy-2.0.2 → spluspy-2.0.4}/examples/02_echo_bot.py +4 -5
  9. spluspy-2.0.4/examples/03_command_bot.py +42 -0
  10. spluspy-2.0.4/examples/08_combined_filters.py +49 -0
  11. spluspy-2.0.4/examples/25_error_handling.py +58 -0
  12. {spluspy-2.0.2 → spluspy-2.0.4}/pyproject.toml +13 -2
  13. spluspy-2.0.4/rename_splusthon.py +280 -0
  14. spluspy-2.0.4/spluspy/.mimocode/.cron-lock +1 -0
  15. spluspy-2.0.4/spluspy/__init__.py +135 -0
  16. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/__version__.py +1 -1
  17. spluspy-2.0.4/spluspy/cli.py +116 -0
  18. spluspy-2.0.4/spluspy/client/client.py +1467 -0
  19. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/client/conversation.py +1 -1
  20. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/config.py +23 -15
  21. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/errors/__init__.py +16 -0
  22. spluspy-2.0.4/spluspy/errors/exceptions.py +139 -0
  23. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/events/__init__.py +10 -1
  24. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/events/album.py +1 -1
  25. spluspy-2.0.4/spluspy/events/base.py +165 -0
  26. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/events/callback.py +1 -1
  27. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/events/edited.py +1 -1
  28. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/events/inline.py +1 -1
  29. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/events/message.py +1 -1
  30. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/events/user_update.py +1 -1
  31. spluspy-2.0.4/spluspy/filters/__init__.py +173 -0
  32. spluspy-2.0.4/spluspy/filters/filters.py +599 -0
  33. spluspy-2.0.4/spluspy/fsm/__init__.py +10 -0
  34. spluspy-2.0.4/spluspy/fsm/state.py +264 -0
  35. spluspy-2.0.4/spluspy/middleware/rate_limit.py +66 -0
  36. {spluspy-2.0.2/spluspy/types → spluspy-2.0.4/spluspy/models}/__init__.py +8 -7
  37. {spluspy-2.0.2/spluspy/types → spluspy-2.0.4/spluspy/models}/bot.py +3 -3
  38. {spluspy-2.0.2/spluspy/types → spluspy-2.0.4/spluspy/models}/chat.py +63 -1
  39. {spluspy-2.0.2/spluspy/types → spluspy-2.0.4/spluspy/models}/media.py +1 -1
  40. {spluspy-2.0.2/spluspy/types → spluspy-2.0.4/spluspy/models}/message.py +22 -7
  41. {spluspy-2.0.2/spluspy/types → spluspy-2.0.4/spluspy/models}/user.py +1 -1
  42. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/network/__init__.py +2 -0
  43. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/network/client.py +171 -32
  44. spluspy-2.0.4/spluspy/network/http_client.py +355 -0
  45. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/network/mtproto.py +20 -17
  46. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/network/spluspy_adapter.py +79 -4
  47. spluspy-2.0.4/spluspy/session/sqlite.py +331 -0
  48. spluspy-2.0.4/spluspy/storage/__init__.py +44 -0
  49. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/storage/memory.py +1 -1
  50. spluspy-2.0.4/spluspy/storage/postgres.py +183 -0
  51. spluspy-2.0.4/spluspy/storage/redis.py +140 -0
  52. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/sync/client.py +2 -2
  53. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/utils/__init__.py +3 -0
  54. spluspy-2.0.4/spluspy/utils/batch.py +178 -0
  55. spluspy-2.0.4/spluspy/utils/cache.py +215 -0
  56. spluspy-2.0.4/spluspy/utils/file_transfer.py +258 -0
  57. spluspy-2.0.4/spluspy/utils/rate_limiter.py +211 -0
  58. spluspy-2.0.4/spluspy/utils/version_check.py +86 -0
  59. spluspy-2.0.4/spluspy.spluspy +0 -0
  60. spluspy-2.0.4/testbots/main.py +283 -0
  61. spluspy-2.0.4/tests/test_client.py +476 -0
  62. {spluspy-2.0.2 → spluspy-2.0.4}/tests/test_filters.py +3 -3
  63. spluspy-2.0.4/tests/test_fsm_enhanced.py +106 -0
  64. spluspy-2.0.4/tests/test_rate_limiter.py +63 -0
  65. spluspy-2.0.4/tests/test_session.py +180 -0
  66. spluspy-2.0.4/tests/test_storage_backends.py +52 -0
  67. spluspy-2.0.4/tests/test_utils.py +96 -0
  68. spluspy-2.0.2/CHANGELOG.md +0 -53
  69. spluspy-2.0.2/PKG-INFO +0 -324
  70. spluspy-2.0.2/README.md +0 -279
  71. spluspy-2.0.2/README.rst +0 -76
  72. spluspy-2.0.2/examples/03_command_bot.py +0 -31
  73. spluspy-2.0.2/examples/08_combined_filters.py +0 -31
  74. spluspy-2.0.2/examples/25_error_handling.py +0 -30
  75. spluspy-2.0.2/spluspy/__init__.py +0 -59
  76. spluspy-2.0.2/spluspy/client/client.py +0 -688
  77. spluspy-2.0.2/spluspy/errors/exceptions.py +0 -76
  78. spluspy-2.0.2/spluspy/events/base.py +0 -75
  79. spluspy-2.0.2/spluspy/filters/__init__.py +0 -66
  80. spluspy-2.0.2/spluspy/filters/filters.py +0 -255
  81. spluspy-2.0.2/spluspy/fsm/__init__.py +0 -5
  82. spluspy-2.0.2/spluspy/fsm/state.py +0 -146
  83. spluspy-2.0.2/spluspy/session/sqlite.py +0 -112
  84. spluspy-2.0.2/spluspy/storage/__init__.py +0 -11
  85. spluspy-2.0.2/spluspy/utils/cache.py +0 -86
  86. spluspy-2.0.2/testbots/hello_bot.py +0 -16
  87. spluspy-2.0.2/tests/test_client.py +0 -141
  88. spluspy-2.0.2/tests/test_session.py +0 -84
  89. spluspy-2.0.2/tests/test_utils.py +0 -90
  90. {spluspy-2.0.2 → spluspy-2.0.4}/CONTRIBUTING.md +0 -0
  91. {spluspy-2.0.2 → spluspy-2.0.4}/LICENSE +0 -0
  92. {spluspy-2.0.2 → spluspy-2.0.4}/MANIFEST.in +0 -0
  93. {spluspy-2.0.2 → spluspy-2.0.4}/examples/04_private_only.py +0 -0
  94. {spluspy-2.0.2 → spluspy-2.0.4}/examples/05_group_only.py +0 -0
  95. {spluspy-2.0.2 → spluspy-2.0.4}/examples/06_regex_bot.py +0 -0
  96. {spluspy-2.0.2 → spluspy-2.0.4}/examples/07_user_filter.py +0 -0
  97. {spluspy-2.0.2 → spluspy-2.0.4}/examples/09_inline_keyboard.py +0 -0
  98. {spluspy-2.0.2 → spluspy-2.0.4}/examples/10_reply_keyboard.py +0 -0
  99. {spluspy-2.0.2 → spluspy-2.0.4}/examples/11_message_actions.py +0 -0
  100. {spluspy-2.0.2 → spluspy-2.0.4}/examples/12_media_bot.py +0 -0
  101. {spluspy-2.0.2 → spluspy-2.0.4}/examples/13_fsm_bot.py +0 -0
  102. {spluspy-2.0.2 → spluspy-2.0.4}/examples/14_plugin_bot.py +0 -0
  103. {spluspy-2.0.2 → spluspy-2.0.4}/examples/15_middleware_bot.py +0 -0
  104. {spluspy-2.0.2 → spluspy-2.0.4}/examples/16_scheduler_bot.py +0 -0
  105. {spluspy-2.0.2 → spluspy-2.0.4}/examples/17_conversation.py +0 -0
  106. {spluspy-2.0.2 → spluspy-2.0.4}/examples/18_chat_management.py +0 -0
  107. {spluspy-2.0.2 → spluspy-2.0.4}/examples/19_event_types.py +0 -0
  108. {spluspy-2.0.2 → spluspy-2.0.4}/examples/20_sync_bot.py +0 -0
  109. {spluspy-2.0.2 → spluspy-2.0.4}/examples/21_album_handler.py +0 -0
  110. {spluspy-2.0.2 → spluspy-2.0.4}/examples/22_download_bot.py +0 -0
  111. {spluspy-2.0.2 → spluspy-2.0.4}/examples/23_url_button.py +0 -0
  112. {spluspy-2.0.2 → spluspy-2.0.4}/examples/24_string_session.py +0 -0
  113. {spluspy-2.0.2 → spluspy-2.0.4}/examples/25_working_bot.py +0 -0
  114. {spluspy-2.0.2 → spluspy-2.0.4}/examples/26_message_entities.py +0 -0
  115. {spluspy-2.0.2 → spluspy-2.0.4}/examples/27_search_messages.py +0 -0
  116. {spluspy-2.0.2 → spluspy-2.0.4}/examples/28_poll_bot.py +0 -0
  117. {spluspy-2.0.2 → spluspy-2.0.4}/examples/29_dice_bot.py +0 -0
  118. {spluspy-2.0.2 → spluspy-2.0.4}/examples/30_cache_bot.py +0 -0
  119. {spluspy-2.0.2 → spluspy-2.0.4}/examples/31_reaction_bot.py +0 -0
  120. {spluspy-2.0.2 → spluspy-2.0.4}/examples/32_mark_read_bot.py +0 -0
  121. {spluspy-2.0.2 → spluspy-2.0.4}/examples/33_context_manager.py +0 -0
  122. {spluspy-2.0.2 → spluspy-2.0.4}/examples/34_user_info.py +0 -0
  123. {spluspy-2.0.2 → spluspy-2.0.4}/examples/35_chat_info.py +0 -0
  124. {spluspy-2.0.2 → spluspy-2.0.4}/examples/36_forward_copy.py +0 -0
  125. {spluspy-2.0.2 → spluspy-2.0.4}/examples/37_admin_bot.py +0 -0
  126. {spluspy-2.0.2 → spluspy-2.0.4}/examples/38_media_filters.py +0 -0
  127. {spluspy-2.0.2 → spluspy-2.0.4}/examples/39_status_bot.py +0 -0
  128. {spluspy-2.0.2 → spluspy-2.0.4}/examples/40_delete_detection.py +0 -0
  129. {spluspy-2.0.2 → spluspy-2.0.4}/examples/41_read_detection.py +0 -0
  130. {spluspy-2.0.2 → spluspy-2.0.4}/examples/42_raw_events.py +0 -0
  131. {spluspy-2.0.2 → spluspy-2.0.4}/examples/43_poll_handler.py +0 -0
  132. {spluspy-2.0.2 → spluspy-2.0.4}/examples/44_reaction_handler.py +0 -0
  133. {spluspy-2.0.2 → spluspy-2.0.4}/examples/45_typing_handler.py +0 -0
  134. {spluspy-2.0.2 → spluspy-2.0.4}/examples/46_get_messages.py +0 -0
  135. {spluspy-2.0.2 → spluspy-2.0.4}/examples/47_iter_messages.py +0 -0
  136. {spluspy-2.0.2 → spluspy-2.0.4}/examples/48_get_members.py +0 -0
  137. {spluspy-2.0.2 → spluspy-2.0.4}/examples/49_resolve_username.py +0 -0
  138. {spluspy-2.0.2 → spluspy-2.0.4}/examples/50_invoke.py +0 -0
  139. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/client/__init__.py +0 -0
  140. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/compat.py +0 -0
  141. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/events/chat_action.py +0 -0
  142. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/events/message_deleted.py +0 -0
  143. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/events/message_read.py +0 -0
  144. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/middleware/__init__.py +0 -0
  145. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/middleware/base.py +0 -0
  146. {spluspy-2.0.2/spluspy/types → spluspy-2.0.4/spluspy/models}/enums.py +0 -0
  147. {spluspy-2.0.2/spluspy/types → spluspy-2.0.4/spluspy/models}/objects.py +0 -0
  148. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/network/connection.py +0 -0
  149. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/network/telethon_adapter.py +0 -0
  150. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/network/transport.py +0 -0
  151. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/plugins/__init__.py +0 -0
  152. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/plugins/loader.py +0 -0
  153. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/scheduler/__init__.py +0 -0
  154. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/scheduler/scheduler.py +0 -0
  155. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/session/__init__.py +0 -0
  156. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/session/base.py +0 -0
  157. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/session/memory.py +0 -0
  158. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/session/string.py +0 -0
  159. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/storage/base.py +0 -0
  160. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/storage/sqlite.py +0 -0
  161. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/sync/__init__.py +0 -0
  162. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/utils/helpers.py +0 -0
  163. {spluspy-2.0.2 → spluspy-2.0.4}/spluspy/utils/logger.py +0 -0
  164. {spluspy-2.0.2 → spluspy-2.0.4}/tempCodeRunnerFile.py +0 -0
  165. {spluspy-2.0.2 → spluspy-2.0.4}/test_handlers.py +0 -0
  166. {spluspy-2.0.2 → spluspy-2.0.4}/tests/.vscode/PythonImportHelper-v2-Completion.json +0 -0
  167. {spluspy-2.0.2 → spluspy-2.0.4}/tests/__init__.py +0 -0
  168. {spluspy-2.0.2 → spluspy-2.0.4}/tests/test_fsm.py +0 -0
  169. {spluspy-2.0.2 → spluspy-2.0.4}/tests/test_middleware.py +0 -0
  170. {spluspy-2.0.2 → spluspy-2.0.4}/tests/test_scheduler.py +0 -0
  171. {spluspy-2.0.2 → spluspy-2.0.4}/tests/test_storage.py +0 -0
  172. {spluspy-2.0.2 → spluspy-2.0.4}/tests/test_types.py +0 -0
@@ -0,0 +1,132 @@
1
+ # Changelog
2
+
3
+ All notable changes to SplusPy will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/).
7
+
8
+ ## [3.0.0] - 2026-07-10
9
+
10
+ ### Added
11
+
12
+ #### Security
13
+ - Removed insecure AES-ECB fallback for IGE encryption — PyCryptodome is now required
14
+ - Removed hardcoded API credentials — `api_id` and `api_hash` must be provided by user
15
+
16
+ #### Core
17
+ - Complete Diffie-Hellman authorization key exchange (was previously a stub)
18
+ - Full MTProto encrypted message handling with proper key derivation
19
+
20
+ #### Storage Backends
21
+ - `RedisStorage` — high-performance Redis backend with TTL, hash operations, and counters
22
+ - `PostgresStorage` — production PostgreSQL backend with JSONB, indexes, and connection pooling
23
+ - `get_storage()` factory function for creating backends by name
24
+
25
+ #### FSM Enhancements
26
+ - Decorator-based state routing: `@sm.state(Form.name)`
27
+ - `on_enter` / `on_leave` hooks for state transitions
28
+ - Fallback handler for unmatched states
29
+ - `FSMContext.get()` / `FSMContext.set()` for single key access
30
+ - `FSMContext.finish()` alias for reset
31
+ - `StateTransition` class for conditional transitions
32
+
33
+ #### Rate Limiting
34
+ - `RateLimiter` with token bucket algorithm
35
+ - `RateLimitMiddleware` for automatic flood wait handling
36
+ - `FloodWait` and `FloodWaitError` exception types
37
+ - Per-method rate limiting with configurable thresholds
38
+
39
+ #### File Transfer
40
+ - `ProgressTracker` and `TransferProgress` for upload/download progress
41
+ - `stream_upload()` and `stream_download()` with chunked transfer
42
+ - `parallel_download()` for concurrent media downloads
43
+ - `format_size()` utility for human-readable file sizes
44
+
45
+ #### Event System
46
+ - `HandlerPriority` enum (FIRST, HIGH, NORMAL, LOW, LAST)
47
+ - Handler priority ordering — lower values run first
48
+ - `Event.stop_propagation()` to prevent subsequent handlers from running
49
+ - `ErrorEvent` for handler error reporting
50
+ - `@bot.on_error()` decorator for global error handling
51
+ - `ErrorHandlerBuilder` for filtering errors by exception type
52
+
53
+ #### Performance
54
+ - `LRUCache` with hit/miss statistics and TTL support
55
+ - `EntityCache` for auto-caching users/chats with deduplication
56
+ - `batch_send()`, `batch_delete()`, `batch_forward()`, `batch_get_messages()`
57
+ - `batch_operation()` generic batch executor
58
+
59
+ #### Packaging & CLI
60
+ - CLI entry point: `spluspy run bot.py`, `spluspy session-info`, `spluspy version`, `spluspy validate`
61
+ - Dockerfile for containerized bot deployment
62
+ - Optional dependencies: `pip install spluspy[redis]`, `pip install spluspy[postgres]`
63
+
64
+ #### Testing
65
+ - Tests for storage backends
66
+ - Tests for enhanced FSM
67
+ - Tests for rate limiter
68
+
69
+ ### Changed
70
+ - `SoroushAPI` no longer has hardcoded `api_id`/`api_hash` — credentials must come from user
71
+ - `TelegramConfig.apply_defaults()` now raises `ValueError` if credentials are missing
72
+ - `EventBuilder` accepts `priority` parameter
73
+ - `Client.on_message()` accepts `priority` kwarg
74
+ - Updated `pyproject.toml` with new optional dependencies and CLI entry point
75
+
76
+ ### Fixed
77
+ - AES-ECB fallback was insecure and broke IGE mode
78
+ - Auth key exchange was a stub that never performed real DH exchange
79
+ - `_process_message` now properly parses encrypted MTProto containers
80
+
81
+ ---
82
+
83
+ ## [2.0.0] - 2024-01-01
84
+
85
+ ### Added
86
+
87
+ - Complete rewrite from scratch with clean architecture
88
+ - Async-first design with full type hints
89
+ - Synchronous client wrapper (`spluspy.sync`)
90
+ - Composable filter system (`filters.text & filters.private`)
91
+ - FSM (Finite State Machine) for conversational bots
92
+ - Plugin system with dynamic loading
93
+ - Middleware system for pre/post processing
94
+ - Task scheduler
95
+ - Multiple storage backends (Memory, SQLite)
96
+ - Professional logging system
97
+ - Connection pool with auto-reconnect
98
+ - LRU cache
99
+ - 100+ examples
100
+ - Full test suite with pytest
101
+ - CI/CD with GitHub Actions
102
+
103
+ ### Changed
104
+
105
+ - Complete API redesign inspired by Telethon/Pyrogram
106
+ - Message objects now have methods (reply, edit, delete, etc.)
107
+ - Event system uses builder pattern
108
+ - Session system supports SQLite, Memory, and String sessions
109
+ - Exception hierarchy with specific error types
110
+
111
+ ### Removed
112
+
113
+ - Legacy Telethon-forked code
114
+ - Monolithic architecture
115
+ - Untyped code
116
+
117
+ ---
118
+
119
+ ## [1.0.1] - 2023-12-01
120
+
121
+ ### Fixed
122
+
123
+ - Minor bug fixes
124
+
125
+ ---
126
+
127
+ ## [1.0.0] - 2023-11-01
128
+
129
+ ### Added
130
+
131
+ - Initial release as a Telethon fork
132
+ - Basic Soroush Plus support
@@ -0,0 +1,21 @@
1
+ FROM python:3.12-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install system dependencies
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ gcc \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ # Copy requirements first for Docker layer caching
11
+ COPY pyproject.toml README.md ./
12
+ COPY spluspy/ spluspy/
13
+
14
+ # Install the package
15
+ RUN pip install --no-cache-dir ".[all]"
16
+
17
+ # Copy bot script if present
18
+ COPY bot.py ./
19
+
20
+ # Run the bot
21
+ CMD ["python", "bot.py"]