29 lines
837 B
Python
29 lines
837 B
Python
import io
|
|
|
|
from aiogram import types
|
|
|
|
from load import dp, messages
|
|
from utils.database.market import Catalog
|
|
from keyboard.inline.catalog import item_list
|
|
|
|
|
|
@dp.callback_query_handler(lambda c: c.data.split("|")[0] in ["prev", "next"])
|
|
async def next_item(callback: types.CallbackQuery):
|
|
data = callback.data.split("|")
|
|
count = int(data[1])
|
|
items = Catalog.get_catalog()
|
|
item = items[count]
|
|
|
|
await callback.message.edit_media(
|
|
media=types.InputMediaPhoto(
|
|
media=io.BytesIO(item["image"]),
|
|
caption=messages.product_message.format(
|
|
name=item["name"],
|
|
description=item["description"],
|
|
price=item['price']
|
|
),
|
|
parse_mode="Markdown",
|
|
),
|
|
reply_markup=item_list(count, len(items)-1, int(data[2]))
|
|
)
|