pyrobale 0.3.5__py3-none-any.whl → 0.3.7__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.
@@ -1,3 +1,6 @@
1
+ """# objects in pyrobale, we have a lot of objects that are used to represent
2
+ different types of data."""
3
+
1
4
  from .voice import Voice
2
5
  from .replykeyboardmarkup import ReplyKeyboardMarkup
3
6
  from .inputmedias import (
@@ -1,13 +1,4 @@
1
- from typing import TYPE_CHECKING, Optional
2
-
3
- if TYPE_CHECKING:
4
- from .user import User
5
- from .message import Message
6
- from ..client import Client
7
-
8
- from .user import User
9
- from .message import Message
10
- from .chat import Chat
1
+ from typing import Optional
11
2
 
12
3
 
13
4
  class CallbackQuery:
@@ -16,27 +7,31 @@ class CallbackQuery:
16
7
  def __init__(
17
8
  self,
18
9
  id: Optional[str] = None,
19
- user: Optional["User"] = None,
20
- message: Optional["Message"] = None,
10
+ user: Optional[dict] = None,
11
+ message: Optional[dict] = None,
21
12
  data: Optional[str] = None,
22
13
  **kwargs
23
14
  ):
24
15
  self.id = id
25
- self.user: "User" = User(**user) if user else None
26
- self.message: "Message" = Message(**message) if message else None
27
- self.chat: "Chat" = self.message.chat if self.message else None
16
+ self.user = None
17
+ self.message = None
18
+ self.chat = None
28
19
  self.data = data if data else None
29
- self.bot: "Client" = kwargs.get("kwargs", {}).get("client", None)
20
+ self.bot = kwargs.get("kwargs", {}).get("client", None)
30
21
 
31
- async def answer(
32
- self, text: Optional[str] = None, show_alert: bool = False
33
- ) -> bool:
34
- """Sends a response to the callback query.
22
+ if user:
23
+ from .user import User
35
24
 
36
- :param text: The text of the response.
25
+ self.user = User(**user)
37
26
 
38
- :param show_alert: Whether to show an alert to the user.
27
+ if message:
28
+ from .message import Message
39
29
 
40
- :return: true if the response was sent successfully.
41
- """
30
+ self.message = Message(**message)
31
+ self.chat = self.message.chat if self.message else None
32
+
33
+ async def answer(
34
+ self, text: Optional[str] = None, show_alert: bool = False
35
+ ) -> bool:
36
+ """Sends a response to the callback query."""
42
37
  return await self.bot.answer_callback_query(self.id, text, show_alert)
@@ -4,10 +4,10 @@ from typing import Optional, Union
4
4
  if TYPE_CHECKING:
5
5
  from .utils import build_api_url
6
6
  from .user import User
7
+ from ..client import Client
7
8
  from .chat import Chat
8
9
  from .user import User
9
10
  from .enums import ChatType
10
- from ..client import Client
11
11
 
12
12
 
13
13
  class ChatMember:
@@ -79,8 +79,8 @@ class ChatMember:
79
79
  """Bans the chat member from the chat.
80
80
 
81
81
  :param chat_id: The ID of the chat.
82
-
83
- :return: True if the member was banned successfully, False otherwise.
82
+ :return: True if the member was banned successfully, False
83
+ otherwise.
84
84
  """
85
85
  data = await self.chat.ban(self.user.id)
86
86
  return data
@@ -88,7 +88,8 @@ class ChatMember:
88
88
  async def unban(self) -> bool:
89
89
  """Unbans the chat member from the chat.
90
90
 
91
- :return: True if the member was unbanned successfully, False otherwise.
91
+ :return: True if the member was unbanned successfully, False
92
+ otherwise.
92
93
  """
93
94
  data = await self.chat.unban(self.user.id)
94
95
  return data
pyrobale/objects/enums.py CHANGED
@@ -10,6 +10,19 @@ class UpdatesTypes(Enum):
10
10
  PRE_CHECKOUT_QUERY = "pre_checkout_query"
11
11
  MEMBER_JOINED = "member_joined"
12
12
  MEMBER_LEFT = "member_left"
13
+ SUCCESSFUL_PAYMENT = "successful_payment"
14
+
15
+
16
+ class Filters(Enum):
17
+ """Filters that you can use in handlers"""
18
+
19
+ TEXT = "text"
20
+ PHOTO = "photo"
21
+ VIDEO = "video"
22
+ AUDIO = "audio"
23
+ VOICE = "voice"
24
+ CONTACT = "contact"
25
+ LOCATION = "location"
13
26
 
14
27
 
15
28
  class ChatAction(Enum):
@@ -18,6 +31,9 @@ class ChatAction(Enum):
18
31
  TYPING = "typing"
19
32
  PHOTO = "upload_photo"
20
33
  VIDEO = "upload_video"
34
+ REVORDVIDEO = "record_video"
35
+ VOICE = "upload_voice"
36
+ DOCUMENT = "upload_document"
21
37
 
22
38
 
23
39
  class ChatType(Enum):
@@ -24,8 +24,7 @@ if TYPE_CHECKING:
24
24
  from ..client import Client
25
25
  from ..objects.chat import Chat
26
26
  from ..objects.user import User
27
- import asyncio
28
- import aiohttp
27
+ from ..objects.inlinekeyboardmarkup import InlineKeyboardMarkup
29
28
 
30
29
 
31
30
  class Message:
@@ -126,7 +125,9 @@ class Message:
126
125
  **kwargs: Additional keyword arguments
127
126
  """
128
127
  self.id: int = message_id
129
- self.user: "User" = User(**from_user) if from_user else None
128
+ self.user: "User" = (
129
+ User(**from_user, kwargs={"client": self.client}) if from_user else None
130
+ )
130
131
  self.date: int = date
131
132
  self.chat: Optional["Chat"] = (
132
133
  chat if isinstance(chat, Chat) else Chat(**chat) if chat else None
@@ -168,13 +169,16 @@ class Message:
168
169
  """
169
170
  if self.chat and self.chat.id:
170
171
  await self.client.send_message(
171
- self.chat.id, text, reply_markup=reply_markup
172
+ self.chat.id,
173
+ text,
174
+ reply_to_message_id=self.id,
175
+ reply_markup=reply_markup,
172
176
  )
173
177
 
174
178
  async def edit(
175
179
  self,
176
180
  text: str,
177
- reply_markup: Union["ReplyKeyboardMarkup", "InlineKeyboardMarkup"] = None,
181
+ reply_markup: Optional[InlineKeyboardMarkup] = None,
178
182
  ):
179
183
  """Edit the current message text.
180
184
 
@@ -216,7 +220,11 @@ class Message:
216
220
  """
217
221
  if self.chat and self.chat.id:
218
222
  await self.client.send_photo(
219
- self.chat.id, photo=photo, caption=caption, reply_markup=reply_markup
223
+ self.chat.id,
224
+ photo=photo,
225
+ caption=caption,
226
+ reply_to_message_id=self.id,
227
+ reply_markup=reply_markup,
220
228
  )
221
229
 
222
230
  async def reply_video(
@@ -234,7 +242,11 @@ class Message:
234
242
  """
235
243
  if self.chat and self.chat.id:
236
244
  await self.client.send_video(
237
- self.chat.id, video=video, caption=caption, reply_markup=reply_markup
245
+ self.chat.id,
246
+ video=video,
247
+ caption=caption,
248
+ reply_to_message_id=self.id,
249
+ reply_markup=reply_markup,
238
250
  )
239
251
 
240
252
  async def reply_audio(
@@ -252,7 +264,11 @@ class Message:
252
264
  """
253
265
  if self.chat and self.chat.id:
254
266
  await self.client.send_audio(
255
- self.chat.id, audio=audio, caption=caption, reply_markup=reply_markup
267
+ self.chat.id,
268
+ audio=audio,
269
+ caption=caption,
270
+ reply_to_message_id=self.id,
271
+ reply_markup=reply_markup,
256
272
  )
257
273
 
258
274
  async def reply_document(
@@ -273,6 +289,7 @@ class Message:
273
289
  self.chat.id,
274
290
  document=document,
275
291
  caption=caption,
292
+ reply_to_message_id=self.id,
276
293
  reply_markup=reply_markup,
277
294
  )
278
295
 
@@ -310,6 +327,7 @@ class Message:
310
327
  self.chat.id,
311
328
  latitude=latitude,
312
329
  longitude=longitude,
330
+ reply_to_message_id=self.id,
313
331
  reply_markup=reply_markup,
314
332
  )
315
333
 
@@ -331,6 +349,7 @@ class Message:
331
349
  self.chat.id,
332
350
  phone_number=phone_number,
333
351
  first_name=first_name,
352
+ reply_to_message_id=self.id,
334
353
  reply_markup=reply_markup,
335
354
  )
336
355
 
pyrobale/objects/user.py CHANGED
@@ -1,20 +1,22 @@
1
- from typing import Optional, Union
2
- from .utils import build_api_url
3
- import asyncio
4
- import aiohttp
1
+ from typing import Optional, TYPE_CHECKING
2
+
3
+ if TYPE_CHECKING:
4
+ from ..client import Client
5
5
 
6
6
 
7
7
  class User:
8
8
  def __init__(
9
9
  self,
10
- id: int,
11
- is_bot: bool,
12
- first_name: str,
13
- last_name: Optional[str],
14
- username: Optional[str],
10
+ id: int = None,
11
+ is_bot: bool = None,
12
+ first_name: str = None,
13
+ last_name: Optional[str] = None,
14
+ username: Optional[str] = None,
15
+ **kwargs
15
16
  ):
16
17
  self.id = id
17
18
  self.is_bot = is_bot
18
19
  self.first_name = first_name
19
20
  self.last_name = last_name
20
21
  self.username = username
22
+ self.client: Optional["Client"] = kwargs.get("client", None)
pyrobale/objects/utils.py CHANGED
@@ -1,4 +1,3 @@
1
- import asyncio
2
1
  import aiohttp
3
2
 
4
3
 
@@ -0,0 +1,153 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyrobale
3
+ Version: 0.3.7
4
+ Summary: A python wrapper for bale api
5
+ Project-URL: github, https://github.com/pyrobale/pyrobale
6
+ Project-URL: website, https://pyrobale.github.io
7
+ Author-email: Ali Safamanesh <darg.q.a.a@gmail.com>, Aydin Rahbaran <codewizaard9@gmail.com>
8
+ License: MIT License
9
+
10
+ Copyright (c) 2025 Ali Safamanesh
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ License-File: LICENSE
30
+ Classifier: License :: OSI Approved :: MIT License
31
+ Classifier: Operating System :: OS Independent
32
+ Classifier: Programming Language :: Python :: 3
33
+ Requires-Python: >=3.9
34
+ Requires-Dist: aiohttp
35
+ Description-Content-Type: text/markdown
36
+
37
+ ![pyrobaletext](https://raw.githubusercontent.com/pyrobale/pyrobale/refs/heads/main/pyrobaletext.png)
38
+
39
+ # Bale Bot API Python Library
40
+
41
+ A modern, easy-to-use Python wrapper for the Bale Bot API that makes building Bale bots simple and intuitive.
42
+
43
+ ## Features
44
+
45
+ - 🚀 **Simple & Intuitive** - Clean, Pythonic API design
46
+ - 📨 **Full Message Support** - Text, photos, videos, documents, and more
47
+ - ⌨️ **Interactive Elements** - Inline keyboards, reply keyboards, and buttons
48
+ - 🔄 **Real-time Updates** - Webhook and polling support
49
+ - 📁 **File Handling** - Easy upload and download of media files
50
+ - 🛡️ **Error Handling** - Comprehensive exception handling
51
+ - 📖 **Type Hints** - Full typing support for better development experience
52
+ - ⚡ **Async Support** - Both synchronous and asynchronous operations
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ pip install pyrobale
58
+ ```
59
+
60
+ ## Quick Start
61
+
62
+ ```python
63
+ from pyrobale.client import Client
64
+ from pyrobale.objects import Message, UpdatesTypes
65
+
66
+ bot = Client("YOUR_BOT_TOKEN")
67
+
68
+ @bot.on_message()
69
+ async def message_handler(message: User):
70
+ await message.reply("Hello, world!")
71
+
72
+ bot.run()
73
+ ```
74
+
75
+ ## Examples
76
+
77
+ ### Conversation Bot
78
+ ```python
79
+ from pyrobale.objects import *
80
+ from pyrobale.client import Client, Message, UpdatesTypes
81
+ import asyncio
82
+
83
+ client = Client("YOUR_BOT_TOKEN")
84
+
85
+ async def handle_message(message: Message):
86
+ if message.text == "/start":
87
+ await message.reply("سلام! من یک ربات PyRoBale هستم!")
88
+ await client.wait_for(UpdatesTypes.MESSAGE)
89
+ await message.reply("Okay! wait_for Test Compeleted")
90
+
91
+ client.add_handler(UpdatesTypes.MESSAGE, handle_message)
92
+
93
+ client.run()
94
+ ```
95
+
96
+ ### Echo Bot
97
+ ```python
98
+ from pyrobale.client import Client
99
+ from pyrobale.objects import Message, UpdatesTypes
100
+
101
+ bot = Client("YOUR_BOT_TOKEN")
102
+
103
+ @bot.on_message()
104
+ async def message_handler(message: Message):
105
+ await message.reply(message.text)
106
+
107
+ bot.run()
108
+ ```
109
+
110
+ ### Inline Keyboard
111
+ ```python
112
+ from pyrobale.client import Client
113
+ from pyrobale.objects import Message, UpdatesTypes, InlineKeyboardButton, InlineKeyboardMarkup, CopyTextButton
114
+
115
+ bot = Client("YOUR_BOT_TOKEN")
116
+ async def message_handler(message: Message):
117
+ buttons = InlineKeyboardMarkup()
118
+ buttons.add_button("URL", url="https://google.com")
119
+ buttons.add_button("Callback", callback_data="callback")
120
+ buttons.add_row()
121
+ buttons.add_button("WebApp", web_app="https://daradege.ir")
122
+ buttons.add_button("Copy", copy_text_button=CopyTextButton("TEXT"))
123
+ await message.reply("Hello, world!", reply_markup=buttons)
124
+ ```
125
+
126
+
127
+ ## Core Abilities
128
+
129
+ - **Message Handling** - Process text, commands, and media messages
130
+ - **Callback Queries** - Handle inline keyboard interactions
131
+ - **File Operations** - Send and receive photos, videos, documents
132
+ - **Chat Management** - Get chat info, member management
133
+ - **Custom Keyboards** - Create interactive user interfaces
134
+ - **Webhook Support** - Production-ready webhook handling
135
+ - **Middleware Support** - Add custom processing layers
136
+
137
+ ## Documentation
138
+
139
+ For detailed documentation and advanced usage, visit our [documentation site](https://pyrobale.readthedocs.io).
140
+
141
+ ## Contributing
142
+
143
+ Contributions are welcome! Please feel free to submit a Pull Request.
144
+
145
+ ## License
146
+
147
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
148
+
149
+ ## Support
150
+
151
+ - 📖 [Documentation](https://pyrobale.readthedocs.io)
152
+ - 🐛 [Issue Tracker](https://github.com/pyrobale/pyrobale/issues)
153
+ - 💬 [Discussions](https://github.com/pyrobale/pyrobale/discussions)
@@ -1,18 +1,19 @@
1
- pyrobale/__init__.py,sha256=JHnoAuKziwl7pysBJLpmXDN4YoKeDXhiL6joscEFh_Y,78
2
- pyrobale/client/__init__.py,sha256=ehsCuqAVpJuXzwolZCCcySHZZJawqNT-yr2LIgP52II,21104
1
+ pyrobale/__init__.py,sha256=h5jjU9rJHxzD3V7nBzKQDXskmtlQKbTNROUm_kO8Olw,3620
2
+ pyrobale/StateMachine/__init__.py,sha256=StMaUqpvJw_ViywGO0c-NRKcglpWyZxg-2kEkqgGG8o,1213
3
+ pyrobale/client/__init__.py,sha256=V2SqIOf52iXQxRF1oc2KQib0oX8BMETbUm9oLAO4beo,41447
3
4
  pyrobale/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
5
  pyrobale/exceptions/common.py,sha256=waAfMFzCsrDr9lS11N0Yzs2v1BX_2ucwV15K1Dq9tYA,159
5
- pyrobale/objects/__init__.py,sha256=cQP_MKQH4WeJPjhQHt864jUFEBw7jOwIh2w5pCUbbUE,2132
6
+ pyrobale/objects/__init__.py,sha256=uy0xBJc5d-1TnlPD6CgxAaUjBnIvQs-GuAgLeEKoXSQ,2239
6
7
  pyrobale/objects/animation.py,sha256=jpM9V8AOaGLWkcENTDmsxKf57Abf-MArYBLfU6GwkD0,978
7
8
  pyrobale/objects/audio.py,sha256=q14wz5WpC3SgKZkAlH-D9M554RYQNDwuCT2z7v7IZYU,696
8
- pyrobale/objects/callbackquery.py,sha256=VlogbysCpdPjAIvrF6CvcJeSUco4WKPXjrvUprEaF1g,1281
9
+ pyrobale/objects/callbackquery.py,sha256=jALmTVXU6tc6OppTTrhGERCzugzazYrT39AhhGE-UeI,1018
9
10
  pyrobale/objects/chat.py,sha256=gQ1wpmB63Ot51aeSBAiWzbw9lFgCpJjlm9hlYNBQJ88,16566
10
- pyrobale/objects/chatmember.py,sha256=CyoX4R4vkNoPjki7U4tgslmEc51g1nn9Q7tUyPeHa58,6868
11
+ pyrobale/objects/chatmember.py,sha256=IyAGmuZZ5HlJVYjrfXEKbLoNc7etMytrK-gOeKKo0CU,6895
11
12
  pyrobale/objects/chatphoto.py,sha256=vOb5xzpr3oBiCloi2_ufBnVlUfmcPqSTmMMMTTBYdJo,533
12
13
  pyrobale/objects/contact.py,sha256=6LDxT5RoGbY5Tsw64lg5-jvKSRmmvOiIJha1HqdTaG4,411
13
14
  pyrobale/objects/copytextbutton.py,sha256=CbFWeY9Ebor7dnHJpQUMB1zYhJWl7b5a2T_cdmo1qQ0,134
14
15
  pyrobale/objects/document.py,sha256=cI9_McPzySNKZaQmOma9eX75a3YsyzkVrLvUBDIuwsA,661
15
- pyrobale/objects/enums.py,sha256=O7n5ErPGuhGMd-JdOgJvCqV5q5ukZ2xNsUb0RoEtboA,554
16
+ pyrobale/objects/enums.py,sha256=EPTKrc_ueAY_KinaVMu9ZQLCSj1VoUjHHCn1p9bjf0A,912
16
17
  pyrobale/objects/file.py,sha256=4PBfjouP0knd1vFDNs7mx_jwBoDQVBKS7ESjzF4Y6E8,360
17
18
  pyrobale/objects/inlinekeyboardbutton.py,sha256=w4HehdisD7RQodS66gG-DJjaf0gO2U-6wYaVXaatTN8,617
18
19
  pyrobale/objects/inlinekeyboardmarkup.py,sha256=shNpYUT25EqT0PQFa-c1tEma_6mJIpBwXQ0IqcTGg4M,2887
@@ -22,7 +23,7 @@ pyrobale/objects/invoice.py,sha256=hI225mtsSSV7fYre6aFHp-o1NxUT8MLugJAD6NfAeIs,3
22
23
  pyrobale/objects/keyboardbutton.py,sha256=J7c1ma7swjk3zkgcD7vnMdIMsBGExicmbm1bnP_puzU,459
23
24
  pyrobale/objects/labeledprice.py,sha256=d-fbOLzpkBslfor13BXGeVoySKCcSxsXY4QVwub2Z9o,228
24
25
  pyrobale/objects/location.py,sha256=w_9sRJRntLpNbn8Jk6JhRJVVigD9Bd4BxbjFyglxWhU,143
25
- pyrobale/objects/message.py,sha256=5mtVEsC6j8LkwW834IHTEl4AGvoFbKDURjAAV6YUP3E,14094
26
+ pyrobale/objects/message.py,sha256=cKN7gCJNm55E8tLU7wyITOy4_irqGmFUl4UTu2107pk,14657
26
27
  pyrobale/objects/messageid.py,sha256=DrWKV8y9m9H8G_Fj68KgiJKwDJOGduNJGJ-Dyn8N580,95
27
28
  pyrobale/objects/photosize.py,sha256=I4hnmi46uoU-cW7hPN_tTT9kn0u80BtG5QJ3uRjoUiE,298
28
29
  pyrobale/objects/precheckoutquery.py,sha256=Rtjh1qqRc9TRZMJU1W5r0B8y7K5dayLMXX6WH9h1Ul4,470
@@ -31,13 +32,13 @@ pyrobale/objects/sticker.py,sha256=yLzWAm1fikMVISExdCG0R-rVu1_M31LLw6sHt0sBehE,3
31
32
  pyrobale/objects/stickerset.py,sha256=xlSdlnb5TCzI_MCkB_bJsZPgELVevbO7R3BAYN2jIt8,269
32
33
  pyrobale/objects/successfulpayment.py,sha256=aEAApcd60dByqPw253jEifG_CVsbLYiphB1ep3CEm2E,502
33
34
  pyrobale/objects/update.py,sha256=cDR9hpcC8r4bJjixgMQD84Dg_-8ZrlZq1HninVVVDuQ,716
34
- pyrobale/objects/user.py,sha256=PDPJGq89PARg6Ha38FR1N4ZanpbSMpI_siXh5ZHfsvg,437
35
- pyrobale/objects/utils.py,sha256=WVR6eTXbVzTZeNPgb_qNEyGv7ctppTsuAL2c5x48ljo,861
35
+ pyrobale/objects/user.py,sha256=uCvG3k7rIbGP73fFQt_uy7-shS-BRWAL2aEcCEZWyWY,554
36
+ pyrobale/objects/utils.py,sha256=2ZghxTTjVOUru06Ka_qOjn8U1PvM37-GJ6X1toaovCI,846
36
37
  pyrobale/objects/video.py,sha256=DuZMGHio_w8yQvi87Vc3XpJOpEaltkM4_bNRSeocPZo,509
37
38
  pyrobale/objects/voice.py,sha256=ZdsJFH2IsBwelEk4rb4oZfX9xrfJ2_DgfjsMc0e4Tmg,148
38
39
  pyrobale/objects/webappdata.py,sha256=QlZlCa8Mylt8VmcdgdoHeyita5CVnz2WsT1yueEY1tY,78
39
40
  pyrobale/objects/webappinfo.py,sha256=qnTvfNqx91Yzbc1gO5y4XQ3w6g0RpMUqMuF5wk_EZMc,75
40
- pyrobale-0.3.5.dist-info/METADATA,sha256=Z_bbIivEemBz3HVdg0-X0ObOp4im-VRF1KABsveI7C4,4214
41
- pyrobale-0.3.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
42
- pyrobale-0.3.5.dist-info/licenses/LICENSE,sha256=F8U4JY2aXNJspsrcVW0zf6watzK22FMPTF3NkS36tss,1070
43
- pyrobale-0.3.5.dist-info/RECORD,,
41
+ pyrobale-0.3.7.dist-info/METADATA,sha256=yrnMA_qlgmJsudQHqs0xUA9rHZld8lY7pj6zEqmtc48,5319
42
+ pyrobale-0.3.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
43
+ pyrobale-0.3.7.dist-info/licenses/LICENSE,sha256=F8U4JY2aXNJspsrcVW0zf6watzK22FMPTF3NkS36tss,1070
44
+ pyrobale-0.3.7.dist-info/RECORD,,
@@ -1,176 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: pyrobale
3
- Version: 0.3.5
4
- Summary: A python wrapper for bale api
5
- Project-URL: github, https://github.com/pyrobale/pyrobale
6
- Project-URL: website, https://pyrobale.github.io
7
- Author-email: Ali Safamanesh <darg.q.a.a@gmail.com>
8
- License: MIT License
9
-
10
- Copyright (c) 2025 Ali Safamanesh
11
-
12
- Permission is hereby granted, free of charge, to any person obtaining a copy
13
- of this software and associated documentation files (the "Software"), to deal
14
- in the Software without restriction, including without limitation the rights
15
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- copies of the Software, and to permit persons to whom the Software is
17
- furnished to do so, subject to the following conditions:
18
-
19
- The above copyright notice and this permission notice shall be included in all
20
- copies or substantial portions of the Software.
21
-
22
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- SOFTWARE.
29
- License-File: LICENSE
30
- Classifier: License :: OSI Approved :: MIT License
31
- Classifier: Operating System :: OS Independent
32
- Classifier: Programming Language :: Python :: 3
33
- Requires-Python: >=3.9
34
- Description-Content-Type: text/markdown
35
-
36
- ![pyrobaletext](https://raw.githubusercontent.com/pyrobale/pyrobale/refs/heads/main/pyrobaletext.png)
37
-
38
- # Bale Bot API Python Library
39
-
40
- A Python wrapper for the Bale Bot API that makes it easy to build Bale bots.
41
-
42
- ## Features
43
-
44
- - Full Bale Bot API support
45
- - Object-oriented design
46
- - Easy-to-use interface
47
- - Support for:
48
- - Messages
49
- - Photos
50
- - Documents
51
- - Audio
52
- - Video
53
- - Voice messages
54
- - Location
55
- - Contact sharing
56
- - Inline keyboards
57
- - Menu keyboards
58
- - Callback queries
59
- - Chat administration
60
- - Payment system
61
- - Database integration
62
-
63
- ## Installation
64
-
65
- ``pip install pyrobale``
66
-
67
- ## Quick Start
68
-
69
- ```py
70
- from bale import Client, MenuKeyboardMarkup, MenuKeyboardButton
71
-
72
- # Initialize bot with token
73
- bot = Client("YOUR_BOT_TOKEN")
74
-
75
- # Handle incoming messages
76
- @bot.on_message
77
- def handle_message(message):
78
- if message.text == "/start":
79
- # Create keyboard
80
- keyboard = MenuKeyboardMarkup()
81
- keyboard.add(MenuKeyboardButton("Hello!"))
82
-
83
- # Send welcome message
84
- message.reply_message("Welcome!", reply_markup=keyboard)
85
-
86
- # Start the bot
87
- bot.run()
88
- ```
89
-
90
- ## Key Components
91
-
92
- ### Client
93
-
94
- The main class for interacting with Bale API. Handles all API requests and provides event decorators.
95
-
96
- ### Message
97
-
98
- Represents a message in Bale with methods for replying, editing, and deleting messages.
99
-
100
- ### User
101
-
102
- Represents a Bale user with their properties and methods.
103
-
104
- ### Chat
105
-
106
- Represents a chat conversation with methods for sending messages and managing chat settings.
107
-
108
- ### Keyboards
109
-
110
- - `MenuKeyboardMarkup`: For creating text keyboards
111
- - `InlineKeyboardMarkup`: For creating inline keyboards
112
-
113
- ### Database
114
-
115
- Built-in SQLite database support for storing persistent data.
116
-
117
- ## Event Handlers
118
-
119
- # Message handler
120
-
121
- ```python
122
- @bot.on_message
123
- def handle_message(message):
124
- pass
125
- ```
126
-
127
- # Callback query handler
128
-
129
- ```python
130
- @bot.on_callback_query
131
- def handle_callback(callback):
132
- pass
133
- ```
134
-
135
- # Periodic task handler
136
-
137
- ```python
138
- @bot.on_tick(60) # Runs every 60 seconds
139
- def handle_tick():
140
- pass
141
- ```
142
-
143
- # Ready event handler
144
-
145
- ```python
146
- @bot.on_ready
147
- def handle_ready():
148
- pass
149
- ```
150
-
151
- # Member join handler
152
-
153
- ```python
154
- @bot.on_member_chat_join
155
- def handle_join(message, chat, user):
156
- pass
157
- ```
158
-
159
- # Member leave handler
160
-
161
- ```python
162
- @bot.on_member_chat_leave
163
- def handle_leave(message, chat, user):
164
- pass
165
- ```
166
-
167
- ## Database Usage
168
-
169
- # Access database
170
-
171
- ```py
172
- with bot.database as db:
173
- db.write_key("user_123", {"points": 100})
174
-
175
- data = db.read_key("user_123")
176
- ```