diff --git a/commands/implemented/Command_tts_v2.py b/commands/implemented/Command_tts_v2.py index 93cf453..f2f69b5 100644 --- a/commands/implemented/Command_tts_v2.py +++ b/commands/implemented/Command_tts_v2.py @@ -6,6 +6,7 @@ from json import loads from urllib.parse import urlencode from urllib.parse import parse_qs import requests +import re import config @@ -44,14 +45,11 @@ class Command_tts_v2(AbstractCommand, metaclass=ABCMeta): for name in config.allowedTTS_List: print(name) - - for key_ in fixedData: - praxis_logger_obj.log(key_) - + tempNick = self.contains_value("(?<=nick=')[^']+", bonusData) tempName = user.lower() if name == tempName: - self.send_TTS(fixedData.author.nick, rest) + self.send_TTS(tempNick, rest) else: returnString = self.send_TTS(user, rest) @@ -89,7 +87,7 @@ class Command_tts_v2(AbstractCommand, metaclass=ABCMeta): resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) - data = loads(resp.text) + #data = loads(resp.text) msg = data['message'] if msg is not None: return msg @@ -98,5 +96,9 @@ class Command_tts_v2(AbstractCommand, metaclass=ABCMeta): # todo handle failed requests pass + def contains_value(self, search: str, data:str): + contains = re.search(search, data) + return contains.group(0) + def get_help(self): return self.help \ No newline at end of file diff --git a/config.py b/config.py index 968c533..2a457b9 100644 --- a/config.py +++ b/config.py @@ -9,7 +9,7 @@ user_module: bool = True autoJoin_TwitchChannel = "thecuriousnerd" autoJoin_TwitchChannels = ["thecuriousnerd"] allowedCommandsList_TwitchPowerUsers = ["thecuriousnerd", "lakotor", "blastofcynicism", "theredpoint"] -allowedTTS_List = ["thecuriousnerd", "lakotor", "blastofcynicism", "theredpoint", "<@76078763984551936>"] +allowedTTS_List = ["thecuriousnerd", "lakotor", "blastofcynicism", "theredpoint", "<@76078763984551936>", "<@!76078763984551936>"] adminUsers_List = ["thecuriousnerd", "<@!76078763984551936>"] #Twitch Module Configs