From 178310d8441e70d1a031c0284043b3c1eeb5f6e9 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Wed, 17 Mar 2021 12:55:54 +0300 Subject: [PATCH] make robot filenames unique --- bots/modules/robot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bots/modules/robot.py b/bots/modules/robot.py index 5304c0c..22385b9 100644 --- a/bots/modules/robot.py +++ b/bots/modules/robot.py @@ -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)