Compare commits

...

2 Commits

Author SHA1 Message Date
Alex Orid
d773d8b8da Modified load_credentials()
Made the load_credentials function add credentials to the credential lists.
2020-09-22 18:26:04 -04:00
Alex Orid
7d0520b0b0 Added the DB Credential Template 2020-09-22 18:20:56 -04:00
4 changed files with 24 additions and 7 deletions

View File

@ -1,15 +1,19 @@
A chatbot to help with live stream production/effects.
___
# Credentials Setup:
## For Twitch Credentials in twitch_cred.py
Create a json based on the templates and put them into the credentials folder.
## For Twitch Credentials
Username = `TwitchUsername`
Helix ID = `https://dev.twitch.tv/console/apps`
Helix Client ID = `https://dev.twitch.tv/console/apps`
Oauth = `https://twitchapps.com/tmi/`
V5 Client ID = `https://twitchtokengenerator.com/`
## For Database Credentials in db_cred.py
engine = `"mysql+mysqlconnector://root:password@localhost:3306/DatabaseName"`
## For Database Credentials
Engine = `"mysql+mysqlconnector://root:password@localhost:3306/DatabaseName"`

View File

@ -0,0 +1,3 @@
{
"engine": "mysql+mysqlconnector://root:password@localhost:3306/DatabaseName"
}

View File

@ -1,6 +1,6 @@
{
"username": "something",
"helix": "secret",
"helix": "Helix Client ID",
"oauth": "token",
"v5_client": "I have no idea here"
"v5_client": "Client ID"
}

View File

@ -61,12 +61,18 @@ class Credentials_Module():
if file.lower().find("twitch") != -1:
credential_loading_function = self.credentialLoadingFunctions.get(Credential.Twitch_Credential)
output = credential_loading_function(self, file)
if output is not None:
self.Twitch_Credentials_List.append(output)
if file.lower().find("discord") != -1:
credential_loading_function = self.credentialLoadingFunctions.get(Credential.Discord_Credential)
output = credential_loading_function(self, file)
if output is not None:
self.Discord_Credentials_List.append(output)
if file.lower().find("db") != -1:
credential_loading_function = self.credentialLoadingFunctions.get(Credential.DB_Credential)
output = credential_loading_function(self, file)
if output is not None:
self.DB_Credentials_List.append(output)
def list_credential_files(self):
credentialPath = self.get_credentials_dir()
@ -97,7 +103,11 @@ class Credentials_Module():
return tobj
def load_DB_Credential(self, fileName: str):
return None
file_path = os.path.join(self.get_credentials_dir(), fileName)
f = open(file_path)
raw_json = json.loads(f.read())
tobj = DB_Credential(**raw_json)
return tobj
credentialLoadingFunctions = { # this is a mapping of the Credential enum to function pointers
Credential.Twitch_Credential: load_Twitch_Credential,