Files
ai-char-bot/keyboards.py
2026-02-02 23:08:47 +03:00

38 lines
1.6 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from aiogram.fsm.context import FSMContext
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from models.enums import AspectRatios, Quality, GenType
from repos.dao import DAO
def get_request_kb():
return InlineKeyboardMarkup(inline_keyboard=[
[InlineKeyboardButton(text="🔐 Запросить доступ", callback_data="req_access")]
])
def get_admin_decision_kb(user_id: int):
"""Кнопки для админа с ID пользователя в callback_data"""
return InlineKeyboardMarkup(inline_keyboard=[
[
InlineKeyboardButton(text="✅ Разрешить", callback_data=f"access_allow_{user_id}"),
InlineKeyboardButton(text="🚫 Запретить", callback_data=f"access_deny_{user_id}")
]
])
async def get_gen_mode_kb(state: FSMContext, dao: DAO):
data = await state.get_data()
char = await dao.chars.get_character(character_id=data['char_id'])
return InlineKeyboardMarkup(inline_keyboard=[
[
InlineKeyboardButton(text=f'Перс: {char.name}', callback_data=f'gen_mode_change_char'),
],
[
InlineKeyboardButton(text=f"🔁{AspectRatios[data['aspect_ratio']].value}", callback_data=f'gen_mode_change_aspect_ratio'),
InlineKeyboardButton(text=f"🔁{Quality[data['quality']].value}", callback_data=f'gen_mode_change_quality'),
InlineKeyboardButton(text=f"🔁{GenType[data['type']].value}",callback_data=f'gen_mode_change_type')
],
[
InlineKeyboardButton(text="❌ Выйти из режима генерации", callback_data=f'gen_mode_off'),
]
])