diff sat_frontends/jp/cmd_message.py @ 4023:78b5f356900c

component AP gateway: handle attachments
author Goffi <goffi@goffi.org>
date Thu, 23 Mar 2023 15:42:21 +0100
parents 900bf04d87c8
children 524856bd7b19
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_message.py	Thu Mar 23 15:39:48 2023 +0100
+++ b/sat_frontends/jp/cmd_message.py	Thu Mar 23 15:42:21 2023 +0100
@@ -145,7 +145,7 @@
             to_send.append(msg)
 
         if self.args.attachments:
-            attachments = extra[C.MESS_KEY_ATTACHMENTS] = []
+            attachments = extra[C.KEY_ATTACHMENTS] = []
             for attachment in self.args.attachments:
                 try:
                     file_path = str(Path(attachment).resolve(strict=True))
@@ -155,10 +155,10 @@
                     attachments.append({"path": file_path})
 
         for idx, msg in enumerate(to_send):
-            if idx > 0 and C.MESS_KEY_ATTACHMENTS in extra:
+            if idx > 0 and C.KEY_ATTACHMENTS in extra:
                 # if we send several messages, we only want to send attachments with the
                 # first one
-                del extra[C.MESS_KEY_ATTACHMENTS]
+                del extra[C.KEY_ATTACHMENTS]
             try:
                 await self.host.bridge.messageSend(
                     dest_jid,