Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report command description localization #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions bot/before_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
ChatMemberAdministrator, ChatMemberOwner, ChatMemberBanned, ChatMemberLeft, ChatMemberRestricted,
BotCommand, BotCommandScopeChat
)
from fluent.runtime import FluentLocalization


async def check_bot_rights_main_group(
Expand Down Expand Up @@ -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))
3 changes: 3 additions & 0 deletions bot/locale/current/strings.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions bot/locale/examples/en/strings.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions bot/locale/examples/ru/strings.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ readonly-temporary =

channels-not-allowed =
В этой группе запрещено отправлять сообщения от имени канала. Сам канал забанен.

bot-command-description =
Сообщить о нарушении