Allow auto-naming of pictures
This commit is contained in:
parent
11b319d0a5
commit
7a52498939
@ -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"
|
||||
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user