def callback_query(call): bot.answer_callback_query(call.id, "开始学习") bot.delete_message(call.message.chat.id, call.message.id) if call.data == "ALLUSER": bot.send_message(call.message.chat.id, "全部账号开始学习") pdl.start(None) else: bot.send_message(call.message.chat.id, call.data + " 开始学习") pdl.start(call.data)
def wechat_learn(msg: MessageInfo): """ 开始学习 """ uid = get_uid(msg.from_user_name) if not uid: msg: MessageInfo("您未绑定账号,请联系管理员绑定") else: pdl.start(uid)
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))
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)