"""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:
from pearl.utils import sudo_cmd, pearl_on_cmd, edit_or_reply, load_module, remove_plugin import asyncio import os from datetime import datetime from pathlib import Path DELETE_TIMEOUT = 5 @pearl.on(pearl_on_cmd(pattern="install", outgoing=True)) async def install(event): if event.fwd_from: return if event.reply_to_msg_id: try: downloaded_file_name = ( await event.client.download_media( # pylint:disable=E0602 await event.get_reply_message(), "pearl/modules/", # pylint:disable=E0602 )) if "(" not in downloaded_file_name: path1 = Path(downloaded_file_name) shortname = path1.stem load_module(shortname.replace(".py", "")) await event.edit( "BLACK PEARL Has Installed `{}` Sucessfully.".format( os.path.basename(downloaded_file_name))) else: os.remove(downloaded_file_name) await event.edit( "Errors! This plugin is already installed/pre-installed.") except Exception as e: # pylint:disable=C0103,W0703
return await event.edit("Something Went Wrong", str(err)) return user_obj, extra async def get_user_from_id(user, event): if isinstance(user, str): user = int(user) try: user_obj = await event.client.get_entity(user) except (TypeError, ValueError) as err: await event.edit(str(err)) return None return user_obj @pearl.on(pearl_on_cmd(pattern="gban ?(.*)")) async def gspider(pearl): lol = pearl sender = await lol.get_sender() me = await lol.client.get_me() if not sender.id == me.id: pearl = await lol.reply("Gbanning This User !") else: pearl = await lol.edit("Wait Processing.....") me = await pearl.client.get_me() await pearl.edit(f"Global Ban Is Coming ! Wait And Watch You N***a") my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id) f"@{me.username}" if me.username else my_mention await pearl.get_chat() a = b = 0 if pearl.is_private:
"""command: .abusehin , .abusemal""" #!/usr/bin/env python3 # -*- coding: utf-8 -*- import random from pearl.utils import pearl_on_cmd @pearl.on(pearl_on_cmd(pattern=r"habuse(.*)", outgoing=True)) async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) if input_str in "hin": emoticons = [ "Maderchod- M**********R", "Bhosadike-BORN FROM A ROTTEN PUSSY", "Bhen chod-Sister f****r", "Bhadhava- Pimp", "Bhadhava- Pimp", "Chodu- F****r", "Chutiya- F****r, bastard", "Gaand- ASS", "Gaandu-Asshole", "Gadha, Bakland- Idiot", "Lauda, Lund- Penis, dick, c**k", "Hijra- Gay, Transsexual", "Kuttiya- Bitch", "Paad- FART",
"\U0001F800-\U0001F8FF" # Supplemental Arrows-C "\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(
"""Emoji Available Commands: .think""" import asyncio from pearl.utils import pearl_on_cmd @pearl.on(pearl_on_cmd("think")) async def _(event): if event.fwd_from: return animation_interval = 0.5 animation_ttl = range(0, 288) # await event.edit(input_str) await event.edit("thinking") animation_chars = [ "THINKING", "THI&K#N₹", "T+IN@I?G", "¿H$NK∆NG", "¶H×NK&N*", "NGITHKIN", "T+I#K@₹G", "THINKING", "THI&K#N₹", "T+IN@I?G",
"""Get weather data using OpenWeatherMap Syntax: .weather <Location> .wttr <location> """ import io import time import aiohttp from pearl.utils import pearl_on_cmd @pearl.on(pearl_on_cmd(pattern="weathers (.*)")) async def _(event): if event.fwd_from: return sample_url = ( "https://api.openweathermap.org/data/2.5/weather?q={}&APPID={}&units=metric" ) input_str = event.pattern_match.group(1) async with aiohttp.ClientSession() as session: response_api_zero = await session.get( sample_url.format(input_str, Config.OPEN_WEATHER_MAP_APPID)) response_api = await response_api_zero.json() if response_api["cod"] == 200: country_code = response_api["sys"]["country"] country_time_zone = int(response_api["timezone"]) sun_rise_time = int(response_api["sys"]["sunrise"]) + country_time_zone sun_set_time = int(response_api["sys"]["sunset"]) + country_time_zone await event.edit("""{} **Temperature**: {}°С
"""Emoji Available Commands: .support """ import asyncio from pearl.utils import pearl_on_cmd @pearl.on(pearl_on_cmd("BlackPearl")) async def _(event): if event.fwd_from: return animation_interval = 1 animation_ttl = range(0, 36) # input_str = event.pattern_match.group(1) # if input_str == "support": await event.edit("For Our Support Group") animation_chars = [ "Click Here", "[Support Group](https://t.me/pearlsupport)", ] for i in animation_ttl: await asyncio.sleep(animation_interval) await event.edit(animation_chars[i % 18])
import os from datetime import datetime import requests from bs4 import BeautifulSoup from google_images_download import google_images_download from pearl.utils import pearl_on_cmd, edit_or_reply, sudo_cmd def progress(current, total): logger.info("Downloaded {} of {}\nCompleted {}".format( current, total, (current / total) * 100)) @pearl.on(pearl_on_cmd(pattern="search (.*)")) @pearl.on(sudo_cmd(pattern="search (.*)", allow_sudo=True)) async def _(event): stark = await edit_or_reply(event, "`Processing Your Request`") if event.fwd_from: return start = datetime.now() await stark.edit("`Trying To Connect...`") # SHOW_DESCRIPTION = False input_str = event.pattern_match.group( 1 ) # + " -inurl:(htm|html|php|pls|txt) intitle:index.of \"last modified\" (mkv|mp4|avi|epub|pdf|mp3)" input_url = "https://bots.shrimadhavuk.me/search/?q={}".format(input_str) headers = {"USER-AGENT": "BlackPearl"} response = requests.get(input_url, headers=headers).json() output_str = " "
# c += 1 # elif d.is_group: # g += 1 # else: # logger.info(d.stringify()) # end = datetime.now() # ms = (end - start).seconds # await event.edit("""Obtained in {} seconds. # Users:\t{} # Groups:\t{} # Super Groups:\t{} # Channels:\t{} # Bots:\t{}""".format(ms, u, g, c, bc, b)) @pearl.on(pearl_on_cmd(pattern="count")) async def stats( event: NewMessage.Event, ) -> None: # pylint: disable = R0912, R0914, R0915 """Command to get stats about the account""" await event.edit("`Collecting stats, Wait Master`") start_time = time.time() private_chats = 0 bots = 0 groups = 0 broadcast_channels = 0 admin_in_groups = 0 creator_in_groups = 0 admin_in_broadcast_channels = 0 creator_in_channels = 0 unread_mentions = 0
"""Restart or Terminate the bot from any chat Available Commands: .restart .shutdown""" import os import sys import asyncio from pearl.utils import pearl_on_cmd @pearl.on(pearl_on_cmd("restart")) async def _(event): if event.fwd_from: return # await asyncio.sleep(2) # await event.edit("Restarting [██░] ...\n`.ping` me or `.help` to check if I am online after a lil bit.") # await asyncio.sleep(2) # await event.edit("Restarting [███]...\n`.ping` me or `.help` to check if I am online after a lil bit.") # await asyncio.sleep(2) await event.edit("Restarted. `.ping` me or `.help` to check if I am online" ) await borg.disconnect() # https://archive.is/im3rt os.execl(sys.executable, sys.executable, *sys.argv) # You probably don't need it but whatever quit() @pearl.on(pearl_on_cmd("shutdown")) async def _(event): if event.fwd_from:
"""Emoji Available Commands: .wtf""" import asyncio from pearl.utils import pearl_on_cmd @pearl.on(pearl_on_cmd("wtf")) async def _(event): if event.fwd_from: return animation_interval = 0.3 animation_ttl = range(0, 5) await event.edit("wtf") animation_chars = [ "What", "What The", "What The F", "What The F Bitch", "[What The F Bitch](https://telegra.ph/file/c2421ad9fc88e2a6f2937.jpg)", ] for i in animation_ttl: await asyncio.sleep(animation_interval) await event.edit(animation_chars[i % 5])
"""Check your internet speed powered by speedtest.net Syntax: .speedtest Available Options: image, file, text""" from datetime import datetime import speedtest from pearl.utils import pearl_on_cmd @pearl.on(pearl_on_cmd("speedtest ?(.*)")) async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) as_text = True as_document = False if input_str == "image": as_document = False elif input_str == "file": as_document = True elif input_str == "text": as_text = True await event.edit("`LETS CHECK IF MY NETWORK HAS GUTS OR NOT!`") start = datetime.now() s = speedtest.Speedtest() s.get_best_server() s.download() s.upload() end = datetime.now() ms = (end - start).microseconds / 1000
send_messages=None, 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)
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)
"""Get Detailed info about any message Syntax: .json""" import io from pearl.utils import pearl_on_cmd @pearl.on(pearl_on_cmd("json")) async def _(event): if event.fwd_from: return the_real_message = None reply_to_id = None if event.reply_to_msg_id: previous_message = await event.get_reply_message() the_real_message = previous_message.stringify() reply_to_id = event.reply_to_msg_id else: the_real_message = event.stringify() reply_to_id = event.message.id if len(the_real_message) > Config.MAX_MESSAGE_SIZE_LIMIT: with io.BytesIO(str.encode(the_real_message)) as out_file: out_file.name = "json.text" await borg.send_file( event.chat_id, out_file, force_document=True, allow_cache=False, reply_to=reply_to_id, ) await event.delete()
import requests from pearl.utils import pearl_on_cmd @pearl.on(pearl_on_cmd("ggl (.*)")) async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) sample_url = "https://da.gd/s?url=https://lmgtfy.com/?q={}%26iie=1".format( input_str.replace(" ", "+")) response_api = requests.get(sample_url).text if response_api: await event.edit("[{}]({})\n`Click on this you crap 🙃` ".format( input_str, response_api.rstrip())) else: await event.edit(" Strange!!..I Dind't found anything...")
from pearl.utils import pearl_on_cmd, sudo_cmd, edit_or_reply from var import Var @pearl.on(pearl_on_cmd(pattern="stat$")) async def stats(event): if event.fwd_from: return botusername = Var.TG_BOT_USER_NAME_BF_HER noob = "stats" if event.reply_to_msg_id: reply_to_id = await event.get_reply_message() tap = await bot.inline_query(botusername, noob) await tap[0].click(event.chat_id) await event.delete() @pearl.on(pearl_on_cmd(pattern="xogame$")) async def gamez(event): if event.fwd_from: return botusername = "******" noob = "play" if event.reply_to_msg_id: reply_to_id = await event.get_reply_message() tap = await bot.inline_query(botusername, noob) await tap[0].click(event.chat_id) await event.delete() @pearl.on(pearl_on_cmd(pattern="wspr ?(.*)"))
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 = (
import asyncio from pearl.utils import pearl_on_cmd from pearl import ALIVE_NAME rider = ALIVE_NAME @pearl.on(pearl_on_cmd("gangsta ?(.*)")) async def _(event): if not event.text[0].isalpha() and event.text[0] not in ("/", "#", "@", "!"): await event.edit("EVERyBOdy") await asyncio.sleep(0.3) await event.edit("iZ") await asyncio.sleep(0.2) await event.edit("GangSTur") await asyncio.sleep(0.5) await event.edit("UNtIL ") await asyncio.sleep(0.2) await event.edit("RiDeR") await asyncio.sleep(0.3) await event.edit("ArRivE") await asyncio.sleep(0.3) await event.edit("🔥🔥🔥") await asyncio.sleep(0.3) await event.edit("EVERyBOdy iZ GangSTur UNtIL {rider} ArRivE 🔥🔥🔥")
def zipdir(path, ziph): for root, dirs, files in os.walk(path): for file in files: ziph.write(os.path.join(root, file)) os.remove(os.path.join(root, file)) thumb_image_path = Config.TMP_DOWNLOAD_DIRECTORY + "/thumb_image.jpg" extracted = Config.TMP_DOWNLOAD_DIRECTORY + "extracted/" if not os.path.isdir(extracted): os.makedirs(extracted) @pearl.on(pearl_on_cmd(pattern="unzip")) async def _(event): if event.fwd_from: return mone = await event.edit("Processing ...") if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY): os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY) if event.reply_to_msg_id: start = datetime.now() reply_message = await event.get_reply_message() try: time.time() downloaded_file_name = await borg.download_media( reply_message, Config.TMP_DOWNLOAD_DIRECTORY, )
""" Syntax : .gps <location name> """ from geopy.geocoders import Nominatim from telethon.tl import types from pearl.utils import pearl_on_cmd, edit_or_reply, sudo_cmd @pearl.on(pearl_on_cmd(pattern="gps ?(.*)")) @pearl.on(sudo_cmd(pattern="gps ?(.*)", allow_sudo=True)) async def gps(event): pearlislub = await edit_or_reply(event, "Processing") if event.fwd_from: return reply_to_id = event.message if event.reply_to_msg_id: reply_to_id = await event.get_reply_message() input_str = event.pattern_match.group(1) if not input_str: return await pearlislub.edit("what should i find give me location.") await pearlislub.edit("finding") geolocator = Nominatim(user_agent="BlackPearl") geoloc = geolocator.geocode(input_str) if geoloc: lon = geoloc.longitude
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}`" )
from telethon.tl.functions.messages import GetStickerSetRequest 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`")
snip.media_file_reference, ) 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
"""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)))
""" .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."})
import asyncio, os from asyncio import wait, sleep from pearl import BOTLOG, BOTLOG_CHATID, CMD_HELP from pearl.utils import pearl_on_cmd @pearl.on(pearl_on_cmd(pattern=f"(?:scam|ssc)\s(.*)")) async def scam(rider): if not rider.is_private: chat = await rider.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator and chat.id == -1001191765261: return try: await rider.delete() except: pass options = ('typing', 'game', 'voice', 'round', 'video', 'photo', 'document') input_str = rider.pattern_match.group(1) args = input_str.split() if len(args) == 2: scam_action = str(args[1]).lower() if not scam_action in options: return await rider.reply( f"Failed \n\n •**Error:** Invalid Action\n\n You can use one of this \n{options}" ) try: scam_time = int(args[0]) except:
""" 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()
"""Invite the user(s) to the current chat Syntax: .invite <User(s)>""" from telethon import functions from pearl.utils import pearl_on_cmd """Invite the user(s) to the current chat Syntax: .invite <User(s)>""" from telethon import functions from pearl.utils import pearl_on_cmd, edit_or_reply from pearl import CMD_HELP @pearl.on(pearl_on_cmd(pattern="invite ?(.*)")) async def _(event): if event.fwd_from: return to_add_users = event.pattern_match.group(1) if event.is_private: await edit_or_reply( event, "`.invite` users to a chat, not to a Private Message") else: logger.info(to_add_users) 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(