From 95bb93b1ebd08b90a0d810dea1f8be21f9825d9a Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 10 Jan 2025 13:14:22 +0330 Subject: [PATCH] Added CPU monitoring module --- core/scripts/telegrambot/tbot.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/scripts/telegrambot/tbot.py b/core/scripts/telegrambot/tbot.py index 7c6f472..6c06904 100644 --- a/core/scripts/telegrambot/tbot.py +++ b/core/scripts/telegrambot/tbot.py @@ -7,6 +7,9 @@ from utils.deleteuser import * from utils.edituser import * from utils.search import * from utils.serverinfo import * +from utils.cpu import * +import threading +import time @bot.message_handler(commands=['start']) def send_welcome(message): @@ -16,5 +19,12 @@ def send_welcome(message): else: bot.reply_to(message, "Unauthorized access. You do not have permission to use this bot.") +def monitoring_thread(): + while True: + monitor_system_resources() + time.sleep(60) + if __name__ == '__main__': + monitor_thread = threading.Thread(target=monitoring_thread, daemon=True) + monitor_thread.start() bot.polling(none_stop=True)