mirror of
https://github.com/civsocit/olgram.git
synced 2025-12-17 15:36:17 +00:00
#15 antiflood
This commit is contained in:
@@ -86,3 +86,8 @@ async def olgram_text(bot: Bot, call: types.CallbackQuery):
|
||||
if await bot.is_promo():
|
||||
bot.enable_olgram_text = not bot.enable_olgram_text
|
||||
await bot.save(update_fields=["enable_olgram_text"])
|
||||
|
||||
|
||||
async def antiflood(bot: Bot, call: types.CallbackQuery):
|
||||
bot.enable_antiflood = not bot.enable_antiflood
|
||||
await bot.save(update_fields=["enable_antiflood"])
|
||||
|
||||
@@ -162,6 +162,11 @@ async def send_bot_settings_menu(bot: Bot, call: types.CallbackQuery):
|
||||
callback_data=menu_callback.new(level=3, bot_id=bot.id, operation="additional_info",
|
||||
chat=empty))
|
||||
)
|
||||
keyboard.insert(
|
||||
types.InlineKeyboardButton(text=_("Антифлуд"),
|
||||
callback_data=menu_callback.new(level=3, bot_id=bot.id, operation="antiflood",
|
||||
chat=empty))
|
||||
)
|
||||
is_promo = await bot.is_promo()
|
||||
if is_promo:
|
||||
keyboard.insert(
|
||||
@@ -178,10 +183,12 @@ async def send_bot_settings_menu(bot: Bot, call: types.CallbackQuery):
|
||||
|
||||
thread_turn = _("включены") if bot.enable_threads else _("выключены")
|
||||
info_turn = _("включены") if bot.enable_additional_info else _("выключены")
|
||||
antiflood_turn = _("включен") if bot.enable_antiflood else _("выключен")
|
||||
text = dedent(_("""
|
||||
<a href="https://olgram.readthedocs.io/ru/latest/options.html#threads">Потоки сообщений</a>: <b>{0}</b>
|
||||
<a href="https://olgram.readthedocs.io/ru/latest/options.html#user-info">Данные пользователя</a>: <b>{1}</b>
|
||||
""")).format(thread_turn, info_turn)
|
||||
<a href="https://olgram.readthedocs.io/ru/latest/options.html#antiflood">Антифлуд</a>: <b>{2}</b>
|
||||
""")).format(thread_turn, info_turn, antiflood_turn)
|
||||
|
||||
if is_promo:
|
||||
olgram_turn = _("включена") if bot.enable_olgram_text else _("выключена")
|
||||
@@ -425,6 +432,9 @@ async def callback(call: types.CallbackQuery, callback_data: dict, state: FSMCon
|
||||
if operation == "threads":
|
||||
await bot_actions.threads(bot, call)
|
||||
return await send_bot_settings_menu(bot, call)
|
||||
if operation == "antiflood":
|
||||
await bot_actions.antiflood(bot, call)
|
||||
return await send_bot_settings_menu(bot, call)
|
||||
if operation == "additional_info":
|
||||
await bot_actions.additional_info(bot, call)
|
||||
return await send_bot_settings_menu(bot, call)
|
||||
|
||||
Reference in New Issue
Block a user