Телеграмм бот не выполняет запрос при Inline клавиатуре
Запускаю бота, ''Получить скриншот'' и ''Система'' работают идеально, дошёл до браузера и всё, ловит тупняк, запрос начинает грузить, но не выполняет, причём ошибок не выдает, не знаю в чем может быть проблема. Мой код ниже либо по этой ссылке - http://codepad.org/hsxuJLFF
import os
import telebot
import tempfile
import subprocess
from PIL import ImageGrab
API_TOKEN = 'Здесь токен'
bot = telebot.TeleBot(API_TOKEN)
CDIR = os.getcwd()
@bot.message_handler(commands=['start'])
def send_welcome(message):
markup = telebot.types.ReplyKeyboardMarkup(resize_keyboard=True)
markup.add("Получить скриншот")
markup.add("Система")
markup.add("Браузер")
markup.add("Программы")
sti = open('static/welcome.webp', 'rb')
bot.send_sticker(message.chat.id, sti)
bot.send_message(message.chat.id,
"Добро пожаловать, {0.first_name}!\nЯ - <b>{1.first_name}</b> - бот созданный для тестирования различных задач своего автора. \nby MoXiTo.".format(
message.from_user, bot.get_me()),
parse_mode='html', reply_markup=markup)
# SCREENSHOT
@bot.message_handler(regexp='получить скриншот')
def echo_message(message):
path = tempfile.gettempdir() + 'screenshot.png'
screenshot = ImageGrab.grab()
screenshot.save(path, 'PNG')
bot.send_photo(message.chat.id, open(path, 'rb'))
# SCREENSHOT
# SYSTEM
@bot.message_handler(regexp='Система')
def echo_message(message):
item1 = telebot.types.InlineKeyboardButton("Выключить", callback_data='system_off')
markup = telebot.types.InlineKeyboardMarkup()
markup.add(item1)
bot.send_message(message.chat.id, 'Выберете пункт:', reply_markup=markup)
@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
try:
if call.message:
if call.data == 'system_off':
bot.send_message(call.message.chat.id, 'Выключаю...')
os.system("shutdown -s -t 0")
except Exception as e:
print(repr(e))
# SYSTEM
# BROWSER
@bot.message_handler(regexp='Браузер')
def echo_message(message):
item1 = telebot.types.InlineKeyboardButton("Открыть браузер", callback_data='open_browser')
markup = telebot.types.InlineKeyboardMarkup()
markup.add(item1)
bot.send_message(message.chat.id, 'Выберете пункт:', reply_markup=markup)
@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
try:
if call.message:
if call.data == 'open_browser':
subprocess.Popen([f'{CDIR}\\custom-commands\\Run browser.exe'])
bot.send_message(call.message.chat.id, 'Выполняю...')
except Exception as e:
print(repr(e))
# BROWSER
bot.infinity_polling()