pyrobale 0.3.5__tar.gz → 0.3.8.5__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.
Files changed (63) hide show
  1. pyrobale-0.3.8.5/.github/ISSUE_TEMPLATE/issue-template-/342/204/271/357/270/217.md +64 -0
  2. pyrobale-0.3.8.5/.github/workflows/docs.yml +38 -0
  3. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/LICENSE +2 -2
  4. pyrobale-0.3.8.5/PKG-INFO +152 -0
  5. pyrobale-0.3.8.5/README.md +116 -0
  6. pyrobale-0.3.8.5/examples/command.py +12 -0
  7. pyrobale-0.3.8.5/examples/echo_bot.py +10 -0
  8. pyrobale-0.3.8.5/examples/handler_system.py +11 -0
  9. pyrobale-0.3.8.5/examples/inline_keyboard.py +20 -0
  10. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyproject.toml +3 -2
  11. pyrobale-0.3.8.5/pyrobale/StateMachine/__init__.py +66 -0
  12. pyrobale-0.3.8.5/pyrobale/__init__.py +125 -0
  13. pyrobale-0.3.8.5/pyrobale/client/__init__.py +1234 -0
  14. pyrobale-0.3.8.5/pyrobale/exceptions/__init__.py +1 -0
  15. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/exceptions/common.py +6 -0
  16. pyrobale-0.3.8.5/pyrobale/filters/__init__.py +2 -0
  17. pyrobale-0.3.8.5/pyrobale/filters/enum_filters.py +12 -0
  18. pyrobale-0.3.8.5/pyrobale/filters/func_filters.py +17 -0
  19. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/__init__.py +3 -0
  20. pyrobale-0.3.8.5/pyrobale/objects/callbackquery.py +37 -0
  21. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/chat.py +11 -0
  22. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/chatmember.py +5 -4
  23. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/enums.py +8 -0
  24. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/inlinekeyboardmarkup.py +11 -4
  25. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/message.py +33 -16
  26. pyrobale-0.3.8.5/pyrobale/objects/user.py +22 -0
  27. pyrobale-0.3.8.5/pyrobale/objects/utils.py +48 -0
  28. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale.png +0 -0
  29. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobaletext.png +0 -0
  30. pyrobale-0.3.5/PKG-INFO +0 -176
  31. pyrobale-0.3.5/README.md +0 -141
  32. pyrobale-0.3.5/pyrobale/__init__.py +0 -3
  33. pyrobale-0.3.5/pyrobale/client/__init__.py +0 -574
  34. pyrobale-0.3.5/pyrobale/exceptions/__init__.py +0 -0
  35. pyrobale-0.3.5/pyrobale/objects/callbackquery.py +0 -42
  36. pyrobale-0.3.5/pyrobale/objects/user.py +0 -20
  37. pyrobale-0.3.5/pyrobale/objects/utils.py +0 -28
  38. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/animation.py +0 -0
  39. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/audio.py +0 -0
  40. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/chatphoto.py +0 -0
  41. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/contact.py +0 -0
  42. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/copytextbutton.py +0 -0
  43. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/document.py +0 -0
  44. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/file.py +0 -0
  45. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/inlinekeyboardbutton.py +0 -0
  46. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/inputfile.py +0 -0
  47. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/inputmedias.py +0 -0
  48. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/invoice.py +0 -0
  49. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/keyboardbutton.py +0 -0
  50. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/labeledprice.py +0 -0
  51. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/location.py +0 -0
  52. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/messageid.py +0 -0
  53. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/photosize.py +0 -0
  54. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/precheckoutquery.py +0 -0
  55. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/replykeyboardmarkup.py +0 -0
  56. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/sticker.py +0 -0
  57. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/stickerset.py +0 -0
  58. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/successfulpayment.py +0 -0
  59. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/update.py +0 -0
  60. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/video.py +0 -0
  61. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/voice.py +0 -0
  62. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/webappdata.py +0 -0
  63. {pyrobale-0.3.5 → pyrobale-0.3.8.5}/pyrobale/objects/webappinfo.py +0 -0
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: Issue template ℹ️
3
+ about: Report any issue here
4
+ title: Issue Title
5
+ labels: ''
6
+ assignees: Daradege, Code-Wizaard
7
+
8
+ ---
9
+
10
+ ### 🐞 Issue Type
11
+
12
+ Please select one:
13
+
14
+ - [ ] Bug Report
15
+ - [ ] Feature Request
16
+ - [ ] Documentation Improvement
17
+ - [ ] Question / Help Needed
18
+
19
+ ---
20
+
21
+ ### 📌 Description
22
+
23
+ <!-- Clearly describe the issue, suggestion, or question -->
24
+
25
+ Example:
26
+ When using `send_file` with a relative path, it raises `FileNotFoundError` even though the file exists.
27
+
28
+ ---
29
+
30
+ ### 🔁 Steps to Reproduce (For Bugs)
31
+
32
+ 1. ...
33
+ 2. ...
34
+ 3. ...
35
+ 4. ...
36
+
37
+ ---
38
+
39
+ ### ✅ Expected Behavior
40
+
41
+ <!-- What did you expect to happen? -->
42
+
43
+ ---
44
+
45
+ ### 📎 Environment Info
46
+
47
+ - Python version: e.g., `3.11`
48
+ - Operating System: e.g., `Linux Mint 21.3 KDE`
49
+ - PyroBale version: e.g., `0.2.1`
50
+ - Internet connection / proxy info: e.g., `Direct, no proxy`
51
+
52
+ ---
53
+
54
+ ### 📝 Code Sample (If Applicable)
55
+
56
+ ```python
57
+ # Include a minimal reproducible code sample if relevant
58
+ ````
59
+
60
+ ---
61
+
62
+ ### 🙏 Additional Notes
63
+
64
+ <!-- Any extra notes, thanks, or related info -->
@@ -0,0 +1,38 @@
1
+ name: Build and Deploy Docs
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ docs:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - name: Checkout repository
14
+ uses: actions/checkout@v4
15
+ with:
16
+ fetch-depth: 0
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: '3.11'
22
+
23
+ - name: Install dependencies
24
+ run: |
25
+ pip install pdoc aiohttp
26
+
27
+ - name: Generate documentation
28
+ run: |
29
+ pdoc pyrobale --output-dir docs --docformat google
30
+
31
+ - name: Deploy to docs branch
32
+ uses: peaceiris/actions-gh-pages@v3
33
+ with:
34
+ deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}
35
+ external_repository: pyrobale/docs
36
+ publish_branch: docs
37
+ publish_dir: ./docs
38
+ commit_message: "Auto-generate docs from ${{ github.sha }}"
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Ali Safamanesh
3
+ Copyright (c) 2025 PyroBale Team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -0,0 +1,152 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyrobale
3
+ Version: 0.3.8.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>, Aydin Rahbaran <codewizaard9@gmail.com>
8
+ License: MIT License
9
+
10
+ Copyright (c) 2025 PyroBale Team
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** - 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: Message):
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
+
82
+ client = Client("YOUR_BOT_TOKEN")
83
+
84
+ async def handle_message(message: Message):
85
+ if message.text == "/start":
86
+ await message.reply("Hi! Im a pyrobale RoBot!")
87
+ await client.wait_for(UpdatesTypes.MESSAGE)
88
+ await message.reply("Okay! wait_for Test Compeleted")
89
+
90
+ client.add_handler(UpdatesTypes.MESSAGE, handle_message)
91
+
92
+ client.run()
93
+ ```
94
+
95
+ ### Echo Bot
96
+ ```python
97
+ from pyrobale.client import Client
98
+ from pyrobale.objects import Message, UpdatesTypes
99
+
100
+ bot = Client("YOUR_BOT_TOKEN")
101
+
102
+ @bot.on_message()
103
+ async def message_handler(message: Message):
104
+ await message.reply(message.text)
105
+
106
+ bot.run()
107
+ ```
108
+
109
+ ### Inline Keyboard
110
+ ```python
111
+ from pyrobale.client import Client
112
+ from pyrobale.objects import Message, UpdatesTypes, InlineKeyboardButton, InlineKeyboardMarkup, CopyTextButton
113
+
114
+ bot = Client("YOUR_BOT_TOKEN")
115
+ async def message_handler(message: Message):
116
+ buttons = InlineKeyboardMarkup()
117
+ buttons.add_button("URL", url="https://google.com")
118
+ buttons.add_button("Callback", callback_data="callback")
119
+ buttons.add_row()
120
+ buttons.add_button("WebApp", web_app="https://daradege.ir")
121
+ buttons.add_button("Copy", copy_text_button=CopyTextButton("TEXT"))
122
+ await message.reply("Hello, world!", reply_markup=buttons)
123
+ ```
124
+
125
+
126
+ ## Core Abilities
127
+
128
+ - **Message Handling** - Process text, commands, and media messages
129
+ - **Callback Queries** - Handle inline keyboard interactions
130
+ - **File Operations** - Send and receive photos, videos, documents
131
+ - **Chat Management** - Get chat info, member management
132
+ - **Custom Keyboards** - Create interactive user interfaces
133
+ - **Webhook Support** - Production-ready webhook handling
134
+ - **Middleware Support** - Add custom processing layers
135
+
136
+ ## Documentation
137
+
138
+ For detailed documentation and advanced usage, visit our [documentation site](https://pyrobale.readthedocs.io).
139
+
140
+ ## Contributing
141
+
142
+ Contributions are welcome! Please feel free to submit a Pull Request.
143
+
144
+ ## License
145
+
146
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
147
+
148
+ ## Support
149
+
150
+ - 📖 [Documentation](https://pyrobale.readthedocs.io)
151
+ - 🐛 [Issue Tracker](https://github.com/pyrobale/pyrobale/issues)
152
+ - 💬 [Discussions](https://github.com/pyrobale/pyrobale/discussions)
@@ -0,0 +1,116 @@
1
+ ![pyrobaletext](https://raw.githubusercontent.com/pyrobale/pyrobale/refs/heads/main/pyrobaletext.png)
2
+
3
+ # Bale Bot API Python Library
4
+
5
+ A modern, easy-to-use Python wrapper for the Bale Bot API that makes building Bale bots simple and intuitive.
6
+
7
+ ## Features
8
+
9
+ - 🚀 **Simple & Intuitive** - Clean, Pythonic API design
10
+ - 📨 **Full Message Support** - Text, photos, videos, documents, and more
11
+ - ⌨️ **Interactive Elements** - Inline keyboards, reply keyboards, and buttons
12
+ - 🔄 **Real-time Updates** - Webhook and polling support
13
+ - 📁 **File Handling** - Easy upload and download of media files
14
+ - 🛡️ **Error Handling** - Comprehensive exception handling
15
+ - 📖 **Type Hints** - Full typing support for better development experience
16
+ - ⚡ **Async Support** - asynchronous operations
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install pyrobale
22
+ ```
23
+
24
+ ## Quick Start
25
+
26
+ ```python
27
+ from pyrobale.client import Client
28
+ from pyrobale.objects import Message, UpdatesTypes
29
+
30
+ bot = Client("YOUR_BOT_TOKEN")
31
+
32
+ @bot.on_message()
33
+ async def message_handler(message: Message):
34
+ await message.reply("Hello, world!")
35
+
36
+ bot.run()
37
+ ```
38
+
39
+ ## Examples
40
+
41
+ ### Conversation Bot
42
+ ```python
43
+ from pyrobale.objects import *
44
+ from pyrobale.client import Client, Message, UpdatesTypes
45
+
46
+ client = Client("YOUR_BOT_TOKEN")
47
+
48
+ async def handle_message(message: Message):
49
+ if message.text == "/start":
50
+ await message.reply("Hi! Im a pyrobale RoBot!")
51
+ await client.wait_for(UpdatesTypes.MESSAGE)
52
+ await message.reply("Okay! wait_for Test Compeleted")
53
+
54
+ client.add_handler(UpdatesTypes.MESSAGE, handle_message)
55
+
56
+ client.run()
57
+ ```
58
+
59
+ ### Echo Bot
60
+ ```python
61
+ from pyrobale.client import Client
62
+ from pyrobale.objects import Message, UpdatesTypes
63
+
64
+ bot = Client("YOUR_BOT_TOKEN")
65
+
66
+ @bot.on_message()
67
+ async def message_handler(message: Message):
68
+ await message.reply(message.text)
69
+
70
+ bot.run()
71
+ ```
72
+
73
+ ### Inline Keyboard
74
+ ```python
75
+ from pyrobale.client import Client
76
+ from pyrobale.objects import Message, UpdatesTypes, InlineKeyboardButton, InlineKeyboardMarkup, CopyTextButton
77
+
78
+ bot = Client("YOUR_BOT_TOKEN")
79
+ async def message_handler(message: Message):
80
+ buttons = InlineKeyboardMarkup()
81
+ buttons.add_button("URL", url="https://google.com")
82
+ buttons.add_button("Callback", callback_data="callback")
83
+ buttons.add_row()
84
+ buttons.add_button("WebApp", web_app="https://daradege.ir")
85
+ buttons.add_button("Copy", copy_text_button=CopyTextButton("TEXT"))
86
+ await message.reply("Hello, world!", reply_markup=buttons)
87
+ ```
88
+
89
+
90
+ ## Core Abilities
91
+
92
+ - **Message Handling** - Process text, commands, and media messages
93
+ - **Callback Queries** - Handle inline keyboard interactions
94
+ - **File Operations** - Send and receive photos, videos, documents
95
+ - **Chat Management** - Get chat info, member management
96
+ - **Custom Keyboards** - Create interactive user interfaces
97
+ - **Webhook Support** - Production-ready webhook handling
98
+ - **Middleware Support** - Add custom processing layers
99
+
100
+ ## Documentation
101
+
102
+ For detailed documentation and advanced usage, visit our [documentation site](https://pyrobale.readthedocs.io).
103
+
104
+ ## Contributing
105
+
106
+ Contributions are welcome! Please feel free to submit a Pull Request.
107
+
108
+ ## License
109
+
110
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
111
+
112
+ ## Support
113
+
114
+ - 📖 [Documentation](https://pyrobale.readthedocs.io)
115
+ - 🐛 [Issue Tracker](https://github.com/pyrobale/pyrobale/issues)
116
+ - 💬 [Discussions](https://github.com/pyrobale/pyrobale/discussions)
@@ -0,0 +1,12 @@
1
+ from pyrobale.client import Client
2
+ from pyrobale.objects import Message, UpdatesTypes
3
+
4
+ token = "YOUR_BOT_TOKEN"
5
+
6
+ bot = Client(token)
7
+
8
+ @bot.on_command('start')
9
+ async def start(message: Message):
10
+ await message.reply("Hello, world!")
11
+
12
+ bot.run()
@@ -0,0 +1,10 @@
1
+ from pyrobale.client import Client
2
+ from pyrobale.objects import Message, UpdatesTypes
3
+
4
+ client = Client("YOUR_BOT_TOKEN")
5
+
6
+ @client.on_message()
7
+ async def message_handler(message: Message):
8
+ await message.reply(message.text)
9
+
10
+ client.run()
@@ -0,0 +1,11 @@
1
+ from ..pyrobale.client import Client
2
+ from ..pyrobale.objects import Message, UpdatesTypes
3
+
4
+ client = Client("YOUR_BOT_TOKEN")
5
+
6
+ async def message_handler(message: Message):
7
+ await message.reply("Hello, world!")
8
+
9
+ client.add_handler(UpdatesTypes.MESSAGE, message_handler)
10
+
11
+ client.run()
@@ -0,0 +1,20 @@
1
+ from pyrobale.client import Client
2
+ from pyrobale.objects import Message, UpdatesTypes, CallbackQuery
3
+ from pyrobale.objects import InlineKeyboardButton, InlineKeyboardMarkup, CopyTextButton
4
+
5
+ client = Client("YOUR_BOT_TOKEN")
6
+
7
+ @client.on_message()
8
+ async def message_handler(message: Message):
9
+ buttons = InlineKeyboardMarkup()
10
+ buttons.add_button("Callback", callback_data="callback_data")
11
+ buttons.add_button("Copy Text", copy_text=CopyTextButton("Hello, world!"))
12
+ buttons.add_button("URL", url="https://www.google.com")
13
+ buttons.add_button("WebApp", web_app="https://daradege.ir")
14
+ await message.reply("These are Inline Buttons!", reply_markup=buttons)
15
+
16
+ @client.on_callback_query()
17
+ async def callback_handler(callback_query: CallbackQuery):
18
+ await callback_query.answer("Callback Query Received!", show_alert=True)
19
+
20
+ client.run()
@@ -1,8 +1,9 @@
1
1
  [project]
2
2
  name = "pyrobale"
3
- version = "0.3.5"
3
+ version = "0.3.8.5"
4
4
  authors = [
5
5
  { name = "Ali Safamanesh", email = "darg.q.a.a@gmail.com" },
6
+ { name = "Aydin Rahbaran", email = "codewizaard9@gmail.com"},
6
7
  ]
7
8
  description = "A python wrapper for bale api"
8
9
  readme = "README.md"
@@ -13,7 +14,7 @@ classifiers = [
13
14
  "Operating System :: OS Independent",
14
15
  ]
15
16
  license = { file = "LICENSE" }
16
-
17
+ dependencies = ["aiohttp"]
17
18
  [project.urls]
18
19
  github = "https://github.com/pyrobale/pyrobale"
19
20
  website = "https://pyrobale.github.io"
@@ -0,0 +1,66 @@
1
+ from typing import Union, TYPE_CHECKING
2
+
3
+ if TYPE_CHECKING:
4
+ from ..objects import User
5
+ from ..client import Client
6
+
7
+
8
+ class StateMachine:
9
+ def __init__(self):
10
+ self.__states = {}
11
+
12
+ def set_state(self, user_id: Union[str, int], state: str):
13
+ """Sets or updates state of a user
14
+
15
+ Args:
16
+ user_id (string OR integer): unique id of user for setting the state
17
+ state (string): state of user (it can be anything)
18
+ """
19
+ self.__states[user_id] = state
20
+
21
+ def get_state(self, user_id: Union[str, int]) -> str:
22
+ """Gets state of a specified user
23
+
24
+ Args:
25
+ user_id (string OR integer): unique id of user for getting the state
26
+
27
+ Returns:
28
+ Str: the state of user
29
+ """
30
+
31
+ if user_id in self.__states:
32
+ return self.__states[user_id]
33
+ else:
34
+ raise KeyError
35
+
36
+ def del_state(self, user_id: Union[str, int]):
37
+ """Deletes the saved state of user
38
+
39
+ Args:
40
+ user_id (string OR integer): unique if of user to delete its state
41
+ """
42
+ if user_id in self.__states:
43
+ del self.__states[user_id]
44
+ else:
45
+ raise KeyError
46
+
47
+ def save_local(self, file_name: str):
48
+ """Saves the state of all users to a file
49
+
50
+ Args:
51
+ file_name (string): name of file to save the state of users
52
+ """
53
+ with open(file_name, "w") as f:
54
+ for user_id, state in self.__states.items():
55
+ f.write(f"{user_id} {state}\n")
56
+
57
+ def load_local(self, file_name: str):
58
+ """Loads the state of all users from a file
59
+
60
+ Args:
61
+ file_name (string): name of file to load the state of users
62
+ """
63
+ with open(file_name, "r") as f:
64
+ for line in f:
65
+ user_id, state = line.split()
66
+ self.__states[user_id] = state
@@ -0,0 +1,125 @@
1
+ """
2
+ ![pyrobaletext](https://raw.githubusercontent.com/pyrobale/pyrobale/refs/heads/main/pyrobaletext.png)
3
+
4
+ # Bale Bot API Python Library
5
+
6
+ A modern, easy-to-use Python wrapper for the Bale Bot API that makes building Bale bots simple and intuitive.
7
+
8
+ ## Features
9
+
10
+ - 🚀 **Simple & Intuitive** - Clean, Pythonic API design
11
+ - 📨 **Full Message Support** - Text, photos, videos, documents, and more
12
+ - ⌨️ **Interactive Elements** - Inline keyboards, reply keyboards, and buttons
13
+ - 🔄 **Real-time Updates** - Webhook and polling support
14
+ - 📁 **File Handling** - Easy upload and download of media files
15
+ - 🛡️ **Error Handling** - Comprehensive exception handling
16
+ - 📖 **Type Hints** - Full typing support for better development experience
17
+ - ⚡ **Async Support** - Both synchronous and asynchronous operations
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pip install pyrobale
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ ```python
28
+ from pyrobale.client import Client
29
+ from pyrobale.objects import Message, UpdatesTypes
30
+
31
+ bot = Client("YOUR_BOT_TOKEN")
32
+
33
+ @bot.on_message()
34
+ async def message_handler(message: Message):
35
+ await message.reply("Hello, world!")
36
+
37
+ bot.run()
38
+ ```
39
+
40
+ ## Examples
41
+
42
+ ### Conversation Bot
43
+ ```python
44
+ from pyrobale.objects import *
45
+ from pyrobale.client import Client, Message, UpdatesTypes
46
+ import asyncio
47
+
48
+ client = Client("YOUR_BOT_TOKEN")
49
+
50
+ async def handle_message(message: Message):
51
+ if message.text == "/start":
52
+ await message.reply("سلام! من یک ربات PyRoBale هستم!")
53
+ await client.wait_for(UpdatesTypes.MESSAGE)
54
+ await message.reply("Okay! wait_for Test Compeleted")
55
+
56
+ client.add_handler(UpdatesTypes.MESSAGE, handle_message)
57
+
58
+ client.run()
59
+ ```
60
+
61
+ ### Echo Bot
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: Message):
70
+ await message.reply(message.text)
71
+
72
+ bot.run()
73
+ ```
74
+
75
+ ### Inline Keyboard
76
+ ```python
77
+ from pyrobale.client import Client
78
+ from pyrobale.objects import Message, UpdatesTypes, InlineKeyboardButton, InlineKeyboardMarkup, CopyTextButton
79
+
80
+ bot = Client("YOUR_BOT_TOKEN")
81
+ async def message_handler(message: Message):
82
+ buttons = InlineKeyboardMarkup()
83
+ buttons.add_button("URL", url="https://google.com")
84
+ buttons.add_button("Callback", callback_data="callback")
85
+ buttons.add_row()
86
+ buttons.add_button("WebApp", web_app="https://daradege.ir")
87
+ buttons.add_button("Copy", copy_text_button=CopyTextButton("TEXT"))
88
+ await message.reply("Hello, world!", reply_markup=buttons)
89
+ ```
90
+
91
+
92
+ ## Core Abilities
93
+
94
+ - **Message Handling** - Process text, commands, and media messages
95
+ - **Callback Queries** - Handle inline keyboard interactions
96
+ - **File Operations** - Send and receive photos, videos, documents
97
+ - **Chat Management** - Get chat info, member management
98
+ - **Custom Keyboards** - Create interactive user interfaces
99
+ - **Webhook Support** - Production-ready webhook handling
100
+ - **Middleware Support** - Add custom processing layers
101
+
102
+ ## Documentation
103
+
104
+ For detailed documentation and advanced usage, visit our [documentation site](https://pyrobale.readthedocs.io).
105
+
106
+ ## Contributing
107
+
108
+ Contributions are welcome! Please feel free to submit a Pull Request.
109
+
110
+ ## License
111
+
112
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
113
+
114
+ ## Support
115
+
116
+ - 📖 [Documentation](https://pyrobale.readthedocs.io)
117
+ - 🐛 [Issue Tracker](https://github.com/pyrobale/pyrobale/issues)
118
+ - 💬 [Discussions](https://github.com/pyrobale/pyrobale/discussions)
119
+
120
+ """
121
+
122
+ from .objects.utils import *
123
+ from .exceptions import *
124
+ from .objects import *
125
+ from .client import Client