""" .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."})
""" Google Translate Available Commands: .tr LanguageCode as reply to a message .tr LangaugeCode | text to translate""" import emoji from googletrans import Translator from pearl.utils import pearl_on_cmd, edit_or_reply, sudo_cmd @pearl.on(pearl_on_cmd("tr ?(.*)")) @pearl.on(sudo_cmd("tr ?(.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return if "trim" in event.raw_text: # https://t.me/c/1220993104/192075 return input_str = event.pattern_match.group(1) if event.reply_to_msg_id: previous_message = await event.get_reply_message() text = previous_message.message lan = input_str or "gu" elif "|" in input_str: lan, text = input_str.split("|") else: await edit_or_reply(event, "`.tr LanguageCode` as reply to a message") return text = emoji.demojize(text.strip()) lan = lan.strip()
"\U0001F900-\U0001F9FF" # Supplemental Symbols and Pictographs "\U0001FA00-\U0001FA6F" # Chess Symbols "\U0001FA70-\U0001FAFF" # Symbols and Pictographs Extended-A "\U00002702-\U000027B0" # Dingbats "]+" ) def deEmojify(inputString: str) -> str: """Remove emojis and other non-safe characters from string""" return re.sub(EMOJI_PATTERN, "", inputString) # @register(outgoing=True, pattern="^.waifu(?: |$)(.*)", allow_sudo=True)) @pearl.on(pearl_on_cmd(pattern=r"stickfun(?: |$)(.*)")) @pearl.on(sudo_cmd(pattern=r"stickfun(?: |$)(.*)", allow_sudo=True)) 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))}"
) else: media = None event.message.id if event.reply_to_msg_id: event.reply_to_msg_id await event.reply(snip.reply, file=media) if event.chat_id not in last_triggered_filters: last_triggered_filters[event.chat_id] = [] last_triggered_filters[event.chat_id].append(name) await asyncio.sleep(DELETE_TIMEOUT) last_triggered_filters[event.chat_id].remove(name) @pearl.on(pearl_on_cmd(pattern="filter (.*)")) @pearl.on(sudo_cmd(pattern="filter (.*)", allow_sudo=True)) async def on_snip_save(event): hitler = await edit_or_reply(event, "Saving....") name = event.pattern_match.group(1) msg = await event.get_reply_message() if msg: snip = {"type": TYPE_TEXT, "text": msg.message or ""} if msg.media: media = None if isinstance(msg.media, types.MessageMediaPhoto): media = utils.get_input_photo(msg.media.photo) snip["type"] = TYPE_PHOTO elif isinstance(msg.media, types.MessageMediaDocument): media = utils.get_input_document(msg.media.document) snip["type"] = TYPE_DOCUMENT if media:
from youtubesearchpython import SearchVideos from pytube import YouTube import os import wget from pearl.Configs import Config import asyncio from pearl.utils import sudo_cmd, pearl_on_cmd, edit_or_reply @pearl.on(pearl_on_cmd(pattern="sg ?(.*)")) @pearl.on(sudo_cmd(pattern="sg ?(.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return urlissed = event.pattern_match.group(1) myself_pearl = await edit_or_reply( event, f"`Getting {urlissed} From Youtube Servers. Please Wait.`") search = SearchVideos(f"{urlissed}", offset=1, mode="dict", max_results=1) mi = search.result() mio = mi['search_result'] mo = mio[0]['link'] thum = mio[0]['title'] Pearl = mio[0]['id'] thums = mio[0]['channel'] kekme = f"https://img.youtube.com/vi/{BlackPearl}/hqdefault.jpg" await asyncio.sleep(0.6) if not os.path.isdir('./music/'): os.makedirs('./music/') path = Config.TMP_DOWNLOAD_DIRECTORY sedlyf = wget.download(kekme, out=path) pearl = (
remainder, result = divmod(seconds, 24) if seconds == 0 and remainder == 0: break time_list.append(int(result)) seconds = int(remainder) for x in range(len(time_list)): time_list[x] = str(time_list[x]) + time_suffix_list[x] if len(time_list) == 4: ping_time += time_list.pop() + ", " time_list.reverse() ping_time += ":".join(time_list) return ping_time @pearl.on(pearl_on_cmd(pattern="ping$")) @pearl.on(sudo_cmd(pattern="ping$", allow_sudo=True)) async def _(event): perumechanic = await edit_or_reply(event, "`Pong !`") if event.fwd_from: return start = datetime.now() end = datetime.now() ms = (end - start).microseconds uptime = get_readable_time((time.time() - Lastupdate)) await perumechanic.edit( f"**█▀▀█ █▀▀█ █▀▀█ █▀▀▀ █\n█░░█ █░░█ █░░█ █░▀█ ▀\n█▀▀▀ ▀▀▀▀ ▀░░▀ ▀▀▀▀ ▄**\n ➲ `{ms}` ms \n ➲ `{uptime}`" )
"""Get ID of any Telegram media, or any user Syntax: .get_id""" from telethon.utils import pack_bot_file_id from pearl.utils import pearl_on_cmd, edit_or_reply, sudo_cmd @pearl.on(pearl_on_cmd("get_id")) @pearl.on(sudo_cmd("get_id", allow_sudo=True)) async def _(event): pearlisgreat = await edit_or_reply(event, "Processing") if event.fwd_from: return if event.reply_to_msg_id: await event.get_input_chat() r_msg = await event.get_reply_message() if r_msg.media: bot_api_file_id = pack_bot_file_id(r_msg.media) await pearlisgreat.edit( "Current Chat ID: `{}`\nFrom User ID: `{}`\nBot API File ID: `{}`" .format(str(event.chat_id), str(r_msg.from_id), bot_api_file_id)) else: await pearlisgreat.edit( "Current Chat ID: `{}`\nFrom User ID: `{}`".format( str(event.chat_id), str(r_msg.from_id))) else: await pearlisgreat.edit("Current Chat ID: `{}`".format( str(event.chat_id)))
import io import os import lyricsgenius from tswift import Song from pearl import CMD_HELP from pearl.utils import pearl_on_cmd, edit_or_reply, sudo_cmd GENIUS = os.environ.get("GENIUS_API_TOKEN", None) @pearl.on(pearl_on_cmd(outgoing=True, pattern="lyrics (.*)")) @pearl.on(sudo_cmd(pattern="lyrics (.*)", allow_sudo=True)) async def _(event): await edit_or_reply(event, "Searching For Lyrics.....") reply_to_id = event.message.id if event.reply_to_msg_id: reply_to_id = event.reply_to_msg_id reply = await event.get_reply_message() if event.pattern_match.group(1): query = event.pattern_match.group(1) elif reply.text: query = reply.message else: await edit_or_reply(event, "`Am I Supposed To Find Any Kind Of Lyric? `") return song = "" song = Song.find_song(query)
from telethon.tl.types import ( DocumentAttributeSticker, InputStickerSetID, InputStickerSetShortName, MessageMediaPhoto, ) from pearl import ALIVE_NAME from pearl.utils import pearl_on_cmd, edit_or_reply, sudo_cmd DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "Who is this" FILLED_UP_DADDY = "Invalid pack selected." @pearl.on(pearl_on_cmd(pattern="kang ?(.*)")) @pearl.on(sudo_cmd(pattern="kang ?(.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return if not event.is_reply: await moods.edit("Reply to a photo to add to my 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 moods = await edit_or_reply( event, "`Hello, This Sticker Looks Noice. Mind if I steal it`") user = await bot.get_me()
send_media=None, send_stickers=None, send_gifs=None, send_games=None, send_inline=None, embed_links=None, ) MUTE_RIGHTS = ChatBannedRights(until_date=None, send_messages=True) UNMUTE_RIGHTS = ChatBannedRights(until_date=None, send_messages=False) # ================================================ @pearl.on(pearl_on_cmd(pattern=r"setgpic")) @pearl.on(sudo_cmd(pattern=r"setgpic", allow_sudo=True)) @errors_handler async def set_group_photo(gpic): """ For .setgpic command, changes the picture of a group """ if not gpic.is_group: await gpic.edit("`I don't think this is a group.`") return replymsg = await gpic.get_reply_message() chat = await gpic.get_chat() admin = chat.admin_rights creator = chat.creator photo = None if not admin and not creator: await gpic.edit(NO_ADMIN) return
"""Get Administrators of any Chat* Syntax: .get_admin""" from telethon.tl.types import ( ChannelParticipantAdmin, ChannelParticipantCreator, ChannelParticipantsAdmins, ) from pearl.utils import pearl_on_cmd, edit_or_reply, sudo_cmd @pearl.on(pearl_on_cmd("get_ad?(m)in ?(.*)")) @pearl.on(sudo_cmd("get_ad?(m)in ?(.*)", allow_sudo=True)) async def _(event): admeme = await edit_or_reply(event, "Processing") if event.fwd_from: return mentions = "**Admins in this Channel**: \n" should_mention_admins = False reply_message = None pattern_match_str = event.pattern_match.group(1) if "m" in pattern_match_str: should_mention_admins = True if event.reply_to_msg_id: reply_message = await event.get_reply_message() input_str = event.pattern_match.group(2) to_write_chat = await event.get_input_chat() chat = None if not input_str: chat = to_write_chat else:
import pyfiglet from pearl.utils import pearl_on_cmd, edit_or_reply, sudo_cmd @pearl.on(pearl_on_cmd(pattern="figlet ?(.*)", outgoing=True)) @pearl.on(sudo_cmd(pattern="figlet ?(.*)", allow_sudo=True)) async def figlet(event): arjun = await edit_or_reply(event, "`Making This Text Eye Catchy...!`") if event.fwd_from: return CMD_FIG = { "slant": "slant", "3D": "3-d", "5line": "5lineoblique", "alpha": "alphabet", "banner": "banner3-D", "doh": "doh", "iso": "isometric1", "letter": "letters", "allig": "alligator", "dotm": "dotmatrix", "bubble": "bubble", "bulb": "bulbhead", "digi": "digital", } input_str = event.pattern_match.group(1) if "|" in input_str: text, cmd = input_str.split("|", maxsplit=1) elif input_str is not None: cmd = None
"""Get Telegram Profile Picture and other information Syntax: .info @username""" # hmm import html from telethon.tl.functions.photos import GetUserPhotosRequest from telethon.tl.functions.users import GetFullUserRequest from telethon.tl.types import MessageEntityMentionName from telethon.utils import get_input_location from pearl.utils import pearl_on_cmd, edit_or_reply, sudo_cmd @pearl.on(pearl_on_cmd("info ?(.*)")) @pearl.on(sudo_cmd("info ?(.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return replied_user, error_i_a = await get_full_user(event) if replied_user is None: await edit_or_reply(event, str(error_i_a)) return False replied_user_profile_photos = await borg( GetUserPhotosRequest(user_id=replied_user.user.id, offset=42, max_id=0, limit=80)) replied_user_profile_photos_count = "K" try: replied_user_profile_photos_count = replied_user_profile_photos.count except AttributeError: