async def incoming_cancel_message_f(bot, update): """/cancel command""" if update.from_user.id not in AUTH_USERS: try: await update.message.delete() except: pass return status = DOWNLOAD_LOCATION + "/status.json" if os.path.exists(status): inline_keyboard = [] ikeyboard = [] ikeyboard.append( InlineKeyboardButton("Yes ЁЯЪл", callback_data=("fuckingdo").encode("UTF-8"))) ikeyboard.append( InlineKeyboardButton("No ЁЯдЧ", callback_data=("fuckoff").encode("UTF-8"))) inline_keyboard.append(ikeyboard) reply_markup = InlineKeyboardMarkup(inline_keyboard) await update.reply_text( "Are you sure? ЁЯЪл This will stop the compression!", reply_markup=reply_markup, quote=True) else: delete_downloads() await bot.send_message(chat_id=update.chat.id, text="No active compression exists", reply_to_message_id=update.message_id)
async def button(bot, update: CallbackQuery): cb_data = update.data try: g = await AdminCheck(bot, update.message.chat.id, update.from_user.id) print(g) except: pass LOGGER.info(update.message.reply_to_message.from_user.id) if (update.from_user.id == update.message.reply_to_message.from_user.id) or g: print(cb_data) if cb_data == "fuckingdo": if update.from_user.id in AUTH_USERS: status = DOWNLOAD_LOCATION + "/status.json" with open(status, 'r+') as f: statusMsg = json.load(f) statusMsg['running'] = False f.seek(0) json.dump(statusMsg, f, indent=2) if 'pid' in statusMsg.keys(): try: os.kill(statusMsg["pid"], 9) except: pass delete_downloads() try: await bot.delete_messages(update.message.chat.id, statusMsg["message"]) except: pass try: await update.message.edit_text( "🚦🚦 Last Process Stopped 🚦🚦") chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" await bot.send_message( chat_id, f"**Last Process Cancelled ❌**\n\n**Bot Status : Free 🟢**\n\n➤ @CompressFlixBot\n\n**Process Stopped At** `{now}`", parse_mode="markdown") except: pass else: try: await update.message.edit_text( "You are not allowed to do that 🤭") except: pass elif cb_data == "fuckoff": try: await update.message.edit_text("Okay! Fine 🤬") except: pass
async def button(bot, update: CallbackQuery): cb_data = update.data try: g = await AdminCheck(bot, update.message.chat.id, update.from_user.id) print(g) except: pass LOGGER.info(update.message.reply_to_message.from_user.id) if (update.from_user.id == update.message.reply_to_message.from_user.id) or g: print(cb_data) if cb_data == "fuckingdo": if update.from_user.id: status = DOWNLOAD_LOCATION + "/status.json" with open(status, 'r+') as f: statusMsg = json.load(f) statusMsg['running'] = False f.seek(0) json.dump(statusMsg, f, indent=2) if 'pid' in statusMsg.keys(): try: os.kill(statusMsg["pid"], 9) except: pass delete_downloads() try: await bot.delete_messages(update.message.chat.id, statusMsg["message"]) except: pass try: await update.message.edit_text( "🚦🚦 Stopped 🚦🚦") except: pass else: try: await update.message.edit_text( "You are not allowed to do that ðŸ¤") except: pass elif cb_data == "fuckoff": try: await update.message.edit_text("Okay! fine 🤬") except: pass
async def button(bot, update: CallbackQuery): cb_data = update.data try: g = await AdminCheck(bot, update.message.chat.id, update.from_user.id) print(g) except: pass LOGGER.info(update.message.reply_to_message.from_user.id) if (update.from_user.id == update.message.reply_to_message.from_user.id) or g: print(cb_data) if cb_data == "fuckingdo": if update.from_user.id in AUTH_USERS: status = DOWNLOAD_LOCATION + "/status.json" with open(status, 'r+') as f: statusMsg = json.load(f) statusMsg['running'] = False f.seek(0) json.dump(statusMsg, f, indent=2) if 'pid' in statusMsg.keys(): try: os.kill(statusMsg["pid"], 9) except: pass delete_downloads() try: await bot.delete_messages(update.message.chat.id, statusMsg["message"]) except: pass try: await update.message.edit_text("Stopped") except: pass else: try: await update.message.edit_text( "Sorry , Your Not Allowed To Do That Ask My Master :- @David9010" ) except: pass elif cb_data == "Leave For Here": try: await update.message.edit_text("Okay! Fine") except: pass
async def incoming_cancel_message_f(bot, update): """/cancel command""" status = DOWNLOAD_LOCATION + "/status.json" if os.path.exists(status): inline_keyboard = [] ikeyboard = [] ikeyboard.append(InlineKeyboardButton("Yes", callback_data=("Ok , Done").encode("UTF-8"))) ikeyboard.append(InlineKeyboardButton("No", callback_data=("Ok , Done").encode("UTF-8"))) inline_keyboard.append(ikeyboard) reply_markup = InlineKeyboardMarkup(inline_keyboard) await update.reply_text("Are you sure?, reply_markup=reply_markup, quote=True) else: delete_downloads() await bot.send_message( chat_id=update.chat.id, text="No active compression exists", reply_to_message_id=update.message_id )
async def incoming_cancel_message_f(bot, update): """/cancel command""" status = DOWNLOAD_LOCATION + "/status.json" if os.path.exists(status): inline_keyboard = [] ikeyboard = [] ikeyboard.append( InlineKeyboardButton("Yes ЁЯФ┤", callback_data=("fuckingdo").encode("UTF-8"))) ikeyboard.append( InlineKeyboardButton("No ЁЯЦд", callback_data=("fuckoff").encode("UTF-8"))) inline_keyboard.append(ikeyboard) reply_markup = InlineKeyboardMarkup(inline_keyboard) await update.reply_text("<b> So , Are you Sure ..?? </b>", reply_markup=reply_markup, quote=True) else: delete_downloads() await bot.send_message(chat_id=update.chat.id, text="I am Free Like a ЁЯжЛ...", reply_to_message_id=update.message_id)
async def incoming_compress_message_f(bot, update): """/compress command""" if update.from_user.id not in AUTH_USERS: try: await update.message.delete() except: pass return if update.reply_to_message is None: try: await bot.send_message(chat_id=update.chat.id, text="ЁЯдм Reply to telegram media ЁЯдм", reply_to_message_id=update.message_id) except: pass return target_percentage = 50 isAuto = False if len(update.command) > 1: try: if int(update.command[1]) <= 90 and int(update.command[1]) >= 10: target_percentage = int(update.command[1]) else: try: await bot.send_message( chat_id=update.chat.id, text="ЁЯдм Value should be 10 - 90", reply_to_message_id=update.message_id) return except: pass except: pass else: isAuto = True user_file = str(update.from_user.id) + ".FFMpegRoBot.mkv" saved_file_path = DOWNLOAD_LOCATION + "/" + user_file LOGGER.info(saved_file_path) d_start = time.time() c_start = time.time() u_start = time.time() status = DOWNLOAD_LOCATION + "/status.json" if not os.path.exists(status): sent_message = await bot.send_message( chat_id=update.chat.id, text=Localisation.DOWNLOAD_START, reply_to_message_id=update.message_id) try: d_start = time.time() status = DOWNLOAD_LOCATION + "/status.json" with open(status, 'w') as f: statusMsg = { 'running': True, 'message': sent_message.message_id } json.dump(statusMsg, f, indent=2) video = await bot.download_media( message=update.reply_to_message, file_name=saved_file_path, progress=progress_for_pyrogram, progress_args=(bot, Localisation.DOWNLOAD_START, sent_message, d_start)) LOGGER.info(video) if (video is None): try: await sent_message.edit_text(text="Download stopped") except: pass delete_downloads() LOGGER.info("Download stopped") return except (ValueError) as e: try: await sent_message.edit_text(text=str(e)) except: pass delete_downloads() try: await sent_message.edit_text(text=Localisation.SAVED_RECVD_DOC_FILE ) except: pass else: try: await bot.send_message( chat_id=update.chat.id, text=Localisation.FF_MPEG_RO_BOT_STOR_AGE_ALREADY_EXISTS, reply_to_message_id=update.message_id) except: pass return if os.path.exists(saved_file_path): downloaded_time = TimeFormatter((time.time() - d_start) * 1000) duration, bitrate = await media_info(saved_file_path) if duration is None or bitrate is None: try: await sent_message.edit_text( text="тЪая╕П Getting video meta data failed тЪая╕П") except: pass delete_downloads() return thumb_image_path = await take_screen_shot( saved_file_path, os.path.dirname(os.path.abspath(saved_file_path)), (duration / 2)) await sent_message.edit_text(text=Localisation.COMPRESS_START) c_start = time.time() o = await convert_video(saved_file_path, DOWNLOAD_LOCATION, duration, bot, sent_message, target_percentage, isAuto) compressed_time = TimeFormatter((time.time() - c_start) * 1000) LOGGER.info(o) if o == 'stopped': return if o is not None: await sent_message.edit_text(text=Localisation.UPLOAD_START, ) u_start = time.time() caption = Localisation.COMPRESS_SUCCESS.replace( '{}', downloaded_time, 1).replace('{}', compressed_time, 1) upload = await bot.send_video( chat_id=update.chat.id, video=o, caption=caption, supports_streaming=True, duration=duration, thumb=thumb_image_path, reply_to_message_id=update.message_id, progress=progress_for_pyrogram, progress_args=(bot, Localisation.UPLOAD_START, sent_message, u_start)) if (upload is None): try: await sent_message.edit_text(text="Upload stopped") except: pass delete_downloads() return uploaded_time = TimeFormatter((time.time() - u_start) * 1000) await sent_message.delete() delete_downloads() LOGGER.info(upload.caption) try: await upload.edit_caption( caption=upload.caption.replace('{}', uploaded_time)) except: pass else: delete_downloads() try: await sent_message.edit_text( text="тЪая╕П Compression failed тЪая╕П") except: pass else: delete_downloads() try: await sent_message.edit_text( text="тЪая╕П Failed Downloaded path not exist тЪая╕П") except: pass
async def incoming_compress_message_f(bot, update): """/compress command""" update_channel = UPDATES_CHANNEL if update_channel: try: user = await bot.get_chat_member(update_channel, update.chat.id) if user.status == "kicked": await bot.send_message( chat_id=update.chat.id, text= "Sorry Sir, You are Banned to use me. Contact my [Support Group](https://t.me/UniversalBotsSupport).", parse_mode="markdown", disable_web_page_preview=True) return except UserNotParticipant: await bot.send_message( chat_id=update.chat.id, text="**Please Join My Updates Channel to use this Bot!**", reply_markup=InlineKeyboardMarkup([[ InlineKeyboardButton("Join Updates Channel", url=f"https://t.me/{update_channel}") ]]), parse_mode="markdown") return except Exception: await bot.send_message( chat_id=update.chat.id, text= f"Add me into your [Updates Channel](https://t.me/{update_channel}), for more help Contact my [Support Group](https://t.me/UniversalBotsSupport).", parse_mode="markdown", disable_web_page_preview=True) return if update.reply_to_message is None: try: await bot.send_message(chat_id=update.chat.id, text="ЁЯдм Reply to telegram media ЁЯдм", reply_to_message_id=update.message_id) except: pass return target_percentage = 50 isAuto = False if len(update.command) > 1: try: if int(update.command[1]) <= 90 and int(update.command[1]) >= 10: target_percentage = int(update.command[1]) else: try: await bot.send_message( chat_id=update.chat.id, text="ЁЯдм Value should be 10 to 90", reply_to_message_id=update.message_id) return except: pass except: pass else: isAuto = True user_file = str(update.from_user.id) + ".FFMpegRoBot.mkv" saved_file_path = DOWNLOAD_LOCATION + "/" + user_file LOGGER.info(saved_file_path) d_start = time.time() c_start = time.time() u_start = time.time() status = DOWNLOAD_LOCATION + "/status.json" if not os.path.exists(status): sent_message = await bot.send_message( chat_id=update.chat.id, text=Localisation.DOWNLOAD_START, reply_to_message_id=update.message_id) chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" download_start = await bot.send_message( chat_id, f"**Bot Become Busy Now !!** \n\nDownload Started at `{now}`", parse_mode="markdown") try: d_start = time.time() status = DOWNLOAD_LOCATION + "/status.json" with open(status, 'w') as f: statusMsg = { 'running': True, 'message': sent_message.message_id } json.dump(statusMsg, f, indent=2) video = await bot.download_media( message=update.reply_to_message, file_name=saved_file_path, progress=progress_for_pyrogram, progress_args=(bot, Localisation.DOWNLOAD_START, sent_message, d_start)) LOGGER.info(video) if (video is None): try: await sent_message.edit_text(text="Download stopped") chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" await bot.send_message( chat_id, f"**Download Stopped, Bot is Free Now !!** \n\nProcess Done at `{now}`", parse_mode="markdown") await download_start.delete() except: pass delete_downloads() LOGGER.info("Download stopped") return except (ValueError) as e: try: await sent_message.edit_text(text=str(e)) except: pass delete_downloads() try: await sent_message.edit_text(text=Localisation.SAVED_RECVD_DOC_FILE ) except: pass else: try: await bot.send_message( chat_id=update.chat.id, text=Localisation.FF_MPEG_RO_BOT_STOR_AGE_ALREADY_EXISTS, reply_markup=InlineKeyboardMarkup([[ InlineKeyboardButton('Show Bot Status', url=f'https://t.me/{LOG_CHANNEL}' ) # That's Username na ... ]]), reply_to_message_id=update.message_id) except: pass return if os.path.exists(saved_file_path): downloaded_time = TimeFormatter((time.time() - d_start) * 1000) duration, bitrate = await media_info(saved_file_path) if duration is None or bitrate is None: try: await sent_message.edit_text( text="тЪая╕П Getting video meta data failed тЪая╕П") chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" await bot.send_message( chat_id, f"**Download Failed, Bot is Free Now !!** \n\nProcess Done at `{now}`", parse_mode="markdown") await download_start.delete() except: pass delete_downloads() return thumb_image_path = await take_screen_shot( saved_file_path, os.path.dirname(os.path.abspath(saved_file_path)), (duration / 2)) chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" await download_start.delete() compress_start = await bot.send_message( chat_id, f"**Compressing Video ...** \n\nProcess Started at `{now}`", parse_mode="markdown") await sent_message.edit_text(text=Localisation.COMPRESS_START) c_start = time.time() o = await convert_video(saved_file_path, DOWNLOAD_LOCATION, duration, bot, sent_message, target_percentage, isAuto) compressed_time = TimeFormatter((time.time() - c_start) * 1000) LOGGER.info(o) if o == 'stopped': return if o is not None: chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" await compress_start.delete() upload_start = await bot.send_message( chat_id, f"**Uploading Video ...** \n\nProcess Started at `{now}`", parse_mode="markdown") await sent_message.edit_text(text=Localisation.UPLOAD_START, ) u_start = time.time() caption = Localisation.COMPRESS_SUCCESS.replace( '{}', downloaded_time, 1).replace('{}', compressed_time, 1) upload = await bot.send_video( chat_id=update.chat.id, video=o, caption=caption, supports_streaming=True, duration=duration, thumb=thumb_image_path, reply_to_message_id=update.message_id, progress=progress_for_pyrogram, progress_args=(bot, Localisation.UPLOAD_START, sent_message, u_start)) if (upload is None): try: await sent_message.edit_text(text="Upload stopped") chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" await bot.send_message( chat_id, f"**Upload Stopped, Bot is Free Now !!** \n\nProcess Done at `{now}`", parse_mode="markdown") await upload_start.delete() except: pass delete_downloads() return uploaded_time = TimeFormatter((time.time() - u_start) * 1000) await sent_message.delete() delete_downloads() chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" await upload_start.delete() await bot.send_message( chat_id, f"**Upload Done, Bot is Free Now !!** \n\nProcess Done at `{now}`", parse_mode="markdown") LOGGER.info(upload.caption) try: await upload.edit_caption( caption=upload.caption.replace('{}', uploaded_time)) except: pass else: delete_downloads() try: await sent_message.edit_text( text="тЪая╕П Compression failed тЪая╕П") chat_id = LOG_CHANNEL now = datetime.datetime.now() await bot.send_message( chat_id, f"**Compression Failed, Bot is Free Now !!** \n\nProcess Done at `{now}`", parse_mode="markdown") await download_start.delete() except: pass else: delete_downloads() try: await sent_message.edit_text( text="тЪая╕П Failed Downloaded path not exist тЪая╕П") chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" await bot.send_message( chat_id, f"**Download Error, Bot is Free Now !!** \n\nProcess Done at `{now}`", parse_mode="markdown") await download_start.delete() except: pass
async def incoming_compress_message_f(bot, update): """/compress command""" update_channel = UPDATES_CHANNEL if update_channel: try: user = await bot.get_chat_member(update_channel, update.chat.id) if user.status == "kicked": await bot.send_message( chat_id=update.chat.id, text= "**Sorry Sir, You Are Banned From Using Me. Contact My** [Support Bot](https://t.me/FlixHelpBot).", parse_mode="markdown", disable_web_page_preview=True) return except UserNotParticipant: await bot.send_message( chat_id=update.chat.id, text= "**Please Join My Updates Channel Below To Use This Bot!**", reply_markup=InlineKeyboardMarkup([[ InlineKeyboardButton("Join Our Updates Channel 📢", url=f"https://t.me/{update_channel}") ]]), parse_mode="markdown") return except Exception: await bot.send_message( chat_id=update.chat.id, text= "**Something Went Wrong. Contact My [Support Bot](https://t.me/FlixHelpBot).", parse_mode="markdown", disable_web_page_preview=True) return if update.reply_to_message is None: try: await bot.send_message(chat_id=update.chat.id, text="🤬 Reply to telegram media 🤬", reply_to_message_id=update.message_id) except: pass return target_percentage = 50 isAuto = False if len(update.command) > 1: try: if int(update.command[1]) <= 90 and int(update.command[1]) >= 10: target_percentage = int(update.command[1]) else: try: await bot.send_message( chat_id=update.chat.id, text="🤬 Value should be 10 to 90", reply_to_message_id=update.message_id) return except: pass except: pass else: isAuto = True user_file = str(update.from_user.id) + ".FFMpegRoBot.mkv" saved_file_path = DOWNLOAD_LOCATION + "/" + user_file LOGGER.info(saved_file_path) d_start = time.time() c_start = time.time() u_start = time.time() status = DOWNLOAD_LOCATION + "/status.json" if not os.path.exists(status): sent_message = await bot.send_message( chat_id=update.chat.id, text=Localisation.DOWNLOAD_START, reply_to_message_id=update.message_id) chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" await bot.send_message( chat_id, f"**Video Compressing Started\n\nBot Status : Busy Now 🔴**\n\n➤ @CompressFlixBot\n\n**A Process Started At** `{now}`", parse_mode="markdown") try: d_start = time.time() status = DOWNLOAD_LOCATION + "/status.json" with open(status, 'w') as f: statusMsg = { 'running': True, 'message': sent_message.message_id } json.dump(statusMsg, f, indent=2) video = await bot.download_media( message=update.reply_to_message, file_name=saved_file_path, progress=progress_for_pyrogram, progress_args=(bot, Localisation.DOWNLOAD_START, sent_message, d_start)) LOGGER.info(video) if (video is None): try: await sent_message.edit_text(text="Download stopped") chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" await bot.send_message( chat_id, f"**Download Stopped ❌\n\nBot Status : Free 🟢**\n\n➤ @CompressFlixBot\n\n**Process Stopped At** `{now}`", parse_mode="markdown") except: pass delete_downloads() LOGGER.info("Download stopped") return except (ValueError) as e: try: await sent_message.edit_text(text=str(e)) except: pass delete_downloads() try: await sent_message.edit_text(text=Localisation.SAVED_RECVD_DOC_FILE ) except: pass else: try: await bot.send_message( chat_id=update.chat.id, text=Localisation.FF_MPEG_RO_BOT_STOR_AGE_ALREADY_EXISTS, reply_markup=InlineKeyboardMarkup([[ InlineKeyboardButton('🥳 Bot Status 🥳', url='https://t.me/CompressFlixLogs' ) # Replace With Your's ]]), reply_to_message_id=update.message_id) except: pass return if os.path.exists(saved_file_path): downloaded_time = TimeFormatter((time.time() - d_start) * 1000) duration, bitrate = await media_info(saved_file_path) if duration is None or bitrate is None: try: await sent_message.edit_text( text="⚠️ Getting video meta data failed ⚠️") chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" await bot.send_message( chat_id, f"**Download Failed ❌**\n\n**Bot Status : Free 🟢**\n\n➤ @CompressFlixBot\n\n**Process Stopped At** `{now}`", parse_mode="markdown") except: pass delete_downloads() return thumb_image_path = await take_screen_shot( saved_file_path, os.path.dirname(os.path.abspath(saved_file_path)), (duration / 2)) await sent_message.edit_text(text=Localisation.COMPRESS_START) c_start = time.time() o = await convert_video(saved_file_path, DOWNLOAD_LOCATION, duration, bot, sent_message, target_percentage, isAuto) compressed_time = TimeFormatter((time.time() - c_start) * 1000) LOGGER.info(o) if o == 'stopped': return if o is not None: await sent_message.edit_text(text=Localisation.UPLOAD_START, ) u_start = time.time() caption = Localisation.COMPRESS_SUCCESS.replace( '{}', downloaded_time, 1).replace('{}', compressed_time, 1) upload = await bot.send_video( chat_id=update.chat.id, video=o, caption=caption, supports_streaming=True, duration=duration, thumb=thumb_image_path, reply_to_message_id=update.message_id, progress=progress_for_pyrogram, progress_args=(bot, Localisation.UPLOAD_START, sent_message, u_start)) if (upload is None): try: await sent_message.edit_text(text="Upload stopped") chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" await bot.send_message( chat_id, f"**Upload Stopped ❌**\n\n**Bot Status : Free 🟢**\n\n➤ @CompressFlixBot\n\n**Process Stopped At** `{now}`", parse_mode="markdown") except: pass delete_downloads() return uploaded_time = TimeFormatter((time.time() - u_start) * 1000) await sent_message.delete() delete_downloads() chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" await bot.send_message( chat_id, f"**Uploaded Successfully 🎦**\n\n**Bot Status : Free 🟢**\n\n➤ @CompressFlixBot\n\n**Process Done At** `{now}`", parse_mode="markdown") LOGGER.info(upload.caption) try: await upload.edit_caption( caption=upload.caption.replace('{}', uploaded_time)) except: pass else: delete_downloads() try: await sent_message.edit_text(text="⚠️ Compression failed ⚠️") chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" await bot.send_message( chat_id, f"**Compression Failed 📀**\n\n**Bot Status : Free 🟢**\n\n➤ @CompressFlixBot\n\n**Process Stopped At** `{now}`", parse_mode="markdown") except: pass else: delete_downloads() try: await sent_message.edit_text( text="⚠️ Failed To Download, Path Does Not Exist ⚠️") chat_id = LOG_CHANNEL utc_now = datetime.datetime.utcnow() ist_now = utc_now + datetime.timedelta(minutes=30, hours=5) ist = ist_now.strftime("%d/%m/%Y, %H:%M:%S") bst_now = utc_now + datetime.timedelta(minutes=00, hours=6) bst = bst_now.strftime("%d/%m/%Y, %H:%M:%S") now = f"\n{ist} (GMT+05:30)`\n`{bst} (GMT+06:00)" await bot.send_message( chat_id, f"**Download Error ‼️**\n\n**Bot Status : Free 🟢**\n\n➤ @CompressFlixBot\n\n**Process Stopped At** `{now}`", parse_mode="markdown") except: pass