Working Version
This commit is contained in:
parent
41afb81df0
commit
87492e625a
@ -18,13 +18,15 @@ class ChannelReward_Hydration_v2(AbstractChannelRewards, metaclass=ABCMeta):
|
|||||||
self.isChannelRewardEnabled = True
|
self.isChannelRewardEnabled = True
|
||||||
|
|
||||||
def do_ChannelReward(self, source = AbstractChannelRewards.ChannelRewardsSource.default, user = "User", rewardName = "", rewardPrompt = "", userInput = "", bonusData = None):
|
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
|
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
|
# 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
|
url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params
|
||||||
resp = requests.get(url)
|
resp = requests.get(url)
|
||||||
if resp.status_code == 200:
|
if resp.status_code == 200:
|
||||||
|
|||||||
@ -207,12 +207,16 @@ RGB_Lights = Lights_Module()
|
|||||||
def init():
|
def init():
|
||||||
RGB_Lights.main()
|
RGB_Lights.main()
|
||||||
|
|
||||||
def do_light_command(user="", lightGroup="all", command = "", rest = ""):
|
def do_lights_command(user="", lightGroup="all", command = "", rest = ""):
|
||||||
returnString = "None"
|
returnString = "None"
|
||||||
print("about to do something ......")
|
print("about to do something ......")
|
||||||
|
|
||||||
#bot.return_message("\nRGB Command Detected!")
|
#bot.return_message("\nRGB Command Detected!")
|
||||||
|
if rest is not "":
|
||||||
tempFix = command + " " + rest
|
tempFix = command + " " + rest
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
tempFix = command
|
||||||
|
|
||||||
tempParsedMessage = tempFix.split(" ")
|
tempParsedMessage = tempFix.split(" ")
|
||||||
sceneCommand = False
|
sceneCommand = False
|
||||||
@ -275,7 +279,8 @@ def exec_lights():
|
|||||||
return flask.make_response('{\"text\":"Argument \'scene_name\' not in request"}', 400)
|
return flask.make_response('{\"text\":"Argument \'scene_name\' not in request"}', 400)
|
||||||
|
|
||||||
print("about to do something ......")
|
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__":
|
if __name__ == "__main__":
|
||||||
init()
|
init()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user