mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Fix loadings funcs
This commit is contained in:
parent
e99fb8f84f
commit
ed7e33b4c6
@ -113,7 +113,7 @@ class TeleBot:
|
|||||||
self.worker_pool = util.ThreadPool(num_threads=num_threads)
|
self.worker_pool = util.ThreadPool(num_threads=num_threads)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def dump_handlers(handlers, filename="./handler-saves/step.save", file_mode="w"):
|
def dump_handlers(handlers, filename, file_mode="w"):
|
||||||
dirs = filename.rsplit('/', maxsplit=1)[0]
|
dirs = filename.rsplit('/', maxsplit=1)[0]
|
||||||
os.makedirs(dirs, exist_ok=True)
|
os.makedirs(dirs, exist_ok=True)
|
||||||
with open(filename + ".tmp", file_mode) as file:
|
with open(filename + ".tmp", file_mode) as file:
|
||||||
@ -165,6 +165,12 @@ class TeleBot:
|
|||||||
with open(filename, "r") as file:
|
with open(filename, "r") as file:
|
||||||
handlers = json.load(file)
|
handlers = json.load(file)
|
||||||
|
|
||||||
|
for handler in handlers:
|
||||||
|
name = handler["callback"]["name"]
|
||||||
|
module = handler["callback"]["module"]
|
||||||
|
|
||||||
|
handler = getattr(sys.modules[module], name)
|
||||||
|
|
||||||
return handlers
|
return handlers
|
||||||
|
|
||||||
def load_next_step_handlers(self, filename="./handler-saves/step.save"):
|
def load_next_step_handlers(self, filename="./handler-saves/step.save"):
|
||||||
|
Loading…
Reference in New Issue
Block a user