up
This commit is contained in:
parent
d22cbad4e4
commit
b1b74fcb18
11
online.py
11
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}
|
||||
|
Loading…
Reference in New Issue
Block a user