Compare commits

...

3 Commits

Author SHA1 Message Date
justuser 29e31f90a6 Update 'README.md' 2024-03-09 15:34:50 +03:00
none b076bfc71a Merge remote-tracking branch 'refs/remotes/origin/main' 2024-03-09 15:29:55 +03:00
none 11962b7a70 up 2024-03-09 15:29:21 +03:00
2 changed files with 31 additions and 1 deletions
+25 -1
View File
@@ -1 +1,25 @@
Just ping server and get stats. ## Что это?
Это проект, который предоставялет: простого онлайн ТГ бота ; аналитику сервера по типу пинг сервера, количество игроков.
<img src="https://gitea.404.mn/justuser/minestatsping/raw/branch/main/preview/2024-03-09_12-20.png" alt="drawing" width="400"/>
## Как использовать?
### Использование ТГ бота
1. Получить токен в https://t.me/BotFather
2. Запустить: `python online.py`
3. Вставить токен в `config.json`, где написано "token"
4. Запустить: `python online.py`
5. Проверить команду бота: `/online`
### Использование аналитики
1. Указать данные сервера в `ping.py`
- адрес - host
- порт - port
- протокол - prot ( https://minecraft.fandom.com/wiki/Protocol_version#Java_Edition )
2. Запустить сбор статистики: `python ping.py`
3. Запустить сайт: `python site_stat.py`
4. Зайти на сайт: `127.0.0.1:8050` (браузер)
+6
View File
@@ -7,9 +7,15 @@ if not os.path.exists('config.json'):
with open("config.json", "w") as outfile: with open("config.json", "w") as outfile:
outfile.write(js) outfile.write(js)
print('Created new config.json') print('Created new config.json')
exit()
def read(file = 'config.json'): def read(file = 'config.json'):
if not os.path.exists(file):
with open(file, "w") as f:
f.write("{}")
f.close()
with open(file, "r", encoding="utf-8") as openfile: with open(file, "r", encoding="utf-8") as openfile:
db = json.load(openfile) db = json.load(openfile)
return db return db