refactor(logging): logging and rename token env

This commit is contained in:
2026-07-22 21:36:33 +05:00
parent e4de501472
commit 2fb37d1ee8
21 changed files with 741 additions and 54 deletions
+14 -5
View File
@@ -29,7 +29,7 @@ def get_inventory_icon(desc: dict) -> str:
name = tag.get("localized_tag_name", "")
if category == "item_class":
if "Trading Card" in name:
return "🃏"
return "🎏"
if "Emoticon" in name:
return "😀"
if "Profile Background" in name:
@@ -40,6 +40,7 @@ def get_inventory_icon(desc: dict) -> str:
return "💎"
if "Gift" in name:
return "🎁"
item_type = desc.get("type", "").lower()
if "knife" in item_type:
return "🔪"
@@ -98,7 +99,11 @@ def get_bot_status_icon(bot: dict) -> str:
def format_bot_ui(bot: dict) -> str:
online = get_bot_status_icon(bot)
now_farming = bot.get("CardsFarmer", {}).get("NowFarming")
status_line = "🃏 Идет фарм карточек" if now_farming else "🃏 Карточки не фармится"
status_line = (
"🎴 Идет фарм карточек"
if now_farming
else "🎴 Карточки не фармятся"
)
time = bot.get("CardsFarmer", {}).get("TimeRemaining", "00:00:00")
games_to_farm = len(bot.get("CardsFarmer", {}).get("GamesToFarm", []))
twofa = "есть" if bot.get("HasMobileAuthenticator") else "нет"
@@ -110,9 +115,10 @@ def format_bot_ui(bot: dict) -> str:
profile_url = f"https://steamcommunity.com/profiles/{steam_id}"
text = (
f"{online} {bot.get('BotName') or 'Загрузка...'}"
f'(<a href="{profile_url}">{nickname}</a>)\n'
f' (<a href="{profile_url}">{nickname}</a>)\n'
f"{status_line}\n"
)
idle_games = bot.get("BotConfig", {}).get("GamesPlayedWhileIdle", [])
if idle_games:
names = [GAMES.get(game, str(game)) for game in idle_games]
@@ -126,8 +132,9 @@ def format_bot_ui(bot: dict) -> str:
text += f"{idle_text}\n"
else:
text += "⌚ Накрутка часов: выключена\n"
text += (
f"🆔 : <code>{steam_id}</code>\n"
f"🆔: <code>{steam_id}</code>\n"
f"🔐 2FA: {twofa}\n\n"
f"💰 Баланс: {balance:.2f} {currency}\n"
)
@@ -161,8 +168,10 @@ def get_farm_summary(bots: dict) -> str:
time_str = farmer.get("TimeRemaining", "00:00:00")
hours, minutes, seconds = map(int, time_str.split(":"))
total_time_seconds += hours * 3600 + minutes * 60 + seconds
if total_games == 0:
return "На аккаунтах нечего не фармиться"
return "На аккаунтах нечего фармить"
hours = total_time_seconds // 3600
minutes = (total_time_seconds % 3600) // 60
return (
+6 -1
View File
@@ -35,7 +35,11 @@ def back_keyboard(callback_data: str = "back") -> InlineKeyboardMarkup:
def games_keyboard(bot_name: str, is_enabled: bool) -> InlineKeyboardMarkup:
text = "Остановить накрутку CS2" if is_enabled else "⌚ Накрутить часы CS2"
text = (
"Остановить накрутку CS2"
if is_enabled
else "⌚ Накрутить часы CS2"
)
return InlineKeyboardMarkup(
inline_keyboard=[
[InlineKeyboardButton(text=text, callback_data=f"farm|{bot_name}|730")],
@@ -179,6 +183,7 @@ def inventory_page_keyboard(
callback_data=f"invpage|{inventory_type}|{bot_name}|{page + 1}",
)
)
keyboard = []
if nav_buttons:
keyboard.append(nav_buttons)