make robot filenames unique
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
				
			|||||||
import logging
 | 
					import logging
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					import time
 | 
				
			||||||
from tempfile import TemporaryDirectory
 | 
					from tempfile import TemporaryDirectory
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import boto3
 | 
					import boto3
 | 
				
			||||||
@@ -42,7 +43,7 @@ class RobotBotModuleConfig(TelegramBotModuleConfig):
 | 
				
			|||||||
            return
 | 
					            return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        file = ctx.bot.get_file(file_id)
 | 
					        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:
 | 
					        with TemporaryDirectory() as d:
 | 
				
			||||||
            file_path = os.path.join(d, filename)
 | 
					            file_path = os.path.join(d, filename)
 | 
				
			||||||
            file.download(file_path)
 | 
					            file.download(file_path)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user