diff --git a/commands/implemented/command_lights_rgb_color.py b/commands/implemented/command_lights_rgb_color.py index 0454f74..7606798 100644 --- a/commands/implemented/command_lights_rgb_color.py +++ b/commands/implemented/command_lights_rgb_color.py @@ -21,38 +21,47 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta): if tempBool == True: LightModule = lights_module.Lights_Module() LightModule.main() - print("\nRGB Command Detected!") + #print("\nRGB Command Detected!") tempParsedMessage = user_message.message.split(" ") - print("\nParsed Command! ", user_message.message) + sceneCommand = False if (len(tempParsedMessage)) > 2: - print("\nRGB Command!") + print("RGB 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") + #print("got XY") LightModule.bridge_.set_group(16, "xy", xy_result) - print("sent color") + print("sent color to [Lights_Module]") else: if "stream" in tempParsedMessage: + sceneCommand = True LightModule.bridge_.run_scene("Downstairs", "Stream") elif "normal" in tempParsedMessage: + sceneCommand = True LightModule.bridge_.run_scene("Downstairs", "Bright") elif "haxor" in tempParsedMessage: + sceneCommand = True LightModule.bridge_.run_scene("Downstairs", "hacker vibes") elif "off" in tempParsedMessage: + sceneCommand = True LightModule.bridge_.set_group("Downstairs", "on", False) elif "on" in tempParsedMessage: + sceneCommand = True LightModule.bridge_.set_group("Downstairs", "on", True) elif "ravemode" in tempParsedMessage: + sceneCommand = True LightModule.raveMode() else: - print("\nColor Command!") + print("Color Command!") xy_result = LightModule.color_string_parser(tempParsedMessage) - print("got XY") + #print("got XY") LightModule.bridge_.set_group(16, "xy", xy_result) - print("sent color") + print("sent color to [Lights_Module]") + + if sceneCommand == True: + print("Scene Command!") returnMessage = "@" + user_message.user + " changed the light's color!" bot.return_message(returnMessage) \ No newline at end of file diff --git a/commands/implemented/command_lights_rgb_color_twitch.py b/commands/implemented/command_lights_rgb_color_twitch.py index 909ae16..a87ea3b 100644 --- a/commands/implemented/command_lights_rgb_color_twitch.py +++ b/commands/implemented/command_lights_rgb_color_twitch.py @@ -17,41 +17,51 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta): super().__init__(CommandRoll.command, n_args=3, command_type=AbstractCommand.CommandType.TWITCH) def do_command(self, bot, twitch_message): + if bot.allow_rgbLightControl == True: LightModule = lights_module.Lights_Module() LightModule.main() - print("\nRGB Command Detected!") + #print("\nRGB Command Detected!") tempParsedMessage = twitch_message.text.split(" ") - print("\nParsed Command! ", twitch_message.text) + sceneCommand = False if (len(tempParsedMessage)) > 2: - print("\nRGB Command!") + print("RGB 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") + #print("got XY") LightModule.bridge_.set_group(16, "xy", xy_result) - print("sent color") + print("sent color to [Lights_Module]") else: if "stream" in tempParsedMessage: + sceneCommand = True LightModule.bridge_.run_scene("Downstairs", "Stream") elif "normal" in tempParsedMessage: + sceneCommand = True LightModule.bridge_.run_scene("Downstairs", "Bright") elif "haxor" in tempParsedMessage: + sceneCommand = True LightModule.bridge_.run_scene("Downstairs", "hacker vibes") elif "off" in tempParsedMessage: + sceneCommand = True LightModule.bridge_.set_group("Downstairs", "on", False) elif "on" in tempParsedMessage: + sceneCommand = True LightModule.bridge_.set_group("Downstairs", "on", True) elif "ravemode" in tempParsedMessage: + sceneCommand = True LightModule.raveMode() else: - print("\nColor Command!") + print("Color Command!") xy_result = LightModule.color_string_parser(tempParsedMessage) - print("got XY") + #print("got XY") LightModule.bridge_.set_group(16, "xy", xy_result) - print("sent color") + print("sent color to [Lights_Module]") + + if sceneCommand == True: + print("Scene Command!") 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 a0a077a..53e8eec 100644 --- a/config.py +++ b/config.py @@ -44,6 +44,11 @@ autoEnabled_Discord_rgbLightControl = False #Chyron Module Configs chyronListSpaceCount = 25 + +#Lights Module Configs +colorParse_maxDigits = 4 + + #General Configs skip_splashScreen = False skip_splashScreenClear = False diff --git a/lights_module.py b/lights_module.py index 63a366b..4fb9d08 100644 --- a/lights_module.py +++ b/lights_module.py @@ -14,7 +14,7 @@ class Lights_Module(): self.bridge_:Bridge = Bridge('192.168.191.146') def main(self): - print("Starting up Lights_Modules....") + print("Starting up [Lights_Module]...") self.bridge_.connect() self.bridge_.get_api() @@ -24,11 +24,11 @@ class Lights_Module(): groups = self.bridge_.get_group() groupCount = 0 - print("\n -Listing Lights...") + #print("\n -Listing Lights...") for l in light_list: pass #print(l.name) - print("\n -Counting Groups...") + #print("\n -Counting Groups...") for g in groups: #print(g) groupCount = int(g) @@ -65,7 +65,7 @@ class Lights_Module(): # This will set the group Downstairs to the Stream scene #self.bridge_.run_scene("Downstairs", "Stream") - print("\n Setup Complete") + print("-[Lights_Module] Setup Complete") def setLight(): pass @@ -117,23 +117,23 @@ class Lights_Module(): return [x, y] def color_string_parser(self, message): - maxDigits = 4 - print("trying to find color") + maxDigits = config.colorParse_maxDigits + print("Searching for color...") xy_color = [0, 0] for text in message: #print("testing word") if "red" in text.lower(): xy_color = self.rgb_to_xy(1,0,0) - print("found: red") + print("-found: red") if "blue" in text.lower(): - print("found: blue") + print("-found: blue") xy_color = self.rgb_to_xy(0,0,1) if "green" in text.lower(): - print("found: green") + print("-found: green") xy_color = self.rgb_to_xy(0,1,0) if "yellow" in text.lower(): - print("found: yellow") + print("-found: yellow") xy_color = self.rgb_to_xy( 0.7, 0.64, @@ -141,23 +141,23 @@ class Lights_Module(): if "cyan" in text.lower(): - print("found: cyan") + print("-found: cyan") xy_color = self.rgb_to_xy(0,1,1) if "aquamarine" in text.lower(): - print("found: aquamarine") + print("-found: aquamarine") xy_color = self.rgb_to_xy( round(utilities.rescale_value(111,0,254),maxDigits), round(utilities.rescale_value(218,0,254),maxDigits), round(utilities.rescale_value(146,0,254),maxDigits)) if "turquoise" in text.lower(): - print("found: turquoise") + print("-found: turquoise") xy_color = self.rgb_to_xy( round(utilities.rescale_value(172,0,254),maxDigits), round(utilities.rescale_value(233,0,254),maxDigits), round(utilities.rescale_value(232,0,254),maxDigits)) if "orange" in text.lower(): - print("found: orange") + print("-found: orange") xy_color = self.rgb_to_xy( 1, round(utilities.rescale_value(126,0,254),maxDigits), @@ -165,21 +165,21 @@ class Lights_Module(): if "magenta" in text.lower(): - print("found: magenta") + print("-found: magenta") xy_color = self.rgb_to_xy( 1, 0, 1) if "purple" in text.lower(): - print("found: purple") + print("-found: purple") xy_color = self.rgb_to_xy( round(utilities.rescale_value(159,0,254),maxDigits), round(utilities.rescale_value(32,0,254),maxDigits), round(utilities.rescale_value(239,0,254),maxDigits)) if "violet" in text.lower(): - print("found: violet") + print("-found: violet") xy_color = self.rgb_to_xy( round(utilities.rescale_value(237,0,254),maxDigits), round(utilities.rescale_value(129,0,254),maxDigits),