python类ReplyKeyboardRemove()的实例源码

discab.py 文件源码 项目:UnivaqBot 作者: giacomocerquone 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def discab_news(bot, update, section):
    """Defining function that prints 5 news from discab given section"""

    news_to_string = ""
    for i, item in enumerate(utils.NEWS[section]):
        news_to_string += (str(i + 1) + ' - <a href="{link}">{title}</a>\n\n').format(**item)

    news_to_string += ('<a href="http://discab.univaq.it/index.php?id=2004">'
                       'Vedi le altre notizie</a> e attiva le notifiche con /newson per '
                       'restare sempre aggiornato')

    bot.sendMessage(update.message.chat_id,
                    parse_mode='HTML', disable_web_page_preview=True, text=news_to_string,
                    reply_markup=telegram.ReplyKeyboardRemove())

    return ConversationHandler.END
mesva.py 文件源码 项目:UnivaqBot 作者: giacomocerquone 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def mesva_news(bot, update, section):
    """Defining function that prints 5 news from mesva given section"""

    news_to_string = ""
    for i, item in enumerate(utils.NEWS[section]):
        news_to_string += (str(i + 1) + ' - <a href="{link}">{title}</a>\n\n').format(**item)

    news_to_string += ('<a href="http://mesva.univaq.it/">'
                       'Vedi le altre notizie</a> e attiva le notifiche con /newson per '
                       'restare sempre aggiornato')

    bot.sendMessage(update.message.chat_id,
                    parse_mode='HTML', disable_web_page_preview=True, text=news_to_string,
                    reply_markup=telegram.ReplyKeyboardRemove())

    return ConversationHandler.END
univaq.py 文件源码 项目:UnivaqBot 作者: giacomocerquone 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def inevidenza(bot, update):
    """Defining function that prints 5 news from in evidenza"""

    news_to_string = ""
    for i, item in enumerate(utils.NEWS['univaq'][0:5]):
        news_to_string += (str(i + 1) + ' - <a href="{link}">{title}</a>\n\n').format(**item)

    news_to_string += ('<a href="http://www.univaq.it">'
                       'Vedi le altre notizie</a> e attiva le notifiche con /newson per '
                       'restare sempre aggiornato')

    bot.sendMessage(update.message.chat_id,
                    parse_mode='HTML', disable_web_page_preview=True, text=news_to_string,
                    reply_markup=telegram.ReplyKeyboardRemove())

    return ConversationHandler.END
univaq.py 文件源码 项目:UnivaqBot 作者: giacomocerquone 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def ultimissime(bot, update):
    """Defining function that prints 5 news from ultimissime"""

    news_to_string = ""
    for i, item in enumerate(utils.NEWS['univaq'][5:10]):
        news_to_string += (str(i + 1) + ' - <a href="{link}">{title}</a>\n\n').format(**item)

    news_to_string += ('<a href="http://www.univaq.it">'
                       'Vedi le altre notizie</a> e attiva le notifiche con /newson per '
                       'restare sempre aggiornato')

    bot.sendMessage(update.message.chat_id,
                    parse_mode='HTML', disable_web_page_preview=True, text=news_to_string,
                    reply_markup=telegram.ReplyKeyboardRemove())

    return ConversationHandler.END
feedback.py 文件源码 项目:UnivaqBot 作者: giacomocerquone 项目源码 文件源码 阅读 38 收藏 0 点赞 0 评论 0
def send_to_developers(bot, update):
    """Function to send feedback to developers"""

    feedback_user = (('<b>{}</b>\n\n <i>{} {}, {}</i>')
                     .format(update.message.text,
                             update.message.from_user.first_name,
                             update.message.from_user.last_name,
                             update.message.chat_id))

    for admin in os.environ['ADMIN'].split(' '):
        bot.sendMessage(admin, feedback_user, parse_mode='HTML')

    bot.sendMessage(update.message.chat_id, 'Grazie per la collaborazione, '
                                            'il messaggio è stato inviato agli sviluppatori.',
                    reply_markup=telegram.ReplyKeyboardRemove())

    return ConversationHandler.END
raiwalletbot.py 文件源码 项目:RaiWalletBot 作者: SergiySW 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def hide_keyboard(bot, chat_id, text):
    reply_markup = ReplyKeyboardRemove()
    try:
        bot.sendMessage(chat_id=chat_id, text=text, reply_markup=reply_markup)
    except:
        sleep(1)
        bot.sendMessage(chat_id=chat_id, text=text, reply_markup=reply_markup)
bot7.py 文件源码 项目:simplebot 作者: korneevm 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def start_anketa(bot, update, user_data):
    update.message.reply_text("????????, ??? ??? ?????.", reply_markup=ReplyKeyboardRemove())
    return "name"
teamspeak.py 文件源码 项目:teamSpeakTelegram 作者: jossalgon 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
def cancel(bot, update):
    message = update.message
    bot.sendMessage(chat_id=message.chat_id, text=_('Global text has been cancelled.'),
                    reply_to_message_id=message.message_id, reply_markup=ReplyKeyboardRemove(selective=True))
    return ConversationHandler.END
manage_worker.py 文件源码 项目:vk-channelify 作者: reo7sp 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def new_in_state_asked_channel_access(bot, update):
    update.message.reply_text('??????. ????????? ????? ????????? ?? ??????', reply_markup=ReplyKeyboardRemove())
    return ASKED_CHANNEL_MESSAGE_IN_NEW
manage_worker.py 文件源码 项目:vk-channelify 作者: reo7sp 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def cancel_new(bot, update, users_state):
    update.message.reply_text('?????', reply_markup=ReplyKeyboardRemove())
    update.message.reply_text('??????? /new ???????? ????? ?????')

    del_state(update, users_state)
    return ConversationHandler.END
manage_worker.py 文件源码 项目:vk-channelify 作者: reo7sp 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def cancel_filter_by_hashtag(bot, update, users_state):
    update.message.reply_text('?????', reply_markup=ReplyKeyboardRemove())
    update.message.reply_text('????????? ?????? ?? ???????? ????? ???????? /filter_by_hashtag')
    update.message.reply_text('??????? /new ???????? ????? ?????')

    del_state(update, users_state)
    return ConversationHandler.END
manage_worker.py 文件源码 项目:vk-channelify 作者: reo7sp 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def cancel_recover(bot, update, users_state):
    update.message.reply_text('?????', reply_markup=ReplyKeyboardRemove())
    update.message.reply_text('??????? /new ???????? ????? ?????')

    del_state(update, users_state)
    return ConversationHandler.END
discab.py 文件源码 项目:UnivaqBot 作者: giacomocerquone 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def discabon(bot, update, section):
    """Defining the command to enable notification for discab"""

    if update.message.chat_id not in utils.USERS[section]:
        utils.subscribe_user(update.message.chat_id, section)
        bot.sendMessage(update.message.chat_id,
                        text='Notifiche Abilitate!',
                        reply_markup=telegram.ReplyKeyboardRemove())
    else:
        bot.sendMessage(update.message.chat_id,
                        text='Le notifiche sono già abilitate!',
                        reply_markup=telegram.ReplyKeyboardRemove())

    return ConversationHandler.END
discab.py 文件源码 项目:UnivaqBot 作者: giacomocerquone 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def discaboff(bot, update, section):
    """Defining the command to disable notification for discab"""

    if update.message.chat_id in utils.USERS[section]:
        utils.unsubscribe_user(update.message.chat_id, section)
        bot.sendMessage(update.message.chat_id,
                        text='Notifiche Disattivate!',
                        reply_markup=telegram.ReplyKeyboardRemove())
    else:
        bot.sendMessage(update.message.chat_id,
                        text='Per disattivare le notifiche dovresti prima attivarle.',
                        reply_markup=telegram.ReplyKeyboardRemove())

    return ConversationHandler.END
mesva.py 文件源码 项目:UnivaqBot 作者: giacomocerquone 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def mesvaon(bot, update, section):
    """Defining the command to enable notification for mesva"""

    if update.message.chat_id not in utils.USERS[section]:
        utils.subscribe_user(update.message.chat_id, section)
        bot.sendMessage(update.message.chat_id,
                        text='Notifiche Abilitate!',
                        reply_markup=telegram.ReplyKeyboardRemove())
    else:
        bot.sendMessage(update.message.chat_id,
                        text='Le notifiche sono già abilitate!',
                        reply_markup=telegram.ReplyKeyboardRemove())

    return ConversationHandler.END
disim.py 文件源码 项目:UnivaqBot 作者: giacomocerquone 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def disim(bot, update):
    """Defining the command to retrieve 5 news
    Now we store the last 10 news into the database,
    the comparison to send notifications is made between
    the last 5 pulled news from disim site and the news stored into the db.
    This decision was made to avoid repeated news, in fact, if some news(from first to fifth)
    is deleted the sixth(that now has become the fifth) news will be sent again even if it is
    already been sent in the past because it will appear in the pulled news and it
    is no more present into the database at the moment of the comparison.
    """

    news_to_string = ""
    for i, item in enumerate(utils.NEWS['disim'][0:5]):
        suffix = '...' if len(item['description']) > 75 else ''
        news_to_string += (str(i + 1) + ' - <a href="{link}">{title}</a>\n'
                           '\t<i>{description:.75}{}</i>\n\n').format(suffix, **item)

    news_to_string += ('<a href="http://www.disim.univaq.it/main/news.php?entrant=1">'
                       'Vedi le altre notizie</a> e attiva le notifiche con /newson per '
                       'restare sempre aggiornato')

    bot.sendMessage(update.message.chat_id,
                    parse_mode='HTML', disable_web_page_preview=True, text=news_to_string,
                    reply_markup=telegram.ReplyKeyboardRemove())

    return ConversationHandler.END
disim.py 文件源码 项目:UnivaqBot 作者: giacomocerquone 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def disimon(bot, update):
    """Defining the command to enable notification for disim"""

    if update.message.chat_id not in utils.USERS['disim']:
        utils.subscribe_user(update.message.chat_id, 'disim')
        bot.sendMessage(update.message.chat_id,
                        text='Notifiche Abilitate!',
                        reply_markup=telegram.ReplyKeyboardRemove())
    else:
        bot.sendMessage(update.message.chat_id,
                        text='Le notifiche sono già abilitate!',
                        reply_markup=telegram.ReplyKeyboardRemove())

    return ConversationHandler.END
disim.py 文件源码 项目:UnivaqBot 作者: giacomocerquone 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def disimoff(bot, update):
    """Defining the command to disable notification for disim"""

    if update.message.chat_id in utils.USERS['disim']:
        utils.unsubscribe_user(update.message.chat_id, 'disim')
        bot.sendMessage(update.message.chat_id,
                        text='Notifiche Disattivate!',
                        reply_markup=telegram.ReplyKeyboardRemove())
    else:
        bot.sendMessage(update.message.chat_id,
                        text='Per disattivare le notifiche dovresti prima attivarle.',
                        reply_markup=telegram.ReplyKeyboardRemove())

    return ConversationHandler.END
univaq.py 文件源码 项目:UnivaqBot 作者: giacomocerquone 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def univaqoff(bot, update):
    """Defining the command to disable notification for univaq"""

    if update.message.chat_id in utils.USERS['univaq']:
        utils.unsubscribe_user(update.message.chat_id, 'univaq')
        bot.sendMessage(update.message.chat_id,
                        text='Notifiche Disattivate!',
                        reply_markup=telegram.ReplyKeyboardRemove())

    else:
        bot.sendMessage(update.message.chat_id,
                        text='Per disattivare le notifiche dovresti prima attivarle.',
                        reply_markup=telegram.ReplyKeyboardRemove())

    return ConversationHandler.END
news_commands.py 文件源码 项目:UnivaqBot 作者: giacomocerquone 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def close(bot, update):
    """Defining Function for remove keyboard"""

    bot.sendMessage(update.message.chat_id,
                    'Ho chiuso le news!',
                    reply_markup=telegram.ReplyKeyboardRemove())

    return ConversationHandler.END
feedback.py 文件源码 项目:UnivaqBot 作者: giacomocerquone 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def close(bot, update):
    """Defining Function for remove keyboard"""

    bot.sendMessage(update.message.chat_id,
                    'Davvero non vuoi nemmeno salutarci? Che peccato...',
                    reply_markup=telegram.ReplyKeyboardRemove())

    return ConversationHandler.END
__init__.py 文件源码 项目:totally-not-jarvis 作者: lorey 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def process_asking(self, bot, update):
        if update.message.text == 'Yes':
            bot.send_message(chat_id=config.TELEGRAM_CHAT_ID, text='Starting to record notes for this meeting:',
                             reply_markup=telegram.ReplyKeyboardRemove())
            self.state = 'memo'
        elif update.message.text in ['No', 'Later']:
            bot.send_message(chat_id=config.TELEGRAM_CHAT_ID, text='Okay.', reply_markup=telegram.ReplyKeyboardRemove())
            self.is_done_ = True
        else:
            # didn't understand answer, ask again
            self.ask_if_desired(bot)
__init__.py 文件源码 项目:totally-not-jarvis 作者: lorey 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def process(self, bot, update):
        if update.message.text == 'Yes':
            print('Trying to send a mail')
            print(self.email.__dict__)
            send_email(self.email)
            bot.send_message(chat_id=update.message.chat_id, text='Okay, I have sent the mail successfully.',
                             reply_markup=telegram.ReplyKeyboardRemove())
        else:
            bot.send_message(chat_id=update.message.chat_id, text='Okay, I will not send a mail.',
                             reply_markup=telegram.ReplyKeyboardRemove())

        self.is_done_ = True
telegram_kraken_bot.py 文件源码 项目:Telegram-Kraken-Bot 作者: Endogen 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def trade_currency(bot, update, chat_data):
    chat_data["currency"] = update.message.text

    reply_msg = "Enter price per unit"
    reply_mrk = ReplyKeyboardRemove()

    update.message.reply_text(reply_msg, reply_markup=reply_mrk)
    return WorkflowEnum.TRADE_PRICE


# Save price per unit and choose how to enter the
# trade volume (euro, volume or all available funds)
telegram_kraken_bot.py 文件源码 项目:Telegram-Kraken-Bot 作者: Endogen 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def trade_vol_type(bot, update, chat_data):
    chat_data["vol_type"] = update.message.text

    reply_msg = "Enter volume"
    reply_mrk = ReplyKeyboardRemove()

    update.message.reply_text(reply_msg, reply_markup=reply_mrk)
    return WorkflowEnum.TRADE_VOLUME


# Volume type 'ALL' chosen - meaning that
# all available EURO funds will be used
telegram_kraken_bot.py 文件源码 项目:Telegram-Kraken-Bot 作者: Endogen 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def funding_withdraw(bot, update):
    update.message.reply_text("Enter target wallet name", reply_markup=ReplyKeyboardRemove())

    return WorkflowEnum.WITHDRAW_WALLET
telegram_kraken_bot.py 文件源码 项目:Telegram-Kraken-Bot 作者: Endogen 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def shutdown_cmd(bot, update):
    update.message.reply_text("Shutting down...", reply_markup=ReplyKeyboardRemove())

    # See comments on the 'shutdown' function
    threading.Thread(target=shutdown).start()


# Restart this python script
telegram_kraken_bot.py 文件源码 项目:Telegram-Kraken-Bot 作者: Endogen 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def restart_cmd(bot, update):
    update.message.reply_text("Bot is restarting...", reply_markup=ReplyKeyboardRemove())

    time.sleep(0.2)
    os.execl(sys.executable, sys.executable, *sys.argv)


# Get current settings
testcases.py 文件源码 项目:django-telegram-bot 作者: jlmadurga 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def assertBotResponse(self, mock_send, command):
        args, kwargs = mock_send.call_args
        self.assertEqual(1, mock_send.call_count)
        self.assertEqual(kwargs['chat_id'], self.update.message.chat.id)
        self.assertEqual(kwargs['parse_mode'], command['out']['parse_mode'])
        if not command['out']['reply_markup']:
            self.assertTrue(isinstance(kwargs['reply_markup'], ReplyKeyboardRemove))
        else:
            self.assertInKeyboard(command['out']['reply_markup'], kwargs['reply_markup'].keyboard)
        if not PY3:
            kwargs['text'] = kwargs['text'].decode('utf-8')
        self.assertIn(command['out']['text'], kwargs['text'])
responses.py 文件源码 项目:django-telegram-bot 作者: jlmadurga 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def render(self):
        keyboard = super(KeyboardResponse, self).render()
        if keyboard:
            keyboard = ast.literal_eval(keyboard)
            keyboard = ReplyKeyboardMarkup(keyboard, resize_keyboard=True)
        else:
            keyboard = ReplyKeyboardRemove()
        return keyboard


问题


面经


文章

微信
公众号

扫码关注公众号