async def _(event): if event.fwd_from: return args = event.pattern_match.group(1).lower() if args: if args in CMD_HELP: await event.edit(f"Here is some help for the {CMD_HELP[args]}") else: await event.edit( f"Help string for {args} not found! Type `.help` to see valid module names." ) else: string = "" for i in CMD_HELP.values(): string += f"`{str(i[0])}`, " string = string[:-2] await event.edit("Please specify which module you want help for!\n\n" f"{string}")
entity=channel_id, filter=InputMessagesFilterDocument, # this might cause FLOOD WAIT, # if used too many times limit=None, search=search_kw, ) # get a random font from the list of fonts # https://docs.python.org/3/library/random.html#random.choice font_file_message = random.choice(font_file_message_s) # download and return the file path return await client.download_media(font_file_message) # EMOJI_PATTERN = re.compile( # """Remove emojis and other non-safe characters from string""" # return re.sub(EMOJI_PATTERN, '', inputString) # def deEmojify(inputString: str) -> str: # """Remove emojis and other non-safe characters from string""" # return re.sub(EMOJI_PATTERN, '', inputString) CMD_HELP.update( { "stickcreate": "**Sticker Creator**\ \n\n**Syntax : **`.stcr <text>`\ \n**Usage :** Creates sticker with given text." } )
try: await event.edit(shiiinabot) except Exception as e: logger.warn(str(e)) typing_symbol = "|" DELAY_BETWEEN_EDITS = 0.3 previous_text = "" await event.edit(typing_symbol) await asyncio.sleep(DELAY_BETWEEN_EDITS) for character in input_str: previous_text = previous_text + "" + character typing_text = previous_text + "" + typing_symbol try: await event.edit(typing_text) except Exception as e: logger.warn(str(e)) await asyncio.sleep(DELAY_BETWEEN_EDITS) try: await event.edit(previous_text) except Exception as e: logger.warn(str(e)) await asyncio.sleep(DELAY_BETWEEN_EDITS) CMD_HELP.update({ "typing": "**Typing**\ \n\n**Syntax : **`.type <text>`\ \n**Usage :** Creates typing effect with given text." })
await event.edit("`ID number you entered is invalid`") return except: await event.edit("`Are you Comedy Me ?`") return if int(id) <= (len(photos)): send_photos = await event.client.download_media(photos[id - 1]) await borg.send_file(event.chat_id, send_photos) else: await event.edit("`No photo found of that N***a , now u Die`") return CMD_HELP.update({ "poto": "**Poto**\ \n\n**Syntax : **`.poto <reply to a user> <profile picture number>`\ \n**Usage :** Downloads profile picture of replyed user." })
chat = None if not input_str: chat = to_write_chat else: mentions = "Bots in {} channel: \n".format(input_str) try: chat = await borg.get_entity(input_str) except Exception as e: await event.edit(str(e)) return None try: async for x in borg.iter_participants(chat, filter=ChannelParticipantsBots): if isinstance(x.participant, ChannelParticipantAdmin): mentions += "\n ⚜️ [{}](tg://user?id={}) `{}`".format( x.first_name, x.id, x.id) else: mentions += "\n [{}](tg://user?id={}) `{}`".format( x.first_name, x.id, x.id) except Exception as e: mentions += " " + str(e) + "\n" await event.edit(mentions) CMD_HELP.update({ "get_bot": "**Get Bot**\ \n\n**Syntax : **`.get_bot`\ \n**Usage :** Lists all the bots in a chat." })
os.remove(downloaded_file_name) page_content = page_content.replace("\n", "<br>") response = telegraph.create_page(title_of_page, html_content=page_content) end = datetime.now() ms = (end - start).seconds await event.edit( "Pasted to https://telegra.ph/{} in {} seconds.".format( response["path"], ms), link_preview=True, ) else: await event.edit( "Reply to a message to get a permanent telegra.ph link. (Inspired by @ControllerBot)" ) def resize_image(image): im = Image.open(image) im.save(image, "PNG") CMD_HELP.update({ "telegraph": "**Telegraph**\ \n\n**Syntax : **`.telegraph media <reply to image or video>`\ \n**Usage :** Upload image and video directly to telegraph.\ \n\n**Syntax : **`.telegraph text <reply to text>`\ \n**Usage :** upload text directly to telegraph ." })
country_code, ) ) else: await event.edit(response_api["message"]) @iron.on(iron_on_cmd(pattern="wttr (.*)")) async def _(event): if event.fwd_from: return sample_url = "https://wttr.in/{}.png" # logger.info(sample_url) input_str = event.pattern_match.group(1) async with aiohttp.ClientSession() as session: response_api_zero = await session.get(sample_url.format(input_str)) # logger.info(response_api_zero) response_api = await response_api_zero.read() with io.BytesIO(response_api) as out_file: await event.reply(file=out_file) await event.edit(input_str) CMD_HELP.update( { "weather": "**Weather**\ \n\n**Syntax : **`.weather <location>`\ \n**Usage :** Gives weather information about the location." } )
else: help_string = """IRON Userbot Modules Are Listed Here !\n For More Help or Support Visit @freedom_reborn""" results = await bot.inline_query( # pylint:disable=E0602 tgbotusername, help_string) await results[0].click(event.chat_id, reply_to=event.reply_to_msg_id, hide_via=True) await event.delete() CMD_HELP.update({ "update": ">`.update`" "\nUsage: Checks if the main userbot repository has any updates " "and shows a changelog if so." "\n\n>`.update now`" "\nUsage: Performs a quick update." "\n\n>`.update deploy`" "\nUsage: Performs a full update (recommended)." }) CMD_HELP.update({ "ping": "**Ping**\ \n\n**Syntax : **`.ping`\ \n**Usage :** Get uptime and speed of your bot." }) CMD_HELP.update({ "alive": "**ALive**\ \n\n**Syntax : **`.alive`\ \n**Usage :** Check if UserBot is Alive"
chat = "@QuotLyBot" reply_message.sender if reply_message.sender.bot: await event.edit("```Reply to actual users message.```") return await event.edit("```Making a Quote```") async with bot.conversation(chat) as conv: try: response = conv.wait_event( events.NewMessage(incoming=True, from_users=1031952739)) await bot.forward_messages(chat, reply_message) response = await response except YouBlockedUserError: await event.reply("```Please unblock @QuotLyBot and try again```") return if response.text.startswith("Hi!"): await event.edit( "```Can you kindly disable your forward privacy settings for good?```" ) else: await event.delete() await bot.forward_messages(event.chat_id, response.message) CMD_HELP.update({ "quotly": "**Quotly**\ \n\n**Syntax : **`.qbot media <reply to some message>`\ \n**Usage :** you will get quoted message." })
elif type(currrent_entity) is Chat: g += 1 elif type(currrent_entity) is Channel: if currrent_entity.broadcast: bc += 1 else: c += 1 else: print(d) end = datetime.now() ms = (end - start).seconds await event.edit( """`Your Stats Obtained in {} seconds` `You have {} Private Messages` `You are in {} Groups` `You are in {} Super Groups` `You Are in {} Channels` `And finally Bots = {}`""".format( ms, u, g, c, bc, b ) ) CMD_HELP.update( { "stats": "**Stats**\ \n\n**Syntax : **`.stats`\ \n**Usage :** Shows user account stats." } )
@iron.on(iron_on_cmd("cpin ?(.*)")) async def _(event): if event.fwd_from: return silent = True input_str = event.pattern_match.group(1) if input_str: silent = False if event.message.reply_to_msg_id is not None: message_id = event.message.reply_to_msg_id try: await borg( functions.messages.UpdatePinnedMessageRequest( event.chat_id, message_id, silent)) except Exception as e: await event.edit(str(e)) else: await event.delete() else: await event.edit( "Reply to a message to pin the message in this Channel.") CMD_HELP.update({ "pin_message": "**pin Message**\ \n\n**Syntax : **`.cpin <reply to a message>`\ \n**Usage :** Replyed message is pinned." })
if BOTLOG: await edit.client.send_message(BOTLOG_CHATID, "Edit query was executed successfully") @iron.on(iron_on_cmd(pattern="sd")) async def selfdestruct(destroy): if destroy.fwd_from: return """ 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**\ \n\n**Syntax : **`.purge`\ \n**Usage :** Purges all messages starting from the reply.\ \n\n**Syntax : **`.purgeme <x>`\ \n**Usage :** Deletes x amount of your latest messages." })
tap = await bot.inline_query(botusername, wwwspr) await tap[0].click(event.chat_id) await event.delete() @iron.on(iron_on_cmd(pattern="mod ?(.*)")) async def mod(event): if event.fwd_from: return modr = event.pattern_match.group(1) botusername = "******" if event.reply_to_msg_id: await event.get_reply_message() tap = await bot.inline_query(botusername, modr) await tap[0].click(event.chat_id) await event.delete() CMD_HELP.update({ "iron_fun": "**Iron Fun**\ \n\n**Syntax : **`.stat`\ \n**Usage :** Shows inline stats of your assistant bot.\ \n\n**Syntax : **`.xogame`\ \n**Usage :** starts a multiplayer xo game.\ \n\n**Syntax : **`.wspr <text> <username/ID>`\ \n**Usage :** sends a inline whisper message for given user.\ \n\n**Syntax : **`.mod <app name>`\ \n**Usage :** Provides mod APK for given app." })
f"`{int(seconds)}s` **yang lalu**" msg = None message_to_reply = ( f"__Sabar lagi afk__❗\n__selama __ `{total_afk_time}`\n__karena__ `{reason}`" if reason else f"__Sabar lagi afk__❗\n__selama :__ `{total_afk_time}`") msg = await event.reply(message_to_reply) await asyncio.sleep(10) # Spechide Bad await msg.delete() if event.chat_id in last_afk_message: # pylint:disable=E0602 await last_afk_message[event.chat_id].delete() # pylint:disable=E0602 last_afk_message[event.chat_id] = msg # pylint:disable=E0602 CMD_HELP.update({"afk": ".afk <Reason> \ \nUsage: Gets You Afk"}) @iron.on(iron_on_cmd(pattern="badd ?(.*)")) @iron.on(sudo_cmd(pattern="badd ?(.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return input_chnnl = event.pattern_match.group(1) sed = 0 oks = 0 if input_chnnl == "all": poppo = await edit_or_reply(event, "`Adding All Channel TO DB.`") addall = [ d.entity for d in await event.client.get_dialogs() if (d.is_group or d.is_channel)
reason = f"<i>True</i>" else: reason = f"<i>False</i>" if sclient is None: oki = "<i>Token Invalid</i>" elif sclient: hmmyes = sclient.is_banned(lolu.user.id) if hmmyes: oki = f"""<i>True</i> <b>~ Reason :</b> <i>{hmmyes.reason}</i>""" else: oki = "<i>False</i>" infomsg = ( f"<b>Info Of</b> <a href=tg://user?id={lolu.user.id}>{lolu.user.first_name}</a>: \n" f"<b>- Username :</b> <i>{lolu.user.username}</i>\n" f"<b>- ID :</b> <i>{lolu.user.id}</i>\n" f"<b>- Bot :</b> <i>{lolu.user.bot}</i>\n" f"<b>- CAS Banned :</b> {reason} \n" f"<b>- Nospam+ Banned :</b> {oki}") await event.edit(infomsg, parse_mode="HTML") CMD_HELP.update({ "information": "**Information**\ \n\n**Syntax : **`.info <mention a username/reply to a message>`\ \n**Usage :** Gives you information about the username.\ \n\n**Syntax : **`.wru <mention a username/reply to a message>`\ \n**Usage :** Shows if the person is banned in NospamPlus or not." })
"https://api.remove.bg/v1.0/removebg", headers=headers, files=files, allow_redirects=True, stream=True, ) return r def ReTrieveURL(input_url): headers = { "X-API-Key": Config.REM_BG_API_KEY, } data = {"image_url": input_url} r = requests.post( "https://api.remove.bg/v1.0/removebg", headers=headers, data=data, allow_redirects=True, stream=True, ) return r CMD_HELP.update({ "remove.bg": "**Remove background**\ \n\n**Syntax : **`.rmbg <reply to image>`\ \n**Usage :** Image of replyed image is removed." })
return None async def get_sticker_emoji(event): reply_message = await event.get_reply_message() try: final_emoji = reply_message.media.document.attributes[1].alt except: final_emoji = '😎' return final_emoji def zipdir(path, ziph): # ziph is zipfile handle for root, dirs, files in os.walk(path): for file in files: ziph.write(os.path.join(root, file)) os.remove(os.path.join(root, file)) CMD_HELP.update({ "stickers": "**Stickers**\ \n\n**Syntax : **`.kang <reply to sticker/image>`\ \n**Usage :** Kangs the image into your sticker pack.\ \n\n**Syntax : **`.packinfo <reply to a sticker>`\ \n**Usage :** Shows info about the pack.\ \n\n**Syntax : **`.getsticker <reply to sticker>`\ \n**Usage :** Downloada the sticker." })
if event.fwd_from: return iloveindia = await edit_or_reply(event, "Processing...") name = event.pattern_match.group(1) remove_filter(event.chat_id, name) await iloveindia.edit(f"filter {name} deleted successfully") @iron.on(iron_on_cmd(pattern="rmfilters$")) @iron.on(sudo_cmd(pattern="rmfilters$", allow_sudo=True)) async def on_all_snip_delete(event): if event.fwd_from: return edit_or_reply(event, "Processing....") remove_all_filters(event.chat_id) await event.edit(f"filters **in current chat** deleted successfully") CMD_HELP.update({ "filters": "**Filters**\ \n\n**Syntax : **`.filter <word to trigger> <reply to triggered message>`\ \n**Usage :** save filters using this plugin.\ \n\n**Syntax : **`.filters`\ \n**Usage :** All the filters of current chat are listed.\ \n\n**Syntax : **`.stop <filter word to stop>`\ \n**Usage :** Deletes given trigger word.\ \n\n**Syntax : **`.rmfilters`\ \n**Usage :** All the filters in a chat are deleted." })
if not e: e = "No Error" o = stdout.decode() if not o: o = "**Tip**: \n`If you want to see the results of your code, I suggest printing them to stdout.`" else: _o = o.split("\n") o = "`\n".join(_o) OUTPUT = f"**QUERY:**\n__Command:__\n`{cmd}` \n__PID:__\n`{process.pid}`\n\n**stderr:** \n`{e}`\n**Output:**\n{o}" if len(OUTPUT) > 4095: with io.BytesIO(str.encode(OUTPUT)) as out_file: out_file.name = "exec.text" await bot.send_file( event.chat_id, out_file, force_document=True, allow_cache=False, caption=cmd, reply_to=reply_to_id, ) await event.delete() await tflyf.edit(OUTPUT) CMD_HELP.update({ "bash": "**Bash**\ \n\n**Syntax : **`.bash <cmd>`\ \n**Usage :** Run Commands Using Userbot" })
await poppo.delete() CMD_HELP.update({ "admin": ".promote <username/reply> <custom rank (optional)>\ \n**Usage:** Provides admin rights to the person in the chat.\ \n\n.demote <username/reply>\ \n**Usage:** Revokes the person's admin permissions in the chat.\ \n\n.ban <username/reply> <reason (optional)>\ \n**Usage:** Bans the person off your chat.\ \n\n.unban <username/reply>\ \n**Usage:** Removes the ban from the person in the chat.\ \n\n.mute <username/reply> <reason (optional)>\ \n**Usage:** Mutes the person in the chat, works on admins too.\ \n\n.unmute <username/reply>\ \n**Usage:** Removes the person from the muted list.\ \n\n.gmute <username/reply> <reason (optional)>\ \n**Usage:** Mutes the person in all groups you have in common with them.\ \n\n.ungmute <username/reply>\ \n**Usage:** Reply someone's message with .ungmute to remove them from the gmuted list.\ \n\n.zombies\ \n**Usage:** Searches for deleted accounts in a group. Use .zombies clean to remove deleted accounts from the group.\ \n\n.adminlist\ \n**Usage:** Retrieves a list of admins in the chat.\ \n\n.users or .users <name of member>\ \n**Usage:** Retrieves all (or queried) users in the chat.\ \n\n.setgppic <reply to image>\ \n**Usage:** Changes the group's display picture." })
try: lim = lim[0] lim = lim.replace("lim=", "") query = query.replace("lim=" + lim[0], "") except IndexError: lim = 5 response = googleimagesdownload() # creating list of arguments arguments = { "keywords": query, "limit": lim, "format": "jpg", "silent_mode": True, "no_directory": "no_directory", } # passing the arguments to the function paths = response.download(arguments) lst = paths[0][query] await event.client.send_file( await event.client.get_input_entity(event.chat_id), lst) shutil.rmtree(os.path.dirname(os.path.abspath(lst[0]))) await event.delete() CMD_HELP.update({ "img": "**Img**\ \n\n**Syntax : **`.img <query>`\ \n**Usage :** get images just with a query" })
if isinstance(x.participant, ChannelParticipantCreator): mentions += "\n 👑 [{}](tg://user?id={}) `{}`".format( x.first_name, x.id, x.id) mentions += "\n" async for x in borg.iter_participants( chat, filter=ChannelParticipantsAdmins): if not x.deleted: if isinstance(x.participant, ChannelParticipantAdmin): mentions += "\n ⚜️ [{}](tg://user?id={}) `{}`".format( x.first_name, x.id, x.id) else: mentions += "\n `{}`".format(x.id) except Exception as e: mentions += " " + str(e) + "\n" if should_mention_admins: if reply_message: await reply_message.reply(mentions) else: await event.reply(mentions) await event.delete() else: await admeme.edit(mentions) CMD_HELP.update({ "get_admin": "**Get_admin**\ \n\n**Syntax : **`.get_admin`\ \n**Usage :** lists all the admins in a group." })
@iron.on(iron_on_cmd("get_id")) @iron.on(sudo_cmd("get_id", allow_sudo=True)) async def _(event): starkisgreat = await edit_or_reply(event, "Processing") if event.fwd_from: return if event.reply_to_msg_id: await event.get_input_chat() r_msg = await event.get_reply_message() if r_msg.media: bot_api_file_id = pack_bot_file_id(r_msg.media) await starkisgreat.edit( "Current Chat ID: `{}`\nFrom User ID: `{}`\nBot API File ID: `{}`" .format(str(event.chat_id), str(r_msg.sender_id), bot_api_file_id)) else: await starkisgreat.edit( "Current Chat ID: `{}`\nFrom User ID: `{}`".format( str(event.chat_id), str(r_msg.sender_id))) else: await starkisgreat.edit("Current Chat ID: `{}`".format( str(event.chat_id))) CMD_HELP.update({ "get_id": "**Get Id**\ \n\n**Syntax : **`.get_id <reply to media or any message>`\ \n**Usage :** Get ID of any Telegram media, or any user." })
song = netase.pattern_match.group(1) chat = "@WooMaiBot" link = f"/netease {song}" await netase.edit("```Getting Your Music```") async with bot.conversation(chat) as conv: await asyncio.sleep(2) await netase.edit("`Downloading...Please wait`") try: msg = await conv.send_message(link) response = await conv.get_response() respond = await conv.get_response() """ - don't spam notif - """ await bot.send_read_acknowledge(conv.chat_id) except YouBlockedUserError: await netase.reply("```Please unblock @WooMaiBot and try again```") return await netase.edit("`Sending Your Music...`") await asyncio.sleep(3) await bot.send_file(netase.chat_id, respond) await netase.client.delete_messages(conv.chat_id, [msg.id, response.id, respond.id]) await netase.delete() CMD_HELP.update({ "song": "**Song**\ \n\n**Syntax : **`.songs <song name>`\ \n**Usage :** downloads the song from internet and uploades it." })
cws = get_current_welcome_settings(event.chat_id) rm_welcome_setting(event.chat_id) await event.edit("Welcome note cleared. " + "The previous welcome message was `{}`.".format( cws.custom_welcome_message)) @iron.on(iron_on_cmd(pattern="listwelcome$")) # pylint:disable=E0602 async def _(event): if event.fwd_from: return cws = get_current_welcome_settings(event.chat_id) if hasattr(cws, "custom_welcome_message"): await event.edit("Welcome note found. " + "Your welcome message is\n\n`{}`.".format( cws.custom_welcome_message)) else: await event.edit("No Welcome Message found") CMD_HELP.update({ "welcome": "**Welcome**\ \n\n**Syntax : **`.savewelcome <welcome message to save>`\ \n**Usage :** Saves welcome message.\ \n\n**Syntax : **`.clearwelcome`\ \n**Usage :** Clears welcome message.\ \n\n**Syntax : **`.listwelcome`\ \n**Usage :** Lists existing welcome message." })
async def get_user_sender_id(user, event): if isinstance(user, str): user = int(user) try: user_obj = await event.client.get_entity(user) except (TypeError, ValueError) as err: await event.edit(str(err)) return None return user_obj CMD_HELP.update( { "warns": "**Warns**\ \n\n**Syntax : **`.warn <reason> <reply or mention the user>`\ \n**Usage :** Warns The Given User.\ \n\n**Syntax : **`.rwarn <reply or mention the user>`\ \n**Usage :** Removes Warn Of The User.\ \n\n**Syntax : **`.allwarns <reply or mention the user>`\ \n**Usage :** Shows All The Warns Of The Given User.\ \n\n**Syntax : **`.slimit <no of max warns>`\ \n**Usage :** Sets Maximum Warn Limit.\ \n\n**Syntax : **`.wap <on or off>`\ \n**Usage :** If this is turned on, user gets banned after reaching maximum warns. If it's off, user is kicked." } )
after_tr_text = lmao source_lano = translator.detect(text) try: source_lan = source_lano[1] except: source_lan = source_lano[0] output_str = f"""**TRANSLATED SUCCESSFULLY** **Source ({source_lan})**: `{text}` **Translation ({lan})**: `{translated}`""" if len(output_str) >= 4096: out_file = output_str url = "https://del.dog/documents" r = requests.post(url, data=out_file.encode("UTF-8")).json() url2 = f"https://del.dog/{r['key']}" starky = f"Translated Text Was Too Big, Never Mind I Have Pasted It [Here]({url2})" else: starky = output_str await edit_or_reply(event, starky) CMD_HELP.update({ "translate": "**Translate**\ \n\n**Syntax : **`.tr <language Code> <reply to text>`\ \n**Usage :** Translates the given text into your language." })
try: herokuHelper = HerokuHelper(Config.HEROKU_APP_NAME, Config.HEROKU_API_KEY) herokuHelper.restart() except: await borg.disconnect() os.execl(sys.executable, sys.executable, *sys.argv) @iron.on(iron_on_cmd("shutdown$")) async def _(event): if event.fwd_from: return await event.edit("Turning off ...Manually turn me on later") if Config.HEROKU_API_KEY: app = Heroku.app(Config.HEROKU_APP_NAME) app.dynos['worker.1'].kill() else: await bot.disconnect() sys.exit(0) CMD_HELP.update({ "power_tools": "**Power Tools**\ \n\n**Syntax : **`.restart`\ \n**Usage :** restarts your iron userbot.\ \n\n**Syntax : **`.shutdown`\ \n**Usage :** Shuts down your iron userbot." })