From 373c3983060382b5b0d0febf2bcaa94c1fb2720b Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Fri, 7 May 2021 16:21:10 -0400 Subject: [PATCH] working version --- standalone_twitch_script.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/standalone_twitch_script.py b/standalone_twitch_script.py index 14c1b15..b030797 100644 --- a/standalone_twitch_script.py +++ b/standalone_twitch_script.py @@ -73,13 +73,6 @@ class Twitch_Module(): def eval_command(self, message): command, rest = utility.parse_line(message.text) - try: - is_actionable = self.is_command(command) - if is_actionable: - if self.cooldownModule.isCooldownActive("twitchChat") == False: - self.exec_command(message ,command, rest) - except: - praxis_logger_obj.log("something went wrong with a command") try: is_actionable = self.is_command(command) @@ -88,11 +81,18 @@ class Twitch_Module(): praxis_logger_obj.log("Sent a thing") except: praxis_logger_obj.log("something went wrong with Event LOG") + try: + is_actionable = self.is_command(command) + if is_actionable: + if self.cooldownModule.isCooldownActive("twitchChat") == False: + self.exec_command(message ,command, rest) + except: + praxis_logger_obj.log("something went wrong with a command") def is_command(self, word: str) -> bool: # todo need to url-escape word clean_param = urlencode({'name': word}) - url = "http://standalone_command:42010/api/v1/command?%s" % clean_param + url = "http://localhost:42010/api/v1/command?%s" % clean_param resp = requests.get(url) return resp.status_code == 200 @@ -104,8 +104,8 @@ class Twitch_Module(): 'command_name': command, 'rest': rest, 'bonus_data': realMessage}) - - url = "http://standalone_command:42010/api/v1/exec_command?%s" % params + #standalone_command + url = "http://localhost:42010/api/v1/exec_command?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) @@ -144,7 +144,7 @@ class Twitch_Module(): 'event_time': eventTime, 'event_type': eventType, 'event_data': rest}) - url = "http://127.0.0.1:42008/api/v1/event_log/add_event?%s" % params + url = "http://localhost:42008/api/v1/event_log/add_event?%s" % params resp = requests.get(url) if resp.status_code == 200: @@ -161,7 +161,7 @@ class Twitch_Module(): def exec_tts_sender(self, username, message): params = urlencode({'tts_sender': username, 'tts_text': message}) #standalone_tts_core - url = "http://standalone_tts_core:42064/api/v1/tts/send_text?%s" % params + url = "http://localhost:42064/api/v1/tts/send_text?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text)