Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import telebot
- import config
- from telebot import types
- bot = telebot.TeleBot(config.token)
- AllKeyboard = types.ReplyKeyboardMarkup(resize_keyboard=True,one_time_keyboard=False)
- AllKeyboard.row('Сoздaть обрaщeниe')
- AllKeyboard.row('Пoсмoтреть другиe уcлуги')
- CellPhoneSendKeyboard = types.ReplyKeyboardMarkup(resize_keyboard=True,one_time_keyboard=False)
- button_phone = types.KeyboardButton(text="Отправить номер телефона", request_contact=True)
- CellPhoneSendKeyboard.add(button_phone)
- SendFullName = types.ReplyKeyboardMarkup(resize_keyboard=True,one_time_keyboard=False)
- SendFullName.row('SEND')
- HideKeyboard = types.ReplyKeyboardRemove()
- CellPhoneRetryKeyboard = types.ReplyKeyboardMarkup(resize_keyboard=True,one_time_keyboard=False)
- button_phone = types.KeyboardButton(text="Отправить номер телефона", request_contact=True)
- CellPhoneRetryKeyboard.add(button_phone)
- CellPhoneRetryKeyboard.row('Пeрeйти в Глaвнoе мeню')
- URLKeyboard = types.InlineKeyboardMarkup()
- TelecomURLBotton = types.InlineKeyboardButton(text="Перейти в Telecom.kz", url="https://telecom.kz/")
- URLKeyboard.add(TelecomURLBotton)
- @bot.message_handler(content_types=["contact"])
- def test(message):
- try:
- bot.send_message(message.chat.id, config.message3, reply_markup=HideKeyboard)
- bot.register_next_step_handler(message,process_step)
- except:
- error_step_2(message)
- def process_step(message):
- bot.send_message(message.chat.id, config.message4, reply_markup=AllKeyboard)
- def error_step_1(message):
- bot.send_message(message.chat.id, config.message1, reply_markup=AllKeyboard)
- def error_step_2(message):
- bot.send_message(message.chat.id, config.message5, reply_markup=CellPhoneRetryKeyboard)
- class abot:
- @bot.message_handler(content_types=["text"])
- def reply_all_messages(self,message):
- unit_to_multiplier = {
- 'a': bot.send_message(message.chat.id, config.message1, reply_markup=AllKeyboard),
- 'b': bot.send_message(message.chat.id, config.message2, reply_markup=CellPhoneSendKeyboard),
- 'c': bot.send_message(message.chat.id,
- "Для ознакомления с другими услугами нажмите на кнопку «Перейти в Telecom.kz»",
- reply_markup=URLKeyboard)
- }
- step = False
- if message.text == '/start':
- self.unit_to_multiplier['a']
- elif message.text == 'Сoздaть обрaщeниe':
- step = True
- self.unit_to_multiplier['b']
- elif message.text == 'Пoсмoтреть другиe уcлуги':
- step = True
- self.unit_to_multiplier['c']
- else:
- print('точка')
- if step == False:
- error_step_1(message)
- else:
- error_step_2(message)
- if __name__=='__main__':
- bot.polling(none_stop=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement