本文整理汇总了Python中telebot.types.ReplyKeyboardMarkup方法的典型用法代码示例。如果您正苦于以下问题:Python types.ReplyKeyboardMarkup方法的具体用法?Python types.ReplyKeyboardMarkup怎么用?Python types.ReplyKeyboardMarkup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类telebot.types
的用法示例。
在下文中一共展示了types.ReplyKeyboardMarkup方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_age_step
# 需要导入模块: from telebot import types [as 别名]
# 或者: from telebot.types import ReplyKeyboardMarkup [as 别名]
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')
示例2: addme
# 需要导入模块: from telebot import types [as 别名]
# 或者: from telebot.types import ReplyKeyboardMarkup [as 别名]
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")
示例3: removeme
# 需要导入模块: from telebot import types [as 别名]
# 或者: from telebot.types import ReplyKeyboardMarkup [as 别名]
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")
示例4: link
# 需要导入模块: from telebot import types [as 别名]
# 或者: from telebot.types import ReplyKeyboardMarkup [as 别名]
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)
示例5: bkb
# 需要导入模块: from telebot import types [as 别名]
# 或者: from telebot.types import ReplyKeyboardMarkup [as 别名]
def bkb(l) :
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
markup.row(ln(l,'back'))
return markup
# --- inline back keyboards needs in callback_query:| ---
示例6: send_welcome
# 需要导入模块: from telebot import types [as 别名]
# 或者: from telebot.types import ReplyKeyboardMarkup [as 别名]
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)
#################################################################################################################################################################################################
示例7: test_KeyboardButtonPollType
# 需要导入模块: from telebot import types [as 别名]
# 或者: from telebot.types import ReplyKeyboardMarkup [as 别名]
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
示例8: test_send_message_with_markup
# 需要导入模块: from telebot import types [as 别名]
# 或者: from telebot.types import ReplyKeyboardMarkup [as 别名]
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
示例9: test_send_message_with_markup_use_string
# 需要导入模块: from telebot import types [as 别名]
# 或者: from telebot.types import ReplyKeyboardMarkup [as 别名]
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