Настройки самого бота
This commit is contained in:
48
bot/handlers/commands/settings/settings_cmd.py
Normal file
48
bot/handlers/commands/settings/settings_cmd.py
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
from aiogram import Router, F
|
||||||
|
from aiogram.filters import Command
|
||||||
|
from aiogram.fsm.context import FSMContext
|
||||||
|
from aiogram.types import Message, CallbackQuery, InlineKeyboardButton
|
||||||
|
from aiogram.utils.i18n import gettext as _
|
||||||
|
from aiogram.utils.keyboard import InlineKeyboardBuilder
|
||||||
|
|
||||||
|
from bot.core.bots import BotInfo
|
||||||
|
from bot.filters import IsOwner
|
||||||
|
from bot.templates import msg
|
||||||
|
from bot.utils import status_clear
|
||||||
|
from configs import COMMANDS
|
||||||
|
|
||||||
|
# Настройки экспорта и роутера
|
||||||
|
__all__ = ("router", "settings_keyboard",)
|
||||||
|
CMD: str = "botsettings".lower()
|
||||||
|
router: Router = Router(name=f"{CMD}_cmd_router")
|
||||||
|
|
||||||
|
|
||||||
|
def settings_keyboard() -> InlineKeyboardBuilder:
|
||||||
|
"""Клавиатура настроек"""
|
||||||
|
ikb: InlineKeyboardBuilder = InlineKeyboardBuilder()
|
||||||
|
ikb.row(InlineKeyboardButton(text="🔙 Вернуться", callback_data="settings"))
|
||||||
|
return ikb
|
||||||
|
|
||||||
|
|
||||||
|
@router.callback_query(F.data.lower() == CMD, IsOwner())
|
||||||
|
@router.message(Command(*COMMANDS[CMD], prefix=BotInfo.prefix, ignore_case=True), IsOwner())
|
||||||
|
async def settings_cmd(message: Message | CallbackQuery, state: FSMContext) -> None:
|
||||||
|
"""Обработчик команды /settings"""
|
||||||
|
await status_clear(update=message, state=state)
|
||||||
|
|
||||||
|
# Создание инлайн-клавиатуры
|
||||||
|
ikb: InlineKeyboardBuilder = InlineKeyboardBuilder()
|
||||||
|
ikb.row(InlineKeyboardButton(text="Имя бота⚜️", callback_data='set_name'))
|
||||||
|
ikb.row(InlineKeyboardButton(text="Описание бота📝", callback_data='set_description'))
|
||||||
|
ikb.row(InlineKeyboardButton(text="Виджет🧩", callback_data='set_widget'))
|
||||||
|
ikb.row(InlineKeyboardButton(text="Назад◀️", callback_data='menu'))
|
||||||
|
|
||||||
|
# Формируем приветственное сообщение
|
||||||
|
text: str = _("""
|
||||||
|
⚙️ Настройки
|
||||||
|
"""
|
||||||
|
).format(
|
||||||
|
)
|
||||||
|
|
||||||
|
# Отправляем сообщение
|
||||||
|
await msg(update=message, text=text, markup=ikb, state=state)
|
||||||
Reference in New Issue
Block a user