示例#1
0
async def _(event):
    if event.fwd_from:
        return
    if not event.reply_to_msg_id:
        await event.edit("```Reply to any user message.```")
        return
    reply_message = await event.get_reply_message()

    chat = "@QuotLyBot"
    sender = reply_message.sender
    if reply_message.sender.bot:
        await event.edit("```Reply to actual users message.```")
        return
    await event.edit("```Making a Quote```")
    async with bot.conversation(chat) as conv:
        try:
            response = conv.wait_event(
                events.NewMessage(incoming=True, from_users=1031952739))
            await bot.forward_messages(chat, reply_message)
            response = await response
        except YouBlockedUserError:
            await event.reply("```Please unblock @QuotLyBot and try again```")
            return
        if response.text.startswith("Hi!"):
            await event.edit(
                "```Can you kindly disable your forward privacy settings for good?```"
            )
        else:
            await event.delete()
            await bot.forward_messages(event.chat_id, response.message)
示例#2
0
async def _(event):
       rksong = event.pattern_match.group(1)
       if not rksong:
            return await event.reply("`Give a link to scan.....`")
       rkp = await event.reply(" `Scanning url.........`")
       chat = "@DrWebBot"
       async with bot.conversation(chat) as conv: 
          try:        
              response = conv.wait_event(events.NewMessage(incoming=True,from_users=161163358))                   
              await conv.send_message(rksong)
              song2 = await conv.get_response()
              return await rkp.edit(f"**{JAVES_NNAME}**:  {song2.message}")
          except : 
              return await event.reply("Please unblock @DrWebBot and try again")
示例#3
0
async def _(event):
    if event.fwd_from:
        return
    ok = await event.edit("`Subscribing...`")
    sysarg = event.text[8:]
    async with borg.conversation(bot) as conv:
        try:
            await conv.send_message("/start")
            await conv.get_response()
            await conv.send_message("/fedsub " + sysarg)
            audio = await conv.get_response()
            await ok.edit(audio.text + "\n\nSubscribed to given fed ")
        except YouBlockedUserError:
            await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!"
                          )
示例#4
0
async def _(event):
    reply_message = await event.get_reply_message() 
    if not reply_message or not event.reply_to_msg_id or not reply_message.media or not reply_message.media:
       return await event.reply("```Reply to a media message```")
    chat = "@DrWebBot"
    sender = reply_message.sender
    rkp = await event.reply(" `Scanning......`")
    async with bot.conversation(chat) as conv:
          try:        
              response = conv.wait_event(events.NewMessage(incoming=True,from_users=161163358))                   
              await conv.send_message(reply_message)
              song2 = await conv.get_response()
              return await rkp.edit(f"**{JAVES_NNAME}:**  {song2.message}")
          except:      
              return await event.reply(f"Please unblock @DrWebBot and try again")
示例#5
0
async def _(event):
    if event.fwd_from:
        return
    ok = await event.edit("`Extracting information...`")
    sysarg = event.pattern_match.group(1)
    async with borg.conversation(bot) as conv:
        try:
            await conv.send_message("/start")
            await conv.get_response()
            await conv.send_message("/fedinfo " + sysarg)
            audio = await conv.get_response()
            await ok.edit(audio.text + "\n\nFedInfo Excracted ")
        except YouBlockedUserError:
            await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!"
                          )
示例#6
0
async def _(event):
    bot = "@SpamBot"
    if event.fwd_from:
        return
    sysarg = event.pattern_match.group(1)
    if sysarg == "":
        async with borg.conversation(bot) as conv:
            try:
                await conv.send_message("/start")
                await conv.get_response()
                await conv.send_message("/start")
                audio = await conv.get_response()
                final = ("HeHe", "")
                await borg.send_message(event.chat_id, audio.text)
                await event.delete()
            except YouBlockedUserError:
                await event.edit("**Error:** `unblock` @spambot `and retry!")
示例#7
0
async def _(event):
    if event.fwd_from:
        return
    if not event.reply_to_msg_id:
        await event.reply(f"`{JAVES_NNAME}`: **Reply to a Photo**")
        return
    reply_message = await event.get_reply_message()
    if not reply_message.media:
        await event.reply(f"`{JAVES_NNAME}`: **Reply to a photo**")
        return
    chat = "@BuildStickerBot"
    sender = reply_message.sender
    if reply_message.sender.bot:
        await event.reply(
            f"`{JAVES_NNAME}`: **Reply to actual users message.**")
        return
    await event.reply(f"`{JAVES_NNAME}`: **processing Img to Sticker.......**")
    async with bot.conversation(chat) as conv:
        try:
            await conv.send_message("/start")
            response2 = await conv.get_response()
            if response2.text.startswith("🔸"):
                await asyncio.sleep(0.3)
                response = conv.wait_event(
                    events.NewMessage(incoming=True, from_users=164977173))
                await bot.forward_messages(chat, reply_message)
                response = await response
                #await event.reply(f"`{JAVES_NNAME}`: **Converted @{sender.username}'s photo to Sticker Sucessfully**")
                if response.text.startswith("🔸"):
                    await event.reply(
                        f"`{JAVES_NNAME}`: **Sorry, Failed to decode this img \n try use alternative way !ss3**"
                    )
                else:
                    await bot.send_file(event.chat_id, response.message.media)
            else:
                await event.reply(
                    f"`{JAVES_NNAME}`: **Sorry, currently this command in maintaince..... please try later \nOr use alternative way !ss3  **"
                )
        except YouBlockedUserError:
            await event.reply(
                f"`{JAVES_NNAME}`: **Please unblock @BuildStickerBot and try again**"
            )
示例#8
0
async def _(event):
    if event.fwd_from:
        return
    ok = await event.edit(f"**CHECKING**`...`")
    fid = event.text[10:]
    if event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        sysarg = str(previous_message.sender_id)
        user = f"[user](tg://user?id={sysarg})"
    else:
        sysarg = event.text[10:]
        user, fid = sysarg.split(";")
        sysarg, fid = sysarg.split(";")
    if sysarg == "":
        await ok.edit(
            "`Give me someones id, or reply to somones message to check his/her fedstat.`"
        )
        return
    else:
        async with borg.conversation(bot) as conv:
            try:
                await conv.send_message("/start")
                await conv.get_response()
                await conv.send_message(f"/fedstat {sysarg} {fid}")
                audio = await conv.get_response()
                if "Looks like" in audio.text:
                    await audio.click(0)
                    await asyncio.sleep(2)
                    audio = await conv.get_response()
                    await borg.send_file(
                        event.chat_id,
                        audio,
                        caption=
                        f"List of feds {user} has been banned in.\n\nFSTATS CHECKED BY @MissRose_bot 🔥\n\nCollected.",
                    )
                else:
                    await borg.send_message(event.chat_id, audio.text)
                await event.delete()
            except YouBlockedUserError:
                await ok.edit(
                    "**Error**\n `Unblock` @MissRose_Bot `and try again!")
示例#9
0
async def _(event):
    msg = await event.edit("Starting a Mass-FedBan...")
    fedList = []
    if event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        if previous_message.media:
            downloaded_file_name = await ultroid_bot.download_media(
                previous_message, "fedlist")
            file = open(downloaded_file_name, encoding="utf8")
            lines = file.readlines()
            for line in lines:
                try:
                    fedList.append(line[:36])
                except BaseException:
                    pass
            arg = event.text.split(" ", maxsplit=2)
            if len(arg) > 2:
                FBAN = arg[1]
                REASON = arg[2]
            else:
                FBAN = arg[1]
                REASON = " #TBMassBanned "
        else:
            FBAN = previous_message.sender_id
            try:
                REASON = event.text.split(" ", maxsplit=1)[1]
            except BaseException:
                REASON = ""
            if REASON.strip() == "":
                REASON = " #TBMassBanned "
    else:
        arg = event.text.split(" ", maxsplit=2)
        if len(arg) > 2:
            try:
                FBAN = arg[1]
                REASON = arg[2]
            except BaseException:
                return await msg.edit("`No user designated!`")
        else:
            try:
                FBAN = arg[1]
                REASON = " #TBMassBanned "
            except BaseException:
                return await msg.edit("`No user designated!`")
    try:
        if str(FBAN) == str(929138153):
            await msg.edit("You can't ban my dev !!")
            return
        elif FBAN.startswith("@"):
            try:
                x = await borg.get_entity(str(FBAN))
                uid = x.id
                if str(uid) == str(929138153):
                    await msg.edit("You can't ban my dev!!")
                    return
            except Exception as e:
                print(str(e))
                return await msg.edit(str(e))
    except Exception as e:
        print(str(e))
        return await msg.edit(str(e))

    chat = await event.get_chat()
    if not len(fedList):
        for a in range(3):
            async with ultroid_bot.conversation("@MissRose_bot") as bot_conv:
                await bot_conv.send_message("/start")
                await asyncio.sleep(3)
                await bot_conv.send_message("/myfeds")
                await asyncio.sleep(3)
                try:
                    response = await bot_conv.get_response()
                except asyncio.exceptions.TimeoutError:
                    return await msg.edit(
                        "`Seems like rose isn't responding, or, the plugin is misbehaving`"
                    )
                await asyncio.sleep(3)
                if "make a file" in response.text or "Looks like" in response.text:
                    await response.click(0)
                    await asyncio.sleep(3)
                    fedfile = await bot_conv.get_response()
                    await asyncio.sleep(3)
                    if fedfile.media:
                        downloaded_file_name = await ultroid_bot.download_media(
                            fedfile, "fedlist")
                        await asyncio.sleep(6)
                        file = open(downloaded_file_name, "r", errors="ignore")
                        lines = file.readlines()
                        for line in lines:
                            try:
                                fedList.append(line[:36])
                            except BaseException:
                                pass
                    elif "You can only use fed commands once every 5 minutes" in (
                            await bot_conv.get_edit):
                        await msg.edit("Try again after 5 mins.")
                        return
                if len(fedList) == 0:
                    await msg.edit(
                        f"Unable to collect FedAdminList. Retrying ({a+1}/3)..."
                    )
                else:
                    break
        else:
            await msg.edit("Error")
        In = False
        tempFedId = ""
        for x in response.text:
            if x == "`":
                if In:
                    In = False
                    fedList.append(tempFedId)
                    tempFedId = ""
                else:
                    In = True
            elif In:
                tempFedId += x
        if len(fedList) == 0:
            await msg.edit("Unable to collect FedAdminList.")
            return
    await msg.edit(f"FBaning in {len(fedList)} feds.")
    try:
        await ultroid_bot.send_message(FED_LOGGER, f"/start")
    except BaseException:
        await msg.edit("Specified FBan Group ID is incorrect.")
        return
    await asyncio.sleep(3)

    exCount = 0
    for fed in fedList:
        await ultroid_bot.send_message(FED_LOGGER, f"/joinfed {fed}")
        await asyncio.sleep(3)
        await ultroid_bot.send_message(FED_LOGGER, f"/fban {FBAN} {REASON}")
        await asyncio.sleep(3)
    try:
        os.remove("fedlist")
    except Exception as e:
        print(f"Error in removing FedAdmin file.\n{str(e)}")
    await msg.edit("SuperFBan Completed.\n#TB")
示例#10
0
async def kang(args):
    """ For .kang command, kangs stickers or creates new ones. """
    kang_meme = random.choice(KANGING_STR)
    user = await bot.get_me()
    if not user.username:
        user.username = user.first_name
    message = await args.get_reply_message()
    photo = None
    emojibypass = False
    is_anim = False
    emoji = None

    if message and message.media:
        if isinstance(message.media, MessageMediaPhoto):
            await args.edit(f"`{kang_meme}`")
            photo = io.BytesIO()
            photo = await bot.download_media(message.photo, photo)
        elif "image" in message.media.document.mime_type.split('/'):
            await args.edit(f"`{kang_meme}`")
            photo = io.BytesIO()
            await bot.download_file(message.media.document, photo)
            if (DocumentAttributeFilename(file_name='sticker.webp')
                    in message.media.document.attributes):
                emoji = message.media.document.attributes[1].alt
                emojibypass = True
        elif "tgsticker" in message.media.document.mime_type:
            await args.edit(f"`{kang_meme}`")
            await bot.download_file(message.media.document,
                                    'AnimatedSticker.tgs')

            attributes = message.media.document.attributes
            for attribute in attributes:
                if isinstance(attribute, DocumentAttributeSticker):
                    emoji = attribute.alt

            emojibypass = True
            is_anim = True
            photo = 1
        else:
            await args.edit("`Unsupported File!`")
            return
    else:
        await args.edit("`I can't kang that...`")
        return

    if photo:
        splat = args.text.split()
        if not emojibypass:
            emoji = "🤔"
        pack = 1
        if len(splat) == 3:
            pack = splat[2]  # User sent both
            emoji = splat[1]
        elif len(splat) == 2:
            if splat[1].isnumeric():
                # User wants to push into different pack, but is okay with
                # thonk as emote.
                pack = int(splat[1])
            else:
                # User sent just custom emote, wants to push to default
                # pack
                emoji = splat[1]

        packname = f"a{user.id}_by_{user.username}_{pack}"
        packnick = f"@{user.username}'s pack Vol.{pack}"
        cmd = '/newpack'
        file = io.BytesIO()

        if not is_anim:
            image = await resize_photo(photo)
            file.name = "sticker.png"
            image.save(file, "PNG")
        else:
            packname += "_anim"
            packnick += " (Animated)"
            cmd = '/newanimated'

        response = urllib.request.urlopen(
            urllib.request.Request(f'http://t.me/addstickers/{packname}'))
        htmlstr = response.read().decode("utf8").split('\n')

        if "  A <strong>Telegram</strong> user has created the <strong>Sticker&nbsp;Set</strong>." not in htmlstr:
            async with bot.conversation('Stickers') as conv:
                await conv.send_message('/addsticker')
                await conv.get_response()
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
                await conv.send_message(packname)
                x = await conv.get_response()
                while x.text == PACK_FULL:
                    pack += 1
                    packname = f"a{user.id}_by_{user.username}_{pack}"
                    packnick = f"@{user.username}'s pack Vol.{pack}"
                    await args.edit(f"`{kang_meme}\
                    \nMoving on to Vol.{str(pack)}..`")
                    await conv.send_message(packname)
                    x = await conv.get_response()
                    if x.text == "Invalid pack selected.":
                        await conv.send_message(cmd)
                        await conv.get_response()
                        # Ensure user doesn't get spamming notifications
                        await bot.send_read_acknowledge(conv.chat_id)
                        await conv.send_message(packnick)
                        await conv.get_response()
                        # Ensure user doesn't get spamming notifications
                        await bot.send_read_acknowledge(conv.chat_id)
                        if is_anim:
                            await conv.send_file('AnimatedSticker.tgs')
                            remove('AnimatedSticker.tgs')
                        else:
                            file.seek(0)
                            await conv.send_file(file, force_document=True)
                        await conv.get_response()
                        await conv.send_message(emoji)
                        # Ensure user doesn't get spamming notifications
                        await bot.send_read_acknowledge(conv.chat_id)
                        await conv.get_response()
                        await conv.send_message("/publish")
                        if is_anim:
                            await conv.get_response()
                            await conv.send_message(f"<{packnick}>")
                        # Ensure user doesn't get spamming notifications
                        await conv.get_response()
                        await bot.send_read_acknowledge(conv.chat_id)
                        await conv.send_message("/skip")
                        # Ensure user doesn't get spamming notifications
                        await bot.send_read_acknowledge(conv.chat_id)
                        await conv.get_response()
                        await conv.send_message(packname)
                        # Ensure user doesn't get spamming notifications
                        await bot.send_read_acknowledge(conv.chat_id)
                        await conv.get_response()
                        # Ensure user doesn't get spamming notifications
                        await bot.send_read_acknowledge(conv.chat_id)
                        await args.edit(f"`Haha, yes. New kang pack unlocked!\
                            \nPack can be found [here](t.me/addstickers/{packname})",
                                        parse_mode='md')
                        return
                if is_anim:
                    await conv.send_file('AnimatedSticker.tgs')
                    remove('AnimatedSticker.tgs')
                else:
                    file.seek(0)
                    await conv.send_file(file, force_document=True)
                rsp = await conv.get_response()
                if "Sorry, the file type is invalid." in rsp.text:
                    await args.edit(
                        "`Failed to add sticker, use` @Stickers `bot to add the sticker manually.`"
                    )
                    return
                await conv.send_message(emoji)
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
                await conv.get_response()
                await conv.send_message('/done')
                await conv.get_response()
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
        else:
            await args.edit(f"`{JAVES_NNAME}`: **Brewing a new Pack...**")
            async with bot.conversation('Stickers') as conv:
                await conv.send_message(cmd)
                await conv.get_response()
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
                await conv.send_message(packnick)
                await conv.get_response()
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
                if is_anim:
                    await conv.send_file('AnimatedSticker.tgs')
                    remove('AnimatedSticker.tgs')
                else:
                    file.seek(0)
                    await conv.send_file(file, force_document=True)
                rsp = await conv.get_response()
                if "Sorry, the file type is invalid." in rsp.text:
                    await args.edit(
                        "`Failed to add sticker, use` @Stickers `bot to add the sticker manually.`"
                    )
                    return
                await conv.send_message(emoji)
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
                await conv.get_response()
                await conv.send_message("/publish")
                if is_anim:
                    await conv.get_response()
                    await conv.send_message(f"<{packnick}>")
                # Ensure user doesn't get spamming notifications
                await conv.get_response()
                await bot.send_read_acknowledge(conv.chat_id)
                await conv.send_message("/skip")
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
                await conv.get_response()
                await conv.send_message(packname)
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
                await conv.get_response()
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)

        await args.edit(f"`{JAVES_NNAME}`: **Sticker kanged successfully!**\
            \nPack can be found [here](t.me/addstickers/{packname})",
                        parse_mode='md')