изменили запуск, проверку карт+названия карт
This commit is contained in:
27
hlna_bot.py
27
hlna_bot.py
@ -3,11 +3,12 @@ import time
|
||||
import os
|
||||
import telebot
|
||||
from telebot import types
|
||||
import subprocess
|
||||
|
||||
import hlna
|
||||
|
||||
|
||||
key_api = input("Укажите ключ бота")
|
||||
key_api = '6192661772:AAHB1dw4rXHOglgyTOpcsxwvLn4d3AKkvP4'
|
||||
#key_api = input("Укажите ключ бота\n")
|
||||
hlna_bot = telebot.TeleBot(f"{key_api}", parse_mode=None)
|
||||
map_server = hlna.list_config
|
||||
|
||||
@ -37,7 +38,12 @@ def m_start(m):
|
||||
def m_chose(m):
|
||||
if m.text.strip() == '🦖 Старт':
|
||||
if map_server == []:
|
||||
hlna_bot.send_message(m.chat.id, text="{0.first_name}, ниодна карта не установлена".format(m.from_user))
|
||||
menu_install = types.ReplyKeyboardMarkup(resize_keyboard=True)
|
||||
k_install = types.KeyboardButton("Установить")
|
||||
k_back = types.KeyboardButton("Назад")
|
||||
menu_install.add(k_back, k_install)
|
||||
hlna_bot.send_message(m.chat.id, text="{0.first_name}, ниодна карта не установлена".format(m.from_user), reply_markup=menu_install)
|
||||
hlna_bot.register_next_step_handler(m, m_install)
|
||||
else:
|
||||
menu_start = types.ReplyKeyboardMarkup(resize_keyboard=True)
|
||||
for i in map_server:
|
||||
@ -48,9 +54,15 @@ def m_chose(m):
|
||||
hlna_bot.send_message(m.chat.id, text="{0.first_name}, выбери карту".format(m.from_user), reply_markup=menu_start)
|
||||
elif m.text.strip() == 'Назад':
|
||||
m_start(m)
|
||||
elif m.text.strip() == 'TheIsland':
|
||||
hlna.start()
|
||||
#def m_start(m):
|
||||
# elif m.text.strip() == 'TheIsland':
|
||||
# hlna.start()
|
||||
def m_install(m):
|
||||
if m.text.strip() == 'Установить':
|
||||
hlna_bot.send_message(m.chat.id, subprocess.check_output(hlna.config(), shell=True))
|
||||
|
||||
print("Bot starting")
|
||||
hlna_bot.polling(none_stop=True, interval=0, timeout=999)
|
||||
|
||||
# print("Start")
|
||||
#
|
||||
|
||||
@ -108,6 +120,5 @@ def m_chose(m):
|
||||
# time.sleep(30)
|
||||
# pass
|
||||
|
||||
print("Bot starting")
|
||||
hlna_bot.polling(none_stop=True, interval=0, timeout=999)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user