Python telebot.types.ReplyKeyboardMarkup() Examples
The following are 9
code examples of telebot.types.ReplyKeyboardMarkup().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
telebot.types
, or try the search function
.
Example #1
Source File: SiteAlert_bot.py From SiteAlert-Python with BSD 2-Clause "Simplified" License | 8 votes |
def removeme(m): credentials = site_alert.execute_fetch_all("SELECT mail FROM Users WHERE telegram =?", (m.chat.id,)) if len(credentials) > 0: markup = types.ReplyKeyboardMarkup(one_time_keyboard=True) sites = site_alert.execute_fetch_all( "SELECT name FROM Registered, Users WHERE Registered.mail = Users.mail AND telegram = ? ORDER BY name COLLATE NOCASE", (m.chat.id,)) for site in sites: markup.add(site[0]) msg = tb.send_message(m.chat.id, "Ok, from...?", reply_markup=markup) tb.register_next_step_handler(msg, rm) else: tb.send_message(m.chat.id, "You must be registered.\nUse /register")
Example #2
Source File: step_example.py From pyTelegramBotAPI with GNU General Public License v2.0 | 7 votes |
def process_age_step(message): try: chat_id = message.chat.id age = message.text if not age.isdigit(): msg = bot.reply_to(message, 'Age should be a number. How old are you?') bot.register_next_step_handler(msg, process_age_step) return user = user_dict[chat_id] user.age = age markup = types.ReplyKeyboardMarkup(one_time_keyboard=True) markup.add('Male', 'Female') msg = bot.reply_to(message, 'What is your gender', reply_markup=markup) bot.register_next_step_handler(msg, process_sex_step) except Exception as e: bot.reply_to(message, 'oooops')
Example #3
Source File: SiteAlert_bot.py From SiteAlert-Python with BSD 2-Clause "Simplified" License | 6 votes |
def addme(m): credentials = site_alert.execute_fetch_all("SELECT mail FROM Users WHERE telegram =?", (m.chat.id,)) if len(credentials) > 0: markup = types.ReplyKeyboardMarkup(one_time_keyboard=True) sites = site_alert.execute_fetch_all( "SELECT name FROM SiteAlert EXCEPT SELECT name FROM Registered, Users WHERE Registered.mail = Users.mail AND telegram = ? ORDER BY name COLLATE NOCASE", (m.chat.id,)) for site in sites: markup.add(site[0]) msg = tb.send_message(m.chat.id, "Ok, to...?", reply_markup=markup) tb.register_next_step_handler(msg, am) else: tb.send_message(m.chat.id, "You must be registered.\nUse /register")
Example #4
Source File: SiteAlert_bot.py From SiteAlert-Python with BSD 2-Clause "Simplified" License | 6 votes |
def link(m): markup = types.ReplyKeyboardMarkup(one_time_keyboard=True) sites = site_alert.execute_fetch_all("SELECT name FROM SiteAlert ORDER BY name COLLATE NOCASE", ()) for site in sites: markup.add(site[0]) msg = tb.send_message(m.chat.id, "Of which site?", reply_markup=markup) tb.register_next_step_handler(msg, lk)
Example #5
Source File: bot.py From ASMagic with GNU General Public License v3.0 | 6 votes |
def bkb(l) : markup = types.ReplyKeyboardMarkup(resize_keyboard=True) markup.row(ln(l,'back')) return markup # --- inline back keyboards needs in callback_query:| ---
Example #6
Source File: bot.py From TweenRoBot with MIT License | 6 votes |
def send_welcome(message): markup = types.ReplyKeyboardMarkup(one_time_keyboard=True) button = types.KeyboardButton(text='Share Location',request_location=True) button2 = types.KeyboardButton(text='Share Number',request_contact=True) markup.add(button, button2) bot.send_message(message.chat.id, 'Please Chose One :', reply_markup=markup) #################################################################################################################################################################################################
Example #7
Source File: test_types.py From pyTelegramBotAPI with GNU General Public License v2.0 | 6 votes |
def test_KeyboardButtonPollType(): markup = types.ReplyKeyboardMarkup() markup.add(types.KeyboardButton('send me a poll', request_poll=types.KeyboardButtonPollType(type='quiz'))) json_str = markup.to_json() assert 'request_poll' in json_str assert 'quiz' in json_str
Example #8
Source File: test_telebot.py From pyTelegramBotAPI with GNU General Public License v2.0 | 6 votes |
def test_send_message_with_markup_use_string(self): text = 'CI Test Message' tb = telebot.TeleBot(TOKEN) markup = types.ReplyKeyboardMarkup() markup.add("1") markup.add("2") markup.add("3") markup.add("4") ret_msg = tb.send_message(CHAT_ID, text, disable_notification=True, reply_markup=markup) assert ret_msg.message_id
Example #9
Source File: test_telebot.py From pyTelegramBotAPI with GNU General Public License v2.0 | 5 votes |
def test_send_message_with_markup(self): text = 'CI Test Message' tb = telebot.TeleBot(TOKEN) markup = types.ReplyKeyboardMarkup() markup.add(types.KeyboardButton("1")) markup.add(types.KeyboardButton("2")) ret_msg = tb.send_message(CHAT_ID, text, disable_notification=True, reply_markup=markup) assert ret_msg.message_id