Rubka 1.8.8__py3-none-any.whl → 2.11.13__py3-none-any.whl
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.
rubka/api.py
CHANGED
|
@@ -110,15 +110,15 @@ class Robot:
|
|
|
110
110
|
self._inline_query_handler = func
|
|
111
111
|
return func
|
|
112
112
|
return decorator
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
|
|
116
114
|
def _process_update(self, update: Dict[str, Any]):
|
|
115
|
+
import threading
|
|
117
116
|
if update.get('type') == 'ReceiveQuery':
|
|
118
117
|
msg = update.get("inline_message", {})
|
|
119
118
|
if self._inline_query_handler:
|
|
120
119
|
context = InlineMessage(bot=self, raw_data=msg)
|
|
121
|
-
self._inline_query_handler(self, context)
|
|
120
|
+
threading.Thread(target=self._inline_query_handler, args=(self, context), daemon=True).start()
|
|
121
|
+
|
|
122
122
|
if update.get('type') == 'NewMessage':
|
|
123
123
|
msg = update.get('new_message', {})
|
|
124
124
|
chat_id = update.get('chat_id')
|
|
@@ -127,11 +127,15 @@ class Robot:
|
|
|
127
127
|
text = msg.get('text')
|
|
128
128
|
try:
|
|
129
129
|
import time
|
|
130
|
-
if msg.get("time") and (time.time() - float(msg["time"])) >
|
|
131
|
-
|
|
130
|
+
if msg.get("time") and (time.time() - float(msg["time"])) > 20:
|
|
131
|
+
return
|
|
132
|
+
except Exception:
|
|
133
|
+
return
|
|
134
|
+
|
|
132
135
|
if self._message_handler:
|
|
133
136
|
handler = self._message_handler
|
|
134
137
|
context = Message(bot=self, chat_id=chat_id, message_id=message_id, sender_id=sender_id, text=text, raw_data=msg)
|
|
138
|
+
|
|
135
139
|
if handler["commands"]:
|
|
136
140
|
if not context.text or not context.text.startswith("/"):
|
|
137
141
|
return
|
|
@@ -145,7 +149,7 @@ class Robot:
|
|
|
145
149
|
if not handler["filters"](context):
|
|
146
150
|
return
|
|
147
151
|
|
|
148
|
-
handler["func"](self, context)
|
|
152
|
+
threading.Thread(target=handler["func"], args=(self, context), daemon=True).start()
|
|
149
153
|
|
|
150
154
|
elif update.get('type') == 'ReceiveQuery':
|
|
151
155
|
msg = update.get("inline_message", {})
|
|
@@ -156,7 +160,8 @@ class Robot:
|
|
|
156
160
|
|
|
157
161
|
if hasattr(self, "_callback_handler"):
|
|
158
162
|
context = Message(bot=self, chat_id=chat_id, message_id=message_id, sender_id=sender_id, text=text, raw_data=msg)
|
|
159
|
-
self._callback_handler(self, context)
|
|
163
|
+
threading.Thread(target=self._callback_handler, args=(self, context), daemon=True).start()
|
|
164
|
+
|
|
160
165
|
|
|
161
166
|
|
|
162
167
|
def run(self):
|
|
@@ -176,7 +181,7 @@ class Robot:
|
|
|
176
181
|
|
|
177
182
|
while True:
|
|
178
183
|
try:
|
|
179
|
-
updates = self.get_updates(offset_id=self._offset_id, limit=
|
|
184
|
+
updates = self.get_updates(offset_id=self._offset_id, limit=100)
|
|
180
185
|
if updates and updates.get("data"):
|
|
181
186
|
for update in updates["data"].get("updates", []):
|
|
182
187
|
self._process_update(update)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Rubka
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.11.13
|
|
4
4
|
Summary: A Python library for interacting with Rubika Bot API.
|
|
5
5
|
Home-page: https://github.com/Mahdy-Ahmadi/Rubka
|
|
6
6
|
Download-URL: https://github.com/Mahdy-Ahmadi/Rubka/archive/refs/tags/v0.1.0.tar.gz
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
rubka/__init__.py,sha256=3f4H6Uj1ylrfBYlTHmTvzZSvaPJsdNhCocyX3Bbvuv0,254
|
|
2
|
-
rubka/api.py,sha256=
|
|
2
|
+
rubka/api.py,sha256=bF3lyXS7D3wxjdgxKkiiplfWY3fNGo6ORv4WQhdkAgU,13399
|
|
3
3
|
rubka/config.py,sha256=Bck59xkOiqioLv0GkQ1qPGnBXVctz1hKk6LT4h2EPx0,78
|
|
4
4
|
rubka/context.py,sha256=5OMFjcnMWvkn3ZigRgJrjMiFt_tYgMwzHsTS6qXMGj8,12843
|
|
5
5
|
rubka/decorators.py,sha256=hGwUoE4q2ImrunJIGJ_kzGYYxQf1ueE0isadqraKEts,1157
|
|
@@ -9,7 +9,7 @@ rubka/keyboards.py,sha256=7nr-dT2bQJVQnQ6RMWPTSjML6EEk6dsBx-4d8pab8xk,488
|
|
|
9
9
|
rubka/keypad.py,sha256=FHe0xVYhOXMdHZhbGKHsRxtsRB27qZv0DvNfb8NkNwI,1545
|
|
10
10
|
rubka/logger.py,sha256=J2I6NiK1z32lrAzC4H1Et6WPMBXxXGCVUsW4jgcAofs,289
|
|
11
11
|
rubka/utils.py,sha256=XUQUZxQt9J2f0X5hmAH_MH1kibTAfdT1T4AaBkBhBBs,148
|
|
12
|
-
rubka-
|
|
13
|
-
rubka-
|
|
14
|
-
rubka-
|
|
15
|
-
rubka-
|
|
12
|
+
rubka-2.11.13.dist-info/METADATA,sha256=Iz2JhjVfJBk5pOq1eXG4GcwQsT7pUpG24JzU-GSdkD0,8170
|
|
13
|
+
rubka-2.11.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
rubka-2.11.13.dist-info/top_level.txt,sha256=vy2A4lot11cRMdQS-F4HDCIXL3JK8RKfu7HMDkezJW4,6
|
|
15
|
+
rubka-2.11.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|