Esempio n. 1
0
async def items_handler(call: CallbackQuery, state: FSMContext):
    data = await state.get_data()
    cart = data.get('cart')
    print(cart)
    if call.data == 'right':
        await bot.answer_callback_query(call.id)
        i = data.get('i')
        if i != len(cart) - 1:
            i = i + 1
            items_kb = await kb.cart_keyboard(cart, len(cart), i)
            await call.message.edit_media(
                media=InputMediaPhoto(
                    media=cart[i].product.photo_url,
                    caption=f'<b>{cart[i].product.name} {cart[i].size}.{cart[i].quantity}шт'
                            f' {cart[i].price * cart[i].quantity}</b>'),
                reply_markup=items_kb
            )
            await state.update_data(i=i)
    if call.data == 'left':
        await bot.answer_callback_query(call.id)
        i = data.get('i')
        if i != 0:
            i = i-1
            items_kb = await kb.cart_keyboard(cart, len(cart), i)
            await call.message.edit_media(
                media=InputMediaPhoto(
                    media=cart[i].product.photo_url,
                    caption=f'<b>{cart[i].product.name} {cart[i].size}.{cart[i].quantity}шт'
                            f' {cart[i].price * cart[i].quantity}</b>'),
                reply_markup=items_kb
            )
            await state.update_data(i=i)
Esempio n. 2
0
async def get_image_input_file(name: str, caption: str):
    file_id = await file_id_storage.get_file_id(name)
    if file_id is None:
        image_url = "{}/{}/{}".format(config.host, config.img_path, name)
        image_response = requests.get(image_url)
        assert image_response.status_code == 200, "Image is not found!"
        image = io.BytesIO(image_response.content)
        input_file = InputFile(image, name)
        input_media_photo = InputMediaPhoto(input_file, caption=caption)
    else:
        input_media_photo = InputMediaPhoto(file_id, file_id, caption)
    return input_media_photo
Esempio n. 3
0
async def vk_timer():
    # TODO: REWRITE: Add support of music

    for feed in VK_FEEDS:
        feed_id = feed["feed_id"]
        posts = await vk_api.wall.get(domain=feed_id, count=5)

        for item in posts["items"][::-1]:
            links = []
            feeds = list(Feed.select().where(Feed.id == feed_id))

            if len(feeds) == 0:
                Feed.save(feed_id, item["id"])
            else:
                if item["id"] in json.loads(feeds[0].links):
                    continue
                else:
                    Feed.save(feed_id, item["id"])

            try:
                attachments = item["attachments"]
            except Exception:
                attachments = []

            for attachment in attachments:
                if attachment["type"] == "photo":
                    url = get_max_photosize(attachment["photo"])
                    links.append(url)

                elif attachment["type"] == "video":
                    url = get_max_photosize(attachment["video"])
                    links.append(url)

            if len(links) == 1:
                await bot.send_photo(feed["chat_id"], links[0],
                                     cuteCrop(item["text"], 1000))

            elif len(links) > 1:
                photos = []

                for link in links:
                    photos.append(InputMediaPhoto(link))

                if item["text"] != "":
                    photos[0] = InputMediaPhoto(links[0],
                                                cuteCrop(item["text"], 1000))

                await bot.send_media_group(feed["chat_id"], photos)

            elif item["text"] != "":
                await bot.send_message(feed["chat_id"],
                                       cuteCrop(item["text"], 4096))
Esempio n. 4
0
async def vk_timer():
    for channel in VK_CHANNELS:
        channelid = channel["channelid"]
        posts = await vk_api.wall.get(domain=channelid, count=5)

        for item in posts["items"][::-1]:
            links = []

            channels = await videos.select(where=f"{channelid = }")

            if len(channels) == 0:
                await videos.save(channelid, item["id"])
            else:
                if item["id"] in json.loads(channels[0][1]):
                    continue
                else:
                    await videos.save(channelid, item["id"])

            try:
                attachments = item["attachments"]
            except Exception:
                attachments = []

            for attachment in attachments:
                if attachment["type"] == "photo":
                    url = get_max_photosize(attachment["photo"])
                    links.append(url)

                elif attachment["type"] == "video":
                    url = get_max_photosize(attachment["video"])
                    links.append(url)

            if len(links) == 1:
                await bot.send_photo(channel["chatid"], links[0],
                                     cuteCrop(item["text"], 1000))

            elif len(links) > 1:
                photos = []

                for link in links:
                    photos.append(InputMediaPhoto(link))

                if item["text"] != "":
                    photos[0] = InputMediaPhoto(links[0],
                                                cuteCrop(item["text"], 1000))

                await bot.send_media_group(channel["chatid"], photos)

            elif item["text"] != "":
                await bot.send_message(channel["chatid"],
                                       cuteCrop(item["text"], 4096))
Esempio n. 5
0
async def config_crop_range(msg: Message, state: FSMContext):
    user = msg.from_user
    crop_range_str = msg.text

    if not crop_range_str.replace(
            " ", "").isdecimal() or len(crop_range_str.split(" ")) != 3:
        await msg.answer(
            "Вводить диапазон нужно тремя целыми числами, через пробел 🥴\n"
            "<i>Пример ввода: 300 470 1150</i>")
        return
    elif len(crop_range_str) > 25:
        await msg.answer(
            "Какие-то очень большие размеры для обрезания картинки 🥴\n"
            "На самой первой тестовой картинке отмечены границы высоты зелённой линией."
        )

    crop_range = [int(num) for num in crop_range_str.split(" ")]
    crop_range.sort()

    photo_id: str = await redis_commands.get_photo_id(user.id)
    await msg.bot.send_chat_action(user.id, "upload_photo")

    img_file = BytesIO()
    photo = await msg.bot.get_file(photo_id)
    await photo.download(destination=img_file)

    word_img, transl_img = await get_separated_imgs(img_file, *crop_range)

    if not word_img:
        await msg.answer(
            "Ты задал(-а) дипазон, который выходит за пределы размера картинки 🥴\n"
            "На картинке с зелённой линией показаны допустимые для тебя значения высоты."
        )
        return

    separated_imgs_album = MediaGroup()
    separated_imgs_album.attach_many(InputMediaPhoto(word_img),
                                     InputMediaPhoto(transl_img))

    await state.update_data(crop_range=crop_range)

    await msg.answer_media_group(separated_imgs_album)
    await msg.answer(
        "Если фотографии обрезалась не корректно, то введи "
        "диапозон высот ещё раз.",
        reply_markup=keyboards.default.create_set_menu)

    logging.info(f"@{user.username}-{user.id} read crop_range {crop_range}")
Esempio n. 6
0
async def get_work_examples(message: types.Message, state: FSMContext):
    """Отправляем последние 5 фотографий и ссылку на инстаграм"""
    await reset_state(state, message)
    recent_photos = await db.get_instagram_pictures()
    media = [InputMediaPhoto(photo_url) for photo_url in recent_photos]
    await bot.send_media_group(message.from_user.id, media)
    await message.answer(more_photo, reply_markup=menu_keyboard)
Esempio n. 7
0
async def know_word(call: CallbackQuery, state: FSMContext):
    msg = call.message
    user = call.from_user

    try:
        async with state.proxy() as data:
            word_id = int(data["word_ids"].pop(0))
        word = dict(await db.get_word_side(word_id))

        await msg.edit_media(
            InputMediaPhoto(word.pop("word_img_id")),
            reply_markup=keyboards.inline.get_word_menu(word=word)
        )
    except IndexError:
        await msg.delete()
        await msg.answer(
            "Поздравляю! Теперь ты знаешь этот набор.",
            reply_markup=keyboards.default.get_bot_menu()
        )
        await msg.answer_sticker("CAACAgIAAxkBAAEIu69gVLjRs19x-GQrM1RvAjXPc9HFXAACHQADwDZPE17YptxBPd5IHgQ")

        data = await state.get_data()
        await schedule_repeat(user.id, data["set_id"], data["set_name"])

        await state.finish()
        return

    await call.answer()

    logging.info(f"@{user.username}-{user.id} know word -- {word_id}")
Esempio n. 8
0
async def reload_transl_side(word_id: int, user_id: int, learn_words_msg_id: int):
    word = dict(await db.get_transl_side(word_id))
    await bot.edit_message_media(
        InputMediaPhoto(word.pop("transl_img_id"), caption=word.pop("assoc")),
        chat_id=user_id, message_id=learn_words_msg_id,
        reply_markup=keyboards.inline.get_word_menu(word=word, side="word")
    )
Esempio n. 9
0
async def prev_or_next(query: types.CallbackQuery, state: FSMContext, *args,
                       **kwargs):
    current_item_id = (await state.get_data()).get('item_id')
    first_item = await sync_to_async(Item.objects.first)()
    last_item = await sync_to_async(Item.objects.last)()
    while True:
        current_item_id = current_item_id - 1 if query.data == 'previous' else current_item_id + 1
        try:
            item = await sync_to_async(Item.objects.get)(id=current_item_id)
            if not item.disabled:
                break
        except Item.DoesNotExist:
            if (current_item_id < first_item.id and query.data == 'previous') or \
                    (current_item_id > last_item.id and query.data == 'next'):
                await query.answer('Reached the end of list')
                return

    await query.message.edit_media(InputMediaPhoto(
        item.photo_file_id,
        caption=replies.ITEM_DESCRIPTION.format(name=item.name,
                                                description=item.description,
                                                price=(item.price /
                                                       100_000_000))),
                                   reply_markup=keyboards.shop_keyboard)
    await state.update_data(item_id=item.id)
    await query.answer()
Esempio n. 10
0
async def show_current_page(call: CallbackQuery, callback_data: dict):
    await call.answer(cache_time=2)
    current_page=int(callback_data.get("page"))
    photo = get_page(array=Leninsky_photo,page=current_page)
    media=InputMediaPhoto(media=open(photo_db.get_one_file_name(name=photo),'rb'))
    markup=get_page_keyboard(k="len",max=max_len,page=current_page)
    await call.message.edit_media(media= media, reply_markup=markup)
Esempio n. 11
0
async def process_callback(callback_query: types.CallbackQuery,
                           state: FSMContext):
    print('кнопка вперед нажата')
    data = await state.get_data()
    print('каталог шаг = ' + str(data['catalog_step']))
    prewbtn = True
    nextbtn = True
    if int(data['catalog_step']) == 0:
        prewbtn = False
        await callback_query.message.edit_reply_markup(
            reply_markup=keyboards.get_catalog_interactive_ikeyb(
                prewbtn, nextbtn, bool(data['isopisopen'])))
        return
    else:
        if int(data['catalog_step']) - 1 == 0:
            prewbtn = False
        pos = fastdb.CATALOG_BUFFER.get_pos(data['catalog_fsection'],
                                            data['catalog_step'] - 1)
        await callback_query.message.edit_media(
            media=InputMediaPhoto(media=pos.cap,
                                  caption=format_text_tocatpos(
                                      pos, bool(data['isopisopen']))),
            reply_markup=keyboards.get_catalog_interactive_ikeyb(
                prewbtn, nextbtn, bool(data['isopisopen'])))
        await state.update_data(catalog_step=data['catalog_step'] - 1)
Esempio n. 12
0
async def schedule_trigger():
    while True:
        now = datetime.now()
        now = now.replace(second=0, microsecond=0)
        for story in Story.select().where(Story.scheduled_datetime == now,
                                          Story.prod_message_id == None):
            img_links = json.loads(story.img_links)

            if len(img_links) == 1:
                response = await bot.send_photo(MEMOTRON_CHANNEL,
                                                photo=img_links[0],
                                                caption=story.title)

            elif len(img_links) > 1:
                medias = [InputMediaPhoto(url) for url in img_links]
                if len(medias) > 10:  # TG limit
                    return

                response = await bot.send_media_group(MEMOTRON_CHANNEL, medias)
                response = response[0]
            else:
                response = await bot.send_message(MEMOTRON_CHANNEL,
                                                  text=story.text)
            logger.info(response)
            story.prod_message_id = response['message_id']
            story.save()

            await sleep(1)
        await sleep(1)
Esempio n. 13
0
 def prepare_message(cls,
                     msg_data: dict) -> Dict[str, Union[list, dict, bool]]:
     """
     TODO: check if items len > 10
     FIXME: photo with video not sending
     :param msg_data:
     :return:
     """
     media_message = {"text": None, "has_poll": False, "media_data": []}
     media, text_message = msg_data.get("media"), msg_data.get("text")
     if text_message:
         media_message.update({"text": text_message})
     if media:
         if "videos" in media:
             # media_message["media_data"].extend([InputMediaVideo(video) for video in media["videos"]])
             return None
         if "photos" in media:
             media_message["media_data"].extend(
                 [InputMediaPhoto(photo) for photo in media["photos"]])
         if "poll" in media:
             media_message.update({
                 "has_poll": True,
                 "poll_data": dict(media["poll"])
             })
         if media_message["media_data"]:
             media_message["media_data"][0].caption = text_message
     return media_message
Esempio n. 14
0
async def select_style(call: CallbackQuery, callback_data: dict, state: FSMContext):
    '''
    Navigates the 21 style options
    '''
    name = callback_data.get('name')
    await call.message.edit_media(InputMediaPhoto(open(f'stylization_mode/style_images/{name}.jpg', 'rb')),
                                  reply_markup=style_menu[name])
    async with state.proxy() as data:
        data['style_path'] = f'stylization_mode/style_images/{name}.jpg'
Esempio n. 15
0
def get_media_obj(enroll_complete, file_type, file_id, caption):
    if enroll_complete:
        if file_type == 'photo':
            obj = InputMediaPhoto(file_id, caption=caption)
        else:
            obj = InputMediaDocument(file_id, caption=caption)
    else:
        obj = InputMediaDocument(kitty, caption=caption)
    return obj
Esempio n. 16
0
async def edit_cart(call, cart, i=0):
    cart_product = cart.get_products()
    kb = await cart_kb(cart, cart_product.count(), i)
    await call.message.edit_media(media=InputMediaPhoto(
        media=settings.URL + cart_product[i].product.image.url,
        caption=f'<b>{cart_product[i].product.title}\n'
        f'{cart_product[i].product.description}.\n\n'
        f'{cart_product[i].quantity} шт.\n\n'
        f'{cart_product[i].product.price} руб.</b>'),
                                  reply_markup=kb)
Esempio n. 17
0
async def process(message: types.Message, state: FSMContext):
    await bot.send_chat_action(message.from_user.id, ChatActions.TYPING)

    art_list = message.text.split()
    for art in art_list:
        if art.isdigit() and len(art) % 6 == 0:
            continue
        else:
            await state.finish()
            return await message.answer('Неверно введены артикулы!')

    async with state.proxy() as data:
        try:
            for art in art_list:
                data['art_list'].append(art)
            print(data['art_list'])
        except KeyError:
            data['art_list'] = art_list
        data['current_art'] = art_list[0]
        data['message'] = message
        current_art = art_list[0]

    answer, images = parse(current_art)

    async with state.proxy() as data:
        data[f'article:{current_art}'] = current_art
        data[f'images:{current_art}'] = images
        data[f'count:{current_art}'] = 1
        data[f'price:{current_art}'] = 0

    count = 1
    price = 0
    answer += bold(f'\nКоличество: {count}\nЦена продажи: {price}р')

    async with state.proxy() as data:
        data[f'title:{current_art}'] = answer

    media = []

    for img in images:
        media.append(InputMediaPhoto(img))

    await bot.send_media_group(
        message.from_user.id,
        media,
        reply_to_message_id=message.message_id,
    )

    await bot.send_message(
        message.from_user.id,
        text=emojize(answer),
        reply_markup=kb.inline_kb1,
    )
Esempio n. 18
0
async def next_prod(call: CallbackQuery, state: FSMContext):
    await call.answer('Ищу следующий товар...')

    async with state.proxy() as data:
        current_art = data['current_art']
        art_list = data['art_list']
        message = data['message']
        index = art_list.index(current_art)
        try:
            current_art = data['current_art'] = art_list[index + 1]
        except IndexError:
            return await bot.send_message(
                message.from_user.id,
                text='Артикулы обработаны. '
                'Вы можете:',
                reply_markup=kb.inline_finalize,
            )

    await bot.send_chat_action(message.from_user.id, ChatActions.TYPING)

    await Stage.Q1.set()

    answer, images = parse(current_art)

    async with state.proxy() as data:
        data[f'article:{current_art}'] = current_art
        data[f'images:{current_art}'] = images
        data[f'count:{current_art}'] = 1
        data[f'price:{current_art}'] = 0

    count = 1
    price = 0
    answer += bold(f'\nКоличество: {count}\nЦена продажи: {price}р')

    async with state.proxy() as data:
        data[f'title:{current_art}'] = answer

    media = []

    for img in images:
        media.append(InputMediaPhoto(img))

    await bot.send_media_group(
        message.from_user.id,
        media,
        reply_to_message_id=message.message_id,
    )

    await bot.send_message(
        message.from_user.id,
        text=emojize(answer),
        reply_markup=kb.inline_kb1,
    )
Esempio n. 19
0
async def prepare_media(links: Collection[str]):
    media = []
    for link in links:
        file_url = URL(link)
        file_name = Path(file_url.name)
        if file_name.suffix == '.webp':
            webp_file_path = await download_file(link)
            png_file_path = webp_to_png(webp_file_path)

            file = open(png_file_path, 'rb')
            input_media = InputMediaPhoto(file)
            media.append(input_media)

            webp_file_path.unlink()
            png_file_path.unlink()
        else:
            media.append(InputMediaPhoto(link))

        if len(media) == 10:
            return media

    return media
Esempio n. 20
0
async def change_side(call: CallbackQuery, state: FSMContext, callback_data: dict):
    msg = call.message
    user = call.from_user
    side = callback_data["side"]
    word_id = int(callback_data["word_id"])

    if side == "word":
        word = dict(await db.get_transl_side(word_id))
        await msg.edit_media(
            InputMediaPhoto(word.pop("transl_img_id"), caption=word.pop("assoc")),
            reply_markup=keyboards.inline.get_word_menu(word=word, side=side)
        )
    elif side == "transl":
        word = dict(await db.get_word_side(word_id))
        await msg.edit_media(
            InputMediaPhoto(word.pop("word_img_id")),
            reply_markup=keyboards.inline.get_word_menu(word=word, side=side)
        )

    await call.answer()

    logging.info(f"@{user.username}-{user.id} change side of the word -- {word_id}")
Esempio n. 21
0
 async def sendSingleGroup(self,
                           imgs: List[Image],
                           caption: str,
                           chat_id: int,
                           reply_to: Optional[int] = None):
     await self.send_chat_action(chat_id, ChatActions.UPLOAD_PHOTO)
     media = list()
     for img in imgs:
         media.append(InputMediaPhoto(await img.display_url()))  # TODO
     media[0].caption = caption
     await self.send_media_group(chat_id,
                                 media,
                                 reply_to_message_id=reply_to)
Esempio n. 22
0
async def some_chosen_inline_handler(chosen_inline_query: ChosenInlineResult):
    txt = chosen_inline_query.query[3:]  # Обрезаем "qr"

    voidInlineKeyboard = inline_keyboard.InlineKeyboardMarkup()

    qrCodePath = createQR(txt)
    imgID = await uploadInputFileToTelegram(qrCodePath, bot=bot)

    await bot.edit_message_reply_markup(
        reply_markup=voidInlineKeyboard,
        inline_message_id=chosen_inline_query.inline_message_id)

    await bot.edit_message_media(
        media=InputMediaPhoto(media=imgID),
        inline_message_id=chosen_inline_query.inline_message_id)

    remove(qrCodePath)
Esempio n. 23
0
async def dont_know_word(call: CallbackQuery, state: FSMContext, callback_data: dict):
    msg = call.message
    user = call.from_user
    unknown_word_id = int(callback_data["word_id"])

    async with state.proxy() as data:
        data["word_ids"].append(unknown_word_id)
        word_id = data["word_ids"].pop(0)
    word = dict(await db.get_word_side(word_id))

    await msg.edit_media(
        InputMediaPhoto(word.pop("word_img_id")),
        reply_markup=keyboards.inline.get_word_menu(word=word)
    )

    await call.answer()

    logging.info(f"@{user.username}-{user.id} dont know word -- {unknown_word_id}")
Esempio n. 24
0
async def callback_handler(callback: CallbackQuery):
    chat = Chat.get_by_callback(callback)
    chat.last_crack = datetime.now()
    chat.save()
    logger.info(callback)

    with open('./assets/glove/snap.gif', 'rb') as file:
        await bot.edit_message_media(chat_id=chat.id,
                                     message_id=callback.message.message_id,
                                     media=InputMediaAnimation(file))

    await sleep(2.9)
    with open('./assets/glove/glove180.png', 'rb') as file:
        await bot.edit_message_media(chat_id=chat.id,
                                     message_id=callback.message.message_id,
                                     media=InputMediaPhoto(file))

    await sleep(3)
Esempio n. 25
0
async def see_product(call: CallbackQuery, callback_data: dict):
    item = str(callback_data.get('item'))
    type = str(callback_data.get('type'))
    await call.message.delete_reply_markup()
    await call.message.delete()
    callback_data = call.data
    logging.info(f'call={callback_data}')
    str_item = item.lower()
    load_photo = db.get_product_image(str_item)
    group_image = []
    if group_image is not None:
        for i in load_photo:
            group_image.append(
                InputMediaPhoto(i[1],
                                get_file(f'info/{item.lower()}_info.txt')))
        await call.message.answer_media_group(group_image)

    await call.message.answer(text=get_file(f'info/{item.lower()}_info.txt'),
                              reply_markup=button.inline_button_sleb
                              if type == 'sleb' else button.inline_markup)
Esempio n. 26
0
async def custom_next_handler(
    call: CallbackQuery,
    caption: str = None,
    btn_call_data: str = None,
    self=None,
    func: FunctionType = None,
) -> None:
    try:
        new_url = await func()
        if not isinstance(new_url, (str, bool)):
            raise Exception(
                f"Invalid type returned by `next_handler`. Expected `str` or `False`, got `{type(new_url)}`"
            )
    except Exception:
        logger.exception("Exception while trying to parse new photo")
        await call.answer("Error occurred", show_alert=True)
        return

    if not new_url:
        await call.answer("No photos left", show_alert=True)
        return

    markup = InlineKeyboardMarkup()
    markup.add(InlineKeyboardButton("Next ➡️", callback_data=btn_call_data))

    _caption = caption if isinstance(
        caption, str) or not callable(caption) else caption()

    try:
        await self.bot.edit_message_media(
            inline_message_id=call.inline_message_id,
            media=InputMediaPhoto(media=new_url,
                                  caption=_caption,
                                  parse_mode="HTML"),
            reply_markup=markup,
        )
    except Exception:
        logger.exception("Exception while trying to edit media")
        await call.answer("Error occurred", show_alert=True)
        return
Esempio n. 27
0
async def change_item_photo(message: types.Message, state: FSMContext):
    await bot.send_chat_action(message.chat.id, 'upload_photo')

    item_photo_id = message.photo[-1].file_id
    item_small_photo = await get_image_link(message.photo[0])

    async with state.proxy() as data:
        data['item_photo_id'] = item_photo_id
        data['item_small_photo'] = item_small_photo
        item_price = data['item_price']
        item_name = data['item_name']
        item_description = data['item_description']
        item_msg_id = data['item_msg_id']
        last_msg_id = data['last_msg_id']

    item_text = get_item_text(item_name, item_description, item_price)

    await dp.bot.delete_message(message.chat.id, last_msg_id)
    await dp.bot.delete_message(message.chat.id, message.message_id)

    await dp.bot.edit_message_media(InputMediaPhoto(item_photo_id, item_text),
                                    message.chat.id, item_msg_id)

    await AddItemState.confirm_item.set()
Esempio n. 28
0
async def process_group_command(message: types.Message):
    media = [InputMediaVideo(VIDEO, 'ёжик и котятки')]
    for photo_id in KITTENS:
        media.append(InputMediaPhoto(photo_id))
    await bot.send_media_group(message.from_user.id, media)
Esempio n. 29
0
async def get_photos(callback: CallbackQuery):
    id = callback.from_user.id
    images = [
        InputMediaPhoto(
            "AgACAgIAAxkDAANcYJV5wnUZitDsdFakLfhMZXDLc2sAAmy0MRuFMKhI3tiTFP0tVa1sWDefLgADAQADAgADbQADypQDAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANdYJV5wpO2vcYtCVlCzUU2Mc8yweYAAnG0MRuFMKhIqLXrYtWd8dC3Q6aiLgADAQADAgADbQADMQoCAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANeYJV5wwF3MMuihZ9luilv4m--3sUAAnK0MRuFMKhIk5M04IO6CJLyf1GkLgADAQADAgADbQADB8EAAh8E"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANfYJV5w7jIYueqir56-T8FVrra-CwAAnO0MRuFMKhInCxHlcFj9G9qdE6kLgADAQADAgADbQAD7s0AAh8E"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANgYJV5xFM9L_lJFXSIz-HAAj317ckAAnS0MRuFMKhImJtAsWZA17PFT4yiLgADAQADAgADbQADtOEBAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANhYJV5xEHzpngDx4RuuyI2lliGE4AAAnW0MRuFMKhIQE1RHKG4EexVN0OeLgADAQADAgADbQADfZ0DAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANiYJV5xX3_Uzh17VqRT-odJk8mvY8AAna0MRuFMKhIsfBq9zEiX6TY0jWfLgADAQADAgADbQAD6O0DAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANjYJV5xiW-OFZpOGyGgcXSNDnrvRkAAne0MRuFMKhIbbLUtR20MawbN0OeLgADAQADAgADbQADd6ADAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANkYJV5x-5x7B9r8A23UfSNQi7nuXQAAni0MRuFMKhIJutXOyAcqv4Dp4OfLgADAQADAgADbQADbqkDAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANlYJV5x9FFRlflli7FYWhK9gsMwwEAAnm0MRuFMKhIivn97gSFO9XA0Q-bLgADAQADAgADbQADvyUGAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANmYJV5yB0kODZ4dcCe51Kw597A7K8AAnq0MRuFMKhInxqQnLNR0EJ68ZOiLgADAQADAgADbQADZt4BAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANnYJV5yHdnuvDNRRBESppYuFKr4a0AAnu0MRuFMKhIQ4rq9qkZbnj4-dCiLgADAQADAgADbQADss8BAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANoYJV5ya0JKXlidgKiRe37j-y7I00AAny0MRuFMKhIKhaFzIAfKgJuMg-iLgADAQADAgADbQADiOUBAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANpYJV5yXcNPuhhnreFfJvNEJZnphwAAn20MRuFMKhILu1bB1NiEoyac06kLgADAQADAgADbQADDdIAAh8E"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANqYJV5ynGICeWMByayekk1c3yh4OQAAn60MRuFMKhI9V_uagb7oHIchoedLgADAQADAgADbQADTvYBAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANrYJV5y_gNjejBTr6mSUiXsS226vcAAn-0MRuFMKhIlT9QIZo3GwtYIAOeLgADAQADAgADbQADA5cDAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANsYJV5y5Cg9puFYPZ3DFeSrNUNK2kAAoC0MRuFMKhIPi2rtO5l_JOTzIqiLgADAQADAgADbQADUP4BAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANtYJV5zI4OcRpVX2IxNhfXVGUbT10AAoG0MRuFMKhIBe3teLkUpIy2Z4meLgADAQADAgADbQADQQoGAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANuYJV5zFPv-HXPO2LkJJeqM6tmuBkAAoK0MRuFMKhITmnxNSiAjQWBIAOeLgADAQADAgADbQADt5UDAAEfBA"
        ),
        InputMediaPhoto(
            "AgACAgIAAxkDAANvYJV5zUZa0bDN7R28ZzA1TWSgzIIAAoO0MRuFMKhIqmD7DjhdQW26zg2eLgADAQADAgADbQADdfYFAAEfBA"
        ),
    ]
    await bot.delete_message(id, callback.message.message_id)
    await bot.send_media_group(id, images[10:20])
Esempio n. 30
0
async def question_1(call: CallbackQuery):
    await call.answer(cache_time=60)
    await call.message.edit_media(media=InputMediaPhoto(media=open(photo_db.get_one_file_name(name=photo_quiz[7]), 'rb')),reply_markup=quiz_photo8)