aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorParker <contact@pkrm.dev>2024-04-12 00:28:59 -0500
committerParker <contact@pkrm.dev>2024-04-12 00:28:59 -0500
commit2ebd5421b7f37234dc400ed4f6cf2e6b0c62e0ed (patch)
tree1eae4a18b20362c536d8dfa424612d08c9287de6 /code
parent312e2f12beaae6e53f929c62c4285386d4c6ffdb (diff)
Add OPENAI_API_KEY
Preparation for autoplay feature using ChatGPT
Diffstat (limited to 'code')
-rw-r--r--code/global_variables.py2
-rw-r--r--code/validate_config.py6
2 files changed, 7 insertions, 1 deletions
diff --git a/code/global_variables.py b/code/global_variables.py
index f79a3bb..1507f7a 100644
--- a/code/global_variables.py
+++ b/code/global_variables.py
@@ -2,6 +2,7 @@ import configparser
import logging
from colorlog import ColoredFormatter
import discord
+import openai
log_level = logging.DEBUG
@@ -49,6 +50,7 @@ BOT_COLOR = discord.Color(int((config["BOT_INFO"]["BOT_COLOR"]).replace("#", "")
FEEDBACK_CHANNEL_ID = int(config["BOT_INFO"]["FEEDBACK_CHANNEL_ID"])
SPOTIFY_CLIENT_ID = config["BOT_INFO"]["SPOTIFY_CLIENT_ID"]
SPOTIFY_CLIENT_SECRET = config["BOT_INFO"]["SPOTIFY_CLIENT_SECRET"]
+CLIENT = openai.OpenAI(api_key=config["BOT_INFO"]["OPENAI_API_KEY"])
BUG_CHANNEL_ID = int(config["BOT_INFO"]["BUG_CHANNEL_ID"])
BOT_INVITE_LINK = config["BOT_INFO"]["BOT_INVITE_LINK"]
diff --git a/code/validate_config.py b/code/validate_config.py
index 3db5427..80264e9 100644
--- a/code/validate_config.py
+++ b/code/validate_config.py
@@ -46,6 +46,10 @@ def validate_config(file_contents):
if not config["BOT_INFO"]["SPOTIFY_CLIENT_SECRET"]:
LOG.critical("SPOTIFY_CLIENT_SECRET has not been set.")
errors += 1
+ # Validate OPENAI_API_KEY
+ if not config["BOT_INFO"]["OPENAI_API_KEY"]:
+ LOG.critical("OPENAI_API_KEY has not bee set.")
+ errors += 1
# Validate BUG_CHANNEL_ID
if not config["BOT_INFO"]["BUG_CHANNEL_ID"]:
LOG.critical("BUG_CHANNEL_ID has not been set.")
@@ -107,7 +111,7 @@ def create_config():
"FEEDBACK_CHANNEL_ID": "",
"SPOTIFY_CLIENT_ID": "",
"SPOTIFY_CLIENT_SECRET": "",
- "BUG_CHANNEL_ID": "",
+ "OPENAI_API_KEY" "BUG_CHANNEL_ID": "",
}
config["LAVALINK"] = {"HOST": "", "PORT": "", "PASSWORD": ""}