Fully Working AFAIK
This commit is contained in:
parent
1d07fb449d
commit
2c6fd90a0e
@ -34,7 +34,7 @@ class ChannelReward_Hydration_v2(AbstractChannelRewards, metaclass=ABCMeta):
|
|||||||
data = loads(resp.text)
|
data = loads(resp.text)
|
||||||
msg = data['message']
|
msg = data['message']
|
||||||
if msg is not None:
|
if msg is not None:
|
||||||
pass
|
return msg
|
||||||
# todo send to logger and other relevent services
|
# todo send to logger and other relevent services
|
||||||
else:
|
else:
|
||||||
# todo handle failed requests
|
# todo handle failed requests
|
||||||
|
|||||||
@ -6,6 +6,7 @@ from json import loads
|
|||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
class Command_lights_v2(AbstractCommand, metaclass=ABCMeta):
|
class Command_lights_v2(AbstractCommand, metaclass=ABCMeta):
|
||||||
"""
|
"""
|
||||||
this is the test command.
|
this is the test command.
|
||||||
@ -20,8 +21,9 @@ class Command_lights_v2(AbstractCommand, metaclass=ABCMeta):
|
|||||||
|
|
||||||
def do_command(self, source = AbstractCommand.CommandSource.default, user = "User", command = "", rest = "", bonusData = None):
|
def do_command(self, source = AbstractCommand.CommandSource.default, user = "User", command = "", rest = "", bonusData = None):
|
||||||
returnString = ""
|
returnString = ""
|
||||||
|
print("\n Command>: " + command + rest)
|
||||||
|
|
||||||
returnString = self.dothething(user, 16, "!lights hydration", "")
|
returnString = self.dothething(user, 16, command, rest)
|
||||||
|
|
||||||
return returnString
|
return returnString
|
||||||
|
|
||||||
@ -40,7 +42,7 @@ class Command_lights_v2(AbstractCommand, metaclass=ABCMeta):
|
|||||||
# todo send to logger and other relevent services
|
# todo send to logger and other relevent services
|
||||||
else:
|
else:
|
||||||
# todo handle failed requests
|
# todo handle failed requests
|
||||||
pass
|
return None
|
||||||
|
|
||||||
def get_help(self):
|
def get_help(self):
|
||||||
return self.help
|
return self.help
|
||||||
@ -2,18 +2,6 @@ INFO:root:Application running!
|
|||||||
INFO:root:
|
INFO:root:
|
||||||
-Starting Logs: standalone_channelrewards.py
|
-Starting Logs: standalone_channelrewards.py
|
||||||
INFO:root:init stuff
|
INFO:root:init stuff
|
||||||
INFO:werkzeug: * Restarting with stat
|
|
||||||
INFO:root:Application running!
|
|
||||||
INFO:root:
|
|
||||||
-Starting Logs: standalone_channelrewards.py
|
|
||||||
INFO:root:init stuff
|
|
||||||
WARNING:werkzeug: * Debugger is active!
|
|
||||||
INFO:werkzeug: * Debugger PIN: 760-498-562
|
|
||||||
INFO:werkzeug: * Running on http://0.0.0.0:6969/ (Press CTRL+C to quit)
|
|
||||||
INFO:root:Application running!
|
|
||||||
INFO:root:
|
|
||||||
-Starting Logs: standalone_channelrewards.py
|
|
||||||
INFO:root:init stuff
|
|
||||||
INFO:werkzeug: * Running on http://0.0.0.0:6969/ (Press CTRL+C to quit)
|
INFO:werkzeug: * Running on http://0.0.0.0:6969/ (Press CTRL+C to quit)
|
||||||
INFO:werkzeug: * Restarting with stat
|
INFO:werkzeug: * Restarting with stat
|
||||||
INFO:root:Application running!
|
INFO:root:Application running!
|
||||||
@ -21,7 +9,26 @@ INFO:root:
|
|||||||
-Starting Logs: standalone_channelrewards.py
|
-Starting Logs: standalone_channelrewards.py
|
||||||
INFO:root:init stuff
|
INFO:root:init stuff
|
||||||
WARNING:werkzeug: * Debugger is active!
|
WARNING:werkzeug: * Debugger is active!
|
||||||
INFO:werkzeug: * Debugger PIN: 758-762-350
|
INFO:werkzeug: * Debugger PIN: 697-151-642
|
||||||
|
INFO:werkzeug:192.168.96.2 - - [28/Apr/2021 06:49:47] "[35m[1mGET /api/v1/reward?reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints HTTP/1.1[0m" 500 -
|
||||||
|
INFO:werkzeug: * Detected change in '/Praxis/channel_rewards/implemented/ChannelReward_Hydration.py', reloading
|
||||||
|
INFO:werkzeug: * Restarting with stat
|
||||||
|
INFO:root:Application running!
|
||||||
|
INFO:root:
|
||||||
|
-Starting Logs: standalone_channelrewards.py
|
||||||
|
INFO:root:init stuff
|
||||||
|
WARNING:werkzeug: * Debugger is active!
|
||||||
|
INFO:werkzeug: * Debugger PIN: 697-151-642
|
||||||
|
INFO:werkzeug:192.168.96.2 - - [28/Apr/2021 06:50:59] "[35m[1mGET /api/v1/reward?reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints HTTP/1.1[0m" 500 -
|
||||||
|
INFO:werkzeug: * Detected change in '/Praxis/channel_rewards/implemented/ChannelReward_Hydration.py', reloading
|
||||||
|
INFO:werkzeug: * Restarting with stat
|
||||||
|
INFO:root:Application running!
|
||||||
|
INFO:root:
|
||||||
|
-Starting Logs: standalone_channelrewards.py
|
||||||
|
INFO:root:init stuff
|
||||||
|
WARNING:werkzeug: * Debugger is active!
|
||||||
|
INFO:werkzeug: * Debugger PIN: 697-151-642
|
||||||
|
INFO:werkzeug:192.168.96.2 - - [28/Apr/2021 06:51:19] "[35m[1mGET /api/v1/reward?reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints HTTP/1.1[0m" 500 -
|
||||||
INFO:root:Application running!
|
INFO:root:Application running!
|
||||||
INFO:root:
|
INFO:root:
|
||||||
-Starting Logs: standalone_channelrewards.py
|
-Starting Logs: standalone_channelrewards.py
|
||||||
@ -33,6 +40,103 @@ INFO:root:
|
|||||||
-Starting Logs: standalone_channelrewards.py
|
-Starting Logs: standalone_channelrewards.py
|
||||||
INFO:root:init stuff
|
INFO:root:init stuff
|
||||||
WARNING:werkzeug: * Debugger is active!
|
WARNING:werkzeug: * Debugger is active!
|
||||||
INFO:werkzeug: * Debugger PIN: 181-543-254
|
INFO:werkzeug: * Debugger PIN: 697-151-642
|
||||||
INFO:werkzeug:192.168.48.7 - - [28/Apr/2021 04:44:07] "[35m[1mGET /api/v1/reward?reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints HTTP/1.1[0m" 500 -
|
INFO:werkzeug:192.168.96.2 - - [28/Apr/2021 06:52:54] "[35m[1mGET /api/v1/reward?reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints HTTP/1.1[0m" 500 -
|
||||||
INFO:werkzeug:192.168.48.7 - - [28/Apr/2021 04:44:13] "[35m[1mGET /api/v1/reward?reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints HTTP/1.1[0m" 500 -
|
INFO:werkzeug: * Detected change in '/Praxis/standalone_channelrewards.py', reloading
|
||||||
|
INFO:werkzeug: * Restarting with stat
|
||||||
|
INFO:root:Application running!
|
||||||
|
INFO:root:
|
||||||
|
-Starting Logs: standalone_channelrewards.py
|
||||||
|
INFO:root:init stuff
|
||||||
|
WARNING:werkzeug: * Debugger is active!
|
||||||
|
INFO:werkzeug: * Debugger PIN: 697-151-642
|
||||||
|
INFO:root:reward_name: Hydratereward_type: ChannelRewardsType.channelPoints
|
||||||
|
INFO:werkzeug:192.168.96.2 - - [28/Apr/2021 06:54:10] "[35m[1mGET /api/v1/reward?reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints HTTP/1.1[0m" 500 -
|
||||||
|
INFO:root:Application running!
|
||||||
|
INFO:root:
|
||||||
|
-Starting Logs: standalone_channelrewards.py
|
||||||
|
INFO:root:init stuff
|
||||||
|
INFO:werkzeug: * Running on http://0.0.0.0:6969/ (Press CTRL+C to quit)
|
||||||
|
INFO:werkzeug: * Restarting with stat
|
||||||
|
INFO:root:Application running!
|
||||||
|
INFO:root:
|
||||||
|
-Starting Logs: standalone_channelrewards.py
|
||||||
|
INFO:root:init stuff
|
||||||
|
WARNING:werkzeug: * Debugger is active!
|
||||||
|
INFO:werkzeug: * Debugger PIN: 697-151-642
|
||||||
|
INFO:root:reward_name: Hydratereward_type: ChannelRewardsType.channelPoints
|
||||||
|
INFO:werkzeug:192.168.96.2 - - [28/Apr/2021 06:54:21] "[35m[1mGET /api/v1/reward?reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints HTTP/1.1[0m" 500 -
|
||||||
|
INFO:werkzeug: * Detected change in '/Praxis/standalone_channelrewards.py', reloading
|
||||||
|
INFO:werkzeug: * Restarting with stat
|
||||||
|
INFO:root:Application running!
|
||||||
|
INFO:root:
|
||||||
|
-Starting Logs: standalone_channelrewards.py
|
||||||
|
INFO:root:init stuff
|
||||||
|
WARNING:werkzeug: * Debugger is active!
|
||||||
|
INFO:werkzeug: * Debugger PIN: 697-151-642
|
||||||
|
INFO:root:Application running!
|
||||||
|
INFO:root:
|
||||||
|
-Starting Logs: standalone_channelrewards.py
|
||||||
|
INFO:root:init stuff
|
||||||
|
INFO:werkzeug: * Running on http://0.0.0.0:6969/ (Press CTRL+C to quit)
|
||||||
|
INFO:werkzeug: * Restarting with stat
|
||||||
|
INFO:root:Application running!
|
||||||
|
INFO:root:
|
||||||
|
-Starting Logs: standalone_channelrewards.py
|
||||||
|
INFO:root:init stuff
|
||||||
|
WARNING:werkzeug: * Debugger is active!
|
||||||
|
INFO:werkzeug: * Debugger PIN: 697-151-642
|
||||||
|
INFO:werkzeug:192.168.96.2 - - [28/Apr/2021 06:55:05] "[35m[1mGET /api/v1/reward?reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints HTTP/1.1[0m" 500 -
|
||||||
|
INFO:werkzeug:192.168.96.2 - - [28/Apr/2021 06:57:43] "[35m[1mGET /api/v1/reward?reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints HTTP/1.1[0m" 500 -
|
||||||
|
INFO:werkzeug: * Detected change in '/Praxis/standalone_channelrewards.py', reloading
|
||||||
|
INFO:werkzeug: * Restarting with stat
|
||||||
|
INFO:root:Application running!
|
||||||
|
INFO:root:
|
||||||
|
-Starting Logs: standalone_channelrewards.py
|
||||||
|
INFO:root:init stuff
|
||||||
|
WARNING:werkzeug: * Debugger is active!
|
||||||
|
INFO:werkzeug: * Debugger PIN: 697-151-642
|
||||||
|
INFO:root:Application running!
|
||||||
|
INFO:root:
|
||||||
|
-Starting Logs: standalone_channelrewards.py
|
||||||
|
INFO:root:init stuff
|
||||||
|
INFO:werkzeug: * Running on http://0.0.0.0:6969/ (Press CTRL+C to quit)
|
||||||
|
INFO:werkzeug: * Restarting with stat
|
||||||
|
INFO:root:Application running!
|
||||||
|
INFO:root:
|
||||||
|
-Starting Logs: standalone_channelrewards.py
|
||||||
|
INFO:root:init stuff
|
||||||
|
WARNING:werkzeug: * Debugger is active!
|
||||||
|
INFO:werkzeug: * Debugger PIN: 697-151-642
|
||||||
|
INFO:root:Equal
|
||||||
|
INFO:root:about to send
|
||||||
|
INFO:werkzeug:192.168.96.2 - - [28/Apr/2021 06:59:26] "[37mGET /api/v1/reward?reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints HTTP/1.1[0m" 200 -
|
||||||
|
INFO:root:
|
||||||
|
About to try a reward
|
||||||
|
INFO:root:ChannelRewardsSource.Twitch
|
||||||
|
INFO:root:Hydrate
|
||||||
|
INFO:root:ChannelRewardsType.channelPoints
|
||||||
|
INFO:root:Make me take a sip of water
|
||||||
|
INFO:root:
|
||||||
|
INFO:root:{'type': 'reward-redeemed', 'data': {'timestamp': '2021-04-28T06:59:27.946826068Z', 'redemption': {'id': '72f37b3d-f01d-44e0-9f63-91d17243cbe7', 'user': {'id': '50897047', 'login': 'thecuriousnerd', 'display_name': 'TheCuriousNerd'}, 'channel_id': '50897047', 'redeemed_at': '2021-04-28T06:59:27.946826068Z', 'reward': {'id': '92c89d8c-cf01-45f6-89f4-5f07ad576882', 'channel_id': '50897047', 'title': 'Hydrate', 'prompt': 'Make me take a sip of water', 'cost': 50, 'is_user_input_required': False, 'is_sub_only': False, 'image': None, 'default_image': {'url_1x': 'https://static-cdn.jtvnw.net/custom-reward-images/tree-1.png', 'url_2x': 'https://static-cdn.jtvnw.net/custom-reward-images/tree-2.png', 'url_4x': 'https://static-cdn.jtvnw.net/custom-reward-images/tree-4.png'}, 'background_color': '#1C4592', 'is_enabled': True, 'is_paused': False, 'is_in_stock': True, 'max_per_stream': {'is_enabled': False, 'max_per_stream': 1}, 'should_redemptions_skip_request_queue': False, 'template_id': 'template:41d5eae8-4deb-4541-b681-ebdcb3125c0f', 'updated_for_indicator_at': '2020-07-02T23:46:33.40915846Z', 'max_per_user_per_stream': {'is_enabled': False, 'max_per_user_per_stream': 0}, 'global_cooldown': {'is_enabled': False, 'global_cooldown_seconds': 0}, 'redemptions_redeemed_current_stream': None, 'cooldown_expires_at': None}, 'status': 'UNFULFILLED'}}}
|
||||||
|
INFO:root:
|
||||||
|
trying to handle reward: Hydrate
|
||||||
|
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): standalone_lights:42069
|
||||||
|
DEBUG:urllib3.connectionpool:http://standalone_lights:42069 "GET /api/v1/exec_lights?user_name=TheCuriousNerd&light_group=16&command=%21lights+hydration&rest= HTTP/1.1" 200 55
|
||||||
|
INFO:werkzeug:192.168.96.2 - - [28/Apr/2021 06:59:28] "[37mGET /api/v1/exec_reward?reward_source=ChannelRewardsSource.Twitch&user_name=TheCuriousNerd&reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints&reward_prompt=Make+me+take+a+sip+of+water&user_input=&bonus_data=%7B%27type%27%3A+%27reward-redeemed%27%2C+%27data%27%3A+%7B%27timestamp%27%3A+%272021-04-28T06%3A59%3A27.946826068Z%27%2C+%27redemption%27%3A+%7B%27id%27%3A+%2772f37b3d-f01d-44e0-9f63-91d17243cbe7%27%2C+%27user%27%3A+%7B%27id%27%3A+%2750897047%27%2C+%27login%27%3A+%27thecuriousnerd%27%2C+%27display_name%27%3A+%27TheCuriousNerd%27%7D%2C+%27channel_id%27%3A+%2750897047%27%2C+%27redeemed_at%27%3A+%272021-04-28T06%3A59%3A27.946826068Z%27%2C+%27reward%27%3A+%7B%27id%27%3A+%2792c89d8c-cf01-45f6-89f4-5f07ad576882%27%2C+%27channel_id%27%3A+%2750897047%27%2C+%27title%27%3A+%27Hydrate%27%2C+%27prompt%27%3A+%27Make+me+take+a+sip+of+water%27%2C+%27cost%27%3A+50%2C+%27is_user_input_required%27%3A+False%2C+%27is_sub_only%27%3A+False%2C+%27image%27%3A+None%2C+%27default_image%27%3A+%7B%27url_1x%27%3A+%27https%3A%2F%2Fstatic-cdn.jtvnw.net%2Fcustom-reward-images%2Ftree-1.png%27%2C+%27url_2x%27%3A+%27https%3A%2F%2Fstatic-cdn.jtvnw.net%2Fcustom-reward-images%2Ftree-2.png%27%2C+%27url_4x%27%3A+%27https%3A%2F%2Fstatic-cdn.jtvnw.net%2Fcustom-reward-images%2Ftree-4.png%27%7D%2C+%27background_color%27%3A+%27%231C4592%27%2C+%27is_enabled%27%3A+True%2C+%27is_paused%27%3A+False%2C+%27is_in_stock%27%3A+True%2C+%27max_per_stream%27%3A+%7B%27is_enabled%27%3A+False%2C+%27max_per_stream%27%3A+1%7D%2C+%27should_redemptions_skip_request_queue%27%3A+False%2C+%27template_id%27%3A+%27template%3A41d5eae8-4deb-4541-b681-ebdcb3125c0f%27%2C+%27updated_for_indicator_at%27%3A+%272020-07-02T23%3A46%3A33.40915846Z%27%2C+%27max_per_user_per_stream%27%3A+%7B%27is_enabled%27%3A+False%2C+%27max_per_user_per_stream%27%3A+0%7D%2C+%27global_cooldown%27%3A+%7B%27is_enabled%27%3A+False%2C+%27global_cooldown_seconds%27%3A+0%7D%2C+%27redemptions_redeemed_current_stream%27%3A+None%2C+%27cooldown_expires_at%27%3A+None%7D%2C+%27status%27%3A+%27UNFULFILLED%27%7D%7D%7D HTTP/1.1[0m" 200 -
|
||||||
|
INFO:root:Equal
|
||||||
|
INFO:root:about to send
|
||||||
|
INFO:werkzeug:192.168.96.2 - - [28/Apr/2021 07:01:18] "[37mGET /api/v1/reward?reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints HTTP/1.1[0m" 200 -
|
||||||
|
INFO:root:
|
||||||
|
About to try a reward
|
||||||
|
INFO:root:ChannelRewardsSource.Twitch
|
||||||
|
INFO:root:Hydrate
|
||||||
|
INFO:root:ChannelRewardsType.channelPoints
|
||||||
|
INFO:root:Make me take a sip of water
|
||||||
|
INFO:root:
|
||||||
|
INFO:root:{'type': 'reward-redeemed', 'data': {'timestamp': '2021-04-28T07:01:19.498040456Z', 'redemption': {'id': 'a7a4ba13-c702-46b6-a2c3-60851a746eaa', 'user': {'id': '50897047', 'login': 'thecuriousnerd', 'display_name': 'TheCuriousNerd'}, 'channel_id': '50897047', 'redeemed_at': '2021-04-28T07:01:19.498040456Z', 'reward': {'id': '92c89d8c-cf01-45f6-89f4-5f07ad576882', 'channel_id': '50897047', 'title': 'Hydrate', 'prompt': 'Make me take a sip of water', 'cost': 50, 'is_user_input_required': False, 'is_sub_only': False, 'image': None, 'default_image': {'url_1x': 'https://static-cdn.jtvnw.net/custom-reward-images/tree-1.png', 'url_2x': 'https://static-cdn.jtvnw.net/custom-reward-images/tree-2.png', 'url_4x': 'https://static-cdn.jtvnw.net/custom-reward-images/tree-4.png'}, 'background_color': '#1C4592', 'is_enabled': True, 'is_paused': False, 'is_in_stock': True, 'max_per_stream': {'is_enabled': False, 'max_per_stream': 1}, 'should_redemptions_skip_request_queue': False, 'template_id': 'template:41d5eae8-4deb-4541-b681-ebdcb3125c0f', 'updated_for_indicator_at': '2020-07-02T23:46:33.40915846Z', 'max_per_user_per_stream': {'is_enabled': False, 'max_per_user_per_stream': 0}, 'global_cooldown': {'is_enabled': False, 'global_cooldown_seconds': 0}, 'redemptions_redeemed_current_stream': None, 'cooldown_expires_at': None}, 'status': 'UNFULFILLED'}}}
|
||||||
|
INFO:root:
|
||||||
|
trying to handle reward: Hydrate
|
||||||
|
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): standalone_lights:42069
|
||||||
|
DEBUG:urllib3.connectionpool:http://standalone_lights:42069 "GET /api/v1/exec_lights?user_name=TheCuriousNerd&light_group=16&command=%21lights+hydration&rest= HTTP/1.1" 200 55
|
||||||
|
INFO:werkzeug:192.168.96.2 - - [28/Apr/2021 07:01:19] "[37mGET /api/v1/exec_reward?reward_source=ChannelRewardsSource.Twitch&user_name=TheCuriousNerd&reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints&reward_prompt=Make+me+take+a+sip+of+water&user_input=&bonus_data=%7B%27type%27%3A+%27reward-redeemed%27%2C+%27data%27%3A+%7B%27timestamp%27%3A+%272021-04-28T07%3A01%3A19.498040456Z%27%2C+%27redemption%27%3A+%7B%27id%27%3A+%27a7a4ba13-c702-46b6-a2c3-60851a746eaa%27%2C+%27user%27%3A+%7B%27id%27%3A+%2750897047%27%2C+%27login%27%3A+%27thecuriousnerd%27%2C+%27display_name%27%3A+%27TheCuriousNerd%27%7D%2C+%27channel_id%27%3A+%2750897047%27%2C+%27redeemed_at%27%3A+%272021-04-28T07%3A01%3A19.498040456Z%27%2C+%27reward%27%3A+%7B%27id%27%3A+%2792c89d8c-cf01-45f6-89f4-5f07ad576882%27%2C+%27channel_id%27%3A+%2750897047%27%2C+%27title%27%3A+%27Hydrate%27%2C+%27prompt%27%3A+%27Make+me+take+a+sip+of+water%27%2C+%27cost%27%3A+50%2C+%27is_user_input_required%27%3A+False%2C+%27is_sub_only%27%3A+False%2C+%27image%27%3A+None%2C+%27default_image%27%3A+%7B%27url_1x%27%3A+%27https%3A%2F%2Fstatic-cdn.jtvnw.net%2Fcustom-reward-images%2Ftree-1.png%27%2C+%27url_2x%27%3A+%27https%3A%2F%2Fstatic-cdn.jtvnw.net%2Fcustom-reward-images%2Ftree-2.png%27%2C+%27url_4x%27%3A+%27https%3A%2F%2Fstatic-cdn.jtvnw.net%2Fcustom-reward-images%2Ftree-4.png%27%7D%2C+%27background_color%27%3A+%27%231C4592%27%2C+%27is_enabled%27%3A+True%2C+%27is_paused%27%3A+False%2C+%27is_in_stock%27%3A+True%2C+%27max_per_stream%27%3A+%7B%27is_enabled%27%3A+False%2C+%27max_per_stream%27%3A+1%7D%2C+%27should_redemptions_skip_request_queue%27%3A+False%2C+%27template_id%27%3A+%27template%3A41d5eae8-4deb-4541-b681-ebdcb3125c0f%27%2C+%27updated_for_indicator_at%27%3A+%272020-07-02T23%3A46%3A33.40915846Z%27%2C+%27max_per_user_per_stream%27%3A+%7B%27is_enabled%27%3A+False%2C+%27max_per_user_per_stream%27%3A+0%7D%2C+%27global_cooldown%27%3A+%7B%27is_enabled%27%3A+False%2C+%27global_cooldown_seconds%27%3A+0%7D%2C+%27redemptions_redeemed_current_stream%27%3A+None%2C+%27cooldown_expires_at%27%3A+None%7D%2C+%27status%27%3A+%27UNFULFILLED%27%7D%7D%7D HTTP/1.1[0m" 200 -
|
||||||
|
|||||||
@ -31,7 +31,7 @@ def is_reward(reward_name, reward_type) -> bool:
|
|||||||
#praxis_logger_obj.log(loadedRewards[realTempType])
|
#praxis_logger_obj.log(loadedRewards[realTempType])
|
||||||
|
|
||||||
for reward in loadedRewards[realTempType]:
|
for reward in loadedRewards[realTempType]:
|
||||||
praxis_logger_obj.log("found: ", reward, "type: ", type(reward))
|
#praxis_logger_obj.log("found: ", reward, "type: ", type(reward))
|
||||||
if reward_name == reward:
|
if reward_name == reward:
|
||||||
praxis_logger_obj.log("Equal")
|
praxis_logger_obj.log("Equal")
|
||||||
return True
|
return True
|
||||||
@ -45,6 +45,7 @@ def is_reward(reward_name, reward_type) -> bool:
|
|||||||
|
|
||||||
def handle_reward(source, username, reward_name, reward_type, rewardPrompt, userInput, bonusData):
|
def handle_reward(source, username, reward_name, reward_type, rewardPrompt, userInput, bonusData):
|
||||||
#reward:AbstractChannelRewards = loadedRewards[reward_name]
|
#reward:AbstractChannelRewards = loadedRewards[reward_name]
|
||||||
|
praxis_logger_obj.log("\n trying to handle reward: " + reward_name)
|
||||||
try:
|
try:
|
||||||
tempType = reward_type.replace('ChannelRewardsType.', '')
|
tempType = reward_type.replace('ChannelRewardsType.', '')
|
||||||
realTempType = AbstractChannelRewards.ChannelRewardsType.__dict__[tempType]
|
realTempType = AbstractChannelRewards.ChannelRewardsType.__dict__[tempType]
|
||||||
@ -53,14 +54,14 @@ def handle_reward(source, username, reward_name, reward_type, rewardPrompt, user
|
|||||||
reward_response = reward.do_ChannelReward(source, username, reward_name, rewardPrompt, userInput, bonusData)
|
reward_response = reward.do_ChannelReward(source, username, reward_name, rewardPrompt, userInput, bonusData)
|
||||||
return flask.make_response("{\"message\":\"%s\"}" % reward_response, 200, {"Content-Type": "application/json"})
|
return flask.make_response("{\"message\":\"%s\"}" % reward_response, 200, {"Content-Type": "application/json"})
|
||||||
except:
|
except:
|
||||||
return "None"
|
return flask.make_response("This is a magic test", 500)
|
||||||
#praxis_logger_obj.log("Doing a reward")
|
#praxis_logger_obj.log("Doing a reward")
|
||||||
|
|
||||||
|
|
||||||
@api.route('/api/v1/reward', methods=['GET'])
|
@api.route('/api/v1/reward', methods=['GET'])
|
||||||
def reward_check():
|
def reward_check():
|
||||||
if 'reward_name' in request.args and 'reward_type' in request.args:
|
if 'reward_name' in request.args and 'reward_type' in request.args:
|
||||||
praxis_logger_obj.log("reward_name:", request.args['reward_name'],"reward_type:", request.args['reward_type'])
|
#praxis_logger_obj.log("reward_name: "+ request.args['reward_name']+"reward_type: "+ request.args['reward_type'])
|
||||||
if is_reward(request.args['reward_name'], request.args['reward_type']):
|
if is_reward(request.args['reward_name'], request.args['reward_type']):
|
||||||
praxis_logger_obj.log("about to send")
|
praxis_logger_obj.log("about to send")
|
||||||
return flask.make_response('', 200)
|
return flask.make_response('', 200)
|
||||||
@ -73,7 +74,7 @@ def exec_reward():
|
|||||||
if 'reward_name' not in request.args:
|
if 'reward_name' not in request.args:
|
||||||
return flask.make_response('{\"text\":"Argument \'reward_name\' not in request"}', 400)
|
return flask.make_response('{\"text\":"Argument \'reward_name\' not in request"}', 400)
|
||||||
if 'reward_type' not in request.args:
|
if 'reward_type' not in request.args:
|
||||||
return flask.make_response('{\"text\":"Argument \'reward_name\' not in request"}', 400)
|
return flask.make_response('{\"text\":"Argument \'reward_type\' not in request"}', 400)
|
||||||
if 'reward_prompt' not in request.args:
|
if 'reward_prompt' not in request.args:
|
||||||
return flask.make_response('{\"text\":"Argument \'reward_prompt\' not in request"}', 400)
|
return flask.make_response('{\"text\":"Argument \'reward_prompt\' not in request"}', 400)
|
||||||
if 'user_input' not in request.args:
|
if 'user_input' not in request.args:
|
||||||
@ -87,7 +88,14 @@ def exec_reward():
|
|||||||
username = "User"
|
username = "User"
|
||||||
else:
|
else:
|
||||||
username = request.args['user_name']
|
username = request.args['user_name']
|
||||||
|
praxis_logger_obj.log("\n About to try a reward")
|
||||||
|
|
||||||
|
praxis_logger_obj.log(request.args['reward_source'])
|
||||||
|
praxis_logger_obj.log(request.args['reward_name'])
|
||||||
|
praxis_logger_obj.log(request.args['reward_type'])
|
||||||
|
praxis_logger_obj.log(request.args['reward_prompt'])
|
||||||
|
praxis_logger_obj.log(request.args['user_input'])
|
||||||
|
praxis_logger_obj.log(request.args['bonus_data'])
|
||||||
return handle_reward(
|
return handle_reward(
|
||||||
request.args['reward_source'],
|
request.args['reward_source'],
|
||||||
username,
|
username,
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class Lights_Module():
|
|||||||
self.bridge_:Bridge = Bridge('192.168.191.146')
|
self.bridge_:Bridge = Bridge('192.168.191.146')
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
print("\nStarting up [Lights_Module]...")
|
praxis_logger_obj.log("\nStarting up [Lights_Module]...")
|
||||||
self.bridge_.connect()
|
self.bridge_.connect()
|
||||||
|
|
||||||
self.bridge_.get_api()
|
self.bridge_.get_api()
|
||||||
@ -37,26 +37,26 @@ class Lights_Module():
|
|||||||
groups = self.bridge_.get_group()
|
groups = self.bridge_.get_group()
|
||||||
groupCount = 0
|
groupCount = 0
|
||||||
|
|
||||||
#print("\n -Listing Lights...")
|
#praxis_logger_obj.log("\n -Listing Lights...")
|
||||||
for l in light_list:
|
for l in light_list:
|
||||||
pass
|
pass
|
||||||
#print(l.name)
|
#praxis_logger_obj.log(l.name)
|
||||||
#print("\n -Counting Groups...")
|
#praxis_logger_obj.log("\n -Counting Groups...")
|
||||||
for g in groups:
|
for g in groups:
|
||||||
#print(g)
|
#praxis_logger_obj.log(g)
|
||||||
groupCount = int(g)
|
groupCount = int(g)
|
||||||
|
|
||||||
|
|
||||||
for gc in range(groupCount):
|
for gc in range(groupCount):
|
||||||
try:
|
try:
|
||||||
#print("group n:" + str(gc))
|
#praxis_logger_obj.log("group n:" + str(gc))
|
||||||
group = self.bridge_.get_group(gc ,'name')
|
group = self.bridge_.get_group(gc ,'name')
|
||||||
#print(group)
|
#praxis_logger_obj.log(group)
|
||||||
group_list.append(group)
|
group_list.append(group)
|
||||||
#print(" --done adding")
|
#praxis_logger_obj.log(" --done adding")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
#print(" --adding failed")
|
#praxis_logger_obj.log(" --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
|
||||||
@ -73,13 +73,13 @@ class Lights_Module():
|
|||||||
#sleep(0.1)
|
#sleep(0.1)
|
||||||
|
|
||||||
#for stuffz in self.bridge_.scenes:
|
#for stuffz in self.bridge_.scenes:
|
||||||
#print(stuffz)
|
#praxis_logger_obj.log(stuffz)
|
||||||
|
|
||||||
# This will set the group Downstairs to the Stream scene
|
# This will set the group Downstairs to the Stream scene
|
||||||
#self.bridge_.run_scene("Downstairs", "Stream")
|
#self.bridge_.run_scene("Downstairs", "Stream")
|
||||||
|
|
||||||
#self.bridge_.run_scene("Downstairs", "Stream")
|
#self.bridge_.run_scene("Downstairs", "Stream")
|
||||||
print("-[Lights_Module] Setup Complete")
|
praxis_logger_obj.log("-[Lights_Module] Setup Complete")
|
||||||
|
|
||||||
def setLight():
|
def setLight():
|
||||||
pass
|
pass
|
||||||
@ -137,22 +137,22 @@ class Lights_Module():
|
|||||||
|
|
||||||
def color_string_parser(self, message):
|
def color_string_parser(self, message):
|
||||||
maxDigits = config.colorParse_maxDigits
|
maxDigits = config.colorParse_maxDigits
|
||||||
print("Searching for color...")
|
praxis_logger_obj.log("Searching for color...")
|
||||||
xy_color = [0, 0]
|
xy_color = [0, 0]
|
||||||
for text in message:
|
for text in message:
|
||||||
#print("testing word")
|
#praxis_logger_obj.log("testing word")
|
||||||
if "red" in text.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")
|
praxis_logger_obj.log("-found: red")
|
||||||
if "blue" in text.lower():
|
if "blue" in text.lower():
|
||||||
print("-found: blue")
|
praxis_logger_obj.log("-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 text.lower():
|
||||||
print("-found: green")
|
praxis_logger_obj.log("-found: green")
|
||||||
xy_color = self.rgb_to_xy(0,1,0)
|
xy_color = self.rgb_to_xy(0,1,0)
|
||||||
|
|
||||||
if "yellow" in text.lower():
|
if "yellow" in text.lower():
|
||||||
print("-found: yellow")
|
praxis_logger_obj.log("-found: yellow")
|
||||||
xy_color = self.rgb_to_xy(
|
xy_color = self.rgb_to_xy(
|
||||||
0.7,
|
0.7,
|
||||||
0.64,
|
0.64,
|
||||||
@ -160,23 +160,23 @@ class Lights_Module():
|
|||||||
|
|
||||||
|
|
||||||
if "cyan" in text.lower():
|
if "cyan" in text.lower():
|
||||||
print("-found: cyan")
|
praxis_logger_obj.log("-found: cyan")
|
||||||
xy_color = self.rgb_to_xy(0,1,1)
|
xy_color = self.rgb_to_xy(0,1,1)
|
||||||
if "aquamarine" in text.lower():
|
if "aquamarine" in text.lower():
|
||||||
print("-found: aquamarine")
|
praxis_logger_obj.log("-found: aquamarine")
|
||||||
xy_color = self.rgb_to_xy(
|
xy_color = self.rgb_to_xy(
|
||||||
round(utilities.rescale_value(111,0,254),maxDigits),
|
round(utilities.rescale_value(111,0,254),maxDigits),
|
||||||
round(utilities.rescale_value(218,0,254),maxDigits),
|
round(utilities.rescale_value(218,0,254),maxDigits),
|
||||||
round(utilities.rescale_value(146,0,254),maxDigits))
|
round(utilities.rescale_value(146,0,254),maxDigits))
|
||||||
if "turquoise" in text.lower():
|
if "turquoise" in text.lower():
|
||||||
print("-found: turquoise")
|
praxis_logger_obj.log("-found: turquoise")
|
||||||
xy_color = self.rgb_to_xy(
|
xy_color = self.rgb_to_xy(
|
||||||
round(utilities.rescale_value(172,0,254),maxDigits),
|
round(utilities.rescale_value(172,0,254),maxDigits),
|
||||||
round(utilities.rescale_value(233,0,254),maxDigits),
|
round(utilities.rescale_value(233,0,254),maxDigits),
|
||||||
round(utilities.rescale_value(232,0,254),maxDigits))
|
round(utilities.rescale_value(232,0,254),maxDigits))
|
||||||
|
|
||||||
if "orange" in text.lower():
|
if "orange" in text.lower():
|
||||||
print("-found: orange")
|
praxis_logger_obj.log("-found: orange")
|
||||||
xy_color = self.rgb_to_xy(
|
xy_color = self.rgb_to_xy(
|
||||||
1,
|
1,
|
||||||
round(utilities.rescale_value(126,0,254),maxDigits),
|
round(utilities.rescale_value(126,0,254),maxDigits),
|
||||||
@ -184,21 +184,21 @@ class Lights_Module():
|
|||||||
|
|
||||||
|
|
||||||
if "magenta" in text.lower():
|
if "magenta" in text.lower():
|
||||||
print("-found: magenta")
|
praxis_logger_obj.log("-found: magenta")
|
||||||
xy_color = self.rgb_to_xy(
|
xy_color = self.rgb_to_xy(
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
1)
|
1)
|
||||||
|
|
||||||
if "purple" in text.lower():
|
if "purple" in text.lower():
|
||||||
print("-found: purple")
|
praxis_logger_obj.log("-found: purple")
|
||||||
xy_color = self.rgb_to_xy(
|
xy_color = self.rgb_to_xy(
|
||||||
round(utilities.rescale_value(159,0,254),maxDigits),
|
round(utilities.rescale_value(159,0,254),maxDigits),
|
||||||
round(utilities.rescale_value(32,0,254),maxDigits),
|
round(utilities.rescale_value(32,0,254),maxDigits),
|
||||||
round(utilities.rescale_value(239,0,254),maxDigits))
|
round(utilities.rescale_value(239,0,254),maxDigits))
|
||||||
|
|
||||||
if "violet" in text.lower():
|
if "violet" in text.lower():
|
||||||
print("-found: violet")
|
praxis_logger_obj.log("-found: violet")
|
||||||
xy_color = self.rgb_to_xy(
|
xy_color = self.rgb_to_xy(
|
||||||
round(utilities.rescale_value(237,0,254),maxDigits),
|
round(utilities.rescale_value(237,0,254),maxDigits),
|
||||||
round(utilities.rescale_value(129,0,254),maxDigits),
|
round(utilities.rescale_value(129,0,254),maxDigits),
|
||||||
@ -214,24 +214,23 @@ def init():
|
|||||||
|
|
||||||
def do_lights_command(user="", lightGroup="all", command = "", rest = ""):
|
def do_lights_command(user="", lightGroup="all", command = "", rest = ""):
|
||||||
returnString = "None"
|
returnString = "None"
|
||||||
print("about to do something ......")
|
praxis_logger_obj.log("about to do something ......")
|
||||||
|
praxis_logger_obj.log("about to do something with: " + command + " " + rest)
|
||||||
#bot.return_message("\nRGB Command Detected!")
|
#bot.return_message("\nRGB Command Detected!")
|
||||||
if rest is not "":
|
if rest is not "":
|
||||||
tempFix = command + " " + rest
|
tempFix = command + " " + rest
|
||||||
else:
|
else:
|
||||||
pass
|
tempFix = command
|
||||||
tempFix = command
|
|
||||||
|
|
||||||
tempParsedMessage = tempFix.split(" ")
|
tempParsedMessage = tempFix.split(" ")
|
||||||
sceneCommand = False
|
sceneCommand = False
|
||||||
if (len(tempParsedMessage)) > 2:
|
if (len(tempParsedMessage)) > 2:
|
||||||
print("RGB Command!")
|
praxis_logger_obj.log("RGB 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 = RGB_Lights.rgb_to_xy(rgb_r, rgb_g, rgb_b)
|
xy_result = RGB_Lights.rgb_to_xy(rgb_r, rgb_g, rgb_b)
|
||||||
print("got XY")
|
praxis_logger_obj.log("got XY")
|
||||||
RGB_Lights.bridge_.set_group(16, "xy", xy_result)
|
RGB_Lights.bridge_.set_group(16, "xy", xy_result)
|
||||||
#bot.return_message("sent color to [Lights_Module]")
|
#bot.return_message("sent color to [Lights_Module]")
|
||||||
else:
|
else:
|
||||||
@ -264,11 +263,11 @@ def do_lights_command(user="", lightGroup="all", command = "", rest = ""):
|
|||||||
#bot.return_message("sent color to [Lights_Module]")
|
#bot.return_message("sent color to [Lights_Module]")
|
||||||
|
|
||||||
if sceneCommand == True:
|
if sceneCommand == True:
|
||||||
print("Scene Command!")
|
praxis_logger_obj.log("Scene Command!")
|
||||||
|
|
||||||
returnString = user + " changed the light's color!"
|
returnString = user + " changed the light's color!"
|
||||||
|
|
||||||
return returnString
|
return flask.make_response("{\"message\":\"%s\"}" % returnString, 200, {"Content-Type": "application/json"})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -283,7 +282,7 @@ def exec_lights():
|
|||||||
if 'command' not in request.args:
|
if 'command' not in request.args:
|
||||||
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 ......")
|
praxis_logger_obj.log("about to do something ......")
|
||||||
RGB_Lights.main()
|
RGB_Lights.main()
|
||||||
return do_lights_command(user_name, request.args['light_group'], request.args['command'], request.args['rest'])
|
return do_lights_command(user_name, request.args['light_group'], request.args['command'], request.args['rest'])
|
||||||
|
|
||||||
|
|||||||
@ -94,7 +94,13 @@ class Twitch_Pubsub():
|
|||||||
userinput = data['data']['redemption']['user_input']
|
userinput = data['data']['redemption']['user_input']
|
||||||
except:
|
except:
|
||||||
userinput = ""
|
userinput = ""
|
||||||
#print(userinput)
|
praxis_logger_obj.log("\n\n")
|
||||||
|
praxis_logger_obj.log(data['data']['redemption']['user']['display_name'])
|
||||||
|
praxis_logger_obj.log(data['data']['redemption']['reward']['title'])
|
||||||
|
praxis_logger_obj.log(AbstractChannelRewards.ChannelRewardsType.channelPoints)
|
||||||
|
praxis_logger_obj.log(data['data']['redemption']['reward']['prompt'])
|
||||||
|
praxis_logger_obj.log(userinput)
|
||||||
|
praxis_logger_obj.log(data)
|
||||||
self.callback_EXEC(
|
self.callback_EXEC(
|
||||||
data['data']['redemption']['user']['display_name'],
|
data['data']['redemption']['user']['display_name'],
|
||||||
data['data']['redemption']['reward']['title'],
|
data['data']['redemption']['reward']['title'],
|
||||||
@ -117,7 +123,7 @@ class Twitch_Pubsub():
|
|||||||
try:
|
try:
|
||||||
is_actionable = self.is_reward(rewardName, rewardType)
|
is_actionable = self.is_reward(rewardName, rewardType)
|
||||||
if is_actionable:
|
if is_actionable:
|
||||||
print("Trying to do the thing")
|
praxis_logger_obj.log("Trying to do the thing")
|
||||||
if self.cooldownModule.isCooldownActive("twitchChat") == False:
|
if self.cooldownModule.isCooldownActive("twitchChat") == False:
|
||||||
self.exec_reward(sender, rewardName, rewardType, rewardPrompt, userInput, raw_data)
|
self.exec_reward(sender, rewardName, rewardType, rewardPrompt, userInput, raw_data)
|
||||||
except:
|
except:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user