103 lines
3.0 KiB
Python
103 lines
3.0 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 discord_script
|
|
|
|
import test_module
|
|
|
|
import utilities_script as utility
|
|
import config as config
|
|
|
|
import credentials
|
|
|
|
import threading
|
|
|
|
twitchModule_: twitch_script.Twitch_Module
|
|
discordModule_: discord_script.Discord_Module
|
|
testModule_: test_module.Test_Module
|
|
|
|
credentials_manager: credentials.Credentials_Module
|
|
|
|
def main(inputArg):
|
|
args = utility.get_args(inputArg)
|
|
|
|
|
|
def twitch_module_init(dbCert, twitchCert):
|
|
print("-init [TWITCH Module]")
|
|
twitchModule_.db_manager.setup_engine(dbCert)
|
|
twitchModule_.twitchCredential = twitchCert
|
|
|
|
twitchModule_.tts_enabled = config.autoEnabled_TwitchChannelsTTS
|
|
twitchModule_.whitelisted_users = config.whitelisted_TwitchPowerUsers
|
|
|
|
for twitchChannel in config.autoJoin_TwitchChannels:
|
|
print("joining channel function")
|
|
twitchModule_.join_channel(None, twitchChannel)
|
|
|
|
def discord_module_init(dbCert, discordCert):
|
|
print("-init [DISCORD Module]")
|
|
discordModule_.dbCredential = dbCert
|
|
discordModule_.discordCredential = discordCert
|
|
|
|
discordModule_.tts_enabled = config.autoEnabled_DiscordChannelsTTS
|
|
|
|
for ttsChannel in config.selected_DiscordTTSChannels:
|
|
discordModule_.selected_ttsChannels.append(int(ttsChannel))
|
|
|
|
discordModule_.main()
|
|
|
|
def test_module_init(dbCert, Empty):
|
|
print("-init [TEST Module]")
|
|
#testModule_.dbCredential = dbCert
|
|
testModule_.main()
|
|
|
|
|
|
def thread_main():
|
|
global credentials_manager
|
|
global twitchModule_
|
|
global discordModule_
|
|
global testModule_
|
|
|
|
credentials_manager = credentials.Credentials_Module()
|
|
|
|
twitchModule_ = twitch_script.Twitch_Module()
|
|
discordModule_ = discord_script.Discord_Module()
|
|
testModule_ = test_module.Test_Module()
|
|
|
|
credentials_manager.load_credentials()
|
|
dbCert: credentials.DB_Credential = credentials_manager.find_Credential(credentials.DB_Credential, config.credentialsNickname)
|
|
|
|
threads = []
|
|
if config.twitch_module == True:
|
|
twitchCert: credentials.Twitch_Credential = credentials_manager.find_Twitch_Credential(config.credentialsNickname)
|
|
thread_ = threading.Thread(target=twitch_module_init, args=(dbCert, twitchCert))
|
|
threads.append(thread_)
|
|
thread_.start()
|
|
|
|
if config.discord_module == True:
|
|
discordCert: credentials.Discord_Credential = credentials_manager.find_Discord_Credential(config.credentialsNickname)
|
|
thread_ = threading.Thread(target=discord_module_init, args=(dbCert, discordCert))
|
|
threads.append(thread_)
|
|
thread_.start()
|
|
|
|
if config.test_module == True:
|
|
thread_ = threading.Thread(target=test_module_init, args=(dbCert, None))
|
|
threads.append(thread_)
|
|
thread_.start()
|
|
|
|
print("---Post Thread Creation Test---")
|
|
for t in threads:
|
|
t.join()
|
|
|
|
print("---Point of no return---")
|
|
input()
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
thread_main()
|