Skip to content

Commit

Permalink
4Gb Support
Browse files Browse the repository at this point in the history
Added 4GB Support
  • Loading branch information
soheru authored Sep 18, 2023
2 parents 5cd5b90 + 6c1442f commit b193db0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
18 changes: 17 additions & 1 deletion Bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
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 (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:
try:
Expand All @@ -26,3 +29,16 @@
except Exception as e:
LOG.warn(f'😞 Error While Connecting To Bot\nCheck Errors: {e}')
sys.exit()
#<---------------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)
LOGS.info("❤️ 4GB String Session Connected")
return ubot
except:
LOGS.info('😞 Error While Connecting To String Session')
sys.exit()
return None
8 changes: 6 additions & 2 deletions Bot/__main__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
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')]]))
except:
pass

loop = asyncio.get_event_loop()
loop.run_forever()
loop.run_forever()
11 changes: 8 additions & 3 deletions Bot/plugins/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit b193db0

Please sign in to comment.