当前位置: 首页>>代码示例>>Python>>正文


Python types.ReplyKeyboardMarkup方法代码示例

本文整理汇总了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') 
开发者ID:eternnoir,项目名称:pyTelegramBotAPI,代码行数:18,代码来源:step_example.py

示例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") 
开发者ID:ilteoood,项目名称:SiteAlert-Python,代码行数:15,代码来源:SiteAlert_bot.py

示例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") 
开发者ID:ilteoood,项目名称:SiteAlert-Python,代码行数:15,代码来源:SiteAlert_bot.py

示例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) 
开发者ID:ilteoood,项目名称:SiteAlert-Python,代码行数:9,代码来源:SiteAlert_bot.py

示例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:| --- 
开发者ID:MagicNews,项目名称:ASMagic,代码行数:7,代码来源:bot.py

示例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)


################################################################################################################################################################################################# 
开发者ID:ThisIsAmir,项目名称:TweenRoBot,代码行数:11,代码来源:bot.py

示例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 
开发者ID:eternnoir,项目名称:pyTelegramBotAPI,代码行数:8,代码来源:test_types.py

示例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 
开发者ID:eternnoir,项目名称:pyTelegramBotAPI,代码行数:10,代码来源:test_telebot.py

示例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 
开发者ID:eternnoir,项目名称:pyTelegramBotAPI,代码行数:12,代码来源:test_telebot.py


注:本文中的telebot.types.ReplyKeyboardMarkup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。