Exemple #1
0
def learn_by_nick_name(nick_name):
    names = pdl.get_all_user_name()
    if len(names) <= 1:
        return web_log_and_resp_ok('请添加用户')
    else:
        names = pdl.get_all_user_name()
        for name in names:
            if nick_name == name:
                pdl.start(nick_name)
                return web_log_and_resp_ok('开始学习:{}'.format(nick_name))
Exemple #2
0
def learn():
    ''' 新线程无法操控内存数据库'''
    # web_db.session.add(WebMessage('新线程无法操控内存数据库'))
    # web_db.session.commit()
    # return resp_models_ok(WebMessage('新线程无法操控内存数据库'))
    names = pdl.get_all_user_name()
    if len(names) <= 1:
        return web_log_and_resp_ok('请添加用户')
    else:
        pdl.start(None)
        return web_log_and_resp_ok('全部账号开始学习:{}'.format(names))
def learn(message):
    params = message.text.split(" ")
    if len(params) > 1:
        pdl.start(params[1] if params[1] else None)
    else:
        names = pdl.get_all_user_name()
        if len(names) <= 1:
            pdl.start(None)
        else:
            markup = InlineKeyboardMarkup()
            boards = []
            for name in names:
                boards.append(InlineKeyboardButton(name, callback_data=name))
            boards.append(InlineKeyboardButton("全部", callback_data="ALLUSER"))
            markup.add(*boards)
            bot.send_message(message.chat.id,
                             "请选择开始学xi的账号:",
                             reply_markup=markup)