Compare commits

..

1 Commits

Author SHA1 Message Date
Alex Orid
f872f1fe07 Reload Rewards Initial Commit 2021-05-13 15:04:32 -04:00
12 changed files with 70 additions and 95 deletions

View File

@ -2,44 +2,27 @@ An evolving chatbot to help users primarily with live stream production and effe
___
# Praxis Bot
# Standalone V2 Info
## Docker:
This bot primarily uses docker to run various services.
### Image Setup:
Use the following command to setup all the images.
Windows: `makedockerimages.bat`<br>
Linux: `makedockerimages.sh`
Use these commands to build the images.</br>
`docker build --file Dockerfile_standalone_command --tag standalone_command .`</br>
`docker build --file Dockerfile_standalone_channelRewards --tag standalone_channelrewards .`</br>
`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:
To Start:
`docker-compose up -d`<br>
`docker-compose up -d`</br>
To Stop:
`docker-compose down`<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>
`docker-compose down`</br>
</br>
___
# Credentials:
@ -47,12 +30,9 @@ ___
## Credentials Setup:
Create a json based on the templates and put them into the `/credentials/` folder.
Refer to the `/credential_templates/` folder for examples.<br>
<br>
Refer to the `/credential_templates/` folder for examples.
## For Twitch Credentials:
### Twitch IRC Chat Credentials:
### For Twitch Credentials
Username = `TwitchUsername` *(Must match ***credentialsNickname*** in config)*
Helix Client ID = `https://dev.twitch.tv/console/apps`
@ -61,34 +41,15 @@ Oauth = `https://twitchapps.com/tmi/`
V5 Client ID = `https://twitchtokengenerator.com/`
### Twitch PubSub 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:
### For Database Credentials
Nickname = `Anything You Want` *(Must match ***credentialsNickname*** in config)*
Token = `https://discord.com/developers/`<br>
<br>
Engine = `"mysql+mysqlconnector://root:password@localhost:3306/DatabaseName"`
## Phue 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:
`python lights_module.py`<br>
### For Discord Credentials
Nickname = `Anything You Want` *(Must match ***credentialsNickname*** in config)*
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>
<br>
Token = `https://discord.com/developers/`
## Credential Usage:

View File

@ -77,7 +77,7 @@ class ChannelReward_RubiksCube(AbstractChannelRewards, metaclass=ABCMeta):
pass
def get_Phrase(self, defaultRewardPrompt,
phrases = [" thinks its time to solve a cube "]):
phrases = [""]):
phrases.append(defaultRewardPrompt)
totalPhrases = len(phrases) - 1

View File

@ -142,6 +142,6 @@ PollyVoice = PollyVoices.Justin
#Misc Configs
slurList = badwords.slurList
praxisVersion_Alpha = "0 " #Build
praxisVersion_Delta = "1 " #Minor
praxisVersion_Omega = "0.8 " #Major
praxisVersion_Alpha = "A.0 "
praxisVersion_Delta = "D.1 "
praxisVersion_Omega = "O.0 "

View File

@ -1,6 +1,7 @@
from commands.command_base import AbstractCommand
from enum import Enum
import config as config
import db
import commands.loader as command_loader
@ -9,6 +10,7 @@ import credentials
class Help_Module():
def __init__(self):
super().__init__()
#self.dbCredential: credentials.DB_Credential
def main(self):
print("[Help Module]> help test")
@ -66,4 +68,7 @@ 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()

View File

@ -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 .

View File

@ -1,2 +0,0 @@
#!/bin/bash
python "c:\praxis\standalone_tts_speaker.py"

2
praxis-user.bat Normal file
View File

@ -0,0 +1,2 @@
cd "c:\praxis"
python "c:\praxis\standalone_user_cli.py"

View File

@ -20,9 +20,12 @@ import utilities_script as utility
import chyron_module
import timers_module
import requests
import random
import json
from json import loads
from urllib.parse import urlencode
import base64
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"})
def reRunEvent_handler(eventName, eventTime, eventType, eventSender, eventData):
attempt_Event_Rerun(eventName, eventTime, eventType, eventSender, eventData)
return flask.make_response("{\"message\":\"%s\"}" % 'rerunning event....', 200, {"Content-Type": "application/json"})
returnString = attempt_Event_Rerun(eventName, eventTime, eventType, eventSender, eventData)
return flask.make_response("{\"message\":\"%s\"}" % returnString, 200, {"Content-Type": "application/json"})
def attempt_Event_Rerun(eventName, eventTime, eventType, eventSender, eventData):
returnString = ""
try:
return flask.make_response("{\"message\":\"%s\"}" % returnString, 200, {"Content-Type": "application/json"})
if "reward" in eventType:
pass
return returnString
except:
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('/')
def bot_StatusIcon():

View File

@ -1,11 +1,12 @@
import config as config
import db
import credentials
class Test_Module():
def __init__(self):
super().__init__()
self.dbCredential: credentials.DB_Credential
def main(self):
print("[TEST Module]> test")
@ -14,4 +15,7 @@ class Test_Module():
if __name__ == "__main__":
testModule = Test_Module()
credentials_manager = credentials.Credentials_Module()
credentials_manager.load_credentials()
testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
testModule.main()

View File

@ -286,26 +286,12 @@
<div class="col s12 center">
<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>
<p>Version:<br> A:0 D:1 O:0.8</p>
<p>Version:<br> A:0 D:1 O:8</p>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="js/materialize.js"></script>

View File

@ -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>User: <br>"+ eventSender +"</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>"+
"</a></div>"
$("#EventHistoryWrapper").prepend(template);

View File

@ -1,6 +1,7 @@
from enum import Enum
import time
import config as config
import db
import tts
import credentials
@ -15,6 +16,7 @@ import utilities_script as utility
class User_Module():
def __init__(self):
super().__init__()
self.dbCredential: credentials.DB_Credential
self.MessageLog:list = []
self.commands = command_loader.load_commands_new(AbstractCommand.CommandType.Praxis)
self.UseFlagTypeMap = { # this is a mapping of the UserFlagTypes enum to function pointers
@ -131,4 +133,7 @@ class UserFlag():
if __name__ == "__main__":
testModule = User_Module()
credentials_manager = credentials.Credentials_Module()
credentials_manager.load_credentials()
testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
testModule.main()