Skip to content

Commit

Permalink
Add Crowdin link to .about
Browse files Browse the repository at this point in the history
  • Loading branch information
evgfilim1 committed Sep 30, 2022
1 parent 8dbc13c commit 84e59fc
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions userbot/commands/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,42 @@
]

from os import getenv
from typing import Type

from pyrogram import Client

from ..constants import DefaultIcons, PremiumIcons
from ..constants import Icons, PremiumIcons
from ..modules import CommandsModule
from ..translation import Translation
from ..utils import is_prod

commands = CommandsModule("About")


@commands.add("about")
async def about(client: Client, tr: Translation) -> str:
async def about(client: Client, icons: Type[Icons], tr: Translation) -> str:
"""Shows information about this userbot"""
_ = tr.gettext
base_url = "https://github.com/evgfilim1/userbot"
# TODO (2022-07-13): get this from the git repo also
commit = getenv("GITHUB_SHA", None)
commit = getenv("GITHUB_SHA", _("staging"))
if client.me.is_premium:
header_icon = PremiumIcons.INFO
github_icon = PremiumIcons.GITHUB
commit_icon = PremiumIcons.GIT
else:
header_icon = DefaultIcons.INFO
github_icon = _("<i>Repo:</i>")
commit_icon = _("<i>Commit:</i>")
t = _("{header_icon} <b>About userbot</b>\n").format(header_icon=header_icon)
t = _("{icon} <b>About userbot</b>\n").format(icon=icons.INFO)
t += (
f"{github_icon} <a href='{base_url}'>evgfilim1/userbot</a>\n"
f"{commit_icon} <code>{commit or 'staging'}</code>"
f"{commit_icon} <code>{commit}</code>"
)
if commit:
if is_prod():
t += _(" (<a href='{base_url}/deployments'>deployments</a>)").format(
base_url=base_url,
)
t += _("\n{icon} <a href='{url}'>Contribute userbot translations</a>").format(
icon=icons.GLOBE,
url="https://crowdin.com/project/evgfilim1-userbot",
)
return t

0 comments on commit 84e59fc

Please sign in to comment.