from abc import ABCMeta import lights_module from commands.command_base import AbstractCommand import utilities_script as utility class Command_lights_v2(AbstractCommand, metaclass=ABCMeta): """ this is the test command. """ command = "!lights" def __init__(self): super().__init__(Command_lights_v2.command, n_args=1, command_type=AbstractCommand.CommandType.Ver2) self.help = ["This command allows you to modify the lights via the Lights_Module.", "\nExample:","lights \"SCENE\"","lights \"COLOR\"","lights \"R\" \"G\" \"B\"","lights \"1\" \"0.5\" \"0\""] self.isCommandEnabled = True def do_command(self, source = AbstractCommand.CommandSource.default, user = "User", command = "", rest = "", bonusData = None): returnString = "" tempBool = True if tempBool == True: LightModule = lights_module.Lights_Module() LightModule.main() #bot.return_message("\nRGB Command Detected!") tempFix = command + " " + rest tempParsedMessage = tempFix.split(" ") sceneCommand = False if (len(tempParsedMessage)) > 2: #bot.return_message("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) #bot.return_message("got XY") LightModule.bridge_.set_group(16, "xy", xy_result) #bot.return_message("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: #bot.return_message("Color Command!") xy_result = LightModule.color_string_parser(tempParsedMessage) #bot.return_message("got XY") LightModule.bridge_.set_group(16, "xy", xy_result) #bot.return_message("sent color to [Lights_Module]") #if sceneCommand == True: #bot.return_message("Scene Command!") returnString = user + " changed the light's color!" return returnString def get_help(self): return self.help