mirror of
https://github.com/civsocit/olgram.git
synced 2023-07-22 01:29:12 +03:00
возможность отзывать токен
This commit is contained in:
parent
e78b0c1150
commit
1c4ce35829
@ -185,7 +185,7 @@ async def send_bot_settings_menu(bot: Bot, call: types.CallbackQuery):
|
|||||||
|
|
||||||
if is_promo:
|
if is_promo:
|
||||||
olgram_turn = _("включена") if bot.enable_olgram_text else _("выключена")
|
olgram_turn = _("включена") if bot.enable_olgram_text else _("выключена")
|
||||||
text += _("Olgram подпись: {0}").format(olgram_turn)
|
text += _("Olgram подпись: <b>{0}</b>").format(olgram_turn)
|
||||||
|
|
||||||
await edit_or_create(call, text, reply_markup=keyboard, parse_mode="HTML")
|
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":
|
if operation == "additional_info":
|
||||||
await bot_actions.additional_info(bot, call)
|
await bot_actions.additional_info(bot, call)
|
||||||
return await send_bot_settings_menu(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":
|
if operation == "reset_text":
|
||||||
await bot_actions.reset_bot_text(bot, call)
|
await bot_actions.reset_bot_text(bot, call)
|
||||||
return await send_bot_text_menu(bot, call)
|
return await send_bot_text_menu(bot, call)
|
||||||
|
@ -29,6 +29,30 @@ async def new_promo(message: types.Message, state: FSMContext):
|
|||||||
await promo.save()
|
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="*")
|
@dp.message_handler(commands=["setpromo"], state="*")
|
||||||
async def set_promo(message: types.Message, state: FSMContext):
|
async def set_promo(message: types.Message, state: FSMContext):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user