baleio 0.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.
Files changed (52) hide show
  1. baleio/__init__.py +93 -0
  2. baleio/__meta__.py +2 -0
  3. baleio/client/__init__.py +5 -0
  4. baleio/client/bot.py +655 -0
  5. baleio/client/default.py +18 -0
  6. baleio/client/session/__init__.py +4 -0
  7. baleio/client/session/aiohttp.py +115 -0
  8. baleio/client/session/base.py +178 -0
  9. baleio/dispatcher/__init__.py +4 -0
  10. baleio/dispatcher/dispatcher.py +223 -0
  11. baleio/dispatcher/event/__init__.py +4 -0
  12. baleio/dispatcher/event/handler.py +23 -0
  13. baleio/dispatcher/event/observer.py +74 -0
  14. baleio/dispatcher/router.py +72 -0
  15. baleio/enums/__init__.py +128 -0
  16. baleio/exceptions.py +121 -0
  17. baleio/filters/__init__.py +30 -0
  18. baleio/filters/base.py +81 -0
  19. baleio/filters/callback_data.py +149 -0
  20. baleio/filters/command.py +96 -0
  21. baleio/filters/exception.py +40 -0
  22. baleio/filters/logic.py +41 -0
  23. baleio/filters/state.py +32 -0
  24. baleio/fsm/__init__.py +14 -0
  25. baleio/fsm/context.py +33 -0
  26. baleio/fsm/state.py +81 -0
  27. baleio/fsm/storage/__init__.py +4 -0
  28. baleio/fsm/storage/base.py +53 -0
  29. baleio/fsm/storage/memory.py +39 -0
  30. baleio/types/__init__.py +143 -0
  31. baleio/types/attachments.py +53 -0
  32. baleio/types/base.py +84 -0
  33. baleio/types/callback.py +41 -0
  34. baleio/types/chat.py +135 -0
  35. baleio/types/error.py +20 -0
  36. baleio/types/input_file.py +115 -0
  37. baleio/types/input_media.py +58 -0
  38. baleio/types/keyboards.py +59 -0
  39. baleio/types/media.py +98 -0
  40. baleio/types/message.py +272 -0
  41. baleio/types/misc.py +18 -0
  42. baleio/types/payments.py +50 -0
  43. baleio/types/update.py +33 -0
  44. baleio/types/user.py +27 -0
  45. baleio/utils/__init__.py +3 -0
  46. baleio/utils/call.py +77 -0
  47. baleio/utils/keyboard.py +84 -0
  48. baleio/utils/markdown.py +35 -0
  49. baleio-0.1.0.dist-info/METADATA +389 -0
  50. baleio-0.1.0.dist-info/RECORD +52 -0
  51. baleio-0.1.0.dist-info/WHEEL +4 -0
  52. baleio-0.1.0.dist-info/licenses/LICENSE +21 -0
baleio/__init__.py ADDED
@@ -0,0 +1,93 @@
1
+ """baleio — a modern, fully async framework for Bale (بله) bots.
2
+
3
+ Inspired by aiogram. Quick start::
4
+
5
+ import asyncio
6
+ from baleio import Bot, Dispatcher
7
+ from baleio.filters import Command
8
+ from baleio.types import Message
9
+
10
+ dp = Dispatcher()
11
+
12
+ @dp.message(Command("start"))
13
+ async def start(message: Message):
14
+ await message.answer("سلام! به baleio خوش اومدی.")
15
+
16
+ async def main():
17
+ bot = Bot("TOKEN")
18
+ await dp.start_polling(bot)
19
+
20
+ asyncio.run(main())
21
+ """
22
+ from __future__ import annotations
23
+
24
+ from . import enums, filters, types
25
+ from .__meta__ import __version__
26
+ from .client import AiohttpSession, BaseSession, Bot, DefaultBotProperties
27
+ from .dispatcher import Dispatcher, Router
28
+ from .exceptions import (
29
+ BaleAPIError,
30
+ BaleBadRequest,
31
+ BaleError,
32
+ BaleForbidden,
33
+ BaleNetworkError,
34
+ BaleNotFound,
35
+ BaleRetryAfter,
36
+ BaleUnauthorized,
37
+ )
38
+ from .filters import (
39
+ CallbackData,
40
+ Command,
41
+ CommandStart,
42
+ ExceptionTypeFilter,
43
+ F,
44
+ StateFilter,
45
+ )
46
+ from .fsm import FSMContext, MemoryStorage, State, StatesGroup
47
+ from .utils import InlineKeyboardBuilder, ReplyKeyboardBuilder
48
+ from .utils import markdown as md
49
+
50
+ #: Bale renders Markdown only, so ``md`` is the analogue of aiogram's ``html``.
51
+ markdown = md
52
+
53
+ __all__ = [
54
+ "__version__",
55
+ # sub-packages
56
+ "types",
57
+ "enums",
58
+ "filters",
59
+ "md",
60
+ "markdown",
61
+ # client
62
+ "Bot",
63
+ "DefaultBotProperties",
64
+ "AiohttpSession",
65
+ "BaseSession",
66
+ # dispatcher
67
+ "Dispatcher",
68
+ "Router",
69
+ # filters
70
+ "F",
71
+ "Command",
72
+ "CommandStart",
73
+ "StateFilter",
74
+ "CallbackData",
75
+ "ExceptionTypeFilter",
76
+ # fsm
77
+ "FSMContext",
78
+ "State",
79
+ "StatesGroup",
80
+ "MemoryStorage",
81
+ # keyboards
82
+ "InlineKeyboardBuilder",
83
+ "ReplyKeyboardBuilder",
84
+ # exceptions
85
+ "BaleError",
86
+ "BaleAPIError",
87
+ "BaleBadRequest",
88
+ "BaleForbidden",
89
+ "BaleNotFound",
90
+ "BaleUnauthorized",
91
+ "BaleNetworkError",
92
+ "BaleRetryAfter",
93
+ ]
baleio/__meta__.py ADDED
@@ -0,0 +1,2 @@
1
+ __version__ = "0.1.0"
2
+ __api_version__ = "bale-bot-api"
@@ -0,0 +1,5 @@
1
+ from .bot import Bot
2
+ from .default import DefaultBotProperties
3
+ from .session import AiohttpSession, BaseSession
4
+
5
+ __all__ = ["Bot", "DefaultBotProperties", "AiohttpSession", "BaseSession"]