Fixed TTS Bugs

Fixed Discord TTS Config Bug
Fixed Docker TTS playsound()
This commit is contained in:
Alex Orid 2021-04-15 18:04:10 -04:00
parent c01418cebe
commit b7e20c5602
4 changed files with 11 additions and 4 deletions

View File

@ -30,8 +30,8 @@ block_DiscordChannelsMessaging = [""] # Blocks the ability to send messages to D
blockAll_DiscordChannelsMessaging = False # Blocks the ability to send messages to Discord channels blockAll_DiscordChannelsMessaging = False # Blocks the ability to send messages to Discord channels
blockAll_DiscordPrivateMessaging = False # Private Messaging not yet implemented blockAll_DiscordPrivateMessaging = False # Private Messaging not yet implemented
selected_DiscordTTSChannels = ["431129571308339210"]
autoEnabled_DiscordChannelsTTS = False autoEnabled_DiscordChannelsTTS = False
selected_DiscordTTSChannels = ["431129571308339210"]
block_DiscordChannelsTTS = [""] # block supersedes the tts_enabled bool block_DiscordChannelsTTS = [""] # block supersedes the tts_enabled bool
blockAll_DiscordChannelsTTS = False # blockAll supersedes the force bool and force list and tts_enabled bool blockAll_DiscordChannelsTTS = False # blockAll supersedes the force bool and force list and tts_enabled bool
force_DiscordChannelsTTS = [""] # force supersedes the block list force_DiscordChannelsTTS = [""] # force supersedes the block list

View File

@ -138,7 +138,13 @@ class Discord_Module(discord.Client):
#print("isBlocked: " + str(isBlocked)) #print("isBlocked: " + str(isBlocked))
#print("isForced: " + str(isForced)) #print("isForced: " + str(isForced))
if (not await self.contains_slur(message)) and (await self.isTTS_URL_Enabled(message)): if (not await self.contains_slur(message)) and (await self.isTTS_URL_Enabled(message)):
if self.tts_enabled and not isBlocked and not config.blockAll_DiscordChannelsTTS or isForced or config.forceAll_DiscordChatChannelsTTS: print(message.channel.id, message.channel.id, message.channel.id)
isMessageChannelInList = False
for TTS_C_id in config.selected_DiscordTTSChannels:
print(TTS_C_id)
if int(TTS_C_id) == int(message.channel.id):
isMessageChannelInList = True
if self.tts_enabled and (isMessageChannelInList) and not isBlocked and not config.blockAll_DiscordChannelsTTS or isForced or config.forceAll_DiscordChatChannelsTTS:
if not message.content.startswith('!'): if not message.content.startswith('!'):
text_to_say: str = "%s says, %s" % (message.author.display_name, message.content) text_to_say: str = "%s says, %s" % (message.author.display_name, message.content)
channel_text = "%s user msg" % message.channel channel_text = "%s user msg" % message.channel

3
tts.py
View File

@ -13,9 +13,10 @@ streamLabsUrl = "https://streamlabs.com/polly/speak"
def tts(inputText: str, *args): def tts(inputText: str, *args):
outpath = create_speech_file(inputText) outpath = create_speech_file(inputText)
if utility.isRunningInDocker() == False: if utility.isRunningInDocker() == True:
print("Docker Detected, skipping playsound()") print("Docker Detected, skipping playsound()")
else: else:
print("Playing Sound...")
playsound(outpath) playsound(outpath)

View File

@ -21,7 +21,7 @@ class User_Module():
def main(self): def main(self):
print("\nWaiting on User input...\n") print("\nWaiting on User input...\n")
inputLoop = True inputLoop = True
if utility.isRunningInDocker() == False: if utility.isRunningInDocker() == True:
inputLoop = False inputLoop = False
print("\nNo User's Input Allowed") print("\nNo User's Input Allowed")
while inputLoop: while inputLoop: