Esempio n. 1
0
async def album_process(event):
    msg_caption = None

    for message in event.messages:
        if not util.check_tags(message):
            continue
        else:
            msg_caption = message
            break

    if not msg_caption:
        return

    response = await boards.new_card(**util.extract_card_info(msg_caption))

    Tags.create(chat_id=event.chat_id,
                message_id=msg_caption.id,
                user_id=event.from_id,
                card_id=response['id'],
                short_url=response['shortUrl'])

    logging.info(
        f"{event.from_id} uploaded a new issue {response['shortUrl']} " +
        "with Photo Album")

    for message in event.messages:
        if not util.check_media(message):
            return

        stream = await message.download_media(file=bytes)

        await boards.attach_card(response['id'], stream,
                                 str(message.id) + message.file.ext,
                                 message.file.mime_type)
Esempio n. 2
0
async def process(event):
    response = await boards.new_card(**util.extract_card_info(event))

    Tags.create(chat_id=event.chat_id,
                message_id=event.id,
                user_id=event.from_id,
                card_id=response['id'],
                short_url=response['shortUrl'])

    logging.info(
        f"{event.from_id} uploaded a new issue {response['shortUrl']}")

    if not util.check_media(event):
        return

    stream = await event.download_media(file=bytes)

    await boards.attach_card(response['id'], stream,
                             str(event.id) + event.file.ext,
                             event.file.mime_type)