From 1b317282c5e8b577cc26b09ac994fa0026fe76d0 Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Wed, 7 Apr 2021 17:36:55 -0400 Subject: [PATCH] Added RGB Config Controls --- .../implemented/command_lights_rgb_color.py | 45 ++++++++++--------- config.py | 7 ++- twitch_script.py | 2 + 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/commands/implemented/command_lights_rgb_color.py b/commands/implemented/command_lights_rgb_color.py index 4fb3a51..bc5b6d4 100644 --- a/commands/implemented/command_lights_rgb_color.py +++ b/commands/implemented/command_lights_rgb_color.py @@ -17,27 +17,28 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta): super().__init__(CommandRoll.command, n_args=3, command_type=AbstractCommand.CommandType.TWITCH) def do_command(self, bot, twitch_message): - LightModule = lights_module.Lights_Module() - LightModule.main() - print("\nRGB Command Detected!") + if bot.allow_rgbLightControl == True: + LightModule = lights_module.Lights_Module() + LightModule.main() + print("\nRGB Command Detected!") - tempParsedMessage = twitch_message.text.split(" ") - print("\nParsed Command! ", twitch_message.text) - if (len(tempParsedMessage)) > 2: - print("\nRGB Command!") - rgb_r = float(tempParsedMessage[1]) - rgb_g = float(tempParsedMessage[2]) - rgb_b = float(tempParsedMessage[3]) - xy_result = LightModule.rgb_to_xy(rgb_r, rgb_g, rgb_b) - print("got XY") - LightModule.bridge_.set_group(16, "xy", xy_result) - print("sent color") - else: - print("\nColor Command!") - xy_result = LightModule.color_string_parser(tempParsedMessage) - print("got XY") - LightModule.bridge_.set_group(16, "xy", xy_result) - print("sent color") + tempParsedMessage = twitch_message.text.split(" ") + print("\nParsed Command! ", twitch_message.text) + if (len(tempParsedMessage)) > 2: + print("\nRGB Command!") + rgb_r = float(tempParsedMessage[1]) + rgb_g = float(tempParsedMessage[2]) + rgb_b = float(tempParsedMessage[3]) + xy_result = LightModule.rgb_to_xy(rgb_r, rgb_g, rgb_b) + print("got XY") + LightModule.bridge_.set_group(16, "xy", xy_result) + print("sent color") + else: + print("\nColor Command!") + xy_result = LightModule.color_string_parser(tempParsedMessage) + print("got XY") + LightModule.bridge_.set_group(16, "xy", xy_result) + print("sent color") - returnMessage = "@" + twitch_message.sender + " changed the light's color!" - bot.send_message(returnMessage) \ No newline at end of file + returnMessage = "@" + twitch_message.sender + " changed the light's color!" + bot.send_message(returnMessage) \ No newline at end of file diff --git a/config.py b/config.py index bce47c4..db465fd 100644 --- a/config.py +++ b/config.py @@ -11,7 +11,7 @@ test_module: bool = False 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 @@ -23,7 +23,9 @@ forceAll_TwitchChatChannelsTTS = False # forceAll supersedes the blockAll bool a blockAll_TTS_URL_Twitch = True +autoEnabled_Twitch_rgbLightControl = False +#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 @@ -37,6 +39,9 @@ forceAll_DiscordChatChannelsTTS = False # forceAll supersedes the blockAll bool blockAll_TTS_URL_Discord = True +autoEnabled_Discord_rgbLightControl = False + + skip_splashScreen = False skip_splashScreenClear = False diff --git a/twitch_script.py b/twitch_script.py index 9e16e6a..2c886f0 100644 --- a/twitch_script.py +++ b/twitch_script.py @@ -39,6 +39,8 @@ class Twitch_Module(): self.cooldownModule:Cooldown_Module = Cooldown_Module() self.cooldownModule.setupCooldown("twitchChat", 20, 32) + self.allow_rgbLightControl = config.autoEnabled_Twitch_rgbLightControl + def join_channel(self, credential: credentials.Twitch_Credential, channel_name:str): channel_name = "#" + channel_name print("Connecting to Channel: " + channel_name + "...")