def timeoff_command(update, context): user_id = update.effective_user.id groups = database.get_groups_admin(user_id) group_string = group_id_generator(groups) now = datetime.datetime.now() update.effective_message.reply_text(strings.TIMEOFF_COMMAND.format( group_string, now.strftime("%a - %H:%M")), parse_mode="HTML") context.user_data.update({"timeoff": True, "groups": groups, "now": now})
def settings(update, context): user_id = update.effective_user.id groups = database.get_groups_admin(user_id) buttons = [ InlineKeyboardButton(group.title, callback_data=f"settings_{group.id}") for group in groups ] update.effective_message.reply_text(strings.SETTINGS_COMMAND, reply_markup=InlineKeyboardMarkup( build_menu(buttons, 4))) context.user_data["groups"] = groups
def back(update, context): user_id = update.effective_user.id groups = database.get_groups_admin(user_id) buttons = [ InlineKeyboardButton(group.title, callback_data=f"settings_{group.id}") for group in groups ] update.callback_query.edit_message_text( strings.SETTINGS_COMMAND, reply_markup=InlineKeyboardMarkup(build_menu(buttons, 2)), ) context.user_data["groups"] = groups if "group" in context.user_data: del context.user_data["group"] update.callback_query.answer()