forked from AsmSafone/MusicPlayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
52 lines (42 loc) · 2 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
"""
Music Player, Telegram Voice Chat Bot
Copyright (c) 2021-present Asm Safone <https://github.com/AsmSafone>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
"""
import os
from dotenv import load_dotenv
load_dotenv()
class Config:
def __init__(self) -> None:
self.API_ID: str = os.environ.get("API_ID", None)
self.API_HASH: str = os.environ.get("API_HASH", None)
self.SESSION: str = os.environ.get("SESSION", None)
self.BOT_TOKEN: str = os.environ.get("BOT_TOKEN", None)
self.SUDOERS: list = [
int(id) for id in os.environ.get("SUDOERS", " ").split() if id.isnumeric()
]
if not self.SESSION or not self.API_ID or not self.API_HASH:
print("ERROR: SESSION, API_ID and API_HASH is required!")
quit(0)
self.SPOTIFY: bool = False
self.QUALITY: str = os.environ.get("QUALITY", "high").lower()
self.PREFIXES: list = os.environ.get("PREFIX", "!").split()
self.LANGUAGE: str = os.environ.get("LANGUAGE", "en").lower()
self.STREAM_MODE: str = (
"audio"
if (os.environ.get("STREAM_MODE", "audio").lower() == "audio")
else "video"
)
self.ADMINS_ONLY: bool = os.environ.get("ADMINS_ONLY", False)
self.SPOTIFY_CLIENT_ID: str = os.environ.get("SPOTIFY_CLIENT_ID", None)
self.SPOTIFY_CLIENT_SECRET: str = os.environ.get("SPOTIFY_CLIENT_SECRET", None)
config = Config()