Skip to content

Commit

Permalink
v1.1.5 🔗 LINKS, PARSE, SHOW ...
Browse files Browse the repository at this point in the history
1) LINKS_LOG_ID Added (Single), Complete Logging System.
2) LEECH_SPLIT_SIZE fixed on Adding USER_SESSION_STRING
3) Bot PM, Bot Start Fixed for Non-started Users
4) Dump Channel SAVE MSG removed
5) Bot PM added Reply to Task Added Msg.
6) Added SHOW_EXTRA_CMDS, used for Old Use of All Zip & UnZip cmds + Usage of Args
7) Miror Log & Leech Log --> Multiple!
8) CLEAN_LOG_MSG Added to Make LEECH_LOG Clean
9) Added {md5_hash} extra Filling in Caption
10) Added Magnet URLs, On Tg Files, All Details..
11) Fixed Premium Upload File Issue
12) Changed View in Bot Button to Inline Button, Now Only its User can Go to PM.
13) Speed Up on Start cmd

**MORE UPCOMING, PUSHED TO FIX THE ERRORS !**
`( EXCEP_CHATS, BLACKLIST_USER, DISABLE_MODULES )`

Thanks You, for Checking out, Now go Explore in Bot 🛠.... ( Hit More Stars 🌟 to Motivate ) 👓
-------
Co-authored-by: mlbtheroku <[email protected]>
  • Loading branch information
SilentDemonSD authored Jul 11, 2023
1 parent 34338a3 commit 41ce992
Show file tree
Hide file tree
Showing 17 changed files with 316 additions and 156 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ data*
log.txt
accounts/*
Thumbnails/*
MediaInfo/*
Images/*
rclone/*
list_drives.txt
cookies.txt
Expand Down
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

28 changes: 20 additions & 8 deletions bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
def get_version():
MAJOR = '1'
MINOR = '1'
PATCH = '4'
PATCH = '5'
return f"v{MAJOR}.{MINOR}.{PATCH}-x"


Expand Down Expand Up @@ -261,7 +261,7 @@ def changetz(*args):
MAX_SPLIT_SIZE = 4194304000 if IS_PREMIUM_USER else 2097152000

LEECH_SPLIT_SIZE = environ.get('LEECH_SPLIT_SIZE', '')
if len(LEECH_SPLIT_SIZE) == 0 or int(LEECH_SPLIT_SIZE) > MAX_SPLIT_SIZE:
if str(LEECH_SPLIT_SIZE) in ["4194304000", "2097152000"] or len(LEECH_SPLIT_SIZE) == 0 or int(LEECH_SPLIT_SIZE) > MAX_SPLIT_SIZE:
LEECH_SPLIT_SIZE = MAX_SPLIT_SIZE
else:
LEECH_SPLIT_SIZE = int(LEECH_SPLIT_SIZE)
Expand All @@ -288,9 +288,6 @@ def changetz(*args):
SEARCH_LIMIT = environ.get('SEARCH_LIMIT', '')
SEARCH_LIMIT = 0 if len(SEARCH_LIMIT) == 0 else int(SEARCH_LIMIT)

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

STATUS_LIMIT = environ.get('STATUS_LIMIT', '')
STATUS_LIMIT = 6 if len(STATUS_LIMIT) == 0 else int(STATUS_LIMIT)

Expand Down Expand Up @@ -380,8 +377,7 @@ def changetz(*args):
RCLONE_SERVE_PASS = ''

STORAGE_THRESHOLD = environ.get('STORAGE_THRESHOLD', '')
STORAGE_THRESHOLD = '' if len(
STORAGE_THRESHOLD) == 0 else float(STORAGE_THRESHOLD)
STORAGE_THRESHOLD = '' if len(STORAGE_THRESHOLD) == 0 else float(STORAGE_THRESHOLD)

TORRENT_LIMIT = environ.get('TORRENT_LIMIT', '')
TORRENT_LIMIT = '' if len(TORRENT_LIMIT) == 0 else float(TORRENT_LIMIT)
Expand Down Expand Up @@ -413,10 +409,17 @@ def changetz(*args):
FSUB_IDS = environ.get('FSUB_IDS', '')
if len(FSUB_IDS) == 0:
FSUB_IDS = ''

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

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

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

BOT_PM = environ.get('BOT_PM', '')
BOT_PM = BOT_PM.lower() == 'true'
Expand Down Expand Up @@ -462,7 +465,7 @@ def changetz(*args):

TITLE_NAME = environ.get('TITLE_NAME', '')
if len(TITLE_NAME) == 0:
TITLE_NAME = 'WZ M/L X'
TITLE_NAME = 'WZ-M/L-X'

GD_INFO = environ.get('GD_INFO', '')
if len(GD_INFO) == 0:
Expand All @@ -477,6 +480,12 @@ def changetz(*args):
SET_COMMANDS = environ.get('SET_COMMANDS', '')
SET_COMMANDS = SET_COMMANDS.lower() == 'true'

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

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

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

Expand Down Expand Up @@ -562,6 +571,7 @@ def changetz(*args):
'DAILY_LEECH_LIMIT': DAILY_LEECH_LIMIT,
'MIRROR_LOG_ID': MIRROR_LOG_ID,
'LEECH_LOG_ID': LEECH_LOG_ID,
'LINKS_LOG_ID': LINKS_LOG_ID,
'BOT_PM': BOT_PM,
'DISABLE_DRIVE_LINK': DISABLE_DRIVE_LINK,
'BOT_THEME': BOT_THEME,
Expand Down Expand Up @@ -613,6 +623,8 @@ def changetz(*args):
'SEARCH_PLUGINS': SEARCH_PLUGINS,
'SET_COMMANDS': SET_COMMANDS,
'SHOW_MEDIAINFO': SHOW_MEDIAINFO,
'CLEAN_LOG_MSG': CLEAN_LOG_MSG,
'SHOW_EXTRA_CMDS': SHOW_EXTRA_CMDS,
'SOURCE_LINK': SOURCE_LINK,
'STATUS_LIMIT': STATUS_LIMIT,
'STATUS_UPDATE_INTERVAL': STATUS_UPDATE_INTERVAL,
Expand Down
11 changes: 8 additions & 3 deletions bot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,13 @@ async def stats(client, message):

@new_task
async def start(client, message):
await DbManger().update_pm_users(message.from_user.id)
buttons = ButtonMaker()
buttons.ubutton(BotTheme('ST_BN1_NAME'), BotTheme('ST_BN1_URL'))
buttons.ubutton(BotTheme('ST_BN2_NAME'), BotTheme('ST_BN2_URL'))
reply_markup = buttons.build_menu(2)
if len(message.command) > 1 and config_dict['TOKEN_TIMEOUT']:
if len(message.command) > 1 and message.command[1] == "wzmlx":
await message.delete()
elif len(message.command) > 1 and config_dict['TOKEN_TIMEOUT']:
userid = message.from_user.id
encrypted_url = message.command[1]
input_token, pre_uid = (b64decode(encrypted_url.encode()).decode()).split('&&')
Expand All @@ -112,6 +113,8 @@ async def start(client, message):
await sendMessage(message, BotTheme('ST_BOTPM'), reply_markup, photo='IMAGES')
else:
await sendMessage(message, BotTheme('ST_UNAUTH'), reply_markup, photo='IMAGES')
await DbManger().update_pm_users(message.from_user.id)


async def token_callback(_, query):
user_id = query.from_user.id
Expand All @@ -125,7 +128,8 @@ async def token_callback(_, query):
kb = query.message.reply_markup.inline_keyboard[1:]
kb.insert(0, [InlineKeyboardButton('✅️ Activated ✅', callback_data='pass activated')])
await query.edit_message_reply_markup(InlineKeyboardMarkup(kb))



async def login(_, message):
if config_dict['LOGIN_PASS'] is None:
return
Expand All @@ -142,6 +146,7 @@ async def login(_, message):
else:
await sendMessage(message, '<b>Bot Login Usage :</b>\n\n<code>/cmd {password}</code>')


async def restart(client, message):
restart_message = await sendMessage(message, BotTheme('RESTARTING'))
if scheduler.running:
Expand Down
18 changes: 15 additions & 3 deletions bot/helper/ext_utils/bot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def extra_btns(buttons):
async def set_commands(client):
if config_dict['SET_COMMANDS']:
try:
await client.set_bot_commands([
bot_cmds = [
BotCommand(BotCommands.MirrorCommand[0], f'or /{BotCommands.MirrorCommand[1]} Mirror [links/media/rclone_path]'),
BotCommand(BotCommands.LeechCommand[0], f'or /{BotCommands.LeechCommand[1]} Leech [links/media/rclone_path]'),
BotCommand(BotCommands.QbMirrorCommand[0], f'or /{BotCommands.QbMirrorCommand[1]} Mirror magnet/torrent using qBittorrent'),
Expand All @@ -544,7 +544,7 @@ async def set_commands(client):
BotCommand(BotCommands.CloneCommand[0], f'or /{BotCommands.CloneCommand[1]} Copy file/folder to Drive (GDrive/RClone)'),
BotCommand(BotCommands.CountCommand, '[drive_url]: Count file/folder of Google Drive/RClone Drives'),
BotCommand(BotCommands.StatusCommand[0], f'or /{BotCommands.StatusCommand[1]} Get Bot All Status Stats Message'),
BotCommand(BotCommands.StatsCommand[0], f'or /{BotCommands.StatsCommand[1]}Check Bot & System stats'),
BotCommand(BotCommands.StatsCommand[0], f'or /{BotCommands.StatsCommand[1]} Check Bot & System stats'),
BotCommand(BotCommands.BtSelectCommand, 'Select files to download only torrents/magnet qbit/aria2c'),
BotCommand(BotCommands.CancelMirror, 'Cancel a Task of yours!'),
BotCommand(BotCommands.CancelAllCommand[0], f'Cancel all Tasks in whole Bots.'),
Expand All @@ -559,7 +559,19 @@ async def set_commands(client):
BotCommand(BotCommands.MediaInfoCommand[0], f'or /{BotCommands.MediaInfoCommand[1]} Generate Mediainfo for Replied Media or DL links'),
BotCommand(BotCommands.BotSetCommand[0], f"or /{BotCommands.BotSetCommand[1]} Bot's Personal Settings (Owner or Sudo Only)"),
BotCommand(BotCommands.RestartCommand[0], f'or /{BotCommands.RestartCommand[1]} Restart & Update the Bot (Owner or Sudo Only)'),
])
]
if config_dict['SHOW_EXTRA_CMDS']:
bot_cmds.insert(1, BotCommand(BotCommands.MirrorCommand[2], f'or /{BotCommands.MirrorCommand[3]} Mirror and UnZip [links/media/rclone_path]'))
bot_cmds.insert(1, BotCommand(BotCommands.MirrorCommand[4], f'or /{BotCommands.MirrorCommand[5]} Mirror and Zip [links/media/rclone_path]'))
bot_cmds.insert(4, BotCommand(BotCommands.LeechCommand[2], f'or /{BotCommands.LeechCommand[3]} Leech and UnZip [links/media/rclone_path]'))
bot_cmds.insert(4, BotCommand(BotCommands.LeechCommand[4], f'or /{BotCommands.LeechCommand[5]} Leech and Zip [links/media/rclone_path]'))
bot_cmds.insert(7, BotCommand(BotCommands.QbMirrorCommand[2], f'or /{BotCommands.QbMirrorCommand[3]} Mirror magnet/torrent and UnZip using qBit'))
bot_cmds.insert(7, BotCommand(BotCommands.QbMirrorCommand[4], f'or /{BotCommands.QbMirrorCommand[5]} Mirror magnet/torrent and Zip using qBit'))
bot_cmds.insert(10, BotCommand(BotCommands.QbLeechCommand[2], f'or /{BotCommands.QbLeechCommand[3]} Leech magnet/torrent and UnZip using qBit'))
bot_cmds.insert(10, BotCommand(BotCommands.QbLeechCommand[4], f'or /{BotCommands.QbLeechCommand[5]} Leech magnet/torrent and Zip using qBit'))
bot_cmds.insert(13, BotCommand(BotCommands.YtdlCommand[2], f'or /{BotCommands.YtdlCommand[3]} Mirror yt-dlp supported links and Zip via bot'))
bot_cmds.insert(13, BotCommand(BotCommands.YtdlLeechCommand[2], f'or /{BotCommands.YtdlLeechCommand[3]} Leech yt-dlp supported links and Zip via bot'))
await client.set_bot_commands(bot_cmds)
LOGGER.info('Bot Commands have been Set & Updated')
except Exception as err:
LOGGER.error(err)
Expand Down
7 changes: 4 additions & 3 deletions bot/helper/ext_utils/leech_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,10 @@ async def format_filename(file_, user_id, dirpath=None, isMirror=False):
slit = lcaption.split("|")
up_path = ospath.join(dirpath, prefile_)
cap_mono = slit[0].format(
filename=nfile_,
size=get_readable_file_size(await aiopath.getsize(up_path)),
duration = get_readable_time((await get_media_info(up_path))[0])
filename = nfile_,
size = get_readable_file_size(await aiopath.getsize(up_path)),
duration = get_readable_time((await get_media_info(up_path))[0]),
md5_hash = get_md5_hash(up_path)
)
if len(slit) > 1:
for rep in range(1, len(slit)):
Expand Down
11 changes: 5 additions & 6 deletions bot/helper/ext_utils/task_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ async def limit_checker(size, listener, isTorrent=False, isMega=False, isDriveLi


async def task_utils(message):
LOGGER.info('Checking Task Utilities ...')
LOGGER.info('Running Task Manager ...')
msg = []
button = None

token_msg, button = checking_access(message.from_user.id, button)
if token_msg is not None:
msg.append(token_msg)
if message.chat.type != message.chat.type.PRIVATE:
if message.chat.type != message.chat.type.BOT:
if ids := config_dict['FSUB_IDS']:
_msg, button = await forcesub(message, ids, button)
if _msg:
Expand All @@ -207,10 +207,9 @@ async def task_utils(message):
user_dict = user_data.get(user_id, {})
user = await user_info(message._client, message.from_user.id)
if config_dict['BOT_PM'] or user_dict.get('bot_pm'):
if user.status == user.status.LONG_AGO:
_msg, button = await BotPm_check(message, button)
if _msg:
msg.append(_msg)
_msg, button = await BotPm_check(message, button)
if _msg:
msg.append(_msg)
if (bmax_tasks := config_dict['BOT_MAX_TASKS']) and len(download_dict) >= bmax_tasks:
msg.append(f"Bot Max Tasks limit exceeded.\nBot max tasks limit is {bmax_tasks}.\nPlease wait for the completion of other tasks.")
if (maxtask := config_dict['USER_MAX_TASKS']) and await get_user_tasks(message.from_user.id, maxtask):
Expand Down
Loading

0 comments on commit 41ce992

Please sign in to comment.