telegram_libs 0.1.3__tar.gz → 0.1.4__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: telegram_libs
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Common libraries for Telegram bots
5
5
  Author: Andrey Gritsaenko gricaenko.95a@gmail.com
6
6
  Requires-Python: >=3.11,<4.0
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "telegram_libs"
3
- version = "0.1.3"
3
+ version = "0.1.4"
4
4
  description = "Common libraries for Telegram bots"
5
5
  authors = ["Andrey Gritsaenko gricaenko.95a@gmail.com"]
6
6
  readme = "README.md"
@@ -2,4 +2,4 @@
2
2
  Telegram Libs - Common libraries for Telegram bots
3
3
  """
4
4
 
5
- __version__ = "0.1.3"
5
+ __version__ = "0.1.4"
@@ -1,7 +1,14 @@
1
1
  import json
2
2
  import os
3
+ from typing import Any
3
4
 
4
- def load_translations():
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"
@@ -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')
File without changes
File without changes