Skip to content

ability to use custom filename in sendDocument etc. #56

Description

@ergoz

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Fields

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions