Spaces:
Paused

nextjsfun99 commited on
Commit
283d271
·
verified ·
1 Parent(s): dd76e6f

Upload 7 files

Browse files
Files changed (7) hide show
  1. .gitignore +22 -0
  2. Dockerfile +11 -0
  3. config.env +146 -0
  4. heroku.yml +3 -0
  5. requirements.txt +36 -0
  6. start.sh +4 -0
  7. update.py +143 -0
.gitignore ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .idea
2
+ .netrc
3
+ .vscode
4
+ *.json
5
+ *.pickle
6
+ *.pyc
7
+ accounts.zip
8
+ accounts/*
9
+ bot.session
10
+ config.env
11
+ cookies.txt
12
+ data/*
13
+ downloads/*
14
+ list_drives.txt
15
+ log.txt
16
+ rclone.conf
17
+ rclone/*
18
+ terabox.txt
19
+ Thumbnails/*
20
+ token.pickle
21
+ tokens/*
22
+ user.session
Dockerfile ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM arakurumi/bot:mltb
2
+
3
+ WORKDIR /app
4
+
5
+ RUN chmod -R 777 /app
6
+
7
+ COPY . .
8
+
9
+ RUN pip install --break-system-packages --no-cache-dir --requirement requirements.txt
10
+
11
+ CMD ["bash", "start.sh"]
config.env ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # lanzermania@tutamail.com
2
+ BOT_TOKEN = "6486124376:AAHiPCSBl0QVxtqna_vleCK6uDCxUGr-gz4" # Require restart after changing it while bot running
3
+ OWNER_ID = "1487943213" # Require restart after changing it while bot running
4
+ TELEGRAM_API = "2589472" # Require restart after changing it while bot running
5
+ TELEGRAM_HASH = "5243628014db9798d6775b330e542602" # Require restart after changing it while bot running
6
+ # OPTIONAL CONFIG
7
+ AUTHORIZED_CHATS = "" # Use : to separate chatId with threadId. Require restart after changing it while bot running
8
+ CMD_SUFFIX = "" # Require restart after changing it while bot running
9
+ DATABASE_URL = "mongodb+srv://runarata:natusvincer@cluster0.rf5kn.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0" # Require restart after changing it while bot running
10
+ DEFAULT_UPLOAD = "gd"
11
+ DOWNLOAD_DIR = "/app/downloads/" # Require restart after changing it while bot running
12
+ EXTENSION_FILTER = ""
13
+ INCOMPLETE_TASK_NOTIFIER = "False"
14
+ NAME_SUBSTITUTE = ""
15
+ STATUS_LIMIT = "4"
16
+ STATUS_UPDATE_INTERVAL = "25"
17
+ SUDO_USERS = "" # Require restart after changing it while bot running
18
+ TELEGRAM_API_PREMIUM = "" # Use different TELEGRAM_API for USER_SESSION_STRING
19
+ TELEGRAM_HASH_PREMIUM = "" # Use different TELEGRAM_HASH for USER_SESSION_STRING
20
+ USE_SERVICE_ACCOUNTS = "False"
21
+ USE_TELEGRAPH = "False" # Use Telegraph to listing Google Drive instead of Telegram text
22
+ USER_SESSION_STRING = "BQAngyAAqxB8SV1Y_SR17UuStbSv52imWVPqhtLee1OhS7kgBRieAPprv_iZzPGjpYsQ7RJc0JUMac7qhPRvHnmxRsxzOc7_YVfrQa1knG3i-SbPShlkZfceMe5PNiTh0Mt97zcuBoYSWbliyhRVLg6C3F4amGKYK9HbL65lQkcgcHpPVWORxxEx8P8kh3yzz94lnXu21f-wulB35cNHbRD9_2MaT5576RDZkt9W-IpBZT1Ypd8LoJvd9K6y4RX0PsUHt-ZLqKfqrNYzGjIgsW4tnAaZqaRnndSV4LcAqM90dixK1P9_TXGqBDtJydkKgDJSBagxNIfyy4ypX7l3PORMBnCk9gAAAABYsDYtAA" # Require restart after changing it while bot running
23
+ YT_DLP_OPTIONS = ""
24
+ # GDrive Tools
25
+ GDRIVE_ID = ""
26
+ INDEX_URL = "https://down3.storage03.workers.dev/0:"
27
+ IS_TEAM_DRIVE = "False"
28
+ STOP_DUPLICATE = "False"
29
+ # Rclone
30
+ RCLONE_PATH = ""
31
+ RCLONE_FLAGS = ""
32
+ RCLONE_SERVE_URL = ""
33
+ RCLONE_SERVE_PORT = ""
34
+ RCLONE_SERVE_USER = ""
35
+ RCLONE_SERVE_PASS = ""
36
+ # Credential
37
+ ALLDEBRID_API = "" # Api Key from https://alldebrid.com/
38
+ DEBRIDLINK_API = "" # Api Key from https://debrid-link.com/
39
+ FILELION_API = ""
40
+ STREAMWISH_API = ""
41
+ UPTOBOX_TOKEN = ""
42
+ # JDownloader
43
+ JD_EMAIL = "" # Use "" if you want to disable Java (Eating to much RAM on Heroku)
44
+ JD_PASS = "" # Use "" if you want to disable Java (Eating to much RAM on Heroku)
45
+ # SABnzbd
46
+ USENET_SERVERS= [{"name": "main", "host": "", "port": 563, "timeout": 60, "username": "", "password": "", "connections": 60, "ssl": 1, "ssl_verify": 2, "ssl_ciphers": "", "enable": 1, "required": 0, "optional": 0, "retention": 0, "send_group": 0, "priority": 0}]
47
+ MEGA_EMAIL = ""
48
+ MEGA_PASS = ""
49
+ # Update
50
+ UPSTREAM_REPO = "https://genstava789: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@github.com/genstava789/mltb-heroki"
51
+ UPSTREAM_BRANCH = "main"
52
+ # Leech
53
+ AS_DOCUMENT = "False"
54
+ EQUAL_SPLITS = "False"
55
+ USER_TRANSMISSION = "False"
56
+ LEECH_SPLIT_SIZE = ""
57
+ LEECH_FILENAME_PERFIX = ""
58
+ MEDIA_GROUP = "False"
59
+ MIXED_LEECH = "False"
60
+ # Log
61
+ LOG_CHAT_ID = "-1001821586355" # Use : to separate chatId with threadId
62
+ LEECH_CHAT_ID = "" # Use : to separate chatId with threadId
63
+ FORWARD_RESULT = "True"
64
+ # qBittorrent/Aria2c
65
+ BASE_URL = "https://arxmirror-e9459719db30.herokuapp.com"
66
+ BASE_URL_PORT = ""
67
+ TORRENT_TIMEOUT = ""
68
+ WEB_PINCODE = "False"
69
+ #Queueing system
70
+ QUEUE_ALL = ""
71
+ QUEUE_DOWNLOAD = ""
72
+ QUEUE_UPLOAD = ""
73
+ # RSS
74
+ RSS_DELAY = "600"
75
+ RSS_CHAT_ID = "" # Use : to separate chatId with threadId
76
+ # Buttons
77
+ VIEW_LINK = "True"
78
+ # Torrent Search
79
+ SEARCH_LIMIT = "0"
80
+ SEARCH_API_LINK = ""
81
+ SEARCH_PLUGINS = '[
82
+ "https://gist.githubusercontent.com/scadams/56635407b8dfb8f5f7ede6873922ac8b/raw/f654c10468a0b9945bec9bf31e216993c9b7a961/one337x.py",
83
+ "https://github.com/vt-idiot/qBit-SukebeiNyaa-plugin/raw/master/engines/sukebeisi.py",
84
+ "https://raw.githubusercontent.com/AlaaBrahim/qBitTorrent-animetosho-search-plugin/main/animetosho.py",
85
+ "https://raw.githubusercontent.com/amongst-us/qbit-plugins/main/yts_mx.py",
86
+ "https://raw.githubusercontent.com/BrunoReX/qBittorrent-Search-Plugin-TokyoToshokan/master/tokyotoshokan.py",
87
+ "https://raw.githubusercontent.com/bugsbringer/qbit-plugins/master/darklibria.py",
88
+ "https://raw.githubusercontent.com/BurningMop/qBittorrent-Search-Plugins/main/bitsearch.py",
89
+ "https://raw.githubusercontent.com/BurningMop/qBittorrent-Search-Plugins/main/mypornclub.py",
90
+ "https://raw.githubusercontent.com/BurningMop/qBittorrent-Search-Plugins/main/solidtorrents.py",
91
+ "https://raw.githubusercontent.com/BurningMop/qBittorrent-Search-Plugins/main/therarbg.py",
92
+ "https://raw.githubusercontent.com/BurningMop/qBittorrent-Search-Plugins/main/torrentdownloads.py",
93
+ "https://raw.githubusercontent.com/BurningMop/qBittorrent-Search-Plugins/main/traht.py",
94
+ "https://raw.githubusercontent.com/BurningMop/qBittorrent-Search-Plugins/main/xxxclubto.py",
95
+ "https://raw.githubusercontent.com/camilobot/qb-cubonegro/main/cubonegro.py",
96
+ "https://raw.githubusercontent.com/Cc050511/qBit-search-plugins/main/acgrip.py",
97
+ "https://raw.githubusercontent.com/Cc050511/qBit-search-plugins/main/mikanani.py",
98
+ "https://raw.githubusercontent.com/hannsen/qbittorrent_search_plugins/master/ali213.py",
99
+ "https://raw.githubusercontent.com/hannsen/qbittorrent_search_plugins/master/smallgames.py",
100
+ "https://raw.githubusercontent.com/imDMG/qBt_SE/master/engines/rutor.py",
101
+ "https://raw.githubusercontent.com/iordic/qbittorrent-search-plugins/master/engines/elitetorrent.py",
102
+ "https://raw.githubusercontent.com/joseeloren/search-plugins/master/nova3/engines/maxitorrent.py",
103
+ "https://raw.githubusercontent.com/khensolomon/leyts/master/yts.py",
104
+ "https://raw.githubusercontent.com/kjjejones44/b4tg_search_plugin/master/bt4g.py",
105
+ "https://raw.githubusercontent.com/Larsluph/qbittorrent-search-plugins/prt/nova3/engines/pornrips.py",
106
+ "https://raw.githubusercontent.com/libellula/qbt-plugins/c81ccd168f3d8e4e8d8492bcef19e1740cc18aa7/nyaapantsu.py",
107
+ "https://raw.githubusercontent.com/libellula/qbt-plugins/main/pantsu.py",
108
+ "https://raw.githubusercontent.com/libellula/qbt-plugins/main/sukebei.py",
109
+ "https://raw.githubusercontent.com/LightDestory/qBittorrent-Search-Plugins/master/src/engines/academictorrents.py",
110
+ "https://raw.githubusercontent.com/LightDestory/qBittorrent-Search-Plugins/master/src/engines/ettv.py",
111
+ "https://raw.githubusercontent.com/LightDestory/qBittorrent-Search-Plugins/master/src/engines/glotorrents.py",
112
+ "https://raw.githubusercontent.com/LightDestory/qBittorrent-Search-Plugins/master/src/engines/kickasstorrents.py",
113
+ "https://raw.githubusercontent.com/LightDestory/qBittorrent-Search-Plugins/master/src/engines/pirateiro.py",
114
+ "https://raw.githubusercontent.com/LightDestory/qBittorrent-Search-Plugins/master/src/engines/rockbox.py",
115
+ "https://raw.githubusercontent.com/LightDestory/qBittorrent-Search-Plugins/master/src/engines/snowfl.py",
116
+ "https://raw.githubusercontent.com/LightDestory/qBittorrent-Search-Plugins/master/src/engines/thepiratebay.py",
117
+ "https://raw.githubusercontent.com/LightDestory/qBittorrent-Search-Plugins/master/src/engines/torrentdownload.py",
118
+ "https://raw.githubusercontent.com/LightDestory/qBittorrent-Search-Plugins/master/src/engines/yourbittorrent.py",
119
+ "https://raw.githubusercontent.com/MadeOfMagicAndWires/qBit-plugins/6074a7cccb90dfd5c81b7eaddd3138adec7f3377/engines/linuxtracker.py",
120
+ "https://raw.githubusercontent.com/MadeOfMagicAndWires/qBit-plugins/master/engines/linuxtracker.py",
121
+ "https://raw.githubusercontent.com/MadeOfMagicAndWires/qBit-plugins/master/engines/nyaasi.py",
122
+ "https://raw.githubusercontent.com/MarcBresson/cpasbien/master/src/cpasbien.py",
123
+ "https://raw.githubusercontent.com/MaurizioRicci/qBittorrent_search_engines/master/kickass_torrent.py",
124
+ "https://raw.githubusercontent.com/MaurizioRicci/qBittorrent_search_engines/master/yts_am.py",
125
+ "https://raw.githubusercontent.com/menegop/qbfrench/master/torrent9.py",
126
+ "https://raw.githubusercontent.com/msagca/qbittorrent_plugins/main/btmulu.py",
127
+ "https://raw.githubusercontent.com/msagca/qbittorrent_plugins/main/uniondht.py",
128
+ "https://raw.githubusercontent.com/nindogo/qbtSearchScripts/master/anidex.py",
129
+ "https://raw.githubusercontent.com/nindogo/qbtSearchScripts/master/magnetdl.py",
130
+ "https://raw.githubusercontent.com/nindogo/qbtSearchScripts/master/torrentgalaxy.py",
131
+ "https://raw.githubusercontent.com/nklido/qBittorrent_search_engines/master/engines/audiobookbay.py",
132
+ "https://raw.githubusercontent.com/phuongtailtranminh/qBittorrent-Nyaa-Search-Plugin/master/nyaa.py",
133
+ "https://raw.githubusercontent.com/qbittorrent/search-plugins/master/nova3/engines/eztv.py",
134
+ "https://raw.githubusercontent.com/qbittorrent/search-plugins/master/nova3/engines/limetorrents.py",
135
+ "https://raw.githubusercontent.com/qbittorrent/search-plugins/master/nova3/engines/piratebay.py",
136
+ "https://raw.githubusercontent.com/qbittorrent/search-plugins/master/nova3/engines/torlock.py",
137
+ "https://raw.githubusercontent.com/qbittorrent/search-plugins/master/nova3/engines/torrentproject.py",
138
+ "https://raw.githubusercontent.com/qbittorrent/search-plugins/master/nova3/engines/torrentscsv.py",
139
+ "https://raw.githubusercontent.com/TuckerWarlock/qbittorrent-search-plugins/main/bt4gprx.com/bt4gprx.py",
140
+ "https://raw.githubusercontent.com/v1k45/1337x-qBittorrent-search-plugin/master/leetx.py",
141
+ "https://raw.githubusercontent.com/YGGverse/qbittorrent-yggtracker-search-plugin/main/yggtracker.py",
142
+ "https://raw.githubusercontent.com/ZH1637/dmhy/main/dmhy.py",
143
+ "https://scare.ca/dl/qBittorrent/magnetdl.py",
144
+ "https://scare.ca/dl/qBittorrent/thepiratebay.py",
145
+ "https://scare.ca/dl/qBittorrent/torrentdownload.py",
146
+ ]'
heroku.yml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ build:
2
+ docker:
3
+ web: Dockerfile
requirements.txt ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiofiles
2
+ aioshutil
3
+ anytree
4
+ apscheduler
5
+ aria2p
6
+ beautifulsoup4
7
+ cloudscraper
8
+ feedparser
9
+ flask
10
+ gevent
11
+ google-api-python-client
12
+ google-auth-httplib2
13
+ google-auth-oauthlib
14
+ gunicorn
15
+ httpx
16
+ lxml
17
+ motor
18
+ natsort
19
+ pillow
20
+ psutil
21
+ pycryptodome
22
+ pycurl
23
+ pymongo
24
+ pyrofork
25
+ python-dotenv
26
+ python-magic
27
+ qbittorrent-api
28
+ requests
29
+ speedtest-cli
30
+ telegraph
31
+ tenacity
32
+ TgCrypto-pyrofork
33
+ urllib3
34
+ uvloop
35
+ xattr
36
+ yt-dlp
start.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ python update.py
4
+ python -m bot
update.py ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dotenv import load_dotenv, dotenv_values
2
+ from http.client import responses
3
+ from logging import (
4
+ basicConfig,
5
+ getLogger,
6
+ ERROR,
7
+ INFO,
8
+ )
9
+ from os import (
10
+ environ,
11
+ path,
12
+ remove,
13
+ )
14
+ from pymongo.mongo_client import MongoClient
15
+ from pymongo.server_api import ServerApi
16
+ from requests import get
17
+ from subprocess import run
18
+
19
+
20
+ basicConfig(
21
+ format="{asctime} - [{levelname[0]}] {name} [{module}:{lineno}] - {message}",
22
+ datefmt="%Y-%m-%d %H:%M:%S",
23
+ style="{",
24
+ level=INFO,
25
+ )
26
+
27
+ LOGGER = getLogger("update")
28
+ getLogger("pymongo").setLevel(ERROR)
29
+
30
+ if path.exists("log.txt"):
31
+ with open("log.txt", "r+") as f:
32
+ f.truncate(0)
33
+
34
+ if path.exists("rlog.txt"):
35
+ remove("rlog.txt")
36
+
37
+ if not path.exists("config.env"):
38
+ if CONFIG_URL := environ.get("CONFIG_URL"):
39
+ LOGGER.info("CONFIG_URL is found! Downloading CONFIG_URL...")
40
+
41
+ req = get(
42
+ url=CONFIG_URL,
43
+ timeout=10,
44
+ allow_redirects=True,
45
+ )
46
+
47
+ if req.ok:
48
+ with open("config.env", "wb+") as file:
49
+ file.write(req.content)
50
+
51
+ else:
52
+ LOGGER.error(f"[{req.status_code}] {responses[req.status_code]}")
53
+
54
+ else:
55
+ LOGGER.warning("CONFIG_URL is not found! Using local config.env instead...")
56
+
57
+ load_dotenv("config.env", override=True)
58
+
59
+ if bool(environ.get("_____REMOVE_THIS_LINE_____")):
60
+ LOGGER.error("The README.md file there to be read!")
61
+ exit()
62
+
63
+ BOT_TOKEN = environ.get("BOT_TOKEN", "")
64
+ if len(BOT_TOKEN) == 0:
65
+ LOGGER.error("BOT_TOKEN is not found!")
66
+ exit(1)
67
+
68
+ BOT_ID = BOT_TOKEN.split(":", 1)[0]
69
+
70
+ DATABASE_URL = environ.get("DATABASE_URL", "")
71
+ if len(DATABASE_URL) == 0:
72
+ DATABASE_URL = None
73
+ LOGGER.warning("DATABASE_URL is not found!")
74
+
75
+ else:
76
+ try:
77
+ conn = MongoClient(
78
+ DATABASE_URL,
79
+ server_api=ServerApi("1"),
80
+ )
81
+
82
+ db = conn.mltb
83
+ old_config = db.settings.deployConfig.find_one({"_id": BOT_ID})
84
+ config_dict = db.settings.config.find_one({"_id": BOT_ID})
85
+ if old_config is not None:
86
+ del old_config["_id"]
87
+
88
+ if (
89
+ old_config is not None
90
+ and old_config == dict(dotenv_values("config.env"))
91
+ or old_config is None
92
+ ) and config_dict is not None:
93
+ environ["UPSTREAM_REPO"] = config_dict["UPSTREAM_REPO"]
94
+ environ["UPSTREAM_BRANCH"] = config_dict["UPSTREAM_BRANCH"]
95
+
96
+ conn.close()
97
+
98
+ except Exception as e:
99
+ LOGGER.error(f"DATABASE ERROR! ERROR: {e}")
100
+
101
+ UPSTREAM_REPO = environ.get("UPSTREAM_REPO", "")
102
+ if len(UPSTREAM_REPO) == 0:
103
+ UPSTREAM_REPO = None
104
+
105
+ else:
106
+ if UPSTREAM_REPO.startswith("#"):
107
+ UPSTREAM_REPO = None
108
+
109
+ UPSTREAM_BRANCH = environ.get("UPSTREAM_BRANCH", "")
110
+ if len(UPSTREAM_BRANCH) == 0:
111
+ UPSTREAM_BRANCH = None
112
+
113
+ else:
114
+ if UPSTREAM_BRANCH.startswith("#"):
115
+ UPSTREAM_BRANCH = None
116
+
117
+ if (
118
+ UPSTREAM_REPO
119
+ and UPSTREAM_BRANCH
120
+ ):
121
+ if path.exists(".git"):
122
+ run(["rm -rf .git"], shell=True)
123
+
124
+ process = run([
125
+ f"git init -q \
126
+ && git config --global user.email kqruumi@gmail.com \
127
+ && git config --global user.name KQRM \
128
+ && git add . \
129
+ && git commit -sm update -q \
130
+ && git remote add origin {UPSTREAM_REPO} \
131
+ && git fetch origin -q \
132
+ && git reset --hard origin/{UPSTREAM_BRANCH} -q"
133
+ ], shell=True)
134
+
135
+ if process.returncode == 0:
136
+ LOGGER.info("Successfully updated with latest commit from UPSTREAM_REPO!")
137
+
138
+ else:
139
+ LOGGER.error("Something wrong while updating! Check UPSTREAM_REPO if valid or not!")
140
+
141
+ else:
142
+ LOGGER.warning("UPSTREAM_REPO is not found!")
143
+ LOGGER.warning("UPSTREAM_BRANCH is not found!")