Pytdbot 0.9.10.dev0__tar.gz → 0.10.0.dev0__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 (47) hide show
  1. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/PKG-INFO +7 -21
  2. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/Pytdbot.egg-info/PKG-INFO +7 -21
  3. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/Pytdbot.egg-info/SOURCES.txt +1 -2
  4. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/Pytdbot.egg-info/requires.txt +1 -1
  5. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/Pytdbot.egg-info/top_level.txt +1 -0
  6. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/README.md +2 -2
  7. pytdbot-0.10.0.dev0/pyproject.toml +39 -0
  8. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/__init__.py +4 -4
  9. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/client.py +39 -35
  10. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/client_manager.py +8 -6
  11. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/filters.py +1 -1
  12. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/handlers/decorators.py +19 -17
  13. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/handlers/handler.py +6 -4
  14. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/handlers/td_updates.py +766 -704
  15. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/methods/methods.py +102 -106
  16. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/methods/td_functions.py +5077 -2796
  17. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/tdjson/tdjson.py +2 -3
  18. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/types/__init__.py +173 -39
  19. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/types/bound_methods/callback_query.py +27 -22
  20. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/types/bound_methods/chatActions.py +4 -2
  21. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/types/bound_methods/file.py +5 -5
  22. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/types/bound_methods/message.py +129 -136
  23. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/types/bound_methods/sender_id.py +1 -2
  24. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/types/td_types.py +18900 -15441
  25. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/types/tdserver/schedule.py +4 -3
  26. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/types/tdserver/stats.py +3 -2
  27. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/utils/__init__.py +32 -29
  28. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/utils/json_utils.py +2 -4
  29. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/utils/webapps.py +1 -2
  30. pytdbot-0.9.10.dev0/requirements.txt +0 -2
  31. pytdbot-0.9.10.dev0/setup.py +0 -49
  32. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/LICENSE +0 -0
  33. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/MANIFEST.in +0 -0
  34. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/Pytdbot.egg-info/dependency_links.txt +0 -0
  35. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/exception/__init__.py +0 -0
  36. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/handlers/__init__.py +0 -0
  37. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/methods/__init__.py +0 -0
  38. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/tdjson/__init__.py +0 -0
  39. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/types/bound_methods/__init__.py +0 -0
  40. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/types/plugins/__init__.py +0 -0
  41. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/types/tdserver/__init__.py +0 -0
  42. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/utils/asyncio_utils.py +0 -0
  43. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/utils/escape.py +0 -0
  44. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/utils/obj_encoder.py +0 -0
  45. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/utils/strings.py +0 -0
  46. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/pytdbot/utils/text_format.py +0 -0
  47. {pytdbot-0.9.10.dev0 → pytdbot-0.10.0.dev0}/setup.cfg +0 -0
@@ -1,36 +1,22 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Pytdbot
3
- Version: 0.9.10.dev0
3
+ Version: 0.10.0.dev0
4
4
  Summary: Easy-to-use asynchronous TDLib wrapper for Python.
5
- Home-page: https://github.com/pytdbot/client
6
- Author: AYMEN Mohammed
7
- Author-email: let.me.code.safe@gmail.com
5
+ Author-email: AYMEN A <let.me.code.safe@gmail.com>
8
6
  License: MIT
9
7
  Project-URL: Source, https://github.com/pytdbot/client
10
8
  Project-URL: Tracker, https://github.com/pytdbot/client/issues
11
- Keywords: telegram,tdlib,bot,telegram-client,telegram-bot,bot-api,telegram-bot,tdlib-python,tdlib-bot
12
- Requires-Python: >=3.9
9
+ Keywords: telegram,tdlib,bot,telegram-client,telegram-bot,bot-api,tdlib-python,tdlib-bot
10
+ Requires-Python: >=3.10
13
11
  Description-Content-Type: text/markdown
14
12
  License-File: LICENSE
15
13
  Requires-Dist: deepdiff
16
- Requires-Dist: aio-pika
14
+ Requires-Dist: aio_pika
17
15
  Provides-Extra: tdjson
18
16
  Requires-Dist: tdjson; extra == "tdjson"
19
- Dynamic: author
20
- Dynamic: author-email
21
- Dynamic: description
22
- Dynamic: description-content-type
23
- Dynamic: home-page
24
- Dynamic: keywords
25
- Dynamic: license
26
17
  Dynamic: license-file
27
- Dynamic: project-url
28
- Dynamic: provides-extra
29
- Dynamic: requires-dist
30
- Dynamic: requires-python
31
- Dynamic: summary
32
18
 
33
- # Pytdbot [![Version](https://img.shields.io/pypi/v/Pytdbot?style=flat&logo=pypi)](https://pypi.org/project/Pytdbot) [![TDLib version](https://img.shields.io/badge/TDLib-v1.8.60-blue?logo=telegram)](https://github.com/tdlib/td) [![Downloads](https://static.pepy.tech/personalized-badge/pytdbot?period=month&units=none&left_color=grey&right_color=brightgreen&left_text=Downloads)](https://pepy.tech/project/pytdbot) [![Telegram Chat](https://img.shields.io/badge/Pytdbot%20chat-blue?logo=telegram&label=Telegram)](https://t.me/pytdbotchat)
19
+ # Pytdbot [![Version](https://img.shields.io/pypi/v/Pytdbot?style=flat&logo=pypi)](https://pypi.org/project/Pytdbot) [![TDLib version](https://img.shields.io/badge/TDLib-v1.8.62-blue?logo=telegram)](https://github.com/tdlib/td) [![Downloads](https://static.pepy.tech/personalized-badge/pytdbot?period=month&units=none&left_color=grey&right_color=brightgreen&left_text=Downloads)](https://pepy.tech/project/pytdbot) [![Telegram Chat](https://img.shields.io/badge/Pytdbot%20chat-blue?logo=telegram&label=Telegram)](https://t.me/pytdbotchat)
34
20
 
35
21
  <a href="https://cupofton.pages.dev/donate?a=UQCeySURtYxvqF2jNXlsFrXuTEqPjJhGx8uoev6tUbD_HELL&n=AYMEN&t=5&c=You+deserve+a+Cup+of+TON+for+Pytdbot%2521" target="_blank" rel="noopener">
36
22
  <img src="https://cupofton.pages.dev/assets/badge-1.svg" alt="Buy me a Cup of TON" style="width: 600px; height: auto;">
@@ -53,7 +39,7 @@ Pytdbot is an asynchronous [**TDLib**](https://github.com/tdlib/td) wrapper for
53
39
 
54
40
  ### Requirements
55
41
 
56
- - Python 3.9+
42
+ - Python 3.10+
57
43
  - Telegram [API key](https://my.telegram.org/apps)
58
44
  - [tdjson](https://github.com/AYMENJD/tdjson) or [TDLib](https://github.com/tdlib/td#building)
59
45
  - [deepdiff](https://github.com/seperman/deepdiff)
@@ -1,36 +1,22 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Pytdbot
3
- Version: 0.9.10.dev0
3
+ Version: 0.10.0.dev0
4
4
  Summary: Easy-to-use asynchronous TDLib wrapper for Python.
5
- Home-page: https://github.com/pytdbot/client
6
- Author: AYMEN Mohammed
7
- Author-email: let.me.code.safe@gmail.com
5
+ Author-email: AYMEN A <let.me.code.safe@gmail.com>
8
6
  License: MIT
9
7
  Project-URL: Source, https://github.com/pytdbot/client
10
8
  Project-URL: Tracker, https://github.com/pytdbot/client/issues
11
- Keywords: telegram,tdlib,bot,telegram-client,telegram-bot,bot-api,telegram-bot,tdlib-python,tdlib-bot
12
- Requires-Python: >=3.9
9
+ Keywords: telegram,tdlib,bot,telegram-client,telegram-bot,bot-api,tdlib-python,tdlib-bot
10
+ Requires-Python: >=3.10
13
11
  Description-Content-Type: text/markdown
14
12
  License-File: LICENSE
15
13
  Requires-Dist: deepdiff
16
- Requires-Dist: aio-pika
14
+ Requires-Dist: aio_pika
17
15
  Provides-Extra: tdjson
18
16
  Requires-Dist: tdjson; extra == "tdjson"
19
- Dynamic: author
20
- Dynamic: author-email
21
- Dynamic: description
22
- Dynamic: description-content-type
23
- Dynamic: home-page
24
- Dynamic: keywords
25
- Dynamic: license
26
17
  Dynamic: license-file
27
- Dynamic: project-url
28
- Dynamic: provides-extra
29
- Dynamic: requires-dist
30
- Dynamic: requires-python
31
- Dynamic: summary
32
18
 
33
- # Pytdbot [![Version](https://img.shields.io/pypi/v/Pytdbot?style=flat&logo=pypi)](https://pypi.org/project/Pytdbot) [![TDLib version](https://img.shields.io/badge/TDLib-v1.8.60-blue?logo=telegram)](https://github.com/tdlib/td) [![Downloads](https://static.pepy.tech/personalized-badge/pytdbot?period=month&units=none&left_color=grey&right_color=brightgreen&left_text=Downloads)](https://pepy.tech/project/pytdbot) [![Telegram Chat](https://img.shields.io/badge/Pytdbot%20chat-blue?logo=telegram&label=Telegram)](https://t.me/pytdbotchat)
19
+ # Pytdbot [![Version](https://img.shields.io/pypi/v/Pytdbot?style=flat&logo=pypi)](https://pypi.org/project/Pytdbot) [![TDLib version](https://img.shields.io/badge/TDLib-v1.8.62-blue?logo=telegram)](https://github.com/tdlib/td) [![Downloads](https://static.pepy.tech/personalized-badge/pytdbot?period=month&units=none&left_color=grey&right_color=brightgreen&left_text=Downloads)](https://pepy.tech/project/pytdbot) [![Telegram Chat](https://img.shields.io/badge/Pytdbot%20chat-blue?logo=telegram&label=Telegram)](https://t.me/pytdbotchat)
34
20
 
35
21
  <a href="https://cupofton.pages.dev/donate?a=UQCeySURtYxvqF2jNXlsFrXuTEqPjJhGx8uoev6tUbD_HELL&n=AYMEN&t=5&c=You+deserve+a+Cup+of+TON+for+Pytdbot%2521" target="_blank" rel="noopener">
36
22
  <img src="https://cupofton.pages.dev/assets/badge-1.svg" alt="Buy me a Cup of TON" style="width: 600px; height: auto;">
@@ -53,7 +39,7 @@ Pytdbot is an asynchronous [**TDLib**](https://github.com/tdlib/td) wrapper for
53
39
 
54
40
  ### Requirements
55
41
 
56
- - Python 3.9+
42
+ - Python 3.10+
57
43
  - Telegram [API key](https://my.telegram.org/apps)
58
44
  - [tdjson](https://github.com/AYMENJD/tdjson) or [TDLib](https://github.com/tdlib/td#building)
59
45
  - [deepdiff](https://github.com/seperman/deepdiff)
@@ -1,8 +1,7 @@
1
1
  LICENSE
2
2
  MANIFEST.in
3
3
  README.md
4
- requirements.txt
5
- setup.py
4
+ pyproject.toml
6
5
  Pytdbot.egg-info/PKG-INFO
7
6
  Pytdbot.egg-info/SOURCES.txt
8
7
  Pytdbot.egg-info/dependency_links.txt
@@ -1,5 +1,5 @@
1
1
  deepdiff
2
- aio-pika
2
+ aio_pika
3
3
 
4
4
  [tdjson]
5
5
  tdjson
@@ -1,4 +1,4 @@
1
- # Pytdbot [![Version](https://img.shields.io/pypi/v/Pytdbot?style=flat&logo=pypi)](https://pypi.org/project/Pytdbot) [![TDLib version](https://img.shields.io/badge/TDLib-v1.8.60-blue?logo=telegram)](https://github.com/tdlib/td) [![Downloads](https://static.pepy.tech/personalized-badge/pytdbot?period=month&units=none&left_color=grey&right_color=brightgreen&left_text=Downloads)](https://pepy.tech/project/pytdbot) [![Telegram Chat](https://img.shields.io/badge/Pytdbot%20chat-blue?logo=telegram&label=Telegram)](https://t.me/pytdbotchat)
1
+ # Pytdbot [![Version](https://img.shields.io/pypi/v/Pytdbot?style=flat&logo=pypi)](https://pypi.org/project/Pytdbot) [![TDLib version](https://img.shields.io/badge/TDLib-v1.8.62-blue?logo=telegram)](https://github.com/tdlib/td) [![Downloads](https://static.pepy.tech/personalized-badge/pytdbot?period=month&units=none&left_color=grey&right_color=brightgreen&left_text=Downloads)](https://pepy.tech/project/pytdbot) [![Telegram Chat](https://img.shields.io/badge/Pytdbot%20chat-blue?logo=telegram&label=Telegram)](https://t.me/pytdbotchat)
2
2
 
3
3
  <a href="https://cupofton.pages.dev/donate?a=UQCeySURtYxvqF2jNXlsFrXuTEqPjJhGx8uoev6tUbD_HELL&n=AYMEN&t=5&c=You+deserve+a+Cup+of+TON+for+Pytdbot%2521" target="_blank" rel="noopener">
4
4
  <img src="https://cupofton.pages.dev/assets/badge-1.svg" alt="Buy me a Cup of TON" style="width: 600px; height: auto;">
@@ -21,7 +21,7 @@ Pytdbot is an asynchronous [**TDLib**](https://github.com/tdlib/td) wrapper for
21
21
 
22
22
  ### Requirements
23
23
 
24
- - Python 3.9+
24
+ - Python 3.10+
25
25
  - Telegram [API key](https://my.telegram.org/apps)
26
26
  - [tdjson](https://github.com/AYMENJD/tdjson) or [TDLib](https://github.com/tdlib/td#building)
27
27
  - [deepdiff](https://github.com/seperman/deepdiff)
@@ -0,0 +1,39 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "Pytdbot"
7
+ dynamic = ["version"]
8
+ description = "Easy-to-use asynchronous TDLib wrapper for Python."
9
+ readme = { file = "README.md", content-type = "text/markdown" }
10
+ requires-python = ">=3.10"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "AYMEN A", email = "let.me.code.safe@gmail.com" }]
13
+ dependencies = ["deepdiff", "aio_pika"]
14
+ keywords = [
15
+ "telegram",
16
+ "tdlib",
17
+ "bot",
18
+ "telegram-client",
19
+ "telegram-bot",
20
+ "bot-api",
21
+ "tdlib-python",
22
+ "tdlib-bot",
23
+ ]
24
+
25
+ [project.urls]
26
+ Source = "https://github.com/pytdbot/client"
27
+ Tracker = "https://github.com/pytdbot/client/issues"
28
+
29
+ [project.optional-dependencies]
30
+ tdjson = ["tdjson"]
31
+
32
+ [tool.setuptools.packages.find]
33
+ exclude = ["examples"]
34
+
35
+ [tool.setuptools.package-data]
36
+ pytdbot = ["td_api.*"]
37
+
38
+ [tool.setuptools.dynamic]
39
+ version = { attr = "pytdbot.__version__" }
@@ -1,7 +1,7 @@
1
- from . import types, utils, filters, exception
2
- from .tdjson import TdJson
3
- from .client_manager import ClientManager
1
+ from . import exception, filters, types, utils
4
2
  from .client import Client
3
+ from .client_manager import ClientManager
4
+ from .tdjson import TdJson
5
5
 
6
6
  __all__ = [
7
7
  "types",
@@ -13,7 +13,7 @@ __all__ = [
13
13
  "Client",
14
14
  ]
15
15
 
16
- __version__ = "0.9.10dev0"
16
+ __version__ = "0.10.0.dev0"
17
17
  __copyright__ = "Copyright (c) 2022-2026 Pytdbot, AYMENJD"
18
18
  __license__ = "MIT License"
19
19
 
@@ -1,13 +1,16 @@
1
+ from __future__ import annotations
2
+
1
3
  import asyncio
2
4
  import signal
3
- from importlib import import_module, reload as reload_module
5
+ from collections.abc import Callable
6
+ from importlib import import_module
7
+ from importlib import reload as reload_module
4
8
  from json import dumps
5
9
  from logging import DEBUG, getLogger
6
10
  from os.path import join as join_path
7
11
  from pathlib import Path
8
12
  from platform import python_implementation, python_version
9
13
  from threading import current_thread, main_thread
10
- from typing import Callable, Dict, Type, Union
11
14
 
12
15
  import aio_pika
13
16
  from deepdiff import DeepDiff
@@ -112,31 +115,31 @@ class Client(Decorators, Methods):
112
115
 
113
116
  def __init__(
114
117
  self,
115
- token: str = None,
116
- api_id: int = None,
117
- api_hash: str = None,
118
- rabbitmq_url: str = None,
119
- instance_id: str = None,
120
- lib_path: str = None,
121
- plugins: Plugins = None,
122
- default_parse_mode: str = None,
118
+ token: str | None = None,
119
+ api_id: int | None = None,
120
+ api_hash: str | None = None,
121
+ rabbitmq_url: str | None = None,
122
+ instance_id: str | None = None,
123
+ lib_path: str | None = None,
124
+ plugins: Plugins | None = None,
125
+ default_parse_mode: str | None = None,
123
126
  system_language_code: str = "en",
124
- device_model: str = None,
125
- files_directory: str = None,
126
- database_encryption_key: Union[str, bytes] = None,
127
+ device_model: str | None = None,
128
+ files_directory: str | None = None,
129
+ database_encryption_key: str | bytes | None = None,
127
130
  use_test_dc: bool = False,
128
131
  use_file_database: bool = True,
129
132
  use_chat_info_database: bool = True,
130
133
  use_message_database: bool = True,
131
- loop: asyncio.AbstractEventLoop = None,
132
- options: dict = None,
134
+ loop: asyncio.AbstractEventLoop | None = None,
135
+ options: dict | None = None,
133
136
  workers: int = 5,
134
137
  queue_size: int = 1000,
135
- default_handlers_timeout: float = None,
138
+ default_handlers_timeout: float | None = None,
136
139
  no_updates: bool = False,
137
140
  load_messages_before_reply: bool = False,
138
141
  td_verbosity: int = 2,
139
- td_log: LogStream = None,
142
+ td_log: LogStream | None = None,
140
143
  user_bot: bool = False,
141
144
  server_ack: bool = True,
142
145
  ) -> None:
@@ -201,11 +204,11 @@ class Client(Decorators, Methods):
201
204
 
202
205
  self._handlers = {"initializer": [], "finalizer": []}
203
206
  self._current_handlers = {}
204
- self._results: Dict[str, asyncio.Future] = {}
207
+ self._results: dict[str, asyncio.Future] = {}
205
208
  self._workers_tasks = None
206
209
  self.__wait_login: asyncio.Event = None
207
210
  self.__rabbitmq_iterator_task = None
208
- self.__authorization_state = None
211
+ self.__authorization_state: str = None
209
212
  self.__cache = {"is_coro_filter": {}}
210
213
  self.__local_handlers = {
211
214
  "updateAuthorizationState": self.__handle_authorization_state,
@@ -250,7 +253,7 @@ class Client(Decorators, Methods):
250
253
 
251
254
  async def getServerStats(
252
255
  self,
253
- ) -> Union["pytdbot.types.ServerStats", "pytdbot.types.Error"]:
256
+ ) -> pytdbot.types.ServerStats | pytdbot.types.Error:
254
257
  """Returns TDLib Server stats"""
255
258
 
256
259
  self._check_rabbitmq()
@@ -259,7 +262,7 @@ class Client(Decorators, Methods):
259
262
 
260
263
  async def scheduleEvent(
261
264
  self, name: str, payload: str, send_at: int
262
- ) -> Union["pytdbot.types.ScheduledEvent", "pytdbot.types.Error"]:
265
+ ) -> pytdbot.types.ScheduledEvent | pytdbot.types.Error:
263
266
  """Schedule an event
264
267
 
265
268
  Parameters:
@@ -293,7 +296,7 @@ class Client(Decorators, Methods):
293
296
 
294
297
  async def cancelScheduledEvent(
295
298
  self, event_id: str
296
- ) -> Union["pytdbot.types.Ok", "pytdbot.types.Error"]:
299
+ ) -> pytdbot.types.Ok | pytdbot.types.Error:
297
300
  """Cancel a scheduled event
298
301
 
299
302
  Parameters:
@@ -356,7 +359,7 @@ class Client(Decorators, Methods):
356
359
  self.logger.info("Started with unlimited updates processes")
357
360
 
358
361
  self.loop.create_task(
359
- self.getOption("version")
362
+ self.getOption(name="version")
360
363
  ) # Ping TDLib to start processing updates
361
364
 
362
365
  if wait_login and self.__wait_login:
@@ -364,12 +367,12 @@ class Client(Decorators, Methods):
364
367
 
365
368
  def add_handler(
366
369
  self,
367
- update_type: Union[Type["pytdbot.types.Update"], str],
370
+ update_type: type[pytdbot.types.Update] | str,
368
371
  func: Callable,
369
- filters: pytdbot.filters.Filter = None,
370
- position: int = None,
372
+ filters: pytdbot.filters.Filter | None = None,
373
+ position: int | None = None,
371
374
  inner_object: bool = False,
372
- timeout: float = None,
375
+ timeout: float | None = None,
373
376
  is_from_plugin: bool = False,
374
377
  ) -> None:
375
378
  r"""Add an update handler
@@ -560,7 +563,7 @@ class Client(Decorators, Methods):
560
563
 
561
564
  self.logger.debug(f"Attempt to load chat {chat_id}")
562
565
 
563
- chat = await self.getChat(chat_id)
566
+ chat = await self.getChat(chat_id=chat_id)
564
567
  if not isinstance(chat, types.Error):
565
568
  self.logger.debug(f"Chat {chat_id} is loaded")
566
569
 
@@ -571,7 +574,9 @@ class Client(Decorators, Methods):
571
574
  # if the request is a reply to another message
572
575
  # load the replied message to avoid "Message not found"
573
576
  if reply_to_message_id > 0:
574
- await self.getMessage(chat_id, reply_to_message_id)
577
+ await self.getMessage(
578
+ chat_id=chat_id, message_id=reply_to_message_id
579
+ )
575
580
 
576
581
  continue
577
582
  else:
@@ -678,7 +683,7 @@ class Client(Decorators, Methods):
678
683
  return True
679
684
 
680
685
  def _create_request_future(
681
- self, request: dict, result_id: str = None, handle_result: bool = True
686
+ self, request: dict, result_id: str | None = None, handle_result: bool = True
682
687
  ) -> asyncio.Future:
683
688
  result = asyncio.Future()
684
689
 
@@ -742,18 +747,17 @@ class Client(Decorators, Methods):
742
747
  plugin_paths = [
743
748
  path
744
749
  for path in plugin_paths
745
- if ".".join(path.parent.parts + (path.stem,)) in self.plugins.include
750
+ if ".".join((*path.parent.parts, path.stem)) in self.plugins.include
746
751
  ]
747
752
  elif self.plugins.exclude:
748
753
  plugin_paths = [
749
754
  path
750
755
  for path in plugin_paths
751
- if ".".join(path.parent.parts + (path.stem,))
752
- not in self.plugins.exclude
756
+ if ".".join((*path.parent.parts, path.stem)) not in self.plugins.exclude
753
757
  ]
754
758
 
755
759
  for path in plugin_paths:
756
- module_path = ".".join(path.parent.parts + (path.stem,))
760
+ module_path = ".".join((*path.parent.parts, path.stem))
757
761
 
758
762
  try:
759
763
  module = import_module(module_path)
@@ -1240,7 +1244,7 @@ class Client(Decorators, Methods):
1240
1244
  ):
1241
1245
  return
1242
1246
 
1243
- res = await self.checkAuthenticationBotToken(self.__token)
1247
+ res = await self.checkAuthenticationBotToken(token=self.__token)
1244
1248
 
1245
1249
  if isinstance(res, types.Error):
1246
1250
  await self.stop()
@@ -1,9 +1,11 @@
1
+ from __future__ import annotations
2
+
1
3
  import asyncio
2
4
  import logging
3
- from typing import List
4
5
  from concurrent.futures import ThreadPoolExecutor
5
6
 
6
7
  import pytdbot
8
+
7
9
  from .tdjson import TdJson
8
10
 
9
11
  logger = logging.getLogger(__name__)
@@ -14,10 +16,10 @@ class ClientManager:
14
16
 
15
17
  def __init__(
16
18
  self,
17
- clients: List["pytdbot.Client"] = None,
18
- lib_path: str = None,
19
+ clients: list[pytdbot.Client] | None = None,
20
+ lib_path: str | None = None,
19
21
  verbosity: int = 2,
20
- loop: asyncio.AbstractEventLoop = None,
22
+ loop: asyncio.AbstractEventLoop | None = None,
21
23
  ) -> None:
22
24
  """Manage multiple Pytdbot clients
23
25
 
@@ -30,7 +32,7 @@ class ClientManager:
30
32
  >>> await client_manager.start()
31
33
 
32
34
  Parameters:
33
- clients (``List[pytdbot.Client]``, *optional*):
35
+ clients (``list[pytdbot.Client]``, *optional*):
34
36
  List of clients to manage
35
37
 
36
38
  lib_path (``str``, *optional*):
@@ -80,7 +82,7 @@ class ClientManager:
80
82
  self.__pending_clients = None
81
83
 
82
84
  async def add_client(
83
- self, client: "pytdbot.Client", start_client: bool = False
85
+ self, client: pytdbot.Client, start_client: bool = False
84
86
  ) -> None:
85
87
  """Add a client to the manager
86
88
 
@@ -1,4 +1,4 @@
1
- from typing import Callable
1
+ from collections.abc import Callable
2
2
 
3
3
 
4
4
  class Filter:
@@ -1,6 +1,8 @@
1
+ from __future__ import annotations
2
+
1
3
  import logging
2
4
  from asyncio import iscoroutinefunction
3
- from typing import Callable
5
+ from collections.abc import Callable
4
6
 
5
7
  import pytdbot
6
8
 
@@ -14,11 +16,11 @@ class Decorators(Updates):
14
16
  """Decorators class."""
15
17
 
16
18
  def initializer(
17
- self: "pytdbot.Client" = None,
18
- filters: "pytdbot.filters.Filter" = None,
19
- position: int = None,
19
+ self: pytdbot.Client | None = None,
20
+ filters: pytdbot.filters.Filter | None = None,
21
+ position: int | None = None,
20
22
  inner_object: bool = False,
21
- timeout: float = None,
23
+ timeout: float | None = None,
22
24
  ) -> None:
23
25
  r"""A decorator to initialize an event object before running other handlers
24
26
 
@@ -78,11 +80,11 @@ class Decorators(Updates):
78
80
  return decorator
79
81
 
80
82
  def finalizer(
81
- self: "pytdbot.Client" = None,
82
- filters: "pytdbot.filters.Filter" = None,
83
- position: int = None,
83
+ self: pytdbot.Client | None = None,
84
+ filters: pytdbot.filters.Filter | None = None,
85
+ position: int | None = None,
84
86
  inner_object: bool = False,
85
- timeout: float = None,
87
+ timeout: float | None = None,
86
88
  ) -> None:
87
89
  r"""A decorator to finalize an event object after running all handlers
88
90
 
@@ -141,10 +143,10 @@ class Decorators(Updates):
141
143
  return decorator
142
144
 
143
145
  def on_message(
144
- self: "pytdbot.Client" = None,
145
- filters: "pytdbot.filters.Filter" = None,
146
- position: int = None,
147
- timeout: float = None,
146
+ self: pytdbot.Client | None = None,
147
+ filters: pytdbot.filters.Filter | None = None,
148
+ position: int | None = None,
149
+ timeout: float | None = None,
148
150
  ) -> None:
149
151
  r"""A decorator to handle ``updateNewMessage`` but with ``Message`` object.
150
152
 
@@ -201,10 +203,10 @@ class Decorators(Updates):
201
203
  return decorator
202
204
 
203
205
  def on_updateScheduledEvent(
204
- self: "pytdbot.Client" = None,
205
- filters: "pytdbot.filters.Filter" = None,
206
- position: int = None,
207
- timeout: float = None,
206
+ self: pytdbot.Client | None = None,
207
+ filters: pytdbot.filters.Filter | None = None,
208
+ position: int | None = None,
209
+ timeout: float | None = None,
208
210
  ) -> None:
209
211
  r"""A scheduled event has been triggered
210
212
 
@@ -1,4 +1,6 @@
1
- from typing import Callable
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Callable
2
4
 
3
5
  import pytdbot
4
6
 
@@ -12,10 +14,10 @@ class Handler:
12
14
  self,
13
15
  func: Callable,
14
16
  update_type: str,
15
- filter: Filter = None,
16
- position: int = None,
17
+ filter: Filter | None = None,
18
+ position: int | None = None,
17
19
  inner_object: bool = False,
18
- timeout: float = None,
20
+ timeout: float | None = None,
19
21
  is_from_plugin: bool = False,
20
22
  ) -> None:
21
23
  self.func = func