示例#1
0
async def ag(animu):
    try:
        await animu.delete()
    except:
    	pass
    text = animu.pattern_match.group(1)
    if not text:
        if animu.is_reply:
            text = (await animu.get_reply_message()).message
        else:
            await edit_or_reply("`No text given`")
            return
    animus = [20, 32, 33, 40, 41, 42, 58]
    sticcers = await bot.inline_query(
        "stickerizerbot", f"#{random.choice(animus)}{(deEmojify(text))}"
    )
    await sticcers[0].click(
          animu.chat_id,
          reply_to=animu.reply_to_msg_id,
          silent=True if animu.is_reply else False,
          hide_via=True
    )
    await animu.delete()
     
    CMD_HELP.update({"ag": ".ag : Anime girl will show ur text."})
示例#2
0
async def stickfun(animu):
    # """Creates random anime sticker!"""

    text = animu.pattern_match.group(1)
    if not text:
        if animu.is_reply:
            text = (await animu.get_reply_message()).message
        else:
            await edit_or_reply(
                animu, "`You haven't written any article, Waifu is going away.`"
            )
            return
    animus = [1, 3, 7, 9, 13, 22, 34, 35, 36, 37, 43, 44, 45, 52, 53, 55]
    sticcers = await bot.inline_query(
        "stickerizerbot", f"#{random.choice(animus)}{(deEmojify(text))}"
    )
    await sticcers[0].click(
        animu.chat_id,
        reply_to=animu.reply_to_msg_id,
        silent=True if animu.is_reply else False,
        hide_via=True,
    )
    await animu.delete()

    CMD_HELP.update({"stickfun": ".waifu : Anime that makes your writing fun."})
示例#3
0
        else:
            os.remove(required_file_name)
            required_file_name = required_file_name + ".opus"
        end = datetime.now()
        ms = (end - start).seconds
        await borg.send_file(
            event.chat_id,
            required_file_name,
            # caption="Processed {} ({}) in {} seconds!".format(text[0:97], lan, ms),
            reply_to=event.message.reply_to_msg_id,
            allow_cache=False,
            voice_note=True,
        )
        os.remove(required_file_name)
        await event.edit("Processed {} ({}) in {} seconds!".format(
            text[0:97], lan, ms))
        await asyncio.sleep(5)
        await event.delete()
    except Exception as e:
        await event.edit(str(e))


CMD_HELP.update({
    "voice":
    " Google Text to Speech\
\nAvailable Commands:\
\n.voice LanguageCode as reply to a message\
\n\n.voice LangaugeCode | text to speak\
"
})
示例#4
0
    return results


async def scam(results, lim):

    single = opener.open(results["similar_images"]).read()
    decoded = single.decode("utf-8")

    imglinks = []
    counter = 0

    pattern = r"^,\[\"(.*[.png|.jpg|.jpeg])\",[0-9]+,[0-9]+\]$"
    oboi = re.findall(pattern, decoded, re.I | re.M)

    for imglink in oboi:
        counter += 1
        if not counter >= int(lim):
            imglinks.append(imglink)
        else:
            break

    return imglinks


CMD_HELP.update({
    "reverse":
    ".simg\
        \nUsage: Reply to a pic/sticker to revers-search it on Google Images !!"
})
示例#5
0
            await borg(
                functions.account.UpdateProfileRequest(  # pylint:disable=E0602
                    first_name=name))

        except FloodWaitError as ex:

            logger.warning(str(e))

            await asyncio.sleep(ex.seconds)

        # else:

        # logger.info(r.stringify())

        # await borg.send_message(  # pylint:disable=E0602

        #     Config.PRIVATE_GROUP_BOT_API_ID,  # pylint:disable=E0602

        #     "Successfully Changed Profile Name"

        # )

        await asyncio.sleep(DEL_TIME_OUT)

    await sed.edit(f"Auto Name has been started Black Pearl")


CMD_HELP.update(
    {"autoname": ".autoname\nUsage - Auto changing profile name, with time."})
示例#6
0
    if songs is None:
        await lyric.edit(f"Song **{artist} - {song}** not found!")
        return
    if len(songs.lyrics) > 4096:
        await lyric.edit("`Lyrics is too big, view the file to see it.`")
        with open("lyrics.txt", "w+") as f:
            f.write(f"Search query: \n{artist} - {song}\n\n{songs.lyrics}")
        await lyric.client.send_file(
            lyric.chat_id,
            "lyrics.txt",
            reply_to=lyric.id,
        )
        os.remove("lyrics.txt")
    else:
        await lyric.edit(
            f"**Search query**: \n`{artist} - {song}`\n\n```{songs.lyrics}```")
    return


CMD_HELP.update({
    "lyrics":
    ".lyrics song name \
    \n USAGE: Searches A Song Lyric and sends you if Song name doesnt work try along with artist name"
    "**Usage:** .`glyrics <artist name> - <song name>`\n"
    "__note__: **-** Is neccessary when searching the lyrics to divided artist and song \n"
    "Genius lyrics plugin \n"
    "Get this value from https://genius.com/developers \n"
    "Add:-  GENIUS_API_TOKEN and token value in Heroku app settings \n"
    "Lyrics Plugin Syntax: .lyrics <aritst name - song nane>"
})
示例#7
0
def is_gif(file):
    # ngl this should be fixed, telethon.utils.is_gif but working
    # lazy to go to github and make an issue kek
    if not is_video(file):
        return False
    if DocumentAttributeAnimated() not in getattr(file, "document", file).attributes:
        return False
    return True


CMD_HELP.update(
    {
        "anime": ".anime <anime>\
    \nUsage: Returns with Anime information.\
    \n\n.manga <manga name>\
    \nUsage: Returns with the Manga information.\
    \n\n.akaizoku or .akayo <anime name>\
    \nUsage: Returns with the Anime Download link.\
    \n\n.char <character name>\
    \nUsage: Return with character information.\
    \n\n.upcoming\
    \nUsage: Returns with Upcoming Anime information.\
    \n\n.scanime <anime> or .sanime <anime>\
    \nUsage: Search anime.\
    \n\n.smanga <manga>\
    \nUsage: Search manga.\
    \n\n.whatanime Reply with media.\
    \nUsage: Find anime from media file."
    }
)
示例#8
0
                afk_since = "**Yesterday**"
            elif days > 1:
                if days > 6:
                    date = now + datetime.timedelta(
                        days=-days, hours=-hours, minutes=-minutes)
                    afk_since = date.strftime("%A, %Y %B %m, %H:%I")
                else:
                    wday = now + datetime.timedelta(days=-days)
                    wday.strftime("%A")
            elif hours > 1:
                f"`{int(hours)}h{int(minutes)}m` **ago**"
            elif minutes > 0:
                f"`{int(minutes)}m{int(seconds)}s` **ago**"
            else:
                f"`{int(seconds)}s` **ago**"
        msg = None
        message_to_reply = (
            f"**Hi. I'm not here right now..but maybe i am..or maybe it's a program..or maybe I'm a program in the Matrix..omg help!!**  \n**AFKT** : `{total_afk_time}`\n**Reason** : `{reason}`"
            + f"\n\n**BEEP BEEP..PLEASE LEAVE A MESSAGE!**" if reason else
            f"**You Didn't Give Me A Quarter, THerefore I Dont't Give A Crap**\n AFK : `{total_afk_time}` Hold Up.. will come back if any change in plans"
        )
        msg = await event.reply(message_to_reply)
        await asyncio.sleep(5)
        if event.chat_id in last_afk_message:  # pylint:disable=E0602
            await last_afk_message[event.chat_id].delete()  # pylint:disable=E0602
        last_afk_message[event.chat_id] = msg  # pylint:disable=E0602


CMD_HELP.update(
    {"afk": " `.afk` <optional reason>\nUsage - Sets your status to Offline."})
示例#9
0
import asyncio

from pearl.utils import pearl_on_cmd
from pearl import CMD_HELP


# @command(pattern="^.cmds", outgoing=True)
@pearl.on(pearl_on_cmd(pattern=r"cmds"))
async def install(event):
    if event.fwd_from:
        return
    cmd = "ls pearl/modules"
    process = await asyncio.create_subprocess_shell(
        cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
    stdout, stderr = await process.communicate()
    o = stdout.decode()
    _o = o.split("\n")
    o = "\n".join(_o)
    OUTPUT = f"**List of Plugins:**\n - {o}\n\n**HELP:** __All commands are can be viewed by, doing:-__ \n `.help <plugin name>` **without the < > brackets.**\n__All modules might not work directly__"
    await event.edit(OUTPUT)


CMD_HELP.update(
    {"cmd_list": ".cmds\nUsage - Get the list of all plugins in Black Pearl."})
示例#10
0
        await event.edit("```Reply to any user message.```")
        return
    reply_message = await event.get_reply_message()
    chat = "@QuotLyBot"
    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)


CMD_HELP.update(
    {"quotly": ".q \
          \nUsage: Enhance ur text to sticker."})
示例#11
0
    r = random.randint(1, 100)
    input_str = event.pattern_match.group(1)
    if input_str:
        input_str = input_str.lower()
    if r % 2 == 1:
        if input_str == "Heads":
            await event.edit("The coin landed on: **Heads**. \n K You Win .")
        elif input_str == "Tails":
            await event.edit(
                "The coin landed on: **Heads**. \n Sed Laife, You weren't correct, try again ..."
            )
        else:
            await event.edit("The coin landed on: **Heads**.")
    elif r % 2 == 0:
        if input_str == "Tails":
            await event.edit("The coin landed on: **Tails**. \n K You Win.")
        elif input_str == "Heads":
            await event.edit(
                "The coin landed on: **Tails**. \n Sed Laife, You weren't correct, try again ..."
            )
        else:
            await event.edit("The coin landed on: **Tails**.")
    else:
        await event.edit("¯\_(ツ)_/¯")

CMD_HELP.update(
    {
        "coinflip": ".coin\nUsage : This plugin flips the coin to land on heads or tails."
    }
)        
示例#12
0
    u, t, g, o, s, n = inp.split(), "🗑", "<(^_^ <)", "(> ^_^)>", "⠀ ", "\n"
    h = [(u[0], u[1], u[2]), (u[0], u[1], ""), (u[0], "", "")]
    for something in reversed(
        [
            y
            for y in (
                [
                    "".join(x)
                    for x in (
                        f + (s, g, s + s * f.count(""), t),
                        f + (g, s * 2 + s * f.count(""), t),
                        f[:i] + (o, f[i], s * 2 + s * f.count(""), t),
                        f[:i] + (s + s * f.count(""), o, f[i], s, t),
                        f[:i] + (s * 2 + s * f.count(""), o, f[i], t),
                        f[:i] + (s * 3 + s * f.count(""), o, t),
                        f[:i] + (s * 3 + s * f.count(""), g, t),
                    )
                ]
                for i, f in enumerate(reversed(h))
            )
        ]
    ):
        for something_else in something:
            await asyncio.sleep(0.3)
            try:
                await message.edit(something_else)
            except MessageIdInvalidError:
                return
            
CMD_HELP.update({"dumpster": ".waste\nUsage - useless."})
示例#13
0
        await event.edit(
            '`"What is the most important change that should be made to your country’s education system?"`'
        )

    if x == 56:

        await event.edit('`"Send your favourite sticker pack."`')

    if x == 57:

        await event.edit('`"Send your favourite animated sticker pack."`')

    if x == 58:

        await event.edit('`"Send your favourite video or gif."`')

    if x == 59:

        await event.edit('`"Send your favourite emojies"`')

    if x == 60:

        await event.edit(
            '`"What’s something you misunderstood as a child and only realized much later was wrong?"`'
        )


CMD_HELP.update(
    {"conversationqt": ".qt\nUsage - Helps starting a conversation."})
示例#14
0
                    user_object = await event.client.get_entity(input_str)
                    user_id = user_object.id
                    replied_user = await event.client(
                        GetFullUserRequest(user_id))
                    return replied_user, None
                except Exception as e:
                    return None, e
        elif event.is_private:
            try:
                user_id = event.chat_id
                replied_user = await event.client(GetFullUserRequest(user_id))
                return replied_user, None
            except Exception as e:
                return None, e
        else:
            try:
                user_object = await event.client.get_entity(int(input_str))
                user_id = user_object.id
                replied_user = await event.client(GetFullUserRequest(user_id))
                return replied_user, None
            except Exception as e:
                return None, e


CMD_HELP.update({
    "clone":
    ".clone <reply to user who you want to clone>.\
    \nUsage - clone the replied user account.\
    "
})
示例#15
0
    img = ImageEnhance.Sharpness(img).enhance(randint(5, 300))

    return img


async def check_media(reply_message):
    if reply_message and reply_message.media:
        if reply_message.photo:
            data = reply_message.photo
        elif reply_message.document:
            if (DocumentAttributeFilename(file_name="AnimatedSticker.tgs")
                    in reply_message.media.document.attributes):
                return False
            if (reply_message.gif or reply_message.video or reply_message.audio
                    or reply_message.voice):
                return False
            data = reply_message.media.document
        else:
            return False
    else:
        return False

    if not data or data is None:
        return False
    else:
        return data


CMD_HELP.update(
    {"deepfryer": ".df <reply to pic>\nUsage - Deepfry the picture."})
示例#16
0
    if group == "all":
        lim = 0
    elif group.isdigit():
        lim = int(group)
    else:
        lim = 1

    pfplist = await delpfp.client(
        GetUserPhotosRequest(user_id=delpfp.from_id,
                             offset=0,
                             max_id=0,
                             limit=lim))
    input_photos = []
    for sep in pfplist.photos:
        input_photos.append(
            InputPhoto(
                id=sep.id,
                access_hash=sep.access_hash,
                file_reference=sep.file_reference,
            ))
    await delpfp.client(DeletePhotosRequest(id=input_photos))
    await edit_or_reply(
        delpfp,
        f"`Successfully deleted {len(input_photos)} profile picture(s).`")


CMD_HELP.update({
    "delfp":
    ".delpfp <profile pictures count>\nUsage : This plugin deletes requested number of profile pictures."
})
示例#17
0
PM_IMG = Config.ALIVE_IMAGE
pm_caption = "➢ **BLACK PEARL IS:** SAILING\n\n"
pm_caption += "✪༺ ──•◈•───•◈•──༻✪\n"
pm_caption += "➢ **SYSTEMS STATS**\n"
pm_caption += "➢ **Telethon Version:** `1.15.0` \n"
pm_caption += "➢ **Python:** `3.7.4` \n"
pm_caption += f"➢ **Uptime** : `{uptime}` \n"
pm_caption += "➢ **Database Status:**  `Functional`\n"
pm_caption += "➢ **Current Branch** : `master`\n"
pm_caption += f"➢ **Version** : `1.0`\n"
pm_caption += f"➢ **My Captian** : {DEFAULTUSER} \n"
pm_caption += "➢ **Heroku Database** : `AWS - WORKS LIKE A CHARM`\n"
pm_caption += "➢ **License** : [GNU General Public License v3.0](github.com/PEARLGANG/BlackPearl/blob/main/LICENSE)\n"
pm_caption += "➢ **Copyright** : By [Github](GitHub.com/PEARLGANG)\n"
pm_caption += "➢ **Check Stats By Doing** `.stat`. \n"
pm_caption += "✪༺ ──•◈•───•◈•──༻✪\n\n"
pm_caption += "➢ **[Deploy Black Pearl](https://heroku.com/deploy?template=https://github.com/PEARLGANG/BlackPearl)** \n"


@pearl.on(pearl_on_cmd(pattern=r"alive"))
@pearl.on(sudo_cmd(pattern=r"alive", allow_sudo=True))
async def pearl(alive):
    await alive.get_chat()
    """ For .alive command, check if the bot is running.  """
    await borg.send_file(alive.chat_id, PM_IMG, caption=pm_caption)
    await alive.delete()


CMD_HELP.update(
    {"alive": "`.alive`\nUsage - Check if Black Pearl is working."})
示例#18
0
        else:
            color_scheme = str(random.randint(1, 29))
            driver.find_element_by_id(("downshift-0-item-" + color_scheme)).click()
        driver.find_element_by_id("export-menu").click()
        driver.find_element_by_xpath("//button[contains(text(),'4x')]").click()
        driver.find_element_by_xpath("//button[contains(text(),'PNG')]").click()
        await e.edit("`Processing..\n75%`")
        # Waiting for downloading
        sleep(2.5)
        color_name = driver.find_element_by_xpath(
            "/html/body/div[1]/main/div[3]/div[2]/div[1]/div[1]/div/span[2]/input"
        ).get_attribute("value")
        await e.edit("`Done Dana Done...\n100%`")
        file = "./carbon.png"
        await e.edit("`Uploading..`")
        await e.client.send_file(
            e.chat_id,
            file,
            caption="<< `Here's your carbon!` \n **Carbonised Using** [Black Pearl](https://github.com/IntelligentSammy/BlackPearl)>>\n**Colour Scheme: **`{}`".format(
                color_name
            ),
            force_document=True,
            reply_to=e.message.reply_to_msg_id,
        )
        os.remove("./carbon.png")
        driver.quit()
        # Removing carbon.png after uploading
        await e.delete()  # Deleting msg
        
CMD_HELP.update({"carbon": ".carbon <text/reply to text>\nUsage - Generate a carbon for the text."})
示例#19
0
            try:
                mg = div.p.a["href"]
                magnets.append(mg)
            except Exception:
                pass
    print("Found Magnets...")
    shorted_links = dogbin(magnets)
    print("Dogged Magnets to del.dog...")
    msg = ""
    try:
        search_str = search_str.replace("+", " ")
    except BaseException:
        pass
    msg = "**Torrent Search Query**\n`{}`".format(
        search_str) + "\n**Results**\n"
    counter = 0
    while counter != len(titles):
        msg = (msg + "⁍ [{}]".format(titles[counter]) +
               "({})".format(shorted_links[counter]) + "\n\n")
        counter = counter + 1
    await event.edit(msg, link_preview=False)


CMD_HELP.update({
    "torrent":
    ".ts Search query.\
    \nUsage: Search for torrent query and post to dogbin.\
    \n\n.tos Search query.\
    \nUsage: Search for torrent magnet from query."
})
示例#20
0
        if not event.is_channel and event.is_group:
            # https://lonamiwebs.github.io/Telethon/methods/messages/add_chat_user.html
            for user_id in to_add_users.split(" "):
                try:
                    await borg(
                        functions.messages.AddChatUserRequest(
                            chat_id=event.chat_id,
                            user_id=user_id,
                            fwd_limit=1000000))
                except Exception as e:
                    await event.reply(str(e))
            await event.edit("Invited Successfully")
        else:
            # https://lonamiwebs.github.io/Telethon/methods/channels/invite_to_channel.html
            for user_id in to_add_users.split(" "):
                try:
                    await borg(
                        functions.channels.InviteToChannelRequest(
                            channel=event.chat_id, users=[user_id]))
                except Exception as e:
                    await event.reply(str(e))
            await edit_or_reply(event, "Invited Successfully")


CMD_HELP.update({
    "add":
    "\
\n\nSyntax :.invite <user_id or user-name>\
\nUsage : Adds User To Group"
})
示例#21
0
            f"**Error**\nusage `.dealyspam <time in seconds> <count> <text>`")


CMD_HELP.update({
    "spam":
    "⚠️ Spam at your own risk !!\
\n\n`.spam/.sp` <count> <text>\
\n**Usage:**  Floods text in the chat !!\
\n\n`.scam/.sc` <time in seconds> <action>\
\n**Usage:**  Scam by fake actions like typing, sending photo......!!\
\n\n`.cspam/.csp` <text>\
\n**Usage:**  Spam the text letter by letter.\
\n\n`.rspam/.rsp` <count> <text>\
\n**Usage:**  Repeats the text for a number of times.\
\n\n`.wspam/.wsp` <text>\
\n**Usage:**  Spam the text word by word.\
\n\n`.mspam/.msp` <count> <reply to a media message>\
\n**Usage:**  As if text spam was not enough !!\
\n\n`.delayspam/.dsp` <delay> <count> <text>\
\n**Usage:**  spam with custom delay.\
\n\n`.dmspam/.dmsp` <delay> <count> <reply to a media message>\
\n**Usage:**  mspam with custom delay.\
\n\n**Spam_protect**\
\n**Usage:**  Protect your groups from scammers.\
\nFor on `.set var SPAM_PROTECT True` , for off `.del var SPAM_PROTECT`\
\n You need to set up api key for that\
\n More information click [here](https://t.me/pearlsupport)\
\n\n**All commands support sudo , type .help sudo for more info**\
"
})
示例#22
0
    return user_obj


CMD_HELP.update({
    "admin":
    ".promote <username/reply> <custom rank (optional)>\
\nUsage: Provides admin rights to the person in the chat.\
\n\n.demote <username/reply>\
\nUsage: Revokes the person's admin permissions in the chat.\
\n\n.ban <username/reply> <reason (optional)>\
\nUsage: Bans the person off your chat.\
\n\n.unban <username/reply>\
\nUsage: Removes the ban from the person in the chat.\
\n\n.mute <username/reply> <reason (optional)>\
\nUsage: Mutes the person in the chat, works on admins too.\
\n\n.unmute <username/reply>\
\nUsage: Removes the person from the muted list.\
\n\n.gmute <username/reply> <reason (optional)>\
\nUsage: Mutes the person in all groups you have in common with them.\
\n\n.ungmute <username/reply>\
\nUsage: Reply someone's message with .ungmute to remove them from the gmuted list.\
\n\n.delusers\
\nUsage: Searches for deleted accounts in a group. Use .delusers clean to remove deleted accounts from the group.\
\n\n.admins\
\nUsage: Retrieves a list of admins in the chat.\
\n\n.users or .users <name of member>\
\nUsage: Retrieves all (or queried) users in the chat.\
\n\n.setgppic <reply to image>\
\nUsage: Changes the group's display picture."
})
示例#23
0
            await hazmat.edit("`Can't handle this GIF...`")
            await hazmat.client.delete_messages(
                conv.chat_id, [msg.id, response.id, r.id, msg_reply.id])
            return
        else:
            downloaded_file_name = await hazmat.client.download_media(
                response.media, TEMP_DOWNLOAD_DIRECTORY)
            await hazmat.client.send_file(
                hazmat.chat_id,
                downloaded_file_name,
                force_document=False,
                reply_to=message_id_to_reply,
            )
            """ - cleanup chat after completed - """
            if msg_reply is not None:
                await hazmat.client.delete_messages(
                    conv.chat_id, [msg.id, msg_reply.id, r.id, response.id])
            else:
                await hazmat.client.delete_messages(conv.chat_id,
                                                    [msg.id, response.id])
    await hazmat.delete()
    return os.remove(downloaded_file_name)


CMD_HELP.update({
    "hazmat":
    ".hz or .hz [flip, x2, rotate (degree), background (number), black]"
    "\nUsage: Reply to a image / sticker to suit up!"
    "\n@hazmat_suit_bot"
})
示例#24
0
    SPOTIFYCHECK = True
    await sleep(4)
    await update_spotify_info()


@register(outgoing=True, pattern="^.enablespotify$")
async def set_biostgraph(setstbio):
    setrecursionlimit(700000)
    if not SPOTIFYCHECK:
        environ["errorcheck"] = "0"
        await setstbio.edit(SPO_BIO_ENABLED)
        await get_spotify_token()
        await dirtyfix()
    else:
        await setstbio.edit(SPO_BIO_RUNNING)


@register(outgoing=True, pattern="^.disablespotify$")
async def set_biodgraph(setdbio):
    global SPOTIFYCHECK
    global RUNNING
    SPOTIFYCHECK = False
    RUNNING = False
    await bot(UpdateProfileRequest(about=DEFAULT_BIO))
    await setdbio.edit(SPO_BIO_DISABLED)


CMD_HELP.update({"enablespotify": "Usage: Enable Spotify bio updating."})

CMD_HELP.update({"disablespotify": "Usage: Disable Spotify bio updating."})
示例#25
0
""".admin Plugin """
from telethon.tl.types import ChannelParticipantsAdmins
from uniborg.util import pearl_on_cmd
from pearl import CMD_HELP


@pearl.on(pearl_on_cmd(pattern="admins"))
async def _(event):
    if event.fwd_from:
        return
    mentions = "@admin: **Spam Spotted**"
    chat = await event.get_input_chat()
    async for x in borg.iter_participants(chat,
                                          filter=ChannelParticipantsAdmins):
        mentions += f"[\u2063](tg://user?id={x.id})"
    reply_message = None
    if event.reply_to_msg_id:
        reply_message = await event.get_reply_message()
        await reply_message.reply(mentions)
    else:
        await event.reply(mentions)
    await event.delete()


CMD_HELP.update({
    "calladmin":
    ".admins\nUsage : use this plugin to mention all the admins in a group."
})
示例#26
0
import random

from pearl.util import pearl_on_cmd, edit_or_reply
from pearl import CMD_HELP

RUNSREACTS = [
    "`Congratulations and BRAVO!`",
    "`You did it! So proud of you!`",
    "`This calls for celebrating! Congratulations!`",
    "`I knew it was only a matter of time. Well done!`",
    "`Congratulations on your well-deserved success.`",
    "`Heartfelt congratulations to you.`",
    "`Warmest congratulations on your achievement.`",
    "`Congratulations and best wishes for your next adventure!”`",
    "`So pleased to see you accomplishing great things.`",
    "`Feeling so much joy for you today. What an impressive achievement!`",
]


@pearl.on(pearl_on_cmd(pattern="congo"))
async def _(event):
    if event.fwd_from:
        return
    bro = random.randint(0, len(RUNSREACTS) - 1)
    reply_text = RUNSREACTS[bro]
    await edit_or_reply(event, reply_text)


CMD_HELP.update({"congratulations": ".congo\nUsage - Congratulate a person."})
示例#27
0
"""
.bye
"""
import time

from telethon.tl.functions.channels import LeaveChannelRequest

from pearl.utils import pearl_on_cmd, edit_or_reply, sudo_cmd
from pearl import CMD_HELP


@pearl.on(pearl_on_cmd("bye", outgoing=True))
@pearl.on(sudo_cmd("bye", allow_sudo=True))
async def leave(e):
    pearlgang = await edit_or_reply(e, "Bye Kek")
    if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
        await pearlgang.edit("`F**k This I'm Out.....!`")
        time.sleep(3)
        if "-" in str(e.chat_id):
            await borg(LeaveChannelRequest(e.chat_id))
        else:
            await pearlgang.edit(
                "`You Think This Is A Chat?... Then F**k You Its Not!!`")


CMD_HELP.update({"bye": ".bye\nUsage - Leave the group."})
示例#28
0
    response += f"**Unread:** {unread} \n"
    response += f"**Unread Mentions:** {unread_mentions} \n\n"
    response += f"__It Took:__ {stop_time:.02f}s \n"

    await event.edit(response)


def make_mention(user):
    if user.username:
        return f"@{user.username}"
    else:
        return inline_mention(user)


def inline_mention(user):
    full_name = user_full_name(user) or "No Name"
    return f"[{full_name}](tg://user?id={user.id})"


def user_full_name(user):
    names = [user.first_name, user.last_name]
    names = [i for i in list(names) if i]
    full_name = " ".join(names)
    return full_name


CMD_HELP.update({
    "count":
    ".count\nUsage : This plugin shows detailed stats about your account."
})
示例#29
0
    await event.edit("`Uploading Glitched Media...`")
    c_time = time.time()
    nosave = await event.client.send_file(
        event.chat_id,
        Glitched,
        force_document=False,
        reply_to=event.reply_to_msg_id,
        progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
            progress(d, t, event, c_time, "[UPLOAD]")),
    )
    await event.delete()
    os.remove(Glitched)
    await bot(
        functions.messages.SaveGifRequest(
            id=types.InputDocument(
                id=nosave.media.document.id,
                access_hash=nosave.media.document.access_hash,
                file_reference=nosave.media.document.file_reference,
            ),
            unsave=True,
        ))
    os.remove(glitch_file)


CMD_HELP.update({
    "glitch":
    ".glitch <1-8>\
            \nUsage: Reply a sticker/image and send with cmd.\
            \nvalue is range 1-8 if doenst it will give default value which is 2"
})
示例#30
0
"""Quickly make a decision
Syntax: .decide"""
import requests

from pearl.utils import pearl_on_cmd
from pearl import CMD_HELP


@pearl.on(pearl_on_cmd("decide"))
async def _(event):
    if event.fwd_from:
        return
    message_id = event.message.id
    if event.reply_to_msg_id:
        message_id = event.reply_to_msg_id
    r = requests.get("https://yesno.wtf/api").json()
    await borg.send_message(event.chat_id,
                            r["answer"],
                            reply_to=message_id,
                            file=r["image"])
    await event.delete()


CMD_HELP.update(
    {"decide": ".decide\nUsage : Use this plugin to quickly make a decision."})