Send image and caption in two different messages
This allows conversations to autodownload the images.
This commit is contained in:
parent
aeb43dff55
commit
026f21f43e
10
session.py
10
session.py
|
@ -297,16 +297,18 @@ class Session(YowsupApp):
|
|||
participant = image.participant
|
||||
if image.caption is None:
|
||||
image.caption = ''
|
||||
message = image.url + ' ' + image.caption
|
||||
if participant is not None: # Group message
|
||||
partname = participant.split('@')[0]
|
||||
if image._from.split('@')[1] == 'broadcast': # Broadcast message
|
||||
self.sendMessageToXMPP(partname, self.broadcast_prefix, image.timestamp)
|
||||
self.sendMessageToXMPP(partname, message, image.timestamp)
|
||||
self.sendMessageToXMPP(partname, image.url, image.timestamp)
|
||||
self.sendMessageToXMPP(partname, image.caption, image.timestamp)
|
||||
else: # Group message
|
||||
self.sendGroupMessageToXMPP(buddy, partname, message, image.timestamp)
|
||||
self.sendGroupMessageToXMPP(buddy, partname, image.url, image.timestamp)
|
||||
self.sendGroupMessageToXMPP(buddy, partname, image.caption, image.timestamp)
|
||||
else:
|
||||
self.sendMessageToXMPP(buddy, message, image.timestamp)
|
||||
self.sendMessageToXMPP(buddy, image.url, image.timestamp)
|
||||
self.sendMessageToXMPP(buddy, image.caption, image.timestamp)
|
||||
self.sendReceipt(image._id, image._from, None, image.participant)
|
||||
|
||||
# Called by superclass
|
||||
|
|
Loading…
Reference in a new issue