-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Venom
authored
Sep 16, 2023
1 parent
8dec30a
commit 6cf04b7
Showing
10 changed files
with
379 additions
and
0 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,12 @@ | ||
FROM nikolaik/python-nodejs:python3.10-nodejs19 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends ffmpeg \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY . /app/ | ||
WORKDIR /app/ | ||
RUN pip3 install --no-cache-dir -U -r requirements.txt | ||
|
||
CMD bash start |
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 @@ | ||
worker: bash start |
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,73 @@ | ||
{ | ||
"name": "𝐈𝛕ᷟ͢𝚣⃪ꙴ ⋆⃝ǫᴜᴇᴇɴ𓃭 ⃟ᴍᴜsɪᴄ⛦⃕͜༆", | ||
"description": "A Telegram Music Player Bot, written in Python with Pyrogram and Py-Tgcalls.", | ||
"logo": "https://te.legra.ph/file/b8a0c1a00db3e57522b53.jpg", | ||
"keywords": [ | ||
"python3", | ||
"telegram", | ||
"bot", | ||
"VenomX", | ||
"MusicBot", | ||
"telegram-bot", | ||
"pyrogram" | ||
], | ||
"env": { | ||
"API_ID": { | ||
"description": "Get this value from https://my.telegram.org", | ||
"value": "", | ||
"required": true | ||
}, | ||
"API_HASH": { | ||
"description": "Get this value from https://my.telegram.org", | ||
"value": "", | ||
"required": true | ||
}, | ||
"BOT_TOKEN": { | ||
"description": "A Bot's token from Botfather", | ||
"value": "", | ||
"required": true | ||
}, | ||
"MONGO_DB_URI": { | ||
"description": "Get a mongodb url from https://cloud.mongodb.com.", | ||
"value": "", | ||
"required": true | ||
}, | ||
"OWNER_ID": { | ||
"description": "The user id of user whom you would like to add as OWNER.", | ||
"value": "6194877007", | ||
"required": true | ||
}, | ||
"STRING_SESSION": { | ||
"description": "A Pyrogram v1 String Session from @Venom_string_robot on Telegram.", | ||
"value": "", | ||
"required": true | ||
}, | ||
"HEROKU_API_KEY": { | ||
"description": "Your Heroku account's API key", | ||
"value": "", | ||
"required": false | ||
}, | ||
"HEROKU_APP_NAME": { | ||
"description": "Your heroku app name", | ||
"value": "", | ||
"required": false | ||
}, | ||
"LOGGER_ID": { | ||
"description": "Your Log Group ID, add your bot and promote as an admin with full rights!. Channel ki id mat daal dena bsdk.", | ||
"value": "", | ||
"required": true | ||
} | ||
}, | ||
"buildpacks": [ | ||
{ | ||
"url": "heroku/python" | ||
}, | ||
{ | ||
"url": "heroku/nodejs" | ||
}, | ||
{ | ||
"url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git" | ||
} | ||
], | ||
"stack": "container" | ||
} |
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,126 @@ | ||
import re | ||
from os import getenv | ||
|
||
from dotenv import load_dotenv | ||
from pyrogram import filters | ||
|
||
load_dotenv() | ||
|
||
# Get this value from my.telegram.org/apps | ||
API_ID = int(getenv("API_ID", "")) | ||
API_HASH = getenv("API_HASH", "") | ||
|
||
# Get your token from @BotFather on Telegram. | ||
BOT_TOKEN = getenv("BOT_TOKEN", "") | ||
|
||
# Get your mongo url from cloud.mongodb.com | ||
MONGO_DB_URI = getenv("MONGO_DB_URI", "") | ||
|
||
DURATION_LIMIT_MIN = int(getenv("DURATION_LIMIT", 5400)) | ||
|
||
SONG_DOWNLOAD_DURATION = int( | ||
getenv("SONG_DOWNLOAD_DURATION_LIMIT", "5400") | ||
) | ||
# Chat id of a group for logging bot's activities | ||
LOGGER_ID = int(getenv("LOGGER_ID", "")) | ||
|
||
# Get this value from @Hot_Girl_Robot on Telegram by /id | ||
OWNER_ID = int(getenv("OWNER_ID", "6194877007")) | ||
|
||
## Fill these variables if you're deploying on heroku. | ||
# Your heroku app name | ||
HEROKU_APP_NAME = getenv("HEROKU_APP_NAME") | ||
# Get it from http://dashboard.heroku.com/account | ||
HEROKU_API_KEY = getenv("HEROKU_API_KEY") | ||
|
||
UPSTREAM_REPO = getenv( | ||
"UPSTREAM_REPO", | ||
"https://github.com/Itsvenomo/VenomX", | ||
) | ||
UPSTREAM_BRANCH = getenv("UPSTREAM_BRANCH", "main") | ||
GIT_TOKEN = getenv( | ||
"GIT_TOKEN", None | ||
) # Fill this variable if your upstream repository is private | ||
|
||
SUPPORT_CHANNEL = getenv("SUPPORT_CHANNEL", "https://t.me/VenomOwners") | ||
SUPPORT_CHAT = getenv("SUPPORT_CHAT", "https://t.me/Venom_Chatting") | ||
|
||
# Set this to True if you want the assistant to automatically leave chats after an interval | ||
AUTO_LEAVING_ASSISTANT = bool(getenv("AUTO_LEAVING_ASSISTANT", False)) | ||
AUTO_SUGGESTION_MODE = getenv("AUTO_SUGGESTION_MODE", "True") | ||
AUTO_SUGGESTION_TIME = int( | ||
getenv("AUTO_SUGGESTION_TIME", "500")) | ||
# Get this credentials from https://developer.spotify.com/dashboard | ||
SPOTIFY_CLIENT_ID = getenv("SPOTIFY_CLIENT_ID", None) | ||
SPOTIFY_CLIENT_SECRET = getenv("SPOTIFY_CLIENT_SECRET", None) | ||
|
||
|
||
# Maximum limit for fetching playlist's track from youtube, spotify, apple links. | ||
PLAYLIST_FETCH_LIMIT = int(getenv("PLAYLIST_FETCH_LIMIT", 25)) | ||
|
||
CLEANMODE_DELETE_MINS = int( | ||
getenv("CLEANMODE_MINS", "5")) | ||
# Telegram audio and video file size limit (in bytes) | ||
TG_AUDIO_FILESIZE_LIMIT = int(getenv("TG_AUDIO_FILESIZE_LIMIT", 104857600)) | ||
TG_VIDEO_FILESIZE_LIMIT = int(getenv("TG_VIDEO_FILESIZE_LIMIT", 1073741824)) | ||
# Checkout https://www.gbmb.org/mb-to-bytes for converting mb to bytes | ||
|
||
|
||
# Get your pyrogram v2 session from @Venom_string_robot on Telegram | ||
STRING1 = getenv("STRING_SESSION", "") | ||
STRING2 = getenv("STRING_SESSION2", None) | ||
STRING3 = getenv("STRING_SESSION3", None) | ||
STRING4 = getenv("STRING_SESSION4", None) | ||
STRING5 = getenv("STRING_SESSION5", None) | ||
|
||
|
||
BANNED_USERS = filters.user() | ||
adminlist = {} | ||
lyrical = {} | ||
votemode = {} | ||
autoclean = [] | ||
confirmer = {} | ||
chatstats = {} | ||
userstats = {} | ||
clean = {} | ||
|
||
autoclean = [] | ||
|
||
START_IMG_URL = getenv( | ||
"START_IMG_URL", "https://telegra.ph/file/8a5171024a3bc5569ee3f.jpg" | ||
) | ||
PING_IMG_URL = getenv( | ||
"PING_IMG_URL", "https://telegra.ph/file/8a5171024a3bc5569ee3f.jpg" | ||
) | ||
PLAYLIST_IMG_URL = "https://telegra.ph/file/8a5171024a3bc5569ee3f.jpg" | ||
STATS_IMG_URL = "https://telegra.ph/file/8a5171024a3bc5569ee3f.jpg" | ||
TELEGRAM_AUDIO_URL = "https://telegra.ph/file/8a5171024a3bc5569ee3f.jpg" | ||
TELEGRAM_VIDEO_URL = "https://telegra.ph/file/8a5171024a3bc5569ee3f.jpg" | ||
STREAM_IMG_URL = "https://telegra.ph/file/8a5171024a3bc5569ee3f.jpg" | ||
SOUNCLOUD_IMG_URL = "https://telegra.ph/file/8a5171024a3bc5569ee3f.jpg" | ||
YOUTUBE_IMG_URL = "https://telegra.ph/file/8a5171024a3bc5569ee3f.jpg" | ||
SPOTIFY_ARTIST_IMG_URL = "https://telegra.ph/file/8a5171024a3bc5569ee3f.jpg" | ||
SPOTIFY_ALBUM_IMG_URL = "https://telegra.ph/file/8a5171024a3bc5569ee3f.jpg" | ||
SPOTIFY_PLAYLIST_IMG_URL = "https://telegra.ph/file/8a5171024a3bc5569ee3f.jpg" | ||
|
||
|
||
def time_to_seconds(time): | ||
stringt = str(time) | ||
return sum(int(x) * 60**i for i, x in enumerate(reversed(stringt.split(":")))) | ||
|
||
|
||
DURATION_LIMIT = int(time_to_seconds(f"{DURATION_LIMIT_MIN}:00")) | ||
SONG_DOWNLOAD_DURATION_LIMIT = int( | ||
time_to_seconds(f"{SONG_DOWNLOAD_DURATION}:00")) | ||
|
||
if SUPPORT_CHANNEL: | ||
if not re.match("(?:http|https)://", SUPPORT_CHANNEL): | ||
raise SystemExit( | ||
"[ERROR] - Your SUPPORT_CHANNEL url is wrong. Please ensure that it starts with https://" | ||
) | ||
|
||
if SUPPORT_CHAT: | ||
if not re.match("(?:http|https)://", SUPPORT_CHAT): | ||
raise SystemExit( | ||
"[ERROR] - Your SUPPORT_CHAT url is wrong. Please ensure that it starts with https://" | ||
) |
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,5 @@ | ||
build: | ||
docker: | ||
worker: Dockerfile | ||
run: | ||
worker: bash start |
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,27 @@ | ||
aiofiles | ||
aiohttp | ||
asyncio | ||
beautifulsoup4 | ||
dnspython | ||
ffmpeg-python | ||
gitpython | ||
hachoir | ||
heroku3 | ||
lyricsgenius | ||
motor | ||
numpy | ||
pillow | ||
psutil | ||
py-tgcalls==0.9.7 | ||
pykeyboard | ||
pyrogram==2.0.106 | ||
python-dotenv | ||
pyyaml | ||
requests | ||
speedtest-cli | ||
spotipy | ||
tgcrypto | ||
unidecode | ||
yt-dlp | ||
youtube-search | ||
youtube-search-python |
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 @@ | ||
python-3.11.4 |
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,7 @@ | ||
API_ID= | ||
API_HASH= | ||
BOT_TOKEN= | ||
LOGGER_ID= | ||
MONGO_DB_URI= | ||
OWNER_ID= | ||
STRING_SESSION= |
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,126 @@ | ||
#!/bin/bash | ||
|
||
pprint (){ | ||
cred='\033[0;31m' | ||
cgreen='\033[0;32m' | ||
cyellow='\033[0;33m' | ||
cblue='\033[0;34m' | ||
cpurple='\033[0;35m' | ||
eval "export color='$cpurple'" | ||
[ ! -z $2 ] && eval "export color=\"\$$2\"" | ||
printf "$color $1" | ||
} | ||
|
||
color_reset(){ printf '\033[0;37m';} | ||
|
||
yesnoprompt(){ | ||
old_stty_cfg=$(stty -g) | ||
stty raw -echo ; answer=$(head -c 1) | ||
stty $old_stty_cfg | ||
echo "$answer" | grep -iq "^y" | ||
} | ||
|
||
update() { | ||
pprint "\n\nUpdating package list.. " | ||
sudo apt update 2>&1 | grep "can be upgraded" &>/dev/null | ||
if [ $? -eq 0 ]; then | ||
pprint "UPDATE AVAILABLE" "cgreen" | ||
pprint "\n\nDo you want to automatically upgrade (y/n)?" | ||
if yesnoprompt; then | ||
pprint "\n\nUpgrading packages.. " | ||
sudo apt upgrade -y &>/dev/null && | ||
pprint "DONE!\n\n" "cgreen" || (pprint "FAIL.\n\n" "cred"; exit 1) | ||
else | ||
echo | ||
fi | ||
else | ||
pprint "ALREADY UP TO DATE\n\n" "cgreen" | ||
fi | ||
} | ||
|
||
packages(){ | ||
if ! command -v pip &>/dev/null; then | ||
pprint "Couldn't found pip, installing now..." | ||
sudo apt install python3-pip -y 2>pypilog.txt 1>/dev/null && | ||
pprint "SUCCESS.\n\n" "cgreen" || (pprint "FAIL.\n\n" "cred"; exit 1) | ||
fi | ||
|
||
if ! command -v ffmpeg &>/dev/null; then | ||
pprint "Couldn't found ffmpeg, installing now..." | ||
if sudo apt install ffmpeg -y &>/dev/null;then | ||
pprint "SUCCESS.\n\n" "cgreen" | ||
else | ||
pprint "FAIL.\n\n" "cred" | ||
pprint "You need to install ffmpeg manually in order to deploy VenomXMusic, exiting...\n" "cblue" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Check ffmpeg version and warn user if necessary. | ||
fv=$(grep -Po 'version (3.*?) ' <<< $(ffmpeg -version)) && | ||
pprint "Playing live streams not going to work since you have ffmpeg $fv, live streams are supported by version 4+.\n" "cblue" | ||
} | ||
|
||
|
||
node(){ | ||
command -v npm &>/dev/null && return | ||
pprint "Installing Nodejs and Npm.. " | ||
curl -fssL https://deb.nodesource.com/setup_19.x | sudo -E bash - &>nodelog.txt && | ||
sudo apt install -y nodejs &>>nodelog.txt && | ||
sudo npm i -g npm &>>nodelog.txt && | ||
pprint "SUCCESS!\n" "cgreen" || (pprint "FAIL.\n" "cred"; exit 1) | ||
} | ||
|
||
|
||
installation(){ | ||
pprint "\n\nUpgrading pip and installing dependency packages..." | ||
pip3 install -U pip &>>pypilog.txt && | ||
pip3 install -U -r requirements.txt &>>pypilog.txt && | ||
pprint "DONE.\n" "cgreen" && return | ||
pprint "FAIL.\n" "cred" | ||
exit 1 | ||
} | ||
|
||
clear | ||
pprint "Welcome to VenomXMusic Setup Installer\n\n" | ||
pprint "If you see any error during Installation Process, Please refer to these files for logs: " | ||
pprint "\nFor node js errors , Checkout nodelog.txt" | ||
pprint "\nFor pypi packages errors , Checkout pypilog.txt" | ||
sleep 1 | ||
pprint "\n\nScript needs sudo privileges in order to update & install packages.\n" | ||
sudo test | ||
|
||
update | ||
packages | ||
node | ||
installation | ||
pprint "\n\n\n\n\nVenomXMusic Installation Completed !" "cgreen" | ||
sleep 1 | ||
clear | ||
|
||
pprint "\nEnter Your Values Below\n\n\n" | ||
pprint "API ID: "; color_reset; read api_id | ||
pprint "\nAPI HASH: "; color_reset; read api_hash | ||
pprint "\nBOT TOKEN: "; color_reset; read bot_token | ||
pprint "\nOWNER ID:"; color_reset; read ownid | ||
pprint "\nMONGO DB URI: "; color_reset; read mongo_db | ||
pprint "\nLOG GROUP ID: "; color_reset; read logger | ||
pprint "\nSTRING SESSION: "; color_reset; read string_session | ||
|
||
pprint "\n\nProcessing your vars, wait a while !" "cgreen" | ||
|
||
if [ -f .env ]; then | ||
rm .env | ||
fi | ||
|
||
echo """API_ID = $api_id | ||
API_HASH = $api_hash | ||
BOT_TOKEN = $bot_token | ||
MONGO_DB_URI = $mongo_db | ||
LOGGER_ID = $logger | ||
STRING_SESSION = $string_session | ||
OWNER_ID = $ownid""" > .env | ||
clear | ||
|
||
pprint "\n\n\nThanks for using VenomXMusic installer, your vars have been saved successfully ! \nIf you wanna add more variables add them in your env by : vi .env" | ||
pprint "\n\nNow you can start the bot by : bash start\n\n" |
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 @@ | ||
python3 -m VenomX |