diff --git a/dodo-bot.py b/dodo-bot.py index 2831d2a..96a7de4 100644 --- a/dodo-bot.py +++ b/dodo-bot.py @@ -5,46 +5,46 @@ import telebot from telebot import types key_api = input("Укажите ключ бота") -dodo_bot = telebot.Telebot(f"{key_api, parse_mode=None) +dodo_bot = telebot.Telebot(f"{key_api}", parse_mode=None) -@bot.message_handler(commans=['start', 'help']) +@dodo_bot.message_handler(commans=['start', 'help']) def start_bot(message): - bot.reply_to(message, message.text) + dodo_bot.reply_to(message, message.text) -@bot.message_handler(content_types=['text']) +@dodo_bot.message_handler(content_types=['text']) def menu(a): if a.text == "Inline_menu": mainmenu = types.InlineKeyboardMarkup() key1 = types.InlineKeyboardButton(text='Кнопка 1', callback_data='key1') key2 = types.InlineKeyboardButton(text='Кнопка 2', callback_data='key2') mainmenu.add(key1, key2) - bot.send_message(a.chat.id, 'Это главное меню!', reply_markup=mainmenu) + dodo_bot.send_message(a.chat.id, 'Это главное меню!', reply_markup=mainmenu) -@bot.callback_query_handler(func=lambda call: True) +@dodo_bot.callback_query_handler(func=lambda call: True) def back(call): if call.data == "mainmenu": mainmenu = types.InlineKeyboardMarkup() key1 = types.InlineKeyboardButton(text='Кнопка 1', callback_data='key1') key2 = types.InlineKeyboardButton(text='Кнопка 2', callback_data='key2') mainmenu.add(key1, key2) - bot.edit_message_reply_markup(call.message.chat.id, call.message.message_id, reply_markup=mainmenu) + dodo_bot.edit_message_reply_markup(call.message.chat.id, call.message.message_id, reply_markup=mainmenu) elif call.data == "key1": next_menu = types.InlineKeyboardMarkup() key3 = types.InlineKeyboardButton(text='Кнопка 3', callback_data='key3') back = types.InlineKeyboardButton(text='Назад', callback_data='mainmenu') next_menu.add(key3, back) - bot.edit_message_text('Это меню уровня 2, для кнопки1!', call.message.chat.id, call.message.message_id, + dodo_bot.edit_message_text('Это меню уровня 2, для кнопки1!', call.message.chat.id, call.message.message_id, reply_markup=next_menu) elif call.data == "key2": next_menu2 = types.InlineKeyboardMarkup() key4 = types.InlineKeyboardButton(text='Кнопка 4', callback_data='key4') back = types.InlineKeyboardButton(text='Назад', callback_data='mainmenu') next_menu2.add(key4, back) - bot.edit_message_text('Это меню уровня 2, для кнопки2!', call.message.chat.id, call.message.message_id, + dodo_bot.edit_message_text('Это меню уровня 2, для кнопки2!', call.message.chat.id, call.message.message_id, reply_markup=next_menu2) -bot.polling() \ No newline at end of file +dodo_bot.polling() \ No newline at end of file