Fix dynamic reload for modules without @loader.tds

pull/1/head
hikariatama 2022-10-15 16:06:03 +00:00
parent 50847c075e
commit 79a337b809
2 changed files with 11 additions and 2 deletions

View File

@ -8,10 +8,13 @@
import os
from random import choice
import logging
from .. import loader, translations, utils
from ..inline.types import BotInlineCall
logger = logging.getLogger(__name__)
imgs = [
"https://i.gifer.com/GmUB.gif",
"https://i.gifer.com/Afdn.gif",
@ -264,7 +267,10 @@ class QuickstartMod(loader.Module):
await self.translator.init()
for module in self.allmodules.modules:
module.config_complete(reload_dynamic_translate=True)
try:
module.config_complete(reload_dynamic_translate=True)
except Exception as e:
logger.debug("Can't complete dynamic translations reload of %s due to %s", module, e)
await call.answer(self.strings("language_saved"))
await call.edit(text=self.text(), reply_markup=self.mark())

View File

@ -293,7 +293,10 @@ class Translations(loader.Module):
success = await self.translator.init()
for module in self.allmodules.modules:
module.config_complete(reload_dynamic_translate=True)
try:
module.config_complete(reload_dynamic_translate=True)
except Exception as e:
logger.debug("Can't complete dynamic translations reload of %s due to %s", module, e)
await utils.answer(
message,