async def managing_courses_edit(callback: types.CallbackQuery): """Обработка кнопки назад""" user = DataBaseFunc.get_user(callback.from_user.id) await callback.message.edit_text( get_text(user, 'admin_menu_managing_courses'), reply_markup=AdminGenerateKeyboard.admin_menu_managing_courses(user)) await AdminStateMainMenu.managing_courses.set()
async def managing_courses_add_additionaly_cancel( callback: types.CallbackQuery, state: FSMContext): """Возвращает в менеджер управления подписками""" await state.reset_data() user = DataBaseFunc.get_user(callback.from_user.id) await callback.message.edit_text( get_text(user, 'admin_menu_managing_courses'), reply_markup=AdminGenerateKeyboard.admin_menu_managing_courses(user)) await AdminStateMainMenu.managing_courses.set()
async def managing_courses_delete_choose(callback: types.CallbackQuery): """Удаление конкретно выбранного курса""" await callback.answer() user = DataBaseFunc.get_user(callback.from_user.id) course = DataBaseFunc.get_course(int(callback.data[23:])) course.is_delete = True DataBaseFunc.commit() await callback.message.edit_text( get_text(user, 'admin_menu_managing_courses'), reply_markup=AdminGenerateKeyboard.admin_menu_managing_courses(user)) await AdminStateMainMenu.managing_courses.set()
async def managing_courses_add_additionaly_complete( callback: types.CallbackQuery, state: FSMContext): """Добавляет новый курс в базу данных""" user = DataBaseFunc.get_user(callback.from_user.id) data = await state.get_data() DataBaseFunc.create_new_course(data) channels = data["channels"] channels = [] await state.update_data(channels=channels) await callback.message.edit_text( get_text(user, 'admin_menu_managing_courses'), reply_markup=AdminGenerateKeyboard.admin_menu_managing_courses(user)) await AdminStateMainMenu.managing_courses.set()
async def admin_menu_managing_courses(callback: types.CallbackQuery): """Отправляет меню по управлению и настройке подписок администрацией бота""" await callback.answer() user = DataBaseFunc.get_user(callback.from_user.id) await callback.message.edit_text(get_text(user, 'admin_menu_managing_courses'), reply_markup=AdminGenerateKeyboard.admin_menu_managing_courses(user)) await AdminStateMainMenu.managing_courses.set()