

GitHub - SlamDevs/slam-mirrorbot: Aria/qBittorrent Telegram Mirror Bot.
source link: https://github.com/SlamDevs/slam-mirrorbot
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Slam Mirror Bot
Slam Mirror Bot is a multipurpose Telegram Bot written in Python for mirroring files on the Internet to our beloved Google Drive. Based on python-aria-mirror-bot
Features:
Click Here For More Details
How to deploy?
Deploying is pretty much straight forward and is divided into several steps as follows:
Installing requirements
- Clone this repo:
git clone https://github.com/SlamDevs/slam-mirrorbot mirrorbot/
cd mirrorbot
- Install requirements For Debian based distros
sudo apt install python3
Install Docker by following the official Docker docs
sudo snap install docker
- For Arch and it's derivatives:
sudo pacman -S docker python
- Install dependencies for running setup scripts:
pip3 install -r requirements-cli.txt
Generate Database
Click Here For More Details
Setting up config file
Click Here For More Details
Bot commands to be set in @BotFather
help - Get Detailed Help
mirror - Start Mirroring
tarmirror - Start mirroring and upload as .tar
zipmirror - Start mirroring and upload as .zip
unzipmirror - Extract files
qbmirror - Start Mirroring using qBittorrent
qbtarmirror - Start mirroring and upload as .tar using qb
qbzipmirror - Start mirroring and upload as .zip using qb
qbunzipmirror - Extract files using qBittorrent
clone - Copy file/folder to Drive
count - Count file/folder of Drive link
watch - Mirror Youtube-dl supported link
tarwatch - Mirror Youtube playlist link and upload as .tar
zipwatch - Mirror Youtube playlist link and upload as .zip
status - Get Mirror Status message
list - [query] Searches files in Drive
cancel - Cancel a task
cancelall - Cancel all tasks
del - [drive_url] Delete file from Drive
log - Get the Bot Log [owner/sudo only]
shell - Run commands in Shell [owner only]
restart - Restart the Bot [owner/sudo only]
stats - Bot Usage Stats
ping - Ping the Bot
Getting Google OAuth API credential file
- Visit the Google Cloud Console
- Go to the OAuth Consent tab, fill it, and save.
- Go to the Credentials tab and click Create Credentials -> OAuth Client ID
- Choose Desktop and Create.
- Use the download button to download your credentials.
- Move that file to the root of mirrorbot, and rename it to credentials.json
- Visit Google API page
- Search for Drive and enable it if it is disabled
- Finally, run the script to generate token.pickle file for Google Drive:
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib
python3 generate_drive_token.py
Deploying On VPS
IMPORTANT NOTE: You must set SERVER_PORT
variable to 80
or any other port you want to use.
- Start Docker daemon (skip if already running):
sudo dockerd
- Build Docker image:
sudo docker build . -t mirror-bot
- Run the image:
sudo docker run -p 80:80 mirror-bot
NOTE: If you want to use port other than 80, change it in docker-compose.yml
- Using Docker-compose, you can edit and build your image in seconds:
sudo apt install docker-compose
- Build and run Docker image:
sudo docker-compose up
- After editing files with nano for example (nano start.sh):
sudo docker-compose build
sudo docker-compose up
sudo docker-compose up --build
- To stop Docker:
sudo docker ps
sudo docker stop id
- To clear the container (this will not affect the image):
sudo docker container prune
- To delete the image:
sudo docker image prune -a
- Tutorial video from Tortoolkit repo
Deploying on Heroku
- Deploying on Heroku with Github Workflow
- Deploying on Heroku with heroku-cli and Goorm IDE
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.
Generate Service Accounts. What is Service Account
Click Here For More Details
Add all the Service Accounts to the Team Drive
python3 add_to_team_drive.py -d SharedTeamDriveSrcID
Youtube-dl authentication using .netrc file
For using your premium accounts in Youtube-dl or for protected Index Links, edit the netrc file according to following format:
machine host login username password my_youtube_password
For Index Link with only password without username, even http auth will not work, so this is the solution.
machine example.workers.dev password index_password
Where host is the name of extractor (eg. Youtube, Twitch). Multiple accounts of different hosts can be added each separated by a new line.
Credits
Thanks to:
out386
heavily inspired from his Telegram Bot written in TypescriptIzzy12
for build up of this bot from scratchjaskaranSM
for build up of this bot from scratchDank-del
for base repomagneto261290
for some featuresSVR666
for some features & fixesanasty17
for some features & helpbreakdowns
for slam-mirrorbotzevtyardt
for some direct linksyash-dk
for implementation of qBittorrent on Pythonxyou365
for Service Accounts script
And many more people who aren't mentioned here, but can be found in Contributors.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK