STT_Standin.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:TelegramBots 作者: d-qoi 项目源码 文件源码
def chooseLanguage(bot, update, chat_data, args):
    TRACKING.total.post()
    if not checkValidCommand(update.message.text, bot.username):
        return
    logger.info("Choose language received")
    if args:
        for key in LANGUAGES:
            for lang in LANGUAGES[key]:
                if lang[0] == args[0]:
                    reply_text = 'Set language to: %s' % args[0]
                    update.message.reply_text(reply_text)
                    chat_data['lang'] = args[0]

                    return

    chat_data['choosing'] = True
    logger.debug("Starting choose language inline mess")
    reply_text = "Please choose your language, or the closest.\n"
    if not 'lang' in chat_data:
        reply_text += "Current language selected: en-US"
        chat_data['lang'] = 'en-US'

    chat_data['langlist'] = sorted(LANGUAGES.keys())
    keyboard = InlineKeyboardMarkup(updateKeyboard(chat_data))
    update.message.reply_text(reply_text, reply_markup=keyboard, quote=False)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号