Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import telebot
- from telebot import types
- bot = telebot.TeleBot('тут токен')
- def anketa(message):
- bot.send_message(message.from_user.id, "Как тебя зовут?")
- bot.register_next_step_handler(message, get_name)
- def get_name(message): #получаем фамилию
- global name;
- name = message.text;
- bot.send_message(message.from_user.id, 'Какая у тебя фамилия?');
- bot.register_next_step_handler(message, get_surnme);
- def get_surname(message):
- global surname;
- surname = message.text;
- bot.send_message('Сколько тебе лет?');
- bot.register_next_step_handler(message, get_age);
- def get_age(message):
- global age;
- while age == 0: #проверяем что возраст изменился
- try:
- age = int(message.text) #проверяем, что возраст введен корректно
- except Exception:
- bot.send_message(message.from_user.id, 'Цифрами, пожалуйста');
- bot.send_message(message.from_user.id, 'Тебе '+str(age)+' лет, тебя зовут '+name+' '+surname+'?')
- def ku(call):
- typework = types.InlineKeyboardMarkup()
- msg = 'Выберите тип услуги: \n'
- global poddone
- global podd
- global genwork
- global afterwork
- global afterwork20
- global vipwork
- podd = types.InlineKeyboardButton(text = 'Поддерживающая уборка (Постоянный клиент) - ' + pricepodd, callback_data = 'poddpost')
- global msgepodd
- msgepodd = podd.text
- typework.add(podd)
- poddone = types.InlineKeyboardButton(text = 'Поддерживающая уборка (разовый заказ) - ' + pricepoddone, callback_data = 'poddone')
- typework.add(poddone)
- global msgepoddone
- msgepoddone = poddone.text
- genwork = types.InlineKeyboardButton(text = 'Генеральнная уборка - ' + pricegen, callback_data = 'genwork')
- typework.add(genwork)
- global genworktext
- genworktext = genwork.text
- afterwork20 = types.InlineKeyboardButton(text = 'Уборка после ремонта (Без мебели — скидка 20%)', callback_data = 'afterwork20')
- typework.add(afterwork20)
- global afterwork20text
- afterwork20text = afterwork20.text
- afterwork = types.InlineKeyboardButton(text = 'Уборка после ремонта с мебелью - ' +priceafter, callback_data = 'afterdefault')
- typework.add(afterwork)
- global afterworktext
- afterworktext = afterwork.text
- vipwork = types.InlineKeyboardButton(text = 'VIP уборка - ' +pricevip, callback_data = 'vip')
- typework.add(vipwork)
- global vipworktxt
- vipworktxt = vipwork.text
- bot.send_message(call.message.chat.id, msg, reply_markup = typework )
- def end(call):
- if call.data == 'poddpost':
- msg = 'Вы выбрали: ' + podd.text + '\n'
- @bot.message_handler(content_types=["text"])
- def welcome(message):
- button = types.InlineKeyboardMarkup() #объявление кнопок
- #Уборка квартир
- kvartirb = types.InlineKeyboardButton(text='Уборка квартир', callback_data='kvartir')
- button.add(kvartirb) # add button to keyboard
- #Уборка коттеджей
- kottedj = types.InlineKeyboardButton(text = 'Уборка коттеджей', callback_data = 'kottedj')
- button.add(kottedj) # add button to keyboard
- #Уборка офисов и других помещений
- other = types.InlineKeyboardButton(text = 'Уборка офисов и других помещений', callback_data = 'other')
- button.add(other) # add button to keyboard
- ###
- welcometext = 'Здравствуйте, вас приветствует клининговая компания "ПрофКлинингСервис".\n'
- welcometext += 'Выберите интересующий вас раздел.\n'
- msg = bot.send_message(message.chat.id, welcometext, reply_markup=button)
- bot.register_next_step_handler(msg, callback_worker)
- @bot.callback_query_handler(func=lambda call: True)
- def callback_worker(call):
- ploshad = 'Выберите соответствующую площадь квартиры: \n'
- ploshadb = types.InlineKeyboardMarkup()
- global pricepodd
- global pricepoddone
- global pricegen
- global priceafter20
- global priceafter
- global pricevip
- pricepodd = ''
- pricepoddone = ''
- pricegen = ''
- priceafter = ''
- priceafter20 = ''
- pricevip = ''
- if call.data == 'kvartir':
- #до 40 кв.м
- m40 = types.InlineKeyboardButton(text = 'До 40 кв.м', callback_data = 'metr40k')
- ploshadb.add(m40)
- #до 50 кв.м
- m50 = types.InlineKeyboardButton(text = 'До 50 кв.м', callback_data = 'metr50k')
- ploshadb.add(m50)
- #до 60 кв.м
- m60 = types.InlineKeyboardButton(text = 'До 60 кв.м', callback_data = 'metr60k')
- ploshadb.add(m60)
- #до 70кв.м
- m70 = types.InlineKeyboardButton(text = 'До 70 кв.м', callback_data = 'metr70k')
- ploshadb.add(m70)
- #до 80 кв.м
- m80 = types.InlineKeyboardButton(text = 'До 80 кв.м', callback_data = 'metr80k')
- ploshadb.add(m80)
- #до 90кв.м
- m90 = types.InlineKeyboardButton(text = 'До 90 кв.м', callback_data = 'metr90k')
- ploshadb.add(m90)
- #до 100 кв.м
- m100 = types.InlineKeyboardButton(text = 'До 100 кв.м', callback_data = 'metr100k')
- ploshadb.add(m100)
- #далее
- other = types.InlineKeyboardButton(text = 'От 100 кв.м', callback_data = 'otherk')
- ploshadb.add(other)
- bot.send_message(call.message.chat.id, ploshad, reply_markup = ploshadb)
- if call.data == 'metr40k':
- choises = True
- pricepodd = '1 600 рублей'
- pricepoddone = '2 300 рублей'
- pricegen = '5 500 рублей'
- priceafter20 = ''
- priceafter = '6 500 рублей'
- pricevip = '12 000 рублей'
- ku(call)
- elif call.data == 'metr50k':
- choises = True
- pricepodd = '1 800 рублей'
- pricepoddone = '2 500 рублей'
- pricegen = '5 500 рублей'
- priceafter20 = ''
- priceafter = '6 500 рублей'
- pricevip = '12 000 рублей'
- ku(call)
- if call.data == 'metr60k':
- choises = True
- pricepodd = '1 800 рублей'
- pricepoddone = '2 500 рублей'
- pricegen = '7 000 рублей'
- priceafter20 = '6 800 рублей'
- priceafter = '8 500 рублей'
- pricevip = '17 500 рублей'
- ku(call)
- elif call.data == 'metr70k':
- choises = True
- pricepodd = '1 900 рублей'
- pricepoddone = '2 500 рублей'
- pricegen = '8 000 рублей'
- priceafter20 = '7 200 рублей'
- priceafter = '9 000 рублей'
- pricevip = '20 500 рублей'
- ku(call)
- if call.data == 'metr80k':
- choises = True
- pricepodd = '2 300 рублей'
- pricepoddone = '2 600 рублей'
- pricegen = '9 000 рублей'
- priceafter20 = '7 600'
- priceafter = '9 500 рублей'
- pricevip = '23 500 рублей'
- ku(call)
- elif call.data == 'metr90k':
- choises = True
- pricepodd = '2 500 рублей'
- pricepoddone = '3 000 рублей'
- pricegen = '10 000 рублей'
- priceafter20 = '8 400 рублей'
- priceafter = '10 500 рублей'
- pricevip = '26 500 рублей'
- ku(call)
- if call.data == 'metr100k':
- choises = True
- pricepodd = '2 500 рублей'
- pricepoddone = '3 000 рублей'
- pricegen = '11 000 рублей'
- priceafter20 = '8 800 рублей'
- priceafter = '11 000 рублей'
- pricevip = '29 000 рублей'
- ku(call)
- elif call.data == 'otherk':
- choises = True
- pricepodd = '24 р/кв.м'
- pricepoddone = '30р/кв.м'
- pricegen = '110р/кв.м'
- priceafter20 = '88р/кв.м'
- priceafter = '110р/кв.м'
- pricevip = '290р/кв.м'
- ku(call)
- bot.polling( none_stop = True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement