Parcourir la source

send_document: drop the redundant failure log

The debug line added nothing that was not already there —
_send_local_attachment logs and notices failures itself, and the
SendResult carries the outcome to the caller. It also logged the chosen
display name rather than anything actionable. file_name stays in the
signature (base-class callers pass it by keyword); the docstring now
says what actually happens with it.
Paul Klumpp il y a 1 semaine
Parent
commit
4d0a385b49
1 fichiers modifiés avec 5 ajouts et 7 suppressions
  1. 5 7
      adapter.py

+ 5 - 7
adapter.py

@@ -2359,13 +2359,14 @@ class ChattoAdapter(BasePlatformAdapter):
     ) -> SendResult:
         """Send a local file as a native Chatto attachment.
 
-        ``file_name`` is the user-facing name the agent chose; Chatto takes the
-        filename from the upload session, so it only matters for the failure
-        notice.
+        ``file_name`` exists in the base-class signature and is accepted for
+        compatibility, but Chatto takes the recipient-visible filename from
+        the upload session (derived from the local path); failures are logged
+        and noticed by ``_send_local_attachment`` itself.
 
         BasePlatformAdapter override
         """
-        result = await self._send_local_attachment(
+        return await self._send_local_attachment(
             chat_id,
             file_path,
             caption,
@@ -2373,9 +2374,6 @@ class ChattoAdapter(BasePlatformAdapter):
             metadata,
             kind="file",
         )
-        if not result.success and file_name:
-            logger.debug("Chatto: document delivery failed for %s", file_name)
-        return result
 
     async def send_video(
         self,