Pytdbot 0.9.0.dev4__tar.gz → 0.9.0.dev6__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.
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/LICENSE +1 -1
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/PKG-INFO +4 -5
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/Pytdbot.egg-info/PKG-INFO +4 -5
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/Pytdbot.egg-info/SOURCES.txt +1 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/README.md +1 -1
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/__init__.py +11 -11
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/client.py +31 -33
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/methods/td_functions.py +398 -10
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/types/__init__.py +145 -51
- pytdbot-0.9.0.dev6/pytdbot/types/td_types/bound_methods/__init__.py +4 -0
- pytdbot-0.9.0.dev6/pytdbot/types/td_types/bound_methods/callback_query.py +110 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/types/td_types/bound_methods/message.py +48 -1
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/types/td_types/types.py +3242 -837
- Pytdbot-0.9.0.dev4/pytdbot/types/td_types/bound_methods/__init__.py +0 -3
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/MANIFEST.in +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/Pytdbot.egg-info/dependency_links.txt +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/Pytdbot.egg-info/requires.txt +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/Pytdbot.egg-info/top_level.txt +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/exception/__init__.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/filters.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/handlers/__init__.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/handlers/decorators.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/handlers/handler.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/handlers/td_updates.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/methods/__init__.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/methods/methods.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/tdjson/__init__.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/tdjson/tdjson.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/types/plugins/__init__.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/types/td_types/__init__.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/types/td_types/bound_methods/chatActions.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/types/td_types/bound_methods/file.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/utils/__init__.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/utils/escape.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/utils/json_utils.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/utils/obj_encoder.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/utils/strings.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/utils/text_format.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/pytdbot/utils/webapps.py +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/requirements.txt +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/setup.cfg +0 -0
- {Pytdbot-0.9.0.dev4 → pytdbot-0.9.0.dev6}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: Pytdbot
|
|
3
|
-
Version: 0.9.0.
|
|
3
|
+
Version: 0.9.0.dev6
|
|
4
4
|
Summary: Easy-to-use asynchronous TDLib wrapper for Python.
|
|
5
5
|
Home-page: https://github.com/pytdbot/client
|
|
6
6
|
Author: AYMEN Mohammed
|
|
@@ -9,12 +9,13 @@ License: MIT
|
|
|
9
9
|
Project-URL: Source, https://github.com/pytdbot/client
|
|
10
10
|
Project-URL: Tracker, https://github.com/pytdbot/client/issues
|
|
11
11
|
Keywords: telegram,tdlib,bot,telegram-client,telegram-bot,bot-api,telegram-bot,tdlib-python,tdlib-bot
|
|
12
|
-
Platform: UNKNOWN
|
|
13
12
|
Requires-Python: >=3.9
|
|
14
13
|
Description-Content-Type: text/markdown
|
|
15
14
|
License-File: LICENSE
|
|
15
|
+
Requires-Dist: deepdiff
|
|
16
|
+
Requires-Dist: aio-pika
|
|
16
17
|
|
|
17
|
-
# Pytdbot [](https://pypi.org/project/Pytdbot) [](https://pypi.org/project/Pytdbot) [](https://github.com/tdlib/td) [](https://pepy.tech/project/pytdbot)
|
|
18
19
|
|
|
19
20
|
Pytdbot (Python TDLib) is an asynchronous [**TDLib**](https://github.com/tdlib/td) wrapper for **Telegram** users/bots written in **Python**.
|
|
20
21
|
|
|
@@ -102,5 +103,3 @@ For more examples, check the [examples](https://github.com/pytdbot/client/tree/m
|
|
|
102
103
|
# License
|
|
103
104
|
|
|
104
105
|
MIT [License](https://github.com/pytdbot/client/blob/main/LICENSE)
|
|
105
|
-
|
|
106
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: Pytdbot
|
|
3
|
-
Version: 0.9.0.
|
|
3
|
+
Version: 0.9.0.dev6
|
|
4
4
|
Summary: Easy-to-use asynchronous TDLib wrapper for Python.
|
|
5
5
|
Home-page: https://github.com/pytdbot/client
|
|
6
6
|
Author: AYMEN Mohammed
|
|
@@ -9,12 +9,13 @@ License: MIT
|
|
|
9
9
|
Project-URL: Source, https://github.com/pytdbot/client
|
|
10
10
|
Project-URL: Tracker, https://github.com/pytdbot/client/issues
|
|
11
11
|
Keywords: telegram,tdlib,bot,telegram-client,telegram-bot,bot-api,telegram-bot,tdlib-python,tdlib-bot
|
|
12
|
-
Platform: UNKNOWN
|
|
13
12
|
Requires-Python: >=3.9
|
|
14
13
|
Description-Content-Type: text/markdown
|
|
15
14
|
License-File: LICENSE
|
|
15
|
+
Requires-Dist: deepdiff
|
|
16
|
+
Requires-Dist: aio-pika
|
|
16
17
|
|
|
17
|
-
# Pytdbot [](https://pypi.org/project/Pytdbot) [](https://pypi.org/project/Pytdbot) [](https://github.com/tdlib/td) [](https://pepy.tech/project/pytdbot)
|
|
18
19
|
|
|
19
20
|
Pytdbot (Python TDLib) is an asynchronous [**TDLib**](https://github.com/tdlib/td) wrapper for **Telegram** users/bots written in **Python**.
|
|
20
21
|
|
|
@@ -102,5 +103,3 @@ For more examples, check the [examples](https://github.com/pytdbot/client/tree/m
|
|
|
102
103
|
# License
|
|
103
104
|
|
|
104
105
|
MIT [License](https://github.com/pytdbot/client/blob/main/LICENSE)
|
|
105
|
-
|
|
106
|
-
|
|
@@ -26,6 +26,7 @@ pytdbot/types/plugins/__init__.py
|
|
|
26
26
|
pytdbot/types/td_types/__init__.py
|
|
27
27
|
pytdbot/types/td_types/types.py
|
|
28
28
|
pytdbot/types/td_types/bound_methods/__init__.py
|
|
29
|
+
pytdbot/types/td_types/bound_methods/callback_query.py
|
|
29
30
|
pytdbot/types/td_types/bound_methods/chatActions.py
|
|
30
31
|
pytdbot/types/td_types/bound_methods/file.py
|
|
31
32
|
pytdbot/types/td_types/bound_methods/message.py
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Pytdbot [](https://pypi.org/project/Pytdbot) [](https://pypi.org/project/Pytdbot) [](https://github.com/tdlib/td) [](https://pepy.tech/project/pytdbot)
|
|
2
2
|
|
|
3
3
|
Pytdbot (Python TDLib) is an asynchronous [**TDLib**](https://github.com/tdlib/td) wrapper for **Telegram** users/bots written in **Python**.
|
|
4
4
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
from . import types, utils, filters, exception
|
|
2
|
-
from .tdjson import TdJson
|
|
3
|
-
from .client import Client
|
|
4
|
-
|
|
5
|
-
__all__ = ["types", "utils", "filters", "exception", "TdJson", "Client"]
|
|
6
|
-
|
|
7
|
-
__version__ = "0.9.
|
|
8
|
-
__copyright__ = "Copyright (c) 2022-
|
|
9
|
-
__license__ = "MIT License"
|
|
10
|
-
|
|
11
|
-
VERSION = __version__
|
|
1
|
+
from . import types, utils, filters, exception
|
|
2
|
+
from .tdjson import TdJson
|
|
3
|
+
from .client import Client
|
|
4
|
+
|
|
5
|
+
__all__ = ["types", "utils", "filters", "exception", "TdJson", "Client"]
|
|
6
|
+
|
|
7
|
+
__version__ = "0.9.0dev6"
|
|
8
|
+
__copyright__ = "Copyright (c) 2022-2025 AYMEN Mohammed ~ https://github.com/AYMENJD"
|
|
9
|
+
__license__ = "MIT License"
|
|
10
|
+
|
|
11
|
+
VERSION = __version__
|
|
@@ -392,7 +392,7 @@ class Client(Decorators, Methods):
|
|
|
392
392
|
|
|
393
393
|
request["@extra"] = {"id": create_extra_id()}
|
|
394
394
|
|
|
395
|
-
|
|
395
|
+
future = self._create_request_future(request)
|
|
396
396
|
|
|
397
397
|
if (
|
|
398
398
|
self.logger.root.level >= DEBUG or self.logger.level >= DEBUG
|
|
@@ -400,7 +400,7 @@ class Client(Decorators, Methods):
|
|
|
400
400
|
self.logger.debug(f"Sending: {dumps(request, indent=4)}")
|
|
401
401
|
|
|
402
402
|
await self.__send(request)
|
|
403
|
-
await
|
|
403
|
+
result = await future
|
|
404
404
|
|
|
405
405
|
if isinstance(result, types.Error):
|
|
406
406
|
if result.code == 429:
|
|
@@ -413,10 +413,10 @@ class Client(Decorators, Methods):
|
|
|
413
413
|
|
|
414
414
|
await asyncio.sleep(retry_after)
|
|
415
415
|
|
|
416
|
-
|
|
416
|
+
future = self._create_request_future(request)
|
|
417
417
|
|
|
418
418
|
await self.__send(request)
|
|
419
|
-
await
|
|
419
|
+
result = await future
|
|
420
420
|
elif not self.use_message_database and (
|
|
421
421
|
result.code == 400
|
|
422
422
|
and result.message == "Chat not found"
|
|
@@ -431,24 +431,24 @@ class Client(Decorators, Methods):
|
|
|
431
431
|
if not isinstance(load_chat, types.Error):
|
|
432
432
|
self.logger.debug(f"Chat {chat_id} is loaded")
|
|
433
433
|
|
|
434
|
-
|
|
435
|
-
"message_id",
|
|
434
|
+
reply_to_message_id = (request.get("reply_to") or {}).get(
|
|
435
|
+
"message_id", 0
|
|
436
436
|
)
|
|
437
437
|
|
|
438
|
-
#
|
|
439
|
-
#
|
|
440
|
-
if
|
|
441
|
-
await self.getMessage(chat_id,
|
|
438
|
+
# if the request is a reply to another message
|
|
439
|
+
# load the replied message to avoid "Message not found"
|
|
440
|
+
if reply_to_message_id > 0:
|
|
441
|
+
await self.getMessage(chat_id, reply_to_message_id)
|
|
442
442
|
|
|
443
443
|
# repeat the first request
|
|
444
|
-
|
|
444
|
+
future = self._create_request_future(request)
|
|
445
445
|
|
|
446
446
|
await self.__send(request)
|
|
447
|
-
await
|
|
447
|
+
result = await future
|
|
448
448
|
else:
|
|
449
449
|
self.logger.error(f"Couldn't load chat {chat_id}")
|
|
450
450
|
|
|
451
|
-
return
|
|
451
|
+
return result
|
|
452
452
|
|
|
453
453
|
async def call_method(self, method: str, **kwargs) -> types.TlObject:
|
|
454
454
|
r"""Call a method. with keyword arguments (``kwargs``) support
|
|
@@ -741,67 +741,65 @@ class Client(Decorators, Methods):
|
|
|
741
741
|
return update
|
|
742
742
|
|
|
743
743
|
async def __run_initializers(self, update):
|
|
744
|
+
inner_object = self.get_inner_object(update)
|
|
745
|
+
|
|
744
746
|
for initializer in self._handlers["initializer"]:
|
|
745
747
|
try:
|
|
746
|
-
|
|
747
|
-
self.get_inner_object(update)
|
|
748
|
-
if initializer.inner_object
|
|
749
|
-
else update
|
|
750
|
-
)
|
|
748
|
+
handler_value = inner_object if initializer.inner_object else update
|
|
751
749
|
|
|
752
750
|
if initializer.filter is not None:
|
|
753
751
|
filter_function = initializer.filter.func
|
|
754
752
|
|
|
755
753
|
if self.is_coro_filter(filter_function):
|
|
756
|
-
if not await filter_function(self,
|
|
754
|
+
if not await filter_function(self, handler_value):
|
|
757
755
|
continue
|
|
758
|
-
elif not filter_function(self,
|
|
756
|
+
elif not filter_function(self, handler_value):
|
|
759
757
|
continue
|
|
760
758
|
|
|
761
|
-
await initializer(self,
|
|
759
|
+
await initializer(self, handler_value)
|
|
762
760
|
except StopHandlers as e:
|
|
763
761
|
raise e
|
|
764
762
|
except Exception:
|
|
765
763
|
self.logger.exception(f"Initializer {initializer} failed")
|
|
766
764
|
|
|
767
765
|
async def __run_handlers(self, update):
|
|
766
|
+
inner_object = self.get_inner_object(update)
|
|
767
|
+
|
|
768
768
|
for handler in self._handlers[update.getType()]:
|
|
769
769
|
try:
|
|
770
|
-
|
|
771
|
-
self.get_inner_object(update) if handler.inner_object else update
|
|
772
|
-
)
|
|
770
|
+
handler_value = inner_object if handler.inner_object else update
|
|
773
771
|
|
|
774
772
|
if handler.filter is not None:
|
|
775
773
|
filter_function = handler.filter.func
|
|
776
774
|
if self.is_coro_filter(filter_function):
|
|
777
|
-
if not await filter_function(self,
|
|
775
|
+
if not await filter_function(self, handler_value):
|
|
778
776
|
continue
|
|
779
|
-
elif not filter_function(self,
|
|
777
|
+
elif not filter_function(self, handler_value):
|
|
780
778
|
continue
|
|
781
779
|
|
|
782
|
-
await handler(self,
|
|
780
|
+
await handler(self, handler_value)
|
|
783
781
|
except StopHandlers as e:
|
|
784
782
|
raise e
|
|
785
783
|
except Exception:
|
|
786
784
|
self.logger.exception(f"Exception in {handler}")
|
|
787
785
|
|
|
788
786
|
async def __run_finalizers(self, update):
|
|
787
|
+
inner_object = self.get_inner_object(update)
|
|
788
|
+
|
|
789
789
|
for finalizer in self._handlers["finalizer"]:
|
|
790
790
|
try:
|
|
791
|
-
|
|
792
|
-
self.get_inner_object(update) if finalizer.inner_object else update
|
|
793
|
-
)
|
|
791
|
+
handler_value = inner_object if finalizer.inner_object else update
|
|
794
792
|
|
|
795
793
|
if finalizer.filter is not None:
|
|
796
794
|
filter_function = finalizer.filter.func
|
|
797
795
|
|
|
798
796
|
if self.is_coro_filter(filter_function):
|
|
799
|
-
if not await filter_function(self,
|
|
797
|
+
if not await filter_function(self, handler_value):
|
|
800
798
|
continue
|
|
801
|
-
elif not filter_function(self,
|
|
799
|
+
elif not filter_function(self, handler_value):
|
|
802
800
|
continue
|
|
803
801
|
|
|
804
|
-
await finalizer(self,
|
|
802
|
+
await finalizer(self, handler_value)
|
|
805
803
|
except StopHandlers as e:
|
|
806
804
|
raise e
|
|
807
805
|
except Exception:
|