none 9 months ago
parent d22cbad4e4
commit b1b74fcb18

@ -1,16 +1,14 @@
from mctools import PINGClient from mctools import PINGClient
import telebot import telebot
from threading import Thread
from time import time, sleep
from db import * from db import *
API_TOKEN = read()['token'] API_TOKEN = read()['token']
bot = telebot.TeleBot(API_TOKEN) bot = telebot.TeleBot(API_TOKEN)
# 764 - 1.20.2
host = 'CoolFunZone.aternos.me' host = 'CoolFunZone.aternos.me'
port = 36413 port = 36413
# 764 - 1.20.2
prot = 764 prot = 764
global c global c
c = PINGClient(host, port, proto_num = prot) c = PINGClient(host, port, proto_num = prot)
@ -31,6 +29,11 @@ def check_online(message):
maxp = stats['players']['max'] maxp = stats['players']['max']
onp = stats['players']['online'] onp = stats['players']['online']
# Фикс для aternos
if maxp == 0:
bot.reply_to(message, "🔴 Сервер оффлайн")
return 0
try: try:
first = True first = True
for i in stats['players']['sample']: for i in stats['players']['sample']:
@ -42,6 +45,8 @@ def check_online(message):
except: except:
pp = '' pp = ''
print(pp)
bot.reply_to(message, f"""🟢 Игроки онлайн >> {onp}/{maxp} bot.reply_to(message, f"""🟢 Игроки онлайн >> {onp}/{maxp}
{pp} {pp}

Loading…
Cancel
Save