telegram_libs 0.1.3__py3-none-any.whl → 0.1.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- telegram_libs/__init__.py +1 -1
- telegram_libs/translation.py +9 -2
- telegram_libs/utils.py +12 -3
- {telegram_libs-0.1.3.dist-info → telegram_libs-0.1.4.dist-info}/METADATA +1 -1
- telegram_libs-0.1.4.dist-info/RECORD +8 -0
- telegram_libs-0.1.3.dist-info/RECORD +0 -8
- {telegram_libs-0.1.3.dist-info → telegram_libs-0.1.4.dist-info}/LICENSE +0 -0
- {telegram_libs-0.1.3.dist-info → telegram_libs-0.1.4.dist-info}/WHEEL +0 -0
telegram_libs/__init__.py
CHANGED
telegram_libs/translation.py
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
import json
|
2
2
|
import os
|
3
|
+
from typing import Any
|
3
4
|
|
4
|
-
|
5
|
+
|
6
|
+
def load_translations() -> dict:
|
7
|
+
"""Load translations from locales directory
|
8
|
+
|
9
|
+
Returns:
|
10
|
+
dict: Translations dictionary
|
11
|
+
"""
|
5
12
|
translations = {}
|
6
13
|
# Get the project's root directory (where the script is being run from)
|
7
14
|
project_root = os.path.abspath(os.getcwd())
|
@@ -21,7 +28,7 @@ def load_translations():
|
|
21
28
|
|
22
29
|
TRANSLATIONS = load_translations()
|
23
30
|
|
24
|
-
def t(key, lang='ru', **kwargs):
|
31
|
+
def t(key: str, lang: str = 'ru', **kwargs: Any) -> str:
|
25
32
|
"""Get translation for a key with optional formatting"""
|
26
33
|
try:
|
27
34
|
# Support nested keys like "buttons.start"
|
telegram_libs/utils.py
CHANGED
@@ -3,11 +3,11 @@ from telegram import (
|
|
3
3
|
InlineKeyboardMarkup,
|
4
4
|
)
|
5
5
|
from telegram import Update
|
6
|
+
from telegram.ext import ContextTypes
|
6
7
|
from telegram_libs.constants import BOTS_AMOUNT
|
7
8
|
from telegram_libs.translation import t
|
8
9
|
|
9
10
|
|
10
|
-
|
11
11
|
async def get_subscription_keyboard(update: Update, lang: str) -> InlineKeyboardMarkup:
|
12
12
|
"""Get subscription keyboard
|
13
13
|
|
@@ -19,7 +19,7 @@ async def get_subscription_keyboard(update: Update, lang: str) -> InlineKeyboard
|
|
19
19
|
InlineKeyboardMarkup: Inline keyboard markup
|
20
20
|
"""
|
21
21
|
await update.message.reply_text(
|
22
|
-
f"Buying a subscription you will get unlimited access to other {BOTS_AMOUNT} bots, to see all bots click /more"
|
22
|
+
f"Buying a subscription you will get unlimited access to other {int(BOTS_AMOUNT) - 1} bots, to see all bots click /more"
|
23
23
|
)
|
24
24
|
return [
|
25
25
|
[
|
@@ -35,4 +35,13 @@ async def get_subscription_keyboard(update: Update, lang: str) -> InlineKeyboard
|
|
35
35
|
t("subscription.plans.1year", lang), callback_data="sub_1year"
|
36
36
|
),
|
37
37
|
],
|
38
|
-
]
|
38
|
+
]
|
39
|
+
|
40
|
+
|
41
|
+
async def more_bots_list_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
42
|
+
message = """Here is the list of all bots: \n\n
|
43
|
+
- <a href="https://t.me/MagMediaBot">Remove Background</a>
|
44
|
+
- <a href="https://t.me/upscale_image_bot">Upscale Image</a>
|
45
|
+
- <a href="https://t.me/kudapoyti_go_bot">Recommend a place to visit</a>
|
46
|
+
"""
|
47
|
+
await update.message.reply_text(message, disable_web_page_preview=True, parse_mode='HTML')
|
@@ -0,0 +1,8 @@
|
|
1
|
+
telegram_libs/__init__.py,sha256=UhMFbEOlA6Z8p2gBV8NxotAQTsstl7Ad9gxb-o66qPY,82
|
2
|
+
telegram_libs/constants.py,sha256=mZC3_2_Favn01sI10VMz9RiQpNpShqdbFfv3aMA3DKg,319
|
3
|
+
telegram_libs/translation.py,sha256=OB89EyvwA89hxDfOJQcod96xoR5FSM4hsexl3_muqq0,1434
|
4
|
+
telegram_libs/utils.py,sha256=S2T6uPyhHJKq9zbcvTGXGUlvW3GetQ9jtA484h_Xqcc,1595
|
5
|
+
telegram_libs-0.1.4.dist-info/LICENSE,sha256=ZXkWPZbCc61L29Gz6ZHPwn1c4Pm0TnfIqtx8jGWi9F4,1069
|
6
|
+
telegram_libs-0.1.4.dist-info/METADATA,sha256=Qg3fWn6RaIamqUkuEj0fnvdYWhzyVv3ap-NrULCX1K4,762
|
7
|
+
telegram_libs-0.1.4.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
8
|
+
telegram_libs-0.1.4.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
telegram_libs/__init__.py,sha256=70j0wY1ZGtZQWN4EOWmM3recKj_K6pXSGUernohm4uQ,82
|
2
|
-
telegram_libs/constants.py,sha256=mZC3_2_Favn01sI10VMz9RiQpNpShqdbFfv3aMA3DKg,319
|
3
|
-
telegram_libs/translation.py,sha256=LCJLzKzAfd-65pAvSpW7MFr8o34nsdfWuVWonHI7SQU,1270
|
4
|
-
telegram_libs/utils.py,sha256=DAhnilUE7-WlXMoK1LnwcIJ4kgHDdmM3HV06ScyarMY,1089
|
5
|
-
telegram_libs-0.1.3.dist-info/LICENSE,sha256=ZXkWPZbCc61L29Gz6ZHPwn1c4Pm0TnfIqtx8jGWi9F4,1069
|
6
|
-
telegram_libs-0.1.3.dist-info/METADATA,sha256=NHNMoASTZNfeF1IVfP6_I_jRcpAtkxaH44QkNjexyaw,762
|
7
|
-
telegram_libs-0.1.3.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
8
|
-
telegram_libs-0.1.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|