teamtalkbot/bot/app_vars.py
Umiko 2b5f9fc990
Some checks are pending
Build-nightly / docker (push) Waiting to run
fixed the app_var.py.
2025-05-13 20:33:57 +07:00

101 lines
3.8 KiB
Python

from __future__ import annotations
import os
import platform
from typing import Callable, TYPE_CHECKING
if TYPE_CHECKING:
from bot.translator import Translator
app_name = "pandorafox♾"
app_version = "2.4.0"
def get_system_info() -> str:
system = platform.system()
release = platform.release()
version = platform.version()
machine = platform.machine() or "unknown"
processor = platform.processor() or "unknown"
architecture = platform.architecture()[0] # '64bit' or '32bit'
if system == "Windows":
try:
import winreg
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows NT\CurrentVersion")
product_name = winreg.QueryValueEx(key, "ProductName")[0]
release_id = winreg.QueryValueEx(key, "ReleaseId")[0]
system_str = f"{product_name} {release_id}"
except Exception:
system_str = f"Windows {release}"
elif system == "Linux":
try:
# Trying to get CPU info from /proc/cpuinfo
with open("/proc/cpuinfo") as f:
cpu_info = f.read()
# Get the processor information
processor = " ".join([line.split(":")[1].strip() for line in cpu_info.splitlines() if "model name" in line]) or processor
os_info = {}
with open("/etc/os-release") as f:
for line in f:
if "=" in line:
k, v = line.strip().split("=", 1)
os_info[k] = v.strip('"')
name = os_info.get("PRETTY_NAME") or os_info.get("NAME", "Linux")
system_str = name
except Exception:
system_str = f"Linux {release}"
elif system == "Darwin":
mac_ver = platform.mac_ver()[0]
system_str = f"macOS {mac_ver or release}"
else:
system_str = f"{system} {release}"
return f"{system_str} | Arch: {architecture} | Machine: {machine} | CPU: {processor}"
client_name = f"{app_name}-Version{app_version}-{get_system_info()}"
about_text: Callable[[Translator], str] = lambda translator: translator.translate(
"""\
A media streaming bot for TeamTalk.
Authors: Amir Gumerov, Vladislav Kopylov, Beqa Gozalishvili, Kirill Belousov.
Home page: https://github.com/gumerov-amir/TTMediaBot
Pandorabox writer: Rexya, Muhammad.
Extended from pandoraBox (https://www.dropbox.com/scl/fi/w59od6p43v474cdqfllt1/PandoraBox.zip?rlkey=sghktp7rbuxknbz9b3v9lqfii&dl=1)
Currently maintain by Rafli On Techlabs git
Visit us on: https://git.techlabs.lol/radiant_code/teamtalkbot
License: MIT License\
"""
)
start_bottt: Callable[[Translator], str] = lambda translator: translator.translate(
"""\
Hello there!
I'm PandoraFox, your go-to companion for discovering amazing songs and audio through YouTube, Yandex Music (Currently unavailable), and VK.
Hosted by TechLabsStudio, I'm all set to bring audio magic to your TeamTalk experience.
To get started, simply send me a private message with a specific command.
Here's how you can interact with me:
- help: Receive a handy guide to all the commands you can use, delivered straight to your private message.
- contacts: Get contact information sent directly to your private message.
- log: Check out the change log file.
If you encounter any issues or want to chat with us, feel free to reach out.
Thank you for choosing our service, and have a fantastic day!\
"""
)
contacts_bot: Callable[[Translator], str] = lambda translator: translator.translate(
"""\
If you encounter any issues with this bot, please reach out to our dedicated technicians:
🦊 Rafli:
rafli@techlabs.lol
t.me/rafli_ir
Join the TTMediaBot Official Group on Telegram: https://t.me/TTMediaBot_chat\
"""
)
fallback_service = "yt"
loop_timeout = 0.01
max_message_length = 512
recents_max_lenth = 64
tt_event_timeout = 2
directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))