This commit is contained in:
Alex Orid 2020-10-20 00:10:42 -04:00
parent da06145f25
commit 4f55c84ba8
3 changed files with 57 additions and 6 deletions

View File

@ -16,7 +16,6 @@ import discord.channel
class Discord_Module(discord.Client):
def __init__(self):
super().__init__()
self.dbCredential: credentials.DB_Credential
self.discordCredential: credentials.Discord_Credential

59
main.py
View File

@ -11,8 +11,10 @@ import utilities_script as utility
import credentials
twitch_chat: twitch_script.Twitch_Module
credentials_manager: credentials.Credentials_Module
import threading
#twitch_chat: twitch_script.Twitch_Module
#credentials_manager: credentials.Credentials_Module
def main():
global twitch_chat
@ -32,14 +34,61 @@ def main():
twitch_chat.join_channel(None, "thecuriousnerd")
#discord_connection.main()
#Doesn't do stuff past this point
#twitch_chat.send_message("activated")
#discord_connection.main()
def new_main(inputArg):
args = utility.get_args(inputArg)
def twitch_module_init(dbCert, twitchCert):
twitch_chat = twitch_script.Twitch_Module()
twitch_chat.db_manager.setup_engine(dbCert)
twitch_chat.twitchCredential = twitchCert
twitch_chat.join_channel(None, "thecuriousnerd")
def discord_module_init(dbCert, discordCert):
discord_connection = discord_script.Discord_Module()
discord_connection.dbCredential = dbCert
discord_connection.discordCredential = discordCert
discord_connection.main()
#Doesn't do stuff past this point
twitch_chat.send_message("activated")
def thread_main():
global twitch_chat
global credentials_manager
credentials_manager = credentials.Credentials_Module()
credentials_manager.load_credentials()
dbCert: credentials.DB_Credential = credentials_manager.find_Credential(credentials.DB_Credential, "praxis_bot")
twitchCert: credentials.Twitch_Credential = credentials_manager.find_Twitch_Credential("praxis_bot")
discordCert: credentials.Discord_Credential = credentials_manager.find_Discord_Credential("praxis_bot")
threads = []
twitch = threading.Thread(target=twitch_module_init, args=(dbCert, twitchCert))
threads.append(twitch)
twitch.start()
discord = threading.Thread(target=discord_module_init, args=(dbCert, discordCert))
threads.append(discord)
discord.start()
for t in threads:
t.join()
if __name__ == "__main__":
main()
thread_main()

View File

@ -1,3 +1,6 @@
import os
clearScreen = lambda: os.system('cls' if os.name == 'nt' else 'clear')
def get_args(text: str) -> list:
return text.split(" ")