Compare commits
No commits in common. "master" and "electron-UI_for-V2" have entirely different histories.
master
...
electron-U
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,4 +7,3 @@ stream_sources/chyron.txt
|
|||||||
stream_sources/brb.txt
|
stream_sources/brb.txt
|
||||||
*.log
|
*.log
|
||||||
timers/
|
timers/
|
||||||
event_logs/logs/
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
FROM python:3.7.10-alpine3.12
|
|
||||||
|
|
||||||
WORKDIR /Praxis
|
|
||||||
|
|
||||||
COPY requirements_sa_command.txt requirements_sa_command.txt
|
|
||||||
RUN apk add --update gcc libc-dev linux-headers && rm -rf /var/cache/apk/*
|
|
||||||
RUN pip3 install -r requirements_sa_command.txt
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
CMD [ "python3", "standalone_eventLog.py"]
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
FROM python:3.10.0a7-alpine3.13
|
|
||||||
|
|
||||||
WORKDIR /Praxis
|
|
||||||
|
|
||||||
COPY requirements_sa_command.txt requirements_sa_command.txt
|
|
||||||
RUN apk add --update gcc libc-dev linux-headers && rm -rf /var/cache/apk/*
|
|
||||||
RUN pip3 install -r requirements_sa_command.txt
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
CMD [ "python3", "standalone_user_client.py"]
|
|
||||||
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
|
||||||
|
|||||||
@ -76,7 +76,7 @@ class ChannelReward_Workout_Pushups(AbstractChannelRewards, metaclass=ABCMeta):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def get_Phrase(self, defaultRewardPrompt,
|
def get_Phrase(self, defaultRewardPrompt,
|
||||||
phrases = [" demands that The Curious Nerd, to do 20 pushups "]):
|
phrases = [""]):
|
||||||
|
|
||||||
phrases.append(defaultRewardPrompt)
|
phrases.append(defaultRewardPrompt)
|
||||||
totalPhrases = len(phrases) - 1
|
totalPhrases = len(phrases) - 1
|
||||||
|
|||||||
@ -76,7 +76,7 @@ class ChannelReward_Workout_Situps(AbstractChannelRewards, metaclass=ABCMeta):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def get_Phrase(self, defaultRewardPrompt,
|
def get_Phrase(self, defaultRewardPrompt,
|
||||||
phrases = [" demands that The Curious Nerd, to do 20 sit-ups "]):
|
phrases = [""]):
|
||||||
|
|
||||||
phrases.append(defaultRewardPrompt)
|
phrases.append(defaultRewardPrompt)
|
||||||
totalPhrases = len(phrases) - 1
|
totalPhrases = len(phrases) - 1
|
||||||
|
|||||||
@ -76,7 +76,7 @@ class ChannelReward_Workout_Squats(AbstractChannelRewards, metaclass=ABCMeta):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def get_Phrase(self, defaultRewardPrompt,
|
def get_Phrase(self, defaultRewardPrompt,
|
||||||
phrases = [" demands that The Curious Nerd, to do 20 squats "]):
|
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,21 +1,5 @@
|
|||||||
version: '3.7'
|
version: '3.7'
|
||||||
services:
|
services:
|
||||||
standalone_user_client:
|
|
||||||
image: standalone_user_client
|
|
||||||
volumes:
|
|
||||||
- "./:/Praxis/"
|
|
||||||
ports:
|
|
||||||
- 42055:42055
|
|
||||||
environment:
|
|
||||||
- ISDOCKER=cat
|
|
||||||
standalone_eventlog:
|
|
||||||
image: standalone_eventlog
|
|
||||||
volumes:
|
|
||||||
- "./:/Praxis/"
|
|
||||||
ports:
|
|
||||||
- 42008:42008
|
|
||||||
environment:
|
|
||||||
- ISDOCKER=cat
|
|
||||||
standalone_command:
|
standalone_command:
|
||||||
image: standalone_command
|
image: standalone_command
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@ -1,135 +0,0 @@
|
|||||||
from datetime import datetime
|
|
||||||
import random
|
|
||||||
import os
|
|
||||||
import json
|
|
||||||
import utilities_script as utility
|
|
||||||
|
|
||||||
from os import listdir
|
|
||||||
from os.path import isfile, join
|
|
||||||
|
|
||||||
class event_log():
|
|
||||||
def __init__(self, eventName, eventTime, eventType, eventSender, eventData):
|
|
||||||
super().__init__()
|
|
||||||
self.eventName = eventName
|
|
||||||
self.eventTime = eventTime
|
|
||||||
self.eventType = eventType
|
|
||||||
self.eventSender = eventSender
|
|
||||||
self.eventData = eventData
|
|
||||||
|
|
||||||
|
|
||||||
class Event_Log_Module():
|
|
||||||
def __init__(self):
|
|
||||||
super().__init__()
|
|
||||||
self.Event_Log_List = []
|
|
||||||
self.Event_Log_FileName_Bonus = "%s_%s_%s-%s_%s_%s_event_log" % (str(datetime.now().year), str(datetime.now().month), str(datetime.now().day),str(datetime.now().hour), str(datetime.now().minute), str(datetime.now().second))
|
|
||||||
self.Event_Log_FileName = "COMPLETE_event_log"
|
|
||||||
|
|
||||||
def main(self):
|
|
||||||
self.load_HistoricLogs()
|
|
||||||
|
|
||||||
def makeFile(self, fileName):
|
|
||||||
dir = utility.get_dir("event_logs/logs")
|
|
||||||
script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in
|
|
||||||
relative_path = fileName + ".json"
|
|
||||||
real_file_path = os.path.join(script_dir, dir, relative_path)
|
|
||||||
|
|
||||||
# with open(real_file_path, 'w') as cred_w:
|
|
||||||
# #data = json.load(event_log_obj)
|
|
||||||
# dic = {}
|
|
||||||
# dic['eventName'] = event_log_obj.eventName
|
|
||||||
# dic['eventTime'] = str(event_log_obj.eventTime)
|
|
||||||
# dic['eventType'] = str(event_log_obj.eventType)
|
|
||||||
# dic['eventData'] = str(event_log_obj.eventData)
|
|
||||||
# json.dump(dic, cred_w, indent=2)
|
|
||||||
|
|
||||||
newList = []
|
|
||||||
for event in self.Event_Log_List:
|
|
||||||
newDic = {}
|
|
||||||
newDic['eventName'] = event.eventName
|
|
||||||
newDic['eventTime'] = str(event.eventTime)
|
|
||||||
newDic['eventType'] = str(event.eventType)
|
|
||||||
newDic['eventSender'] = str(event.eventSender)
|
|
||||||
newDic['eventData'] = str(event.eventData)
|
|
||||||
newList.append(newDic)
|
|
||||||
with open(real_file_path, 'w') as logFile:
|
|
||||||
json.dump(newList, logFile, indent=2)
|
|
||||||
|
|
||||||
def readFile(self, fileName):
|
|
||||||
dir = utility.get_dir("event_logs/logs")
|
|
||||||
script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in
|
|
||||||
relative_path = fileName + ".json"
|
|
||||||
real_file_path = os.path.join(script_dir, dir, relative_path)
|
|
||||||
|
|
||||||
newList = []
|
|
||||||
with open(real_file_path, 'r') as eventlog_:
|
|
||||||
data = json.load(eventlog_)
|
|
||||||
for d in data:
|
|
||||||
eventName = d['eventName']
|
|
||||||
eventTime = d['eventTime']
|
|
||||||
eventType = d['eventType']
|
|
||||||
eventSender = d['eventSender']
|
|
||||||
eventData = d['eventData']
|
|
||||||
|
|
||||||
foundLog = event_log(eventName, eventTime, eventType, eventSender, eventData)
|
|
||||||
newList.append(foundLog)
|
|
||||||
return newList
|
|
||||||
|
|
||||||
def deleteFile(self, fileName):
|
|
||||||
dir = utility.get_dir("event_logs/logs")
|
|
||||||
script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in
|
|
||||||
relative_path = fileName + ".json"
|
|
||||||
real_file_path = os.path.join(script_dir, dir, relative_path)
|
|
||||||
os.remove(real_file_path)
|
|
||||||
|
|
||||||
def get_base_dir(self) -> str:
|
|
||||||
cwd = os.getcwd()
|
|
||||||
split = os.path.split(cwd)
|
|
||||||
current = split[len(split) - 1]
|
|
||||||
if current == 'event_logs/logs':
|
|
||||||
return self.check_dir(cwd)
|
|
||||||
elif current == 'Praxis_Bot' or current == 'Praxis':
|
|
||||||
return self.check_dir(os.path.join(cwd, "event_logs/logs"))
|
|
||||||
else:
|
|
||||||
print("could not find working directory for Praxis_Bot/event_logs/logs")
|
|
||||||
raise Exception
|
|
||||||
|
|
||||||
def get_implementations_dir(self) -> str:
|
|
||||||
return self.check_dir(os.path.join(self.get_base_dir()))
|
|
||||||
|
|
||||||
def check_dir(self, path: str) -> str:
|
|
||||||
if not os.path.exists(path):
|
|
||||||
os.mkdir(path, 0x777)
|
|
||||||
return path
|
|
||||||
|
|
||||||
def make_event(self, eventName, eventTime, eventType, eventSender, eventData):
|
|
||||||
newLog = event_log(eventName, eventTime, eventType, eventSender, eventData)
|
|
||||||
self.Event_Log_List.append(newLog)
|
|
||||||
self.makeFile(self.Event_Log_FileName)
|
|
||||||
self.makeFile(self.Event_Log_FileName_Bonus)
|
|
||||||
return newLog
|
|
||||||
|
|
||||||
def get_recent_logs(self, howFarBack):
|
|
||||||
newList = []
|
|
||||||
try:
|
|
||||||
for event in self.Event_Log_List:
|
|
||||||
#recentLog = self.Event_Log_List[-x]
|
|
||||||
newDic = {}
|
|
||||||
newDic['eventName'] = event.eventName
|
|
||||||
newDic['eventTime'] = str(event.eventTime)
|
|
||||||
newDic['eventType'] = str(event.eventType)
|
|
||||||
newDic['eventSender'] = str(event.eventSender)
|
|
||||||
newDic['eventData'] = str(event.eventData)
|
|
||||||
newList.append(newDic)
|
|
||||||
except:
|
|
||||||
return newList
|
|
||||||
return newList
|
|
||||||
|
|
||||||
def load_HistoricLogs(self):
|
|
||||||
try:
|
|
||||||
self.Event_Log_List = self.readFile(self.Event_Log_FileName)
|
|
||||||
self.makeFile(self.Event_Log_FileName)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -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,5 +1,3 @@
|
|||||||
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_command.Dockerfile --tag standalone_command .
|
||||||
docker build --file Dockerfile_standalone_channelRewards.Dockerfile --tag standalone_channelrewards .
|
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_lights.Dockerfile --tag standalone_lights .
|
||||||
|
|||||||
@ -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"
|
||||||
@ -1,17 +1,9 @@
|
|||||||
import flask
|
import flask
|
||||||
from flask import Flask, request, after_this_request
|
from flask import request
|
||||||
|
|
||||||
import channel_rewards.channelRewards_loader as rewards_loader
|
import channel_rewards.channelRewards_loader as rewards_loader
|
||||||
from channel_rewards.channelRewards_base import AbstractChannelRewards
|
from channel_rewards.channelRewards_base import AbstractChannelRewards
|
||||||
|
|
||||||
from json import loads
|
|
||||||
from urllib.parse import urlencode
|
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
import json
|
|
||||||
import base64
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import praxis_logging
|
import praxis_logging
|
||||||
praxis_logger_obj = praxis_logging.praxis_logger()
|
praxis_logger_obj = praxis_logging.praxis_logger()
|
||||||
@ -64,41 +56,9 @@ def handle_reward(source, username, reward_name, reward_type, rewardPrompt, user
|
|||||||
reward_response = reward.do_ChannelReward(realSource, username, reward_name, rewardPrompt, userInput, bonusData)
|
reward_response = reward.do_ChannelReward(realSource, username, reward_name, rewardPrompt, userInput, bonusData)
|
||||||
return flask.make_response("{\"message\":\"%s\"}" % reward_response, 200, {"Content-Type": "application/json"})
|
return flask.make_response("{\"message\":\"%s\"}" % reward_response, 200, {"Content-Type": "application/json"})
|
||||||
except:
|
except:
|
||||||
return flask.make_response("{\"message\":\"%s\"}" % "Something Went horribly wrong", 500)
|
return flask.make_response("This is a magic test", 500)
|
||||||
#praxis_logger_obj.log("Doing a reward")
|
#praxis_logger_obj.log("Doing a reward")
|
||||||
|
|
||||||
def handle_get_list():
|
|
||||||
tempDict = {}
|
|
||||||
returnedDict = {}
|
|
||||||
|
|
||||||
for cmd in loadedRewards[AbstractChannelRewards.ChannelRewardsType.channelPoints]:
|
|
||||||
tempCmd:AbstractChannelRewards = loadedRewards[AbstractChannelRewards.ChannelRewardsType.channelPoints][cmd]
|
|
||||||
tempDict['channelRewardName'] = tempCmd.ChannelRewardName
|
|
||||||
tempDict['isRewardEnabled'] = str(tempCmd.isChannelRewardEnabled).lower()
|
|
||||||
returnedDict[tempCmd.ChannelRewardName] = tempDict
|
|
||||||
tempDict = {}
|
|
||||||
for cmd in loadedRewards[AbstractChannelRewards.ChannelRewardsType.twitch_bits]:
|
|
||||||
tempCmd:AbstractChannelRewards = loadedRewards[AbstractChannelRewards.ChannelRewardsType.twitch_bits][cmd]
|
|
||||||
tempDict['channelRewardName'] = tempCmd.ChannelRewardName
|
|
||||||
tempDict['isRewardEnabled'] = str(tempCmd.isChannelRewardEnabled).lower()
|
|
||||||
returnedDict[tempCmd.ChannelRewardName] = tempDict
|
|
||||||
tempDict = {}
|
|
||||||
for cmd in loadedRewards[AbstractChannelRewards.ChannelRewardsType.twitch_subs]:
|
|
||||||
tempCmd:AbstractChannelRewards = loadedRewards[AbstractChannelRewards.ChannelRewardsType.twitch_subs][cmd]
|
|
||||||
tempDict['channelRewardName'] = tempCmd.ChannelRewardName
|
|
||||||
tempDict['isRewardEnabled'] = str(tempCmd.isChannelRewardEnabled).lower()
|
|
||||||
returnedDict[tempCmd.ChannelRewardName] = tempDict
|
|
||||||
tempDict = {}
|
|
||||||
|
|
||||||
payload = json.dumps(returnedDict)
|
|
||||||
praxis_logger_obj.log("dumped")
|
|
||||||
praxis_logger_obj.log(payload)
|
|
||||||
payload = base64.b64encode(str.encode(payload))
|
|
||||||
print("encoded")
|
|
||||||
praxis_logger_obj.log("encoded")
|
|
||||||
praxis_logger_obj.log(payload)
|
|
||||||
return flask.make_response("{\"message\":\"%s\"}" % payload.decode(), 200, {"Content-Type": "application/json"})
|
|
||||||
|
|
||||||
|
|
||||||
@api.route('/api/v1/reward', methods=['GET'])
|
@api.route('/api/v1/reward', methods=['GET'])
|
||||||
def reward_check():
|
def reward_check():
|
||||||
@ -147,14 +107,6 @@ def exec_reward():
|
|||||||
request.args['user_input'],
|
request.args['user_input'],
|
||||||
request.args['bonus_data'])
|
request.args['bonus_data'])
|
||||||
|
|
||||||
@api.route('/api/v1/get_list/all', methods=['GET'])
|
|
||||||
def get_list():
|
|
||||||
@after_this_request
|
|
||||||
def add_header(response):
|
|
||||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
return response
|
|
||||||
|
|
||||||
return handle_get_list()
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
init()
|
init()
|
||||||
|
|||||||
@ -1,17 +1,9 @@
|
|||||||
import json
|
|
||||||
import flask
|
import flask
|
||||||
from flask import Flask, request, after_this_request
|
from flask import request
|
||||||
|
|
||||||
import commands.loader as command_loader
|
import commands.loader as command_loader
|
||||||
from commands.command_base import AbstractCommand
|
from commands.command_base import AbstractCommand
|
||||||
|
|
||||||
from json import loads
|
|
||||||
from urllib.parse import urlencode
|
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
import base64
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import praxis_logging
|
import praxis_logging
|
||||||
praxis_logger_obj = praxis_logging.praxis_logger()
|
praxis_logger_obj = praxis_logging.praxis_logger()
|
||||||
@ -61,25 +53,6 @@ def handle_command(source, username, command, rest, bonusData):
|
|||||||
|
|
||||||
#print("Doing a command")
|
#print("Doing a command")
|
||||||
|
|
||||||
def handle_get_list():
|
|
||||||
tempDict = {}
|
|
||||||
returnedDict = {}
|
|
||||||
|
|
||||||
for cmd in loadedCommands:
|
|
||||||
tempCmd:AbstractCommand = loadedCommands[cmd]
|
|
||||||
tempDict['command'] = tempCmd.command
|
|
||||||
tempDict['isCommandEnabled'] = str(tempCmd.isCommandEnabled).lower()
|
|
||||||
returnedDict[tempCmd.command] = tempDict
|
|
||||||
tempDict = {}
|
|
||||||
|
|
||||||
payload = json.dumps(returnedDict)
|
|
||||||
praxis_logger_obj.log("dumped")
|
|
||||||
praxis_logger_obj.log(payload)
|
|
||||||
payload = base64.b64encode(str.encode(payload))
|
|
||||||
print("encoded")
|
|
||||||
praxis_logger_obj.log("encoded")
|
|
||||||
praxis_logger_obj.log(payload)
|
|
||||||
return flask.make_response("{\"message\":\"%s\"}" % payload.decode(), 200, {"Content-Type": "application/json"})
|
|
||||||
|
|
||||||
@api.route('/api/v1/command', methods=['GET'])
|
@api.route('/api/v1/command', methods=['GET'])
|
||||||
def command_check():
|
def command_check():
|
||||||
@ -107,14 +80,6 @@ def exec_command():
|
|||||||
|
|
||||||
return handle_command(request.args['command_source'], username, request.args['command_name'], request.args['rest'], request.args['bonus_data'])
|
return handle_command(request.args['command_source'], username, request.args['command_name'], request.args['rest'], request.args['bonus_data'])
|
||||||
|
|
||||||
@api.route('/api/v1/get_list/all', methods=['GET'])
|
|
||||||
def get_list():
|
|
||||||
@after_this_request
|
|
||||||
def add_header(response):
|
|
||||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
return response
|
|
||||||
|
|
||||||
return handle_get_list()
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
init()
|
init()
|
||||||
|
|||||||
@ -203,27 +203,6 @@ class Discord_Module(discord.Client):
|
|||||||
|
|
||||||
#tts.tts(text_to_say)
|
#tts.tts(text_to_say)
|
||||||
|
|
||||||
#FINISH THIS EVENT LOG
|
|
||||||
async def send_EventLog(self, eventName, eventTime, eventType, eventData):
|
|
||||||
params = urlencode(
|
|
||||||
{'event_name': eventName,
|
|
||||||
'event_time': eventTime,
|
|
||||||
'event_type': eventType,
|
|
||||||
'event_data': eventData})
|
|
||||||
url = "http://standalone_eventlog:42008/api/v1/event_log/add_event?%s" % params
|
|
||||||
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:
|
|
||||||
return msg
|
|
||||||
# todo send to logger and other relevent services
|
|
||||||
else:
|
|
||||||
# todo handle failed requests
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,198 +0,0 @@
|
|||||||
from datetime import datetime
|
|
||||||
from enum import Enum
|
|
||||||
from os import F_OK
|
|
||||||
import tempText_Module
|
|
||||||
import time
|
|
||||||
import config as config
|
|
||||||
|
|
||||||
import flask
|
|
||||||
from flask import Flask, request, after_this_request
|
|
||||||
|
|
||||||
import credentials
|
|
||||||
|
|
||||||
import commands.loader as command_loader
|
|
||||||
from commands.command_base import AbstractCommand
|
|
||||||
|
|
||||||
from cooldowns import Cooldown_Module
|
|
||||||
|
|
||||||
import utilities_script as utility
|
|
||||||
|
|
||||||
import chyron_module
|
|
||||||
import timers_module
|
|
||||||
|
|
||||||
import random
|
|
||||||
|
|
||||||
import json
|
|
||||||
import base64
|
|
||||||
|
|
||||||
import event_logs.event_log_Module
|
|
||||||
|
|
||||||
import os
|
|
||||||
import praxis_logging
|
|
||||||
praxis_logger_obj = praxis_logging.praxis_logger()
|
|
||||||
praxis_logger_obj.init(os.path.basename(__file__))
|
|
||||||
praxis_logger_obj.log("\n -Starting Logs: " + os.path.basename(__file__))
|
|
||||||
|
|
||||||
api:Flask = Flask(__name__)
|
|
||||||
api.config["DEBUG"] = True
|
|
||||||
|
|
||||||
logging_module = event_logs.event_log_Module.Event_Log_Module()
|
|
||||||
|
|
||||||
def init():
|
|
||||||
print("starting up... ",)
|
|
||||||
logging_module.main()
|
|
||||||
|
|
||||||
def add_event(eventName, eventTime, eventType, eventSender, eventData):
|
|
||||||
logging_module.make_event(eventName, eventTime, eventType, eventSender, eventData)
|
|
||||||
return flask.make_response("{\"message\":\"%s\"}" % None, 200, {"Content-Type": "application/json"})
|
|
||||||
|
|
||||||
def get_events():
|
|
||||||
#returnedData = logging_module.get_recent_logs(50)
|
|
||||||
try:
|
|
||||||
masterDic = {}
|
|
||||||
newDic = {}
|
|
||||||
counter = 0
|
|
||||||
for event in logging_module.Event_Log_List:
|
|
||||||
#praxis_logger_obj.log("get event history debug thing: "+ str(event))
|
|
||||||
#recentLog = self.Event_Log_List[-x]
|
|
||||||
newDic['eventName'] = str(event.eventName)
|
|
||||||
newDic['eventTime'] = str(event.eventTime)
|
|
||||||
newDic['eventType'] = str(event.eventType)
|
|
||||||
newDic['eventSender'] = str(event.eventSender)
|
|
||||||
newDic['eventData'] = str(event.eventData)
|
|
||||||
masterDic[str(counter)] = newDic
|
|
||||||
counter = counter + 1
|
|
||||||
newDic = {}
|
|
||||||
except:
|
|
||||||
masterDic = {}
|
|
||||||
#returnedData = [""]
|
|
||||||
#praxis_logger_obj.log("\nGotten Events" + str(masterDic))
|
|
||||||
#print("\nGotten Events" + masterDic)
|
|
||||||
payload = json.dumps(masterDic)
|
|
||||||
payload = base64.b64encode(str.encode(payload))
|
|
||||||
|
|
||||||
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"})
|
|
||||||
|
|
||||||
def attempt_Event_Rerun(eventName, eventTime, eventType, eventSender, eventData):
|
|
||||||
returnString = ""
|
|
||||||
try:
|
|
||||||
return flask.make_response("{\"message\":\"%s\"}" % returnString, 200, {"Content-Type": "application/json"})
|
|
||||||
except:
|
|
||||||
returnString = "Something Went Wrong!"
|
|
||||||
return flask.make_response("{\"message\":\"%s\"}" % returnString, 200, {"Content-Type": "application/json"})
|
|
||||||
|
|
||||||
@api.route('/')
|
|
||||||
def bot_StatusIcon():
|
|
||||||
@after_this_request
|
|
||||||
def add_header(response):
|
|
||||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
return response
|
|
||||||
return flask.make_response('Hello There', 200)
|
|
||||||
|
|
||||||
@api.route('/api/v1/event_log/status')
|
|
||||||
def bot_status():
|
|
||||||
@after_this_request
|
|
||||||
def add_header(response):
|
|
||||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
return response
|
|
||||||
return flask.make_response('EventLog Service: OK', 200)
|
|
||||||
|
|
||||||
|
|
||||||
@api.route('/api/v1/event_log/add_event')
|
|
||||||
def add_event_log():
|
|
||||||
@after_this_request
|
|
||||||
def add_header(response):
|
|
||||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
return response
|
|
||||||
if 'event_name' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'event_name\' not in request"}', 400)
|
|
||||||
if 'event_time' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'event_time\' not in request"}', 400)
|
|
||||||
if 'event_type' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'event_type\' not in request"}', 400)
|
|
||||||
if 'eventSender' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'eventSender\' not in request"}', 400)
|
|
||||||
if 'event_data' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'event_data\' not in request"}', 400)
|
|
||||||
|
|
||||||
return add_event(request.args['event_name'], request.args['event_time'], request.args['event_type'], request.args['eventSender'], request.args['event_data'],)
|
|
||||||
|
|
||||||
@api.route('/api/v1/event_log/get_events')
|
|
||||||
def get_event_log():
|
|
||||||
@after_this_request
|
|
||||||
def add_header(response):
|
|
||||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
return response
|
|
||||||
if 'request_data' not in request.args:
|
|
||||||
requestData = 50
|
|
||||||
return get_events()
|
|
||||||
|
|
||||||
@api.route('/api/v1/event_log/reRunEvent')
|
|
||||||
def reRunEvent():
|
|
||||||
@after_this_request
|
|
||||||
def add_header(response):
|
|
||||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
return response
|
|
||||||
if 'eventName' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'eventName\' not in request"}', 400)
|
|
||||||
if 'eventTime' not in request.args:
|
|
||||||
sentTime = request.args('eventTime')
|
|
||||||
else:
|
|
||||||
sentTime = None
|
|
||||||
if 'eventType' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'eventType\' not in request"}', 400)
|
|
||||||
if 'eventSender' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'eventSender\' not in request"}', 400)
|
|
||||||
if 'eventData' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'eventData\' not in request"}', 400)
|
|
||||||
|
|
||||||
return reRunEvent_handler(request.args['eventName'], sentTime, request.args['eventType'], request.args['eventSender'], request.args['eventData'])
|
|
||||||
|
|
||||||
|
|
||||||
# @api.route('/api/v1/event_log/chyron/get')
|
|
||||||
# def get_chyron():
|
|
||||||
# @after_this_request
|
|
||||||
# def add_header(response):
|
|
||||||
# response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
# return response
|
|
||||||
# return flask.make_response('Client Service: OK', 200)
|
|
||||||
|
|
||||||
# @api.route('/api/v1/event_log/commands/get')
|
|
||||||
# def get_commands():
|
|
||||||
# @after_this_request
|
|
||||||
# def add_header(response):
|
|
||||||
# response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
# return response
|
|
||||||
# return flask.make_response('Client Service: OK', 200)
|
|
||||||
|
|
||||||
# @api.route('/api/v1/event_log/rewards/get')
|
|
||||||
# def get_rewards():
|
|
||||||
# @after_this_request
|
|
||||||
# def add_header(response):
|
|
||||||
# response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
# return response
|
|
||||||
# return flask.make_response('Client Service: OK', 200)
|
|
||||||
|
|
||||||
# @api.route('/api/v1/event_log/timers/get')
|
|
||||||
# def get_timers():
|
|
||||||
# @after_this_request
|
|
||||||
# def add_header(response):
|
|
||||||
# response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
# return response
|
|
||||||
# return flask.make_response('Client Service: OK', 200)
|
|
||||||
|
|
||||||
# @api.route('/api/v1/event_log/text_sources/get')
|
|
||||||
# def get_text_sources():
|
|
||||||
# @after_this_request
|
|
||||||
# def add_header(response):
|
|
||||||
# response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
# return response
|
|
||||||
# return flask.make_response('Client Service: OK', 200)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
init()
|
|
||||||
api.run(host="0.0.0.0", port = 42008)
|
|
||||||
@ -199,28 +199,6 @@ class Twitch_Pubsub():
|
|||||||
# todo handle failed requests
|
# todo handle failed requests
|
||||||
pass
|
pass
|
||||||
|
|
||||||
#FINISH THIS EVENT LOG
|
|
||||||
def send_EventLog(self, eventName, eventTime, eventType, eventSender, eventData):
|
|
||||||
params = urlencode(
|
|
||||||
{'event_name': eventName,
|
|
||||||
'event_time': eventTime,
|
|
||||||
'event_type': eventType,
|
|
||||||
'eventSender': eventSender,
|
|
||||||
'event_data': eventData})
|
|
||||||
url = "http://standalone_eventlog:42008/api/v1/event_log/add_event?%s" % params
|
|
||||||
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:
|
|
||||||
return msg
|
|
||||||
# todo send to logger and other relevent services
|
|
||||||
else:
|
|
||||||
# todo handle failed requests
|
|
||||||
pass
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
testModule = Twitch_Pubsub()
|
testModule = Twitch_Pubsub()
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
from datetime import datetime
|
|
||||||
import re
|
import re
|
||||||
from json import loads
|
from json import loads
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
@ -73,21 +72,13 @@ class Twitch_Module():
|
|||||||
|
|
||||||
def eval_command(self, message):
|
def eval_command(self, message):
|
||||||
command, rest = utility.parse_line(message.text)
|
command, rest = utility.parse_line(message.text)
|
||||||
|
|
||||||
try:
|
|
||||||
is_actionable = self.is_command(command)
|
|
||||||
if is_actionable:
|
|
||||||
self.send_EventLog(command, str(datetime.now()), "command.twitch", message.sender, rest)
|
|
||||||
praxis_logger_obj.log("Sent a thing")
|
|
||||||
except:
|
|
||||||
praxis_logger_obj.log("something went wrong with Event LOG")
|
|
||||||
try:
|
try:
|
||||||
is_actionable = self.is_command(command)
|
is_actionable = self.is_command(command)
|
||||||
if is_actionable:
|
if is_actionable:
|
||||||
if self.cooldownModule.isCooldownActive("twitchChat") == False:
|
if self.cooldownModule.isCooldownActive("twitchChat") == False:
|
||||||
self.exec_command(message ,command, rest)
|
self.exec_command(message ,command, rest)
|
||||||
except:
|
except:
|
||||||
praxis_logger_obj.log("something went wrong with a command")
|
print("something went wrong with a command")
|
||||||
|
|
||||||
def is_command(self, word: str) -> bool:
|
def is_command(self, word: str) -> bool:
|
||||||
# todo need to url-escape word
|
# todo need to url-escape word
|
||||||
@ -104,7 +95,7 @@ class Twitch_Module():
|
|||||||
'command_name': command,
|
'command_name': command,
|
||||||
'rest': rest,
|
'rest': rest,
|
||||||
'bonus_data': realMessage})
|
'bonus_data': realMessage})
|
||||||
#standalone_command
|
|
||||||
url = "http://standalone_command:42010/api/v1/exec_command?%s" % params
|
url = "http://standalone_command:42010/api/v1/exec_command?%s" % params
|
||||||
resp = requests.get(url)
|
resp = requests.get(url)
|
||||||
if resp.status_code == 200:
|
if resp.status_code == 200:
|
||||||
@ -138,31 +129,12 @@ class Twitch_Module():
|
|||||||
text_to_say: str = "%s says, %s" % (message.sender, message.text)
|
text_to_say: str = "%s says, %s" % (message.sender, message.text)
|
||||||
self.exec_tts_sender("", text_to_say)
|
self.exec_tts_sender("", text_to_say)
|
||||||
|
|
||||||
def send_EventLog(self, command, eventTime, eventType, eventSender, rest):
|
|
||||||
params = urlencode(
|
|
||||||
{'event_name': command,
|
|
||||||
'event_time': eventTime,
|
|
||||||
'event_type': eventType,
|
|
||||||
'eventSender': eventSender,
|
|
||||||
'event_data': rest})
|
|
||||||
url = "http://standalone_eventlog:42008/api/v1/event_log/add_event?%s" % params
|
|
||||||
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:
|
|
||||||
return msg
|
|
||||||
# todo send to logger and other relevent services
|
|
||||||
else:
|
|
||||||
# todo handle failed requests
|
|
||||||
pass
|
|
||||||
|
|
||||||
def exec_tts_sender(self, username, message):
|
def exec_tts_sender(self, username, message):
|
||||||
params = urlencode({'tts_sender': username, 'tts_text': message})
|
params = urlencode({'tts_sender': username, 'tts_text': message})
|
||||||
#standalone_tts_core
|
#standalone_tts_core
|
||||||
url = "http://localhost:42064/api/v1/tts/send_text?%s" % params
|
url = "http://standalone_tts_core:42064/api/v1/tts/send_text?%s" % params
|
||||||
resp = requests.get(url)
|
resp = requests.get(url)
|
||||||
if resp.status_code == 200:
|
if resp.status_code == 200:
|
||||||
print("Got the following message: %s" % resp.text)
|
print("Got the following message: %s" % resp.text)
|
||||||
|
|||||||
@ -1,205 +0,0 @@
|
|||||||
from enum import Enum
|
|
||||||
from os import F_OK
|
|
||||||
import tempText_Module
|
|
||||||
import time
|
|
||||||
import config as config
|
|
||||||
|
|
||||||
from datetime import datetime
|
|
||||||
import re
|
|
||||||
from json import loads
|
|
||||||
from urllib.parse import urlencode
|
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
import flask
|
|
||||||
from flask import Flask, request, after_this_request
|
|
||||||
|
|
||||||
import credentials
|
|
||||||
|
|
||||||
import commands.loader as command_loader
|
|
||||||
from commands.command_base import AbstractCommand
|
|
||||||
|
|
||||||
from cooldowns import Cooldown_Module
|
|
||||||
|
|
||||||
import utilities_script as utility
|
|
||||||
|
|
||||||
import chyron_module
|
|
||||||
import timers_module
|
|
||||||
|
|
||||||
import random
|
|
||||||
|
|
||||||
import os
|
|
||||||
import praxis_logging
|
|
||||||
praxis_logger_obj = praxis_logging.praxis_logger()
|
|
||||||
praxis_logger_obj.init(os.path.basename(__file__))
|
|
||||||
praxis_logger_obj.log("\n -Starting Logs: " + os.path.basename(__file__))
|
|
||||||
|
|
||||||
api:Flask = Flask(__name__)
|
|
||||||
api.config["DEBUG"] = True
|
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
print("starting up... ",)
|
|
||||||
|
|
||||||
|
|
||||||
def handle_request_get(requestName, requestType, requestData):
|
|
||||||
|
|
||||||
if requestType == "list":
|
|
||||||
if requestName == "Chyron":
|
|
||||||
response = request_get_list("XXXXXXXXX", "42010")
|
|
||||||
return flask.make_response("{\"message\": \"%s\"}" % response, 200, {"Content-Type": "application/json"})
|
|
||||||
if requestName == "Commands":
|
|
||||||
response = request_get_list("standalone_command", "42010")
|
|
||||||
return flask.make_response("{\"message\": \"%s\"}" % response, 200, {"Content-Type": "application/json"})
|
|
||||||
if requestName == "Rewards":
|
|
||||||
response = request_get_list("standalone_channelrewards", "42069")
|
|
||||||
return flask.make_response("{\"message\": \"%s\"}" % response, 200, {"Content-Type": "application/json"})
|
|
||||||
if requestName == "Timers":
|
|
||||||
response = request_get_list("XXXXXXXXX", "42010")
|
|
||||||
return flask.make_response("{\"message\": \"%s\"}" % response, 200, {"Content-Type": "application/json"})
|
|
||||||
if requestName == "TextSources":
|
|
||||||
response = request_get_list("XXXXXXXXX", "42010")
|
|
||||||
return flask.make_response("{\"message\": \"%s\"}" % response, 200, {"Content-Type": "application/json"})
|
|
||||||
if requestName == "EventHistory":
|
|
||||||
params = urlencode(
|
|
||||||
{'request_name': requestName,
|
|
||||||
'request_type': requestType,
|
|
||||||
'request_data': requestData})
|
|
||||||
response = request_get_eventlist(params)
|
|
||||||
return flask.make_response("{\"message\": \"%s\"}" % response, 200, {"Content-Type": "application/json"})
|
|
||||||
else:
|
|
||||||
return flask.make_response("{\"message\": \"%s\"}" % "Invalid Request Name", 400, {"Content-Type": "application/json"})
|
|
||||||
|
|
||||||
def request_get_list(serviceName, servicePort):
|
|
||||||
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 get list", 200, {"Content-Type": "application/json"})
|
|
||||||
except:
|
|
||||||
return flask.make_response("{\"message\": \"%s\"}" % "Major Mess up on get list", 200, {"Content-Type": "application/json"})
|
|
||||||
|
|
||||||
def request_get_eventlist(params):
|
|
||||||
try:
|
|
||||||
url = "http://standalone_eventlog:42008/api/v1/event_log/get_events?%s" % params
|
|
||||||
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:
|
|
||||||
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 get eventlist", 200, {"Content-Type": "application/json"})
|
|
||||||
except:
|
|
||||||
return flask.make_response("{\"message\": \"%s\"}" % "Major Mess up on get eventlist", 200, {"Content-Type": "application/json"})
|
|
||||||
|
|
||||||
def request_reRunEvent(eventName, eventTime, eventType, eventSender, eventData):
|
|
||||||
try:
|
|
||||||
params = urlencode(
|
|
||||||
{'eventName': eventName,
|
|
||||||
'eventTime': eventTime,
|
|
||||||
'eventType': eventType,
|
|
||||||
'eventSender': eventSender,
|
|
||||||
'eventData': eventData})
|
|
||||||
url = "http://standalone_eventlog:42008/api/v1/event_log/reRunEvent?%s" % params
|
|
||||||
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:
|
|
||||||
return flask.make_response("{\"message\": \"%s\"}" % msg, 200, {"Content-Type": "application/json"})
|
|
||||||
# todo send to logger and other relevent services
|
|
||||||
else:
|
|
||||||
# todo handle failed requests
|
|
||||||
return flask.make_response('Something Went a little bit Wrong rerunning an event', 400)
|
|
||||||
except:
|
|
||||||
return flask.make_response('Something Went Wrong rerunning an event', 400)
|
|
||||||
|
|
||||||
def handle_request_set(requestName, requestType, requestData):
|
|
||||||
if requestType == "update":
|
|
||||||
if requestName == "Chyron":
|
|
||||||
pass
|
|
||||||
if requestName == "Commands":
|
|
||||||
pass
|
|
||||||
elif requestType == "delete":
|
|
||||||
if requestName == "Chyron":
|
|
||||||
pass
|
|
||||||
if requestName == "Commands":
|
|
||||||
pass
|
|
||||||
|
|
||||||
@api.route('/')
|
|
||||||
def bot_StatusIcon():
|
|
||||||
@after_this_request
|
|
||||||
def add_header(response):
|
|
||||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
return response
|
|
||||||
return flask.make_response('Client Service: OK', 200)
|
|
||||||
|
|
||||||
@api.route('/api/v1/user_client/get', methods=['GET'])
|
|
||||||
def get_data():
|
|
||||||
@after_this_request
|
|
||||||
def add_header(response):
|
|
||||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
return response
|
|
||||||
if 'request_name' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'request_name\' not in request"}', 400)
|
|
||||||
if 'request_type' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'request_type\' not in request"}', 400)
|
|
||||||
if 'request_data' not in request.args:
|
|
||||||
requestData = None
|
|
||||||
else:
|
|
||||||
requestData = request.args['request_data']
|
|
||||||
|
|
||||||
return handle_request_get(request.args['request_name'], request.args['request_type'], requestData)
|
|
||||||
|
|
||||||
@api.route('/api/v1/user_client/set', methods=['GET'])
|
|
||||||
def set_data():
|
|
||||||
@after_this_request
|
|
||||||
def add_header(response):
|
|
||||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
return response
|
|
||||||
if 'request_type' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'request_type\' not in request"}', 400)
|
|
||||||
|
|
||||||
@api.route('/api/v1/user_client/event_log/reRunEvent', methods=['GET'])
|
|
||||||
def EventLog_reRunEvent():
|
|
||||||
@after_this_request
|
|
||||||
def add_header(response):
|
|
||||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
return response
|
|
||||||
if 'eventName' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'eventName\' not in request"}', 400)
|
|
||||||
if 'eventTime' not in request.args:
|
|
||||||
sentTime = request.args('eventTime')
|
|
||||||
else:
|
|
||||||
sentTime = None
|
|
||||||
if 'eventType' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'eventType\' not in request"}', 400)
|
|
||||||
if 'eventSender' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'eventSender\' not in request"}', 400)
|
|
||||||
if 'eventData' not in request.args:
|
|
||||||
return flask.make_response('{\"text\":"Argument \'eventData\' not in request"}', 400)
|
|
||||||
|
|
||||||
#return flask.make_response("test", 200)
|
|
||||||
return request_reRunEvent(request.args['eventName'], sentTime, request.args['eventType'], request.args['eventSender'], request.args['eventData'])
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
init()
|
|
||||||
api.run(host="0.0.0.0", port = 42055)
|
|
||||||
@ -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()
|
||||||
@ -1,21 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2014-2017 Materialize
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
@ -1,90 +0,0 @@
|
|||||||
<p align="center">
|
|
||||||
<a href="http://materializecss.com/">
|
|
||||||
<img src="http://materializecss.com/res/materialize.svg" width="150">
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<h3 align="center">MaterializeCSS</h3>
|
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
Materialize, a CSS Framework based on material design.
|
|
||||||
<br>
|
|
||||||
<a href="http://materializecss.com/"><strong>-- Browse the docs --</strong></a>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<a href="https://travis-ci.org/Dogfalo/materialize">
|
|
||||||
<img src="https://travis-ci.org/Dogfalo/materialize.svg?branch=master" alt="Travis CI badge">
|
|
||||||
</a>
|
|
||||||
<a href="https://badge.fury.io/js/materialize-css">
|
|
||||||
<img src="https://badge.fury.io/js/materialize-css.svg" alt="npm version badge">
|
|
||||||
</a>
|
|
||||||
<a href="https://cdnjs.com/libraries/materialize">
|
|
||||||
<img src="https://img.shields.io/cdnjs/v/materialize.svg" alt="CDNJS version badge">
|
|
||||||
</a>
|
|
||||||
<a href="https://david-dm.org/Dogfalo/materialize">
|
|
||||||
<img src="https://david-dm.org/Dogfalo/materialize/status.svg" alt="dependencies Status badge">
|
|
||||||
</a>
|
|
||||||
<a href="https://david-dm.org/Dogfalo/materialize#info=devDependencies">
|
|
||||||
<img src="https://david-dm.org/Dogfalo/materialize/dev-status.svg" alt="devDependency Status badge">
|
|
||||||
</a>
|
|
||||||
<a href="https://gitter.im/Dogfalo/materialize">
|
|
||||||
<img src="https://badges.gitter.im/Join%20Chat.svg" alt="Gitter badge">
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
- [Quickstart](#quickstart)
|
|
||||||
- [Documentation](#documentation)
|
|
||||||
- [Supported Browsers](#supported-browsers)
|
|
||||||
- [Changelog](#changelog)
|
|
||||||
- [Testing](#testing)
|
|
||||||
- [Contributing](#contributing)
|
|
||||||
- [Copyright and license](#copyright-and-license)
|
|
||||||
|
|
||||||
## Quickstart:
|
|
||||||
Read the [getting started guide](http://materializecss.com/getting-started.html) for more information on how to use materialize.
|
|
||||||
|
|
||||||
- [Download the latest release](https://github.com/Dogfalo/materialize/releases/latest) of materialize directly from GitHub.
|
|
||||||
- Clone the repo: `git clone https://github.com/Dogfalo/materialize.git`
|
|
||||||
- Include the files via [cdnjs](https://cdnjs.com/libraries/materialize). More [here](http://materializecss.com/getting-started.html).
|
|
||||||
- Install with [npm](https://www.npmjs.com): `npm install materialize-css`
|
|
||||||
- Install with [Bower](https://bower.io): `bower install materialize`
|
|
||||||
- Install with [Atmosphere](https://atmospherejs.com): `meteor add materialize:materialize`
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
The documentation can be found at <http://materializecss.com>. To run the documentation locally on your machine, you need [Node.js](https://nodejs.org/en/) installed on your computer.
|
|
||||||
|
|
||||||
### Running documentation locally
|
|
||||||
Run these commands to set up the documentation:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/Dogfalo/materialize
|
|
||||||
cd materialize
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
Then run `grunt monitor` to compile the documentation. When it finishes, open a new browser window and navigate to `localhost:8000`. We use [BrowserSync](https://www.browsersync.io/) to display the documentation.
|
|
||||||
|
|
||||||
### Documentation for previous releases
|
|
||||||
Previous releases and their documentation are available for [download](https://github.com/Dogfalo/materialize/releases).
|
|
||||||
|
|
||||||
## Supported Browsers:
|
|
||||||
Materialize is compatible with:
|
|
||||||
|
|
||||||
- Chrome 35+
|
|
||||||
- Firefox 31+
|
|
||||||
- Safari 7+
|
|
||||||
- Opera
|
|
||||||
- Edge
|
|
||||||
- IE 10+
|
|
||||||
|
|
||||||
## Changelog
|
|
||||||
For changelogs, check out [the Releases section of materialize](https://github.com/Dogfalo/materialize/releases) or the [CHANGELOG.md](CHANGELOG.md).
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
We use Jasmine as our testing framework and we're trying to write a robust test suite for our components. If you want to help, [here's a starting guide on how to write tests in Jasmine](CONTRIBUTING.md#jasmine-testing-guide).
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
Check out the [CONTRIBUTING document](CONTRIBUTING.md) in the root of the repository to learn how you can contribute. You can also browse the [help-wanted](https://github.com/Dogfalo/materialize/labels/help-wanted) tag in our issue tracker to find things to do.
|
|
||||||
|
|
||||||
## Copyright and license
|
|
||||||
Code copyright 2017 Materialize. Code released under the MIT license.
|
|
||||||
9389
user_client/v1/css/materialize.css
vendored
9389
user_client/v1/css/materialize.css
vendored
File diff suppressed because it is too large
Load Diff
16
user_client/v1/css/materialize.min.css
vendored
16
user_client/v1/css/materialize.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1,321 +0,0 @@
|
|||||||
<html lang="en-us">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
||||||
<title>Praxis Bot Control Panel</title>
|
|
||||||
<link rel="stylesheet" href="style.css">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
||||||
|
|
||||||
<!--Import Google Icon Font-->
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
|
||||||
<!--Import materialize.css-->
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
|
||||||
<link type="text/css" rel="stylesheet" href="css/materialize.css" media="screen,projection"/>
|
|
||||||
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
|
|
||||||
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col s12 blue sticky ontop">
|
|
||||||
<ul class="tabs blue">
|
|
||||||
<li class="tab col s3"><a class="active" href="#Home" style="color: white;">Home</a></li>
|
|
||||||
<li class="tab col s3 hide"><a href="#Settings" style="color: white;">Settings</a></li>
|
|
||||||
<li class="tab col s3 "><a href="#About" style="color: white;">About</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="Home">
|
|
||||||
<div id="" class="row bodyarea" style="">
|
|
||||||
<div id="sidebar_area" class="col s12 m3 hide-on-small-and-down card" style="position: fixed;">
|
|
||||||
<div style="" onclick="BotStatus()"><p id="BotStatus" class="card noselect" style="padding-left: 3px;padding-right: 3px;">Bot Status: ??</p></div>
|
|
||||||
<div class="row" style="padding-left: 3px;" style="">
|
|
||||||
<a href="index.html"><div class="s12 card waves-effect waves-light btn-large colsInSideBar" style="background-color: #42A5F5;">
|
|
||||||
<i class="material-icons">arrow_upward</i>
|
|
||||||
</div></a>
|
|
||||||
<div class="lineSeperator blue"></div>
|
|
||||||
<a href="#Chyron"><div class="s12 card waves-effect waves-light btn-large colsInSideBar hide" style="background-color: #42A5F5;">
|
|
||||||
<p>Chyron</p>
|
|
||||||
</div></a>
|
|
||||||
<a href="#Commands"><div class="s12 card waves-effect waves-light btn-large colsInSideBar" style="background-color: #42A5F5;">
|
|
||||||
<p>Commands</p>
|
|
||||||
</div></a>
|
|
||||||
<a href="#Rewards"><div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;">
|
|
||||||
<p>Rewards</p>
|
|
||||||
</div></a>
|
|
||||||
<a href="#Timers"><div class="s12 card colsInSideBar waves-effect waves-light btn-large hide" style="background-color: #42A5F5;">
|
|
||||||
<p>Timers</p>
|
|
||||||
</div></a>
|
|
||||||
<a href="#TextSources"><div class="s12 card colsInSideBar waves-effect waves-light btn-large hide" style="background-color: #42A5F5;">
|
|
||||||
<p>Text Sources</p>
|
|
||||||
</div></a>
|
|
||||||
<a href="#EventHistory"><div class="lineSeperator blue"></div>
|
|
||||||
<div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;">
|
|
||||||
<p>Event History</p>
|
|
||||||
</div></a>
|
|
||||||
<a href="#Services"><div class="s12 card colsInSideBar waves-effect waves-light btn-large hide" style="background-color: #42A5F5;">
|
|
||||||
<p>Services</p>
|
|
||||||
</div></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="main_area" class="col s12 m9 right card">
|
|
||||||
|
|
||||||
|
|
||||||
<div id="Chyron" style="padding-top: 20px;"><div class="rowsInMain center card hide">
|
|
||||||
<a class="btn-floating btn-large waves-effect waves-light blue right" style="margin-right: 10px;">
|
|
||||||
<i class="material-icons">refresh</i>
|
|
||||||
</a>
|
|
||||||
<a class="btn-floating btn-large waves-effect waves-light green right" style="margin-right: 10px;">
|
|
||||||
<i class="material-icons">add</i>
|
|
||||||
</a>
|
|
||||||
<h3>Chyron:</h3></div>
|
|
||||||
<div class="rowsInMain row card hide" style="margin-right: 20px;margin-left: 20px;margin-top: 30px;margin-bottom: 30px;">
|
|
||||||
<div class="col s12 switch hide" style="top: -20px;position: relative;padding-left: 10px;"><label>Enabled:<input type="checkbox"><span class="lever"></span></label></div>
|
|
||||||
<div class="col s4"><p>Section Name:</p>
|
|
||||||
<div class="input-field inline" style="width: 80%;">
|
|
||||||
<input id="section_name_inline" type="text" class="validate">
|
|
||||||
<label for="section_name_inline">Section Name</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col s4"><p>Title:</p>
|
|
||||||
<div class="input-field inline" style="width: 80%;">
|
|
||||||
<input id="title_inline" type="text" class="validate">
|
|
||||||
<label for="title_inline">Title</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col s4"><p>Content:</p>
|
|
||||||
<div class="input-field inline" style="width: 80%;">
|
|
||||||
<input id="content_inline" type="text" class="validate">
|
|
||||||
<label for="content_inline">Text</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="position: absolute; right: 0; top: 0; width: 3em;" class="col s1 btn red waves-effect"><i class="material-icons">delete</i></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="Commands" style="padding-top: 20px;"><div class="rowsInMain center card">
|
|
||||||
<a onclick="updateCommandList()" class="btn-floating btn-large waves-effect waves-light blue right" style="margin-right: 10px;">
|
|
||||||
<i class="material-icons">refresh</i>
|
|
||||||
</a>
|
|
||||||
<h3>Commands:</h3></div>
|
|
||||||
<div id="CommandRowWrapper">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div id="Rewards" style="padding-top: 20px;"><div class="rowsInMain center card">
|
|
||||||
<a onclick="updateRewardList()" class="btn-floating btn-large waves-effect waves-light blue right" style="margin-right: 10px;">
|
|
||||||
<i class="material-icons">refresh</i>
|
|
||||||
</a>
|
|
||||||
<h3>Rewards:</h3></div>
|
|
||||||
<div id="RewardRowWrapper">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="Timers" style="padding-top: 20px;"></div><div class="rowsInMain center card hide">
|
|
||||||
<a class="btn-floating btn-large waves-effect waves-light red right hide-on-small-and-down" style="margin-right: 10px;">
|
|
||||||
<i class="material-icons">add</i>
|
|
||||||
</a><h3>Timers:</h3></div>
|
|
||||||
<div class="rowsInMain row card hide" style="margin-right: 20px;margin-left: 20px;margin-top: 30px;margin-bottom: 30px;">
|
|
||||||
<div class="col s3"><p>Timer Name:</p></div>
|
|
||||||
<div class="col s3"><p>Trigger:</p></div>
|
|
||||||
<div class="col s3"><p>Trigger_EXEC:</p></div>
|
|
||||||
<div class="col s "><p>O</p></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="TextSources" style="padding-top: 20px;"></div><div class="rowsInMain center card hide">
|
|
||||||
<a class="btn-floating btn-large waves-effect waves-light blue right" style="margin-right: 10px;">
|
|
||||||
<i class="material-icons">refresh</i>
|
|
||||||
</a>
|
|
||||||
<h3>Text Sources:</h3></div>
|
|
||||||
<div class="rowsInMain row card hide" style="margin-right: 20px;margin-left: 20px;margin-top: 30px;margin-bottom: 30px;">
|
|
||||||
<div class="col s4"><p>File Name:</p>
|
|
||||||
<div class="input-field inline" style="width: 80%;">
|
|
||||||
<input id="filename_inline" type="text" class="validate">
|
|
||||||
<label for="filename_inline">Text</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col s4"><p>Title:</p>
|
|
||||||
<div class="input-field inline" style="width: 80%;">
|
|
||||||
<input id="title_inline" type="text" class="validate">
|
|
||||||
<label for="title_inline">Text</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col s4"><p>Text:</p>
|
|
||||||
<div class="input-field inline" style="width: 80%;">
|
|
||||||
<input id="text_inline" type="text" class="validate">
|
|
||||||
<label for="text_inline">Text</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="position: absolute; right: 0; top: 0; width: 3em;" class="col s1 btn red waves-effect"><i class="material-icons">delete</i></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="EventHistory" style="padding-top: 20px;"></div><div class="rowsInMain center card">
|
|
||||||
<a onclick="updateEventList()" class="btn-floating btn-large waves-effect waves-light blue right" style="margin-right: 10px;">
|
|
||||||
<i class="material-icons">refresh</i>
|
|
||||||
</a>
|
|
||||||
<h3>Event History:</h3></div>
|
|
||||||
|
|
||||||
<div id="EventHistoryWrapper" class="EventHistoryWrapper">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="Services" style="padding-top: 20px;"></div><div class="rowsInMain center card hide"><h3>Services:</h3></div>
|
|
||||||
<div class="row hide">
|
|
||||||
<div class="col s6 m3">
|
|
||||||
<div class="card modulesCard">
|
|
||||||
<div class="modulesCardWrap">
|
|
||||||
<h6 style="padding-top: 15px;">Commands</h6>
|
|
||||||
<a class="waves-effect waves-light btn modulesCardWrapButton">Enable</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col s6 m3">
|
|
||||||
<div class="card modulesCard">
|
|
||||||
<div class="modulesCardWrap">
|
|
||||||
<h6 style="padding-top: 15px;">Rewards</h6>
|
|
||||||
<a class="waves-effect waves-light btn modulesCardWrapButton">Enable</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col s6 m3">
|
|
||||||
<div class="card modulesCard">
|
|
||||||
<div class="modulesCardWrap">
|
|
||||||
<h6 style="padding-top: 15px;">RGB Lights</h6>
|
|
||||||
<a class="waves-effect waves-light btn modulesCardWrapButton">Enable</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col s6 m3">
|
|
||||||
<div class="card modulesCard">
|
|
||||||
<div class="modulesCardWrap">
|
|
||||||
<h6 style="padding-top: 15px;">Text Sources</h6>
|
|
||||||
<a class="waves-effect waves-light btn modulesCardWrapButton">Enable</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col s6 m3">
|
|
||||||
<div class="card modulesCard">
|
|
||||||
<div class="modulesCardWrap">
|
|
||||||
<h6 style="padding-top: 15px;">TTS</h6>
|
|
||||||
<a class="waves-effect waves-light btn modulesCardWrapButton">Enable</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col s6 m3">
|
|
||||||
<div class="card modulesCard">
|
|
||||||
<div class="modulesCardWrap">
|
|
||||||
<h6 style="padding-top: 15px;">OBS Web Socket</h6>
|
|
||||||
<a class="waves-effect waves-light btn modulesCardWrapButton">Enable</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="Settings"style="padding-top: 20px;">
|
|
||||||
<div class="card" >
|
|
||||||
<div class=""style="padding-top: 20px;">
|
|
||||||
<div class="row bodyarea container" style="background-color: rgb(221, 221, 221);">
|
|
||||||
<div class="rowsInMain center card">
|
|
||||||
<a class="btn-floating btn-large waves-effect waves-light blue right" style="position: absolute; right: 5px;">
|
|
||||||
<i class="material-icons">refresh</i>
|
|
||||||
</a>
|
|
||||||
<h1>Settings</h1>
|
|
||||||
</div>
|
|
||||||
<div class="">
|
|
||||||
<div class="col s12">
|
|
||||||
<div class="card center" style="margin-top: 15px;margin-bottom: 15px; min-height: 3em; padding-top: 5px;padding-bottom: 5px;">
|
|
||||||
<h3>Config</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="col s12">
|
|
||||||
<div class="card center" style="margin-top: 15px;margin-bottom: 15px; min-height: 3em; padding-top: 15px;padding-bottom: 15px;">
|
|
||||||
<p>test</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="">
|
|
||||||
<div class="col s12">
|
|
||||||
<div class="card center" style="margin-top: 15px;margin-bottom: 15px; min-height: 3em; padding-top: 5px;padding-bottom: 5px;">
|
|
||||||
<h3>Credentials</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="col s12">
|
|
||||||
<div class="card center" style="margin-top: 15px;margin-bottom: 15px; min-height: 3em; padding-top: 15px;padding-bottom: 15px;">
|
|
||||||
<p>test</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div id="About" class="">
|
|
||||||
<div class="row bodyarea">
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
|
||||||
<script src="js/materialize.js"></script>
|
|
||||||
|
|
||||||
<!-- Load React. -->
|
|
||||||
<!-- Note: when deploying, replace "development.js" with "production.min.js". -->
|
|
||||||
<!--<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>-->
|
|
||||||
<!--<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>-->
|
|
||||||
|
|
||||||
|
|
||||||
<script src="webclient.js"></script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
var elems = document.querySelectorAll('.fixed-action-btn');
|
|
||||||
var instances = M.FloatingActionButton.init(elems, options);
|
|
||||||
});
|
|
||||||
10021
user_client/v1/js/materialize.js
vendored
10021
user_client/v1/js/materialize.js
vendored
File diff suppressed because it is too large
Load Diff
6
user_client/v1/js/materialize.min.js
vendored
6
user_client/v1/js/materialize.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,157 +0,0 @@
|
|||||||
body {
|
|
||||||
background-color: rgb(250, 250, 250);
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div {
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#header{
|
|
||||||
background-color: cadetblue;
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bodyarea{
|
|
||||||
background-color: rgb(250, 250, 250);
|
|
||||||
padding: 0;
|
|
||||||
padding-top: 3em;
|
|
||||||
margin: 0;
|
|
||||||
min-height: 90%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sidebar_area{
|
|
||||||
background-color: rgb(235, 235, 235);;
|
|
||||||
min-height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#main_area{
|
|
||||||
background-color: rgb(221, 221, 221);
|
|
||||||
min-height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main_area{
|
|
||||||
background-color: rgb(221, 221, 221);
|
|
||||||
min-height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lineSeperator{
|
|
||||||
margin-top: 15px;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
width: 100%;
|
|
||||||
height: 5px;
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.noPadding{
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sticky {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.sticky_btm {
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ontop {
|
|
||||||
z-index: 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.noselect {
|
|
||||||
-webkit-touch-callout: none; /* iOS Safari */
|
|
||||||
-webkit-user-select: none; /* Safari */
|
|
||||||
-khtml-user-select: none; /* Konqueror HTML */
|
|
||||||
-moz-user-select: none; /* Old versions of Firefox */
|
|
||||||
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
||||||
user-select: none; /* Non-prefixed version, currently
|
|
||||||
supported by Chrome, Edge, Opera and Firefox */
|
|
||||||
}
|
|
||||||
|
|
||||||
.headerItem{
|
|
||||||
padding: 1em;
|
|
||||||
background-color: steelblue;
|
|
||||||
}
|
|
||||||
|
|
||||||
.headerItem:hover{
|
|
||||||
background-color: gray;
|
|
||||||
}
|
|
||||||
|
|
||||||
.headerText{
|
|
||||||
text-align: center;
|
|
||||||
color: white;
|
|
||||||
padding-left: 1em;
|
|
||||||
padding-right: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.colsInSideBar{
|
|
||||||
min-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.colsInSideBar:hover{
|
|
||||||
color: white;
|
|
||||||
font-weight: bold;
|
|
||||||
background-color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modulesCard{
|
|
||||||
min-height: 5em;
|
|
||||||
background-color: red;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modulesCardWrap{
|
|
||||||
margin-left: 15px;
|
|
||||||
min-height: 10em;
|
|
||||||
}
|
|
||||||
.modulesCardWrapButton{
|
|
||||||
margin-top: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rowsInMain{
|
|
||||||
padding-top: 30px;
|
|
||||||
padding-bottom: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.EventHistoryWrapper{
|
|
||||||
overflow-y: scroll;
|
|
||||||
max-height: 60vh;
|
|
||||||
background-color: rgb(175, 213, 214);
|
|
||||||
margin-right: 20px;
|
|
||||||
margin-left: 20px;
|
|
||||||
margin-top: 30px;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* width */
|
|
||||||
::-webkit-scrollbar {
|
|
||||||
width: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Track */
|
|
||||||
::-webkit-scrollbar-track {
|
|
||||||
background: #f1f1f1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Handle */
|
|
||||||
::-webkit-scrollbar-thumb {
|
|
||||||
background: rgb(105, 105, 105);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Handle on hover */
|
|
||||||
::-webkit-scrollbar-thumb:hover {
|
|
||||||
background: rgb(49, 49, 49);
|
|
||||||
}
|
|
||||||
@ -1,279 +0,0 @@
|
|||||||
|
|
||||||
refresh = () => response = fetch('http://127.0.0.1:42055/')
|
|
||||||
.then((response) => {
|
|
||||||
return response.text();
|
|
||||||
})
|
|
||||||
|
|
||||||
ConnectionTest = async () => {
|
|
||||||
var a = await refresh();
|
|
||||||
console.log(a)
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
|
|
||||||
async function BotStatus() {
|
|
||||||
var connectionStatus = await ConnectionTest();
|
|
||||||
document.getElementById("BotStatus").innerHTML = connectionStatus;
|
|
||||||
}
|
|
||||||
BotStatus();
|
|
||||||
|
|
||||||
|
|
||||||
async function setValue(request_type, command, isEnabled) {
|
|
||||||
let newCommandState = {
|
|
||||||
'request_type': request_type,
|
|
||||||
'command_name': command,
|
|
||||||
'is_enabled': isEnabled
|
|
||||||
}
|
|
||||||
let params = "?command_name="+encodeURIComponent(newCommandState.command_name)+"&"+"is_enabled="+encodeURIComponent(newCommandState.is_enabled);
|
|
||||||
let targetURL = "http://127.0.0.1:42055/api/v1/user_client/set"+params;
|
|
||||||
//console.log(targetURL)
|
|
||||||
let a = await fetch_GetList(targetURL);
|
|
||||||
//console.log("return: "+a);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch_GetList = (fetchURL) => response = fetch(fetchURL)
|
|
||||||
.then((response) => {
|
|
||||||
return response.text();
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GetList = async (listType) => {
|
|
||||||
if (true) {
|
|
||||||
let ListRequestOBJ = {
|
|
||||||
'request_name': listType,
|
|
||||||
'request_type': "list"
|
|
||||||
}
|
|
||||||
let params = "?request_name="+encodeURIComponent(ListRequestOBJ.request_name)+"&"+"request_type="+encodeURIComponent(ListRequestOBJ.request_type);
|
|
||||||
let targetURL = "http://127.0.0.1:42055/api/v1/user_client/get"+params;
|
|
||||||
//console.log(targetURL)
|
|
||||||
let a = await fetch_GetList(targetURL);
|
|
||||||
//console.log("return: "+a);
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function GetList_OBJ(ListName) {
|
|
||||||
let returnedList = await GetList(ListName);
|
|
||||||
let obj_main = JSON.parse(returnedList);
|
|
||||||
//console.log(returnedList);
|
|
||||||
//console.log(obj_main);
|
|
||||||
//console.log(typeof obj_main['message'])
|
|
||||||
|
|
||||||
//console.log(obj_main.message);
|
|
||||||
//var obj_temp = JSON.parse(obj_main.message['!lights']);
|
|
||||||
|
|
||||||
let data = atob(obj_main.message);
|
|
||||||
console.log(ListName, data);
|
|
||||||
let notDictionary = JSON.parse(data);
|
|
||||||
//let notDictionary = true
|
|
||||||
return notDictionary
|
|
||||||
}
|
|
||||||
|
|
||||||
async function updateCommandList() {
|
|
||||||
$("#CommandRowWrapper").empty();
|
|
||||||
let returnedCommands = await GetList_OBJ("Commands");
|
|
||||||
for (var x in returnedCommands){
|
|
||||||
//console.log(x)
|
|
||||||
var commandName = returnedCommands[x].command
|
|
||||||
var isCommandEnabled = ""
|
|
||||||
if (returnedCommands[x].isCommandEnabled == "true") {
|
|
||||||
isCommandEnabled = "checked"
|
|
||||||
}
|
|
||||||
var template = ""+
|
|
||||||
"<div class=\"rowsInMain row card\" style=\"margin-right: 20px;margin-left: 20px;margin-top: 30px;margin-bottom: 30px;\">" +
|
|
||||||
"<div class=\"col s12 switch\" style=\"top: -20px;position: relative;padding-left: 10px;\"><label>Enabled:<input "+ isCommandEnabled +" disabled type=\"checkbox\"><span class=\"lever\"></span></label></div>" +
|
|
||||||
"<div class=\"col s4\"><p>Command Name:</p>" +
|
|
||||||
"<div class=\"input-field inline\" style=\"width: 80%;\">" +
|
|
||||||
"<p style =\"color:grey;\">Command</p>" +
|
|
||||||
"<input disabled id=\"\" type=\"text\" value=\""+ commandName +"\" class=\"validate\">" +
|
|
||||||
"</div></div></div></div>"
|
|
||||||
$("#CommandRowWrapper").append(template);
|
|
||||||
}
|
|
||||||
//var commandName = "!testerino"
|
|
||||||
//var isCommandEnabled = "" // if == "checked" will start off with the isEnabled bool enabled
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
updateCommandList();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function updateRewardList() {
|
|
||||||
$("#RewardRowWrapper").empty();
|
|
||||||
console.log("about to update the rewards list");
|
|
||||||
let returnedRewards = await GetList_OBJ("Rewards");
|
|
||||||
for (var x in returnedRewards){
|
|
||||||
//console.log(x)
|
|
||||||
let rewardName = returnedRewards[x].channelRewardName
|
|
||||||
var isRewardEnabled = ""
|
|
||||||
if (returnedRewards[x].isRewardEnabled == "true") {
|
|
||||||
isRewardEnabled = "checked"
|
|
||||||
}
|
|
||||||
let template = ""+
|
|
||||||
"<div class=\"rowsInMain row card\" style=\"margin-right: 20px;margin-left: 20px;margin-top: 30px;margin-bottom: 30px;\">" +
|
|
||||||
"<div class=\"col s12 switch\" style=\"top: -20px;position: relative;padding-left: 10px;\"><label>Enabled:<input "+ isRewardEnabled +" disabled type=\"checkbox\"><span class=\"lever\"></span></label></div>" +
|
|
||||||
"<div class=\"col s4\"><p>Reward Name:</p>" +
|
|
||||||
"<div class=\"input-field inline\" style=\"width: 80%;\">" +
|
|
||||||
"<p style =\"color:grey;\">Reward</p>" +
|
|
||||||
"<input disabled id=\"\" type=\"text\" value=\""+ rewardName +"\" class=\"validate\">" +
|
|
||||||
"</div></div></div></div>"
|
|
||||||
$("#RewardRowWrapper").append(template);
|
|
||||||
}
|
|
||||||
//var commandName = "!testerino"
|
|
||||||
//var isCommandEnabled = "" // if == "checked" will start off with the isEnabled bool enabled
|
|
||||||
|
|
||||||
}
|
|
||||||
updateRewardList();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GetEventList = async () => {
|
|
||||||
if (true) {
|
|
||||||
let ListRequestOBJ = {
|
|
||||||
'request_name': "EventHistory",
|
|
||||||
'request_type': "list",
|
|
||||||
'request_data': "50"
|
|
||||||
}
|
|
||||||
let params = "?request_name="+encodeURIComponent(ListRequestOBJ.request_name)
|
|
||||||
+"&"+"request_type="+encodeURIComponent(ListRequestOBJ.request_type)
|
|
||||||
+"&"+"request_data="+encodeURIComponent(ListRequestOBJ.request_data);
|
|
||||||
let targetURL = "http://127.0.0.1:42055/api/v1/user_client/get"+params;
|
|
||||||
//console.log(targetURL)
|
|
||||||
let a = await fetch_GetList(targetURL);
|
|
||||||
//console.log("return: "+a);
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function GetEventList_OBJ() {
|
|
||||||
let returnedList = await GetEventList();
|
|
||||||
let obj_main = JSON.parse(returnedList);
|
|
||||||
//console.log(returnedList);
|
|
||||||
console.log(obj_main);
|
|
||||||
//console.log(typeof obj_main['message'])
|
|
||||||
|
|
||||||
//console.log(obj_main.message);
|
|
||||||
//var obj_temp = JSON.parse(obj_main.message['!lights']);
|
|
||||||
|
|
||||||
let data = atob(obj_main.message);
|
|
||||||
console.log("Event List OBJ: ", data);
|
|
||||||
let notDictionary = JSON.parse(data);
|
|
||||||
//let notDictionary = true
|
|
||||||
return notDictionary
|
|
||||||
}
|
|
||||||
|
|
||||||
async function updateEventList() {
|
|
||||||
$("#EventHistoryWrapper").empty();
|
|
||||||
let returnedEvents = await GetEventList_OBJ();
|
|
||||||
|
|
||||||
|
|
||||||
// let template = ""+
|
|
||||||
// "<div class=\"rowsInMain row card\">"+
|
|
||||||
// "<div class=\"col s3\"><p>Event:"+ "eventName" +"</p></div>"+
|
|
||||||
// "<div class=\"col s3\"><p>User:"+ "eventSender" +"</p></div>"+
|
|
||||||
// "<div class=\"col s3\"><p>Message:"+ "eventData" +"</p></div>"+
|
|
||||||
// "<a onclick=\"reRunEvent()\" 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").append(template);
|
|
||||||
// $("#EventHistoryWrapper").append(template);
|
|
||||||
// $("#EventHistoryWrapper").append(template);
|
|
||||||
// $("#EventHistoryWrapper").append(template);
|
|
||||||
// $("#EventHistoryWrapper").append(template);
|
|
||||||
// $("#EventHistoryWrapper").append(template);
|
|
||||||
|
|
||||||
console.log(returnedEvents)
|
|
||||||
try {
|
|
||||||
for (var x in returnedEvents){
|
|
||||||
console.log(x)
|
|
||||||
let eventName = returnedEvents[x].eventName
|
|
||||||
let eventTime = returnedEvents[x].eventTime
|
|
||||||
let eventType = returnedEvents[x].eventType
|
|
||||||
let eventSender = returnedEvents[x].eventSender
|
|
||||||
let eventData = returnedEvents[x].eventData
|
|
||||||
|
|
||||||
//console.log(eventName)
|
|
||||||
//console.log(eventTime)
|
|
||||||
//console.log(eventType)
|
|
||||||
//console.log(eventSender)
|
|
||||||
|
|
||||||
//let reRunEvent_Params = String("reRunEvent(\"" + eventName + "\", \"" + eventTime + "\", \"" + eventType + "\", \"" + eventSender + "\", \"" + eventData+"\")")
|
|
||||||
let reRunEvent_Params = `reRunEvent("${eventName}", "${eventTime}", "${eventType}", "${eventSender}", "${eventData}")`
|
|
||||||
//let reRunEvent_Params = `reRunEvent('${eventName}', '${eventTime}', '${eventType}', '${eventSender}', '${eventData}')`
|
|
||||||
console.log(reRunEvent_Params)
|
|
||||||
//let reRunEvent_Params = String("reRunEvent()")
|
|
||||||
let template = ""+
|
|
||||||
"<div class=\"rowsInMain row card\">"+
|
|
||||||
"<div class=\"col s12\" style=\"position:absolute;top:0;color:grey;\">Time: "+ eventTime +"</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>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;">'+
|
|
||||||
"<i class=\"material-icons\">refresh</i>"+
|
|
||||||
"</a></div>"
|
|
||||||
$("#EventHistoryWrapper").prepend(template);
|
|
||||||
}
|
|
||||||
}finally {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
updateEventList();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fetch_RerunEvent = (fetchURL) => response = fetch(fetchURL)
|
|
||||||
.then((response) => {
|
|
||||||
return response.text();
|
|
||||||
})
|
|
||||||
|
|
||||||
RerunEvent_OBJ = async (eventToRun) => {
|
|
||||||
if (true) {
|
|
||||||
let exampleEvent = {
|
|
||||||
'eventName': "",
|
|
||||||
'eventTime': "",
|
|
||||||
'eventType': "",
|
|
||||||
'eventSender': "",
|
|
||||||
'eventData': ""
|
|
||||||
}
|
|
||||||
let params = ""+
|
|
||||||
"?eventName="+encodeURIComponent(eventToRun['eventName'])+
|
|
||||||
"&"+"eventTime="+encodeURIComponent(eventToRun['eventTime'])+
|
|
||||||
"&"+"eventType="+encodeURIComponent(eventToRun['eventType'])+
|
|
||||||
"&"+"eventSender="+encodeURIComponent(eventToRun['eventSender'])+
|
|
||||||
"&"+"eventData="+encodeURIComponent(eventToRun['eventData']);
|
|
||||||
let targetURL = "http://127.0.0.1:42055/api/v1/user_client/event_log/reRunEvent"+params;
|
|
||||||
//console.log(targetURL)
|
|
||||||
let a = await fetch_RerunEvent(targetURL);
|
|
||||||
//console.log("return: "+a);
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function reRunEvent(eventName, eventTime, eventType, eventSender, eventData) {
|
|
||||||
var newEvent = {
|
|
||||||
'eventName': eventName,
|
|
||||||
'eventTime': eventTime,
|
|
||||||
'eventType': eventType,
|
|
||||||
'eventSender': eventSender,
|
|
||||||
'eventData': eventData
|
|
||||||
}
|
|
||||||
let response = await RerunEvent_OBJ(newEvent);
|
|
||||||
console.log(response)
|
|
||||||
let main = JSON.parse(response);
|
|
||||||
let data = main.message
|
|
||||||
console.log("response: ", data);
|
|
||||||
}
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
from enum import Enum
|
|
||||||
from os import F_OK
|
|
||||||
import tempText_Module
|
|
||||||
import time
|
|
||||||
import config as config
|
|
||||||
|
|
||||||
import flask
|
|
||||||
from flask import Flask, request, after_this_request
|
|
||||||
|
|
||||||
import credentials
|
|
||||||
|
|
||||||
import commands.loader as command_loader
|
|
||||||
from commands.command_base import AbstractCommand
|
|
||||||
|
|
||||||
from cooldowns import Cooldown_Module
|
|
||||||
|
|
||||||
import utilities_script as utility
|
|
||||||
|
|
||||||
import chyron_module
|
|
||||||
import timers_module
|
|
||||||
|
|
||||||
import random
|
|
||||||
|
|
||||||
import os
|
|
||||||
import praxis_logging
|
|
||||||
praxis_logger_obj = praxis_logging.praxis_logger()
|
|
||||||
praxis_logger_obj.init(os.path.basename(__file__))
|
|
||||||
praxis_logger_obj.log("\n -Starting Logs: " + os.path.basename(__file__))
|
|
||||||
|
|
||||||
api:Flask = Flask(__name__)
|
|
||||||
api.config["DEBUG"] = True
|
|
||||||
|
|
||||||
class Module_InfoLookup():
|
|
||||||
def __init__(self):
|
|
||||||
super().__init__()
|
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
print("starting up... ",)
|
|
||||||
|
|
||||||
@api.route('/')
|
|
||||||
def bot_StatusIcon():
|
|
||||||
@after_this_request
|
|
||||||
def add_header(response):
|
|
||||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
|
||||||
return response
|
|
||||||
return flask.make_response('Client Service: OK', 200)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
init()
|
|
||||||
api.run(host="0.0.0.0", port = 42063)
|
|
||||||
@ -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()
|
||||||
@ -56,10 +56,6 @@ def get_dir(selected_dir):
|
|||||||
os.mkdir(dir)
|
os.mkdir(dir)
|
||||||
return dir
|
return dir
|
||||||
|
|
||||||
def contains_value(self, search: str, data:str):
|
|
||||||
contains = re.search(search, data)
|
|
||||||
return contains.group(0)
|
|
||||||
|
|
||||||
def contains_slur(input: str):
|
def contains_slur(input: str):
|
||||||
containsSlur: bool = False
|
containsSlur: bool = False
|
||||||
parsedMessage = input.split(" ")
|
parsedMessage = input.split(" ")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user