RubigramClient 1.7.23__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rubigramclient-1.7.23/LICENSE +22 -0
- rubigramclient-1.7.23/PKG-INFO +219 -0
- rubigramclient-1.7.23/README.md +178 -0
- rubigramclient-1.7.23/RubigramClient.egg-info/PKG-INFO +219 -0
- rubigramclient-1.7.23/RubigramClient.egg-info/SOURCES.txt +145 -0
- rubigramclient-1.7.23/RubigramClient.egg-info/dependency_links.txt +1 -0
- rubigramclient-1.7.23/RubigramClient.egg-info/requires.txt +4 -0
- rubigramclient-1.7.23/RubigramClient.egg-info/top_level.txt +1 -0
- rubigramclient-1.7.23/pyproject.toml +24 -0
- rubigramclient-1.7.23/rubigram/__init__.py +25 -0
- rubigramclient-1.7.23/rubigram/client.py +224 -0
- rubigramclient-1.7.23/rubigram/dispatcher.py +148 -0
- rubigramclient-1.7.23/rubigram/enums/__init__.py +54 -0
- rubigramclient-1.7.23/rubigram/enums/buttons/__init__.py +13 -0
- rubigramclient-1.7.23/rubigram/enums/buttons/button_calendar_type.py +20 -0
- rubigramclient-1.7.23/rubigram/enums/buttons/button_location_type.py +20 -0
- rubigramclient-1.7.23/rubigram/enums/buttons/button_selection_get_type.py +20 -0
- rubigramclient-1.7.23/rubigram/enums/buttons/button_selection_search_type.py +20 -0
- rubigramclient-1.7.23/rubigram/enums/buttons/button_selection_type.py +22 -0
- rubigramclient-1.7.23/rubigram/enums/buttons/button_textbox_type_keypad.py +20 -0
- rubigramclient-1.7.23/rubigram/enums/buttons/button_textbox_type_line.py +20 -0
- rubigramclient-1.7.23/rubigram/enums/buttons/button_type.py +58 -0
- rubigramclient-1.7.23/rubigram/enums/chat_action_type.py +22 -0
- rubigramclient-1.7.23/rubigram/enums/chat_keypad_type.py +20 -0
- rubigramclient-1.7.23/rubigram/enums/chat_type.py +24 -0
- rubigramclient-1.7.23/rubigram/enums/enum.py +18 -0
- rubigramclient-1.7.23/rubigram/enums/file_type.py +28 -0
- rubigramclient-1.7.23/rubigram/enums/forwarded_from_type.py +22 -0
- rubigramclient-1.7.23/rubigram/enums/handler_type.py +10 -0
- rubigramclient-1.7.23/rubigram/enums/live_location_status.py +20 -0
- rubigramclient-1.7.23/rubigram/enums/message_sender_type.py +20 -0
- rubigramclient-1.7.23/rubigram/enums/metadata_type.py +18 -0
- rubigramclient-1.7.23/rubigram/enums/parse_mode.py +21 -0
- rubigramclient-1.7.23/rubigram/enums/payment_status_type.py +20 -0
- rubigramclient-1.7.23/rubigram/enums/poll_status_type.py +20 -0
- rubigramclient-1.7.23/rubigram/enums/update_endpoint_type.py +26 -0
- rubigramclient-1.7.23/rubigram/enums/update_type.py +28 -0
- rubigramclient-1.7.23/rubigram/errors.py +32 -0
- rubigramclient-1.7.23/rubigram/filters.py +865 -0
- rubigramclient-1.7.23/rubigram/handlers/__init__.py +1 -0
- rubigramclient-1.7.23/rubigram/handlers/handler.py +83 -0
- rubigramclient-1.7.23/rubigram/http_session.py +96 -0
- rubigramclient-1.7.23/rubigram/methods/__init__.py +28 -0
- rubigramclient-1.7.23/rubigram/methods/chats/__init__.py +18 -0
- rubigramclient-1.7.23/rubigram/methods/chats/ban_chat_member.py +124 -0
- rubigramclient-1.7.23/rubigram/methods/chats/get_chat.py +122 -0
- rubigramclient-1.7.23/rubigram/methods/chats/get_chat_member.py +42 -0
- rubigramclient-1.7.23/rubigram/methods/chats/unban_chat_member.py +124 -0
- rubigramclient-1.7.23/rubigram/methods/decorators/__init__.py +26 -0
- rubigramclient-1.7.23/rubigram/methods/decorators/on_deleted_message.py +27 -0
- rubigramclient-1.7.23/rubigram/methods/decorators/on_inline_message.py +33 -0
- rubigramclient-1.7.23/rubigram/methods/decorators/on_message.py +27 -0
- rubigramclient-1.7.23/rubigram/methods/decorators/on_start.py +65 -0
- rubigramclient-1.7.23/rubigram/methods/decorators/on_started_bot.py +27 -0
- rubigramclient-1.7.23/rubigram/methods/decorators/on_stop.py +65 -0
- rubigramclient-1.7.23/rubigram/methods/decorators/on_stopped_bot.py +27 -0
- rubigramclient-1.7.23/rubigram/methods/decorators/on_update_message.py +27 -0
- rubigramclient-1.7.23/rubigram/methods/files/__init__.py +28 -0
- rubigramclient-1.7.23/rubigram/methods/files/get_file.py +34 -0
- rubigramclient-1.7.23/rubigram/methods/files/request_send_file.py +38 -0
- rubigramclient-1.7.23/rubigram/methods/files/send_document.py +166 -0
- rubigramclient-1.7.23/rubigram/methods/files/send_file.py +193 -0
- rubigramclient-1.7.23/rubigram/methods/files/send_gif.py +148 -0
- rubigramclient-1.7.23/rubigram/methods/files/send_music.py +165 -0
- rubigramclient-1.7.23/rubigram/methods/files/send_photo.py +164 -0
- rubigramclient-1.7.23/rubigram/methods/files/send_video.py +164 -0
- rubigramclient-1.7.23/rubigram/methods/files/send_voice.py +164 -0
- rubigramclient-1.7.23/rubigram/methods/messages/__init__.py +34 -0
- rubigramclient-1.7.23/rubigram/methods/messages/delete_messages.py +127 -0
- rubigramclient-1.7.23/rubigram/methods/messages/edit_chat_keypad.py +128 -0
- rubigramclient-1.7.23/rubigram/methods/messages/edit_message.py +104 -0
- rubigramclient-1.7.23/rubigram/methods/messages/edit_message_keypad.py +129 -0
- rubigramclient-1.7.23/rubigram/methods/messages/edit_message_text.py +132 -0
- rubigramclient-1.7.23/rubigram/methods/messages/forward_message.py +128 -0
- rubigramclient-1.7.23/rubigram/methods/messages/remove_chat_keypad.py +86 -0
- rubigramclient-1.7.23/rubigram/methods/messages/send_contact.py +169 -0
- rubigramclient-1.7.23/rubigram/methods/messages/send_location.py +171 -0
- rubigramclient-1.7.23/rubigram/methods/messages/send_message.py +177 -0
- rubigramclient-1.7.23/rubigram/methods/messages/send_poll.py +170 -0
- rubigramclient-1.7.23/rubigram/methods/messages/send_sticker.py +162 -0
- rubigramclient-1.7.23/rubigram/methods/network/__init__.py +18 -0
- rubigramclient-1.7.23/rubigram/methods/network/download_file.py +189 -0
- rubigramclient-1.7.23/rubigram/methods/network/get_file_name.py +34 -0
- rubigramclient-1.7.23/rubigram/methods/network/request.py +68 -0
- rubigramclient-1.7.23/rubigram/methods/network/upload_file.py +184 -0
- rubigramclient-1.7.23/rubigram/methods/settings/__init__.py +14 -0
- rubigramclient-1.7.23/rubigram/methods/settings/set_command.py +118 -0
- rubigramclient-1.7.23/rubigram/methods/settings/update_bot_endpoint.py +133 -0
- rubigramclient-1.7.23/rubigram/methods/updates/__init__.py +12 -0
- rubigramclient-1.7.23/rubigram/methods/updates/get_update.py +132 -0
- rubigramclient-1.7.23/rubigram/methods/users/__init__.py +7 -0
- rubigramclient-1.7.23/rubigram/methods/users/get_me.py +105 -0
- rubigramclient-1.7.23/rubigram/methods/utilities/__init__.py +12 -0
- rubigramclient-1.7.23/rubigram/methods/utilities/run.py +148 -0
- rubigramclient-1.7.23/rubigram/parser/__init__.py +1 -0
- rubigramclient-1.7.23/rubigram/parser/markdown.py +74 -0
- rubigramclient-1.7.23/rubigram/parser/parser.py +16 -0
- rubigramclient-1.7.23/rubigram/rubino/__init__.py +6 -0
- rubigramclient-1.7.23/rubigram/rubino/client.py +374 -0
- rubigramclient-1.7.23/rubigram/rubino/network.py +129 -0
- rubigramclient-1.7.23/rubigram/server/__init__.py +6 -0
- rubigramclient-1.7.23/rubigram/server/server.py +199 -0
- rubigramclient-1.7.23/rubigram/state/__init__.py +7 -0
- rubigramclient-1.7.23/rubigram/state/state.py +121 -0
- rubigramclient-1.7.23/rubigram/state/storage.py +131 -0
- rubigramclient-1.7.23/rubigram/types/__init__.py +66 -0
- rubigramclient-1.7.23/rubigram/types/aux_data.py +28 -0
- rubigramclient-1.7.23/rubigram/types/bot.py +51 -0
- rubigramclient-1.7.23/rubigram/types/bot_command.py +26 -0
- rubigramclient-1.7.23/rubigram/types/buttons/__init__.py +13 -0
- rubigramclient-1.7.23/rubigram/types/buttons/button.py +59 -0
- rubigramclient-1.7.23/rubigram/types/buttons/button_calendar.py +40 -0
- rubigramclient-1.7.23/rubigram/types/buttons/button_location.py +40 -0
- rubigramclient-1.7.23/rubigram/types/buttons/button_number_picker.py +34 -0
- rubigramclient-1.7.23/rubigram/types/buttons/button_selection.py +48 -0
- rubigramclient-1.7.23/rubigram/types/buttons/button_selection_item.py +32 -0
- rubigramclient-1.7.23/rubigram/types/buttons/button_string_picker.py +29 -0
- rubigramclient-1.7.23/rubigram/types/buttons/button_text_box.py +40 -0
- rubigramclient-1.7.23/rubigram/types/chat.py +86 -0
- rubigramclient-1.7.23/rubigram/types/config/__init__.py +6 -0
- rubigramclient-1.7.23/rubigram/types/config/object.py +442 -0
- rubigramclient-1.7.23/rubigram/types/contact_message.py +29 -0
- rubigramclient-1.7.23/rubigram/types/file.py +78 -0
- rubigramclient-1.7.23/rubigram/types/forwarded_from.py +39 -0
- rubigramclient-1.7.23/rubigram/types/keypads/__init__.py +7 -0
- rubigramclient-1.7.23/rubigram/types/keypads/keypad.py +31 -0
- rubigramclient-1.7.23/rubigram/types/keypads/keypad_row.py +23 -0
- rubigramclient-1.7.23/rubigram/types/live_location.py +44 -0
- rubigramclient-1.7.23/rubigram/types/location.py +24 -0
- rubigramclient-1.7.23/rubigram/types/messages/__init__.py +8 -0
- rubigramclient-1.7.23/rubigram/types/messages/inline_message.py +78 -0
- rubigramclient-1.7.23/rubigram/types/messages/message.py +117 -0
- rubigramclient-1.7.23/rubigram/types/messages/update_message.py +341 -0
- rubigramclient-1.7.23/rubigram/types/metadata/__init__.py +7 -0
- rubigramclient-1.7.23/rubigram/types/metadata/metadata.py +43 -0
- rubigramclient-1.7.23/rubigram/types/metadata/metadata_parts.py +42 -0
- rubigramclient-1.7.23/rubigram/types/payment_status.py +30 -0
- rubigramclient-1.7.23/rubigram/types/poll.py +32 -0
- rubigramclient-1.7.23/rubigram/types/poll_status.py +40 -0
- rubigramclient-1.7.23/rubigram/types/sticker.py +33 -0
- rubigramclient-1.7.23/rubigram/types/updates/__init__.py +7 -0
- rubigramclient-1.7.23/rubigram/types/updates/update.py +917 -0
- rubigramclient-1.7.23/rubigram/types/updates/updates.py +56 -0
- rubigramclient-1.7.23/rubigram/utils/__init__.py +7 -0
- rubigramclient-1.7.23/rubigram/utils/auto_delete.py +44 -0
- rubigramclient-1.7.23/rubigram/utils/utils.py +9 -0
- rubigramclient-1.7.23/setup.cfg +4 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2025 Javad
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: RubigramClient
|
|
3
|
+
Version: 1.7.23
|
|
4
|
+
Summary: A simple and flexible Python library for building advanced Rubika bots with powerful message handling, inline buttons, and custom filters.
|
|
5
|
+
Author-email: Javad <MrJavad.Email@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2025 Javad
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Project-URL: GitHub, https://github.com/DevJavad/rubigram
|
|
30
|
+
Classifier: Programming Language :: Python :: 3
|
|
31
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
32
|
+
Classifier: Operating System :: OS Independent
|
|
33
|
+
Requires-Python: >=3.4
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
License-File: LICENSE
|
|
36
|
+
Requires-Dist: aiohttp
|
|
37
|
+
Requires-Dist: aiofiles
|
|
38
|
+
Requires-Dist: aiocache
|
|
39
|
+
Requires-Dist: markdownify
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
<p align="center">
|
|
43
|
+
<img src="http://rubigram.ir/rubigram.jpg" alt="Rubigram" width="200"/>
|
|
44
|
+
</p>
|
|
45
|
+
<p align="center">
|
|
46
|
+
<strong> Python library for rubika API</strong>
|
|
47
|
+
</p>
|
|
48
|
+
<p align="center">
|
|
49
|
+
<a href="https://pypi.org/project/RubigramClient">
|
|
50
|
+
<img src="https://img.shields.io/pypi/v/RubigramClient?style=flat-square" alt="PyPI">
|
|
51
|
+
</a>
|
|
52
|
+
<a href="http://rubigram.ir/doc">
|
|
53
|
+
<img src="https://img.shields.io/badge/docs-online-blue?style=flat-square" alt="Documentation">
|
|
54
|
+
</a>
|
|
55
|
+
</p>
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# Rubigram
|
|
59
|
+
Rubigram is a powerful asynchronous Python framework for **building advanced bots on Rubika**, offering features like concurrent message handling, advanced filtering, and support for both webhooks and polling.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## Features
|
|
63
|
+
- Asynchronous and fast: handle multiple messages concurrently.
|
|
64
|
+
- Advanced filters for private chats, commands, and text messages.
|
|
65
|
+
- Easy message and media sending (text, images, videos, files).
|
|
66
|
+
- Support for both **webhooks** and **polling**.
|
|
67
|
+
- Interactive keyboards and buttons for better user engagement.
|
|
68
|
+
- Flexible integration with databases for storing settings and data.
|
|
69
|
+
|
|
70
|
+
## Start
|
|
71
|
+
```python
|
|
72
|
+
from rubigram import Client, filters
|
|
73
|
+
from rubigram.types import Update
|
|
74
|
+
|
|
75
|
+
client = Client("bot_token")
|
|
76
|
+
|
|
77
|
+
@client.on_message(filters.command("start"))
|
|
78
|
+
async def start(client: Client, update: Update):
|
|
79
|
+
await update.reply("||Hello|| __from__ **Rubigram!**")
|
|
80
|
+
|
|
81
|
+
client.run()
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Button and Keypad
|
|
85
|
+
```python
|
|
86
|
+
from rubigram import Client, filters
|
|
87
|
+
from rubigram.enums import ChatKeypadType
|
|
88
|
+
from rubigram.types import Update, Keypad, Button, KeypadRow
|
|
89
|
+
|
|
90
|
+
client = Client("bot_token")
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@client.on_message(filters.photo)
|
|
94
|
+
async def start(client: Client, update: Update):
|
|
95
|
+
button_1 = Button("send", "send Photo")
|
|
96
|
+
button_2 = Button("save", "Save Photo")
|
|
97
|
+
row = KeypadRow([button_1, button_2])
|
|
98
|
+
keypad = Keypad([row])
|
|
99
|
+
await update.reply(
|
|
100
|
+
"Select your action:",
|
|
101
|
+
chat_keypad=keypad,
|
|
102
|
+
chat_keypad_type=ChatKeypadType.NEW
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
client.run()
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Use webhook and Get inline button data
|
|
109
|
+
```python
|
|
110
|
+
from rubigram import Client, Server, filters
|
|
111
|
+
from rubigram.types import (
|
|
112
|
+
Update,
|
|
113
|
+
Button,
|
|
114
|
+
Keypad,
|
|
115
|
+
KeypadRow,
|
|
116
|
+
InlineMessage
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
client = Client(token="bot_token")
|
|
121
|
+
server = Server(client, "webhook_url")
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
@client.on_message(filters.photo)
|
|
125
|
+
async def start(client: Client, update: Update):
|
|
126
|
+
button_1 = Button("send", "send Photo")
|
|
127
|
+
button_2 = Button("save", "Save Photo")
|
|
128
|
+
row = KeypadRow([button_1, button_2])
|
|
129
|
+
keypad = Keypad([row])
|
|
130
|
+
await update.reply("Select your action:", inline_keypad=keypad)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
@client.on_inline_message(filters.button(["send", "save"]))
|
|
134
|
+
async def inline_message(client: Client, message: InlineMessage):
|
|
135
|
+
button_id = message.aux_data.button_id
|
|
136
|
+
if button_id == "send":
|
|
137
|
+
await message.answer("You clicked the send button")
|
|
138
|
+
else:
|
|
139
|
+
await message.answer("You clicked the save button")
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
@client.on_start()
|
|
143
|
+
async def start(client):
|
|
144
|
+
print("Start bot ....")
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@client.on_stop()
|
|
148
|
+
async def stop(client):
|
|
149
|
+
print("Stop bot")
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
server.run_server()
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Auto state and save tmp data in cache
|
|
156
|
+
```python
|
|
157
|
+
from rubigram import Client, Storage, filters
|
|
158
|
+
from rubigram.types import Update
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
storage = Storage(ttl=120)
|
|
162
|
+
client = Client("bot_token", storage=storage) # You can leave the `storage` parametr empty
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
@client.on_message(filters.command("start") & filters.private)
|
|
166
|
+
async def start(client: Client, update: Update):
|
|
167
|
+
state = client.state(update.chat_id)
|
|
168
|
+
await state.set("name")
|
|
169
|
+
await update.reply("Send your name:")
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
@client.on_message(filters.state("name") & filters.text & filters.private)
|
|
173
|
+
async def save_name(client: Client, update: Update):
|
|
174
|
+
state = client.state(update.chat_id)
|
|
175
|
+
await state.set("email", name=update.text)
|
|
176
|
+
await update.reply("Send your Email:")
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
@client.on_message(filters.state("email") & filters.text & filters.private)
|
|
180
|
+
async def save_email(client: Client, update: Update):
|
|
181
|
+
state = client.state(update.chat_id)
|
|
182
|
+
data = await state.get()
|
|
183
|
+
print(data)
|
|
184
|
+
await state.delete()
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
client.run()
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
## Implementation of multiple programs
|
|
192
|
+
```python
|
|
193
|
+
from rubigram import Client
|
|
194
|
+
import asyncio
|
|
195
|
+
|
|
196
|
+
tokens = ["TOKEN_1", "TOKEN_2"]
|
|
197
|
+
|
|
198
|
+
async def main():
|
|
199
|
+
for token in tokens:
|
|
200
|
+
async with Client(token) as client:
|
|
201
|
+
info = await client.get_me()
|
|
202
|
+
print(info)
|
|
203
|
+
|
|
204
|
+
asyncio.run(main())
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Rubino
|
|
208
|
+
```python
|
|
209
|
+
from rubigram.rubino import Rubino
|
|
210
|
+
import asyncio
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
async def main():
|
|
214
|
+
async with Rubino(auth="auth_account") as client:
|
|
215
|
+
info = await client.get_my_profile_info()
|
|
216
|
+
print(info)
|
|
217
|
+
|
|
218
|
+
asyncio.run(main())
|
|
219
|
+
```
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="http://rubigram.ir/rubigram.jpg" alt="Rubigram" width="200"/>
|
|
3
|
+
</p>
|
|
4
|
+
<p align="center">
|
|
5
|
+
<strong> Python library for rubika API</strong>
|
|
6
|
+
</p>
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://pypi.org/project/RubigramClient">
|
|
9
|
+
<img src="https://img.shields.io/pypi/v/RubigramClient?style=flat-square" alt="PyPI">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="http://rubigram.ir/doc">
|
|
12
|
+
<img src="https://img.shields.io/badge/docs-online-blue?style=flat-square" alt="Documentation">
|
|
13
|
+
</a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# Rubigram
|
|
18
|
+
Rubigram is a powerful asynchronous Python framework for **building advanced bots on Rubika**, offering features like concurrent message handling, advanced filtering, and support for both webhooks and polling.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
- Asynchronous and fast: handle multiple messages concurrently.
|
|
23
|
+
- Advanced filters for private chats, commands, and text messages.
|
|
24
|
+
- Easy message and media sending (text, images, videos, files).
|
|
25
|
+
- Support for both **webhooks** and **polling**.
|
|
26
|
+
- Interactive keyboards and buttons for better user engagement.
|
|
27
|
+
- Flexible integration with databases for storing settings and data.
|
|
28
|
+
|
|
29
|
+
## Start
|
|
30
|
+
```python
|
|
31
|
+
from rubigram import Client, filters
|
|
32
|
+
from rubigram.types import Update
|
|
33
|
+
|
|
34
|
+
client = Client("bot_token")
|
|
35
|
+
|
|
36
|
+
@client.on_message(filters.command("start"))
|
|
37
|
+
async def start(client: Client, update: Update):
|
|
38
|
+
await update.reply("||Hello|| __from__ **Rubigram!**")
|
|
39
|
+
|
|
40
|
+
client.run()
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Button and Keypad
|
|
44
|
+
```python
|
|
45
|
+
from rubigram import Client, filters
|
|
46
|
+
from rubigram.enums import ChatKeypadType
|
|
47
|
+
from rubigram.types import Update, Keypad, Button, KeypadRow
|
|
48
|
+
|
|
49
|
+
client = Client("bot_token")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@client.on_message(filters.photo)
|
|
53
|
+
async def start(client: Client, update: Update):
|
|
54
|
+
button_1 = Button("send", "send Photo")
|
|
55
|
+
button_2 = Button("save", "Save Photo")
|
|
56
|
+
row = KeypadRow([button_1, button_2])
|
|
57
|
+
keypad = Keypad([row])
|
|
58
|
+
await update.reply(
|
|
59
|
+
"Select your action:",
|
|
60
|
+
chat_keypad=keypad,
|
|
61
|
+
chat_keypad_type=ChatKeypadType.NEW
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
client.run()
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Use webhook and Get inline button data
|
|
68
|
+
```python
|
|
69
|
+
from rubigram import Client, Server, filters
|
|
70
|
+
from rubigram.types import (
|
|
71
|
+
Update,
|
|
72
|
+
Button,
|
|
73
|
+
Keypad,
|
|
74
|
+
KeypadRow,
|
|
75
|
+
InlineMessage
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
client = Client(token="bot_token")
|
|
80
|
+
server = Server(client, "webhook_url")
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
@client.on_message(filters.photo)
|
|
84
|
+
async def start(client: Client, update: Update):
|
|
85
|
+
button_1 = Button("send", "send Photo")
|
|
86
|
+
button_2 = Button("save", "Save Photo")
|
|
87
|
+
row = KeypadRow([button_1, button_2])
|
|
88
|
+
keypad = Keypad([row])
|
|
89
|
+
await update.reply("Select your action:", inline_keypad=keypad)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@client.on_inline_message(filters.button(["send", "save"]))
|
|
93
|
+
async def inline_message(client: Client, message: InlineMessage):
|
|
94
|
+
button_id = message.aux_data.button_id
|
|
95
|
+
if button_id == "send":
|
|
96
|
+
await message.answer("You clicked the send button")
|
|
97
|
+
else:
|
|
98
|
+
await message.answer("You clicked the save button")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@client.on_start()
|
|
102
|
+
async def start(client):
|
|
103
|
+
print("Start bot ....")
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@client.on_stop()
|
|
107
|
+
async def stop(client):
|
|
108
|
+
print("Stop bot")
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
server.run_server()
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Auto state and save tmp data in cache
|
|
115
|
+
```python
|
|
116
|
+
from rubigram import Client, Storage, filters
|
|
117
|
+
from rubigram.types import Update
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
storage = Storage(ttl=120)
|
|
121
|
+
client = Client("bot_token", storage=storage) # You can leave the `storage` parametr empty
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
@client.on_message(filters.command("start") & filters.private)
|
|
125
|
+
async def start(client: Client, update: Update):
|
|
126
|
+
state = client.state(update.chat_id)
|
|
127
|
+
await state.set("name")
|
|
128
|
+
await update.reply("Send your name:")
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
@client.on_message(filters.state("name") & filters.text & filters.private)
|
|
132
|
+
async def save_name(client: Client, update: Update):
|
|
133
|
+
state = client.state(update.chat_id)
|
|
134
|
+
await state.set("email", name=update.text)
|
|
135
|
+
await update.reply("Send your Email:")
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@client.on_message(filters.state("email") & filters.text & filters.private)
|
|
139
|
+
async def save_email(client: Client, update: Update):
|
|
140
|
+
state = client.state(update.chat_id)
|
|
141
|
+
data = await state.get()
|
|
142
|
+
print(data)
|
|
143
|
+
await state.delete()
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
client.run()
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## Implementation of multiple programs
|
|
151
|
+
```python
|
|
152
|
+
from rubigram import Client
|
|
153
|
+
import asyncio
|
|
154
|
+
|
|
155
|
+
tokens = ["TOKEN_1", "TOKEN_2"]
|
|
156
|
+
|
|
157
|
+
async def main():
|
|
158
|
+
for token in tokens:
|
|
159
|
+
async with Client(token) as client:
|
|
160
|
+
info = await client.get_me()
|
|
161
|
+
print(info)
|
|
162
|
+
|
|
163
|
+
asyncio.run(main())
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Rubino
|
|
167
|
+
```python
|
|
168
|
+
from rubigram.rubino import Rubino
|
|
169
|
+
import asyncio
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
async def main():
|
|
173
|
+
async with Rubino(auth="auth_account") as client:
|
|
174
|
+
info = await client.get_my_profile_info()
|
|
175
|
+
print(info)
|
|
176
|
+
|
|
177
|
+
asyncio.run(main())
|
|
178
|
+
```
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: RubigramClient
|
|
3
|
+
Version: 1.7.23
|
|
4
|
+
Summary: A simple and flexible Python library for building advanced Rubika bots with powerful message handling, inline buttons, and custom filters.
|
|
5
|
+
Author-email: Javad <MrJavad.Email@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2025 Javad
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Project-URL: GitHub, https://github.com/DevJavad/rubigram
|
|
30
|
+
Classifier: Programming Language :: Python :: 3
|
|
31
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
32
|
+
Classifier: Operating System :: OS Independent
|
|
33
|
+
Requires-Python: >=3.4
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
License-File: LICENSE
|
|
36
|
+
Requires-Dist: aiohttp
|
|
37
|
+
Requires-Dist: aiofiles
|
|
38
|
+
Requires-Dist: aiocache
|
|
39
|
+
Requires-Dist: markdownify
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
<p align="center">
|
|
43
|
+
<img src="http://rubigram.ir/rubigram.jpg" alt="Rubigram" width="200"/>
|
|
44
|
+
</p>
|
|
45
|
+
<p align="center">
|
|
46
|
+
<strong> Python library for rubika API</strong>
|
|
47
|
+
</p>
|
|
48
|
+
<p align="center">
|
|
49
|
+
<a href="https://pypi.org/project/RubigramClient">
|
|
50
|
+
<img src="https://img.shields.io/pypi/v/RubigramClient?style=flat-square" alt="PyPI">
|
|
51
|
+
</a>
|
|
52
|
+
<a href="http://rubigram.ir/doc">
|
|
53
|
+
<img src="https://img.shields.io/badge/docs-online-blue?style=flat-square" alt="Documentation">
|
|
54
|
+
</a>
|
|
55
|
+
</p>
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# Rubigram
|
|
59
|
+
Rubigram is a powerful asynchronous Python framework for **building advanced bots on Rubika**, offering features like concurrent message handling, advanced filtering, and support for both webhooks and polling.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## Features
|
|
63
|
+
- Asynchronous and fast: handle multiple messages concurrently.
|
|
64
|
+
- Advanced filters for private chats, commands, and text messages.
|
|
65
|
+
- Easy message and media sending (text, images, videos, files).
|
|
66
|
+
- Support for both **webhooks** and **polling**.
|
|
67
|
+
- Interactive keyboards and buttons for better user engagement.
|
|
68
|
+
- Flexible integration with databases for storing settings and data.
|
|
69
|
+
|
|
70
|
+
## Start
|
|
71
|
+
```python
|
|
72
|
+
from rubigram import Client, filters
|
|
73
|
+
from rubigram.types import Update
|
|
74
|
+
|
|
75
|
+
client = Client("bot_token")
|
|
76
|
+
|
|
77
|
+
@client.on_message(filters.command("start"))
|
|
78
|
+
async def start(client: Client, update: Update):
|
|
79
|
+
await update.reply("||Hello|| __from__ **Rubigram!**")
|
|
80
|
+
|
|
81
|
+
client.run()
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Button and Keypad
|
|
85
|
+
```python
|
|
86
|
+
from rubigram import Client, filters
|
|
87
|
+
from rubigram.enums import ChatKeypadType
|
|
88
|
+
from rubigram.types import Update, Keypad, Button, KeypadRow
|
|
89
|
+
|
|
90
|
+
client = Client("bot_token")
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@client.on_message(filters.photo)
|
|
94
|
+
async def start(client: Client, update: Update):
|
|
95
|
+
button_1 = Button("send", "send Photo")
|
|
96
|
+
button_2 = Button("save", "Save Photo")
|
|
97
|
+
row = KeypadRow([button_1, button_2])
|
|
98
|
+
keypad = Keypad([row])
|
|
99
|
+
await update.reply(
|
|
100
|
+
"Select your action:",
|
|
101
|
+
chat_keypad=keypad,
|
|
102
|
+
chat_keypad_type=ChatKeypadType.NEW
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
client.run()
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Use webhook and Get inline button data
|
|
109
|
+
```python
|
|
110
|
+
from rubigram import Client, Server, filters
|
|
111
|
+
from rubigram.types import (
|
|
112
|
+
Update,
|
|
113
|
+
Button,
|
|
114
|
+
Keypad,
|
|
115
|
+
KeypadRow,
|
|
116
|
+
InlineMessage
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
client = Client(token="bot_token")
|
|
121
|
+
server = Server(client, "webhook_url")
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
@client.on_message(filters.photo)
|
|
125
|
+
async def start(client: Client, update: Update):
|
|
126
|
+
button_1 = Button("send", "send Photo")
|
|
127
|
+
button_2 = Button("save", "Save Photo")
|
|
128
|
+
row = KeypadRow([button_1, button_2])
|
|
129
|
+
keypad = Keypad([row])
|
|
130
|
+
await update.reply("Select your action:", inline_keypad=keypad)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
@client.on_inline_message(filters.button(["send", "save"]))
|
|
134
|
+
async def inline_message(client: Client, message: InlineMessage):
|
|
135
|
+
button_id = message.aux_data.button_id
|
|
136
|
+
if button_id == "send":
|
|
137
|
+
await message.answer("You clicked the send button")
|
|
138
|
+
else:
|
|
139
|
+
await message.answer("You clicked the save button")
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
@client.on_start()
|
|
143
|
+
async def start(client):
|
|
144
|
+
print("Start bot ....")
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@client.on_stop()
|
|
148
|
+
async def stop(client):
|
|
149
|
+
print("Stop bot")
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
server.run_server()
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Auto state and save tmp data in cache
|
|
156
|
+
```python
|
|
157
|
+
from rubigram import Client, Storage, filters
|
|
158
|
+
from rubigram.types import Update
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
storage = Storage(ttl=120)
|
|
162
|
+
client = Client("bot_token", storage=storage) # You can leave the `storage` parametr empty
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
@client.on_message(filters.command("start") & filters.private)
|
|
166
|
+
async def start(client: Client, update: Update):
|
|
167
|
+
state = client.state(update.chat_id)
|
|
168
|
+
await state.set("name")
|
|
169
|
+
await update.reply("Send your name:")
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
@client.on_message(filters.state("name") & filters.text & filters.private)
|
|
173
|
+
async def save_name(client: Client, update: Update):
|
|
174
|
+
state = client.state(update.chat_id)
|
|
175
|
+
await state.set("email", name=update.text)
|
|
176
|
+
await update.reply("Send your Email:")
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
@client.on_message(filters.state("email") & filters.text & filters.private)
|
|
180
|
+
async def save_email(client: Client, update: Update):
|
|
181
|
+
state = client.state(update.chat_id)
|
|
182
|
+
data = await state.get()
|
|
183
|
+
print(data)
|
|
184
|
+
await state.delete()
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
client.run()
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
## Implementation of multiple programs
|
|
192
|
+
```python
|
|
193
|
+
from rubigram import Client
|
|
194
|
+
import asyncio
|
|
195
|
+
|
|
196
|
+
tokens = ["TOKEN_1", "TOKEN_2"]
|
|
197
|
+
|
|
198
|
+
async def main():
|
|
199
|
+
for token in tokens:
|
|
200
|
+
async with Client(token) as client:
|
|
201
|
+
info = await client.get_me()
|
|
202
|
+
print(info)
|
|
203
|
+
|
|
204
|
+
asyncio.run(main())
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Rubino
|
|
208
|
+
```python
|
|
209
|
+
from rubigram.rubino import Rubino
|
|
210
|
+
import asyncio
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
async def main():
|
|
214
|
+
async with Rubino(auth="auth_account") as client:
|
|
215
|
+
info = await client.get_my_profile_info()
|
|
216
|
+
print(info)
|
|
217
|
+
|
|
218
|
+
asyncio.run(main())
|
|
219
|
+
```
|