Working Version

This commit is contained in:
Alex Orid 2021-04-27 16:59:02 -04:00
parent 41afb81df0
commit 87492e625a
2 changed files with 13 additions and 6 deletions

View File

@ -18,13 +18,15 @@ class ChannelReward_Hydration_v2(AbstractChannelRewards, metaclass=ABCMeta):
self.isChannelRewardEnabled = True
def do_ChannelReward(self, source = AbstractChannelRewards.ChannelRewardsSource.default, user = "User", rewardName = "", rewardPrompt = "", userInput = "", bonusData = None):
self.dothething(user, "16", "lights hydration")
#print("sending:",user, 16, "!lights hydration")
self.dothething(user, 16, "!lights hydration", "")
return None
def dothething(self, username, light_group, command):
def dothething(self, username, light_group, command, rest):
# todo need to url-escape command and rest
params = urlencode({'user_name': username, 'light_group': light_group, 'command': command})
params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest})
#standalone_lights
url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params
resp = requests.get(url)
if resp.status_code == 200:

View File

@ -207,12 +207,16 @@ RGB_Lights = Lights_Module()
def init():
RGB_Lights.main()
def do_light_command(user="", lightGroup="all", command = "", rest = ""):
def do_lights_command(user="", lightGroup="all", command = "", rest = ""):
returnString = "None"
print("about to do something ......")
#bot.return_message("\nRGB Command Detected!")
if rest is not "":
tempFix = command + " " + rest
else:
pass
tempFix = command
tempParsedMessage = tempFix.split(" ")
sceneCommand = False
@ -275,7 +279,8 @@ def exec_lights():
return flask.make_response('{\"text\":"Argument \'scene_name\' not in request"}', 400)
print("about to do something ......")
return do_light_command(user_name, request.args['light_group'], request.args['command'], request.args['rest'])
RGB_Lights.main()
return do_lights_command(user_name, request.args['light_group'], request.args['command'], request.args['rest'])
if __name__ == "__main__":
init()