Merge pull request 'master' (#25) from master into Command-Management-Module
Reviewed-on: #25
This commit is contained in:
commit
6bab6d5342
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: ",
|
||||
|
||||
@ -33,8 +33,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
|
||||
|
||||
@ -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
|
||||
|
||||
8
main.py
8
main.py
@ -36,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):
|
||||
@ -63,6 +64,8 @@ def user_module_init(dbCert, Empty):
|
||||
userModule_.main()
|
||||
|
||||
def thread_main():
|
||||
if utility.isRunningInDocker() == True:
|
||||
print("<[DOCKER Detected]>")
|
||||
if not config.skip_splashScreen:
|
||||
utility.splashScreen()
|
||||
global credentials_manager
|
||||
@ -100,6 +103,8 @@ def thread_main():
|
||||
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()
|
||||
@ -109,6 +114,7 @@ def thread_main():
|
||||
t.join()
|
||||
|
||||
print("---Point of no return---")
|
||||
if utility.isRunningInDocker() == False:
|
||||
input()
|
||||
|
||||
|
||||
|
||||
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__()
|
||||
@ -19,6 +21,9 @@ class User_Module():
|
||||
def main(self):
|
||||
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()
|
||||
|
||||
@ -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