Ejemplo n.º 1
0
async def inline_echo(iq_iq: InlineQuery):
    result_id = random.uniform(0, 2384723684723684)
    catt = Animals.give_me_a_cat()
    cat = InlineQueryResultPhoto(id=result_id,
                                 photo_url=catt[0],
                                 thumb_url=catt[0],
                                 title="😺",
                                 caption=catt[1])
    await BOT.answer_inline_query(iq_iq.id, results=[cat], cache_time=1)
Ejemplo n.º 2
0
async def some_cat(msg: types.Message):
    what_we_want = msg.text.lower()
    try:
        if what_we_want == "котик":
            await types.ChatActions.upload_photo()
            cat = Animals.give_me_a_cat()
            cat_n_caption = types.MediaGroup()
            cat_n_caption.attach_photo(cat[0], cat[1])
            await msg.reply_media_group(media=cat_n_caption)
        if what_we_want == "собачка":
            await types.ChatActions.upload_photo()
            dog = Animals.give_me_a_dog()
            dog_n_caption = types.MediaGroup()
            dog_n_caption.attach_photo(dog[0], dog[1])
            await msg.reply_media_group(media=dog_n_caption)
    except Exception as some_error:
        print(some_error)
        await msg.reply(text("Что-то пошло не так...\nПопробуйте снова!"))