async def give_sysinfo(client, message): splatform = platform.system() platform_release = platform.release() platform_version = platform.version() architecture = platform.machine() hostname = socket.gethostname() ip_address = socket.gethostbyname(socket.gethostname()) mac_address = ":".join(re.findall("..", "%012x" % uuid.getnode())) processor = platform.processor() ram = humanbytes(round(psutil.virtual_memory().total)) cpu_freq = psutil.cpu_freq().current if cpu_freq >= 1000: cpu_freq = f"{round(cpu_freq / 1000, 2)}GHz" else: cpu_freq = f"{round(cpu_freq, 2)}MHz" du = psutil.disk_usage(client.workdir) psutil.disk_io_counters() disk = f"{humanbytes(du.used)} / {humanbytes(du.total)} " f"({du.percent}%)" cpu_len = len(psutil.Process().cpu_affinity()) neat_msg = f"""**System Info** **PlatForm :** `{splatform}` **PlatForm - Release :** `{platform_release}` **PlatFork - Version :** `{platform_version}` **Architecture :** `{architecture}` **Hostname :** `{hostname}` **IP :** `{ip_address}` **Mac :** `{mac_address}` **Processor :** `{processor}` **Ram : ** `{ram}` **CPU :** `{cpu_len}` **CPU FREQ :** `{cpu_freq}` **DISK :** `{disk}` """ await edit_or_reply(message, neat_msg)
async def fetch_webshoot(client, message): msg_ = await edit_or_reply(message, "<code>Please Wait Until I Capture This Clear Shot!</code>", parse_mode="html") url_ = get_text(message) if not url_: await msg_.edit("<code>Give Me Url To Fetch A Screen Shot.</code>", parse_mode="html") return if not await check_if_url_is_valid(url_): return await msg_.edit("<code>This is An Invalid Url.</code>", parse_mode="html") screen_shot_image = await screen_shot_(url_) img_ = await download_img(screen_shot_image) img_size = humanbytes(os.stat(img_).st_size) if not img_: return await msg_.edit("<code>Something Isn't Right. Did You Give Me Valid Url?</code>", parse_mode="html") capt_ = f"<b><u>WebShot Captured</b></u> \n<b>URL :</b> <code>{url_}</code> \n<b>SIZE :</b> <code>{img_size}</code> \n\n<b>Powered By FridayUB</b>" if message.reply_to_message: await client.send_document( message.chat.id, img_, caption=capt_, parse_mode="html", reply_to_message_id=message.reply_to_message.message_id, ) else: await client.send_document(message.chat.id, img_, parse_mode="html", caption=capt_) if os.path.exists(img_): os.remove(img_) await msg_.delete()
def download_progress_hook(d, message, client): if d['status'] == 'downloading': current = d.get("_downloaded_bytes_str") or humanbytes(int(d.get("downloaded_bytes", 1))) total = d.get("_total_bytes_str") or d.get("_total_bytes_estimate_str") file_name = d.get("filename") eta = d.get('_eta_str', "N/A") percent = d.get("_percent_str", "N/A") speed = d.get("_speed_str", "N/A") to_edit = f"<b><u>Downloading File</b></u> \n<b>File Name :</b> <code>{file_name}</code> \n<b>File Size :</b> <code>{total}</code> \n<b>Speed :</b> <code>{speed}</code> \n<b>ETA :</b> <code>{eta}</code> \n<i>Download {current} out of {total}</i> (__{percent}__)" threading.Thread(target=edit_msg, args=(client, message, to_edit)).start()
async def fuck_arch_btw(client, cb): bttn = [ [ InlineKeyboardButton( text="Back 🔙", callback_data=f"backO_to_help_menu" ) ] ] splatform = platform.system() platform_release = platform.release() platform_version = platform.version() architecture = platform.machine() hostname = socket.gethostname() ip_address = socket.gethostbyname(socket.gethostname()) mac_address = ":".join(re.findall("..", "%012x" % uuid.getnode())) processor = platform.processor() ram = humanbytes(round(psutil.virtual_memory().total)) cpu_freq = psutil.cpu_freq().current if cpu_freq >= 1000: cpu_freq = f"{round(cpu_freq / 1000, 2)}GHz" else: cpu_freq = f"{round(cpu_freq, 2)}MHz" du = psutil.disk_usage(client.workdir) psutil.disk_io_counters() disk = f"{humanbytes(du.used)} / {humanbytes(du.total)} " f"({du.percent}%)" cpu_len = len(psutil.Process().cpu_affinity()) neat_msg = f"""<b>System Info</b> <b>PlatForm :</b> <code>{splatform}</code> <b>PlatForm - Release :</b> <code>{platform_release}</code> <b>PlatFork - Version :</b> <code>{platform_version}</code> <b>Architecture :</b> <code>{architecture}</code> <b>Hostname :</b> <code>{hostname}</code> <b>IP :</b> <code>{ip_address}</code> <b>Mac :</b> <code>{mac_address}</code> <b>Processor :</b> <code>{processor}</code> <b>Ram :</b> <code>{ram}</code> <b>CPU :</b> <code>{cpu_len}</code> <b>CPU FREQ :</b> <code>{cpu_freq}</code> <b>DISK :</b> <code>{disk}</code> """ await cb.edit_message_text(neat_msg, reply_markup=InlineKeyboardMarkup(bttn))
async def yt_dl_video(client, cb): url = cb.matches[0].group(1) audio_or_video = cb.matches[0].group(2) if audio_or_video == "video": file_name, downloaded_thumb, name, dur, u_date, uploader, views = await download_yt( url, as_video=True) else: file_name, downloaded_thumb, name, dur, u_date, uploader, views = await download_yt( url, as_video=False) if not os.path.exists(file_name): await cb.edit_message_text(file_name) return await cb.edit_message_text(f"`Downloaded : {name} | Now Uploading....`") import datetime f_size = humanbytes(os.stat(file_name).st_size) caption = f""" **Title :** `{name}` **Uploader :** `{uploader}` **Views :** `{views}` **Link :** `{url}` **Duration :** `{datetime.timedelta(seconds=dur)}` **File Size :** `{f_size}` """ if audio_or_video == "video": file_ = InputMediaVideo(file_name, thumb=downloaded_thumb, supports_streaming=True, duration=dur, caption=caption) else: file_ = InputMediaAudio(file_name, performer=uploader, title=name, thumb=downloaded_thumb, duration=dur, caption=caption) await cb.edit_message_media(file_) if os.path.exists(file_name): os.remove(file_name)