Added v2 lights
This commit is contained in:
parent
44f66ae9e3
commit
0e1dc8b05b
75
commands/implemented/Command_lights_v2.py
Normal file
75
commands/implemented/Command_lights_v2.py
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
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
|
||||||
@ -5,14 +5,14 @@ from commands.command_base import AbstractCommand
|
|||||||
import random
|
import random
|
||||||
import utilities_script as utility
|
import utilities_script as utility
|
||||||
|
|
||||||
class Command_test_v2(AbstractCommand, metaclass=ABCMeta):
|
class Command_roll_v2(AbstractCommand, metaclass=ABCMeta):
|
||||||
"""
|
"""
|
||||||
this is the test command.
|
this is the test command.
|
||||||
"""
|
"""
|
||||||
command = "!roll"
|
command = "!roll"
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(Command_test_v2.command, n_args=1, command_type=AbstractCommand.CommandType.Ver2)
|
super().__init__(Command_roll_v2.command, n_args=1, command_type=AbstractCommand.CommandType.Ver2)
|
||||||
self.help = ["This will roll dice, based on your inputs.",
|
self.help = ["This will roll dice, based on your inputs.",
|
||||||
"\nExample:","roll \"d20\"", "roll \"1D20+5\"", "roll \"10df\"", "roll \"10Df+3\""]
|
"\nExample:","roll \"d20\"", "roll \"1D20+5\"", "roll \"10df\"", "roll \"10Df+3\""]
|
||||||
self.isCommandEnabled = True
|
self.isCommandEnabled = True
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user