Skip to content

Commit

Permalink
v1.2.0-x 🗳 Classify & Categorize
Browse files Browse the repository at this point in the history
> BotTheme Modular --> Upload via BSet
> Added BlackList Users (BLACKLIST_USERS introduced) with /bl & /rbl
>  Added Categories.txt & User TD set via USetting
> Added DeepLinking Save Msg ! Get without starting the Bot.
> Added Save Mode : BotPM or Dump
> Upgraded Broadcast V2 (Includes Edit, Delete, Modify Options) & GDClean V2 (Includes Move to Bin Option)
> Added New EXCEP_CHATS ( Exception Chats which runs separately and LOGS are Disabled in it)
> Upgraded GDToT Domain & Added Crypt for less prone to Errors
> Added Real-Debrid Support Includes Multiple Links Parse! (Torrents will be Added In Future)
> Help Messages are Exclusively Modernized
> Added New Args -c or -category for Categories & UserTD 
> Added Paste Service in Logs
> Added Leech Dumps Categories, Previously set will not Work now, Check the new Format
> Improve Stability and Optimized Memory Usage for Heavy Working Bots
> Added also arg for ldump i.e. -ud name or all
> Upgraded Status Msg with Fast Turn Btns and Spam Limiter.
> Added USER_TIME_INTERVAL (aka TimeGap or Rate Limiter) for individual User
> Added Topics Support
> Fix Playlist Limit,  Source Url, TG Links
> (Must Read) DB has been changed so that Multi Bots works on single DB without any Reflection on another bot.
> Upgraded Help & Stats with Version Control Mechanism ( Get Updates as Repo Updates )
> Added UserTD in Drive List & New Modular Unique UI
> Added COVER_IMAGE var for Telegraph List.
> Added VPN support in docker-compose using Gluetun ! (For Debrid Must)
> ... More Minor unnoticed changes Around the corners ..
> UPCOMING: Multi DDLs & AioHttp Downloader !

THANKS FOR READING ! ( HOPE YOU ARE EXITED ),  Leave a Star 🌟 to reach 1k & Forks in Supporting Us.
~ MysterySD 

CONTRIBUTIONS: Many Around Helped this Version to be Successful, I thank everyone who Helped in any way possible ...
  • Loading branch information
SilentDemonSD authored Aug 1, 2023
1 parent 140935f commit b5f1906
Show file tree
Hide file tree
Showing 60 changed files with 2,067 additions and 893 deletions.
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
FROM anasty17/mltb:latest
FROM mysterysd/wzmlx:latest

WORKDIR /usr/src/app
RUN chmod 777 /usr/src/app

RUN apt-get update && apt-get upgrade -y
RUN apt-get -qq install mediainfo -y

COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt

Expand Down
90 changes: 63 additions & 27 deletions bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,21 @@
Interval = []
QbInterval = []
QbTorrents = {}
DRIVES_NAMES = []
DRIVES_IDS = []
INDEX_URLS = []
GLOBAL_EXTENSION_FILTER = ['aria2', '!qB']
user_data = {}
extra_buttons = {}
shorteneres_list = []
list_drives_dict = {}
shorteners_list = []
categories_dict = {}
aria2_options = {}
qbit_options = {}
queued_dl = {}
queued_up = {}
bot_cache = {}
non_queued_dl = set()
non_queued_up = set()


def get_version():
MAJOR = '1'
MINOR = '1'
PATCH = '5'
return f"v{MAJOR}.{MINOR}.{PATCH}-x"


try:
if bool(environ.get('_____REMOVE_THIS_LINE_____')):
log_error('The README.md file there to be read! Exiting now!')
Expand Down Expand Up @@ -182,6 +175,11 @@ def changetz(*args):
aid = SUDO_USERS.split()
for id_ in aid:
user_data[int(id_.strip())] = {'is_sudo': True}

BLACKLIST_USERS = environ.get('BLACKLIST_USERS', '')
if len(BLACKLIST_USERS) != 0:
for id_ in BLACKLIST_USERS.split():
user_data[int(id_.strip())] = {'is_blacklist': True}

EXTENSION_FILTER = environ.get('EXTENSION_FILTER', '')
if len(EXTENSION_FILTER) > 0:
Expand Down Expand Up @@ -213,6 +211,14 @@ def changetz(*args):
UPTOBOX_TOKEN = environ.get('UPTOBOX_TOKEN', '')
if len(UPTOBOX_TOKEN) == 0:
UPTOBOX_TOKEN = ''

GDTOT_CRYPT = environ.get('GDTOT_CRYPT', '')
if len(GDTOT_CRYPT) == 0:
GDTOT_CRYPT = ''

DEBRID_API_KEY = environ.get('DEBRID_API_KEY', '')
if len(DEBRID_API_KEY) == 0:
DEBRID_API_KEY = ''

INDEX_URL = environ.get('INDEX_URL', '').rstrip("/")
if len(INDEX_URL) == 0:
Expand Down Expand Up @@ -329,6 +335,12 @@ def changetz(*args):
AS_DOCUMENT = environ.get('AS_DOCUMENT', '')
AS_DOCUMENT = AS_DOCUMENT.lower() == 'true'

USER_TD_MODE = environ.get('USER_TD_MODE', '')
USER_TD_MODE = USER_TD_MODE.lower() == 'true'

USER_TD_SA = environ.get('USER_TD_SA', '')
USER_TD_SA = USER_TD_SA.lower() if len(USER_TD_SA) != 0 else ''

SHOW_MEDIAINFO = environ.get('SHOW_MEDIAINFO', '')
SHOW_MEDIAINFO = SHOW_MEDIAINFO.lower() == 'true'

Expand Down Expand Up @@ -401,7 +413,10 @@ def changetz(*args):
LEECH_LIMIT = '' if len(LEECH_LIMIT) == 0 else float(LEECH_LIMIT)

USER_MAX_TASKS = environ.get('USER_MAX_TASKS', '')
USER_MAX_TASKS = '' if len(USER_MAX_TASKS) == 0 else int(USER_MAX_TASKS)
USER_MAX_TASKS = int(USER_MAX_TASKS) if USER_MAX_TASKS.isdigit() else ''

USER_TIME_INTERVAL = environ.get('USER_TIME_INTERVAL', '')
USER_TIME_INTERVAL = int(USER_TIME_INTERVAL) if USER_TIME_INTERVAL.isdigit() else 0

PLAYLIST_LIMIT = environ.get('PLAYLIST_LIMIT', '')
PLAYLIST_LIMIT = '' if len(PLAYLIST_LIMIT) == 0 else int(PLAYLIST_LIMIT)
Expand All @@ -420,6 +435,10 @@ def changetz(*args):
LEECH_LOG_ID = environ.get('LEECH_LOG_ID', '')
if len(LEECH_LOG_ID) == 0:
LEECH_LOG_ID = ''

EXCEP_CHATS = environ.get('EXCEP_CHATS', '')
if len(EXCEP_CHATS) == 0:
EXCEP_CHATS = ''

BOT_PM = environ.get('BOT_PM', '')
BOT_PM = BOT_PM.lower() == 'true'
Expand Down Expand Up @@ -466,6 +485,10 @@ def changetz(*args):
TITLE_NAME = environ.get('TITLE_NAME', '')
if len(TITLE_NAME) == 0:
TITLE_NAME = 'WZ-M/L-X'

COVER_IMAGE = environ.get('COVER_IMAGE', '')
if len(COVER_IMAGE) == 0:
COVER_IMAGE = 'https://graph.org/file/60f9f8bcb97d27f76f5c0.jpg'

GD_INFO = environ.get('GD_INFO', '')
if len(GD_INFO) == 0:
Expand Down Expand Up @@ -547,11 +570,13 @@ def changetz(*args):
'AUTO_DELETE_MESSAGE_DURATION': AUTO_DELETE_MESSAGE_DURATION,
'BASE_URL': BASE_URL,
'BASE_URL_PORT': BASE_URL_PORT,
'BLACKLIST_USERS': BLACKLIST_USERS,
'BOT_TOKEN': BOT_TOKEN,
'BOT_MAX_TASKS': BOT_MAX_TASKS,
'CAP_FONT': CAP_FONT,
'CMD_SUFFIX': CMD_SUFFIX,
'DATABASE_URL': DATABASE_URL,
'DEBRID_API_KEY': DEBRID_API_KEY,
'DELETE_LINKS': DELETE_LINKS,
'DEFAULT_UPLOAD': DEFAULT_UPLOAD,
'DOWNLOAD_DIR': DOWNLOAD_DIR,
Expand All @@ -565,13 +590,15 @@ def changetz(*args):
'LEECH_LIMIT': LEECH_LIMIT,
'FSUB_IDS': FSUB_IDS,
'USER_MAX_TASKS': USER_MAX_TASKS,
'USER_TIME_INTERVAL': USER_TIME_INTERVAL,
'PLAYLIST_LIMIT': PLAYLIST_LIMIT,
'DAILY_TASK_LIMIT': DAILY_TASK_LIMIT,
'DAILY_MIRROR_LIMIT': DAILY_MIRROR_LIMIT,
'DAILY_LEECH_LIMIT': DAILY_LEECH_LIMIT,
'MIRROR_LOG_ID': MIRROR_LOG_ID,
'LEECH_LOG_ID': LEECH_LOG_ID,
'LINKS_LOG_ID': LINKS_LOG_ID,
'EXCEP_CHATS': EXCEP_CHATS,
'BOT_PM': BOT_PM,
'DISABLE_DRIVE_LINK': DISABLE_DRIVE_LINK,
'BOT_THEME': BOT_THEME,
Expand All @@ -581,9 +608,11 @@ def changetz(*args):
'IMDB_TEMPLATE': IMDB_TEMPLATE,
'AUTHOR_NAME': AUTHOR_NAME,
'AUTHOR_URL': AUTHOR_URL,
'COVER_IMAGE': COVER_IMAGE,
'TITLE_NAME': TITLE_NAME,
'TIMEZONE': TIMEZONE,
'GD_INFO': GD_INFO,
'GDTOT_CRYPT': GDTOT_CRYPT,
'EQUAL_SPLITS': EQUAL_SPLITS,
'EXTENSION_FILTER': EXTENSION_FILTER,
'GDRIVE_ID': GDRIVE_ID,
Expand Down Expand Up @@ -637,44 +666,51 @@ def changetz(*args):
'UPSTREAM_BRANCH': UPSTREAM_BRANCH,
'UPTOBOX_TOKEN': UPTOBOX_TOKEN,
'USER_SESSION_STRING': USER_SESSION_STRING,
'USER_TD_MODE':USER_TD_MODE,
'USER_TD_SA': USER_TD_SA,
'USE_SERVICE_ACCOUNTS': USE_SERVICE_ACCOUNTS,
'WEB_PINCODE': WEB_PINCODE,
'YT_DLP_OPTIONS': YT_DLP_OPTIONS}

if GDRIVE_ID:
DRIVES_NAMES.append("Main")
DRIVES_IDS.append(GDRIVE_ID)
INDEX_URLS.append(INDEX_URL)
list_drives_dict['Main'] = {"drive_id": GDRIVE_ID, "index_link": INDEX_URL}
categories_dict['Root'] = {"drive_id": GDRIVE_ID, "index_link": INDEX_URL}

if ospath.exists('list_drives.txt'):
with open('list_drives.txt', 'r+') as f:
lines = f.readlines()
for line in lines:
temp = line.strip().split()
DRIVES_IDS.append(temp[1])
DRIVES_NAMES.append(temp[0].replace("_", " "))
if len(temp) > 2:
INDEX_URLS.append(temp[2])
else:
INDEX_URLS.append('')
sep = 2 if line.strip().split()[-1].startswith('http') else 1
temp = line.strip().rsplit(maxsplit=sep)
name = "Main Custom" if temp[0].casefold() == "Main" else temp[0]
list_drives_dict[name] = {'drive_id': temp[1], 'index_link': (temp[2] if sep == 2 else '')}

if ospath.exists('categories.txt'):
with open('categories.txt', 'r+') as f:
lines = f.readlines()
for line in lines:
sep = 2 if line.strip().split()[-1].startswith('http') else 1
temp = line.strip().rsplit(maxsplit=sep)
name = "Root Custom" if temp[0].casefold() == "Root" else temp[0]
categories_dict[name] = {'drive_id': temp[1], 'index_link': (temp[2] if sep == 2 else '')}

if ospath.exists('buttons.txt'):
with open('buttons.txt', 'r+') as f:
lines = f.readlines()
for line in lines:
temp = line.strip().split()
if len(extra_buttons.keys()) >= 6:
temp = line.strip().rsplit(maxsplit=1)
if len(extra_buttons.keys()) >= 20:
break
if len(temp) == 2:
extra_buttons[temp[0].replace("_", " ")] = temp[1]
elif temp[1].startswith('http'):
extra_buttons[temp[0]] = temp[1]

if ospath.exists('shorteners.txt'):
with open('shorteners.txt', 'r+') as f:
lines = f.readlines()
for line in lines:
temp = line.strip().split()
if len(temp) == 2:
shorteneres_list.append({'domain': temp[0],'api_key': temp[1]})
shorteners_list.append({'domain': temp[0],'api_key': temp[1]})

if BASE_URL:
Popen(f"gunicorn web.wserver:app --bind 0.0.0.0:{BASE_URL_PORT} --worker-class gevent", shell=True)
Expand Down
Loading

0 comments on commit b5f1906

Please sign in to comment.