Skip to content

Commit

Permalink
Minor update
Browse files Browse the repository at this point in the history
Fix button alignments in status.
- Added shortener bypass detector.
- Updated readme with all latest changes.
  • Loading branch information
Dawn-India committed Aug 7, 2024
1 parent 3531ad8 commit 09946e1
Show file tree
Hide file tree
Showing 10 changed files with 261 additions and 213 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

215 changes: 135 additions & 80 deletions README.md

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,15 @@
else:
TOKEN_TIMEOUT = ""

MINIMUM_DURATOIN = environ.get(
"MINIMUM_DURATOIN",
""
)
if MINIMUM_DURATOIN.isdigit():
MINIMUM_DURATOIN = int(MINIMUM_DURATOIN)
else:
MINIMUM_DURATOIN = ""

FSUB_IDS = environ.get(
"FSUB_IDS",
""
Expand Down Expand Up @@ -1084,6 +1093,7 @@
"MEGA_PASSWORD": MEGA_PASSWORD,
"MIXED_LEECH": MIXED_LEECH,
"MEGA_LIMIT": MEGA_LIMIT,
"MINIMUM_DURATOIN": MINIMUM_DURATOIN,
"NAME_SUBSTITUTE": NAME_SUBSTITUTE,
"NZB_LIMIT": NZB_LIMIT,
"PLAYLIST_LIMIT": PLAYLIST_LIMIT,
Expand Down
13 changes: 11 additions & 2 deletions bot/helper/ext_utils/db_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,12 @@ async def update_user_tdata(self, user_id, token, time):
)
self._conn.close # type: ignore

async def update_user_token(self, user_id, token):
async def update_user_token(self, user_id, token, inittime):
if self._err:
return
await self._db.access_token.update_one( # type: ignore
{"_id": user_id},
{"$set": {"token": token}},
{"$set": {"token": token, "inittime": inittime}},
upsert=True
)
self._conn.close # type: ignore
Expand All @@ -387,6 +387,15 @@ async def get_user_token(self, user_id):
self._conn.close # type: ignore
return None

async def get_token_init_time(self, user_id):
if self._err:
return None
user_data = await self._db.access_token.find_one({"_id": user_id}) # type: ignore
if user_data:
return user_data.get("inittime")
self._conn.close # type: ignore
return None

async def delete_all_access_tokens(self):
if self._err:
return
Expand Down
76 changes: 13 additions & 63 deletions bot/helper/ext_utils/help_messages.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mirror = """
<b>Send link along with command line or </b>
<b>Send link along with command line</b>:
/cmd link
Expand All @@ -9,8 +9,6 @@
<b>NOTE:</b>
1. Commands that start with <b>qb</b> are ONLY for torrents.
<b>Join: @Z_Mirror</b>
"""

yt = """
Expand All @@ -24,8 +22,6 @@
Check all supported <a href='https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md'>SITES</a>
Check all yt-dlp API options from this <a href='https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/YoutubeDL.py#L184'>FILE</a> or use this <a href='https://t.me/mltb_official_channel/177'>script</a> to convert CLI arguments to API options.
<b>Join: @Z_Mirror</b>
"""

clone = """
Expand All @@ -34,51 +30,39 @@
Use -sync to use sync method in rclone.
Example: /cmd rcl/rclone_path -up rcl/rclone_path/rc -sync
<b>Join: @Z_Mirror</b>
"""

new_name = """
<b>New Name</b>: -n
<b>Rename</b>: -n
/cmd link -n new name
/cmd link -n new_name
Note: Doesn't work with torrents
<b>Join: @Z_Mirror</b>
"""

multi_link = """
<b>Multi links only by replying to the first link/file</b>: -m
/cmd -m 10(number of links/files)
<b>Join: @Z_Mirror</b>
"""

same_dir = """
<b>Multi links within the same upload directory only by replying to the first link/file</b>: -sd
/cmd -m 10(number of links/files) -sd folder name (multi message)
/cmd -b -sd folder name (bulk-message/file)
<b>Join: @Z_Mirror</b>
"""

thumb = """
<b>Thumbnail for the current task</b>: -t
/cmd link -t tg-message-link(doc or photo)
<b>Join: @Z_Mirror</b>
"""

split_size = """
<b>Split size for the current task</b>: -sp
/cmd link -sp (500mb or 2gb or 4000000000)
Note: Only mb and gb are supported or write in bytes without unit!
<b>Join: @Z_Mirror</b>
"""

upload = """
Expand All @@ -94,8 +78,6 @@
In case you want to specify whether using token.pickle or service accounts you can add tp:gdrive_id or sa:gdrive_id or mtp:gdrive_id.
DEFAULT_UPLOAD has no effect on leech cmds.
<b>Join: @Z_Mirror</b>
"""

user_download = """
Expand All @@ -107,8 +89,6 @@
/cmd sa:gdrive_id to download using service account and file_id in case service account disabled.
/cmd mtp:gdrive_id or mtp:link to download using user token.pickle uploaded from usetting
/cmd mrcc:remote:path to download using user rclone config uploaded from usetting
<b>Join: @Z_Mirror</b>
"""

rcf = """
Expand All @@ -117,8 +97,6 @@
/cmd link|path|rcl -up path|rcl -rcf --buffer-size:8M|--drive-starred-only|key|key:value
This will override all other flags except --exclude.
Check here all <a href='https://rclone.org/flags/'>RcloneFlags</a>.
<b>Join: @Z_Mirror</b>
"""

bulk = """
Expand All @@ -133,8 +111,6 @@
Reply to this example by this cmd -> /cmd -b(bulk) or /cmd -b -sd folder name
You can set the start and end of the links from the bulk like seed, with -b start:end or only end by -b :end or only start by -b start.
The default start is from zero(first link) to infinity.
<b>Join: @Z_Mirror</b>
"""

rlone_dl = """
Expand All @@ -145,19 +121,16 @@
Users can add their own rclone from user settings
If you want to add a path manually from your config add mrcc: before the path without space
/cmd mrcc:main:dump/ubuntu.iso
<b>Join: @Z_Mirror</b>
"""

extract_zip = """
<b>Extract/Zip</b>: -e -z
/cmd link -e (extract)
/cmd link -e password (extract password protected)
/cmd link -z password (zip password protected)
/cmd link -z password -e (extract and zip password protected)
Note: When both extract and zip are added with cmd, it will extract first and then zip, so always extract first.
<b>Join: @Z_Mirror</b>
"""

join = """
Expand All @@ -169,8 +142,6 @@
/cmd -b -j -sd folder name
If you have a link(folder) that has split files:
/cmd link -j
<b>Join: @Z_Mirror</b>
"""

tg_links = """
Expand All @@ -185,8 +156,6 @@
Range: https://t.me/channel_name/first_message_id-last_message_id
Range Example: tg://openmessage?user_id=xxxxxx&message_id=555-560 or https://t.me/channel_name/100-150
Note: Range link will work only by replying cmd to it.
<b>Join: @Z_Mirror</b>
"""

sample_video = """
Expand All @@ -195,8 +164,6 @@
Create a sample video for one video or a folder of videos.
/cmd -sv (it will take the default values which are 60sec sample duration and part duration is 4sec).
You can control those values. Example: /cmd -sv 70:5(sample-duration:part-duration) or /cmd -sv :5 or /cmd -sv 70.
<b>Join: @Z_Mirror</b>
"""

screenshot = """
Expand All @@ -205,8 +172,6 @@
Create up to 10 screenshots for one video or a folder of videos.
/cmd -ss (it will take the default values which are 10 photos).
You can control this value. Example: /cmd -ss 6.
<b>Join: @Z_Mirror</b>
"""

seed = """
Expand All @@ -215,8 +180,6 @@
/cmd link -d ratio:seed_time or by replying to file/link
To specify ratio and seed time add -d ratio:time.
Example: -d 0.7:10 (ratio and time) or -d 0.7 (only ratio) or -d :10 (only time) where time is in minutes.
<b>Join: @Z_Mirror</b>
"""

zip_arg = """
Expand All @@ -225,16 +188,15 @@
/cmd link -z (zip)
/cmd link -z password (zip password protected)
<b>Join: @Z_Mirror</b>
/cmd link -z password -e (extract and zip password protected)
Note: When both extract and zip are added with cmd, it will extract first and then zip, so always extract first.
"""

qual = """
<b>Quality Buttons</b>: -s
In case default quality is added from yt-dlp options using format option and you need to select quality for specific link or links with multi links feature.
/cmd link -s
<b>Join: @Z_Mirror</b>
"""

yt_opt = """
Expand All @@ -244,67 +206,59 @@
Note: Add `^` before integer or float, some values must be numeric and some string.
Like playlist_items:10 works with string, so no need to add `^` before the number but playlistend works only with integer so you must add `^` before the number like example above.
You can add tuple and dict also. Use double quotes inside dict.
<b>Join: @Z_Mirror</b>
"""

convert_media = """
<b>Convert Media</b>: -ca -cv
/cmd link -ca mp3 -cv mp4 (convert all audios to mp3 and all videos to mp4)
/cmd link -ca mp3 (convert all audios to mp3)
/cmd link -cv mp4 (convert all videos to mp4)
/cmd link -ca mp3 + flac ogg (convert only flac and ogg audios to mp3)
/cmd link -cv mp4 - webm flv (convert all videos to mp4 except webm and flv)
<b>Join: @Z_Mirror</b>
"""

force_start = """
<b>Force Start</b>: -f -fd -fu
/cmd link -f (force download and upload)
/cmd link -fd (force download only)
/cmd link -fu (force upload directly after download finishes)
<b>Join: @Z_Mirror</b>
"""

gdrive = """
<b>Gdrive</b>: link
If DEFAULT_UPLOAD is `rc` then you can pass up: `gd` to upload using gdrive tools to GDRIVE_ID.
/cmd gdriveLink or gdl or gdriveId -up gdl or gdriveId or gd
/cmd tp:gdriveLink or tp:gdriveId -up tp:gdriveId or gdl or gd (to use token.pickle if service account enabled)
/cmd sa:gdriveLink or sa:gdriveId -p sa:gdriveId or gdl or gd (to use service account if service account disabled)
/cmd mtp:gdriveLink or mtp:gdriveId -up mtp:gdriveId or gdl or gd(if you have added upload gdriveId from usetting) (to use user token.pickle that uploaded by usetting)
<b>Join: @Z_Mirror</b>
"""

rclone_cl = """
<b>Rclone</b>: path
If DEFAULT_UPLOAD is `gd` then you can pass up: `rc` to upload to RCLONE_PATH.
/cmd rcl/rclone_path -up rcl/rclone_path/rc -rcf flagkey:flagvalue|flagkey|flagkey:flagvalue
/cmd rcl or rclonePath -up rclonePath or rc or rcl
/cmd mrcc:rclonePath -up rcl or rc(if you have added rclone path from usetting) (to use user config)
<b>Join: @Z_Mirror</b>
"""

name_sub = """
<b>Name Substitution</b>: -ns
/cmd link -ns tea : coffee : s|ACC : : s|mP4
This will affect all files. Format: wordToReplace : wordToReplaceWith : sensitiveCase
1. tea will get replaced by coffee with sensitive case because I have added `s` last of the option.
2. ACC will get removed because I have added nothing between to replace with sensitive case because I have added `s` last of the option.
3. mP4 will get removed because I have added nothing to replace with
<b>Join: @Z_Mirror</b>
"""

mixed_leech = """
<b>Mixed Leech</b>: -ml
/cmd link -ml (leech by user and bot session with respect to size)
<b>Join: @Z_Mirror</b>
/cmd link -ml (leech by user and bot session with respect to size)
"""

YT_HELP_DICT = {
Expand Down Expand Up @@ -385,15 +339,11 @@
3. You can add `or` and `|` as much as you want.
4. Take a look at the title if it has a static special character after or before the qualities or extensions or whatever and use them in the filter to avoid wrong match.
Timeout: 60 sec.
<b>Join: @Z_Mirror</b>
"""

PASSWORD_ERROR_MESSAGE = """
<b>This link requires a password!</b>
- Insert <b>::</b> after the link and write the password after the sign.
<b>Example:</b> link::my password
<b>Join: @Z_Mirror</b>
"""
Loading

0 comments on commit 09946e1

Please sign in to comment.