maxrubika 1.0.0__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 (62) hide show
  1. maxrubika-1.0.0/LICENSE +21 -0
  2. maxrubika-1.0.0/PKG-INFO +519 -0
  3. maxrubika-1.0.0/README.md +479 -0
  4. maxrubika-1.0.0/maxrubika/TheBot.py +300 -0
  5. maxrubika-1.0.0/maxrubika/__init__.py +21 -0
  6. maxrubika-1.0.0/maxrubika/bot/__init__.py +74 -0
  7. maxrubika-1.0.0/maxrubika/bot/auto_delete_message.py +24 -0
  8. maxrubika-1.0.0/maxrubika/bot/ban_member.py +37 -0
  9. maxrubika-1.0.0/maxrubika/bot/bridge.py +64 -0
  10. maxrubika-1.0.0/maxrubika/bot/callback.py +24 -0
  11. maxrubika-1.0.0/maxrubika/bot/command.py +40 -0
  12. maxrubika-1.0.0/maxrubika/bot/delete_message.py +37 -0
  13. maxrubika-1.0.0/maxrubika/bot/download_file.py +172 -0
  14. maxrubika-1.0.0/maxrubika/bot/edit_chat_keypad.py +68 -0
  15. maxrubika-1.0.0/maxrubika/bot/edit_inline_keypad.py +65 -0
  16. maxrubika-1.0.0/maxrubika/bot/edit_message.py +61 -0
  17. maxrubika-1.0.0/maxrubika/bot/exceptions.py +97 -0
  18. maxrubika-1.0.0/maxrubika/bot/file_extensions.py +205 -0
  19. maxrubika-1.0.0/maxrubika/bot/filters.py +454 -0
  20. maxrubika-1.0.0/maxrubika/bot/forward_message.py +48 -0
  21. maxrubika-1.0.0/maxrubika/bot/get_chat_info.py +22 -0
  22. maxrubika-1.0.0/maxrubika/bot/get_file.py +13 -0
  23. maxrubika-1.0.0/maxrubika/bot/get_me.py +12 -0
  24. maxrubika-1.0.0/maxrubika/bot/get_updates.py +26 -0
  25. maxrubika-1.0.0/maxrubika/bot/keypad_mixin.py +74 -0
  26. maxrubika-1.0.0/maxrubika/bot/lifecycle.py +27 -0
  27. maxrubika-1.0.0/maxrubika/bot/message.py +46 -0
  28. maxrubika-1.0.0/maxrubika/bot/metadata.py +165 -0
  29. maxrubika-1.0.0/maxrubika/bot/middleware.py +25 -0
  30. maxrubika-1.0.0/maxrubika/bot/plugin.py +433 -0
  31. maxrubika-1.0.0/maxrubika/bot/register_all_endpoints.py +45 -0
  32. maxrubika-1.0.0/maxrubika/bot/registry.py +135 -0
  33. maxrubika-1.0.0/maxrubika/bot/remove_chat_keypad.py +28 -0
  34. maxrubika-1.0.0/maxrubika/bot/remove_member.py +37 -0
  35. maxrubika-1.0.0/maxrubika/bot/request_send_file.py +39 -0
  36. maxrubika-1.0.0/maxrubika/bot/run.py +37 -0
  37. maxrubika-1.0.0/maxrubika/bot/send_contact.py +71 -0
  38. maxrubika-1.0.0/maxrubika/bot/send_file.py +105 -0
  39. maxrubika-1.0.0/maxrubika/bot/send_gif.py +48 -0
  40. maxrubika-1.0.0/maxrubika/bot/send_image.py +48 -0
  41. maxrubika-1.0.0/maxrubika/bot/send_location.py +75 -0
  42. maxrubika-1.0.0/maxrubika/bot/send_message.py +78 -0
  43. maxrubika-1.0.0/maxrubika/bot/send_music.py +48 -0
  44. maxrubika-1.0.0/maxrubika/bot/send_poll.py +87 -0
  45. maxrubika-1.0.0/maxrubika/bot/send_quiz.py +120 -0
  46. maxrubika-1.0.0/maxrubika/bot/send_video.py +48 -0
  47. maxrubika-1.0.0/maxrubika/bot/send_voice.py +48 -0
  48. maxrubika-1.0.0/maxrubika/bot/set_commands.py +55 -0
  49. maxrubika-1.0.0/maxrubika/bot/start.py +136 -0
  50. maxrubika-1.0.0/maxrubika/bot/unban_member.py +37 -0
  51. maxrubika-1.0.0/maxrubika/bot/update_bot_endpoints.py +56 -0
  52. maxrubika-1.0.0/maxrubika/bot/upload_file.py +89 -0
  53. maxrubika-1.0.0/maxrubika/hybrid.py +94 -0
  54. maxrubika-1.0.0/maxrubika/types/__init__.py +3 -0
  55. maxrubika-1.0.0/maxrubika/types/incoming.py +430 -0
  56. maxrubika-1.0.0/maxrubika.egg-info/PKG-INFO +519 -0
  57. maxrubika-1.0.0/maxrubika.egg-info/SOURCES.txt +60 -0
  58. maxrubika-1.0.0/maxrubika.egg-info/dependency_links.txt +1 -0
  59. maxrubika-1.0.0/maxrubika.egg-info/requires.txt +2 -0
  60. maxrubika-1.0.0/maxrubika.egg-info/top_level.txt +1 -0
  61. maxrubika-1.0.0/setup.cfg +4 -0
  62. maxrubika-1.0.0/setup.py +40 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MEHRAB Farahmand
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,519 @@
1
+ Metadata-Version: 2.4
2
+ Name: maxrubika
3
+ Version: 1.0.0
4
+ Summary: Python async library for Rubika Messenger - Build bots and userbots effortlessly.
5
+ Home-page: https://github.com/MEH2RAB/maxrubika
6
+ Author: MEHRAB Farahmand
7
+ Author-email: MEH2RABx@gmail.com
8
+ Project-URL: Documentation, https://maxrubi.ir
9
+ Project-URL: Source, https://github.com/MEH2RAB/maxrubika
10
+ Project-URL: Channel, https://rubika.ir/MAXRubika
11
+ Keywords: maxrubika,rubika,bot,robot,asyncio,client
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Framework :: AsyncIO
21
+ Classifier: Topic :: Communications :: Chat
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: aiohttp
27
+ Requires-Dist: colorama
28
+ Dynamic: author
29
+ Dynamic: author-email
30
+ Dynamic: classifier
31
+ Dynamic: description
32
+ Dynamic: description-content-type
33
+ Dynamic: home-page
34
+ Dynamic: keywords
35
+ Dynamic: license-file
36
+ Dynamic: project-url
37
+ Dynamic: requires-dist
38
+ Dynamic: requires-python
39
+ Dynamic: summary
40
+
41
+ # 🤖 MAXRubika
42
+
43
+ > Python async library for Rubika Messenger - Build bots and userbots effortlessly
44
+
45
+ [![Python Version](https://img.shields.io/badge/python-3.8+-blue.svg)](https://python.org)
46
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
47
+ [![Documentation](https://img.shields.io/badge/docs-maxrubi.ir-brightgreen.svg)](https://maxrubi.ir)
48
+ [![GitHub stars](https://img.shields.io/github/stars/yourusername/maxrubika)](https://github.com/yourusername/maxrubika/stargazers)
49
+
50
+
51
+ ## ✨ Features
52
+
53
+ - ✅ **Full Rubika Bot API** - All methods supported
54
+ - ✅ **Async/Await** - Built with `asyncio` for maximum performance
55
+ - ✅ **Type Hints** - Full typing support for better IDE integration
56
+ - ✅ **Plugin System** - Easily extend your bot with plugins
57
+ - ✅ **Middleware Support** - Intercept and process events
58
+ - ✅ **Webhook & Polling** - Both modes supported
59
+ - ✅ **Rich Filter System** - Powerful event filtering
60
+ - ✅ **Decorator-based Handlers** - Clean and intuitive syntax
61
+ - ✅ **Zero Dependencies** - Only `aiohttp` required
62
+ - 🚧 **UserBot Support** - Coming soon! (Personal account automation)
63
+
64
+
65
+ ## 📦 Installation
66
+
67
+ ```bash
68
+ pip install maxrubika
69
+ ```
70
+
71
+ Or from source:
72
+
73
+ ```bash
74
+ git clone https://github.com/MEH2RAB/maxrubika.git
75
+ cd maxrubika
76
+ pip install -e .
77
+ ```
78
+
79
+
80
+ ## 🚀 Quick Start
81
+
82
+ ```python
83
+ from maxrubika import Bot
84
+
85
+ bot = Bot("TOKEN")
86
+
87
+ @bot.on_command("start")
88
+ async def start(bot, event):
89
+ await event.reply("سلام! به ربات خوش آمدید 👋")
90
+
91
+ bot.run()
92
+ ```
93
+
94
+ ## 📖 Full Documentation
95
+
96
+ All public methods are fully documented with **detailed docstrings** including:
97
+
98
+ - **Parameters** with types and descriptions
99
+ - **Return values**
100
+ - **Usage examples**
101
+
102
+ To view all available methods and their documentation, run:
103
+
104
+ ```python
105
+ from maxrubika import Bot
106
+ import inspect
107
+
108
+ methods = [method for method in dir(Bot)
109
+ if not method.startswith('_')
110
+ and callable(getattr(Bot, method))]
111
+
112
+ for method in methods:
113
+ func = getattr(Bot, method)
114
+ doc = inspect.getdoc(func)
115
+ print(f"→ {method}:\n {doc}\n{'-'*50}")
116
+ ```
117
+
118
+ For complete documentation with examples for every method, visit **[MAXRubi.ir](https://MAXRubi.ir)**.
119
+
120
+ ## 📚 Basic Usage
121
+
122
+ ### Send a Message
123
+
124
+ ```python
125
+ await bot.send_message(
126
+ chat_id="b0abc123...",
127
+ text="Hello, World! 🌍"
128
+ )
129
+ ```
130
+
131
+ ### Send a File
132
+
133
+ ```python
134
+ await bot.send_file(
135
+ chat_id="b0abc123...",
136
+ file="path/to/image.jpg",
137
+ file_type="File",
138
+ text="Check this out!"
139
+ )
140
+ ```
141
+
142
+ ### Send a Photo
143
+
144
+ ```python
145
+ await bot.send_image(
146
+ chat_id="b0abc123...",
147
+ image="photo.jpg",
148
+ text="Nice photo!"
149
+ )
150
+ ```
151
+
152
+ ### Send a Video
153
+
154
+ ```python
155
+ await bot.send_video(
156
+ chat_id="b0abc123...",
157
+ video="video.mp4",
158
+ text="Watch this!"
159
+ )
160
+ ```
161
+
162
+ ### Send a Voice Message
163
+
164
+ ```python
165
+ await bot.send_voice(
166
+ chat_id="b0abc123...",
167
+ voice="voice.mp3",
168
+ text="Listen to this!"
169
+ )
170
+ ```
171
+
172
+ ### Send a Music File
173
+
174
+ ```python
175
+ await bot.send_music(
176
+ chat_id="b0abc123...",
177
+ music="song.mp3",
178
+ text="Enjoy the music!"
179
+ )
180
+ ```
181
+
182
+ ### Send a GIF
183
+
184
+ ```python
185
+ await bot.send_gif(
186
+ chat_id="b0abc123...",
187
+ gif="animation.gif",
188
+ text="Funny GIF!"
189
+ )
190
+ ```
191
+
192
+ ### Send a Poll
193
+
194
+ ```python
195
+ await bot.send_poll(
196
+ chat_id="b0abc123...",
197
+ question="What's your favorite color?",
198
+ options=["Red", "Blue", "Green"]
199
+ )
200
+ ```
201
+
202
+ ### Send a Quiz
203
+
204
+ ```python
205
+ await bot.send_quiz(
206
+ chat_id="b0abc123...",
207
+ question="What is 2+2?",
208
+ options=["3", "4", "5"],
209
+ correct_option=1
210
+ )
211
+ ```
212
+
213
+ ### Send a Location
214
+
215
+ ```python
216
+ await bot.send_location(
217
+ chat_id="b0abc123...",
218
+ latitude=35.6892,
219
+ longitude=51.3890
220
+ )
221
+ ```
222
+
223
+ ### Send a Contact
224
+
225
+ ```python
226
+ await bot.send_contact(
227
+ chat_id="b0abc123...",
228
+ phone_number="+989123456789",
229
+ first_name="MEHRAB",
230
+ last_name="Farahmand"
231
+ )
232
+ ```
233
+
234
+
235
+ ## ⌨️ Inline Keyboard
236
+
237
+ ```python
238
+ inline_keypad = [
239
+ ["Button 1", "Button 2"],
240
+ ["Button 3"]
241
+ ]
242
+
243
+ await bot.send_message(
244
+ chat_id="b0abc123...",
245
+ text="Choose an option:",
246
+ inline_keypad=inline_keypad
247
+ )
248
+ ```
249
+
250
+
251
+ ## 📋 Custom Keyboard
252
+
253
+ ```python
254
+ chat_keypad = {
255
+ "rows": [
256
+ {
257
+ "buttons": [
258
+ {"id": "101", "type": "Simple", "button_text": "Yes"},
259
+ {"id": "102", "type": "Simple", "button_text": "No"},
260
+ {"id": "104", "type": "Simple", "button_text": "Maybe"}
261
+ ]
262
+ }
263
+ ]
264
+ }
265
+
266
+ await bot.send_message(
267
+ chat_id="b0abc123...",
268
+ text="Do you agree?",
269
+ chat_keypad=chat_keypad,
270
+ resize_keyboard=True,
271
+ one_time_keyboard=True
272
+ )
273
+ ```
274
+
275
+ ```python
276
+ inline_keypad = {
277
+ "rows": [
278
+ {
279
+ "buttons": [
280
+ {"id": "101", "type": "Simple", "button_text": "📊 View Report"},
281
+ {"id": "102", "type": "Simple", "button_text": "📥 Download"},
282
+ {"id": "103", "type": "Simple", "button_text": "🔔 Set Reminder"},
283
+ {"id": "104", "type": "Simple", "button_text": "❌ Close"},
284
+ ]
285
+ }
286
+ ]
287
+ }
288
+
289
+ await bot.send_message(
290
+ chat_id="b0abc123...",
291
+ text="**What would you like to do with this document?**",
292
+ inline_keypad=inline_keypad
293
+ )
294
+ ```
295
+
296
+ ## 🎯 Handle Callbacks
297
+
298
+ ```python
299
+ @bot.on_callback()
300
+ async def on_callback(bot, event):
301
+ button_id = event.button_id
302
+ await bot.send_message(
303
+ chat_id=event.chat_id,
304
+ text=f"You pressed: {button_id}"
305
+ )
306
+ ```
307
+
308
+
309
+ ## 🔧 Commands
310
+
311
+ ```python
312
+ @bot.on_command("start")
313
+ async def start_command(bot, event):
314
+ await bot.send_message(
315
+ chat_id=event.chat_id,
316
+ text="Welcome! 🎉"
317
+ )
318
+
319
+ @bot.on_command(["help", "راهنما"])
320
+ async def help_command(bot, event):
321
+ await event.reply("How can I help you?")
322
+ ```
323
+
324
+
325
+ ## 🔍 Using Filters
326
+
327
+ ```python
328
+ from maxrubika.filters import Text, ChatType, FromUser
329
+
330
+ @bot.on_message(Text("hello") & ChatType("user"))
331
+ async def on_hello(bot, event):
332
+ await event.reply("Hi there! 👋")
333
+
334
+ @bot.on_message(FromUser("u0abc123..."))
335
+ async def on_specific_user(bot, event):
336
+ await event.reply("I see you! 👀")
337
+
338
+ @bot.on_message(IsImage() & FromUser("u0abc123..."))
339
+ async def on_image_from_user(bot, event):
340
+ await event.reply("Nice image!")
341
+ ```
342
+
343
+
344
+ ## 🔌 Middleware
345
+
346
+ ```python
347
+ @bot.middleware()
348
+ async def log_middleware(bot, event, call_next):
349
+ print(f"Event: {event.update_type} from {event.chat_id}")
350
+ await call_next()
351
+ ```
352
+
353
+
354
+ ## 🔌 Plugin System
355
+
356
+ ### Create a Plugin
357
+
358
+ ```python
359
+ from maxrubika.plugin import Plugin, create_plugin
360
+
361
+ @create_plugin("greeter", version="1.0.0")
362
+ class GreeterPlugin(Plugin):
363
+ async def setup(self):
364
+ print("Greeter plugin loaded!")
365
+
366
+ async def teardown(self):
367
+ print("Greeter plugin unloaded!")
368
+ ```
369
+
370
+ ### Enable Plugins
371
+
372
+ ```python
373
+ bot = Bot("TOKEN")
374
+ await bot.plugin_manager.enable("greeter")
375
+ ```
376
+
377
+ ### Plugin with Dependencies
378
+
379
+ ```python
380
+ @create_plugin(
381
+ "advanced_greeter",
382
+ version="1.0.0",
383
+ dependencies=("greeter",)
384
+ )
385
+ class AdvancedGreeterPlugin(Plugin):
386
+ async def setup(self):
387
+ print("Advanced greeter loaded!")
388
+ ```
389
+
390
+
391
+ ## 🌐 Webhook Setup
392
+
393
+ ```python
394
+ bot = Bot("TOKEN")
395
+
396
+ # Start with webhook
397
+ await bot.start(
398
+ webhook_url="https://yourdomain.com",
399
+ webhook_path="/wk",
400
+ host="0.0.0.0",
401
+ port=8080
402
+ )
403
+ ```
404
+
405
+ ### Register Webhook Endpoints
406
+
407
+ ```python
408
+ await bot.update_bot_endpoints(
409
+ url="https://yourdomain.com/wk",
410
+ endpoint_type="ReceiveUpdate"
411
+ )
412
+ ```
413
+
414
+ ### Register All Endpoints
415
+
416
+ ```python
417
+ await bot.register_all_endpoints(
418
+ base_url="https://yourdomain.com"
419
+ )
420
+ ```
421
+
422
+
423
+ ## 🔜 Coming Soon: UserBot
424
+
425
+ ```python
426
+ from maxrubika import Client
427
+ client = Client("mySession")
428
+
429
+ a = client.get_me()
430
+ print(a)
431
+ ```
432
+
433
+
434
+ ## 📁 Project Structure
435
+
436
+ ```
437
+ maxrubika/
438
+ ├── TheBot.py # Main Bot class
439
+ ├── TheClient.py # UserBot class (coming soon)
440
+ ├── bot/ # All Bot modules (unified)
441
+ │ ├── __init__.py
442
+ │ ├── registry.py # Handler registry
443
+ │ ├── bridge.py # Bridge between MTProto and Bot API
444
+ │ ├── lifecycle.py # Bot lifecycle management
445
+ │ ├── message.py # Message handling
446
+ │ ├── callback.py # Callback query handling
447
+ │ ├── command.py # Command handling
448
+ │ ├── middleware.py # Middleware system
449
+ │ ├── start.py # Start logic
450
+ │ ├── run.py # Running the bot
451
+ │ ├── plugin.py # Plugin system
452
+ │ ├── exceptions.py # Error classes
453
+ │ ├── filters.py # Event filters
454
+ │ ├── metadata.py # Metadata handling
455
+ │ ├── keypad_mixin.py # Keypad utilities
456
+ │ ├── file_extensions.py # File type mappings
457
+ │ ├── send_message.py # Send message methods
458
+ │ ├── send_file.py
459
+ │ ├── send_poll.py
460
+ │ ├── send_quiz.py
461
+ │ ├── send_location.py
462
+ │ ├── send_contact.py
463
+ │ ├── send_image.py
464
+ │ ├── send_video.py
465
+ │ └── ......
466
+ ├── types/ # Type definitions
467
+ │ ├── __init__.py
468
+ │ ├── incoming.py
469
+ │ └── update.py # Coming soon
470
+ ├── hybrid.py # Compatibility layer
471
+ └── __init__.py # Package entry point
472
+ ```
473
+
474
+
475
+ ## 🤝 Contributing
476
+
477
+ Contributions are welcome! Please read our Contributing Guide.
478
+
479
+ 1. Fork the repository
480
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
481
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
482
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
483
+ 5. Open a Pull Request
484
+
485
+
486
+ ## 📄 License
487
+
488
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
489
+
490
+
491
+ ## 👤 Author
492
+
493
+ **MEHRAB Farahmand**
494
+
495
+ ## Get in Touch
496
+
497
+ | Platform | Link |
498
+ |----------|------|
499
+ | Rubika Channel | [@MAXRubika](https://rubika.ir/MAXRubika) |
500
+ | Rubika Profile | [@Online_User](https://rubika.ir/Online_User) |
501
+ | Telegram | [@MEH2RAB](https://t.me/MEH2RAB) |
502
+ | Documentation | [MAXRubi.ir](https://MAXRubi.ir) |
503
+ | GitHub | [@MEH2RAB](https://github.com/MEH2RAB) |
504
+ | Email | [MEH2RABx@gmail.com](mailto:MEH2RABx@gmail.com) |
505
+
506
+ > 💬 If you have any questions, issues, or suggestions, feel free to reach out to me on **Rubika** ([@Online_User](https://rubika.ir/Online_User)) or **Telegram** ([@MEH2RAB](https://t.me/MEH2RAB)). I'll be happy to help!
507
+
508
+ ---
509
+
510
+ **Special thanks to the management team of MAX Server ([@The_MAXWare](https://t.me/The_MAXWare)) for their invaluable support and contributions to this project.**
511
+
512
+ ## ⭐ Support
513
+
514
+ If you like this project, please give it a star! ⭐
515
+
516
+
517
+ ## 🙏 Acknowledgments
518
+
519
+ - Built with ❤️ for the Rubika community