Queer European MD passionate about IT
Bläddra i källkod

Allow auto-naming of pictures

Davte 5 år sedan
förälder
incheckning
7a52498939
2 ändrade filer med 4 tillägg och 2 borttagningar
  1. 1 1
      davtelepot/__init__.py
  2. 3 1
      davtelepot/custombot.py

+ 1 - 1
davtelepot/__init__.py

@@ -7,7 +7,7 @@ __author__ = "Davide Testa"
 __email__ = "davte@libero.it"
 __credits__ = "Marco Origlia"
 __license__ = "GNU General Public License v3.0"
-__version__ = "1.4.20"
+__version__ = "1.4.21"
 __maintainer__ = "Davide Testa"
 __contact__ = "t.me/davte"
 

+ 3 - 1
davtelepot/custombot.py

@@ -1740,7 +1740,7 @@ class Bot(telepot.aio.Bot, Gettable):
         self.to_be_obscured.remove(inline_message_id)
         return
 
-    async def save_picture(self, update, file_name, path='img/',
+    async def save_picture(self, update, file_name=None, path='img/',
                            extension='jpg'):
         """Store `update` picture as `path`/`file_name`.`extension`."""
         if not path.endswith('/'):
@@ -1751,6 +1751,8 @@ class Bot(telepot.aio.Bot, Gettable):
             path = '{path}/img/'.format(
                 path=self.path
             )
+        if file_name is None:
+            file_name = get_secure_key(length=6)
         if file_name.endswith('.'):
             file_name = file_name[:-1]
         complete_file_name = '{path}{name}.{ext}'.format(