diff --git a/bot/__main__.py b/bot/__main__.py index 09c3d0f..edc9e19 100644 --- a/bot/__main__.py +++ b/bot/__main__.py @@ -41,11 +41,11 @@ async def main(): await bot.session.close() return - await set_bot_commands(bot, bot_config.main_group_id) + l10n = get_fluent_localization() - main_group_admins: dict = await fetch_admins(bot, bot_config.main_group_id) + await set_bot_commands(bot, bot_config.main_group_id, l10n) - l10n = get_fluent_localization() + main_group_admins: dict = await fetch_admins(bot, bot_config.main_group_id) dp = Dispatcher( admins=main_group_admins, diff --git a/bot/before_start.py b/bot/before_start.py index 5ef3803..6d9f20e 100644 --- a/bot/before_start.py +++ b/bot/before_start.py @@ -3,6 +3,7 @@ ChatMemberAdministrator, ChatMemberOwner, ChatMemberBanned, ChatMemberLeft, ChatMemberRestricted, BotCommand, BotCommandScopeChat ) +from fluent.runtime import FluentLocalization async def check_bot_rights_main_group( @@ -46,8 +47,8 @@ async def fetch_admins( return result -async def set_bot_commands(bot: Bot, main_group_id: int): +async def set_bot_commands(bot: Bot, main_group_id: int, l10n: FluentLocalization): commands = [ - BotCommand(command="report", description="Report message to group admins"), + BotCommand(command="report", description=l10n.format_value("bot-command-description")), ] await bot.set_my_commands(commands, scope=BotCommandScopeChat(chat_id=main_group_id)) diff --git a/bot/locale/current/strings.ftl b/bot/locale/current/strings.ftl index dd1dddf..1d2896d 100644 --- a/bot/locale/current/strings.ftl +++ b/bot/locale/current/strings.ftl @@ -62,3 +62,6 @@ readonly-temporary = channels-not-allowed = Sending messages on behalf of channels is not allowed in this group. Channel banned. + +bot-command-description = + Report message to group admins diff --git a/bot/locale/examples/en/strings.ftl b/bot/locale/examples/en/strings.ftl index dd1dddf..1d2896d 100644 --- a/bot/locale/examples/en/strings.ftl +++ b/bot/locale/examples/en/strings.ftl @@ -62,3 +62,6 @@ readonly-temporary = channels-not-allowed = Sending messages on behalf of channels is not allowed in this group. Channel banned. + +bot-command-description = + Report message to group admins diff --git a/bot/locale/examples/ru/strings.ftl b/bot/locale/examples/ru/strings.ftl index ba5545c..6cba814 100644 --- a/bot/locale/examples/ru/strings.ftl +++ b/bot/locale/examples/ru/strings.ftl @@ -62,3 +62,6 @@ readonly-temporary = channels-not-allowed = В этой группе запрещено отправлять сообщения от имени канала. Сам канал забанен. + +bot-command-description = + Сообщить о нарушении