Implemented BotLocale from libbot
This commit is contained in:
parent
f1a8739a44
commit
f8b21093a4
@ -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] = []
|
||||
|
Reference in New Issue
Block a user