From f46ccca1c17da5977b7cb846cb59f6803d0fbd04 Mon Sep 17 00:00:00 2001 From: Void User Date: Sat, 14 Jan 2023 23:25:01 +0300 Subject: [PATCH] n --- main.py | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 main.py diff --git a/main.py b/main.py deleted file mode 100644 index 5e3aab7..0000000 --- a/main.py +++ /dev/null @@ -1,40 +0,0 @@ -from mctools import PINGClient -ping = PINGClient('play.dmcraft.online') -#stats = ping.get_stats() - -#Work with JSON -import json -def read(): - global db - with open('db.json', 'r') as openfile: - db = json.load(openfile) -def write(): - global db - js = json.dumps(db, indent=4) - with open("db.json", "w") as outfile: - outfile.write(js) - -#My libraries -from time import sleep - -#Read -read() - -while True: - sleep(1) - - try: - stats = ping.get_stats() - if stats['players']['online'] != 0: - for i in stats['players']['sample']: - #Add in db if not in db - if i[0] not in db: - db[i[0]] = 1 - write() - else: - db[i[0]] = db[i[0]] + 1 - write() - -# print(f'{i[0]} ++ {db[i[0]]}') - except: - print('Maybe server offline')