-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from ch3p4ll3/v2
V2
- Loading branch information
Showing
68 changed files
with
2,776 additions
and
680 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"files": [ | ||
"README.md" | ||
], | ||
"imageSize": 100, | ||
"commit": false, | ||
"commitType": "docs", | ||
"commitConvention": "angular", | ||
"contributors": [ | ||
{ | ||
"login": "bushig", | ||
"name": "Bogdan", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/2815779?v=4", | ||
"profile": "https://github.com/bushig", | ||
"contributions": [ | ||
"code" | ||
] | ||
} | ||
], | ||
"contributorsPerLine": 7, | ||
"skipCi": true, | ||
"repoType": "github", | ||
"repoHost": "https://github.com", | ||
"projectName": "QBittorrentBot", | ||
"projectOwner": "ch3p4ll3" | ||
} | ||
"projectName": "QBittorrentBot", | ||
"projectOwner": "ch3p4ll3" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Publish Retype powered website to GitHub Pages | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
publish: | ||
name: Publish to retype branch | ||
|
||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: retypeapp/action-build@latest | ||
with: | ||
config: docs/retype.yml | ||
|
||
- uses: retypeapp/action-github-pages@latest | ||
with: | ||
update-branch: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,4 +165,5 @@ config.json | |
*.session | ||
*.session-journal | ||
|
||
*.sqlite | ||
*.sqlite | ||
/docker_folder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
order: -10 | ||
--- | ||
# Add new entries in configuration file | ||
|
||
Adding a new entry to the QBittorrentBot configuration file involves several steps: | ||
|
||
- **Clone the repository**: `git clone https://github.com/ch3p4ll3/QBittorrentBot.git` | ||
|
||
- **Navigate to the folder**: `src/configs` | ||
|
||
- **Modify the pydantic class**: | ||
Identify the pydantic class where the new entry should be added. | ||
Add a new attribute to the class to represent the new entry. | ||
|
||
- **Create a validation function (if necessary)**: | ||
If the new entry requires additional validation beyond the type provided by pydantic, create a validation function. | ||
The validation function should inspect the value of the new entry and check for any constraints or rules that need to be enforced. | ||
|
||
- **Add the new entry to the config file**: | ||
Open the configuration file (usually `config.json`). | ||
Add a new property to the configuration object for the new entry. | ||
Set the value of the new property to the desired initial value. | ||
|
||
- **Update the convert_type_from_string function (if necessary)**: | ||
If the new entry type requires a custom conversion from a string representation, add the conversion function to the `utils` file. | ||
The function should take a string representation of the new entry type and return the corresponding data type. | ||
|
||
- **Update the bot code (if necessary)**: | ||
If the new entry is being used by the bot code, update the relevant parts of the code to handle the new entry type and its values. | ||
|
||
- Build the docker image | ||
- Start the docker container | ||
|
||
You can now use the bot with the new entry, have fun🥳 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- | ||
order: 0 | ||
--- | ||
# Add new client manager | ||
|
||
Adding a new client manager to QBittorrentBot involves creating a new class that implements the `ClientManager` interface. This interface defines the methods that the bot uses to interact with the client, such as adding, removing, pausing, and resuming torrents. | ||
|
||
To do this you need to follow a couple of steps: | ||
|
||
- Clone the repository locally using the command: `git clone https://github.com/ch3p4ll3/QBittorrentBot.git` | ||
- Navigate to the folder `src/client_manager` | ||
- Create a new file for your client manager class. Name the file something like `<client>_manager.py`. For example, if you are writing a manager for utorrent the name will be `utorrent_manager.py` | ||
- Define your client manager class. The class should inherit from the `ClientManager` class and implement all of its methods. For example, the `utorrent_manager.py` file might look like this: | ||
```python | ||
from typing import Union, List | ||
from .client_manager import ClientManager | ||
|
||
|
||
class UtorrentManager(ClientManager): | ||
@classmethod | ||
def add_magnet(cls, magnet_link: Union[str, List[str]], category: str = None) -> None: | ||
# Implement your code to add a magnet to the utorrent client | ||
pass | ||
|
||
@classmethod | ||
def add_torrent(cls, file_name: str, category: str = None) -> None: | ||
# Implement your code to add a torrent to the utorrent client | ||
pass | ||
... | ||
``` | ||
- Navigate to the `src/configs/` folder and edit the `enums.py` file by adding to the `ClientTypeEnum` class an enum for your client. For example, if we wanted to add a manager for utorrent the class would become like this: | ||
```python | ||
class ClientTypeEnum(str, Enum): | ||
QBittorrent = 'qbittorrent' | ||
Utorrent = 'utorrent' | ||
``` | ||
- Return to the `src/client_manager` folder and edit the `client_repo.py` file by adding to the dictionary named `repositories` an entry associating the newly created enum with the new manager. Example: | ||
```python | ||
from ..configs.enums import ClientTypeEnum | ||
from .qbittorrent_manager import QbittorrentManager, ClientManager | ||
|
||
|
||
class ClientRepo: | ||
repositories = { | ||
ClientTypeEnum.QBittorrent: QbittorrentManager, | ||
ClientTypeEnum.Utorrent: UtorrentManager | ||
} | ||
... | ||
``` | ||
- Register your client manager in the config file. The config file is a JSON file that defines the configuration for the QBittorrentBot. You can add your new client manager to the client section of the config file. For example, the config file might look like this: | ||
```json | ||
{ | ||
"client": { | ||
"type": "utorrent", | ||
"host": "192.168.178.102", | ||
"port": 8080, | ||
"user": "admin", | ||
"password": "admin" | ||
}, | ||
"telegram": { | ||
"bot_token": "1111111:AAAAAAAA-BBBBBBBBB", | ||
"api_id": 1111, | ||
"api_hash": "aaaaaaaa" | ||
}, | ||
|
||
"users": [ | ||
{ | ||
"user_id": 123456, | ||
"notify": false, | ||
"role": "administrator" | ||
} | ||
] | ||
} | ||
``` | ||
- Build the docker image | ||
- Start the docker container | ||
|
||
You can now use the bot with the new client, have fun:partying_face: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Advanced | ||
|
||
This section will speigate the advanced functions of the bot, such as creating new client managers, and managing user roles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
order: -10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
order: -20 | ||
--- | ||
# Managing users roles | ||
|
||
QBittorrentBot provides a user role management system to control access to different actions and functionalities within the bot. The system defines three roles: Reader, Manager, and Admin, each with increasing permissions and capabilities. | ||
|
||
## Reader | ||
|
||
The Reader role grants basic access to view the list of active torrents and inspect the details of individual torrents. Users with the Reader role can view the torrent name, download speed, upload speed, progress, and file size. They can also view the category to which each torrent belongs. | ||
|
||
## Manager | ||
|
||
The Manager role extends the Reader role with additional permissions, allowing users to perform actions beyond mere observation. Manager-level users can download new torrents by sending magnet links or torrent files to the bot. They can also add or edit categories to organize their torrents effectively. Additionally, Manager users can set torrent priorities, enabling them to manage the download order and prioritize specific torrents. Moreover, they can pause or resume ongoing downloads, providing flexibility in managing their torrent activity. | ||
|
||
## Admin | ||
|
||
The Admin role, the most privileged, grants the user full control over the bot's functionalities. In addition to the capabilities of the Manager role, Admin users can remove torrents from their download lists, eliminating unwanted downloads. They can also remove categories, streamlining their torrent organization structure. And, as the highest-level role, Admin users have the authority to edit the bot's configuration files, modifying its settings and behavior. | ||
|
||
This role management system ensures that users are granted access appropriate to their needs and responsibilities. Readers can observe and manage their torrent activity, Managers can perform more extensive actions, and Admins have full control over the bot's operation. This structure enhances security and prevents unauthorized users from modifying configuration files or deleting torrents. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
order: -20 | ||
--- | ||
# FAQ | ||
|
||
### What is QBittorrentBot? | ||
|
||
QBittorrentBot is a Telegram bot that allows you to control your qBittorrent downloads from within the Telegram app. It can add torrents, manage your torrent list, and much more. | ||
|
||
### What are the benefits of using QBittorrentBot? | ||
|
||
There are several benefits to using QBittorrentBot, including: | ||
|
||
* **Convenience:** You can control your torrents from anywhere, without having to open the qBittorrent app. | ||
* **Efficiency:** You can manage your torrents without switching between apps. | ||
* **Organization:** You can categorize your torrents for better organization and accessibility. | ||
* **Docker Support:** You can deploy and manage the bot seamlessly using Docker containers. | ||
|
||
### How do I add QBittorrentBot to my Telegram account? | ||
|
||
Follow this guide to start using QBittorrentBot | ||
[!ref Getting Started](getting_started) | ||
|
||
### How do I edit the configuration for the QBittorrentBot? | ||
|
||
The QBittorrentBot configuration file is located at config.json. This file stores the bot's settings, such as the connection details for the qBittorrent client, the API IDs and hashes, and the list of authorized users. To edit the configuration file, you can open it in a text editor and make the necessary changes. | ||
|
||
### How do I check the status of my torrents? | ||
|
||
You can check the status of your torrents by using the list torrents button. This command will display a list of all your active torrents, including their name, status, progress, and download/upload speed. | ||
|
||
### What is the difference between a magnet link and a torrent file? | ||
|
||
A magnet link is a URI scheme that allows you to download a torrent without having to download the entire torrent file. A torrent file is a file that contains metadata about the torrent, such as the filename, file size, and number of pieces. | ||
|
||
### What are the different user roles available in QBittorrentBot? | ||
|
||
QBittorrentBot supports three user roles: Reader, Manager, and Admin. Each role has different permissions, as follows: | ||
|
||
* **Reader:** Can view lists of active torrents and view individual torrent details. | ||
* **Manager:** Can perform all Reader actions, plus add/edit categories, set torrent priorities, and pause/resume downloads. | ||
* **Admin:** Can perform all Manager actions, plus remove torrents, remove categories, and edit configs. | ||
|
||
### How do I change the user role for a user? | ||
|
||
You can change the user role for a user by editing the `config.json` file. Open the file and find the user's entry. Change the `role` field to the desired role (e.g., "reader", "manager", or "admin"). Save the file and restart the bot or, if you are an admin you can reload the configuration from the bot. | ||
|
||
### How do I install QBittorrentBot on my server? | ||
|
||
You can install QBittorrentBot on your server using Docker. First, install Docker on your server. Then, create a Docker image from the QBittorrentBot Dockerfile. Finally, run the Docker image to start the bot. | ||
|
||
### How do I add a new manager to my QBittorrentBot? | ||
|
||
Please follow this guide | ||
[!ref Add new client manager](advanced/add_new_client_manager) | ||
|
||
### How do I add a new entry to the QBittorrentBot configuration file? | ||
|
||
Please follow this guide | ||
[!ref Add new entries in configuration file](advanced/add_entries_configuration) | ||
|
||
### How do I contribute to the development of QBittorrentBot? | ||
|
||
QBittorrentBot is an open-source project. You can contribute to the development by reporting bugs, suggesting improvements, or submitting pull requests. The project's code is hosted on [GitHub](https://github.com/ch3p4ll3/QBittorrentBot). |
Oops, something went wrong.