Compare commits
3 Commits
971915faf4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 29e31f90a6 | |||
| b076bfc71a | |||
| 11962b7a70 |
@@ -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` (браузер)
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user