def get_my_group_schedule(bot, update, user_data): group_id = api_calls.get_user_group_id(update.message.chat_id) if group_id == -1: bot.send_message( chat_id=update.message.chat_id, text=bot_messages.get_my_group_schedule_failure_response) else: user_data['block_id'] = str(group_id) user_data['requested_type'] = 'group' user_data['is_search'] = '' text = 'Select the day:' reply_markup = InlineKeyboardMarkup( api_calls.get_days(str(group_id), 'group')) bot.send_message(chat_id=update.message.chat_id, text=text, reply_markup=reply_markup, parse_mode=telegram.ParseMode.HTML)
def get_teacher_days_callback_query(bot, update, user_data): text = 'Select the day:' msg = update.callback_query.data teacher_id = msg[7:] user_data['block_id'] = teacher_id user_data['requested_type'] = 'teacher' user_data['is_search'] = '' department_id = user_data['department_id'] reply_markup_raw = api_calls.get_days(teacher_id, 'teacher') reply_markup_raw.append([ InlineKeyboardButton('<<', callback_data='department' + department_id) ]) reply_markup = InlineKeyboardMarkup(reply_markup_raw) edit_message_with_reply_markup(bot, update, text, reply_markup)
def get_group_days_callback_query(bot, update, user_data): text = 'Select the day:' msg = update.callback_query.data block_id = msg[5:] user_data['block_id'] = block_id user_data['requested_type'] = 'group' user_data['is_search'] = '' specialty_id = -1 try: specialty_id = user_data['specialty_id'] except Exception as e: logger.debug("specialty_id not found") reply_markup_raw = api_calls.get_days(block_id, 'group') if specialty_id != -1: reply_markup_raw.append([ InlineKeyboardButton('<<', callback_data='specialty' + specialty_id) ]) reply_markup = InlineKeyboardMarkup(reply_markup_raw) edit_message_with_reply_markup(bot, update, text, reply_markup)
def get_search_callback_query(bot, update, user_data): text = 'Select the day:' msg = update.callback_query.data searched_type = msg[6:] print(searched_type) block_id = '' requested_type = '' if 'group' in searched_type: block_id = searched_type[5:] requested_type = 'group' elif 'teacher' in searched_type: block_id = searched_type[7:] requested_type = 'teacher' elif 'room' in searched_type: block_id = searched_type[4:] requested_type = 'room' user_data['block_id'] = block_id user_data['requested_type'] = requested_type user_data['is_search'] = 'search' search_text = user_data['search_text'] reply_markup_raw = api_calls.get_days(block_id, requested_type) reply_markup_raw.append([ InlineKeyboardButton('<<', callback_data='search_options_menu' + search_text) ]) reply_markup = InlineKeyboardMarkup(reply_markup_raw) edit_message_with_reply_markup(bot, update, text, reply_markup)