Compare commits
1 Commits
master
...
user-clien
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f872f1fe07 |
75
README.md
75
README.md
@ -2,44 +2,27 @@ An evolving chatbot to help users primarily with live stream production and effe
|
|||||||
|
|
||||||
___
|
___
|
||||||
|
|
||||||
# Praxis Bot
|
# Standalone V2 Info
|
||||||
|
|
||||||
## Docker:
|
## Docker:
|
||||||
|
|
||||||
This bot primarily uses docker to run various services.
|
|
||||||
### Image Setup:
|
### Image Setup:
|
||||||
|
|
||||||
Use the following command to setup all the images.
|
Use these commands to build the images.</br>
|
||||||
|
`docker build --file Dockerfile_standalone_command --tag standalone_command .`</br>
|
||||||
Windows: `makedockerimages.bat`<br>
|
`docker build --file Dockerfile_standalone_channelRewards --tag standalone_channelrewards .`</br>
|
||||||
Linux: `makedockerimages.sh`
|
`docker build --file Dockerfile_standalone_lights --tag standalone_lights .`</br>
|
||||||
|
`docker build --file Dockerfile_standalone_DiscordScript --tag standalone_discordscript .`</br>
|
||||||
|
`docker build --file Dockerfile_standalone_TwitchScript --tag standalone_twitchscript .`</br>
|
||||||
|
`docker build --file Dockerfile_standalone_Twitch_Pubsub --tag standalone_twitch_pubsub .`</br>
|
||||||
|
|
||||||
### Docker-Compose Info:
|
### Docker-Compose Info:
|
||||||
|
|
||||||
To Start:
|
To Start:
|
||||||
`docker-compose up -d`<br>
|
`docker-compose up -d`</br>
|
||||||
To Stop:
|
To Stop:
|
||||||
`docker-compose down`<br>
|
`docker-compose down`</br>
|
||||||
<br>
|
</br>
|
||||||
___
|
|
||||||
|
|
||||||
### User TTS Speaker:
|
|
||||||
To receive audio from standalone_tt_core.py launch standalone_tts_speaker.py.
|
|
||||||
|
|
||||||
`python standalone_tts_speaker.py`
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
windows: `praxis-tts-speaker.bat` Modify this to match the correct directory! Or no work for YOU!!!<br>
|
|
||||||
linux: `praxis-tts-speaker.sh`<br>
|
|
||||||
<br>
|
|
||||||
___
|
|
||||||
|
|
||||||
### User Web Client:
|
|
||||||
|
|
||||||
To access the User Client visit `index.html` from `\user_client\v1\` in your browser.<br>
|
|
||||||
<br>
|
|
||||||
___
|
___
|
||||||
|
|
||||||
# Credentials:
|
# Credentials:
|
||||||
@ -47,12 +30,9 @@ ___
|
|||||||
## Credentials Setup:
|
## Credentials Setup:
|
||||||
|
|
||||||
Create a json based on the templates and put them into the `/credentials/` folder.
|
Create a json based on the templates and put them into the `/credentials/` folder.
|
||||||
Refer to the `/credential_templates/` folder for examples.<br>
|
Refer to the `/credential_templates/` folder for examples.
|
||||||
<br>
|
|
||||||
|
|
||||||
## For Twitch Credentials:
|
### For Twitch Credentials
|
||||||
|
|
||||||
### Twitch IRC Chat Credentials:
|
|
||||||
Username = `TwitchUsername` *(Must match ***credentialsNickname*** in config)*
|
Username = `TwitchUsername` *(Must match ***credentialsNickname*** in config)*
|
||||||
|
|
||||||
Helix Client ID = `https://dev.twitch.tv/console/apps`
|
Helix Client ID = `https://dev.twitch.tv/console/apps`
|
||||||
@ -61,34 +41,15 @@ Oauth = `https://twitchapps.com/tmi/`
|
|||||||
|
|
||||||
V5 Client ID = `https://twitchtokengenerator.com/`
|
V5 Client ID = `https://twitchtokengenerator.com/`
|
||||||
|
|
||||||
### Twitch PubSub Credentials:
|
### For Database Credentials
|
||||||
|
|
||||||
pubsub_client_id = `https://dev.twitch.tv/console/apps` Set url to `http://localhost:17563`
|
|
||||||
pubsub_secret = `^Look at Instructions Above^`
|
|
||||||
|
|
||||||
pubsub_AccessToken = Generate by using: `python twitch_generate_credentials.py`
|
|
||||||
pubsub_RefreshToken = `^Look at Instructions Above^`<br>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## For Database Credentials:
|
|
||||||
Will be replaced soon.<br>The current `db.py` file is not being used for now.<br>
|
|
||||||
~~Nickname = `Anything You Want` *(Must match ***credentialsNickname*** in config)*~~
|
|
||||||
|
|
||||||
~~Engine = `"mysql+mysqlconnector://root:password@localhost:3306/DatabaseName"`~~<br>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## For Discord Credentials:
|
|
||||||
Nickname = `Anything You Want` *(Must match ***credentialsNickname*** in config)*
|
Nickname = `Anything You Want` *(Must match ***credentialsNickname*** in config)*
|
||||||
|
|
||||||
Token = `https://discord.com/developers/`<br>
|
Engine = `"mysql+mysqlconnector://root:password@localhost:3306/DatabaseName"`
|
||||||
<br>
|
|
||||||
|
|
||||||
## Phue Credentials:
|
### For Discord Credentials
|
||||||
The lights module will only be able to establish and generate credentials if the button on the bridge is pressed prior to running the script via:
|
Nickname = `Anything You Want` *(Must match ***credentialsNickname*** in config)*
|
||||||
`python lights_module.py`<br>
|
|
||||||
|
|
||||||
After running a credential file will be created in the user's home directory on their operating system called `.python_hue` this can then be moved into the credentials folder.<br>
|
Token = `https://discord.com/developers/`
|
||||||
<br>
|
|
||||||
|
|
||||||
## Credential Usage:
|
## Credential Usage:
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ class ChannelReward_RubiksCube(AbstractChannelRewards, metaclass=ABCMeta):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def get_Phrase(self, defaultRewardPrompt,
|
def get_Phrase(self, defaultRewardPrompt,
|
||||||
phrases = [" thinks its time to solve a cube "]):
|
phrases = [""]):
|
||||||
|
|
||||||
phrases.append(defaultRewardPrompt)
|
phrases.append(defaultRewardPrompt)
|
||||||
totalPhrases = len(phrases) - 1
|
totalPhrases = len(phrases) - 1
|
||||||
|
|||||||
@ -142,6 +142,6 @@ PollyVoice = PollyVoices.Justin
|
|||||||
#Misc Configs
|
#Misc Configs
|
||||||
slurList = badwords.slurList
|
slurList = badwords.slurList
|
||||||
|
|
||||||
praxisVersion_Alpha = "0 " #Build
|
praxisVersion_Alpha = "A.0 "
|
||||||
praxisVersion_Delta = "1 " #Minor
|
praxisVersion_Delta = "D.1 "
|
||||||
praxisVersion_Omega = "0.8 " #Major
|
praxisVersion_Omega = "O.0 "
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
from commands.command_base import AbstractCommand
|
from commands.command_base import AbstractCommand
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
import config as config
|
import config as config
|
||||||
|
import db
|
||||||
|
|
||||||
import commands.loader as command_loader
|
import commands.loader as command_loader
|
||||||
|
|
||||||
@ -9,6 +10,7 @@ import credentials
|
|||||||
class Help_Module():
|
class Help_Module():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
#self.dbCredential: credentials.DB_Credential
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
print("[Help Module]> help test")
|
print("[Help Module]> help test")
|
||||||
@ -66,4 +68,7 @@ Help_Module_ = Help_Module()
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
testModule = Help_Module()
|
testModule = Help_Module()
|
||||||
|
|
||||||
|
#credentials_manager = credentials.Credentials_Module()
|
||||||
|
#credentials_manager.load_credentials()
|
||||||
|
#testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
|
||||||
testModule.main()
|
testModule.main()
|
||||||
@ -1,11 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
docker build --file Dockerfile_standalone_user_client.Dockerfile --tag standalone_user_client .
|
|
||||||
docker build --file Dockerfile_standalone_eventlog.Dockerfile --tag standalone_eventlog .
|
|
||||||
docker build --file Dockerfile_standalone_command.Dockerfile --tag standalone_command .
|
|
||||||
docker build --file Dockerfile_standalone_channelRewards.Dockerfile --tag standalone_channelrewards .
|
|
||||||
docker build --file Dockerfile_standalone_lights.Dockerfile --tag standalone_lights .
|
|
||||||
docker build --file Dockerfile_standalone_tts_core.Dockerfile --tag standalone_tts_core .
|
|
||||||
docker build --file Dockerfile_standalone_websource.Dockerfile --tag standalone_websource .
|
|
||||||
docker build --file Dockerfile_standalone_DiscordScript.Dockerfile --tag standalone_discordscript .
|
|
||||||
docker build --file Dockerfile_standalone_TwitchScript.Dockerfile --tag standalone_twitchscript .
|
|
||||||
docker build --file Dockerfile_standalone_Twitch_Pubsub.Dockerfile --tag standalone_twitch_pubsub .
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
python "c:\praxis\standalone_tts_speaker.py"
|
|
||||||
2
praxis-user.bat
Normal file
2
praxis-user.bat
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
cd "c:\praxis"
|
||||||
|
python "c:\praxis\standalone_user_cli.py"
|
||||||
@ -20,9 +20,12 @@ import utilities_script as utility
|
|||||||
import chyron_module
|
import chyron_module
|
||||||
import timers_module
|
import timers_module
|
||||||
|
|
||||||
|
import requests
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
from json import loads
|
||||||
|
from urllib.parse import urlencode
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
import event_logs.event_log_Module
|
import event_logs.event_log_Module
|
||||||
@ -74,16 +77,38 @@ def get_events():
|
|||||||
return flask.make_response("{\"message\":\"%s\"}" % payload.decode(), 200, {"Content-Type": "application/json"})
|
return flask.make_response("{\"message\":\"%s\"}" % payload.decode(), 200, {"Content-Type": "application/json"})
|
||||||
|
|
||||||
def reRunEvent_handler(eventName, eventTime, eventType, eventSender, eventData):
|
def reRunEvent_handler(eventName, eventTime, eventType, eventSender, eventData):
|
||||||
attempt_Event_Rerun(eventName, eventTime, eventType, eventSender, eventData)
|
returnString = attempt_Event_Rerun(eventName, eventTime, eventType, eventSender, eventData)
|
||||||
return flask.make_response("{\"message\":\"%s\"}" % 'rerunning event....', 200, {"Content-Type": "application/json"})
|
return flask.make_response("{\"message\":\"%s\"}" % returnString, 200, {"Content-Type": "application/json"})
|
||||||
|
|
||||||
def attempt_Event_Rerun(eventName, eventTime, eventType, eventSender, eventData):
|
def attempt_Event_Rerun(eventName, eventTime, eventType, eventSender, eventData):
|
||||||
returnString = ""
|
returnString = ""
|
||||||
try:
|
try:
|
||||||
return flask.make_response("{\"message\":\"%s\"}" % returnString, 200, {"Content-Type": "application/json"})
|
if "reward" in eventType:
|
||||||
|
pass
|
||||||
|
return returnString
|
||||||
except:
|
except:
|
||||||
returnString = "Something Went Wrong!"
|
returnString = "Something Went Wrong!"
|
||||||
return flask.make_response("{\"message\":\"%s\"}" % returnString, 200, {"Content-Type": "application/json"})
|
return returnString
|
||||||
|
|
||||||
|
def attempt_Event_Rerun_Send(serviceName, servicePort, params):
|
||||||
|
try:
|
||||||
|
url = "http://"+ serviceName + ":"+ servicePort + "/api/v1/get_list/all"
|
||||||
|
resp = requests.get(url)
|
||||||
|
|
||||||
|
if resp.status_code == 200:
|
||||||
|
print("Got the following message: %s" % resp.text)
|
||||||
|
data = loads(resp.text)
|
||||||
|
msg = data['message']
|
||||||
|
if msg is not None:
|
||||||
|
praxis_logger_obj.log(msg)
|
||||||
|
return msg
|
||||||
|
# todo send to logger and other relevent services
|
||||||
|
else:
|
||||||
|
# todo handle failed requests
|
||||||
|
return flask.make_response("{\"message\": \"%s\"}" % "Minor Mess up on attempt_Event_Rerun_Send", 200, {"Content-Type": "application/json"})
|
||||||
|
except:
|
||||||
|
return flask.make_response("{\"message\": \"%s\"}" % "Major Mess up on attempt_Event_Rerun_Send", 200, {"Content-Type": "application/json"})
|
||||||
|
|
||||||
|
|
||||||
@api.route('/')
|
@api.route('/')
|
||||||
def bot_StatusIcon():
|
def bot_StatusIcon():
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
import config as config
|
import config as config
|
||||||
|
import db
|
||||||
|
|
||||||
import credentials
|
import credentials
|
||||||
|
|
||||||
class Test_Module():
|
class Test_Module():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
self.dbCredential: credentials.DB_Credential
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
print("[TEST Module]> test")
|
print("[TEST Module]> test")
|
||||||
@ -14,4 +15,7 @@ class Test_Module():
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
testModule = Test_Module()
|
testModule = Test_Module()
|
||||||
|
|
||||||
|
credentials_manager = credentials.Credentials_Module()
|
||||||
|
credentials_manager.load_credentials()
|
||||||
|
testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
|
||||||
testModule.main()
|
testModule.main()
|
||||||
@ -286,26 +286,12 @@
|
|||||||
<div class="col s12 center">
|
<div class="col s12 center">
|
||||||
<h1>Made by Alex Orid,<br> The Curious Nerd</h1>
|
<h1>Made by Alex Orid,<br> The Curious Nerd</h1>
|
||||||
<h5>Need Help? Want to help out?<br><a href="https://discord.com/invite/sNTXWn4" target="_blank">Come visit my Discord</a></h5>
|
<h5>Need Help? Want to help out?<br><a href="https://discord.com/invite/sNTXWn4" target="_blank">Come visit my Discord</a></h5>
|
||||||
<p>Version:<br> A:0 D:1 O:0.8</p>
|
<p>Version:<br> A:0 D:1 O:8</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
||||||
<script src="js/materialize.js"></script>
|
<script src="js/materialize.js"></script>
|
||||||
|
|
||||||
|
|||||||
@ -216,7 +216,7 @@ async function updateEventList() {
|
|||||||
"<div class=\"col s12 m3\"><p>Event: <br>"+ eventName +"</p><br></div>"+
|
"<div class=\"col s12 m3\"><p>Event: <br>"+ eventName +"</p><br></div>"+
|
||||||
"<div class=\"col s12 m3\"><p>User: <br>"+ eventSender +"</p><br></div>"+
|
"<div class=\"col s12 m3\"><p>User: <br>"+ eventSender +"</p><br></div>"+
|
||||||
"<div class=\"col s12 m3\"><p>Message: <br>"+ eventData +"</p><br></div>"+
|
"<div class=\"col s12 m3\"><p>Message: <br>"+ eventData +"</p><br></div>"+
|
||||||
'<a onclick="'+ reRunEvent_Params +'" class="hide btn waves-effect waves-light green right col s1" style="position: absolute; right: 0; top: 0; width: 3em;">'+
|
'<a onclick="'+ reRunEvent_Params +'" class="btn waves-effect waves-light green right col s1" style="position: absolute; right: 0; top: 0; width: 3em;">'+
|
||||||
"<i class=\"material-icons\">refresh</i>"+
|
"<i class=\"material-icons\">refresh</i>"+
|
||||||
"</a></div>"
|
"</a></div>"
|
||||||
$("#EventHistoryWrapper").prepend(template);
|
$("#EventHistoryWrapper").prepend(template);
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
from enum import Enum
|
from enum import Enum
|
||||||
import time
|
import time
|
||||||
import config as config
|
import config as config
|
||||||
|
import db
|
||||||
import tts
|
import tts
|
||||||
|
|
||||||
import credentials
|
import credentials
|
||||||
@ -15,6 +16,7 @@ import utilities_script as utility
|
|||||||
class User_Module():
|
class User_Module():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
self.dbCredential: credentials.DB_Credential
|
||||||
self.MessageLog:list = []
|
self.MessageLog:list = []
|
||||||
self.commands = command_loader.load_commands_new(AbstractCommand.CommandType.Praxis)
|
self.commands = command_loader.load_commands_new(AbstractCommand.CommandType.Praxis)
|
||||||
self.UseFlagTypeMap = { # this is a mapping of the UserFlagTypes enum to function pointers
|
self.UseFlagTypeMap = { # this is a mapping of the UserFlagTypes enum to function pointers
|
||||||
@ -131,4 +133,7 @@ class UserFlag():
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
testModule = User_Module()
|
testModule = User_Module()
|
||||||
|
|
||||||
|
credentials_manager = credentials.Credentials_Module()
|
||||||
|
credentials_manager.load_credentials()
|
||||||
|
testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
|
||||||
testModule.main()
|
testModule.main()
|
||||||
Loading…
Reference in New Issue
Block a user