Compare commits
No commits in common. "b519a507025bec8fe03e58ec352bad8b820278da" and "0e4d2455bb4e8da6c6469c55584ce45a217f20c8" have entirely different histories.
b519a50702
...
0e4d2455bb
@ -11,7 +11,7 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta):
|
|||||||
"""
|
"""
|
||||||
this is the roll command.
|
this is the roll command.
|
||||||
"""
|
"""
|
||||||
command = "!lights"
|
command = "!rgb"
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(CommandRoll.command, n_args=3, command_type=AbstractCommand.CommandType.TWITCH)
|
super().__init__(CommandRoll.command, n_args=3, command_type=AbstractCommand.CommandType.TWITCH)
|
||||||
@ -19,25 +19,21 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta):
|
|||||||
def do_command(self, bot, twitch_message):
|
def do_command(self, bot, twitch_message):
|
||||||
LightModule = lights_module.Lights_Module()
|
LightModule = lights_module.Lights_Module()
|
||||||
LightModule.main()
|
LightModule.main()
|
||||||
print("\nRGB Command Detected!")
|
|
||||||
|
|
||||||
tempParsedMessage = twitch_message.text.split(" ")
|
tempParsedMessage = twitch_message.text.split(" ")
|
||||||
print("\nParsed Command! ", twitch_message.text)
|
|
||||||
if (len(tempParsedMessage)) > 2:
|
run_lightsCommand = False
|
||||||
print("\nRGB Command!")
|
if (utilities.does_contain_OnlyNumbers(tempParsedMessage[1]) &
|
||||||
|
utilities.does_contain_OnlyNumbers(tempParsedMessage[2]) &
|
||||||
|
utilities.does_contain_OnlyNumbers(tempParsedMessage[3])) == True:
|
||||||
rgb_r = float(tempParsedMessage[1])
|
rgb_r = float(tempParsedMessage[1])
|
||||||
rgb_g = float(tempParsedMessage[2])
|
rgb_g = float(tempParsedMessage[2])
|
||||||
rgb_b = float(tempParsedMessage[3])
|
rgb_b = float(tempParsedMessage[3])
|
||||||
xy_result = LightModule.rgb_to_xy(rgb_r, rgb_g, rgb_b)
|
xy_result = LightModule.rgb_to_xy(rgb_r, rgb_g, rgb_b)
|
||||||
print("got XY")
|
|
||||||
LightModule.bridge_.set_group(16, "xy", xy_result)
|
LightModule.bridge_.set_group(16, "xy", xy_result)
|
||||||
print("sent color")
|
|
||||||
else:
|
else:
|
||||||
print("\nColor Command!")
|
|
||||||
xy_result = LightModule.color_string_parser(tempParsedMessage)
|
xy_result = LightModule.color_string_parser(tempParsedMessage)
|
||||||
print("got XY")
|
|
||||||
LightModule.bridge_.set_group(16, "xy", xy_result)
|
LightModule.bridge_.set_group(16, "xy", xy_result)
|
||||||
print("sent color")
|
|
||||||
|
|
||||||
returnMessage = "@" + twitch_message.sender + " changed the colors!"
|
returnMessage = "@" + twitch_message.sender + " changed the colors!"
|
||||||
bot.send_message(returnMessage)
|
bot.send_message(returnMessage)
|
||||||
@ -25,24 +25,22 @@ class Lights_Module():
|
|||||||
|
|
||||||
print("\n -Listing Lights...")
|
print("\n -Listing Lights...")
|
||||||
for l in light_list:
|
for l in light_list:
|
||||||
pass
|
print(l.name)
|
||||||
#print(l.name)
|
|
||||||
print("\n -Counting Groups...")
|
print("\n -Counting Groups...")
|
||||||
for g in groups:
|
for g in groups:
|
||||||
#print(g)
|
print(g)
|
||||||
groupCount = int(g)
|
groupCount = int(g)
|
||||||
|
|
||||||
|
|
||||||
for gc in range(groupCount):
|
for gc in range(groupCount):
|
||||||
try:
|
try:
|
||||||
#print("group n:" + str(gc))
|
print("group n:" + str(gc))
|
||||||
group = self.bridge_.get_group(gc ,'name')
|
group = self.bridge_.get_group(gc ,'name')
|
||||||
#print(group)
|
print(group)
|
||||||
group_list.append(group)
|
#group_list.append(group)
|
||||||
#print(" --done adding")
|
print(" --done adding")
|
||||||
except:
|
except:
|
||||||
pass
|
print(" --adding failed")
|
||||||
#print(" --adding failed")
|
|
||||||
|
|
||||||
#self.bridge_.set_group(18, "bri", 254) #This is max Brightness
|
#self.bridge_.set_group(18, "bri", 254) #This is max Brightness
|
||||||
#self.bridge_.set_group(18, "on", True) #This is will turn ON
|
#self.bridge_.set_group(18, "on", True) #This is will turn ON
|
||||||
@ -58,7 +56,7 @@ class Lights_Module():
|
|||||||
#self.bridge_.set_group(16, "xy", xy_result)
|
#self.bridge_.set_group(16, "xy", xy_result)
|
||||||
#sleep(0.1)
|
#sleep(0.1)
|
||||||
|
|
||||||
#for stuffz in self.bridge_.scenes:
|
#for stuffz in .bridge_.scenes:
|
||||||
#print(stuffz)
|
#print(stuffz)
|
||||||
|
|
||||||
# This will set the group Downstairs to the Stream scene
|
# This will set the group Downstairs to the Stream scene
|
||||||
@ -106,18 +104,13 @@ class Lights_Module():
|
|||||||
return [x, y]
|
return [x, y]
|
||||||
|
|
||||||
def color_string_parser(self, message):
|
def color_string_parser(self, message):
|
||||||
print("trying to find color")
|
xy_color = 0
|
||||||
xy_color = [0, 0]
|
|
||||||
for text in message:
|
for text in message:
|
||||||
print("testing word")
|
if "red" in message.lower():
|
||||||
if "red" in text.lower():
|
|
||||||
xy_color = self.rgb_to_xy(1,0,0)
|
xy_color = self.rgb_to_xy(1,0,0)
|
||||||
print("found: red")
|
if "blue" in message.lower():
|
||||||
if "blue" in text.lower():
|
|
||||||
print("found: blue")
|
|
||||||
xy_color = self.rgb_to_xy(0,0,1)
|
xy_color = self.rgb_to_xy(0,0,1)
|
||||||
if "green" in text.lower():
|
if "green" in message.lower():
|
||||||
print("found: green")
|
|
||||||
xy_color = self.rgb_to_xy(0,1,0)
|
xy_color = self.rgb_to_xy(0,1,0)
|
||||||
|
|
||||||
return xy_color
|
return xy_color
|
||||||
|
|||||||
@ -21,18 +21,14 @@ def get_args(text: str) -> list:
|
|||||||
return text.split(" ")
|
return text.split(" ")
|
||||||
|
|
||||||
def does_contain_OnlyNumbers(self, text):
|
def does_contain_OnlyNumbers(self, text):
|
||||||
isJustNumbers = False
|
isJustNumbers = False
|
||||||
print("checking numbers")
|
|
||||||
try:
|
|
||||||
for x in range(10):
|
for x in range(10):
|
||||||
if str(x) in str(text):
|
if str(x) in text:
|
||||||
isJustNumbers = True
|
isJustNumbers = True
|
||||||
else:
|
else:
|
||||||
isJustNumbers = False
|
isJustNumbers = False
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return isJustNumbers
|
return isJustNumbers
|
||||||
|
|
||||||
def contains_slur(self, input: str):
|
def contains_slur(self, input: str):
|
||||||
containsSlur: bool = False
|
containsSlur: bool = False
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user