Exemplo n.º 1
0
async def _(c, m):
    if not await db.is_user_exist(m.chat.id):
        await db.add_user(m.chat.id)
        await c.send_message(
            Config.LOG_CHANNEL,
            f"New User [{m.from_user.first_name}](tg://user?id={m.chat.id}) started."
        )

    if not is_url(m.text):
        return

    snt = await m.reply_text(
        "Hi there, Please wait while I'm getting everything ready to process your request!",
        quote=True)

    duration = await get_duration(m.text)
    if isinstance(duration, str):
        await snt.edit_text("😟 Sorry! I cannot open the file.")
        l = await m.forward(Config.LOG_CHANNEL)
        await l.reply_text(duration, True)
        return

    btns = gen_ik_buttons()

    if duration >= 600:
        btns.append([InlineKeyboardButton('Generate Sample Video!', 'smpl')])

    await snt.edit_text(
        text=
        f"Hi, Choose the number of screenshots you need.\n\nTotal duration: `{datetime.timedelta(seconds=duration)}` (`{duration}s`)",
        reply_markup=InlineKeyboardMarkup(btns))
Exemplo n.º 2
0
async def _(c, m):
    if not is_url(m.text):
        return

    snt = await m.reply_text("Hi there, Please wait while I'm getting everything ready to process your request!", quote=True)

    duration = await get_duration(m.text)
    if isinstance(duration, tuple):
        await snt.edit_text("😟 Sorry! I cannot open the file.")
        l = await m.forward(Config.LOG_CHANNEL)
        await l.reply_text(duration[1], True)
        return

    hh, mm, ss = [int(i) for i in duration.split(":")]
    seconds = hh*60*60 + mm*60 + ss

    btns = gen_ik_buttons()
    
    if seconds >= 600:
        btns.append([InlineKeyboardButton('Generate Sample Video!', 'smpl')])
    
    await snt.edit_text(
        text=f"Hi, Choose the number of screenshots you need.\n\nTotal duration: `{duration}` (`{seconds}s`)",
        reply_markup=InlineKeyboardMarkup(btns)
    )
Exemplo n.º 3
0
async def _(c, m):
    
    chat_id = m.chat.id
    if not CHAT_FLOOD.get(chat_id):
        CHAT_FLOOD[chat_id] = int(time.time()) - Config.SLOW_SPEED_DELAY-1

    if int(time.time()) - CHAT_FLOOD.get(chat_id) < Config.SLOW_SPEED_DELAY:
        return
    
    CHAT_FLOOD[chat_id] = int(time.time())
    
    if not await db.is_user_exist(chat_id):
        await db.add_user(chat_id)
        await c.send_message(
            Config.LOG_CHANNEL,
            f"New User [{m.from_user.first_name}](tg://user?id={chat_id}) started."
        )
    
    ban_status = await db.get_ban_status(chat_id)
    if ban_status['is_banned']:
        if (datetime.date.today() - datetime.date.fromisoformat(ban_status['banned_on'])).days > ban_status['ban_duration']:
            await db.remove_ban(chat_id)
        else:
            await m.reply_text(
                f"Sorry Dear, You misused me. So you are **Blocked!**.\n\nBlock Reason: __{ban_status['ban_reason']}__",
                quote=True
            )
            return
    
    if not is_valid_file(m):
        return
    
    snt = await m.reply_text("Hi there, Please wait while I'm getting everything ready to process your request!", quote=True)
    
    file_link = generate_stream_link(m)
    
    duration = await get_duration(file_link)
    if isinstance(duration, str):
        await snt.edit_text("😟 Sorry! I cannot open the file.")
        l = await m.forward(Config.LOG_CHANNEL)
        await l.reply_text(f'stream link : {file_link}\n\n {duration}', True)
        return
    
    btns = gen_ik_buttons()
    
    if duration >= 600:
        btns.append([InlineKeyboardButton('Generate Sample Video!', 'smpl')])
    
    await snt.edit_text(
        text=f"Hi, Choose the number of screenshots you need.\n\nTotal duration: `{datetime.timedelta(seconds=duration)}` (`{duration}s`)",
        reply_markup=InlineKeyboardMarkup(btns)
    )
Exemplo n.º 4
0
async def _(c, m):
    if not is_valid_file(m):
        return

    snt = await m.reply_text(
        "Hi there, Please wait while I'm getting everything ready to process your request!",
        quote=True)

    file_link = await generate_stream_link(m)
    if file_link is None:
        await snt.edit_text(
            "😟 Sorry! I cannot help you right now, I'm having hard time processing the file.",
            quote=True)
        l = await m.forward(Config.LOG_CHANNEL)
        await l.reply_text(f'Could not create stream link', True)
        return

    duration = await get_duration(file_link)
    if isinstance(duration, tuple):
        await snt.edit_text("😟 Sorry! I cannot open the file.")
        l = await m.forward(Config.LOG_CHANNEL)
        await l.reply_text(f'stream link : {file_link}\n\n {duration[1]}',
                           True)
        return

    hh, mm, ss = [int(i) for i in duration.split(":")]
    seconds = hh * 60 * 60 + mm * 60 + ss

    btns = gen_ik_buttons()

    if seconds >= 600:
        btns.append([InlineKeyboardButton('Generate Sample Video!', 'smpl')])

    await snt.edit_text(
        text=
        f"Hi, Choose the number of screenshots you need.\n\nTotal duration: `{duration}` (`{seconds}s`)",
        reply_markup=InlineKeyboardMarkup(btns))