import telebot
from telebot import types
import os
import time
import webbrowser
import AppOpener
bot=telebot.TeleBot('[TOKEN]')
@bot.message_handler(commands=['start'])
def hoh(message):
markup = types.ReplyKeyboardMarkup()
bt=types.KeyboardButton("Выключить")
bt2=types.KeyboardButton("Запустить")
markup.row(bt, bt2)
bot.send_message(message.chat.id, 'Привет чем могу помочь?', reply_markup=markup)
bot.register_next_step_handler(message, hoh1)
def hoh1(message):
if message.text=="Выключить":
bot.send_message(message.chat.id, 'Выключение')
os.system('shutdown /p')
elif message.text=="Запустить":
markup2 = types.ReplyKeyboardMarkup()
gb=types.KeyboardButton("Телеграм")
gb2=types.KeyboardButton("Discord")
markup2.row(gb, gb2)
gb3=types.KeyboardButton("PyCharm")
gb4=types.KeyboardButton("Vk")
markup2.row(gb3, gb4)
gb5=types.KeyboardButton("YouTube")
gb6=types.KeyboardButton("Viber")
markup2.row(gb5, gb6)
bot.send_message(message.chat.id, 'Выберите приложение которое хотите запустить:', reply_markup=markup2)
bot.register_next_step_handler(hoh2)
def hoh2():
if message.text=="Телеграм":
open('telegram')
bot.send_message(message.chat.id, "Телеграм открыт")
elif message.text=="Vk":
webbrowser.open('https://vk.com', new=2)
bot.send_message(message.chat.id, "Вконтакте открыт в браузере")
elif message.text=="YouTube":
webbrowser.open('https://www.youtube.com', new=2)
bot.send_message(message.chat.id, "YouTube открыт в браузере")
elif message.text=="Viber":
open('viber')
bot.send_message(message.chat.id, "Viber открыт")
elif message.text=="PyCharm":
open('pycharm')
bot.send_message(message.chat.id, "Pycharm открыт")
elif message.text=="Discord":
open('discord')
bot.send_message(message.chat.id, "Discord открыт")
else:
bot.send_message(message.chat.id, "Я вас не понимаю")
bot.polling(none_stop=True)
Ошибка:
Traceback (most recent call last):
File "C:\Users\Master\PycharmProjects\pythonProject5\main.py", line 61, in <module>
bot.polling(none_stop=True)
File "C:\Users\Master\PycharmProjects\pythonProject5\venv\lib\site-packages\telebot\__init__.py", line 1043, in polling
self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout,
File "C:\Users\Master\PycharmProjects\pythonProject5\venv\lib\site-packages\telebot\__init__.py", line 1118, in __threaded_polling
raise e
File "C:\Users\Master\PycharmProjects\pythonProject5\venv\lib\site-packages\telebot\__init__.py", line 1074, in __threaded_polling
self.worker_pool.raise_exceptions()
File "C:\Users\Master\PycharmProjects\pythonProject5\venv\lib\site-packages\telebot\util.py", line 147, in raise_exceptions
raise self.exception_info
File "C:\Users\Master\PycharmProjects\pythonProject5\venv\lib\site-packages\telebot\util.py", line 90, in run
task(*args, **kwargs)
File "C:\Users\Master\PycharmProjects\pythonProject5\main.py", line 35, in hoh1
bot.register_next_step_handler(hoh2)
TypeError: register_next_step_handler() missing 1 required positional argument: 'callback'
Process finished with exit code 1