Spaces:
Running
Running
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") | |
BOT_USERNAME = "dragxmusicbot" | |
# Get your token from @BotFather on Telegram.main | |
SPECIAL_USER_ID = getenv("SPECIAL_USER_ID") | |
BOT_TOKEN = getenv("BOT_TOKEN") | |
# Get your mongo url from cloud.mongodb.com | |
MONGO_DB_URI = getenv("MONGO_DB_URI") | |
MUST_JOIN = getenv("MUST_JOIN", None) | |
DURATION_LIMIT_MIN = int(getenv("DURATION_LIMIT", 200)) | |
SERVER_PLAYLIST_LIMIT = 300 # Set your desired limit here | |
API_URL = getenv("API_URL", 'https://api.thequickearn.xyz') #youtube song url | |
API_KEY = getenv("API_KEY", None) # youtube song api key, get it from https://t.me/RahulTC | |
# Chat id of a group for logging bot's activities | |
LOGGER_ID = int(getenv("LOGGER_ID", )) | |
# Get this value from @FallenxBot on Telegram by /id | |
OWNER_ID = int(getenv("OWNER_ID", )) | |
BITFLOW_API_KEY = getenv("BITFLOW_API_KEY", None) # Bitflow API key for YouTube downloads | |
## 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/taslim19/musicxdrag", | |
) | |
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/haatsoja") | |
SUPPORT_CHAT = getenv("SUPPORT_CHAT", "https://t.me/dragbackup") | |
# 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)) | |
# Get this credentials from https://developer.spotify.com/dashboard | |
SPOTIFY_CLIENT_ID = getenv("SPOTIFY_CLIENT_ID", "48037b43459c4bacbce6c61be2575ade") | |
SPOTIFY_CLIENT_SECRET = getenv("SPOTIFY_CLIENT_SECRET", "103c89540301422aa880a462ca556416") | |
# Maximum limit for fetching playlist's track from youtube, spotify, apple links. | |
PLAYLIST_FETCH_LIMIT = int(getenv("PLAYLIST_FETCH_LIMIT", 300)) | |
# Telegram audio and video file size limit (in bytes) | |
TG_AUDIO_FILESIZE_LIMIT = int(getenv("TG_AUDIO_FILESIZE_LIMIT", 1610612736)) | |
TG_VIDEO_FILESIZE_LIMIT = int(getenv("TG_VIDEO_FILESIZE_LIMIT", 1610612736)) | |
# Checkout https://www.gbmb.org/mb-to-bytes for converting mb to bytes | |
# Get your pyrogram v2 session from @StringFatherBot on Telegram | |
STRING1 = getenv("STRING_SESSION", None) | |
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 = {} | |
START_IMG_URL = getenv("START_IMG_URL", "https://files.catbox.moe/8rwzc8.jpeg") | |
PING_IMG_URL = getenv("PING_IMG_URL", "https://files.catbox.moe/uopqdn.jpg") | |
PLAYLIST_IMG_URL ="https://telegra.ph/file/8d7b534e34e13316a7dd2.jpg" | |
STATS_IMG_URL = "https://files.catbox.moe/nge71y.jpg" | |
TELEGRAM_AUDIO_URL = "https://te.legra.ph/file/6298d377ad3eb46711644.jpg" | |
TELEGRAM_VIDEO_URL = "https://te.legra.ph/file/6298d377ad3eb46711644.jpg" | |
STREAM_IMG_URL = "https://te.legra.ph/file/bd995b032b6bd263e2cc9.jpg" | |
SOUNCLOUD_IMG_URL = "https://te.legra.ph/file/bb0ff85f2dd44070ea519.jpg" | |
YOUTUBE_IMG_URL = "https://te.legra.ph/file/6298d377ad3eb46711644.jpg" | |
SPOTIFY_ARTIST_IMG_URL = "https://te.legra.ph/file/37d163a2f75e0d3b403d6.jpg" | |
SPOTIFY_ALBUM_IMG_URL = "https://te.legra.ph/file/b35fd1dfca73b950b1b05.jpg" | |
SPOTIFY_PLAYLIST_IMG_URL = "https://te.legra.ph/file/95b3ca7993bbfaf993dcb.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}:0")) | |
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://" | |
) | |