async def glitch(client, message): cmd = message.command amount = "" if len(cmd) > 1: amount = " ".join(cmd[1:]) elif len(cmd) == 1: amount = "2" profile_photo = "naruto/downloads/pfp.jpg" glitched_gif = "naruto/downloads/glitched_pfp.gif" replied = message.reply_to_message if not replied: await message.delete() return user = await client.get_users(replied.from_user.id) await client.download_media(user.photo.big_file_id, file_name=profile_photo) subprocess.run( ["glitch_this", profile_photo, f"{amount}", "--gif"], capture_output=True, text=True, ) await client.send_animation(message.chat.id, glitched_gif, reply_to_message_id=ReplyCheck(message)) await message.delete() os.remove(profile_photo) os.remove(glitched_gif)
async def spam_stick(client, message): if not message.reply_to_message: await edrep(message, text="**reply to a sticker with amount you want to spam**") return if not message.reply_to_message.sticker: await edrep(message, text="**reply to a sticker with amount you want to spam**") return else: times = message.command[1] if message.chat.type in ["supergroup", "group"]: for _ in range(int(times)): sticker = message.reply_to_message.sticker.file_id await client.send_sticker( message.chat.id, sticker, reply_to_message_id=ReplyCheck(message), ) await asyncio.sleep(0.20) if message.chat.type == "private": for _ in range(int(times)): sticker = message.reply_to_message.sticker.file_id await client.send_sticker(message.chat.id, sticker) await asyncio.sleep(0.20)
async def lastfm(client, message): x = await client.get_inline_bot_results("lastfmrobot", "") await message.delete() await message.reply_inline_bot_result( x.query_id, x.results[0].id, reply_to_message_id=ReplyCheck(message), hide_via=True, )
async def speed_test_inline(client, message): x = await client.get_inline_bot_results(f"{BotUsername}", "speedtest") await message.delete() await client.send_inline_bot_result( chat_id=message.chat.id, query_id=x.query_id, result_id=x.results[0].id, reply_to_message_id=ReplyCheck(message), hide_via=True, )
async def pat(client, message): async with aiohttp.ClientSession() as session: URL = "https://some-random-api.ml/animu/pat" async with session.get(URL) as request: if request.status == 404: return await edrep(message, text="**no Pats for u :c**") result = await request.json() url = result.get("link", None) await message.delete() await client.send_video(message.chat.id, url, reply_to_message_id=ReplyCheck(message))
async def spam(client, message): await message.delete() times = message.command[1] to_spam = " ".join(message.command[2:]) if message.chat.type in ["supergroup", "group"]: for _ in range(int(times)): await client.send_message(message.chat.id, to_spam, reply_to_message_id=ReplyCheck(message)) await asyncio.sleep(0.20) if message.chat.type == "private": for _ in range(int(times)): await client.send_message(message.chat.id, to_spam) await asyncio.sleep(0.20)
async def remove_bg(client, message): if not remove_bg_api: await edrep( message, text= "Get the API from [Remove.bg](https://www.remove.bg/b/background-removal-api)", disable_web_page_preview=True, parse_mode="html", ) replied = message.reply_to_message if (replied and replied.media and (replied.photo or (replied.document and "image" in replied.document.mime_type))): if os.path.exists(IMG_PATH): os.remove(IMG_PATH) await client.download_media(message=replied, file_name=IMG_PATH) try: rmbg = RemoveBg(remove_bg_api, "rm_bg_error.log") rmbg.remove_background_from_img_file(IMG_PATH) remove_img = IMG_PATH + "_no_bg.png" await client.send_document( chat_id=message.chat.id, document=remove_img, reply_to_message_id=ReplyCheck(message), disable_notification=True, ) await message.delete() os.remove(remove_img) os.remove(IMG_PATH) except Exception as e: print(e) await edrep(message, text="`Something went wrong!`") await sleep(3) await message.delete() else: await edrep(message, text="Usage: reply to a photo to remove background!")
async def get_note(client, message): if not DB_AVAILABLE: await message.edit("Your database is not avaiable!") return if len(message.text.split()) >= 2: note = message.text.split()[1] else: await message.edit("Give me a note tag!") getnotes = db.get_selfnote(message.from_user.id, note) if not getnotes: await message.edit("This note does not exist!") return if getnotes["type"] == Types.TEXT: teks, button = parse_button(getnotes.get("value")) button = build_keyboard(button) button = InlineKeyboardMarkup(button) if button else None if button: try: inlineresult = await naruto.get_inline_bot_results( f"@{BotUsername}", f"note {note}") except errors.exceptions.bad_request_400.BotInlineDisabled: await message.edit( "Your bot inline isn't available!\nCheck your bot for more information!" ) await setbot.send_message( Owner, "Hello, your notes is look like include button, but i can't do that " "because **inline mode** is not enabled.\n\n**To enable inline " "mode:**\n1. Go to @BotFather and type `/mybots`\n2. Select your bot, " "then click **Bot Settings**, click **Inline Mode**, then click " "**Turn on**.\nOther option is optional, you can edit inline " "placeholder as you like!\n\nAfter that, you can try again to get " "that note!", ) return try: await message.delete() await client.send_inline_bot_result( message.chat.id, inlineresult.query_id, inlineresult.results[0].id, reply_to_message_id=ReplyCheck(message), ) except IndexError: await message.edit( "An error has accured! Check your assistant for more information!" ) return else: await message.edit(teks) elif getnotes["type"] in ( Types.STICKER, Types.VOICE, Types.VIDEO_NOTE, Types.CONTACT, Types.ANIMATED_STICKER, ): await GET_FORMAT[getnotes["type"] ](message.chat.id, getnotes["file"], reply_to_message_id=ReplyCheck(message)) else: if getnotes.get("value"): teks, button = parse_button(getnotes.get("value")) button = build_keyboard(button) button = InlineKeyboardMarkup(button) if button else None else: teks = None button = None if button: try: inlineresult = await naruto.get_inline_bot_results( f"@{BotUsername}", f"note {note}") except errors.exceptions.bad_request_400.BotInlineDisabled: await message.edit( "Your bot inline isn't available!\nCheck your bot for more information!" ) await setbot.send_message( Owner, "Hello, your notes is look like include button, but i can't do that because " "**inline mode** is not enabled.\n\n**To enable inline mode:**\n1. Go to " "@BotFather and type `/mybots`\n2. Select your bot, then click **Bot " "Settings**, click **Inline Mode**, then click **Turn on**.\nOther option is " "optional, you can edit inline placeholder as you like!\n\nAfter that, " "you can try again to get that note!", ) return try: await message.delete() await client.send_inline_bot_result( message.chat.id, inlineresult.query_id, inlineresult.results[0].id, reply_to_message_id=ReplyCheck(message), ) except IndexError: message.edit( "An error has accured! Check your assistant for more information!" ) return else: await GET_FORMAT[getnotes["type"]]( message.chat.id, getnotes["file"], caption=teks, reply_to_message_id=ReplyCheck(message), )
async def tracemoe_rs(client, message): dis_loc = "" if message.reply_to_message: message_ = message.reply_to_message if message_.sticker and message_.sticker.file_name.endswith(".tgs"): await message.delete() return if message_.photo or message_.animation or message_.sticker: dis = await client.download_media(message=message_, file_name=screen_shot) dis_loc = os.path.join(screen_shot, os.path.basename(dis)) if message_.animation: await edrep(message, text="`Converting this Gif`") img_file = os.path.join(screen_shot, "grs.jpg") await take_screen_shot(dis_loc, 0, img_file) if not os.path.lexists(img_file): await edrep(message, text="`Something went wrong in Conversion`") await asyncio.sleep(5) await message.delete() return dis_loc = img_file if message_.video: nama = "video_{}-{}.mp4".format( message.reply_to_message.video.date, message.reply_to_message.video.file_size, ) await client.download_media(message.reply_to_message.video, file_name="naruto/downloads/" + nama) dis_loc = "naruto/downloads/" + nama img_file = os.path.join(screen_shot, "grs.jpg") await take_screen_shot(dis_loc, 0, img_file) if not os.path.lexists(img_file): await edrep(message, text="`Something went wrong in Conversion`") await asyncio.sleep(5) await message.delete() return if dis_loc: tracemoe = tracemoepy.async_trace.Async_Trace() if message_.video: search = await tracemoe.search(img_file, upload_file=True) os.remove(img_file) else: search = await tracemoe.search(dis_loc, upload_file=True) os.remove(dis_loc) result = search["docs"][0] ms_g = (f"**Title**: {result['title_english']}" f"\n**Similarity**: {result['similarity']*100}" f"\n**Episode**: {result['episode']}") preview = await tracemoe.natural_preview(search) with open("preview.mp4", "wb") as f: f.write(preview) await message.delete() await client.send_video( message.chat.id, "preview.mp4", caption=ms_g, reply_to_message_id=ReplyCheck(message), ) await asyncio.sleep(5) await message.delete() os.remove("preview.mp4") else: await message.delete() return else: await edrep(message, text="`Reply to a message to proceed`") await asyncio.sleep(5) await message.delete() return