botapi-py 1.1.0__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.
botapi/utils.py ADDED
@@ -0,0 +1,66 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Dict, List, Any
4
+
5
+ from . import types, api
6
+
7
+ class Message:
8
+
9
+ def __init__(
10
+ self,
11
+ bot: api.BotAPI,
12
+ message: types.Message
13
+ ):
14
+ self.bot = bot
15
+ self.message = message
16
+
17
+ async def delete(self) -> bool:
18
+ return await self.bot.delete_message(
19
+ chat_id=self.message.chat.id,
20
+ message_id=self.message.message_id
21
+ )
22
+
23
+ async def edit_text(
24
+ self,
25
+ text: str,
26
+ # inline_message_id: Optional[str] = None,
27
+ parse_mode: str | None,
28
+ entities: list[types.MessageEntity] | None = None,
29
+ link_preview_options: types.LinkPreviewOptions | None = None,
30
+ reply_markup: types.InlineKeyboardMarkup | None = None,
31
+ ) -> types.Message | bool:
32
+ return await self.bot.edit_message_text(
33
+ chat_id=self.message.chat.id,
34
+ message_id=self.message.message_id,
35
+ business_connection_id=self.message.business_connection_id,
36
+ # inline_message_id=self.inline_message_id,
37
+ text=text,
38
+ parse_mode=parse_mode,
39
+ entities=entities,
40
+ link_preview_options=link_preview_options,
41
+ reply_markup=reply_markup
42
+ )
43
+
44
+
45
+ class InlineKeyboard:
46
+
47
+ @staticmethod
48
+ def from_dict(
49
+ json_data: List[List[Dict[str, Any]]]
50
+ ) -> types.InlineKeyboardMarkup:
51
+ keyboard = [
52
+ [
53
+ types.InlineKeyboardButton(**button) for button in row
54
+ ] for row in json_data
55
+ ]
56
+ return types.InlineKeyboardMarkup(inline_keyboard=keyboard)
57
+
58
+
59
+ class MessageEntities:
60
+
61
+ @staticmethod
62
+ def from_dict(
63
+ json_data: List[Dict[str, Any]]
64
+ ) -> List[types.MessageEntity]:
65
+ return [types.MessageEntity.model_validate(item) for item in json_data]
66
+
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.3
2
+ Name: botapi-py
3
+ Version: 1.1.0
4
+ Summary: A simple and flexible Python library to conveniently build Telegram bots using the Bot API.
5
+ Requires-Dist: httpx>=0.28.1
6
+ Requires-Dist: pydantic>=2.12.0
7
+ Requires-Python: >=3.13
8
+ Project-URL: TelegramBotAPI, https://core.telegram.org/bots/api
@@ -0,0 +1,11 @@
1
+ botapi/__init__.py,sha256=RnJ4K1sLZJCMQ9sYW-or0A9iTK36tlUfr7Z_w9VKA7s,143
2
+ botapi/__init__.pyi,sha256=RnJ4K1sLZJCMQ9sYW-or0A9iTK36tlUfr7Z_w9VKA7s,143
3
+ botapi/api.py,sha256=d1tP3LkqKQxUxCdMv5izr_cd3O7cm8ak8XV-UyRuhI4,148667
4
+ botapi/core.py,sha256=ktZEO-HzHLQZA9VfQfieKvqfKo3zGnUldJcvXlLdmaM,3273
5
+ botapi/enums.py,sha256=c6kmtPG2me6tjXdTVaLvc6YLWQgBDE5VnDtJ2csxOCw,588
6
+ botapi/errors.py,sha256=O1fHQPz-bbh2jWNUC9fFMqg4KzOv47GUypPMdb047ss,1110
7
+ botapi/types.py,sha256=MpPMhmxKMBQ62SxD-cN-5BvXEptdVcPIdRmxvKkfbb8,135161
8
+ botapi/utils.py,sha256=DUuQPBMUWERCGC4sKDVZRDqqiUisEacYlM6DOuDhrGI,1642
9
+ botapi_py-1.1.0.dist-info/WHEEL,sha256=X16MKk8bp2DRsAuyteHJ-9qOjzmnY0x1aj0P1ftqqWA,78
10
+ botapi_py-1.1.0.dist-info/METADATA,sha256=WoV5VtHlEiFzrUR1OrYCqWuc5ObW94Tn_CuFEtn8WZQ,303
11
+ botapi_py-1.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.9.2
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any