aboutsummaryrefslogtreecommitdiff
path: root/code/utils/config.py
diff options
context:
space:
mode:
Diffstat (limited to 'code/utils/config.py')
-rw-r--r--code/utils/config.py29
1 files changed, 21 insertions, 8 deletions
diff --git a/code/utils/config.py b/code/utils/config.py
index 470d03c..f2e0d01 100644
--- a/code/utils/config.py
+++ b/code/utils/config.py
@@ -33,7 +33,8 @@ BOT_COLOR = None
BOT_INVITE_LINK = None
FEEDBACK_CHANNEL_ID = None
BUG_CHANNEL_ID = None
-YOUTUBE_SUPPORT = None
+LOG_SONGS = False
+YOUTUBE_SUPPORT = False
SPOTIFY_CLIENT_ID = None
SPOTIFY_CLIENT_SECRET = None
GENIUS_CLIENT_ID = None
@@ -54,10 +55,17 @@ schema = {
"bot_invite_link": {"type": "string"},
"feedback_channel_id": {"type": "integer"},
"bug_channel_id": {"type": "integer"},
- "youtube_support": {"type": "boolean"},
+ "log_songs": {"type": "boolean"},
},
"required": ["token"],
},
+ "youtube": {
+ "type": "object",
+ "properties": {
+ "enabled": {"type": "boolean"},
+ },
+ "required": ["enabled"],
+ },
"spotify": {
"type": "object",
"properties": {
@@ -118,7 +126,10 @@ bot_info:
bot_invite_link: ""
feedback_channel_id: ""
bug_channel_id: ""
- youtube_support: false
+ log_songs: true
+
+youtube:
+ enabled: false
spotify:
spotify_client_id: ""
@@ -149,7 +160,7 @@ lavalink:
# Thouroughly validate all of the options in the config.yaml file
def validate_config(file_contents):
- global TOKEN, BOT_COLOR, BOT_INVITE_LINK, FEEDBACK_CHANNEL_ID, BUG_CHANNEL_ID, YOUTUBE_SUPPORT, SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET, GENIUS_CLIENT_ID, GENIUS_CLIENT_SECRET, OPENAI_API_KEY, LAVALINK_HOST, LAVALINK_PORT, LAVALINK_PASSWORD
+ global TOKEN, BOT_COLOR, BOT_INVITE_LINK, FEEDBACK_CHANNEL_ID, BUG_CHANNEL_ID, LOG_SONGS, YOUTUBE_SUPPORT, SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET, GENIUS_CLIENT_ID, GENIUS_CLIENT_SECRET, OPENAI_API_KEY, LAVALINK_HOST, LAVALINK_PORT, LAVALINK_PASSWORD
config = yaml.safe_load(file_contents)
try:
@@ -209,10 +220,12 @@ def validate_config(file_contents):
else:
BUG_CHANNEL_ID = config["bot_info"]["bug_channel_id"]
- if "youtube_support" in config["bot_info"]:
- YOUTUBE_SUPPORT = bool(config["bot_info"]["youtube_support"])
- else:
- YOUTUBE_SUPPORT = False
+ if "log_songs" in config["bot_info"]:
+ LOG_SONGS = bool(config["bot_info"]["log_songs"])
+
+ # Check for YouTube support
+ if "youtube" in config:
+ YOUTUBE_SUPPORT = bool(config["youtube"]["enabled"])
#
# If the SPOTIFY section is present, make sure the client ID and secret are valid