Fixed an error in chat messages that was making the program unable to keep sending messages after an attachment file has been sent

This commit is contained in:
Manuel Cortez 2019-01-23 09:17:33 -06:00
parent 0c4ee6a033
commit ab0d34599f

View File

@ -935,7 +935,7 @@ class chatBuffer(baseBuffer):
return local_attachments return local_attachments
def _send_message(self, text, attachments=[]): def _send_message(self, text, attachments=[]):
if hasattr(self, "attachments_to_be_sent"): if hasattr(self, "attachments_to_be_sent") and type(self.attachments_to_be_sent) == list:
self.attachments_to_be_sent = self.upload_attachments(self.attachments_to_be_sent) self.attachments_to_be_sent = self.upload_attachments(self.attachments_to_be_sent)
try: try:
# Let's take care about the random_id attribute. # Let's take care about the random_id attribute.
@ -950,6 +950,9 @@ class chatBuffer(baseBuffer):
except ValueError as ex: except ValueError as ex:
if ex.code == 9: if ex.code == 9:
output.speak(_("You have been sending a message that is already sent. Try to update the buffer if you can't see the new message in the history.")) output.speak(_("You have been sending a message that is already sent. Try to update the buffer if you can't see the new message in the history."))
finally:
if hasattr(self, "attachments_to_be_sent"):
del self.attachments_to_be_sent
def __init__(self, unread=False, *args, **kwargs): def __init__(self, unread=False, *args, **kwargs):
super(chatBuffer, self).__init__(*args, **kwargs) super(chatBuffer, self).__init__(*args, **kwargs)