[Messenger] Get rid of resource warnings
* Get rid of resource warnings
Currently, when uploading attachments, there are a ton of warnings printed about unclosed resources; this makes sure the files are opened and closed safely to remove these warnings.
* update for modern syntax
* change
@@ -315,10 +315,11 @@ class MessageSender():
}
}
}
+ with open(payload['filename'], 'rb') as f:
filedata = {
"filedata": (
payload['filename'],
- open(payload['filename'], 'rb'),
+ f,
payload['type'] + '/' + payload['format']
)
}
