diff --git a/olgram/commands/menu.py b/olgram/commands/menu.py index 3a76fc2..c359e10 100644 --- a/olgram/commands/menu.py +++ b/olgram/commands/menu.py @@ -185,7 +185,7 @@ async def send_bot_settings_menu(bot: Bot, call: types.CallbackQuery): if is_promo: olgram_turn = _("включена") if bot.enable_olgram_text else _("выключена") - text += _("Olgram подпись: {0}").format(olgram_turn) + text += _("Olgram подпись: {0}").format(olgram_turn) await edit_or_create(call, text, reply_markup=keyboard, parse_mode="HTML") @@ -428,6 +428,9 @@ async def callback(call: types.CallbackQuery, callback_data: dict, state: FSMCon if operation == "additional_info": await bot_actions.additional_info(bot, call) return await send_bot_settings_menu(bot, call) + if operation == "olgram_text": + await bot_actions.olgram_text(bot, call) + return await send_bot_settings_menu(bot, call) if operation == "reset_text": await bot_actions.reset_bot_text(bot, call) return await send_bot_text_menu(bot, call) diff --git a/olgram/commands/promo.py b/olgram/commands/promo.py index 0ab6c5c..1e6dd6a 100644 --- a/olgram/commands/promo.py +++ b/olgram/commands/promo.py @@ -29,6 +29,30 @@ async def new_promo(message: types.Message, state: FSMContext): await promo.save() +@dp.message_handler(commands=["delpromo"], state="*") +async def del_promo(message: types.Message, state: FSMContext): + """ + Команда /delpromo + """ + + if message.chat.id != OlgramSettings.supervisor_id(): + await message.answer(_("Недостаточно прав")) + return + + try: + uuid = UUID(message.get_args().strip()) + promo = await models.Promo.get_or_none(code=uuid) + except ValueError: + return await message.answer(_("Неправильный токен")) + + if not promo: + return await message.answer(_("Такого кода не существует")) + + await promo.delete() + + await message.answer(_("Промокод отозван")) + + @dp.message_handler(commands=["setpromo"], state="*") async def set_promo(message: types.Message, state: FSMContext): """