R
R
Roman Roman2020-05-06 01:04:31
pip
Roman Roman, 2020-05-06 01:04:31

How to make the message not be stored in m.text change?

I have such a program, I took it from the Internet and changed it a little. I'm a beginner.

import telebot
from telebot import types
menu = ["Піца", "Кава", "Чай", "Морозиво", "Коктель"]
bot = telebot.TeleBot('1087018832:AAEUODlCX-NUC8LOumeedO1_01OJ6lAERTQ')
@bot.message_handler(commands=["Меню","menu","start"])
def start(m):
    msg = bot.send_message(m.chat.id, "Доброго дня! Що хочете замовити?")
    keyboard = types.ReplyKeyboardMarkup(resize_keyboard=True)
    keyboard.add(*[types.KeyboardButton(name) for name in menu])
    keyboard.add(*[types.KeyboardButton(name) for name in ['Контакти']])
    bot.send_message(m.chat.id, 'Вибери в меню що тобі інтересно(Приймається останє замовлення)',
        reply_markup=keyboard)
    bot.register_next_step_handler(msg, name)

def name(m):
    buy = {}
    menu_str = menu.index(str(m.text))
    if m.text == 1 or 2 or 3 or 0:
        dict.fromkeys([m.text])
        keyboard = types.ReplyKeyboardMarkup(resize_keyboard=True)
        bot.send_message(m.chat.id, "Яка кілкість?", reply_markup=keyboard)
        buy = dict.fromkeys([m.text], m.text)
        print(str(m))
bot.polling(none_stop=True)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question