Added RGB Config Controls

This commit is contained in:
Alex Orid 2021-04-07 17:36:55 -04:00
parent 7f1c991672
commit 1b317282c5
3 changed files with 31 additions and 23 deletions

View File

@ -17,27 +17,28 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta):
super().__init__(CommandRoll.command, n_args=3, command_type=AbstractCommand.CommandType.TWITCH) super().__init__(CommandRoll.command, n_args=3, command_type=AbstractCommand.CommandType.TWITCH)
def do_command(self, bot, twitch_message): def do_command(self, bot, twitch_message):
LightModule = lights_module.Lights_Module() if bot.allow_rgbLightControl == True:
LightModule.main() LightModule = lights_module.Lights_Module()
print("\nRGB Command Detected!") LightModule.main()
print("\nRGB Command Detected!")
tempParsedMessage = twitch_message.text.split(" ") tempParsedMessage = twitch_message.text.split(" ")
print("\nParsed Command! ", twitch_message.text) print("\nParsed Command! ", twitch_message.text)
if (len(tempParsedMessage)) > 2: if (len(tempParsedMessage)) > 2:
print("\nRGB Command!") print("\nRGB Command!")
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") print("got XY")
LightModule.bridge_.set_group(16, "xy", xy_result) LightModule.bridge_.set_group(16, "xy", xy_result)
print("sent color") print("sent color")
else: else:
print("\nColor Command!") print("\nColor Command!")
xy_result = LightModule.color_string_parser(tempParsedMessage) xy_result = LightModule.color_string_parser(tempParsedMessage)
print("got XY") print("got XY")
LightModule.bridge_.set_group(16, "xy", xy_result) LightModule.bridge_.set_group(16, "xy", xy_result)
print("sent color") print("sent color")
returnMessage = "@" + twitch_message.sender + " changed the light's color!" returnMessage = "@" + twitch_message.sender + " changed the light's color!"
bot.send_message(returnMessage) bot.send_message(returnMessage)

View File

@ -11,7 +11,7 @@ test_module: bool = False
autoJoin_TwitchChannels = ["thecuriousnerd"] autoJoin_TwitchChannels = ["thecuriousnerd"]
whitelisted_TwitchPowerUsers = ["thecuriousnerd"] whitelisted_TwitchPowerUsers = ["thecuriousnerd"]
#Twitch Module Configs
block_TwitchChannelsMessaging = [""] # Blocks the ability to send messages to twitch channels block_TwitchChannelsMessaging = [""] # Blocks the ability to send messages to twitch channels
blockAll_TwitchChatChannelsMessaging = False # Blocks the ability to send messages to twitch channels blockAll_TwitchChatChannelsMessaging = False # Blocks the ability to send messages to twitch channels
@ -23,7 +23,9 @@ forceAll_TwitchChatChannelsTTS = False # forceAll supersedes the blockAll bool a
blockAll_TTS_URL_Twitch = True blockAll_TTS_URL_Twitch = True
autoEnabled_Twitch_rgbLightControl = False
#Discord Module Configs
block_DiscordChannelsMessaging = [""] # Blocks the ability to send messages to Discord channels block_DiscordChannelsMessaging = [""] # Blocks the ability to send messages to Discord channels
blockAll_DiscordChannelsMessaging = False # Blocks the ability to send messages to Discord channels blockAll_DiscordChannelsMessaging = False # Blocks the ability to send messages to Discord channels
blockAll_DiscordPrivateMessaging = False # Private Messaging not yet implemented blockAll_DiscordPrivateMessaging = False # Private Messaging not yet implemented
@ -37,6 +39,9 @@ forceAll_DiscordChatChannelsTTS = False # forceAll supersedes the blockAll bool
blockAll_TTS_URL_Discord = True blockAll_TTS_URL_Discord = True
autoEnabled_Discord_rgbLightControl = False
skip_splashScreen = False skip_splashScreen = False
skip_splashScreenClear = False skip_splashScreenClear = False

View File

@ -39,6 +39,8 @@ class Twitch_Module():
self.cooldownModule:Cooldown_Module = Cooldown_Module() self.cooldownModule:Cooldown_Module = Cooldown_Module()
self.cooldownModule.setupCooldown("twitchChat", 20, 32) self.cooldownModule.setupCooldown("twitchChat", 20, 32)
self.allow_rgbLightControl = config.autoEnabled_Twitch_rgbLightControl
def join_channel(self, credential: credentials.Twitch_Credential, channel_name:str): def join_channel(self, credential: credentials.Twitch_Credential, channel_name:str):
channel_name = "#" + channel_name channel_name = "#" + channel_name
print("Connecting to Channel: " + channel_name + "...") print("Connecting to Channel: " + channel_name + "...")