Merge pull request 'master updates' (#26) from master into db-module
Reviewed-on: #26
This commit is contained in:
commit
5b2613f9be
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ tts/
|
||||
__pycache__/
|
||||
credentials/
|
||||
.idea/
|
||||
stream_sources/chyron.txt
|
||||
|
||||
10
Dockerfile
Normal file
10
Dockerfile
Normal file
@ -0,0 +1,10 @@
|
||||
FROM python:3.8-buster
|
||||
|
||||
WORKDIR /Praxis
|
||||
|
||||
COPY requirements.txt requirements.txt
|
||||
RUN pip3 install -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
CMD [ "python3", "main.py"] #Uncomment to start with the Docker Container
|
||||
12
README.md
12
README.md
@ -2,6 +2,18 @@ A chatbot to help with live stream production and effects.
|
||||
|
||||
___
|
||||
|
||||
# Docker:
|
||||
|
||||
## Docker Info:
|
||||
|
||||
Currently to build the container run the following command.
|
||||
|
||||
`docker create -p 2501:2501 -e ISDOCKER=cat --name praxis praxis`
|
||||
|
||||
To start the bot with **User_Module** activated use this.
|
||||
|
||||
`docker exec -ti praxis python3 main.py`
|
||||
|
||||
# Credentials:
|
||||
|
||||
## Credentials Setup:
|
||||
|
||||
@ -16,7 +16,7 @@ class Chyron_Module():
|
||||
self.addItem(
|
||||
"WeekDays",
|
||||
"► Weekdays: ",
|
||||
"Daily Stream @ 12pm Noon EST")
|
||||
"Daily Streams @ 12pm Noon EST")
|
||||
self.addItem(
|
||||
"FriSat",
|
||||
"► Friday & Saturday: ",
|
||||
|
||||
@ -18,10 +18,11 @@ class AbstractCommand(metaclass=ABCMeta):
|
||||
TWITCH = auto()
|
||||
DISCORD = auto()
|
||||
|
||||
def __init__(self, command: str, n_args: int = 0, command_type=CommandType.NONE):
|
||||
def __init__(self, command: str, n_args: int = 0, command_type=CommandType.NONE, helpText:list=["No Help"]):
|
||||
self.command = command
|
||||
self.n_args = n_args
|
||||
self.command_type = command_type
|
||||
self.help = helpText
|
||||
|
||||
# no touch!
|
||||
def get_args(self, text: str) -> list:
|
||||
@ -31,6 +32,10 @@ class AbstractCommand(metaclass=ABCMeta):
|
||||
def get_command(self) -> str:
|
||||
return self.command
|
||||
|
||||
# no touch!
|
||||
def get_help(self):
|
||||
return self.help
|
||||
|
||||
@abstractmethod
|
||||
def do_command(self, bot, twitch_message):
|
||||
pass
|
||||
|
||||
@ -7,14 +7,16 @@ import random
|
||||
|
||||
import utilities_script as utilities
|
||||
|
||||
class CommandRoll(AbstractCommand, metaclass=ABCMeta):
|
||||
class CommandChyron(AbstractCommand, metaclass=ABCMeta):
|
||||
"""
|
||||
this is the roll command.
|
||||
this is the chyron command.
|
||||
"""
|
||||
command = "chyron"
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(CommandRoll.command, n_args=5, command_type=AbstractCommand.CommandType.Praxis)
|
||||
super().__init__(CommandChyron.command, n_args=5, command_type=AbstractCommand.CommandType.Praxis)
|
||||
self.help = ["The chyron string can be generated and updated with this command.",
|
||||
"\nExample:","chyron update \"RIGHTNOW\""]
|
||||
|
||||
def do_command(self, bot, user_message):
|
||||
tempBool = True
|
||||
@ -22,14 +24,24 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta):
|
||||
tempParsedMessage = user_message.message.split(" ")
|
||||
i = len(tempParsedMessage)
|
||||
|
||||
if i > 1:
|
||||
if i > 2:
|
||||
if "update" in tempParsedMessage[1]:
|
||||
chyron = chyron_module.Chyron_Module()
|
||||
if i > 2:
|
||||
chyron.main(tempParsedMessage[2])
|
||||
rightNow = ""
|
||||
counter = 0
|
||||
for word in tempParsedMessage:
|
||||
if counter > 1:
|
||||
rightNow = rightNow + word + " "
|
||||
counter = counter + 1
|
||||
rightNow = rightNow[:-1]
|
||||
chyron.main(rightNow)
|
||||
else:
|
||||
chyron.main()
|
||||
chyron.updateChyronFile()
|
||||
|
||||
returnMessage = "@" + user_message.user + " updated the chyron!"
|
||||
bot.return_message(returnMessage)
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
48
commands/implemented/command_help.py
Normal file
48
commands/implemented/command_help.py
Normal file
@ -0,0 +1,48 @@
|
||||
from abc import ABCMeta
|
||||
import help_module
|
||||
|
||||
from commands.command_base import AbstractCommand
|
||||
|
||||
import random
|
||||
|
||||
import utilities_script as utilities
|
||||
|
||||
class CommandChyron(AbstractCommand, metaclass=ABCMeta):
|
||||
"""
|
||||
this is the help command.
|
||||
"""
|
||||
command = "help"
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(CommandChyron.command, n_args=5, command_type=AbstractCommand.CommandType.Praxis)
|
||||
self.help = ["This is a command to learn more about other commands.",
|
||||
"\nExample:","help \"COMMAND\""]
|
||||
|
||||
self.blockDecor = "\n================================================================\n"
|
||||
|
||||
def do_command(self, bot, user_message):
|
||||
tempBool = True
|
||||
if tempBool == True:
|
||||
tempParsedMessage = user_message.message.split(" ")
|
||||
i = len(tempParsedMessage)
|
||||
|
||||
if i > 1:
|
||||
targetCommand = bot.commands[tempParsedMessage[1]]
|
||||
helper = help_module.Help_Module_.help_command_response(targetCommand, help_module.help_command_responseType.fancy)
|
||||
|
||||
returnMessage = helper.response
|
||||
bot.return_message(returnMessage)
|
||||
elif i == 1:
|
||||
commandsList = self.blockDecor + "Commands List:" + self.blockDecor + self.GetCommandsList(bot) + self.blockDecor
|
||||
print(commandsList)
|
||||
|
||||
def GetCommandsList(self, bot):
|
||||
commandsList = ""
|
||||
i = 0
|
||||
for cmd in bot.commands:
|
||||
commandsList = commandsList + cmd + "\n"
|
||||
|
||||
return commandsList
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
@ -7,14 +7,16 @@ import random
|
||||
|
||||
import utilities_script as utilities
|
||||
|
||||
class CommandRoll(AbstractCommand, metaclass=ABCMeta):
|
||||
class CommandLights(AbstractCommand, metaclass=ABCMeta):
|
||||
"""
|
||||
this is the roll command.
|
||||
this is the lights command.
|
||||
"""
|
||||
command = "lights"
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(CommandRoll.command, n_args=3, command_type=AbstractCommand.CommandType.Praxis)
|
||||
super().__init__(CommandLights.command, n_args=3, command_type=AbstractCommand.CommandType.Praxis)
|
||||
self.help = ["This command allows you to modify the lights via the Lights_Module.",
|
||||
"\nExample:","lights \"SCENE\"","lights \"COLOR\"","lights \"R\" \"G\" \"B\"","lights \"1\" \"0.5\" \"0\""]
|
||||
|
||||
def do_command(self, bot, user_message):
|
||||
tempBool = True
|
||||
@ -65,3 +67,6 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta):
|
||||
|
||||
returnMessage = "@" + user_message.user + " changed the light's color!"
|
||||
bot.return_message(returnMessage)
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
@ -7,14 +7,16 @@ import random
|
||||
|
||||
import utilities_script as utilities
|
||||
|
||||
class CommandRoll(AbstractCommand, metaclass=ABCMeta):
|
||||
class CommandLights(AbstractCommand, metaclass=ABCMeta):
|
||||
"""
|
||||
this is the roll command.
|
||||
"""
|
||||
command = "!lights"
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(CommandRoll.command, n_args=3, command_type=AbstractCommand.CommandType.TWITCH)
|
||||
super().__init__(CommandLights.command, n_args=3, command_type=AbstractCommand.CommandType.TWITCH)
|
||||
self.help = ["This command allows you to modify the lights via the Lights_Module.",
|
||||
"\nExample:","!lights \"SCENE\"","!lights \"COLOR\"","!lights \"R\" \"G\" \"B\"","!lights \"1\" \"0.5\" \"0\""]
|
||||
|
||||
def do_command(self, bot, twitch_message):
|
||||
|
||||
@ -65,3 +67,6 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta):
|
||||
|
||||
returnMessage = "@" + twitch_message.sender + " changed the light's color!"
|
||||
bot.send_message(returnMessage)
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
@ -12,6 +12,8 @@ class CommandTTS(AbstractCommand, metaclass=ABCMeta):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(CommandTTS.command, n_args=0, command_type=AbstractCommand.CommandType.DISCORD)
|
||||
self.help = ["MISSING HELP ENTRY",
|
||||
"\nExample:","command \"PARAM\""]
|
||||
|
||||
async def do_command(self, bot, discord_message: discord.message):
|
||||
|
||||
@ -21,3 +23,6 @@ class CommandTTS(AbstractCommand, metaclass=ABCMeta):
|
||||
response = str("Bot restarting...")
|
||||
await bot.send_message(discord_message, response)
|
||||
utilities.restart_self()
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
@ -9,6 +9,8 @@ class CommandTTS(AbstractCommand, metaclass=ABCMeta):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(CommandTTS.command, n_args=0, command_type=AbstractCommand.CommandType.TWITCH)
|
||||
self.help = ["MISSING HELP ENTRY",
|
||||
"\nExample:","command \"PARAM\""]
|
||||
|
||||
def do_command(self, bot, twitch_message):
|
||||
args = self.get_args(twitch_message.text)
|
||||
@ -16,3 +18,5 @@ class CommandTTS(AbstractCommand, metaclass=ABCMeta):
|
||||
bot.send_message("Bot restarting...")
|
||||
utilities.restart_self()
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
@ -18,6 +18,8 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(CommandRoll.command, n_args=1, command_type=AbstractCommand.CommandType.DISCORD)
|
||||
self.help = ["MISSING HELP ENTRY",
|
||||
"\nExample:","command \"PARAM\""]
|
||||
|
||||
async def do_command(self, bot, discord_message: discord.Message):
|
||||
print("!roll Detected")
|
||||
@ -173,3 +175,6 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta):
|
||||
print(diceRoll)
|
||||
|
||||
return diceRoll
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
@ -12,6 +12,8 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(CommandRoll.command, n_args=1, command_type=AbstractCommand.CommandType.TWITCH)
|
||||
self.help = ["MISSING HELP ENTRY",
|
||||
"\nExample:","command \"PARAM\""]
|
||||
|
||||
def do_command(self, bot, twitch_message):
|
||||
print("!roll Detected")
|
||||
@ -166,3 +168,6 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta):
|
||||
print(diceRoll)
|
||||
|
||||
return diceRoll
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
@ -12,6 +12,8 @@ class CommandTTS(AbstractCommand, metaclass=ABCMeta):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(CommandTTS.command, n_args=0, command_type=AbstractCommand.CommandType.DISCORD)
|
||||
self.help = ["MISSING HELP ENTRY",
|
||||
"\nExample:","command \"PARAM\""]
|
||||
|
||||
async def do_command(self, bot, discord_message: discord.message):
|
||||
|
||||
@ -21,3 +23,6 @@ class CommandTTS(AbstractCommand, metaclass=ABCMeta):
|
||||
response = str("Bot shutting down...")
|
||||
await bot.send_message(discord_message, response)
|
||||
utilities.hard_shutdown()
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
@ -9,6 +9,8 @@ class CommandTTS(AbstractCommand, metaclass=ABCMeta):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(CommandTTS.command, n_args=0, command_type=AbstractCommand.CommandType.TWITCH)
|
||||
self.help = ["MISSING HELP ENTRY",
|
||||
"\nExample:","command \"PARAM\""]
|
||||
|
||||
def do_command(self, bot, twitch_message):
|
||||
args = self.get_args(twitch_message.text)
|
||||
@ -16,3 +18,5 @@ class CommandTTS(AbstractCommand, metaclass=ABCMeta):
|
||||
bot.send_message("Bot shutting down...")
|
||||
utilities.hard_shutdown()
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
@ -11,7 +11,12 @@ class CommandTest(AbstractCommand, metaclass=ABCMeta):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(CommandTest.command, command_type=AbstractCommand.CommandType.TWITCH)
|
||||
self.help = ["MISSING HELP ENTRY",
|
||||
"\nExample:","command \"PARAM\""]
|
||||
|
||||
def do_command(self, bot, twitch_message):
|
||||
print("!test Detected")
|
||||
bot.send_message("testing acknowledged")
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
@ -10,6 +10,8 @@ class CommandTTS(AbstractCommand, metaclass=ABCMeta):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(CommandTTS.command, n_args=1, command_type=AbstractCommand.CommandType.DISCORD)
|
||||
self.help = ["MISSING HELP ENTRY",
|
||||
"\nExample:","command \"PARAM\""]
|
||||
|
||||
async def do_command(self, bot, discord_message: discord.message):
|
||||
args = self.get_args(discord_message.content)
|
||||
@ -28,3 +30,6 @@ class CommandTTS(AbstractCommand, metaclass=ABCMeta):
|
||||
response = str("tts deactivated on %s" % discord_message.guild.name)
|
||||
await bot.send_message(discord_message, response)
|
||||
bot.tts_enabled = False
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
@ -9,6 +9,8 @@ class CommandTTS(AbstractCommand, metaclass=ABCMeta):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(CommandTTS.command, n_args=1, command_type=AbstractCommand.CommandType.TWITCH)
|
||||
self.help = ["MISSING HELP ENTRY",
|
||||
"\nExample:","command \"PARAM\""]
|
||||
|
||||
def do_command(self, bot, twitch_message):
|
||||
args = self.get_args(twitch_message.text)
|
||||
@ -20,3 +22,6 @@ class CommandTTS(AbstractCommand, metaclass=ABCMeta):
|
||||
if twitch_message.sender.lower() == twitch_message.channel:
|
||||
bot.send_message("tts deactivated on #%s" % twitch_message.channel)
|
||||
bot.tts_enabled = False
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
@ -5,8 +5,8 @@ credentialsNickname = "praxis_bot"
|
||||
|
||||
twitch_module: bool = False
|
||||
discord_module: bool = False
|
||||
|
||||
test_module: bool = False
|
||||
user_module: bool = True
|
||||
|
||||
autoJoin_TwitchChannels = ["thecuriousnerd"]
|
||||
whitelisted_TwitchPowerUsers = ["thecuriousnerd"]
|
||||
@ -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_DiscordPrivateMessaging = False # Private Messaging not yet implemented
|
||||
|
||||
selected_DiscordTTSChannels = ["431129571308339210"]
|
||||
autoEnabled_DiscordChannelsTTS = False
|
||||
selected_DiscordTTSChannels = ["431129571308339210"]
|
||||
block_DiscordChannelsTTS = [""] # block supersedes the 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
|
||||
@ -41,10 +41,12 @@ blockAll_TTS_URL_Discord = True
|
||||
|
||||
autoEnabled_Discord_rgbLightControl = False
|
||||
|
||||
#User Module Configs
|
||||
blockAll_TTS_URL_UserModule = True
|
||||
|
||||
#Chyron Module Configs
|
||||
chyronListSpaceCount = 25
|
||||
|
||||
|
||||
#Lights Module Configs
|
||||
colorParse_maxDigits = 4
|
||||
|
||||
|
||||
@ -138,7 +138,13 @@ class Discord_Module(discord.Client):
|
||||
#print("isBlocked: " + str(isBlocked))
|
||||
#print("isForced: " + str(isForced))
|
||||
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('!'):
|
||||
text_to_say: str = "%s says, %s" % (message.author.display_name, message.content)
|
||||
channel_text = "%s user msg" % message.channel
|
||||
|
||||
73
help_module.py
Normal file
73
help_module.py
Normal file
@ -0,0 +1,73 @@
|
||||
from commands.command_base import AbstractCommand
|
||||
from enum import Enum
|
||||
import config as config
|
||||
import db
|
||||
|
||||
import commands.loader as command_loader
|
||||
|
||||
import credentials
|
||||
|
||||
class Help_Module():
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
#self.dbCredential: credentials.DB_Credential
|
||||
|
||||
def main(self):
|
||||
print("[Help Module]> help test")
|
||||
|
||||
def help_command_response(self, command:AbstractCommand, responseType):
|
||||
response = help_command_response()
|
||||
response.setup(command, responseType)
|
||||
response.makeResponse()
|
||||
return response
|
||||
|
||||
class help_command_responseType(Enum):
|
||||
plain = 1 # One line response
|
||||
fancy = 2 # Fancy formatted response
|
||||
|
||||
class help_command_response():
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.command = None
|
||||
self.commandName = ""
|
||||
self.helpText = ""
|
||||
self.response = ""
|
||||
self.responseType = help_command_responseType.plain
|
||||
self.blockDecor = "\n================================================================\n"
|
||||
|
||||
def setup(self, command, responseType):
|
||||
self.command = command
|
||||
self.commandName = command.command
|
||||
self.responseType = responseType
|
||||
|
||||
def makeResponse(self):
|
||||
if self.responseType == help_command_responseType.plain:
|
||||
self.response_plain()
|
||||
elif self.responseType == help_command_responseType.fancy:
|
||||
self.response_fancy()
|
||||
|
||||
def response_plain(self):
|
||||
tempHelpText = ""
|
||||
for line in self.command.help:
|
||||
tempHelpText = tempHelpText + line + " "
|
||||
self.response = "Command: " + self.commandName + " : " + self.helpText
|
||||
return self.response
|
||||
|
||||
def response_fancy(self):
|
||||
tempHelpText = ""
|
||||
for line in self.command.help:
|
||||
tempHelpText = tempHelpText + line + "\n"
|
||||
self.response = self.blockDecor + "Command: " + self.commandName + self.blockDecor + tempHelpText + self.blockDecor
|
||||
return self.response
|
||||
|
||||
|
||||
|
||||
Help_Module_ = Help_Module()
|
||||
|
||||
if __name__ == "__main__":
|
||||
testModule = Help_Module()
|
||||
|
||||
#credentials_manager = credentials.Credentials_Module()
|
||||
#credentials_manager.load_credentials()
|
||||
#testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
|
||||
testModule.main()
|
||||
23
main.py
23
main.py
@ -6,9 +6,10 @@ import time
|
||||
|
||||
import twitch_script
|
||||
import discord_script
|
||||
|
||||
import test_module
|
||||
|
||||
import user_module
|
||||
|
||||
import utilities_script as utility
|
||||
import config as config
|
||||
|
||||
@ -19,6 +20,7 @@ import threading
|
||||
twitchModule_: twitch_script.Twitch_Module
|
||||
discordModule_: discord_script.Discord_Module
|
||||
testModule_: test_module.Test_Module
|
||||
userModule_: user_module.User_Module
|
||||
|
||||
credentials_manager: credentials.Credentials_Module
|
||||
|
||||
@ -34,8 +36,9 @@ def twitch_module_init(dbCert, twitchCert):
|
||||
twitchModule_.tts_enabled = config.autoEnabled_TwitchChannelsTTS
|
||||
twitchModule_.whitelisted_users = config.whitelisted_TwitchPowerUsers
|
||||
|
||||
print("[TWITCH Module]>", "Loading Channels...")
|
||||
for twitchChannel in config.autoJoin_TwitchChannels:
|
||||
print("joining channel function")
|
||||
print("joining twitch channel:", twitchChannel)
|
||||
twitchModule_.join_channel(None, twitchChannel)
|
||||
|
||||
def discord_module_init(dbCert, discordCert):
|
||||
@ -55,20 +58,28 @@ def test_module_init(dbCert, Empty):
|
||||
#testModule_.dbCredential = dbCert
|
||||
testModule_.main()
|
||||
|
||||
def user_module_init(dbCert, Empty):
|
||||
print("-init [USER Module]")
|
||||
userModule_.dbCredential = dbCert
|
||||
userModule_.main()
|
||||
|
||||
def thread_main():
|
||||
if utility.isRunningInDocker() == True:
|
||||
print("<[DOCKER Detected]>")
|
||||
if not config.skip_splashScreen:
|
||||
utility.splashScreen()
|
||||
global credentials_manager
|
||||
global twitchModule_
|
||||
global discordModule_
|
||||
global testModule_
|
||||
global userModule_
|
||||
|
||||
credentials_manager = credentials.Credentials_Module()
|
||||
|
||||
twitchModule_ = twitch_script.Twitch_Module()
|
||||
discordModule_ = discord_script.Discord_Module()
|
||||
testModule_ = test_module.Test_Module()
|
||||
userModule_ = user_module.User_Module()
|
||||
|
||||
credentials_manager.load_credentials()
|
||||
dbCert: credentials.DB_Credential = credentials_manager.find_Credential(credentials.DB_Credential, config.credentialsNickname)
|
||||
@ -91,11 +102,19 @@ def thread_main():
|
||||
threads.append(thread_)
|
||||
thread_.start()
|
||||
|
||||
if config.user_module == True:
|
||||
if utility.isRunningInDocker() == False:
|
||||
config.user_module = False
|
||||
thread_ = threading.Thread(target=user_module_init, args=(dbCert, None))
|
||||
threads.append(thread_)
|
||||
thread_.start()
|
||||
|
||||
print("---Post Thread Creation Test---")
|
||||
for t in threads:
|
||||
t.join()
|
||||
|
||||
print("---Point of no return---")
|
||||
if utility.isRunningInDocker() == False:
|
||||
input()
|
||||
|
||||
|
||||
|
||||
@ -1 +1,2 @@
|
||||
cd "c:\praxis"
|
||||
python "c:/Praxis/main.py"
|
||||
2
praxis-user.bat
Normal file
2
praxis-user.bat
Normal file
@ -0,0 +1,2 @@
|
||||
cd "c:\praxis"
|
||||
python "c:\praxis\user_module.py"
|
||||
5
tts.py
5
tts.py
@ -6,12 +6,17 @@ import requests
|
||||
from gtts import gTTS
|
||||
from playsound import playsound
|
||||
|
||||
import utilities_script as utility
|
||||
import config
|
||||
|
||||
streamLabsUrl = "https://streamlabs.com/polly/speak"
|
||||
|
||||
def tts(inputText: str, *args):
|
||||
outpath = create_speech_file(inputText)
|
||||
if utility.isRunningInDocker() == True:
|
||||
print("Docker Detected, skipping playsound()")
|
||||
else:
|
||||
print("Playing Sound...")
|
||||
playsound(outpath)
|
||||
|
||||
|
||||
|
||||
@ -9,6 +9,8 @@ from commands.command_base import AbstractCommand
|
||||
|
||||
from cooldowns import Cooldown_Module
|
||||
|
||||
import utilities_script as utility
|
||||
|
||||
class User_Module():
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@ -17,15 +19,18 @@ class User_Module():
|
||||
self.MessageLog:list = []
|
||||
|
||||
def main(self):
|
||||
print("\nWaiting on User input...")
|
||||
print("\nWaiting on User input...\n")
|
||||
inputLoop = True
|
||||
if utility.isRunningInDocker() == True:
|
||||
inputLoop = False
|
||||
print("\nNo User's Input Allowed")
|
||||
while inputLoop:
|
||||
keyboardInput = input()
|
||||
message = UserMessage()
|
||||
message.makeMessage(message=keyboardInput)
|
||||
|
||||
if "exit" in keyboardInput:
|
||||
print("Quitting User Module Interface...")
|
||||
print("Quitting [User Module] Interface...")
|
||||
inputLoop = False
|
||||
break
|
||||
|
||||
|
||||
@ -35,9 +35,9 @@ def does_contain_OnlyNumbers(text):
|
||||
return isJustNumbers
|
||||
|
||||
def rescale_value(value, min, max):
|
||||
print("trying Rescale")
|
||||
#print("trying Rescale")
|
||||
returnValue = (value - min) / (max - min)
|
||||
print("got ", returnValue)
|
||||
#print("got ", returnValue)
|
||||
return returnValue
|
||||
|
||||
def get_dir(selected_dir):
|
||||
@ -65,6 +65,12 @@ def contains_slur(input: str):
|
||||
print("<{ slur detected! }> ")
|
||||
return containsSlur
|
||||
|
||||
def isRunningInDocker():
|
||||
isD = os.getenv('ISDOCKER')
|
||||
if isD is None:
|
||||
return False
|
||||
return isD == "cat"
|
||||
|
||||
def hard_shutdown():
|
||||
current_system_pid = os.getpid()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user