From acf7f2e08c38a0576b9b6433a5467753df0e87af Mon Sep 17 00:00:00 2001 From: anasty17 Date: Fri, 27 Dec 2024 20:10:50 +0200 Subject: [PATCH] Minor changes Signed-off-by: anasty17 --- README.md | 208 ++++++++++++++---- bot/core/startup.py | 3 +- bot/helper/common.py | 6 + bot/helper/ext_utils/bot_utils.py | 60 +++-- bot/helper/ext_utils/status_utils.py | 6 +- .../download_utils/telegram_download.py | 2 +- .../download_utils/yt_dlp_download.py | 6 +- .../mirror_leech_utils/gdrive_utils/helper.py | 2 +- .../rclone_utils/transfer.py | 2 +- .../status_utils/aria2_status.py | 4 +- .../status_utils/jdownloader_status.py | 2 +- .../status_utils/nzb_status.py | 2 +- .../status_utils/qbit_status.py | 2 +- bot/modules/chat_permission.py | 1 - bot/modules/force_start.py | 21 +- bot/modules/restart.py | 1 - 16 files changed, 236 insertions(+), 92 deletions(-) diff --git a/README.md b/README.md index b228cf31..5916ce78 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,21 @@ programming in Python. - **TELEGRAM CHANNEL:** https://t.me/mltb_official_channel - **TELEGRAM GROUP:** https://t.me/mltb_official_support -# Features +
+

Features

-## qBittorrent +
+
QBittorrent
- External access to webui, so you can remove files or edit settings. Then you can sync settings in database with sync button in bsetting - Select files from a Torrent before and during download using mltb file selector (Requires Base URL) (task option) - Seed torrents to a specific ratio and time (task option) - Edit Global Options while the bot is running from bot settings (global option) -## Aria2c +
+ +
+
Aria2c
- Select files from a Torrent before and during download (Requires Base URL) (task option) - Seed torrents to a specific ratio and time (task option) @@ -24,13 +29,19 @@ programming in Python. is provided) (task option) - Edit Global Options while the bot is running from bot settings (global option) -## Sabnzbd +
+ +
+
Sabnzbd
- External access to web interface, so you can remove files or edit settings. Then you can sync settings in database with sync button in bsetting - Edit Global Options while the bot is running from bot settings (global option) - Servers menu to edit/add/remove usenet servers -## TG Upload/Download +
+ +
+
TG Upload/Download
- Split size (global, user, and task option) - Thumbnail (user and task option) @@ -45,7 +56,10 @@ programming in Python. - Upload with custom layout multiple thubnmail (global, user option and task option) - Topics support -## Google Drive +
+ +
+
Google Drive
- Download/Upload/Clone/Delete/Count from/to Google Drive - Count Google Drive files/folders @@ -60,7 +74,10 @@ programming in Python. - Index link support only for [Bhadoo](https://gitlab.com/GoogleDriveIndex/Google-Drive-Index/-/blob/master/src/worker.js) -## Rclone +
+ +
+
Rclone
- Transfer (download/upload/clone-server-side) without or with random service accounts (global and user option) - Ability to choose config, remote and path from list with or without buttons (global, user and task option) @@ -70,7 +87,10 @@ programming in Python. - Rclone serve for combine remote to use it as index from all remotes (global option) - Upload destination (global, user and task option) -## Status +
+ +
+
Status
- Download/Upload/Extract/Archive/Seed/Clone Status - Status Pages for an unlimited number of tasks, view a specific number of tasks in a message (global option) @@ -81,7 +101,10 @@ programming in Python. - Steps buttons for how much next/previous buttons should step backward/forward (global and user option) - Status for each user (no auto refresh) -## Yt-dlp +
+ +
+
Yt-dlp
- Yt-dlp quality buttons (task option) - Ability to use a specific yt-dlp option (global, user, and task option) @@ -90,7 +113,10 @@ programming in Python. - Embed the original thumbnail and add it for leech - All supported audio formats -## JDownloader +
+ +
+
JDownloader
- Synchronize Settings (global option) - Waiting to select (enable/disable files or change variants) before download start @@ -98,7 +124,10 @@ programming in Python. - All settings can be edited from the remote access to your JDownloader with Web Interface, Android App, iPhone App or Browser Extensions -## Mongo Database +
+ +
+
Mongo Database
- Store bot settings - Store user settings including thumbnails and all private files @@ -108,12 +137,18 @@ programming in Python. - Store config.py file on first build and incase any change occured to it, then next build it will define variables from config.py instead of database -## Torrents Search +
+ +
+
Torrents Search
- Search on torrents with Torrent Search API - Search on torrents with variable plugins using qBittorrent search engine -## Archives +
+ +
+
Archives
- Extract splits with or without password - Zip file/folder with or without password @@ -123,7 +158,10 @@ programming in Python. > ZIP, RAR, TAR, 7z, ISO, WIM, CAB, GZIP, BZIP2, APM, ARJ, CHM, CPIO, CramFS, DEB, DMG, FAT, HFS, LZH, LZMA, LZMA2,MBR, > MSI, MSLZ, NSIS, NTFS, RPM, SquashFS, UDF, VHD, XAR, Z, TAR.XZ, CBZ -## RSS +
+ +
+
RSS
- Based on this repository [rss-chan](https://github.com/hyPnOtICDo0g/rss-chan) - Rss feed (user option) @@ -132,7 +170,10 @@ programming in Python. - Sudo settings to control users feeds - All functions have been improved using buttons from one command. -## Overall +
+ +
+
Overall
- Docker image support for linux `amd64, arm64/v8, arm/v7` - Edit variables and overwrite the private files while bot running (bot, user settings) @@ -170,11 +211,17 @@ programming in Python. > ytdl), > tmpsend.com, qiwi.gg, berkasdrive.com, mp4upload.com, terabox.com (videos only file/folders). -# How to deploy? +
+
-## Prerequisites +
+

How to deploy?

-### 1. Installing requirements +
+

Prerequisites

+ +
+
1. Installing requirements
- Clone this repo: @@ -204,7 +251,10 @@ pip3 install -r requirements-cli.txt ------ -### 2. Setting up config file +
+ +
+
2. Setting up config file
``` cp config_sample.py config.py @@ -227,8 +277,8 @@ Fill up rest of the fields. Meaning of each field is discussed below. session string use this command `python3 generate_string_session.py` after mounting repo folder for sure. `Str`. * *NOTE**: You can't use bot with private message. Use it with superGroup. - `DATABASE_URL`: Your Mongo Database URL (Connection string). Follow - this [Generate Database](https://github.com/anasty17/mirror-leech-telegram-bot/tree/master#generate-database) to - generate database. Data will be saved in Database: bot settings, users settings, rss data and incomplete tasks. **NOTE**: You can always edit all settings that saved in database from the official site -> (Browse collections). `Str` + this [Create Database](https://github.com/anasty17/test?tab=readme-ov-file#create-database) to + create database. Data will be saved in Database: bot settings, users settings, rss data and incomplete tasks. **NOTE**: You can always edit all settings that saved in database from the official site -> (Browse collections). `Str` - `DOWNLOAD_DIR`: The path to the vps local folder where the downloads should be downloaded to. `Str` - `CMD_SUFFIX`: Commands index number. This number will added at the end all commands. `Str`|`Int` - `AUTHORIZED_CHATS`: Fill user_id and chat_id of groups/users you want to authorize. To auth only specific topic(s) write it in this format `chat_id|thread_id` Ex:-100XXXXXXXXXXX or -100XXXXXXXXXXX|10 or Ex:-100XXXXXXXXXXX|10|12. Separate them by space. `Str` @@ -388,9 +438,13 @@ Fill up rest of the fields. Meaning of each field is discussed below. ------ -### 3. Build And Run the Docker Image +
+
-Make sure you still mount the app folder and installed the docker from official documentation. +
+

Build And Run the Docker Image

+ +Make sure you still mount the repo folder and installed the docker from official documentation. - There are two methods to build and run the docker: 1. Using official docker commands. @@ -398,7 +452,8 @@ Make sure you still mount the app folder and installed the docker from official ------ -#### Build And Run The Docker Image Using Official Docker Commands +
+

Build And Run The Docker Image Using Official Docker Commands

- Start Docker daemon (SKIP if already running, mostly you don't need to do this): @@ -430,7 +485,10 @@ sudo docker stop id ---- -#### Build And Run The Docker Image Using docker-compose +
+ +
+

Build And Run The Docker Image Using docker-compose

**NOTE**: If you want to use ports other than 80 and 8080 for torrent file selection and rclone serve respectively, change it in [docker-compose.yml](https://github.com/anasty17/mirror-leech-telegram-bot/blob/master/docker-compose.yml) @@ -484,9 +542,15 @@ sudo docker compose logs --follow ------ -# Extras +
+
+
-## Bot commands to be set in [@BotFather](https://t.me/BotFather) +
+

Extras

+ +
+
Bot commands to be set in @BotFather
``` mirror - or /m Mirror @@ -525,7 +589,10 @@ help - All cmds with description ------ -## Getting Google OAuth API credential file and token.pickle +
+ +
+
Getting Google OAuth API credential file and token.pickle
**NOTES** @@ -554,7 +621,10 @@ python3 generate_drive_token.py ------ -## Getting rclone.conf +
+ +
+
Generating rclone.conf
1. Install rclone from [Official Site](https://rclone.org/install/) 2. Create new remote(s) using `rclone config` command. @@ -562,7 +632,10 @@ python3 generate_drive_token.py ------ -## Upload +
+ +
+
Upload
- `RCLONE_PATH` is like `GDRIVE_ID` a default path for mirror. In additional to those variables `DEFAULT_UPLOAD` to choose the default tool whether it's rclone or google-api-python-client. @@ -579,7 +652,10 @@ python3 generate_drive_token.py ------ -## UPSTREAM REPO (Recommended) +
+ +
+
UPSTREAM REPO (Recommended)
- `UPSTREAM_REPO` variable can be used for edit/add any file in repository. - You can add private/public repository link to grab/overwrite all files from it. @@ -598,29 +674,40 @@ python3 generate_drive_token.py ------ -## Bittorrent Seed +
+ +
+
Bittorrent Seed
- Using `-d` argument alone will lead to use global options for aria2c or qbittorrent. -### Qbittorrent +
+

QBittorrent

- Global options: `GlobalMaxRatio` and `GlobalMaxSeedingMinutes` in qbittorrent.conf, `-1` means no limit, but you can cancel manually. - **NOTE**: Don't change `MaxRatioAction`. -### Aria2c +
+ +
+

Aria2c

- Global options: `--seed-ratio` (0 means no limit) and `--seed-time` (0 means no seed) in aria.sh. ------ -## Using Service Accounts for uploading to avoid user rate limit +
+
+ +
+
Using Service Accounts for uploading to avoid user rate limit
> For Service Account to work, you must set `USE_SERVICE_ACCOUNTS` = "True" in config file or environment variables. > **NOTE**: Using Service Accounts is only recommended while uploading to a Team Drive. -### 1. Generate Service Accounts. [What is Service Account?](https://cloud.google.com/iam/docs/service-accounts) - +
+

1. Generate Service Accounts. What is Service Account?

Let us create only the Service Accounts that we need. **Warning**: Abuse of this feature is not the aim of this project and we do **NOT** recommend that you make a lot of @@ -644,7 +731,8 @@ python3 gen_sa_accounts.py --download-keys $PROJECTID Choose one of these methods -##### 1. Create Service Accounts in existed Project (Recommended Method) +
+
1. Create Service Accounts in existed Project (Recommended Method)
- List your projects ids @@ -670,7 +758,10 @@ python3 gen_sa_accounts.py --create-sas $PROJECTID python3 gen_sa_accounts.py --download-keys $PROJECTID ``` -##### 2. Create Service Accounts in New Project +
+ +
+
2. Create Service Accounts in New Project
``` python3 gen_sa_accounts.py --quick-setup 1 --new-only @@ -678,13 +769,18 @@ python3 gen_sa_accounts.py --quick-setup 1 --new-only A folder named accounts will be created which will contain keys for the Service Accounts. -### 2. Add Service Accounts +
+
+ +
+

2. Add Service Accounts

#### Two methods to add service accounts Choose one of these methods -##### 1. Add Them To Google Group then to Team Drive (Recommended) +
+
1. Add Them To Google Group then to Team Drive (Recommended)
- Mount accounts folder @@ -714,7 +810,10 @@ cd .. Then add emails from emails.txt to Google Group, after that add this Google Group to your Shared Drive and promote it to manager and delete email.txt file from accounts folder -##### 2. Add Them To Team Drive Directly +
+ +
+
2. Add Them To Team Drive Directly
- Run: @@ -724,7 +823,12 @@ python3 add_to_team_drive.py -d SharedTeamDriveSrcID ------ -## Generate Database +
+
+
+ +
+
Create Database
1. Go to `https://mongodb.com/` and sign-up. 2. Create Shared Cluster. @@ -737,7 +841,10 @@ python3 add_to_team_drive.py -d SharedTeamDriveSrcID ------ -## Multi Drive List +
+ +
+
Multi Drive List
To use list from multi TD/folder. Run driveid.py in your terminal and follow it. It will generate **list_drives.txt** file or u can simply create `list_drives.txt` file in working directory and fill it, check below format: @@ -756,7 +863,10 @@ TD2 0AO1JDB1t3i5jUk9PVA https://example.dev ----- -## Yt-dlp and Aria2c Authentication Using .netrc File +
+ +
+
Yt-dlp and Aria2c Authentication Using .netrc File
For using your premium accounts in yt-dlp or for protected Index Links, create .netrc file according to following format: @@ -784,15 +894,17 @@ Authentication using [cookies.txt](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how ----- -> +
+
-## All Thanks To Our Contributors + +# All Thanks To Our Contributors -## Donations +# Donations

If you feel like showing your appreciation for this project, then how about buying me a coffee.

diff --git a/bot/core/startup.py b/bot/core/startup.py index c0af1cc2..cb2d720b 100644 --- a/bot/core/startup.py +++ b/bot/core/startup.py @@ -164,7 +164,8 @@ async def save_settings(): async def update_variables(): if ( Config.LEECH_SPLIT_SIZE > TgClient.MAX_SPLIT_SIZE - or Config.LEECH_SPLIT_SIZE == 2097152000 or not Config.LEECH_SPLIT_SIZE + or Config.LEECH_SPLIT_SIZE == 2097152000 + or not Config.LEECH_SPLIT_SIZE ): Config.LEECH_SPLIT_SIZE = TgClient.MAX_SPLIT_SIZE diff --git a/bot/helper/common.py b/bot/helper/common.py index f83c3f05..4ce3b5a8 100644 --- a/bot/helper/common.py +++ b/bot/helper/common.py @@ -1186,6 +1186,9 @@ class TaskConfig: res = await run_ffmpeg_cmd(self, cmd, file_path) if res and delete_files: await remove(file_path) + if "ffmpeg." in res: + newres = res.replace("ffmpeg.", "") + await move(res, newres) else: for dirpath, _, files in await sync_to_async( walk, dl_path, topdown=False @@ -1214,6 +1217,9 @@ class TaskConfig: res = await run_ffmpeg_cmd(self, cmd, f_path) if res and delete_files: await remove(f_path) + if "ffmpeg." in res: + newres = res.replace("ffmpeg.", "") + await move(res, newres) if checked: cpu_eater_lock.release() return dl_path diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py index a529905f..47a9103e 100644 --- a/bot/helper/ext_utils/bot_utils.py +++ b/bot/helper/ext_utils/bot_utils.py @@ -87,8 +87,14 @@ async def get_telegraph_list(telegraph_content): def arg_parser(items, arg_base): + if not items: return + + arg_start = -1 + i = 0 + total = len(items) + bool_arg_set = { "-b", "-e", @@ -106,43 +112,53 @@ def arg_parser(items, arg_base): "-doc", "-med", } - t = len(items) - i = 0 - arg_start = -1 - while i + 1 <= t: + def process_argument_with_values(start_index): + values = [] + for j in range(start_index + 1, total): + if items[j] in arg_base: + break + values.append(items[j]) + return values + + def process_nested_list(start_index): + values = [] + end_index = start_index + 1 + while end_index < total and items[end_index] != "]": + values.append(items[end_index]) + end_index += 1 + return values, end_index - start_index + + while i < total: part = items[i] + if part in arg_base: if arg_start == -1: arg_start = i + if ( - i + 1 == t + i + 1 == total and part in bool_arg_set or part in ["-s", "-j", "-f", "-fd", "-fu", "-sync", "-ml", "-doc", "-med"] ): arg_base[part] = True + elif part == "-ff" and i + 1 < total and items[i + 1].startswith("["): + nested_values, skip_count = process_nested_list(i + 1) + arg_base[part] = nested_values + i += skip_count else: - sub_list = [] - 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: - arg_base[part] = True - break - sub_list.append(item) - i += 1 + sub_list = process_argument_with_values(i) if sub_list: arg_base[part] = " ".join(sub_list) + i += len(sub_list) + i += 1 - if "link" in arg_base and items[0] not in arg_base: - link = [] - if arg_start == -1: - link.extend(iter(items)) - else: - link.extend(items[r] for r in range(arg_start)) - if link: - arg_base["link"] = " ".join(link) + + if "link" in arg_base: + link_items = items[:arg_start] if arg_start != -1 else items + if link_items: + arg_base["link"] = " ".join(link_items) def get_size_bytes(size): diff --git a/bot/helper/ext_utils/status_utils.py b/bot/helper/ext_utils/status_utils.py index c82a1f0c..fb0e6dae 100644 --- a/bot/helper/ext_utils/status_utils.py +++ b/bot/helper/ext_utils/status_utils.py @@ -42,13 +42,13 @@ STATUSES = { "AR": MirrorStatus.STATUS_ARCHIVE, "EX": MirrorStatus.STATUS_EXTRACT, "SD": MirrorStatus.STATUS_SEED, + "CL": MirrorStatus.STATUS_CLONE, "CM": MirrorStatus.STATUS_CONVERT, "SP": MirrorStatus.STATUS_SPLIT, - "CK": MirrorStatus.STATUS_CHECK, "SV": MirrorStatus.STATUS_SAMVID, "FF": MirrorStatus.STATUS_FFMPEG, - "CL": MirrorStatus.STATUS_CLONE, "PA": MirrorStatus.STATUS_PAUSED, + "CK": MirrorStatus.STATUS_CHECK, } @@ -235,7 +235,7 @@ async def get_readable_message(sid, is_user, page_no=1, status="All", page_step= for i in [1, 2, 4, 6, 8, 10, 15]: buttons.data_button(i, f"status {sid} ps {i}", position="footer") if status != "All" or tasks_no > 20: - for label, status_value in list(STATUSES.items())[:9]: + for label, status_value in list(STATUSES.items()): if status_value != status: buttons.data_button(label, f"status {sid} st {status_value}") buttons.data_button("♻️", f"status {sid} ref", position="header") diff --git a/bot/helper/mirror_leech_utils/download_utils/telegram_download.py b/bot/helper/mirror_leech_utils/download_utils/telegram_download.py index fd7ea0e5..7460c36d 100644 --- a/bot/helper/mirror_leech_utils/download_utils/telegram_download.py +++ b/bot/helper/mirror_leech_utils/download_utils/telegram_download.py @@ -165,4 +165,4 @@ class TelegramDownloadHelper: LOGGER.info( f"Cancelling download on user request: name: {self._listener.name} id: {self._id}" ) - await self._on_download_error("Cancelled by user!") + await self._on_download_error("Stopped by user!") diff --git a/bot/helper/mirror_leech_utils/download_utils/yt_dlp_download.py b/bot/helper/mirror_leech_utils/download_utils/yt_dlp_download.py index c5fe884e..2dd617be 100644 --- a/bot/helper/mirror_leech_utils/download_utils/yt_dlp_download.py +++ b/bot/helper/mirror_leech_utils/download_utils/yt_dlp_download.py @@ -182,8 +182,8 @@ class YoutubeDLHelper: if self._listener.is_cancelled: return async_to_sync(self._listener.on_download_complete) - except ValueError: - self._on_download_error("Download Stopped by User!") + except: + pass async def add_download(self, path, qual, playlist, options): if playlist: @@ -334,7 +334,7 @@ class YoutubeDLHelper: async def cancel_task(self): self._listener.is_cancelled = True LOGGER.info(f"Cancelling Download: {self._listener.name}") - await self._listener.on_download_error("Download Cancelled by User!") + await self._listener.on_download_error("Stopped by User!") def _set_options(self, options): options = options.split("|") diff --git a/bot/helper/mirror_leech_utils/gdrive_utils/helper.py b/bot/helper/mirror_leech_utils/gdrive_utils/helper.py index 9fa47c74..bc8eb528 100644 --- a/bot/helper/mirror_leech_utils/gdrive_utils/helper.py +++ b/bot/helper/mirror_leech_utils/gdrive_utils/helper.py @@ -243,7 +243,7 @@ class GoogleDriveHelper: self.listener.is_cancelled = True if self.is_downloading: LOGGER.info(f"Cancelling Download: {self.listener.name}") - await self.listener.on_download_error("Download stopped by user!") + await self.listener.on_download_error("Stopped by user!") elif self.is_cloning: LOGGER.info(f"Cancelling Clone: {self.listener.name}") await self.listener.on_upload_error( diff --git a/bot/helper/mirror_leech_utils/rclone_utils/transfer.py b/bot/helper/mirror_leech_utils/rclone_utils/transfer.py index dd21bc50..cf57edbc 100644 --- a/bot/helper/mirror_leech_utils/rclone_utils/transfer.py +++ b/bot/helper/mirror_leech_utils/rclone_utils/transfer.py @@ -534,7 +534,7 @@ class RcloneTransferHelper: pass if self._is_download: LOGGER.info(f"Cancelling Download: {self._listener.name}") - await self._listener.on_download_error("Download stopped by user!") + await self._listener.on_download_error("Stopped by user!") elif self._is_upload: LOGGER.info(f"Cancelling Upload: {self._listener.name}") await self._listener.on_upload_error("your upload has been stopped!") diff --git a/bot/helper/mirror_leech_utils/status_utils/aria2_status.py b/bot/helper/mirror_leech_utils/status_utils/aria2_status.py index b23e63b3..627bdf79 100644 --- a/bot/helper/mirror_leech_utils/status_utils/aria2_status.py +++ b/bot/helper/mirror_leech_utils/status_utils/aria2_status.py @@ -99,7 +99,7 @@ class Aria2Status: await sync_to_async(aria2.remove, [self._download], force=True, files=True) elif downloads := self._download.followed_by: LOGGER.info(f"Cancelling Download: {self.name()}") - await self.listener.on_download_error("Download cancelled by user!") + await self.listener.on_download_error("Cancelled by user!") downloads.append(self._download) await sync_to_async(aria2.remove, downloads, force=True, files=True) else: @@ -108,6 +108,6 @@ class Aria2Status: msg = "task have been removed from queue/download" else: LOGGER.info(f"Cancelling Download: {self.name()}") - msg = "Download stopped by user!" + msg = "Stopped by user!" await self.listener.on_download_error(msg) await sync_to_async(aria2.remove, [self._download], force=True, files=True) diff --git a/bot/helper/mirror_leech_utils/status_utils/jdownloader_status.py b/bot/helper/mirror_leech_utils/status_utils/jdownloader_status.py index eb97daa3..a15f5b54 100644 --- a/bot/helper/mirror_leech_utils/status_utils/jdownloader_status.py +++ b/bot/helper/mirror_leech_utils/status_utils/jdownloader_status.py @@ -111,4 +111,4 @@ class JDownloaderStatus: ) async with jd_lock: del jd_downloads[self._gid] - await self.listener.on_download_error("Download cancelled by user!") + await self.listener.on_download_error("Cancelled by user!") diff --git a/bot/helper/mirror_leech_utils/status_utils/nzb_status.py b/bot/helper/mirror_leech_utils/status_utils/nzb_status.py index 3da95464..2af8eb33 100644 --- a/bot/helper/mirror_leech_utils/status_utils/nzb_status.py +++ b/bot/helper/mirror_leech_utils/status_utils/nzb_status.py @@ -88,7 +88,7 @@ class SabnzbdStatus: await self.update() LOGGER.info(f"Cancelling Download: {self.name()}") await gather( - self.listener.on_download_error("Download stopped by user!"), + self.listener.on_download_error("Stopped by user!"), sabnzbd_client.delete_job(self._gid, delete_files=True), sabnzbd_client.delete_category(f"{self.listener.mid}"), ) diff --git a/bot/helper/mirror_leech_utils/status_utils/qbit_status.py b/bot/helper/mirror_leech_utils/status_utils/qbit_status.py index 97642e6b..963b70f0 100644 --- a/bot/helper/mirror_leech_utils/status_utils/qbit_status.py +++ b/bot/helper/mirror_leech_utils/status_utils/qbit_status.py @@ -104,7 +104,7 @@ class QbittorrentStatus: msg = "task have been removed from queue/download" else: LOGGER.info(f"Cancelling Download: {self._info.name}") - msg = "Download stopped by user!" + msg = "Stopped by user!" await sleep(0.3) await gather( self.listener.on_download_error(msg), diff --git a/bot/modules/chat_permission.py b/bot/modules/chat_permission.py index 0fefd787..fce91c81 100644 --- a/bot/modules/chat_permission.py +++ b/bot/modules/chat_permission.py @@ -1,5 +1,4 @@ from .. import user_data -from ..core.config_manager import Config from ..helper.ext_utils.bot_utils import update_user_ldata, new_task from ..helper.ext_utils.db_handler import database from ..helper.telegram_helper.message_utils import send_message diff --git a/bot/modules/force_start.py b/bot/modules/force_start.py index e2293c04..b9f23d9f 100644 --- a/bot/modules/force_start.py +++ b/bot/modules/force_start.py @@ -10,7 +10,6 @@ from ..core.config_manager import Config from ..helper.ext_utils.bot_utils import new_task from ..helper.ext_utils.status_utils import get_task_by_gid from ..helper.telegram_helper.bot_commands import BotCommands -from ..helper.telegram_helper.filters import CustomFilters from ..helper.telegram_helper.message_utils import send_message from ..helper.ext_utils.task_manager import start_dl_from_queued, start_up_from_queued @@ -33,10 +32,16 @@ async def remove_from_queue(_, message): await send_message(message, "This is not an active task!") return elif len(msg) in {1, 2}: - msg = ( - "Reply to an active Command message which was used to start the download" - f" or send /{BotCommands.ForceStartCommand[0]} GID to force start download and upload! Add you can use /cmd fd to force downlaod only or /cmd fu to force upload only!" - ) + msg = f"""Reply to an active Command message which was used to start the download/upload. +/{BotCommands.ForceStartCommand[0]} fd (to remove it from download queue) or fu (to remove it from upload queue) or nothing to start remove it from both download and upload queue. +Also send /{BotCommands.ForceStartCommand[0]} GID fu|fd or obly gid to force start by removeing the task rom queue! +Examples: +/{BotCommands.ForceStartCommand[1]} GID fu (force upload) +/{BotCommands.ForceStartCommand[1]} GID (force download and upload) +By reply to task cmd: +/{BotCommands.ForceStartCommand[1]} (force download and upload) +/{BotCommands.ForceStartCommand[1]} fd (force download) +""" await send_message(message, msg) return if ( @@ -54,11 +59,15 @@ async def remove_from_queue(_, message): if listener.mid in queued_up: await start_up_from_queued(listener.mid) msg = "Task have been force started to upload!" + else: + msg = "Force upload enabled for this task!" elif status == "fd": listener.force_download = True if listener.mid in queued_dl: await start_dl_from_queued(listener.mid) msg = "Task have been force started to download only!" + else: + msg = "This task not in download queue!" else: listener.force_download = True listener.force_upload = True @@ -68,5 +77,7 @@ async def remove_from_queue(_, message): elif listener.mid in queued_dl: await start_dl_from_queued(listener.mid) msg = "Task have been force started to download and upload will start once download finish!" + else: + msg = "This task not in queue!" if msg: await send_message(message, msg) diff --git a/bot/modules/restart.py b/bot/modules/restart.py index 6549cf58..f7347e6b 100644 --- a/bot/modules/restart.py +++ b/bot/modules/restart.py @@ -9,7 +9,6 @@ from ..helper.ext_utils.bot_utils import new_task, sync_to_async from ..helper.telegram_helper.message_utils import ( send_message, delete_message, - edit_message, ) from ..helper.ext_utils.db_handler import database from ..helper.ext_utils.files_utils import clean_all