From 2e96584a36c6809d856c610dbca0d54f66a1a9da Mon Sep 17 00:00:00 2001 From: Rilliat Date: Tue, 14 Jan 2025 22:58:13 +0300 Subject: [PATCH] feat: add cpu, os, kernel version information in infocmd --- hikka/langpacks/de.yml | 1 + hikka/langpacks/en.yml | 1 + hikka/langpacks/ru.yml | 1 + hikka/langpacks/ua.yml | 1 + hikka/modules/heroku_info.py | 8 +++++++- 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hikka/langpacks/de.yml b/hikka/langpacks/de.yml index 8022030..c34680c 100644 --- a/hikka/langpacks/de.yml +++ b/hikka/langpacks/de.yml @@ -411,6 +411,7 @@ heroku_info: branch: "Branch" cpu_usage: "CPU-Nutzung" ram_usage: "RAM-Nutzung" + non_detectable: " Diese Komponente kann auf Ihrem Server nicht erkannt werden!" send_info: "Sende Informationen zum Userbot" description: "ℹ Dies wird keine persönlichen Informationen preisgeben" _ihandle_doc_info: "Sende Informationen zum Userbot" diff --git a/hikka/langpacks/en.yml b/hikka/langpacks/en.yml index 4d903aa..051853f 100644 --- a/hikka/langpacks/en.yml +++ b/hikka/langpacks/en.yml @@ -435,6 +435,7 @@ heroku_info: branch: "Branch" cpu_usage: "CPU usage" ram_usage: "RAM usage" + non_detectable: " This component cannot be detected on your server!" send_info: "Send userbot info" description: "ℹ This will not compromise any sensitive info" up-to-date: "😌 Up-to-date" diff --git a/hikka/langpacks/ru.yml b/hikka/langpacks/ru.yml index de7ccde..1707a58 100644 --- a/hikka/langpacks/ru.yml +++ b/hikka/langpacks/ru.yml @@ -402,6 +402,7 @@ heroku_info: branch: "Ветка" cpu_usage: "Использование CPU" ram_usage: "Использование RAM" + non_detectable: " Этот компонент невозможно обнаружить на вашем сервере!" send_info: "Отправить информацию о юзерботе" description: "ℹ Это не раскроет никакой личной информации" _ihandle_doc_info: "Отправить информацию о юзерботе" diff --git a/hikka/langpacks/ua.yml b/hikka/langpacks/ua.yml index b10628a..1dc7ad5 100644 --- a/hikka/langpacks/ua.yml +++ b/hikka/langpacks/ua.yml @@ -411,6 +411,7 @@ heroku_info: branch: "Гілка" cpu_usage: "ЦП" ram_usage: "ОЗП" + non_detectable: " Цей компонент не може бути виявлений на вашому сервері!" send_info: "Надіслати інформацію про юзербота" description: "ℹ Це не розкриє жодної особистої інформації" _ihandle_doc_info: "Надіслати інформацію про юзербота" diff --git a/hikka/modules/heroku_info.py b/hikka/modules/heroku_info.py index 242804a..445f6a6 100644 --- a/hikka/modules/heroku_info.py +++ b/hikka/modules/heroku_info.py @@ -6,6 +6,8 @@ import git import time + +import psutil from hikkatl.tl.types import Message from hikkatl.utils import get_display_name import requests @@ -13,6 +15,7 @@ import os from .. import loader, utils, version from ..inline.types import InlineQuery import subprocess +import platform as lib_platform @loader.tds class HerokuInfoMod(loader.Module): @@ -97,8 +100,11 @@ class HerokuInfoMod(loader.Module): cpu_usage=utils.get_cpu_usage(), ram_usage=f"{utils.get_ram_usage()} MB", branch=version.branch, - hostname=subprocess.run(['hostname'], stdout=subprocess.PIPE).stdout.decode().strip(), + hostname=lib_platform.node(), user=subprocess.run(['whoami'], stdout=subprocess.PIPE).stdout.decode().strip(), + os=lib_platform.freedesktop_os_release()["PRETTY_NAME"] or self.strings('non_detectable'), + kernel=lib_platform.release(), + cpu=f"{psutil.cpu_count(logical=False)} ({psutil.cpu_count()}) core(-s); {psutil.cpu_percent()}%", ) if self.config["custom_message"] else (