Example #1
0
async def summoned(_, message: Message):
    chat_details = SUMMON().find_chat_id(message)

    if chat_details is not None:
        if chat_details["chat_id"] == message.chat.id:
            if not AFK:
                try:
                    last_send = chat_details["last_send"]
                    next_send = chat_details["next_send"]

                    if (time.time() - last_send) >= next_send:
                        await send_saved_image(
                            message,
                            "summoned_cat",
                            "summoned_cat.jpg",
                        )
                        last_send = time.time()
                        next_send = random_interval()
                        SUMMON().update(message, last_send, next_send)
                except Exception:
                    await send_saved_image(message, "summoned_cat",
                                           "summoned_cat.jpg")
                    last_send = time.time()
                    next_send = random_interval()
                    SUMMON().update(message, last_send, next_send)
Example #2
0
async def summoned(bot: UserBot, message: Message):
    chat_details = SUMMON().find_chat_id(message)

    if chat_details is not None:
        if chat_details['chat_id'] == message.chat.id:
            try:
                last_send = chat_details['last_send']
                next_send = chat_details['next_send']

                if (time.time() - last_send) >= next_send:
                    await send_saved_image(bot, message, "summoned_cat",
                                           "summoned_cat.jpg")
                    last_send = time.time()
                    next_send = random_interval()
                    SUMMON().update(message, last_send, next_send)
            except:
                await send_saved_image(bot, message, "summoned_cat",
                                       "summoned_cat.jpg")
                last_send = time.time()
                next_send = random_interval()
                SUMMON().update(message, last_send, next_send)