Made Discord TTS Command working kinda
This commit is contained in:
parent
72ea8f7b71
commit
a3da70bd55
@ -6,6 +6,7 @@ from json import loads
|
|||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
from urllib.parse import parse_qs
|
from urllib.parse import parse_qs
|
||||||
import requests
|
import requests
|
||||||
|
import re
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
|
||||||
@ -44,14 +45,11 @@ class Command_tts_v2(AbstractCommand, metaclass=ABCMeta):
|
|||||||
for name in config.allowedTTS_List:
|
for name in config.allowedTTS_List:
|
||||||
print(name)
|
print(name)
|
||||||
|
|
||||||
|
tempNick = self.contains_value("(?<=nick=')[^']+", bonusData)
|
||||||
for key_ in fixedData:
|
|
||||||
praxis_logger_obj.log(key_)
|
|
||||||
|
|
||||||
|
|
||||||
tempName = user.lower()
|
tempName = user.lower()
|
||||||
if name == tempName:
|
if name == tempName:
|
||||||
self.send_TTS(fixedData.author.nick, rest)
|
self.send_TTS(tempNick, rest)
|
||||||
else:
|
else:
|
||||||
returnString = self.send_TTS(user, rest)
|
returnString = self.send_TTS(user, rest)
|
||||||
|
|
||||||
@ -89,7 +87,7 @@ class Command_tts_v2(AbstractCommand, metaclass=ABCMeta):
|
|||||||
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)
|
||||||
data = loads(resp.text)
|
#data = loads(resp.text)
|
||||||
msg = data['message']
|
msg = data['message']
|
||||||
if msg is not None:
|
if msg is not None:
|
||||||
return msg
|
return msg
|
||||||
@ -98,5 +96,9 @@ class Command_tts_v2(AbstractCommand, metaclass=ABCMeta):
|
|||||||
# todo handle failed requests
|
# todo handle failed requests
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def contains_value(self, search: str, data:str):
|
||||||
|
contains = re.search(search, data)
|
||||||
|
return contains.group(0)
|
||||||
|
|
||||||
def get_help(self):
|
def get_help(self):
|
||||||
return self.help
|
return self.help
|
||||||
@ -9,7 +9,7 @@ user_module: bool = True
|
|||||||
autoJoin_TwitchChannel = "thecuriousnerd"
|
autoJoin_TwitchChannel = "thecuriousnerd"
|
||||||
autoJoin_TwitchChannels = ["thecuriousnerd"]
|
autoJoin_TwitchChannels = ["thecuriousnerd"]
|
||||||
allowedCommandsList_TwitchPowerUsers = ["thecuriousnerd", "lakotor", "blastofcynicism", "theredpoint"]
|
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>"]
|
adminUsers_List = ["thecuriousnerd", "<@!76078763984551936>"]
|
||||||
|
|
||||||
#Twitch Module Configs
|
#Twitch Module Configs
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user