-
Notifications
You must be signed in to change notification settings - Fork 36
/
config.py
106 lines (83 loc) · 2.82 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import os
import logging
from os import getenv
from dotenv import load_dotenv
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
LOGGER = logging.getLogger(__name__)
if not os.environ.get("ENV"):
load_dotenv('.env', override=True)
class Config(object):
#--------------------
# MAIN BOT VARIABLES
#--------------------
try:
TG_BOT_TOKEN = getenv("TG_BOT_TOKEN")
APP_ID = int(getenv("APP_ID", 123))
API_HASH = getenv("API_HASH")
except:
LOGGER.warning("Essential TG Configs are missing")
exit(1)
try:
AUTH_CHAT = set(int(x) for x in getenv("AUTH_CHAT").split())
except:
AUTH_CHAT = ""
try:
ADMINS = set(int(x) for x in getenv("ADMINS").split())
except:
LOGGER.warning("NO ADMIN USER IDS FOUND")
exit(1)
IS_BOT_PUBLIC = getenv("IS_BOT_PUBLIC", True)
try:
AUTH_USERS = set(int(x) for x in getenv("AUTH_USERS").split())
except:
AUTH_USERS = ""
# Dir to use for thumbs, download files etc.
WORK_DIR = getenv("WORK_DIR", "./bot/")
# Just name of the Downloads Folder
DOWNLOADS_FOLDER = getenv("DOWNLOADS_FOLDER", "DOWNLOADS")
DOWNLOAD_BASE_DIR = WORK_DIR + DOWNLOADS_FOLDER
BOT_USERNAME = getenv("BOT_USERNAME", "")
if not BOT_USERNAME:
LOGGER.warning("NO BOT USERNAME FOUND")
exit(1)
DATABASE_URL = getenv("DATABASE_URL")
if not DATABASE_URL:
LOGGER.warning("NO DATABASE URL FOUND")
exit(1)
BOT_LANGUAGE = getenv("BOT_LANGUAGE", "en")
MENTION_USERS = getenv("MENTION_USERS", False)
ANIT_SPAM_MODE = getenv("ANIT_SPAM_MODE", False)
#--------------------
# TIDAL VARIABLES
#--------------------
TIDAL_TRACK_FORMAT = getenv("TIDAL_TRACK_FORMAT", "{TrackTitle} - {ArtistName}")
#--------------------
# KKBOX VARIABLES
#--------------------
KKBOX_KEY = getenv("KKBOX_KEY", "abc")
KKBOX_EMAIL = getenv("KKBOX_EMAIL", "")
KKBOX_PASSWORD = getenv("KKBOX_PASSWORD", "")
#--------------------
# QOBUZ VARIABLES
#--------------------
QOBUZ_EMAIL = getenv("QOBUZ_EMAIL", "")
QOBUZ_PASSWORD = getenv("QOBUZ_PASSWORD", "")
QOBUZ_TRACK_FORMAT = getenv("QOBUZ_TRACK_FORMAT", "{tracknumber}. {tracktitle}")
#--------------------
# DEEZER VARIABLES
#--------------------
DEEZER_EMAIL = getenv("DEEZER_EMAIL", "")
DEEZER_PASSWORD = getenv("DEEZER_PASSWORD", "")
DEEZER_BF_SECRET = getenv("DEEZER_BF_SECRET", "")
DEEZER_TRACK_URL_KEY = getenv("DEEZER_TRACK_URL_KEY", "")
DEEZER_ARL = getenv("DEEZER_ARL", "")
#--------------------
# SPOTIFY VARIABLES
#--------------------
SPOTIFY_EMAIL = getenv("SPOTIFY_EMAIL", "")
SPOTIFY_PASS = getenv("SPOTIFY_PASS", "")
if BOT_USERNAME.startswith("@"):
BOT_USERNAME = BOT_USERNAME[1:]