From b1b74fcb18aa82752952e92f45e2fb9e89179ec4 Mon Sep 17 00:00:00 2001 From: none Date: Sat, 2 Mar 2024 19:13:55 +0300 Subject: [PATCH] up --- online.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/online.py b/online.py index f1c51f5..37860ce 100644 --- a/online.py +++ b/online.py @@ -1,16 +1,14 @@ from mctools import PINGClient import telebot -from threading import Thread -from time import time, sleep from db import * API_TOKEN = read()['token'] bot = telebot.TeleBot(API_TOKEN) -# 764 - 1.20.2 host = 'CoolFunZone.aternos.me' port = 36413 +# 764 - 1.20.2 prot = 764 global c c = PINGClient(host, port, proto_num = prot) @@ -31,6 +29,11 @@ def check_online(message): maxp = stats['players']['max'] onp = stats['players']['online'] + # Фикс для aternos + if maxp == 0: + bot.reply_to(message, "🔴 Сервер оффлайн") + return 0 + try: first = True for i in stats['players']['sample']: @@ -42,6 +45,8 @@ def check_online(message): except: pp = '' + print(pp) + bot.reply_to(message, f"""🟢 Игроки онлайн >> {onp}/{maxp} {pp}