working version

This commit is contained in:
Alex Orid 2021-05-07 16:21:10 -04:00
parent ddec99c37b
commit 373c398306

View File

@ -73,13 +73,6 @@ class Twitch_Module():
def eval_command(self, message): def eval_command(self, message):
command, rest = utility.parse_line(message.text) 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: try:
is_actionable = self.is_command(command) is_actionable = self.is_command(command)
@ -88,11 +81,18 @@ class Twitch_Module():
praxis_logger_obj.log("Sent a thing") praxis_logger_obj.log("Sent a thing")
except: except:
praxis_logger_obj.log("something went wrong with Event LOG") 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: def is_command(self, word: str) -> bool:
# todo need to url-escape word # todo need to url-escape word
clean_param = urlencode({'name': 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) resp = requests.get(url)
return resp.status_code == 200 return resp.status_code == 200
@ -104,8 +104,8 @@ class Twitch_Module():
'command_name': command, 'command_name': command,
'rest': rest, 'rest': rest,
'bonus_data': realMessage}) 'bonus_data': realMessage})
#standalone_command
url = "http://standalone_command:42010/api/v1/exec_command?%s" % params url = "http://localhost:42010/api/v1/exec_command?%s" % params
resp = requests.get(url) resp = requests.get(url)
if resp.status_code == 200: if resp.status_code == 200:
print("Got the following message: %s" % resp.text) print("Got the following message: %s" % resp.text)
@ -144,7 +144,7 @@ class Twitch_Module():
'event_time': eventTime, 'event_time': eventTime,
'event_type': eventType, 'event_type': eventType,
'event_data': rest}) '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) resp = requests.get(url)
if resp.status_code == 200: if resp.status_code == 200:
@ -161,7 +161,7 @@ class Twitch_Module():
def exec_tts_sender(self, username, message): def exec_tts_sender(self, username, message):
params = urlencode({'tts_sender': username, 'tts_text': message}) params = urlencode({'tts_sender': username, 'tts_text': message})
#standalone_tts_core #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) resp = requests.get(url)
if resp.status_code == 200: if resp.status_code == 200:
print("Got the following message: %s" % resp.text) print("Got the following message: %s" % resp.text)