1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Change default save directory to "./.handler-saves/".

Add del_file_after_loading param to load methods.

Update: telebot/__init__.py
This commit is contained in:
Waffle 2018-05-26 17:10:00 +03:00
parent 47e6dfd6bc
commit 1de356dcc3

View File

@ -188,10 +188,10 @@ class TeleBot:
if self.threaded:
self.worker_pool = util.ThreadPool(num_threads=num_threads)
def enable_save_next_step_handlers(self, delay=120, filename="./handler-saves/step.save"):
def enable_save_next_step_handlers(self, delay=120, filename="./.handler-saves/step.save", del_file_after_loading=True):
self.next_step_saver = Saver(self.next_step_handlers, filename, delay)
def enable_save_reply_handlers(self, delay=120, filename="./handler-saves/reply.save"):
def enable_save_reply_handlers(self, delay=120, filename="./.handler-saves/reply.save", del_file_after_loading=True):
self.reply_saver = Saver(self.reply_handlers, filename, delay)
def disable_save_next_step_handlers(self):
@ -200,10 +200,10 @@ class TeleBot:
def disable_save_reply_handlers(self):
self.reply_saver = None
def load_next_step_handlers(self, filename="./handler-saves/step.save"):
def load_next_step_handlers(self, filename="./.handler-saves/step.save"):
self.next_step_saver.load_handlers(filename)
def load_reply_handlers(self, filename="./handler-saves/reply.save"):
def load_reply_handlers(self, filename="./.handler-saves/reply.save"):
self.reply_saver.load_handlers(filename)
def set_webhook(self, url=None, certificate=None, max_connections=None, allowed_updates=None):
@ -1474,12 +1474,12 @@ class AsyncTeleBot(TeleBot):
TeleBot.__init__(self, *args, **kwargs)
@util.async()
def enable_save_next_step_handlers(self, delay=120, filename="./handler-saves/step.save"):
return TeleBot.enable_save_next_step_handlers(self, delay, filename)
def enable_save_next_step_handlers(self, delay=120, filename="./.handler-saves/step.save", del_file_after_loading=True):
return TeleBot.enable_save_next_step_handlers(self, delay, filename, del_file_after_loading)
@util.async()
def enable_save_reply_handlers(self, delay=120, filename="./handler-saves/reply.save"):
return TeleBot.enable_save_reply_handlers(self, delay, filename)
def enable_save_reply_handlers(self, delay=120, filename="./.handler-saves/reply.save", del_file_after_loading=True):
return TeleBot.enable_save_reply_handlers(self, delay, filename, del_file_after_loading)
@util.async()
def disable_save_next_step_handlers(self):
@ -1490,11 +1490,11 @@ class AsyncTeleBot(TeleBot):
return TeleBot.enable_save_reply_handlers(self)
@util.async()
def load_next_step_handlers(self, filename="./handler-saves/step.save"):
def load_next_step_handlers(self, filename="./.handler-saves/step.save"):
return TeleBot.load_next_step_handlers(self, filename)
@util.async()
def load_reply_handlers(self, filename="./handler-saves/reply.save"):
def load_reply_handlers(self, filename="./.handler-saves/reply.save"):
return TeleBot.load_reply_handlers(self, filename)
@util.async()