This commit is contained in:
xds
2026-02-03 16:21:15 +03:00
parent cba813337e
commit e43cd575b0
3 changed files with 12 additions and 6 deletions

View File

@@ -50,18 +50,19 @@ async def new_char_bio(message: Message, state: FSMContext, dao: DAO, bot: Bot):
try:
# ВОТ ТУТ скачиваем файл (прямо перед сохранением)
# file_io = await bot.download(file_id)
file_io = await bot.download(file_id)
# photo_bytes = file_io.getvalue() # Получаем байты
# Создаем модель
char = Character(
id=None,
name=name,
# character_image=photo_bytes,
character_image_data=file_io.read(),
character_image_tg_id=None,
character_image_doc_tg_id=file_id,
character_bio=bio
)
file_io.close()
# Сохраняем через DAO
await dao.chars.add_character(char)