當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。