Pytdbot 0.9.1__tar.gz → 0.9.2.dev1__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 (41) hide show
  1. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/PKG-INFO +3 -2
  2. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/Pytdbot.egg-info/PKG-INFO +3 -2
  3. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/__init__.py +1 -1
  4. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/client.py +22 -4
  5. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/types/td_types/bound_methods/message.py +2 -2
  6. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/LICENSE +0 -0
  7. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/MANIFEST.in +0 -0
  8. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/Pytdbot.egg-info/SOURCES.txt +0 -0
  9. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/Pytdbot.egg-info/dependency_links.txt +0 -0
  10. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/Pytdbot.egg-info/requires.txt +0 -0
  11. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/Pytdbot.egg-info/top_level.txt +0 -0
  12. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/README.md +0 -0
  13. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/exception/__init__.py +0 -0
  14. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/filters.py +0 -0
  15. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/handlers/__init__.py +0 -0
  16. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/handlers/decorators.py +0 -0
  17. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/handlers/handler.py +0 -0
  18. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/handlers/td_updates.py +0 -0
  19. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/methods/__init__.py +0 -0
  20. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/methods/methods.py +0 -0
  21. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/methods/td_functions.py +0 -0
  22. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/tdjson/__init__.py +0 -0
  23. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/tdjson/tdjson.py +0 -0
  24. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/types/__init__.py +0 -0
  25. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/types/plugins/__init__.py +0 -0
  26. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/types/td_types/__init__.py +0 -0
  27. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/types/td_types/bound_methods/__init__.py +0 -0
  28. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/types/td_types/bound_methods/callback_query.py +0 -0
  29. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/types/td_types/bound_methods/chatActions.py +0 -0
  30. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/types/td_types/bound_methods/file.py +0 -0
  31. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/types/td_types/types.py +0 -0
  32. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/utils/__init__.py +0 -0
  33. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/utils/escape.py +0 -0
  34. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/utils/json_utils.py +0 -0
  35. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/utils/obj_encoder.py +0 -0
  36. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/utils/strings.py +0 -0
  37. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/utils/text_format.py +0 -0
  38. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/pytdbot/utils/webapps.py +0 -0
  39. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/requirements.txt +0 -0
  40. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/setup.cfg +0 -0
  41. {pytdbot-0.9.1 → pytdbot-0.9.2.dev1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: Pytdbot
3
- Version: 0.9.1
3
+ Version: 0.9.2.dev1
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
@@ -23,6 +23,7 @@ Dynamic: description-content-type
23
23
  Dynamic: home-page
24
24
  Dynamic: keywords
25
25
  Dynamic: license
26
+ Dynamic: license-file
26
27
  Dynamic: project-url
27
28
  Dynamic: provides-extra
28
29
  Dynamic: requires-dist
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: Pytdbot
3
- Version: 0.9.1
3
+ Version: 0.9.2.dev1
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
@@ -23,6 +23,7 @@ Dynamic: description-content-type
23
23
  Dynamic: home-page
24
24
  Dynamic: keywords
25
25
  Dynamic: license
26
+ Dynamic: license-file
26
27
  Dynamic: project-url
27
28
  Dynamic: provides-extra
28
29
  Dynamic: requires-dist
@@ -4,7 +4,7 @@ from .client import Client
4
4
 
5
5
  __all__ = ["types", "utils", "filters", "exception", "TdJson", "Client"]
6
6
 
7
- __version__ = "0.9.1"
7
+ __version__ = "0.9.2.dev1"
8
8
  __copyright__ = "Copyright (c) 2022-2025 Pytdbot, AYMENJD"
9
9
  __license__ = "MIT License"
10
10
 
@@ -136,6 +136,7 @@ class Client(Decorators, Methods):
136
136
  no_updates: bool = False,
137
137
  td_verbosity: int = 2,
138
138
  td_log: LogStream = None,
139
+ user_bot: bool = False,
139
140
  ) -> None:
140
141
  self.__api_id = api_id
141
142
  self.__api_hash = api_hash
@@ -164,7 +165,12 @@ class Client(Decorators, Methods):
164
165
  self.workers = workers
165
166
  self.no_updates = no_updates
166
167
  self.queue = asyncio.Queue()
167
- self.my_id = get_bot_id_from_token(self.__token)
168
+ self.user_bot = user_bot
169
+ self.my_id = (
170
+ get_bot_id_from_token(self.__token)
171
+ if isinstance(self.__token, str)
172
+ else None
173
+ )
168
174
  self.logger = getLogger(f"{__name__}:{self.my_id or 0}")
169
175
  self.td_verbosity = td_verbosity
170
176
  self.connection_state: str = None
@@ -233,6 +239,9 @@ class Client(Decorators, Methods):
233
239
  Login after start. Default is ``True``
234
240
  """
235
241
 
242
+ if self.user_bot:
243
+ login = False
244
+
236
245
  if not self.is_running:
237
246
  self.logger.info("Starting pytdbot client...")
238
247
 
@@ -253,19 +262,25 @@ class Client(Decorators, Methods):
253
262
  else:
254
263
  self.__listen_loop_task = self.loop.create_task(self.__listen_loop())
255
264
 
265
+ self.loop.create_task(
266
+ self.getOption("version")
267
+ ) # Ping TDLib to start processing updates
268
+
256
269
  if login:
257
270
  await self.login()
258
271
 
259
272
  async def login(self) -> None:
260
273
  r"""Login to Telegram."""
261
274
 
262
- if not self.__token or (self.is_authenticated or self.is_rabbitmq):
275
+ if (
276
+ not self.__token
277
+ or self.user_bot
278
+ or (self.is_authenticated or self.is_rabbitmq)
279
+ ):
263
280
  return
264
281
 
265
282
  self.__login = True
266
283
 
267
- await self.getOption("version") # Ping TDLib to start authorization process
268
-
269
284
  while self.authorization_state != "authorizationStateReady":
270
285
  await asyncio.sleep(0.1)
271
286
  if self.authorization_state == "authorizationStateClosed":
@@ -566,6 +581,9 @@ class Client(Decorators, Methods):
566
581
  )
567
582
 
568
583
  def _check_init_args(self):
584
+ if self.user_bot:
585
+ return
586
+
569
587
  if not self.is_rabbitmq:
570
588
  if not isinstance(self.__api_id, int):
571
589
  raise TypeError("api_id must be an int")
@@ -64,7 +64,7 @@ class MessageBoundMethods:
64
64
 
65
65
  @property
66
66
  @lru_cache(1)
67
- def caption_entities(self) -> Union[str, None]:
67
+ def caption_entities(self) -> Union[List["pytdbot.types.TextEntity"], None]:
68
68
  r"""Caption entities of the received media"""
69
69
 
70
70
  if isinstance(
@@ -130,7 +130,7 @@ class MessageBoundMethods:
130
130
 
131
131
  return unique_file_id
132
132
 
133
- async def mention(self, parse_mode: str = "html") -> str:
133
+ async def mention(self, parse_mode: str = "html") -> Union[str, None]:
134
134
  r"""Get the text_mention of the message sender
135
135
 
136
136
  Parameters:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes