Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
UI changes.
  • Loading branch information
Dawn-India committed Aug 10, 2024
1 parent 09946e1 commit 68e21cf
Show file tree
Hide file tree
Showing 15 changed files with 971 additions and 836 deletions.
89 changes: 51 additions & 38 deletions bot/helper/ext_utils/bot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ def create_help_buttons():
f"help mirror {name}"
)
buttons.ibutton(
"Close",
"ᴄʟᴏꜱᴇ",
"help close"
)
COMMAND_USAGE["mirror"] = [
MIRROR_HELP_DICT["main"],
buttons.build_menu(3)
buttons.build_menu(2)
]
buttons.reset()
for name in list(YT_HELP_DICT.keys())[1:]:
Expand All @@ -76,12 +76,12 @@ def create_help_buttons():
f"help yt {name}"
)
buttons.ibutton(
"Close",
"ᴄʟᴏꜱᴇ",
"help close"
)
COMMAND_USAGE["yt"] = [
YT_HELP_DICT["main"],
buttons.build_menu(3)
buttons.build_menu(2)
]
buttons.reset()
for name in list(CLONE_HELP_DICT.keys())[1:]:
Expand All @@ -90,12 +90,12 @@ def create_help_buttons():
f"help clone {name}"
)
buttons.ibutton(
"Close",
"ᴄʟᴏꜱᴇ",
"help close"
)
COMMAND_USAGE["clone"] = [
CLONE_HELP_DICT["main"],
buttons.build_menu(3)
buttons.build_menu(2)
]


Expand All @@ -116,32 +116,35 @@ def bt_selection_buttons(id_):
BASE_URL = config_dict["BASE_URL"]
if config_dict["WEB_PINCODE"]:
buttons.ubutton(
"Select Files",
"ꜱᴇʟᴇᴄᴛ ꜰɪʟᴇꜱ",
f"{BASE_URL}/app/files/{id_}"
)
buttons.ibutton(
"Pincode",
"ᴘɪɴᴄᴏᴅᴇ",
f"sel pin {gid} {pincode}"
)
else:
buttons.ubutton(
"Select Files",
"ꜱᴇʟᴇᴄᴛ ꜰɪʟᴇꜱ",
f"{BASE_URL}/app/files/{id_}?pin_code={pincode}"
)
buttons.ibutton(
"Done Selecting",
"ᴅᴏɴᴇ ꜱᴇʟᴇᴄᴛɪɴɢ",
f"sel done {gid} {id_}"
)
buttons.ibutton(
"Cancel",
"ᴄʟᴏꜱᴇ",
f"sel cancel {gid}"
)
return buttons.build_menu(2)


def extra_btns(buttons):
if extra_buttons:
for btn_name, btn_url in extra_buttons.items():
for (
btn_name,
btn_url
) in extra_buttons.items():
buttons.ubutton(
btn_name,
btn_url
Expand All @@ -154,87 +157,87 @@ async def set_commands(client):
await client.set_bot_commands([
BotCommand(
f"{BotCommands.MirrorCommand[0]}",
"Mirror direct links using Aria2"
"ᴍɪʀʀᴏʀ ᴅɪʀᴇᴄᴛ ʟɪɴᴋꜱ ᴜꜱɪɴɢ ᴀʀɪᴀ2ᴄ"
),
BotCommand(
f"{BotCommands.JdMirrorCommand[0]}",
"Mirror supported links using JDownloader"
"ᴍɪʀʀᴏʀ ᴊᴅᴏᴡɴʟᴏᴀᴅᴇʀ ꜱᴜᴘᴘᴏʀᴛᴇᴅ ʟɪɴᴋꜱ"
),
BotCommand(
f"{BotCommands.NzbMirrorCommand[0]}",
"Mirror NZB files using SABnzbd"
"ᴍɪʀʀᴏʀ ꜱᴀʙɴᴢʙᴅ ꜱᴜᴘᴘᴏʀᴛᴇᴅ ʟɪɴᴋꜱ ᴏʀ ꜰɪʟᴇꜱ"
),
BotCommand(
f"{BotCommands.QbMirrorCommand[0]}",
"Mirror torrents using qBittorrent"
"ᴍɪʀʀᴏʀ Qʙɪᴛ-ᴛᴏʀʀᴇɴᴛ ꜱᴜᴘᴘᴏʀᴛᴇᴅ ʟɪɴᴋꜱ ᴏʀ ꜰɪʟᴇꜱ"
),
BotCommand(
f"{BotCommands.YtdlCommand[0]}",
"Mirror yt-dlp supported links"
"ᴍɪʀʀᴏʀ ʏᴛ-ᴅʟᴘ ꜱᴜᴘᴘᴏʀᴛᴇᴅ ʟɪɴᴋꜱ"
),
BotCommand(
f"{BotCommands.LeechCommand[0]}",
"Leech direct links using Aria2"
"ʟᴇᴇᴄʜ ᴅɪʀᴇᴄᴛ ʟɪɴᴋꜱ ᴜꜱɪɴɢ ᴀʀɪᴀ2ᴄ"
),
BotCommand(
f"{BotCommands.JdLeechCommand[0]}",
"Leech supported links using JDownloader"
"ʟᴇᴇᴄʜ ᴊᴅᴏᴡɴʟᴏᴀᴅᴇʀ ꜱᴜᴘᴘᴏʀᴛᴇᴅ ʟɪɴᴋꜱ"
),
BotCommand(
f"{BotCommands.NzbLeechCommand[0]}",
"Leech NZB files using SABnzbd"
"ʟᴇᴇᴄʜ ꜱᴀʙɴᴢʙᴅ ꜱᴜᴘᴘᴏʀᴛᴇᴅ ʟɪɴᴋꜱ ᴏʀ ꜰɪʟᴇꜱ"
),
BotCommand(
f"{BotCommands.QbLeechCommand[0]}",
"Leech torrents using qBittorrent"
"ʟᴇᴇᴄʜ Qʙɪᴛ-ᴛᴏʀʀᴇɴᴛ ꜱᴜᴘᴘᴏʀᴛᴇᴅ ʟɪɴᴋꜱ ᴏʀ ꜰɪʟᴇꜱ"
),
BotCommand(
f"{BotCommands.YtdlLeechCommand[0]}",
"Leech yt-dlp supported links"
"ʟᴇᴇᴄʜ ʏᴛ-ᴅʟᴘ ꜱᴜᴘᴘᴏʀᴛᴇᴅ ʟɪɴᴋꜱ"
),
BotCommand(
f"{BotCommands.CloneCommand}",
"Copy file/folder to Drive"
"ᴄᴏᴘʏ ꜰɪʟᴇ ᴏʀ ꜰᴏʟᴅᴇʀ ᴛᴏ ᴛʜᴇ ᴅʀɪᴠᴇ"
),
BotCommand(
f"{BotCommands.CountCommand}",
"[drive_url]: Count file/folder of Google Drive."
"[ᴅʀɪᴠᴇ ᴜʀʟ]: ᴄᴏᴜɴᴛ ꜰɪʟᴇ ᴏʀ ꜰᴏʟᴅᴇʀ ᴏꜰ ᴛʜᴇ ɢᴏᴏɢʟᴇ ᴅʀɪᴠᴇ"
),
BotCommand(
f"{BotCommands.StatusCommand[0]}",
"Get mirror status message"
"ɢᴇᴛ ᴀʟʟ ᴛᴀꜱᴋꜱ ꜱᴛᴀᴛᴜꜱ ᴍᴇꜱꜱᴀɢᴇ"
),
BotCommand(
f"{BotCommands.StatsCommand[0]}",
"Check bot stats"
"ᴄʜᴇᴄᴋ ʙᴏᴛ ꜱᴛᴀᴛꜱ"
),
BotCommand(
f"{BotCommands.SelectCommand}",
"Select files to download only torrents"
"ꜱᴇʟᴇᴄᴛ ꜰɪʟᴇꜱ ᴛᴏ ᴅᴏᴡɴʟᴏᴀᴅ"
),
BotCommand(
f"{BotCommands.CancelTaskCommand[0]}",
"Cancel a Task"
"ᴄᴀɴᴄᴇʟ ᴀ ᴛᴀꜱᴋ"
),
BotCommand(
f"{BotCommands.CancelAllCommand}",
"Cancel all tasks which added by you."
"ᴄᴀɴᴄᴇʟ ᴀʟʟ ᴛᴀꜱᴋꜱ ᴡʜɪᴄʜ ᴀᴅᴅᴇᴅ ʙʏ ʏᴏᴜ"
),
BotCommand(
f"{BotCommands.ListCommand}",
"Search in Drive"
"ꜱᴇᴀʀᴄʜ ɪɴ ᴅʀɪᴠᴇ"
),
BotCommand(
f"{BotCommands.SearchCommand}",
"Search in Torrent"
"ꜱᴇᴀʀᴄʜ ɪɴ ᴛᴏʀʀᴇɴᴛ"
),
BotCommand(
f"{BotCommands.UserSetCommand[0]}",
"Users settings"
"ᴜꜱᴇʀꜱ ꜱᴇᴛᴛɪɴɢꜱ"
),
BotCommand(
f"{BotCommands.HelpCommand}",
"Get detailed help"
"ɢᴇᴛ ᴅᴇᴛᴀɪʟᴇᴅ ʜᴇʟᴘ"
),
])

Expand All @@ -243,7 +246,7 @@ async def get_telegraph_list(telegraph_content):
path = [
(
await telegraph.create_page(
title="Z-Mirror Drive Search",
title="ᴢ-ᴍɪʀʀᴏʀ ᴅʀɪᴠᴇ ꜱᴇᴀʀᴄʜ",
content=content
)
)["path"]
Expand All @@ -256,7 +259,7 @@ async def get_telegraph_list(telegraph_content):
)
buttons = ButtonMaker()
buttons.ubutton(
"🔎 VIEW",
"🔎 ᴠɪᴇᴡ\nʀᴇꜱᴜʟᴛꜱ",
f"https://telegra.ph/{path[0]}"
)
return buttons.build_menu(1)
Expand Down Expand Up @@ -308,15 +311,21 @@ def arg_parser(items, arg_base):
for j in range(i + 1, t):
item = items[j]
if item in arg_base:
if part in bool_arg_set and not sub_list:
if (
part in bool_arg_set
and not sub_list
):
arg_base[part] = True
break
sub_list.append(item)
i += 1
if sub_list:
arg_base[part] = " ".join(sub_list)
i += 1
if "link" in arg_base and items[0] not in arg_base:
if (
"link" in arg_base
and items[0] not in arg_base
):
link = []
if arg_start == -1:
link.extend(iter(items))
Expand Down Expand Up @@ -396,7 +405,11 @@ async def cmd_exec(cmd, shell=False):
stderr = stderr.decode().strip()
except:
stderr = "Unable to decode the error!"
return stdout, stderr, proc.returncode
return (
stdout,
stderr,
proc.returncode
)


def new_task(func):
Expand Down
91 changes: 46 additions & 45 deletions bot/helper/ext_utils/help_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,58 +263,58 @@

YT_HELP_DICT = {
"main": yt,
"New-Name": f"{new_name}\nNote: Don't add file extension",
"Zip": zip_arg,
"Quality": qual,
"Options": yt_opt,
"Multi-Link": multi_link,
"Same-Directory": same_dir,
"Thumb": thumb,
"Split-Size": split_size,
"Upload-Destination": upload,
"Rclone-Flags": rcf,
"Bulk": bulk,
"Sample-Video": sample_video,
"Screenshot": screenshot,
"Convert-Media": convert_media,
"Force-Start": force_start,
"Name-Substitute": name_sub,
"Mixed-Leech": mixed_leech,
"ʀᴇɴᴀᴍᴇ\nꜰɪʟᴇ": f"{new_name}\nNote: Don't add file extension",
"ᴢɪᴘ\nꜰɪʟᴇꜱ": zip_arg,
"Qᴜᴀʟɪᴛʏ\nᴏᴘᴛ": qual,
"ʏᴛ\nᴏᴘᴛɪᴏɴꜱ": yt_opt,
"ᴍᴜʟᴛɪ\nʟɪɴᴋ": multi_link,
"ꜱᴀᴍᴇ\nᴅɪʀᴇᴄᴛᴏʀʏ": same_dir,
"ᴀᴅᴅ\nᴛʜᴜᴍʙ": thumb,
"ꜱᴘʟɪᴛ\nꜱɪᴢᴇ": split_size,
"ᴜᴘʟᴏᴀᴅ\nᴅᴇꜱᴛɪɴᴀᴛɪᴏɴ": upload,
"ʀᴄʟᴏɴᴇ\nꜰʟᴀɢꜱ": rcf,
"ʙᴜʟᴋ\nʟɪɴᴋꜱ": bulk,
"ꜱᴀᴍᴘʟᴇ\nᴠɪᴅᴇᴏ": sample_video,
"ꜱᴄʀᴇᴇɴ\nꜱʜᴏᴛ": screenshot,
"ᴄᴏɴᴠᴇʀᴛ\nᴍᴇᴅɪᴀ": convert_media,
"ꜰᴏʀᴄᴇ\nꜱᴛᴀʀᴛ": force_start,
"ɴᴀᴍᴇ\nꜱᴜʙꜱᴛɪᴛᴜᴛᴇ": name_sub,
"ʜʏʙʀɪᴅ\nʟᴇᴇᴄʜ": mixed_leech,
}

MIRROR_HELP_DICT = {
"main": mirror,
"New-Name": new_name,
"DL-Auth": "<b>Direct link authorization</b>: -au -ap\n\n/cmd link -au username -ap password",
"Headers": "<b>Direct link custom headers</b>: -h\n\n/cmd link -h key: value key1: value1",
"Extract/Zip": extract_zip,
"Select-Files": "<b>Bittorrent/JDownloader/Sabnzbd File Selection</b>: -s\n\n/cmd link -s or by replying to file/link",
"Torrent-Seed": seed,
"Multi-Link": multi_link,
"Same-Directory": same_dir,
"Thumb": thumb,
"Split-Size": split_size,
"Upload-Destination": upload,
"Rclone-Flags": rcf,
"Bulk": bulk,
"Join": join,
"Rclone-DL": rlone_dl,
"Tg-Links": tg_links,
"Sample-Video": sample_video,
"Screenshot": screenshot,
"Convert-Media": convert_media,
"Force-Start": force_start,
"User-Download": user_download,
"Name-Substitute": name_sub,
"Mixed-Leech": mixed_leech,
"ʀᴇɴᴀᴍᴇ\nꜰɪʟᴇ": new_name,
"ᴅᴏᴡɴʟᴏᴀᴅ\nᴀᴜᴛʜ": "<b>Direct link authorization</b>: -au -ap\n\n/cmd link -au username -ap password",
"ᴅᴅʟ\nʜᴇᴀᴅᴇʀꜱ": "<b>Direct link custom headers</b>: -h\n\n/cmd link -h key: value key1: value1",
"ᴇxᴛʀᴀᴄᴛ\nᴢɪᴘ": extract_zip,
"ꜱᴇʟᴇᴄᴛ\nꜰɪʟᴇꜱ": "<b>Bittorrent/JDownloader/Sabnzbd File Selection</b>: -s\n\n/cmd link -s or by replying to file/link",
"ᴛᴏʀʀᴇɴᴛ\nꜱᴇᴇᴅ": seed,
"ᴍᴜʟᴛɪ\nʟɪɴᴋ": multi_link,
"ꜱᴀᴍᴇ\nᴅɪʀᴇᴄᴛᴏʀʏ": same_dir,
"ᴀᴅᴅ\nᴛʜᴜᴍʙ": thumb,
"ꜱᴘʟɪᴛ\nꜱɪᴢᴇ": split_size,
"ᴜᴘʟᴏᴀᴅ\nᴅᴇꜱᴛɪɴᴀᴛɪᴏɴ": upload,
"ʀᴄʟᴏɴᴇ\nꜰʟᴀɢꜱ": rcf,
"ʙᴜʟᴋ\nʟɪɴᴋꜱ": bulk,
"ᴊᴏɪɴ\nꜰɪʟᴇꜱ": join,
"ʀᴄʟᴏɴᴇ\nᴅʟ": rlone_dl,
"ᴛᴇʟᴇɢʀᴀᴍ\nʟɪɴᴋꜱ": tg_links,
"ꜱᴀᴍᴘʟᴇ\nᴠɪᴅᴇᴏ": sample_video,
"ꜱᴄʀᴇᴇɴ\nꜱʜᴏᴛ": screenshot,
"ᴄᴏɴᴠᴇʀᴛ\nᴍᴇᴅɪᴀ": convert_media,
"ꜰᴏʀᴄᴇ\nꜱᴛᴀʀᴛ": force_start,
"ᴜꜱᴇʀ\nᴅᴏᴡɴʟᴏᴀᴅ": user_download,
"ɴᴀᴍᴇ\nꜱᴜʙꜱᴛɪᴛᴜᴛᴇ": name_sub,
"ʜʏʙʀɪᴅ\nʟᴇᴇᴄʜ": mixed_leech,
}

CLONE_HELP_DICT = {
"main": clone,
"Multi-Link": multi_link,
"Bulk": bulk,
"Gdrive": gdrive,
"Rclone": rclone_cl,
"ᴍᴜʟᴛɪ\nʟɪɴᴋ": multi_link,
"ʙᴜʟᴋ\nʟɪɴᴋꜱ": bulk,
"ɢᴏᴏɢʟᴇ\nᴅʀɪᴠᴇ": gdrive,
"ʀᴄʟᴏɴᴇ\nᴅʟ": rclone_cl,
}

RSS_HELP_MESSAGE = """
Expand Down Expand Up @@ -342,7 +342,8 @@
"""

PASSWORD_ERROR_MESSAGE = """
<b>This link requires a password!</b>
<b>Links require a password!</b>
- Insert <b>::</b> after the link and write the password after the sign.
<b>Example:</b> link::my password
Expand Down
Loading

0 comments on commit 68e21cf

Please sign in to comment.