1
0
mirror of https://github.com/civsocit/olgram.git synced 2025-12-17 05:26:18 +00:00

#11 additional user info

This commit is contained in:
mihalin
2022-03-17 08:05:03 +03:00
parent 90997f5adb
commit 1779a5607d
5 changed files with 33 additions and 1 deletions

View File

@@ -74,3 +74,8 @@ async def select_chat(bot: Bot, call: types.CallbackQuery, chat: str):
async def threads(bot: Bot, call: types.CallbackQuery):
bot.enable_threads = not bot.enable_threads
await bot.save(update_fields=["enable_threads"])
async def additional_info(bot: Bot, call: types.CallbackQuery):
bot.enable_additional_info = not bot.enable_additional_info
await bot.save(update_fields=["enable_additional_info"])

View File

@@ -156,6 +156,11 @@ async def send_bot_settings_menu(bot: Bot, call: types.CallbackQuery):
callback_data=menu_callback.new(level=3, bot_id=bot.id, operation="threads",
chat=empty))
)
keyboard.insert(
types.InlineKeyboardButton(text="Дополнительная информация",
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=1, bot_id=bot.id, operation=empty,
@@ -163,8 +168,10 @@ 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 "выключена"
text = dedent(f"""
<a href="https://olgram.readthedocs.io/ru/latest/threads.html">Потоки сообщений</a>: <b>{thread_turn}</b>
<a href="https://olgram.readthedocs.io/ru/latest/threads.html">Потоки сообщений</a>: <b>{thread_turn}</b>\n
<a href="https://olgram.readthedocs.io/ru/latest/user_info.html">Дополнительная информация</a>: <b>{info_turn}</b>\n
""")
await edit_or_create(call, text, reply_markup=keyboard, parse_mode="HTML")
@@ -402,6 +409,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 == "additional_info":
await bot_actions.additional_info(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)