Cleaned up Main
This commit is contained in:
parent
c4b409fd00
commit
bab4a31d95
@ -25,14 +25,6 @@ class Discord_Module(discord.Client):
|
|||||||
def main(self):
|
def main(self):
|
||||||
self.run(self.discordCredential.token)
|
self.run(self.discordCredential.token)
|
||||||
|
|
||||||
def alt_main(self):
|
|
||||||
credentials_manager = credentials.Credentials_Module()
|
|
||||||
credentials_manager.load_credentials()
|
|
||||||
self.dbCredential = credentials_manager.find_DB_Credential("praxis_bot")
|
|
||||||
self.discordCredential = credentials_manager.find_Discord_Credential("praxis_bot")
|
|
||||||
|
|
||||||
self.run(self.discordCredential.token)
|
|
||||||
|
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
print('Logged on as', self.user)
|
print('Logged on as', self.user)
|
||||||
|
|
||||||
@ -55,12 +47,12 @@ class Discord_Module(discord.Client):
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
testModule = Discord_Module()
|
testModule = Discord_Module()
|
||||||
|
|
||||||
#credentials_manager = credentials.Credentials_Module()
|
credentials_manager = credentials.Credentials_Module()
|
||||||
#credentials_manager.load_credentials()
|
credentials_manager.load_credentials()
|
||||||
#testModule.dbCredential = credentials_manager.find_DB_Credential("praxis_bot")
|
testModule.dbCredential = credentials_manager.find_DB_Credential("praxis_bot")
|
||||||
#testModule.discordCredential = credentials_manager.find_Discord_Credential("praxis_bot")
|
testModule.discordCredential = credentials_manager.find_Discord_Credential("praxis_bot")
|
||||||
#testModule.main()
|
testModule.main()
|
||||||
|
|
||||||
testModule.alt_main()
|
testModule.main()
|
||||||
|
|
||||||
|
|
||||||
40
main.py
40
main.py
@ -18,31 +18,7 @@ credentials_manager: credentials.Credentials_Module
|
|||||||
discord_connection: discord_script.Discord_Module
|
discord_connection: discord_script.Discord_Module
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global twitch_chat
|
pass
|
||||||
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")
|
|
||||||
|
|
||||||
|
|
||||||
twitch_chat = twitch_script.Twitch_Module()
|
|
||||||
|
|
||||||
twitch_chat.db_manager.setup_engine(dbCert)
|
|
||||||
twitch_chat.twitchCredential = twitchCert
|
|
||||||
|
|
||||||
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):
|
def new_main(inputArg):
|
||||||
args = utility.get_args(inputArg)
|
args = utility.get_args(inputArg)
|
||||||
@ -57,10 +33,12 @@ def twitch_module_init(dbCert, twitchCert):
|
|||||||
twitch_chat.join_channel(None, "thecuriousnerd")
|
twitch_chat.join_channel(None, "thecuriousnerd")
|
||||||
|
|
||||||
|
|
||||||
def discord_module_init():
|
def discord_module_init(dbCert, discordCert):
|
||||||
#discord_connection = discord_script.Discord_Module()
|
#discord_connection = discord_script.Discord_Module()
|
||||||
|
discord_connection.dbCredential = dbCert
|
||||||
|
discord_connection.discordCredential = discordCert
|
||||||
|
|
||||||
discord_connection.alt_main()
|
discord_connection.main()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -75,6 +53,7 @@ def thread_main():
|
|||||||
credentials_manager.load_credentials()
|
credentials_manager.load_credentials()
|
||||||
dbCert: credentials.DB_Credential = credentials_manager.find_Credential(credentials.DB_Credential, "praxis_bot")
|
dbCert: credentials.DB_Credential = credentials_manager.find_Credential(credentials.DB_Credential, "praxis_bot")
|
||||||
twitchCert: credentials.Twitch_Credential = credentials_manager.find_Twitch_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 = []
|
threads = []
|
||||||
|
|
||||||
@ -83,15 +62,16 @@ def thread_main():
|
|||||||
twitch.start()
|
twitch.start()
|
||||||
|
|
||||||
discord_connection = discord_script.Discord_Module()
|
discord_connection = discord_script.Discord_Module()
|
||||||
discord = threading.Thread(target=discord_module_init)
|
discord = threading.Thread(target=discord_module_init, args=(dbCert, discordCert))
|
||||||
threads.append(discord)
|
threads.append(discord)
|
||||||
discord.start()
|
discord.start()
|
||||||
|
|
||||||
|
print("---Post Thread Creation Test---")
|
||||||
for t in threads:
|
for t in threads:
|
||||||
t.join()
|
t.join()
|
||||||
|
|
||||||
|
print("---Point of no return---")
|
||||||
print("Post Thread Test")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user