diff --git a/davtelepot/__init__.py b/davtelepot/__init__.py index 39b3a01..e303b44 100644 --- a/davtelepot/__init__.py +++ b/davtelepot/__init__.py @@ -14,7 +14,7 @@ __author__ = "Davide Testa" __email__ = "davide@davte.it" __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __license__ = "GNU General Public License v3.0" -__version__ = "2.3.15" +__version__ = "2.3.16" __maintainer__ = "Davide Testa" __contact__ = "t.me/davte" diff --git a/davtelepot/bot.py b/davtelepot/bot.py index e217b0d..f88092e 100644 --- a/davtelepot/bot.py +++ b/davtelepot/bot.py @@ -1727,8 +1727,10 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject): mode='raw' ) path = path or self.path - if file_name is None: + while file_name is None: file_name = get_secure_key(length=10) + if os.path.exists(f"{path}/{file_name}"): + file_name = None try: with open(f"{path}/{file_name}", 'wb') as local_file: local_file.write(file_bytes)