botapi-py 1.3.1__tar.gz → 1.3.3__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.
- {botapi_py-1.3.1 → botapi_py-1.3.3}/PKG-INFO +1 -1
- {botapi_py-1.3.1 → botapi_py-1.3.3}/pyproject.toml +1 -1
- {botapi_py-1.3.1 → botapi_py-1.3.3}/src/botapi/dispatchers/__init__.py +4 -1
- {botapi_py-1.3.1 → botapi_py-1.3.3}/src/botapi/dispatchers/get_updates_handler.py +2 -2
- {botapi_py-1.3.1 → botapi_py-1.3.3}/src/botapi/dispatchers/redis_pubsub_handler.py +2 -1
- {botapi_py-1.3.1 → botapi_py-1.3.3}/src/botapi/enums.py +15 -5
- botapi_py-1.3.1/src/botapi/boilerplate.py +0 -20
- {botapi_py-1.3.1 → botapi_py-1.3.3}/src/botapi/__init__.py +0 -0
- {botapi_py-1.3.1 → botapi_py-1.3.3}/src/botapi/__init__.pyi +0 -0
- {botapi_py-1.3.1 → botapi_py-1.3.3}/src/botapi/api.py +0 -0
- {botapi_py-1.3.1 → botapi_py-1.3.3}/src/botapi/core.py +0 -0
- {botapi_py-1.3.1 → botapi_py-1.3.3}/src/botapi/errors.py +0 -0
- {botapi_py-1.3.1 → botapi_py-1.3.3}/src/botapi/types.py +0 -0
- {botapi_py-1.3.1 → botapi_py-1.3.3}/src/botapi/utils.py +0 -0
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
from .get_updates_handler import GetUpdatesAsyncDispatcher
|
|
2
|
-
|
|
2
|
+
try:
|
|
3
|
+
from .redis_pubsub_handler import RedisPubSubAsyncDispatcher
|
|
4
|
+
except ImportError:
|
|
5
|
+
pass
|
|
3
6
|
|
|
4
7
|
__all__ = [
|
|
5
8
|
'GetUpdatesAsyncDispatcher',
|
|
@@ -17,7 +17,7 @@ class GetUpdatesAsyncDispatcher:
|
|
|
17
17
|
update_handler: UpdateHandler
|
|
18
18
|
tasks_shutdown_timeout: float
|
|
19
19
|
tasks: set[asyncio.Task] # prevent gc from collecting tasks before they finish
|
|
20
|
-
bot: botapi.api.BotAPI
|
|
20
|
+
bot: 'botapi.api.BotAPI'
|
|
21
21
|
reconnect_delay: float
|
|
22
22
|
allowed_updates: list[str]
|
|
23
23
|
offset: int
|
|
@@ -25,7 +25,7 @@ class GetUpdatesAsyncDispatcher:
|
|
|
25
25
|
def __init__(
|
|
26
26
|
self,
|
|
27
27
|
update_handler: UpdateHandler,
|
|
28
|
-
bot: botapi.api.BotAPI,
|
|
28
|
+
bot: 'botapi.api.BotAPI',
|
|
29
29
|
allowed_updates: list[str], # botapi.enums.UpdateType
|
|
30
30
|
reconnect_delay: float = 5,
|
|
31
31
|
shutdown_wait_timeout: float = 3
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import enum
|
|
2
|
+
from typing import Union
|
|
2
3
|
|
|
3
|
-
from . import boilerplate
|
|
4
4
|
|
|
5
5
|
class ChatType(enum.StrEnum):
|
|
6
6
|
PRIVATE = 'private'
|
|
@@ -102,11 +102,9 @@ class ServiceMessage(enum.StrEnum):
|
|
|
102
102
|
WEB_APP_DATA = 'web_app_data'
|
|
103
103
|
SUGGESTED_POST = 'suggested_post_info'
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
class MessageType(enum.StrEnum):
|
|
105
|
+
class OtherMessageType(enum.StrEnum):
|
|
107
106
|
'''
|
|
108
|
-
The
|
|
109
|
-
All of these fields should be mutually exclusive.
|
|
107
|
+
The type of this message (that does NOT contain multimedia or service content).
|
|
110
108
|
'''
|
|
111
109
|
TEXT = 'text'
|
|
112
110
|
CHECKLIST = 'checklist'
|
|
@@ -118,6 +116,18 @@ class MessageType(enum.StrEnum):
|
|
|
118
116
|
LOCATION = 'location'
|
|
119
117
|
CONTACT = 'contact'
|
|
120
118
|
|
|
119
|
+
MessageType = Union[
|
|
120
|
+
MediaType,
|
|
121
|
+
ServiceMessage,
|
|
122
|
+
OtherMessageType
|
|
123
|
+
]
|
|
124
|
+
'''
|
|
125
|
+
The type of the **actual** message content.
|
|
126
|
+
|
|
127
|
+
All of the fields are mutually exclusive, since a message
|
|
128
|
+
can only be of one 'type' at a time.
|
|
129
|
+
'''
|
|
130
|
+
|
|
121
131
|
class ChatMemberStatus(enum.StrEnum):
|
|
122
132
|
'''
|
|
123
133
|
Statuses of a chat member.
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import enum
|
|
2
|
-
|
|
3
|
-
from typing import TypeVar, Callable
|
|
4
|
-
|
|
5
|
-
# Enums
|
|
6
|
-
E = TypeVar('E', bound=enum.Enum)
|
|
7
|
-
|
|
8
|
-
def extend_enum(*sources: type[E]) -> Callable[..., type[E]]:
|
|
9
|
-
'''
|
|
10
|
-
Decorator that extends an Enum class with members
|
|
11
|
-
from one or more source Enum classes.
|
|
12
|
-
'''
|
|
13
|
-
def decorator(target: type[E]) -> type[E]:
|
|
14
|
-
for source in sources:
|
|
15
|
-
for member in source:
|
|
16
|
-
if member.name not in target.__members__:
|
|
17
|
-
target._member_map_[member.name] = member
|
|
18
|
-
return target
|
|
19
|
-
return decorator
|
|
20
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|