make robot filenames unique
This commit is contained in:
parent
4806bf8fe0
commit
178310d844
@ -1,5 +1,6 @@
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
import boto3
|
||||
@ -42,7 +43,7 @@ class RobotBotModuleConfig(TelegramBotModuleConfig):
|
||||
return
|
||||
|
||||
file = ctx.bot.get_file(file_id)
|
||||
filename = os.path.basename(file.file_path)
|
||||
filename = str(int(time.time())) + '-' + os.path.basename(file.file_path)
|
||||
with TemporaryDirectory() as d:
|
||||
file_path = os.path.join(d, filename)
|
||||
file.download(file_path)
|
||||
|
Loading…
Reference in New Issue
Block a user