diff --git a/commands/implemented/command_light_rgb_color.py b/commands/implemented/command_lights_rgb_color.py similarity index 75% rename from commands/implemented/command_light_rgb_color.py rename to commands/implemented/command_lights_rgb_color.py index 8177eae..aac049e 100644 --- a/commands/implemented/command_light_rgb_color.py +++ b/commands/implemented/command_lights_rgb_color.py @@ -11,7 +11,7 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta): """ this is the roll command. """ - command = "!rgb" + command = "!lights" def __init__(self): super().__init__(CommandRoll.command, n_args=3, command_type=AbstractCommand.CommandType.TWITCH) @@ -19,21 +19,25 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta): def do_command(self, bot, twitch_message): LightModule = lights_module.Lights_Module() LightModule.main() + print("\nRGB Command Detected!") tempParsedMessage = twitch_message.text.split(" ") - - run_lightsCommand = False - if (utilities.does_contain_OnlyNumbers(tempParsedMessage[1]) & - utilities.does_contain_OnlyNumbers(tempParsedMessage[2]) & - utilities.does_contain_OnlyNumbers(tempParsedMessage[3])) == True: + 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 colors!" bot.send_message(returnMessage) \ No newline at end of file diff --git a/lights_module.py b/lights_module.py index c8f1176..261c51a 100644 --- a/lights_module.py +++ b/lights_module.py @@ -106,13 +106,18 @@ class Lights_Module(): return [x, y] def color_string_parser(self, message): - xy_color = 0 + print("trying to find color") + xy_color = [0, 0] for text in message: - if "red" in message.lower(): + print("testing word") + if "red" in text.lower(): xy_color = self.rgb_to_xy(1,0,0) - if "blue" in message.lower(): + print("found: red") + if "blue" in text.lower(): + print("found: blue") xy_color = self.rgb_to_xy(0,0,1) - if "green" in message.lower(): + if "green" in text.lower(): + print("found: green") xy_color = self.rgb_to_xy(0,1,0) return xy_color diff --git a/utilities_script.py b/utilities_script.py index 4ce9b16..e62dc9d 100644 --- a/utilities_script.py +++ b/utilities_script.py @@ -21,14 +21,18 @@ def get_args(text: str) -> list: return text.split(" ") def does_contain_OnlyNumbers(self, text): - isJustNumbers = False + isJustNumbers = False + print("checking numbers") + try: for x in range(10): - if str(x) in text: + if str(x) in str(text): isJustNumbers = True - else: - isJustNumbers = False + else: + isJustNumbers = False + except: + pass - return isJustNumbers + return isJustNumbers def contains_slur(self, input: str): containsSlur: bool = False