Skip to content

Commit

Permalink
Minor Fix & Adjustments
Browse files Browse the repository at this point in the history
> Added Vars in Config Sample
>  Updated Docs
> Fix DISABLE_DRIVE_LINK, leechlogmsg
> Fix Parse on replied URL

Co-authored-by: SilentDemonSD <[email protected]>
  • Loading branch information
mr-m85 and SilentDemonSD authored Jul 13, 2023
1 parent 3e021cd commit 140935f
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 15 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ help - All cmds with description
- `FSUB_IDS`: Fill chat_id(-100xxxxxx) of groups/channel you want to force subscribe. Separate them by space. Int
- Note: Bot should be added in the filled chat_id as admin
- `BOT_PM`: File/links send to the BOT PM. Default is `False`. `Bool`
- `BOT_MAX_TASKS`: Limit the Maximum task for bots of group at a time. `Int`
</details></li>
<li><details>
<summary><b>GDrive Tools</b></summary>
Expand Down Expand Up @@ -479,7 +480,7 @@ help - All cmds with description

</details></li>
<li><details>
<summary><b>Telegram Leech</b></summary>
<summary><b>Telegram Leech & Mirror</b></summary>

- `LEECH_SPLIT_SIZE`: Size of split in bytes. Default is `2GB`. Default is `4GB` if your account is premium. `Int`
- `AS_DOCUMENT`: Default type of Telegram file upload. Default is `False` mean as media. `Bool`
Expand All @@ -489,14 +490,18 @@ help - All cmds with description
- `LEECH_FILENAME_SUFFIX`: Add custom suffix to leeched file name. `Str`
- `LEECH_FILENAME_CAPTION`: Add custom caption to leeched file. `Str`
- `LEECH_FILENAME_REMNAME`: Remove custom word from leeched file name. `Str`
- `MIRROR_FILENAME_PREFIX`: Add custom prefix to mirrored file name. `Str`
- `MIRROR_FILENAME_SUFFIX`: Add custom suffix to mirrored file name. `Str`
- `MIRROR_FILENAME_REMNAME`: Remove custom word from mirrored file name. `Str`

</details></li>
<li><details>
<summary><b>Log Channel</b></summary>

- `LEECH_LOG_ID`: Chat ID to where leeched files would be uploaded. `Int`. **NOTE**: Only available for superGroup/channel. Add `-100` before channel/superGroup id. In short don't add bot id or your id!
- `MIRROR_LOG_ID`: Chat ID to where Mirror files would be Send. `Int`. **NOTE**: Only available for superGroup/channel. Add `-100` before channel/superGroup id. In short don't add bot id or your id!.
- **Note**: For Multiple id Separate them by space.
- `MIRROR_LOG_ID`: Chat ID to where Mirror files would be Send. `Int`. **NOTE**: Only available for superGroup/channel. Add `-100` before channel/superGroup id. In short don't add bot id or your id!.
- `LINKS_LOG_ID`: Chat ID to where Link logs would be Send. `Int`. **NOTE**: Only available for superGroup/channel. Add `-100` before channel/superGroup id. In short don't add bot id or your id!.
- **Note**: LEECH_LOG_ID & MIRROR_LOG_ID it's multiple, For multiple id Separate them by space.
</details></li>
<li><details>
<summary><b>qBittorrent/Aria2c</b></summary>
Expand Down Expand Up @@ -567,6 +572,11 @@ help - All cmds with description
<li><details>
<summary><b>Extra</b></summary>
- `SAFE_MODE`: Remove all file names. Not from BOT_PM & LINK_LOGS. Default is `False`. `Bool`
- `DELETE_LINKS`: Delete links after used. Default is `False`. `Bool`
- `CLEAN_LOG_MSG`: Clean log msg. Default is `False`. `Bool`
- `SHOW_EXTRA_CMDS`: Add old cmds like zipleech... Default is `False`. `Bool`
- `SOURCE_LINK`: Source button of files and links. Default is `False`. `Bool`
- `IMAGES`: Add multiple telgraph(graph.org) image links that are seperated by spaces.
- `IMG_SEARCH`: Put Keyword to Download Images. Sperarte each name by , like `anime`, `iron man`, `god of war`
- `IMG_PAGE`: Set the page value for downloading a image. Each page have approx 70 images. Deafult is `1`. `Int`
Expand Down
22 changes: 13 additions & 9 deletions bot/helper/listeners/tasks_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,15 @@ def __setModeEng(self):
def __parseSource(self):
if self.source_url == self.message.link:
file = self.message.reply_to_message
media = getattr(file, file.media.value)
self.source_msg = f'┎ <b>Name:</b> <i>{media.file_name}</i>\n' \
f'┠ <b>Type:</b> {media.mime_type}\n' \
f'┠ <b>Size:</b> {get_readable_file_size(media.file_size)}\n' \
f'┠ <b>Created Date:</b> {media.date}\n' \
f'┖ <b>Media Type:</b> {(file.media.value).capitalize()}'
if file is not None and file.media is not None:
media = getattr(file, file.media.value)
self.source_msg = f'┎ <b>Name:</b> <i>{media.file_name}</i>\n' \
f'┠ <b>Type:</b> {media.mime_type}\n' \
f'┠ <b>Size:</b> {get_readable_file_size(media.file_size)}\n' \
f'┠ <b>Created Date:</b> {media.date}\n' \
f'┖ <b>Media Type:</b> {(file.media.value).capitalize()}'
else:
self.source_msg = f"<code>{self.message.reply_to_message.text}</code>"
elif self.source_url.startswith('https://t.me/share/url?url='):
msg = self.source_url.replace('https://t.me/share/url?url=', '')
if msg.startswith('magnet'):
Expand All @@ -111,10 +114,11 @@ def __parseSource(self):
elif check.startswith('magnet:?xt=urn:btih:'):
hashh = check.replace('magnet:?xt=urn:btih:', '')
else:
name += ('&' if amper else '') + check.replace("dn=", "")
name += ('&' if amper else '') + check.replace('dn=', '').replace('+', '')
amper = True
self.source_msg = f"┎ <b>Name:</b> <i>{name}</i>\n┠ <b>Magnet Hash:</b> <code>{hashh}</code>\n┠ <b>Total Trackers:</b> {tracCount} \n┖ <b>Share:</b> <a href='https://t.me/share/url?url={quote(msg)}'>Share To Telegram</a>"
else: self.source_msg = f"<code>{msg}</code>"
else:
self.source_msg = f"<code>{msg}</code>"
else:
self.source_msg = f"<code>{self.source_url}</code>"

Expand Down Expand Up @@ -483,7 +487,7 @@ async def onUploadComplete(self, link, size, files, folders, mime_type, name, rc
if is_DDL:
buttons.ubutton(BotTheme('DDL_LINK', Serv='GoFile'), link)
elif link:
if not config_dict['DISABLE_DRIVE_LINK'] and user_id == OWNER_ID:
if not config_dict['DISABLE_DRIVE_LINK'] and user_id != OWNER_ID:
buttons.ubutton(BotTheme('CLOUD_LINK'), link)
else:
msg += BotTheme('RCPATH', RCpath=rclonePath)
Expand Down
2 changes: 1 addition & 1 deletion bot/helper/mirror_utils/upload_utils/pyrogramEngine.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ async def upload(self, o_files, m_size, size):
self.__last_uploaded = 0
await self.__switching_client()
await self.__upload_file(cap_mono, file_)
if not isDeleted and config_dict['CLEAN_LOG_MSG']:
if self.__leechmsg and not isDeleted and config_dict['CLEAN_LOG_MSG']:
await list(self.__leechmsg.values())[0].delete()
isDeleted = True
if self.__is_cancelled:
Expand Down
4 changes: 3 additions & 1 deletion bot/helper/telegram_helper/message_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ async def editMessage(message, text, buttons=None, photo=None):
return await editMessage(message, text, buttons, photo)
except (MessageNotModified, MessageEmpty):
pass
except ReplyMarkupInvalid:
return await editMessage(message, text, None, photo)
except Exception as e:
LOGGER.error(str(e))
return str(e)
Expand Down Expand Up @@ -328,4 +330,4 @@ async def BotPm_check(message, button=None):
button = ButtonMaker()
_msg = "<i>You didn't START the bot in PM (Private)</i>"
button.ubutton("Start Bot Now", f"https://t.me/{bot_name}?start=start", 'header')
return _msg, button
return _msg, button
11 changes: 10 additions & 1 deletion config_sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ USE_SERVICE_ACCOUNTS = "False"
SET_COMMANDS = "False"
FSUB_IDS = ""
BOT_PM = ""
BOT_MAX_TASKS = ""

# GDrive Tools
GDRIVE_ID = ""
Expand All @@ -46,7 +47,7 @@ RCLONE_SERVE_PASS = ""
UPSTREAM_REPO = ""
UPSTREAM_BRANCH = ""

# Leech
# Leech & Mirror
LEECH_SPLIT_SIZE = ""
AS_DOCUMENT = "False"
EQUAL_SPLITS = "False"
Expand All @@ -56,10 +57,14 @@ LEECH_FILENAME_PREFIX = ""
LEECH_FILENAME_SUFFIX = ""
LEECH_FILENAME_CAPTION = ""
LEECH_FILENAME_REMNAME = ""
MIRROR_FILENAME_PREFIX = ""
MIRROR_FILENAME_SUFFIX = ""
MIRROR_FILENAME_REMNAME = ""

# Log Channel (Single ID)
LEECH_LOG_ID = ""
MIRROR_LOG_ID = ""
LINKS_LOG_ID = ""

# qBittorrent/Aria2c
TORRENT_TIMEOUT = ""
Expand Down Expand Up @@ -107,6 +112,10 @@ AUTHOR_URL = "https://t.me/WZML_X"

# Extra
SAFE_MODE = ""
DELETE_LINKS = ""
CLEAN_LOG_MSG = ""
SHOW_EXTRA_CMDS = ""
SOURCE_LINK = ""
TIMEZONE = "Asia/Kolkata"
IMAGES = ""
IMG_SEARCH = ""
Expand Down

0 comments on commit 140935f

Please sign in to comment.