Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #source tenv/bin/activate
- import telebot
- from telebot import types
- TOKEN = 'sdjhgsdf'
- bot = telebot.TeleBot(TOKEN)
- @bot.message_handler(commands=['start'])
- def start(m):
- msg = bot.send_message(m.chat.id, 'Привет всем в этом чате')
- keyboard = types.ReplyKeyboardMarkup(row_width=2)
- keyboard.add(*[types.KeyboardButton(name) for name in ['Choice one', 'Choice two']])
- msg = bot.send_message(m.chat.id, 'Выбирай', reply_markup=keyboard)
- bot.register_next_step_handler(msg, name)
- def name(m):
- if m.text == 'Choice one':
- bot.send_message(m.chat.id, 'Описание первого выбора', parse_mode='Markdown')
- if m.text == 'Choice two':
- bot.send_message(m.chat.id, 'Описание второго выбора', parse_mode='Markdown')
- @bot.message_handler(commands=['geophone'])
- def geophone(message):
- # Эти параметры для клавиатуры необязательны, просто для удобства
- keyboard = types.ReplyKeyboardMarkup(row_width=1, resize_keyboard=True)
- button_phone = types.KeyboardButton(text="Отправить номер телефона", request_contact=True)
- # button_geo = types.KeyboardButton(text="Отправить местоположение", request_location=True)
- keyboard.add(button_phone)
- bot.send_message(message.chat.id, "Отправь мне свой номер телефона", reply_markup=keyboard)
- @bot.message_handler(content_types=["text"])
- def default_test(message):
- keyboard = types.InlineKeyboardMarkup()
- url_button = types.InlineKeyboardButton(text="HelpDesk ", url="https://helpdesk")
- keyboard.add(url_button)
- bot.send_message(message.chat.id, "Привет! Нажми на кнопку и перейди в СервисДеск.", reply_markup=keyboard)
- bot.polling()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement