python-trueconf-bot 1.4.2__py3-none-any.whl → 1.4.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-trueconf-bot
3
- Version: 1.4.2
3
+ Version: 1.4.4
4
4
  Summary: Lightweight and powerful framework for the TrueConf Server Chatbot API
5
5
  Author-email: TrueConf LLC <info@trueconf.com>, Anton Baadzhi <baadzhianton@gmail.com>
6
6
  License-Expression: BSD-3-Clause-Clear
@@ -1,12 +1,12 @@
1
- python_trueconf_bot-1.4.2.dist-info/licenses/LICENSE,sha256=ftDuEzhr-yY_dsfpEQ2SKAP_dEAO-iPt96MBZq_K48o,1684
1
+ python_trueconf_bot-1.4.4.dist-info/licenses/LICENSE,sha256=ftDuEzhr-yY_dsfpEQ2SKAP_dEAO-iPt96MBZq_K48o,1684
2
2
  trueconf/__init__.py,sha256=Ka9VLhsdu-jZPndOQI1QpUXWldpu8xTC2BfgW51Px5U,481
3
- trueconf/_version.py,sha256=M92Udlou7mMHSdniRD3tru4stsJfoWt74G8vTdtA1kI,528
3
+ trueconf/_version.py,sha256=-zAFAqSkPjB6doBc21G2hOSOA2qdJ9_VlCJ_52YGUwc,528
4
4
  trueconf/exceptions.py,sha256=JlnOybf6XBVKGYPPN3STlruupdfQXrLdeZ_FbtUuMIs,7653
5
5
  trueconf/loggers.py,sha256=4dnq14qFo6fJ8SKZJCRZd0iJDYRqmcuX-ccv5FezxlQ,594
6
6
  trueconf/middleware.py,sha256=7yaS4UjZSrPb-lv5STmX8qGg1OamYbO5Nd5-IjPtbU4,2281
7
7
  trueconf/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  trueconf/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- trueconf/client/bot.py,sha256=hbb9glTZB6dn591PuY3tKUD_y7xsiY13ToXVtvOZDMA,79769
9
+ trueconf/client/bot.py,sha256=Zeq9PtJ0wkJTr9IeAqvTiPSXMWcf1j_cotlb2UuI8eA,81250
10
10
  trueconf/client/context_controller.py,sha256=_aItNHblyFbEqRsnbOM3ESgPqg2Pkji7xidTx0gb6zk,660
11
11
  trueconf/client/session.py,sha256=CvHjxQXbkUyyS1r7YCFVL8al37zOYtnhw5ACNLJJDOc,1751
12
12
  trueconf/dispatcher/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -78,7 +78,7 @@ trueconf/types/__init__.py,sha256=UBMPMau1Q2X1LcLQEPdfck0g7BEqTzYZXyHjDSlKta8,13
78
78
  trueconf/types/author_box.py,sha256=G_9AxpBGIbZyWEHCfKg_DkEbte9f9FWt-JQ05gro3bU,356
79
79
  trueconf/types/chat_participant.py,sha256=08sxIkiLK0IFZdHF_yApWHroNZTd-9tj9dVBOvZcI1E,328
80
80
  trueconf/types/input_file.py,sha256=mkr0dqnlTUOZjoFrOcX1_GsecqJ7trfQ1vSWquC4MYc,16806
81
- trueconf/types/last_message.py,sha256=87-mPWYEIi7RAYB1os7iqnPE7fvtQhZhnloMAkybLKU,1541
81
+ trueconf/types/last_message.py,sha256=h9Hw3xPpT0o1XnJ5TtitkmyfGWU4GWLLMHyDOnWuThQ,1646
82
82
  trueconf/types/message.py,sha256=eZu4sjDJNDfDxddtMefDka_b-rZ1usiMnCGVsfdOsJI,24871
83
83
  trueconf/types/parser.py,sha256=R_xV4EjJQMX15LQwbr6KrJd94qaZZ6h2Yt7VsbNJ9O8,4814
84
84
  trueconf/types/update.py,sha256=FS4d_NKjTHWtUiB6-ShPNkOll7hYFTl71gilLPRv45g,287
@@ -87,6 +87,7 @@ trueconf/types/content/attachment.py,sha256=xzCsZluq9vLCJy1gS5oP2TXM5QkXWPbaoUxg
87
87
  trueconf/types/content/base.py,sha256=xEOPSI90Ocz2C2_jBCYBquC3TpxmXe_EpEkoHXQaPsA,163
88
88
  trueconf/types/content/chat_created.py,sha256=p2VOmhoq4b5OlAmcqpM0wlYAk_QR4eTTVn1xGFlrNsI,277
89
89
  trueconf/types/content/document.py,sha256=tM_a1JlWnoYbhq_quZN7KycBM-UqwVmdaSHLYDh2bXs,2217
90
+ trueconf/types/content/edit_chat_avatar.py,sha256=eZ_C3dnm4f2joXGYgYB7XPNTj3b-kiRmtXRMgXFdjes,268
90
91
  trueconf/types/content/edit_chat_title.py,sha256=BGLwpA3B431VlGvYjFaOF49oB5Blp1Duhf-X3K-Ce00,214
91
92
  trueconf/types/content/forward_message.py,sha256=fNika_n21twiaAaT6TPVRhv-dIC6agug_O34WjfU3z8,906
92
93
  trueconf/types/content/location.py,sha256=0Lsm4il90tw8WxO1qjD3eRCE4aRrKgtrKDccwjUL0ps,250
@@ -155,7 +156,7 @@ trueconf/utils/split_text.py,sha256=0HTVv63kLo2gx1r-ImM47ejTR4X_uDkNr5QMxvWdTBo,
155
156
  trueconf/utils/formatting/__init__.py,sha256=Ii9rEamQdy8R0pVbmDf3xbdB4TtmgYyu2-RWRTCXukw,261
156
157
  trueconf/utils/formatting/decorations.py,sha256=iQzCdFBELn16llCgTTPk43K5-BzY6BGPc1M3V2Q0tPQ,2175
157
158
  trueconf/utils/formatting/text.py,sha256=pOW07TIV5vfvtWmGa2i2l_Q0UjFM6QMuowmsAjE9nyo,6867
158
- python_trueconf_bot-1.4.2.dist-info/METADATA,sha256=HYWuDK5ieWsw2uN7P9cHyV6ArUv1azJUCJyhk4mP7GE,5700
159
- python_trueconf_bot-1.4.2.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
160
- python_trueconf_bot-1.4.2.dist-info/top_level.txt,sha256=GjgYdn_osTUuU-H8f59VhIS7MY44xLV7-D7veywJaeY,9
161
- python_trueconf_bot-1.4.2.dist-info/RECORD,,
159
+ python_trueconf_bot-1.4.4.dist-info/METADATA,sha256=eKmCjXBvUPnHyU2B7psZevz4b_uSZU2FUchWqtNSxp8,5700
160
+ python_trueconf_bot-1.4.4.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
161
+ python_trueconf_bot-1.4.4.dist-info/top_level.txt,sha256=GjgYdn_osTUuU-H8f59VhIS7MY44xLV7-D7veywJaeY,9
162
+ python_trueconf_bot-1.4.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (83.0.0)
2
+ Generator: setuptools (84.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
trueconf/_version.py CHANGED
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '1.4.2'
22
- __version_tuple__ = version_tuple = (1, 4, 2)
21
+ __version__ = version = '1.4.4'
22
+ __version_tuple__ = version_tuple = (1, 4, 4)
23
23
 
24
- __commit_id__ = commit_id = 'g0603f16c3'
24
+ __commit_id__ = commit_id = 'gf20c401f4'
trueconf/client/bot.py CHANGED
@@ -245,17 +245,37 @@ class Bot:
245
245
  return None
246
246
 
247
247
  async def __get_server_version(self):
248
- port = "4307"
248
+ version = None
249
249
  async with httpx.AsyncClient(verify=self.ssl_context, timeout=self.timeout) as client:
250
+ loggers.chatbot.info("🔍 Checking server version...")
250
251
  try:
252
+ loggers.chatbot.info("📡 Attempt 1: querying version via /api/v4/server")
253
+ response = await client.get(f"{self._protocol}://{self.server}:{self.port}/api/v4/server")
254
+ response.raise_for_status()
255
+ version = response.json().get("product").get("version")
256
+ except httpx.HTTPStatusError as e:
257
+ loggers.chatbot.error(f"❌ Failed to get server version (HTTP {e.response.status_code}): {e}")
258
+ except httpx.TimeoutException as e:
259
+ loggers.chatbot.error(f"❌ Failed to get server version (timeout): {e}")
260
+
261
+ if version:
262
+ loggers.chatbot.info(f"📦 Server version resolved: {version}")
263
+ return version
264
+ loggers.chatbot.warning("⚠️ Server version not resolved via /api/v4/server, trying fallback...")
265
+
266
+
267
+ port = "4307"
268
+ try:
269
+ loggers.chatbot.info("📡 Attempt 2: querying TrueConf service via /api/v4/endpoints/connects")
251
270
  response = await client.get(
252
271
  f"{self._protocol}://{self.server}:{self.port}/api/v4/endpoints/connects"
253
272
  )
254
273
  port = response.json()["connects"][0].split(":")[-1]
255
274
  except (httpx.RequestError, KeyError, IndexError) as e:
256
- loggers.chatbot.debug(f"Failed to get endpoints/connects: {e}")
275
+ loggers.chatbot.error(f"❌ Failed to get endpoints/connects: {e}")
257
276
 
258
277
  try:
278
+ loggers.chatbot.info(f"🔍 Using port {port} to check /vsstatus")
259
279
  resp = await client.get(
260
280
  f"http://{self.server}:{port}/vsstatus",
261
281
  timeout=self.timeout,
@@ -265,8 +285,9 @@ class Bot:
265
285
  version = m.group(1)
266
286
  loggers.chatbot.info(f"📦 Server engine version resolved: {version}")
267
287
  return version
288
+ loggers.chatbot.error("❌ Could not parse server version from /vsstatus response")
268
289
  except httpx.RequestError as e:
269
- loggers.chatbot.debug(f"Failed to get server engine version: {e}")
290
+ loggers.chatbot.error(f"❌ Failed to get server engine version: {type(e).__name__}: {e}")
270
291
 
271
292
  return None
272
293
 
@@ -305,7 +326,13 @@ class Bot:
305
326
 
306
327
  async def check_version(self):
307
328
  current_version = await self.server_version
308
- _VersionChecker.check(current_version)
329
+ if current_version:
330
+ _VersionChecker.check(current_version)
331
+ else:
332
+ loggers.chatbot.warning(
333
+ "️‼️ Could not determine the server version. "
334
+ "The library may not work correctly on this server."
335
+ )
309
336
 
310
337
  @property
311
338
  def me_id(self) -> str:
@@ -686,7 +713,6 @@ class Bot:
686
713
  delay = min(delay * 2, self._ws_max_delay) + random.uniform(0, 1)
687
714
  msg = f"🔌 Connection issue: {reason}. Retrying in {delay:.1f}s..."
688
715
  loggers.chatbot.warning(msg)
689
- print(msg)
690
716
  continue
691
717
 
692
718
  except websockets.exceptions.InvalidURI as e:
@@ -714,7 +740,6 @@ class Bot:
714
740
  delay = 5
715
741
  msg = f"⚠️ Cant reach server: {e}. Attempt {retry_count}/{self._ws_max_retries}. Retrying in {delay}s..."
716
742
  loggers.chatbot.warning(msg)
717
- print(msg)
718
743
  continue
719
744
 
720
745
  finally:
@@ -0,0 +1,8 @@
1
+ from __future__ import annotations
2
+ from dataclasses import dataclass, field
3
+ from trueconf.types.content.base import AbstractEnvelopeContent
4
+
5
+
6
+ @dataclass
7
+ class EditChatAvatarContent(AbstractEnvelopeContent):
8
+ avatar_url: str = field(metadata={"alias": "avatarUrl"})
@@ -11,6 +11,7 @@ from trueconf.types.content.remove_participant import RemoveParticipant
11
11
  from trueconf.types.content.forward_message import ForwardMessage
12
12
  from trueconf.types.content.chat_created import ParticipantRoleContent
13
13
  from trueconf.types.content.edit_chat_title import EditChatTitleContent
14
+ from trueconf.types.content.edit_chat_avatar import EditChatAvatarContent
14
15
  from trueconf.types.content.location import Location
15
16
 
16
17
 
@@ -28,7 +29,8 @@ class LastMessage(DataClassDictMixin):
28
29
  RemoveParticipant,
29
30
  ForwardMessage,
30
31
  Location,
31
- EditChatTitleContent
32
+ EditChatTitleContent,
33
+ EditChatAvatarContent
32
34
  ]
33
35
 
34
36
  @property