multibotkit 0.1.24__tar.gz → 0.1.26__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.
- {multibotkit-0.1.24 → multibotkit-0.1.26}/PKG-INFO +1 -1
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/helpers/telegram.py +91 -2
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/schemas/telegram/incoming.py +119 -1
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/schemas/telegram/outgoing.py +18 -2
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit.egg-info/PKG-INFO +1 -1
- {multibotkit-0.1.24 → multibotkit-0.1.26}/setup.py +1 -1
- {multibotkit-0.1.24 → multibotkit-0.1.26}/LICENSE +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/README.md +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/__init__.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/dispatchers/__init__.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/dispatchers/base_dispatcher.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/dispatchers/fb.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/dispatchers/telegram.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/dispatchers/viber.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/dispatchers/vk.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/helpers/__init__.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/helpers/base_helper.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/helpers/fb.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/helpers/viber.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/helpers/vk.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/schemas/__init__.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/schemas/fb/__init__.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/schemas/fb/incoming.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/schemas/fb/outgoing.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/schemas/telegram/__init__.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/schemas/viber/__init__.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/schemas/viber/incoming.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/schemas/viber/outgoing.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/schemas/vk/__init__.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/schemas/vk/incoming.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/schemas/vk/outgoing.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/states/__init__.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/states/managers/__init__.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/states/managers/base.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/states/managers/memory.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/states/managers/mongo.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/states/managers/redis.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit/states/state.py +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit.egg-info/SOURCES.txt +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit.egg-info/dependency_links.txt +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit.egg-info/requires.txt +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/multibotkit.egg-info/top_level.txt +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/pyproject.toml +0 -0
- {multibotkit-0.1.24 → multibotkit-0.1.26}/setup.cfg +0 -0
|
@@ -31,6 +31,7 @@ from multibotkit.schemas.telegram.outgoing import (
|
|
|
31
31
|
Location,
|
|
32
32
|
DeleteWebhookParams,
|
|
33
33
|
DeleteMessage,
|
|
34
|
+
CopyMessage,
|
|
34
35
|
)
|
|
35
36
|
|
|
36
37
|
|
|
@@ -207,6 +208,66 @@ class TelegramHelper(BaseHelper):
|
|
|
207
208
|
r = await self._perform_async_request(url, data)
|
|
208
209
|
return r
|
|
209
210
|
|
|
211
|
+
def sync_create_chat_invite_link(
|
|
212
|
+
self,
|
|
213
|
+
chat_id: int,
|
|
214
|
+
creates_join_request: Optional[bool] = False,
|
|
215
|
+
):
|
|
216
|
+
url = self.tg_base_url + "createChatInviteLink"
|
|
217
|
+
data = {"chat_id": chat_id, "creates_join_request": creates_join_request}
|
|
218
|
+
r = self._perform_sync_request(url, data)
|
|
219
|
+
return r
|
|
220
|
+
|
|
221
|
+
async def async_create_chat_invite_link(
|
|
222
|
+
self,
|
|
223
|
+
chat_id: int,
|
|
224
|
+
creates_join_request: Optional[bool] = False,
|
|
225
|
+
):
|
|
226
|
+
url = self.tg_base_url + "createChatInviteLink"
|
|
227
|
+
data = {"chat_id": chat_id, "creates_join_request": creates_join_request}
|
|
228
|
+
r = await self._perform_async_request(url, data)
|
|
229
|
+
return r
|
|
230
|
+
|
|
231
|
+
def sync_approve_chat_join_request(
|
|
232
|
+
self,
|
|
233
|
+
chat_id: int,
|
|
234
|
+
user_id: int,
|
|
235
|
+
):
|
|
236
|
+
url = self.tg_base_url + "approveChatJoinRequest"
|
|
237
|
+
data = {"chat_id": chat_id, "user_id": user_id}
|
|
238
|
+
r = self._perform_sync_request(url, data)
|
|
239
|
+
return r
|
|
240
|
+
|
|
241
|
+
async def async_approve_chat_join_request(
|
|
242
|
+
self,
|
|
243
|
+
chat_id: int,
|
|
244
|
+
user_id: int,
|
|
245
|
+
):
|
|
246
|
+
url = self.tg_base_url + "approveChatJoinRequest"
|
|
247
|
+
data = {"chat_id": chat_id, "user_id": user_id}
|
|
248
|
+
r = await self._perform_async_request(url, data)
|
|
249
|
+
return r
|
|
250
|
+
|
|
251
|
+
def sync_decline_chat_join_request(
|
|
252
|
+
self,
|
|
253
|
+
chat_id: int,
|
|
254
|
+
user_id: int,
|
|
255
|
+
):
|
|
256
|
+
url = self.tg_base_url + "declineChatJoinRequest"
|
|
257
|
+
data = {"chat_id": chat_id, "user_id": user_id}
|
|
258
|
+
r = self._perform_sync_request(url, data)
|
|
259
|
+
return r
|
|
260
|
+
|
|
261
|
+
async def async_decline_chat_join_request(
|
|
262
|
+
self,
|
|
263
|
+
chat_id: int,
|
|
264
|
+
user_id: int,
|
|
265
|
+
):
|
|
266
|
+
url = self.tg_base_url + "declineChatJoinRequest"
|
|
267
|
+
data = {"chat_id": chat_id, "user_id": user_id}
|
|
268
|
+
r = await self._perform_async_request(url, data)
|
|
269
|
+
return r
|
|
270
|
+
|
|
210
271
|
def sync_delete_message(
|
|
211
272
|
self,
|
|
212
273
|
chat_id: int,
|
|
@@ -229,6 +290,34 @@ class TelegramHelper(BaseHelper):
|
|
|
229
290
|
r = await self._perform_async_request(url, delete_message.dict())
|
|
230
291
|
return r
|
|
231
292
|
|
|
293
|
+
def sync_copy_message(
|
|
294
|
+
self,
|
|
295
|
+
chat_id: int,
|
|
296
|
+
from_chat_id: int,
|
|
297
|
+
message_id: int,
|
|
298
|
+
):
|
|
299
|
+
url = self.tg_base_url + "copyMessage"
|
|
300
|
+
copy_message = CopyMessage(
|
|
301
|
+
chat_id=chat_id, message_id=message_id, from_chat_id=from_chat_id
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
r = self._perform_sync_request(url, copy_message.dict())
|
|
305
|
+
return r
|
|
306
|
+
|
|
307
|
+
async def async_copy_message(
|
|
308
|
+
self,
|
|
309
|
+
chat_id: int,
|
|
310
|
+
from_chat_id: int,
|
|
311
|
+
message_id: int,
|
|
312
|
+
):
|
|
313
|
+
url = self.tg_base_url + "copyMessage"
|
|
314
|
+
copy_message = CopyMessage(
|
|
315
|
+
chat_id=chat_id, message_id=message_id, from_chat_id=from_chat_id
|
|
316
|
+
)
|
|
317
|
+
|
|
318
|
+
r = await self._perform_async_request(url, copy_message.dict())
|
|
319
|
+
return r
|
|
320
|
+
|
|
232
321
|
def sync_edit_message_text(
|
|
233
322
|
self,
|
|
234
323
|
chat_id: int,
|
|
@@ -244,7 +333,7 @@ class TelegramHelper(BaseHelper):
|
|
|
244
333
|
"message_id": message_id,
|
|
245
334
|
"text": text,
|
|
246
335
|
"parse_mode": parse_mode,
|
|
247
|
-
"link_preview_options": {"is_disabled": disable_web_page_preview}
|
|
336
|
+
"link_preview_options": {"is_disabled": disable_web_page_preview},
|
|
248
337
|
}
|
|
249
338
|
if reply_markup:
|
|
250
339
|
data["reply_markup"] = reply_markup.dict(exclude_none=True)
|
|
@@ -267,7 +356,7 @@ class TelegramHelper(BaseHelper):
|
|
|
267
356
|
"message_id": message_id,
|
|
268
357
|
"text": text,
|
|
269
358
|
"parse_mode": parse_mode,
|
|
270
|
-
"link_preview_options": {"is_disabled": disable_web_page_preview}
|
|
359
|
+
"link_preview_options": {"is_disabled": disable_web_page_preview},
|
|
271
360
|
}
|
|
272
361
|
if reply_markup:
|
|
273
362
|
data["reply_markup"] = reply_markup.dict(exclude_none=True)
|
|
@@ -232,7 +232,7 @@ class WebAppData(BaseModel):
|
|
|
232
232
|
button_text: str = Field(
|
|
233
233
|
...,
|
|
234
234
|
title="Text of the web_app keyboard button from which the Web App was opened. Be aware that a bad client can "
|
|
235
|
-
|
|
235
|
+
"send arbitrary data in this field.",
|
|
236
236
|
)
|
|
237
237
|
|
|
238
238
|
|
|
@@ -315,8 +315,126 @@ unique identifier for the game",
|
|
|
315
315
|
fields = {"from_": "from"}
|
|
316
316
|
|
|
317
317
|
|
|
318
|
+
class ChatMember(BaseModel):
|
|
319
|
+
status: str = Field(..., title="The member's status in the chat")
|
|
320
|
+
user: User = Field(..., title="Information about the user")
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
class ChatInviteLink(BaseModel):
|
|
324
|
+
invite_link: str = Field(
|
|
325
|
+
...,
|
|
326
|
+
title="The invite link. If the link was created by another chat administrator, "
|
|
327
|
+
"then the second part of the link will be replaced with “…”",
|
|
328
|
+
)
|
|
329
|
+
creator: User = Field(..., title="Creator of the link")
|
|
330
|
+
creates_join_request: bool = Field(
|
|
331
|
+
...,
|
|
332
|
+
title="True, if users joining the chat via the link need to be approved by chat administrators",
|
|
333
|
+
)
|
|
334
|
+
is_primary: bool = Field(
|
|
335
|
+
...,
|
|
336
|
+
title="True, if the link is primary",
|
|
337
|
+
)
|
|
338
|
+
is_revoked: bool = Field(
|
|
339
|
+
...,
|
|
340
|
+
title="True, if the link is revoked",
|
|
341
|
+
)
|
|
342
|
+
name: Optional[str] = Field(
|
|
343
|
+
None,
|
|
344
|
+
title="Invite link name",
|
|
345
|
+
)
|
|
346
|
+
expire_date: Optional[int] = Field(
|
|
347
|
+
None,
|
|
348
|
+
title="Point in time (Unix timestamp) when the link will expire or has been expired",
|
|
349
|
+
)
|
|
350
|
+
member_limit: Optional[int] = Field(
|
|
351
|
+
None,
|
|
352
|
+
title="The maximum number of users that can be members of the chat simultaneously after joining "
|
|
353
|
+
"the chat via this invite link; 1-99999",
|
|
354
|
+
)
|
|
355
|
+
pending_join_request_count: Optional[int] = Field(
|
|
356
|
+
None,
|
|
357
|
+
title="Number of pending join requests created using this link",
|
|
358
|
+
)
|
|
359
|
+
subscription_period: Optional[int] = Field(
|
|
360
|
+
None,
|
|
361
|
+
title="The number of seconds the subscription will be active for before the next payment",
|
|
362
|
+
)
|
|
363
|
+
subscription_price: Optional[int] = Field(
|
|
364
|
+
None,
|
|
365
|
+
title="The amount of Telegram Stars a user must pay initially and after each subsequent "
|
|
366
|
+
"subscription period to be a member of the chat using the link",
|
|
367
|
+
)
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
class ChatMemberUpdated(BaseModel):
|
|
371
|
+
date: int = Field(..., title="Date the change was done in Unix time")
|
|
372
|
+
from_: User = Field(
|
|
373
|
+
..., title="Performer of the action, which resulted in the change"
|
|
374
|
+
)
|
|
375
|
+
chat: Chat = Field(..., title="Chat the user belongs to")
|
|
376
|
+
old_chat_member: ChatMember = Field(
|
|
377
|
+
..., title="Previous information about the chat member"
|
|
378
|
+
)
|
|
379
|
+
new_chat_member: ChatMember = Field(
|
|
380
|
+
..., title="New information about the chat member"
|
|
381
|
+
)
|
|
382
|
+
invite_link: Optional[ChatInviteLink] = Field(
|
|
383
|
+
None,
|
|
384
|
+
title="Chat invite link, which was used by the user to join the chat; for joining by invite link events only.",
|
|
385
|
+
)
|
|
386
|
+
via_join_request: Optional[bool] = Field(
|
|
387
|
+
None,
|
|
388
|
+
title="Optional. True, if the user joined the chat after sending a direct join "
|
|
389
|
+
"request without using an invite link and being approved by an administrator",
|
|
390
|
+
)
|
|
391
|
+
via_chat_folder_invite_link: Optional[bool] = Field(
|
|
392
|
+
None,
|
|
393
|
+
title="Optional. True, if the user joined the chat via a chat folder invite link",
|
|
394
|
+
)
|
|
395
|
+
|
|
396
|
+
class Config:
|
|
397
|
+
fields = {"from_": "from"}
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
class ChatJoinRequest(BaseModel):
|
|
401
|
+
chat: Chat = Field(..., title=" Chat to which the request was sent")
|
|
402
|
+
from_: User = Field(..., title="User that sent the join request")
|
|
403
|
+
user_chat_id: int = Field(
|
|
404
|
+
...,
|
|
405
|
+
title="Identifier of a private chat with the user who sent the join request.",
|
|
406
|
+
)
|
|
407
|
+
date: int = Field(..., title="Date the request was sent in Unix time")
|
|
408
|
+
bio: Optional[str] = Field(
|
|
409
|
+
None,
|
|
410
|
+
title="Bio of the user.",
|
|
411
|
+
)
|
|
412
|
+
invite_link: Optional[ChatInviteLink] = Field(
|
|
413
|
+
None,
|
|
414
|
+
title="Chat invite link that was used by the user to send the join request",
|
|
415
|
+
)
|
|
416
|
+
|
|
417
|
+
class Config:
|
|
418
|
+
fields = {"from_": "from"}
|
|
419
|
+
|
|
420
|
+
|
|
318
421
|
class Update(BaseModel):
|
|
319
422
|
update_id: int = Field(..., title="Id of incoming bot update")
|
|
320
423
|
message: Optional[Message] = Field(None, title="Message data")
|
|
321
424
|
edited_message: Optional[Message] = Field(None, title="Edited message data")
|
|
322
425
|
callback_query: Optional[CallbackQuery] = Field(None, title="Callback query data")
|
|
426
|
+
my_chat_member: Optional[ChatMemberUpdated] = Field(
|
|
427
|
+
None,
|
|
428
|
+
title="The bot's chat member status was updated in a chat. For private chats, this update is received only "
|
|
429
|
+
"when the bot is blocked or unblocked by the user.",
|
|
430
|
+
)
|
|
431
|
+
chat_member: Optional[ChatMemberUpdated] = Field(
|
|
432
|
+
None,
|
|
433
|
+
title="A chat member's status was updated in a chat. The bot must be an administrator in the chat and must "
|
|
434
|
+
'explicitly specify "chat_member" in the list of allowed_updates to receive these updates.',
|
|
435
|
+
)
|
|
436
|
+
chat_join_request: Optional[ChatJoinRequest] = Field(
|
|
437
|
+
None,
|
|
438
|
+
title="A request to join the chat has been sent. The bot must have the can_invite_users administrator right "
|
|
439
|
+
"in the chat to receive these updates.",
|
|
440
|
+
)
|
|
@@ -40,11 +40,27 @@ class DeleteWebhookParams(BaseModel):
|
|
|
40
40
|
|
|
41
41
|
class DeleteMessage(BaseModel):
|
|
42
42
|
chat_id: int = Field(
|
|
43
|
-
|
|
43
|
+
...,
|
|
44
44
|
title="Unique identifier for the target chat or username of the"
|
|
45
45
|
" target channel (in the format @channelusername)",
|
|
46
46
|
)
|
|
47
|
-
message_id: int = Field(
|
|
47
|
+
message_id: int = Field(..., title="Identifier of the message to delete")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class CopyMessage(BaseModel):
|
|
51
|
+
chat_id: int = Field(
|
|
52
|
+
...,
|
|
53
|
+
title="Unique identifier for the target chat or username of the target channel "
|
|
54
|
+
"(in the format @channelusername)",
|
|
55
|
+
)
|
|
56
|
+
from_chat_id: int = Field(
|
|
57
|
+
...,
|
|
58
|
+
title="Unique identifier for the chat where the original message was sent (or channel username in "
|
|
59
|
+
"the format @channelusername)",
|
|
60
|
+
)
|
|
61
|
+
message_id: int = Field(
|
|
62
|
+
..., title="Message identifier in the chat specified in from_chat_id"
|
|
63
|
+
)
|
|
48
64
|
|
|
49
65
|
|
|
50
66
|
class WebhookInfo(BaseModel):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|