diff --git a/commands/implemented/Command_lights_v2.py b/commands/implemented/Command_lights_v2.py new file mode 100644 index 0000000..ccde22b --- /dev/null +++ b/commands/implemented/Command_lights_v2.py @@ -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 \ No newline at end of file diff --git a/commands/implemented/Command_roll_v2.py b/commands/implemented/Command_roll_v2.py index d8928f1..a174567 100644 --- a/commands/implemented/Command_roll_v2.py +++ b/commands/implemented/Command_roll_v2.py @@ -5,14 +5,14 @@ from commands.command_base import AbstractCommand import random import utilities_script as utility -class Command_test_v2(AbstractCommand, metaclass=ABCMeta): +class Command_roll_v2(AbstractCommand, metaclass=ABCMeta): """ this is the test command. """ command = "!roll" 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.", "\nExample:","roll \"d20\"", "roll \"1D20+5\"", "roll \"10df\"", "roll \"10Df+3\""] self.isCommandEnabled = True diff --git a/webSource_standalone.py b/webSource_standalone.py new file mode 100644 index 0000000..54a7dce --- /dev/null +++ b/webSource_standalone.py @@ -0,0 +1,65 @@ +from enum import Enum +from os import F_OK +import tempText_Module +import time +import config as config +import db +import tts +import threading + +from flask import Flask + +import credentials + +import commands.loader as command_loader +from commands.command_base import AbstractCommand + +from cooldowns import Cooldown_Module + +import utilities_script as utility + +import chyron_module + +class webSource_Module(): + webSources:Flask = Flask('webSources') + + def __init__(self): + super().__init__() + self.dbCredential: credentials.DB_Credential + + def main(self, port_=5000): + print("starting up on port: ", port_) + self.webSources.run(host="0.0.0.0", port= port_) + + @webSources.route('/') + def hello_world(): + return 'I can see your Ghost!' + + @webSources.route('/chyron') + def textSource_chyron(): + tempModule = chyron_module.Chyron_Module() + return tempModule.getChyronFile() + + @webSources.route('/temptext//') + def textSource_tempText(filename): + print("trying file: ", filename) + tempModule = tempText_Module.tempText_Module() + return tempModule.getTempTextFile(filename) + + + +if __name__ == "__main__": + testModule = webSource_Module() + testModule_2 = webSource_Module() + threads = [] + + #credentials_manager = credentials.Credentials_Module() + #credentials_manager.load_credentials() + #testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname) + + thread_ = threading.Thread(target=testModule.main(port_=5000)) + threads.append(thread_) + thread_.start() + + for t in threads: + t.join() \ No newline at end of file