async def _(event):
    try:
        if event.fwd_from:
            return
        if not event.reply_to_msg_id:
            await event.reply("Reply to an audio message.")
            return
        reply_message = await event.get_reply_message()
        stt = await event.reply("Identifying the song.")
        tmp = './'
        dl = await tbot.download_media(reply_message, tmp)
        chat = "@auddbot"
        await stt.edit("Identifying the song...")
        async with ubot.conversation(chat) as conv:
            try:
                await conv.send_file(dl)
                check = await conv.get_response()
                if not check.text.startswith("Audio received"):
                    return await stt.edit(
                        "An error while identifying the song. Try to use a 5-10s long audio message."
                    )
                await stt.edit("Wait just a sec...")
                result = await conv.get_response()
                await ubot.send_read_acknowledge(conv.chat_id)
            except YouBlockedUserError:
                await stt.edit("Error Report at @lunasupport")
                return
        namem = f"Song Name : {result.text.splitlines()[0]}\
        \n\nDetails : {result.text.splitlines()[2]}"

        await stt.edit(namem)
    except Exception as e:
        await event.reply(e)
async def alive(event):
    sender = await event.get_sender()
    fname = sender.first_name
    ok = event.pattern_match.group(1)
    k = await event.reply("**Wait for Result.**")
    async with ubot.conversation("@Carol5_bot") as bot_conv:
        await bot_conv.send_message(f"/ss {ok}")
        await asyncio.sleep(9)
        response = await bot_conv.get_response()
        if "Try again after" in response.text:
            await k.edit(response)
            return
        if "Your date is invalid" in response.text:
            await k.edit('Format Wrong or invalid cc.')
            return
        res = response.text
        text = f'{res.splitlines()[0]}\n'
        text += f'{res.splitlines()[1]}\n'
        text += f'{res.splitlines()[2]}\n'
        text += f'{res.splitlines()[3]}\n'
        text += f'{res.splitlines()[4]}\n'
        text += f'{res.splitlines()[5]}\n'
        text += f'{res.splitlines()[6]}\n'
        text += f'Checked By **{fname}**'
        await k.edit(text)
async def alive(event):
    sender = await event.get_sender()
    fname = sender.first_name
    ok = event.pattern_match.group(1)
    k = await event.reply("**Wait for Result.**")
    start_time = datetime.datetime.now()
    async with ubot.conversation("@Carol5_bot") as bot_conv:
        await bot_conv.send_message(f"/key {ok}")
        await asyncio.sleep(6)
        response = await bot_conv.get_response()
        await event.delete()
        end_time = datetime.datetime.now()
        pingtime = end_time - start_time
        time = str(round(pingtime.total_seconds(), 2)) + "s"
        if "Invalid" in response.text:
            reply = f"SK Key : {ok}\n"
            reply += "Result: Invalid API Key\n"
            reply += "RESPONSE: ❌Invalid Key❌\n"
            reply += f"Time: {time}\n"
            reply += f"Checked By **{fname}**"
        elif "Test" in response.text:
            reply = f"SK Key : sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
            reply += "Result: Test mode Key\n"
            reply += "RESPONSE: ❌Test Mode Key❌\n"
            reply += f"Time: {time}\n"
            reply += f"Checked By **{fname}**"
        elif "Valid" in response.text:
            reply = f"SK Key : sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
            reply += "Result: LIVE\n"
            reply += "RESPONSE: ✅Valid Key\n"
            reply += f"Time: {time}\n"
            reply += f"Checked By **{fname}**"
        else:
            reply = "Error, Report @LunaBotSupport"
        await k.edit(reply)
async def alive(event):
    sender = await event.get_sender()
    fname = sender.first_name
    k = await event.reply("**Wait for Result.**")
    ok = event.pattern_match.group(1)
    async with ubot.conversation("@Carol5_bot") as bot_conv:
        await bot_conv.send_message(f"/bin {ok}")
        await asyncio.sleep(5)
        response = await bot_conv.get_response()
        res = response.text
        if "❌" in res:
            text = '🤬❌ INVALID BIN ❌🤬\n'
            text += f'Checked By **{fname}**'
            await k.edit(text)
        else:
            text = f'{res.splitlines()[0]}\n'
            text += f'{res.splitlines()[1]}\n'
            text += f'{res.splitlines()[2]}\n'
            text += f'{res.splitlines()[3]}\n'
            text += f'{res.splitlines()[4]}\n'
            text += f'{res.splitlines()[5]}\n'
            text += f'{res.splitlines()[6]}\n'
            text += f'Checked By **{fname}**'
            await k.edit(text)
Exemplo n.º 5
0
async def _(event):
    try:
        approved_userss = approved_users.find({})
        for ch in approved_userss:
            iid = ch["id"]
            userss = ch["user"]
        if event.is_group:
            if await is_register_admin(event.input_chat,
                                       event.message.sender_id):
                pass
            elif event.chat_id == iid and event.sender_id == userss:
                pass
            else:
                return

        if not event.is_reply:
            await event.reply(
                "Reply to a sticker to remove it from your personal sticker pack."
            )
            return
        reply_message = await event.get_reply_message()
        kanga = await event.reply("`Deleting .`")

        if not is_message_image(reply_message):
            await kanga.edit("Please reply to a sticker.")
            return

        rmsticker = await ubot.get_messages(event.chat_id,
                                            ids=reply_message.id)

        stickerset_attr_s = reply_message.document.attributes
        stickerset_attr = find_instance(stickerset_attr_s,
                                        DocumentAttributeSticker)
        if not stickerset_attr.stickerset:
            await event.reply("Sticker does not belong to a pack.")
            return

        get_stickerset = await tbot(
            GetStickerSetRequest(
                InputStickerSetID(
                    id=stickerset_attr.stickerset.id,
                    access_hash=stickerset_attr.stickerset.access_hash,
                )))

        packname = get_stickerset.set.short_name

        sresult = (await ubot(
            functions.messages.GetStickerSetRequest(
                InputStickerSetShortName(packname)))).documents
        for c in sresult:
            if int(c.id) == int(stickerset_attr.stickerset.id):
                pass
            else:
                await kanga.edit(
                    "This sticker is already removed from your personal sticker pack."
                )
                return

        await kanga.edit("`Deleting ..`")

        async with ubot.conversation("@Stickers") as bot_conv:

            await silently_send_message(bot_conv, "/cancel")
            response = await silently_send_message(bot_conv, "/delsticker")
            if "Choose" not in response.text:
                await tbot.edit_message(
                    kanga, f"**FAILED**! @Stickers replied: {response.text}")
                return
            response = await silently_send_message(bot_conv, packname)
            if not response.text.startswith("Please"):
                await tbot.edit_message(
                    kanga, f"**FAILED**! @Stickers replied: {response.text}")
                return
            try:
                await rmsticker.forward_to("@Stickers")
            except Exception as e:
                print(e)
            if response.text.startswith("This pack has only"):
                await silently_send_message(bot_conv, "Delete anyway")

            await kanga.edit("`Deleting ...`")
            response = await bot_conv.get_response()
            if not "I have deleted" in response.text:
                await tbot.edit_message(
                    kanga, f"**FAILED**! @Stickers replied: {response.text}")
                return

            await kanga.edit(
                "Successfully deleted that sticker from your personal pack.")
    except Exception as e:
        os.remove("sticker.webp")
        print(e)
Exemplo n.º 6
0
async def _(event):
    if not event.is_reply:
        await event.reply(
            "Reply to a photo to add to your personal sticker pack.")
        return
    reply_message = await event.get_reply_message()
    sticker_emoji = "🔥"
    input_str = event.pattern_match.group(1)
    if input_str:
        sticker_emoji = input_str

    user = await event.get_sender()
    if not user.first_name:
        user.first_name = user.id
    pack = 1
    userid = event.sender_id
    first_name = user.first_name
    packname = f"{first_name}'s Sticker Vol.{pack}"
    packshortname = f"MissJuliaRobot_sticker_{userid}"
    kanga = await event.reply("`Kanging .`")
    is_a_s = is_it_animated_sticker(reply_message)
    file_ext_ns_ion = "@MissJuliaRobot.png"
    file = await event.client.download_file(reply_message.media)
    uploaded_sticker = None
    if is_a_s:
        file_ext_ns_ion = "AnimatedSticker.tgs"
        uploaded_sticker = await ubot.upload_file(file,
                                                  file_name=file_ext_ns_ion)
        packname = f"{first_name}'s Animated Sticker Vol.{pack}"
        packshortname = f"MissJuliaRobot_animate_{userid}"
    elif not is_message_image(reply_message):
        await kanga.edit("Invalid message type")
        return
    else:
        with BytesIO(file) as mem_file, BytesIO() as sticker:
            resize_image(mem_file, sticker)
            sticker.seek(0)
            uploaded_sticker = await ubot.upload_file(
                sticker, file_name=file_ext_ns_ion)

    await kanga.edit("`Kanging ..`")

    async with ubot.conversation("@Stickers") as bot_conv:
        now = datetime.datetime.now()
        dt = now + datetime.timedelta(minutes=1)
        if not await stickerset_exists(bot_conv, packshortname):

            await silently_send_message(bot_conv, "/cancel")
            if is_a_s:
                response = await silently_send_message(bot_conv,
                                                       "/newanimated")
            else:
                response = await silently_send_message(bot_conv, "/newpack")
            if "Yay!" not in response.text:
                await tbot.edit_message(
                    kanga, f"**FAILED**! @Stickers replied: {response.text}")
                return
            response = await silently_send_message(bot_conv, packname)
            if not response.text.startswith("Alright!"):
                await tbot.edit_message(
                    kanga, f"**FAILED**! @Stickers replied: {response.text}")
                return
            w = await bot_conv.send_file(file=uploaded_sticker,
                                         allow_cache=False,
                                         force_document=True)
            response = await bot_conv.get_response()
            if "Sorry" in response.text:
                await tbot.edit_message(
                    kanga, f"**FAILED**! @Stickers replied: {response.text}")
                return
            await silently_send_message(bot_conv, sticker_emoji)
            await silently_send_message(bot_conv, "/publish")
            response = await silently_send_message(bot_conv, f"<{packname}>")
            await silently_send_message(bot_conv, "/skip")
            response = await silently_send_message(bot_conv, packshortname)
            if response.text == "Sorry, this short name is already taken.":
                await tbot.edit_message(
                    kanga, f"**FAILED**! @Stickers replied: {response.text}")
                return
        else:
            await silently_send_message(bot_conv, "/cancel")
            await silently_send_message(bot_conv, "/addsticker")
            await silently_send_message(bot_conv, packshortname)
            await bot_conv.send_file(file=uploaded_sticker,
                                     allow_cache=False,
                                     force_document=True)
            response = await bot_conv.get_response()
            if response.text == FILLED_UP_DADDY:
                while response.text == FILLED_UP_DADDY:
                    pack += 1
                    prevv = int(pack) - 1
                    packname = f"{first_name}'s Sticker Vol.{pack}"
                    packshortname = f"Vol_{pack}_with_{userid}"

                    if not await stickerset_exists(bot_conv, packshortname):
                        await tbot.edit_message(
                            kanga,
                            "**Pack No. **" + str(prevv) +
                            "** is full! Making a new Pack, Vol. **" +
                            str(pack),
                        )
                        if is_a_s:
                            response = await silently_send_message(
                                bot_conv, "/newanimated")
                        else:
                            response = await silently_send_message(
                                bot_conv, "/newpack")
                        if "Yay!" not in response.text:
                            await tbot.edit_message(
                                kanga,
                                f"**FAILED**! @Stickers replied: {response.text}"
                            )
                            return
                        response = await silently_send_message(
                            bot_conv, packname)
                        if not response.text.startswith("Alright!"):
                            await tbot.edit_message(
                                kanga,
                                f"**FAILED**! @Stickers replied: {response.text}"
                            )
                            return
                        w = await bot_conv.send_file(
                            file=uploaded_sticker,
                            allow_cache=False,
                            force_document=True,
                        )
                        response = await bot_conv.get_response()
                        if "Sorry" in response.text:
                            await tbot.edit_message(
                                kanga,
                                f"**FAILED**! @Stickers replied: {response.text}"
                            )
                            return
                        await silently_send_message(bot_conv, sticker_emoji)
                        await silently_send_message(bot_conv, "/publish")
                        response = await silently_send_message(
                            bot_conv, f"<{packname}>")
                        await silently_send_message(bot_conv, "/skip")
                        response = await silently_send_message(
                            bot_conv, packshortname)
                        if response.text == "Sorry, this short name is already taken.":
                            await tbot.edit_message(
                                kanga,
                                f"**FAILED**! @Stickers replied: {response.text}"
                            )
                            return
                    else:
                        await tbot.edit_message(
                            kanga,
                            "**Pack No. **" + str(prevv) +
                            "** is full! Switching to Vol. **" + str(pack),
                        )
                        await silently_send_message(bot_conv, "/addsticker")
                        await silently_send_message(bot_conv, packshortname)
                        await bot_conv.send_file(
                            file=uploaded_sticker,
                            allow_cache=False,
                            force_document=True,
                        )
                        response = await bot_conv.get_response()
                        if "Sorry" in response.text:
                            await tbot.edit_message(
                                kanga,
                                f"**FAILED**! @Stickers replied: {response.text}"
                            )
                            return
                        await silently_send_message(bot_conv, sticker_emoji)
                        await silently_send_message(bot_conv, "/done")
            else:
                if "Sorry" in response.text:
                    await tbot.edit_message(
                        kanga,
                        f"**FAILED**! @Stickers replied: {response.text}")
                    return
                await silently_send_message(bot_conv, response)
                await silently_send_message(bot_conv, sticker_emoji)
                await silently_send_message(bot_conv, "/done")
    await kanga.edit("`Kanging ...`")
    await kanga.edit(
        f"Sticker added! Your pack can be found [here](t.me/addstickers/{packshortname})"
    )
    os.system("rm -rf  @MissJuliaRobot.png")
    os.system("rm -rf  AnimatedSticker.tgs")
    os.system("rm -rf *.webp")