From f8b21093a48ab69d68e98312a9b2294505b6c2bc Mon Sep 17 00:00:00 2001 From: profitroll Date: Tue, 20 Jun 2023 12:49:38 +0200 Subject: [PATCH] Implemented BotLocale from libbot --- classes/pyroclient.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/classes/pyroclient.py b/classes/pyroclient.py index eacc48e..a4a3b10 100644 --- a/classes/pyroclient.py +++ b/classes/pyroclient.py @@ -6,7 +6,7 @@ from typing import List, Union import pyrogram from libbot import config_get -from libbot.i18n import in_every_locale +from libbot.i18n import BotLocale from libbot.i18n.sync import _ from pyrogram.client import Client from pyrogram.errors import BadRequest @@ -51,6 +51,14 @@ class PyroClient(Client): self.scoped_commands = config["bot"]["scoped_commands"] self.start_time = 0 + self.bot_locale = BotLocale(config["locations"]["locale"]) + self.default_locale = self.bot_locale.default + self.locales = self.bot_locale.locales + + self._ = self.bot_locale._ + self.in_all_locales = self.bot_locale.in_all_locales + self.in_every_locale = self.bot_locale.in_every_locale + async def start(self): await super().start() @@ -119,7 +127,7 @@ class PyroClient(Client): ) for locale, string in ( - await in_every_locale(command, "commands") + self.in_every_locale(command, "commands") ).items(): if locale not in scopes[dumps(scope)]: scopes[dumps(scope)][locale] = []