diff --git a/config_default.py b/config_default.py new file mode 100644 index 0000000..86b0f8b --- /dev/null +++ b/config_default.py @@ -0,0 +1,159 @@ +from enum import Enum +import badwords as badwords + +class Config_Default(): + configName= "default" + credentialsNickname = "praxis_bot" + + twitch_module: bool = False + discord_module: bool = False + test_module: bool = False + user_module: bool = True + + autoJoin_TwitchChannels = ["thecuriousnerd"] + whitelisted_TwitchPowerUsers = ["thecuriousnerd"] + + #Twitch Module Configs + block_TwitchChannelsMessaging = [""] # Blocks the ability to send messages to twitch channels + blockAll_TwitchChatChannelsMessaging = False # Blocks the ability to send messages to twitch channels + + autoEnabled_TwitchChannelsTTS = False + block_TwitchChannelsTTS = [""] # block supersedes the tts_enabled bool + blockAll_TwitchChatChannelsTTS = False # blockAll supersedes the force bool and force list and tts_enabled bool + force_TwitchChannelsTTS = [""] # force supersedes the block list + forceAll_TwitchChatChannelsTTS = False # forceAll supersedes the blockAll bool and block list and force list + + blockAll_TTS_URL_Twitch = True + + autoEnabled_Twitch_rgbLightControl = False + + twitch_defaultCommandEnabledState = True + #twitch_defaultCommandEnabledState_liveStreamOnly = True # If true this will make commands only available during live streams. + + #Discord Module Configs + block_DiscordChannelsMessaging = [""] # Blocks the ability to send messages to Discord channels + blockAll_DiscordChannelsMessaging = False # Blocks the ability to send messages to Discord channels + blockAll_DiscordPrivateMessaging = False # Private Messaging not yet implemented + + autoEnabled_DiscordChannelsTTS = False + selected_DiscordTTSChannels = ["431129571308339210"] + block_DiscordChannelsTTS = [""] # block supersedes the tts_enabled bool + blockAll_DiscordChannelsTTS = False # blockAll supersedes the force bool and force list and tts_enabled bool + force_DiscordChannelsTTS = [""] # force supersedes the block list + forceAll_DiscordChatChannelsTTS = False # forceAll supersedes the blockAll bool and block list and force list + + blockAll_TTS_URL_Discord = True + + autoEnabled_Discord_rgbLightControl = False + + #discord_defaultCommandEnabledState = True + #discord_defaultCommandEnabledState_liveStreamOnly = True # If true this will make commands only available during live streams. + + #User Module Configs + blockAll_TTS_URL_UserModule = True + + #Chyron Module Configs + chyronListSpaceCount = 25 + + #Lights Module Configs + colorParse_maxDigits = 4 + + + #General Configs + skip_splashScreen = False + skip_splashScreenClear = False + skip_splashScreenSleep = False + + botList = ("Nightbot", "StreamElements", "Moobot", "Praxis Bot", "praxis_bot", "MEE6 +", "Nerdy", "Rythm", "Groovy") + + class FileNameStrategy(Enum): + TIME_BASED = 1 + CONTENT_BASED = 2 + + fileNameStrategy = FileNameStrategy.CONTENT_BASED + + + class DBStrategy(Enum): + SQLite = 1 + MySQL = 2 + + dbStrategy = DBStrategy.SQLite + + + #TTS Configs + class Speaker(Enum): + GOOGLE_TEXT_TO_SPEECH = 1 + STREAMLABS_API = 2 + + currentSpeaker = Speaker.GOOGLE_TEXT_TO_SPEECH + + class PollyVoices(Enum): + Aditi = "Aditi" + Amy = "Amy" + Astrid = "Astrid" + Bianca = "Bianca" + Brian = "Brian" + Camila = "Camila" + Carla = "Carla" + Carmen = "Carmen" + Celine = "Celine" + Chantal = "Chantal" + Conchita = "Conchita" + Cristiano = "Cristiano" + Dora = "Dora" + Emma = "Emma" + Enrique = "Enrique" + Ewa = "Ewa" + Filiz = "Filiz" + Geraint = "Geraint" + Giorgio = "Giorgio" + Gwyneth = "Gwyneth" + Hans = "Hans" + Ines = "Ines" + Ivy = "Ivy" + Jacek = "Jacek" + Jan = "Jan" + Joanna = "Joanna" + Joey = "Joey" + Justin = "Justin" + Karl = "Karl" + Kendra = "Kendra" + Kimberly = "Kimberly" + Lea = "Lea" + Liv = "Liv" + Lotte = "Lotte" + Lucia = "Lucia" + Lupe = "Lupe" + Mads = "Mads" + Maja = "Maja" + Marlene = "Marlene" + Mathieu = "Mathieu" + Matthew = "Matthew" + Maxim = "Maxim" + Mia = "Mia" + Miguel = "Miguel" + Mizuki = "Mizuki" + Naja = "Naja" + Nicole = "Nicole" + Penelope = "Penelope" + Raveena = "Raveena" + Ricardo = "Ricardo" + Ruben = "Ruben" + Russell = "Russell" + Salli = "Salli" + Seoyeon = "Seoyeon" + Takumi = "Takumi" + Tatyana = "Tatyana" + Vicki = "Vicki" + Vitoria = "Vitoria" + Zeina = "Zeina" + Zhiyu = "Zhiyu" + + PollyVoice = PollyVoices.Justin + + #Misc Configs + slurList = badwords.slurList + + praxisVersion_Alpha = "A.0 " + praxisVersion_Delta = "D.1 " + praxisVersion_Omega = "O.0 " diff --git a/config_management_module.py b/config_management_module.py index c9aa91c..b646906 100644 --- a/config_management_module.py +++ b/config_management_module.py @@ -3,19 +3,34 @@ import credentials import config +import config_default + +import json +import inspect + import utilities_script as utilities class Config_Management_Module(): def __init__(self): super().__init__() self.configNames = ['config.py'] + self.config = Config_Wrap() - def main(self): + def mainTest(self): print("[Config Management Module]> test") - print(self.doesConfigExist("twitch_module")) - self.editConfig('twitch_module: bool = False', 'twitch_module: bool = True') + #print(self.doesConfigExist("twitch_module")) + #self.editConfig('twitch_module: bool = False', 'twitch_module: bool = True') + #test = config_default.Config_Default() + test = {1:2, 3:4, 5:6, 7:8, 987:{1:2, 3:4, 5:6, 7:8}} + print(self.tempFunc(test)) + testConfig = Config_Wrap() + testConfig.currentConfig.loadConfig_Default() - def changeConfig(self, configName): + def tempFunc(self, configtext): + #return json.dump(configtext, "") + return json.dumps(self, default=lambda o:configtext, sort_keys=True, indent=4) + + def main(): pass def doesConfigExist(self, configName): @@ -23,12 +38,35 @@ class Config_Management_Module(): return doesExist - def editConfig(self, configName, newVar): - massedit.edit_files(self.configNames, ["re.sub('" + configName + "','" + newVar + "', line)"]) +class Config_Wrap(): + def __init__(self): + super().__init__() + self.currentConfig = Config() + +class Config(): + def __init__(self): + super().__init__() + self.name = "default_config" + self.data = {} + + def getConfig(self): + pass + + def setConfig(self): + pass + + def loadConfig(self): + pass + + def loadConfig_Default(self): + tempConfig = config_default.Config_Default() + for obj in inspect.getmembers(tempConfig): + print(obj) + if __name__ == "__main__": testModule = Config_Management_Module() - testModule.main() \ No newline at end of file + testModule.mainTest() \ No newline at end of file diff --git a/discord_script.py b/discord_script.py index bba7c16..7ffb524 100644 --- a/discord_script.py +++ b/discord_script.py @@ -46,6 +46,11 @@ class Discord_Module(discord.Client): async def startup(self): await self.start(self.discordCredential.token) + + async def shutdown(self): + await self.close() + await self.loop.stop() + def main(self): print("starting loop") self.loop.create_task(self.startup())