I have a code that sends txt file, i need use tmp files that have bad names, when i use
temp_file = tempfile.NamedTemporaryFile(delete=False, mode='w')
tmp_filename = temp_file.name
temp_file.write(build_log)
temp_file.close()
document = open(tmp_filename, 'rb')
self.BOT.sendDocument(chat_id=chat_id, document=document)
document.close()
os.unlink(tmp_filename)
in telegram file have dynamicly generated tmp name (like tempsx8eth). How to set custom name?
As i understand we need to refactor class InputFile(object) on line 70
self.filename = os.path.basename(self.input_file.name)
I've seen 1-2 bots that have ability to change sending name and it is very usefull.
I have a code that sends txt file, i need use tmp files that have bad names, when i use
in telegram file have dynamicly generated tmp name (like tempsx8eth). How to set custom name?
As i understand we need to refactor
class InputFile(object)on line 70I've seen 1-2 bots that have ability to change sending name and it is very usefull.