Expanded main() a little to add DB_Module to the Twitch_Module. Added a db_manager to the Twitch_Module class. Added the nickname string to the db credential.
50 lines
1.6 KiB
Python
50 lines
1.6 KiB
Python
# I moved all the requirements into requirements.txt.
|
|
# you can install everything with pip install -r requirements.txt while you're in the directory
|
|
|
|
import sys
|
|
import time
|
|
|
|
import twitch_script
|
|
|
|
import utilities_script as utility
|
|
|
|
import credentials
|
|
|
|
twitch_chat: twitch_script.Twitch_Module
|
|
credentials_manager: credentials.Credentials_Module
|
|
|
|
def main():
|
|
global twitch_chat
|
|
global credentials_manager
|
|
print("Loading credentials...")
|
|
credentials_manager = credentials.Credentials_Module()
|
|
credentials_manager.load_credentials()
|
|
|
|
twitch_chat = twitch_script.Twitch_Module()
|
|
|
|
dbCert: credentials.DB_Credential
|
|
if credentials_manager.DB_Credentials_List is not None:
|
|
for cert in credentials_manager.DB_Credentials_List:
|
|
if cert.nickname == "praxis_bot":
|
|
print("DB Certificate Found: {" + cert.nickname + "}")
|
|
dbCert = cert
|
|
|
|
twitchCert: credentials.Twitch_Credential
|
|
if credentials_manager.Twitch_Credentials_List is not None:
|
|
for cert in credentials_manager.Twitch_Credentials_List:
|
|
if cert.username == "praxis_bot":
|
|
print("Twitch Certificate Found: {" + cert.username + "}")
|
|
twitchCert = cert
|
|
|
|
twitch_chat.db_manager.setup_engine(dbCert)
|
|
print("Loading Credential: {" + cert.username + "} into Twitch_Module")
|
|
twitch_chat.twitchCredential = twitchCert
|
|
print("Connecting to Channel: " + "thecuriousnerd")
|
|
twitch_chat.join_channel(None, "thecuriousnerd")
|
|
|
|
# twitch_chat.send_message("activated")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|