Created
October 19, 2019 14:22
-
-
Save DiZiNnEs/f4778a7d541a768c2244bea12bb585aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from config import bot | |
import keyboard | |
from telebot import types | |
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton | |
def gen_markup(): | |
markup = InlineKeyboardMarkup() | |
markup.row_width = 2 | |
markup.add(InlineKeyboardButton("Yes", callback_data="cb_yes"), | |
InlineKeyboardButton("No", callback_data="cb_no")), | |
return markup | |
# @bot.callback_query_handler(func=lambda call: True) | |
# def callback_query(call): | |
# if call.data == "cb_yes": | |
# bot.answer_callback_query(call.id, "Answer is Yes") | |
# elif call.data == "cb_no": | |
# bot.answer_callback_query(call.id, "Answer is No") | |
@bot.callback_query_handler(func=lambda call: True) | |
def callback_querry(call): | |
with open('/home/dizinnes/PycharmProjects/My-telegramBot/recipeStart/recipeStart.txt') as wannaEat: | |
wEat = wannaEat.read() | |
if call.data == "cb_yes": | |
bot.send_message(call.message.chat.id, str(wEat)) | |
elif call.data == "cb_no": | |
bot.send_message(call.message.chat.id, 'no') | |
@bot.message_handler(func=lambda message: True) | |
def message_handler(message): | |
if message.text.lower() == 'желаю поесть' or message.text.lower() == 'хочу есть': | |
bot.send_message(message.chat.id, "Выберите направление:", reply_markup=gen_markup()) | |
bot.polling(none_stop=True, interval=0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment