From 7b9d9f432d3aee61cc81592f87f0c57846140bd1 Mon Sep 17 00:00:00 2001 From: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> Date: Fri, 15 Sep 2023 19:38:54 +0530 Subject: [PATCH 1/8] Update __init__.py Signed-off-by: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> --- Bot/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Bot/__init__.py b/Bot/__init__.py index 8083752..c230b76 100644 --- a/Bot/__init__.py +++ b/Bot/__init__.py @@ -18,6 +18,8 @@ MONGO_DB = os.environ.get("MONGO_DB", 'your mongodb') #MONGO DB FOR ANIME DATA FILES_CHANNEL = os.environ.get("FILES_CHANNEL", -100456789013) BOT_NAME = os.environ.get('BOT_NAME', 'Soheru') +#<-----------Variables For 4GB Support--------------> +SESSION_STRING = os.environ.get("SESSION_STRING",'') #<---------------Connecting--------------> if BOT_TOKEN is not None: try: @@ -26,3 +28,12 @@ except Exception as e: LOG.warn(f'😞 Error While Connecting To Bot\nCheck Errors: {e}') sys.exit() +#<---------------4GB Connecting--------------> + +if SESSION_STRING is not None: + try: + ubot = Client("Chizuru", session_string=SESSION_STRING, api_id=API_ID, api_hash=API_HASH, plugins=plugins,max_concurrent_transmissions = 10) + LOGS.info("❤️ 4GB String Session Connected") + except: + LOGS.info('😞 Error While Connecting To String Session') + sys.exit() From da86bcbf84cf93a7d6268da91f3a66e5481d20b6 Mon Sep 17 00:00:00 2001 From: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> Date: Fri, 15 Sep 2023 19:45:26 +0530 Subject: [PATCH 2/8] Update __init__.py Signed-off-by: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> From a0eab7322af5b835a8fe11d9ad79f0ba0bb341a4 Mon Sep 17 00:00:00 2001 From: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> Date: Fri, 15 Sep 2023 19:49:55 +0530 Subject: [PATCH 3/8] Update __init__.py Signed-off-by: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> --- Bot/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Bot/__init__.py b/Bot/__init__.py index c230b76..2f4bc58 100644 --- a/Bot/__init__.py +++ b/Bot/__init__.py @@ -19,7 +19,7 @@ FILES_CHANNEL = os.environ.get("FILES_CHANNEL", -100456789013) BOT_NAME = os.environ.get('BOT_NAME', 'Soheru') #<-----------Variables For 4GB Support--------------> -SESSION_STRING = os.environ.get("SESSION_STRING",'') +SESSION_STRING = os.environ.get("SESSION_STRING",'None') #Replace None With String Session #<---------------Connecting--------------> if BOT_TOKEN is not None: try: @@ -30,9 +30,9 @@ sys.exit() #<---------------4GB Connecting--------------> -if SESSION_STRING is not None: +if SESSION_STRING != "None": try: - ubot = Client("Chizuru", session_string=SESSION_STRING, api_id=API_ID, api_hash=API_HASH, plugins=plugins,max_concurrent_transmissions = 10) + ubot = Client("AutoEncoder", session_string=SESSION_STRING, api_id=API_ID, api_hash=API_HASH, plugins=plugins) LOGS.info("❤️ 4GB String Session Connected") except: LOGS.info('😞 Error While Connecting To String Session') From 3d0915a966589d65db688f207711fda162c9939d Mon Sep 17 00:00:00 2001 From: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> Date: Fri, 15 Sep 2023 20:04:18 +0530 Subject: [PATCH 4/8] Update __init__.py Signed-off-by: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> --- Bot/__init__.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Bot/__init__.py b/Bot/__init__.py index 2f4bc58..3b2f5f1 100644 --- a/Bot/__init__.py +++ b/Bot/__init__.py @@ -29,11 +29,14 @@ LOG.warn(f'😞 Error While Connecting To Bot\nCheck Errors: {e}') sys.exit() #<---------------4GB Connecting--------------> - -if SESSION_STRING != "None": - try: - ubot = Client("AutoEncoder", session_string=SESSION_STRING, api_id=API_ID, api_hash=API_HASH, plugins=plugins) - LOGS.info("❤️ 4GB String Session Connected") - except: - LOGS.info('😞 Error While Connecting To String Session') - sys.exit() +def create_ubot(): + global SESSION_STRING + if SESSION_STRING != "None": + try: + ubot = Client("AutoEncoder", session_string=SESSION_STRING, api_id=API_ID, api_hash=API_HASH, plugins=plugins) + LOGS.info("❤️ 4GB String Session Connected") + return ubot + except: + LOGS.info('😞 Error While Connecting To String Session') + sys.exit() + return None From 61105d3ba624ada4f90e205a70f6671032afa9dc Mon Sep 17 00:00:00 2001 From: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> Date: Fri, 15 Sep 2023 20:06:45 +0530 Subject: [PATCH 5/8] Update __main__.py Signed-off-by: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> --- Bot/__main__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Bot/__main__.py b/Bot/__main__.py index 19edb4c..a792540 100644 --- a/Bot/__main__.py +++ b/Bot/__main__.py @@ -1,9 +1,13 @@ -from Bot import OWNER_ID, encoder +from Bot import OWNER_ID, encoder, create_ubot from pyrogram.types import InlineKeyboardMarkup as IKM, InlineKeyboardButton as IKB import asyncio encoder.start() +success = create_ubot() +if success != None: + ubot = success + ubot.start() try: encoder.send_message(OWNER_ID, text='Bot Started', reply_markup=IKM([[IKB('ʜᴇʟᴘ', 'answer_help'), IKB('ᴅᴇᴠᴇʟᴏᴘᴇʀ', 'answer_about_dev')]])) @@ -11,4 +15,4 @@ pass loop = asyncio.get_event_loop() -loop.run_forever() \ No newline at end of file +loop.run_forever() From 2d3ecd45bcb6381445c54464d00648b052c2a442 Mon Sep 17 00:00:00 2001 From: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> Date: Fri, 15 Sep 2023 20:14:22 +0530 Subject: [PATCH 6/8] Update __init__.py Signed-off-by: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> --- Bot/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Bot/__init__.py b/Bot/__init__.py index 3b2f5f1..ec118c3 100644 --- a/Bot/__init__.py +++ b/Bot/__init__.py @@ -20,6 +20,7 @@ BOT_NAME = os.environ.get('BOT_NAME', 'Soheru') #<-----------Variables For 4GB Support--------------> SESSION_STRING = os.environ.get("SESSION_STRING",'None') #Replace None With String Session +ubot = None # Don't Touch This #<---------------Connecting--------------> if BOT_TOKEN is not None: try: @@ -31,6 +32,7 @@ #<---------------4GB Connecting--------------> def create_ubot(): global SESSION_STRING + global ubot if SESSION_STRING != "None": try: ubot = Client("AutoEncoder", session_string=SESSION_STRING, api_id=API_ID, api_hash=API_HASH, plugins=plugins) From 4382bb216ff4f3a5c44591a8533aabcabd07acb3 Mon Sep 17 00:00:00 2001 From: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> Date: Fri, 15 Sep 2023 20:30:32 +0530 Subject: [PATCH 7/8] Update encoder.py Signed-off-by: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> --- Bot/plugins/encoder.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Bot/plugins/encoder.py b/Bot/plugins/encoder.py index 2b9ef0e..2694f74 100644 --- a/Bot/plugins/encoder.py +++ b/Bot/plugins/encoder.py @@ -5,13 +5,14 @@ from Bot.plugins.database.mongo_db import check_user_mdb,check_vcodec_settings,update_vcodec_settings,check_preset_settings,update_preset_settings,check_resolution_settings,check_audio_type_mdb, update_audio_type_mdb,update_resolution_settings from Bot.utils.decorators import ffmpeg_settings -from Bot import encoder, OWNER_ID, LOG, FILES_CHANNEL +from Bot import encoder, OWNER_ID, LOG, FILES_CHANNEL, SESSION_STRING , ubot from Bot.utils.progress_pyro import progress_for_pyrogram from Bot.utils.ffmpeg import ffmpeg_progress encoder_is_on = [] flood = [] + async def on_task_complete(): del encoder_is_on[0] if len(encoder_is_on) > 0: @@ -41,11 +42,15 @@ async def add_task(message): file_name = output.rsplit('/', 1)[1].replace('_IA', "") try: #MSG EDIT AND EDIT await msg.edit(f'**Encoding Completed') - file = await msg.reply_document(output, caption=f"**{check_resolution}**", file_name=file_name) + if ubot == None: + file = await encoder.send_document(chat_id = FILES_CHANNEL, document = output, caption=f"**{check_resolution}**", file_name=file_name) + else: + file = await ubot.send_document(chat_id = FILES_CHANNEL, document = output, caption=f"**{check_resolution}**", file_name=file_name) + except Exception as e: LOG.info(f'Error while file sending\n'+e) try: - await file.copy(FILES_CHANNEL) + await encoder.copy_message(chat_id = msg.chat.id, from_chat_id = FILES_CHANNEL, message_id= file.id) except Exception as e: LOG.info(f'Error while file copy\n'+e) From 6c1442fdc343a6b15616588ed40b8460e4684865 Mon Sep 17 00:00:00 2001 From: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> Date: Fri, 15 Sep 2023 20:33:24 +0530 Subject: [PATCH 8/8] Update __init__.py Signed-off-by: Solo Leveling <109235836+SoloLeveling7seven@users.noreply.github.com> --- Bot/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Bot/__init__.py b/Bot/__init__.py index ec118c3..e5d4c9e 100644 --- a/Bot/__init__.py +++ b/Bot/__init__.py @@ -16,10 +16,10 @@ APP_HASH = os.environ.get('APP_HASH', 'your api id')# Telgram App hash OWNER_ID = int(os.environ.get('OWNER_ID', 953362604)) MONGO_DB = os.environ.get("MONGO_DB", 'your mongodb') #MONGO DB FOR ANIME DATA -FILES_CHANNEL = os.environ.get("FILES_CHANNEL", -100456789013) +FILES_CHANNEL = os.environ.get("FILES_CHANNEL", -100456789013) # Must Fill This ,Add Bot As Admin In Log Channel BOT_NAME = os.environ.get('BOT_NAME', 'Soheru') -#<-----------Variables For 4GB Support--------------> -SESSION_STRING = os.environ.get("SESSION_STRING",'None') #Replace None With String Session +#<-----------Variables For 4GB Support (Optional)--------------> +SESSION_STRING = os.environ.get("SESSION_STRING",'None') #Replace None With String Session Your String Session Account Must Be Present In Log Channel ubot = None # Don't Touch This #<---------------Connecting--------------> if BOT_TOKEN is not None: