This commit is contained in:
Alex Orid 2021-05-11 16:26:00 -04:00
parent b1d622826f
commit b47663a125
12 changed files with 321 additions and 81 deletions

View File

@ -8,11 +8,12 @@ from os import listdir
from os.path import isfile, join from os.path import isfile, join
class event_log(): class event_log():
def __init__(self, eventName, eventTime, eventType, eventData): def __init__(self, eventName, eventTime, eventType, eventSender, eventData):
super().__init__() super().__init__()
self.eventName = eventName self.eventName = eventName
self.eventTime = eventTime self.eventTime = eventTime
self.eventType = eventType self.eventType = eventType
self.eventSender = eventSender
self.eventData = eventData self.eventData = eventData
@ -47,6 +48,7 @@ class Event_Log_Module():
newDic['eventName'] = event.eventName newDic['eventName'] = event.eventName
newDic['eventTime'] = str(event.eventTime) newDic['eventTime'] = str(event.eventTime)
newDic['eventType'] = str(event.eventType) newDic['eventType'] = str(event.eventType)
newDic['eventSender'] = str(event.eventSender)
newDic['eventData'] = str(event.eventData) newDic['eventData'] = str(event.eventData)
newList.append(newDic) newList.append(newDic)
with open(real_file_path, 'w') as logFile: with open(real_file_path, 'w') as logFile:
@ -65,9 +67,10 @@ class Event_Log_Module():
eventName = d['eventName'] eventName = d['eventName']
eventTime = d['eventTime'] eventTime = d['eventTime']
eventType = d['eventType'] eventType = d['eventType']
eventSender = d['eventSender']
eventData = d['eventData'] eventData = d['eventData']
foundLog = event_log(eventName, eventTime, eventType, eventData) foundLog = event_log(eventName, eventTime, eventType, eventSender, eventData)
newList.append(foundLog) newList.append(foundLog)
return newList return newList
@ -98,8 +101,8 @@ class Event_Log_Module():
os.mkdir(path, 0x777) os.mkdir(path, 0x777)
return path return path
def make_event(self, eventName, eventTime, eventType, eventData): def make_event(self, eventName, eventTime, eventType, eventSender, eventData):
newLog = event_log(eventName, eventTime, eventType, eventData) newLog = event_log(eventName, eventTime, eventType, eventSender, eventData)
self.Event_Log_List.append(newLog) self.Event_Log_List.append(newLog)
self.makeFile(self.Event_Log_FileName) self.makeFile(self.Event_Log_FileName)
self.makeFile(self.Event_Log_FileName_Bonus) self.makeFile(self.Event_Log_FileName_Bonus)

View File

@ -1,9 +1,14 @@
import flask import flask
from flask import request from flask import Flask, request, after_this_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 os import os
import praxis_logging import praxis_logging
praxis_logger_obj = praxis_logging.praxis_logger() praxis_logger_obj = praxis_logging.praxis_logger()
@ -53,6 +58,20 @@ 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 = {}
return flask.make_response({'message': returnedDict}, 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():
@ -80,6 +99,14 @@ 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()

View File

@ -39,8 +39,8 @@ def init():
print("starting up... ",) print("starting up... ",)
logging_module.main() logging_module.main()
def add_event(eventName, eventTime, eventType, eventData): def add_event(eventName, eventTime, eventType, eventSender, eventData):
logging_module.make_event(eventName, eventTime, eventType, eventData) logging_module.make_event(eventName, eventTime, eventType, eventSender, eventData)
return flask.make_response("{\"message\":\"%s\"}" % None, 200, {"Content-Type": "application/json"}) return flask.make_response("{\"message\":\"%s\"}" % None, 200, {"Content-Type": "application/json"})
def get_events(eventCount=100): def get_events(eventCount=100):
@ -77,10 +77,12 @@ def add_event_log():
return flask.make_response('{\"text\":"Argument \'event_time\' not in request"}', 400) return flask.make_response('{\"text\":"Argument \'event_time\' not in request"}', 400)
if 'event_type' not in request.args: if 'event_type' not in request.args:
return flask.make_response('{\"text\":"Argument \'event_type\' not in request"}', 400) 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: if 'event_data' not in request.args:
return flask.make_response('{\"text\":"Argument \'event_data\' not in request"}', 400) 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['event_data'],) 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') @api.route('/api/v1/event_log/get_events')
def get_event_log(): def get_event_log():

View File

@ -200,11 +200,12 @@ class Twitch_Pubsub():
pass pass
#FINISH THIS EVENT LOG #FINISH THIS EVENT LOG
def send_EventLog(self, eventName, eventTime, eventType, eventData): def send_EventLog(self, eventName, eventTime, eventType, eventSender, eventData):
params = urlencode( params = urlencode(
{'event_name': eventName, {'event_name': eventName,
'event_time': eventTime, 'event_time': eventTime,
'event_type': eventType, 'event_type': eventType,
'eventSender': eventSender,
'event_data': eventData}) 'event_data': eventData})
url = "http://standalone_eventlog:42008/api/v1/event_log/add_event?%s" % params url = "http://standalone_eventlog:42008/api/v1/event_log/add_event?%s" % params
resp = requests.get(url) resp = requests.get(url)

View File

@ -77,7 +77,7 @@ class Twitch_Module():
try: try:
is_actionable = self.is_command(command) is_actionable = self.is_command(command)
if is_actionable: if is_actionable:
self.send_EventLog(command, str(datetime.now()), "command.twitch", rest) self.send_EventLog(command, str(datetime.now()), "command.twitch", message.sender, rest)
praxis_logger_obj.log("Sent a thing") praxis_logger_obj.log("Sent a thing")
except: except:
praxis_logger_obj.log("something went wrong with Event LOG") praxis_logger_obj.log("something went wrong with Event LOG")
@ -138,11 +138,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, rest): def send_EventLog(self, command, eventTime, eventType, eventSender, rest):
params = urlencode( params = urlencode(
{'event_name': command, {'event_name': command,
'event_time': eventTime, 'event_time': eventTime,
'event_type': eventType, 'event_type': eventType,
'eventSender': eventSender,
'event_data': rest}) 'event_data': rest})
url = "http://standalone_eventlog:42008/api/v1/event_log/add_event?%s" % params url = "http://standalone_eventlog:42008/api/v1/event_log/add_event?%s" % params
resp = requests.get(url) resp = requests.get(url)

View File

@ -4,6 +4,13 @@ import tempText_Module
import time import time
import config as config import config as config
from datetime import datetime
import re
from json import loads
from urllib.parse import urlencode
import requests
import flask import flask
from flask import Flask, request, after_this_request from flask import Flask, request, after_this_request
@ -34,10 +41,81 @@ api.config["DEBUG"] = True
def init(): def init():
print("starting up... ",) print("starting up... ",)
def handle_request_get(requestName, requestType):
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\"}" % "message123123", 200, {"Content-Type": "application/json"}) return flask.make_response("{\"message\": \"%s\"}" % "message123123", 200, {"Content-Type": "application/json"})
def request_get_list(serviceName, servicePort):
try:
url = "http://"+ "127.0.0.1" + ":"+ 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:
return msg
# todo send to logger and other relevent services
else:
# todo handle failed requests
return None
except:
return None
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 None
except:
return None
def handle_request_set(requestName, requestType, requestData): 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 pass
@api.route('/') @api.route('/')
@ -58,8 +136,12 @@ def get_data():
return flask.make_response('{\"text\":"Argument \'request_name\' not in request"}', 400) return flask.make_response('{\"text\":"Argument \'request_name\' not in request"}', 400)
if 'request_type' not in request.args: if 'request_type' not in request.args:
return flask.make_response('{\"text\":"Argument \'request_type\' not in request"}', 400) 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']) return handle_request_get(request.args['request_name'], request.args['request_type'], requestData)
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -18,55 +18,72 @@
</head> </head>
<body> <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"><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 id="Home">
<div class="sticky ontop"> <div class="sticky ontop">
<div id="header"> <div id="header">
<div class="" style="display:flex;"> <!--<div class="" style="display:flex;">
<div class="headerItem left"><p class="headerText">Home</p></div> <div class="headerItem left"><p class="headerText">Home</p></div>
</div> </div>
<div class="" style="display:flex;"> <div class="" style="display:flex;">
<div class="headerItem"><p class="headerText">Settings</p></div> <div class="headerItem"><p class="headerText">Settings</p></div>
<div class="headerItem"><p class="headerText">About</p></div> <div class="headerItem"><p class="headerText">About</p></div>
</div> </div>-->
<div style="position: absolute;right: 10;" onclick="BotStatus()"><p id="BotStatus" class="card noselect" style="padding-left: 3px;padding-right: 3px;">Bot Status: ??</p></div>
</div> </div>
<!--<a class="btn-floating btn-large waves-effect waves-light red right hide-on-small-and-down" ><i class="material-icons">add</i></a>--> <!--<a class="btn-floating btn-large waves-effect waves-light red right hide-on-small-and-down" ><i class="material-icons">add</i></a>-->
</div> </div>
<div id=bodyarea class="row" style=""> <div id=bodyarea class="row" style="">
<div id="sidebar_area" class="col s12 m3 hide-on-small-and-down" style="position: fixed;"> <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=""> <div class="row" style="padding-left: 3px;" style="">
<div class="s12 card waves-effect waves-light btn-large colsInSideBar" style="background-color: #42A5F5;"> <a href="index.html"><div class="s12 card waves-effect waves-light btn-large colsInSideBar" style="background-color: #42A5F5;">
<i class="material-icons">menu</i> <i class="material-icons">arrow_upward</i>
</div> </div></a>
<div class="lineSeperator"></div> <div class="lineSeperator blue"></div>
<div class="s12 card waves-effect waves-light btn-large colsInSideBar" style="background-color: #42A5F5;"> <a href="#Chyron"><div class="s12 card waves-effect waves-light btn-large colsInSideBar" style="background-color: #42A5F5;">
<p>Chyron</p> <p>Chyron</p>
</div> </div></a>
<div class="s12 card waves-effect waves-light btn-large colsInSideBar" style="background-color: #42A5F5;"> <a href="#Commands"><div class="s12 card waves-effect waves-light btn-large colsInSideBar" style="background-color: #42A5F5;">
<p>Commands</p> <p>Commands</p>
</div> </div></a>
<div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;"> <a href="#Rewards"><div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;">
<p>Rewards</p> <p>Rewards</p>
</div> </div></a>
<div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;"> <a href="#Timers"><div class="s12 card colsInSideBar waves-effect waves-light btn-large hide" style="background-color: #42A5F5;">
<p>Timers</p> <p>Timers</p>
</div> </div></a>
<div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;"> <a href="#TextSources"><div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;">
<p>Text Sources</p> <p>Text Sources</p>
</div> </div></a>
<div class="lineSeperator"></div> <a href="#EventHistory"><div class="lineSeperator blue"></div>
<div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;"> <div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;">
<p>Event History</p> <p>Event History</p>
</div> </div></a>
<div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;"> <a href="#Services"><div class="s12 card colsInSideBar waves-effect waves-light btn-large hide" style="background-color: #42A5F5;">
<p>Modules</p> <p>Services</p>
</div></a>
</div> </div>
</div> </div>
</div> <div id="main_area" class="col s12 m9 right card">
<div id="main_area" class="col s12 m9 right">
<div class="rowsInMain center card"> <div id="Chyron" style="padding-top: 20px;"><div class="rowsInMain center card">
<a class="btn-floating btn-large waves-effect waves-light red right hide-on-small-and-down" style="margin-right: 10px;"> <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> <i class="material-icons">add</i>
</a><h3>Chyron:</h3></div> </a><h3>Chyron:</h3></div>
@ -74,54 +91,51 @@
<div class="col s3"><p>Section Name:</p></div> <div class="col s3"><p>Section Name:</p></div>
<div class="col s3"><p>Title:</p></div> <div class="col s3"><p>Title:</p></div>
<div class="col s3"><p>Content:</p></div> <div class="col s3"><p>Content:</p></div>
<div class="col s1 right"><p>O</p></div> <div class="col s1 switch"><label>Enabled:<input type="checkbox"><span class="lever"></span></label></div>
<div class="col s1 btn red waves-effect"><i class="material-icons">delete</i></div>
</div> </div>
<div class="rowsInMain center card"> <div id="Commands" style="padding-top: 20px;"></div><div class="rowsInMain center card">
<a class="btn-floating btn-large waves-effect waves-light red right hide-on-small-and-down" style="margin-right: 10px;"> <a class="btn-floating btn-large waves-effect waves-light red right hide-on-small-and-down hide" style="margin-right: 10px;">
<i class="material-icons">add</i> <i class="material-icons">add</i>
</a><h3>Commands:</h3></div> </a><h3>Commands:</h3></div>
<div class="rowsInMain row card" style="margin-right: 20px;margin-left: 20px;margin-top: 30px;margin-bottom: 30px;"> <div class="rowsInMain row card" style="margin-right: 20px;margin-left: 20px;margin-top: 30px;margin-bottom: 30px;">
<div class="col s3"><p>Cmd Name:</p></div> <div class="col s3"><p>Command Name:</p></div>
<div class="col s3"><p>Trigger:</p></div> <div class="col s1 switch"><label>Enabled:<input type="checkbox"><span class="lever"></span></label></div>
<div class="col s3"><p>Responses:</p></div>
<div class="col s1 right"><p>O</p></div>
</div> </div>
<div class="rowsInMain center card"> <div id="Rewards" style="padding-top: 20px;"></div><div class="rowsInMain center card">
<a class="btn-floating btn-large waves-effect waves-light red right hide-on-small-and-down" style="margin-right: 10px;"> <a class="btn-floating btn-large waves-effect waves-light red right hide-on-small-and-down hide" style="margin-right: 10px;">
<i class="material-icons">add</i> <i class="material-icons">add</i>
</a><h3>Rewards:</h3></div> </a><h3>Rewards:</h3></div>
<div class="rowsInMain row card" style="margin-right: 20px;margin-left: 20px;margin-top: 30px;margin-bottom: 30px;"> <div class="rowsInMain row card" style="margin-right: 20px;margin-left: 20px;margin-top: 30px;margin-bottom: 30px;">
<div class="col s3"><p>Rwd Name:</p></div> <div class="col s3"><p>Reward Name:</p></div>
<div class="col s3"><p>Trigger:</p></div> <div class="col s1 switch"><label>Enabled:<input type="checkbox"><span class="lever"></span></label></div>
<div class="col s3"><p>Responses:</p></div>
<div class="col s1 right"><p>O</p></div>
</div> </div>
<div class="rowsInMain center card"> <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;"> <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> <i class="material-icons">add</i>
</a><h3>Timers:</h3></div> </a><h3>Timers:</h3></div>
<div class="rowsInMain row card" style="margin-right: 20px;margin-left: 20px;margin-top: 30px;margin-bottom: 30px;"> <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>Timer Name:</p></div>
<div class="col s3"><p>Trigger:</p></div> <div class="col s3"><p>Trigger:</p></div>
<div class="col s3"><p>Trigger_EXEC:</p></div> <div class="col s3"><p>Trigger_EXEC:</p></div>
<div class="col s1 right"><p>O</p></div> <div class="col s "><p>O</p></div>
</div> </div>
<div class="rowsInMain center card"> <div id="TextSources" style="padding-top: 20px;"></div><div class="rowsInMain center card">
<a class="btn-floating btn-large waves-effect waves-light red right hide-on-small-and-down" style="margin-right: 10px;"> <a class="btn-floating btn-large waves-effect waves-light green right hide-on-small-and-down" style="margin-right: 10px;">
<i class="material-icons">add</i> <i class="material-icons">add</i>
</a><h3>Text Sources:</h3></div> </a><h3>Text Sources:</h3></div>
<div class="rowsInMain row card" style="margin-right: 20px;margin-left: 20px;margin-top: 30px;margin-bottom: 30px;"> <div class="rowsInMain row card" style="margin-right: 20px;margin-left: 20px;margin-top: 30px;margin-bottom: 30px;">
<div class="col s3"><p>Text Name:</p></div> <div class="col s3"><p>File Name:</p></div>
<div class="col s3"><p>Title:</p></div> <div class="col s3"><p>Title:</p></div>
<div class="col s3"><p>Text:</p></div> <div class="col s3"><p>Text:</p></div>
<div class="col s1 right"><p>O</p></div> <div class="col s1 btn red waves-effect"><i class="material-icons ">delete</i></div>
</div> </div>
<div class="rowsInMain center card"> <div id="EventHistory" style="padding-top: 20px;"></div><div class="rowsInMain center card">
<a class="btn-floating btn-large waves-effect waves-light red right hide-on-small-and-down" style="margin-right: 10px;"> <a class="btn-floating btn-large waves-effect waves-light blue right hide-on-small-and-down" style="margin-right: 10px;">
<i class="material-icons">add</i> <i class="material-icons">refresh</i>
</a><h3>Event History:</h3></div> </a><h3>Event History:</h3></div>
<div class="" style="overflow-y: scroll; max-height: 60vh; background-color: cadetblue; margin-right: 20px;margin-left: 20px;margin-top: 30px;margin-bottom: 30px;"> <div class="EventHistoryWrapper">
<div class="rowsInMain row card"> <div class="rowsInMain row card">
<div class="col s3"><p>Event:</p></div> <div class="col s3"><p>Event:</p></div>
<div class="col s3"><p>User:</p></div> <div class="col s3"><p>User:</p></div>
@ -172,8 +186,8 @@
</div> </div>
</div> </div>
<div class="rowsInMain center card"><h3>Modules:</h3></div> <div id="Services" style="padding-top: 20px;"></div><div class="rowsInMain center card hide"><h3>Services:</h3></div>
<div class="row"> <div class="row hide">
<div class="col s6 m3"> <div class="col s6 m3">
<div class="card modulesCard"> <div class="card modulesCard">
<div class="modulesCardWrap"> <div class="modulesCardWrap">
@ -228,6 +242,14 @@
</div> </div>
</div> </div>
</div>
<div id="Settings"></div>
<div id="About"></div>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="js/materialize.js"></script> <script src="js/materialize.js"></script>

View File

View File

@ -29,12 +29,12 @@ p {
} }
#sidebar_area{ #sidebar_area{
background-color: aquamarine; background-color: rgb(235, 235, 235);;
min-height: 100%; min-height: 100%;
} }
#main_area{ #main_area{
background-color: rgb(195, 246, 255); background-color: rgb(221, 221, 221);
min-height: 100%; min-height: 100%;
} }
@ -121,6 +121,16 @@ p {
padding-bottom: 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 */ /* width */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 20px; width: 20px;

View File

@ -24,24 +24,17 @@ fetch_GetList = (fetchURL) => response = fetch(fetchURL)
myObj = {
'request_name': "Chyron",
'request_type': "list"
};
params = "?request_name="+encodeURIComponent(myObj.request_name)+"&"+"request_type="+encodeURIComponent(myObj.request_type);
url = "http://127.0.0.1:5500/api/v1/user_client/get"+params;
GetList = async (listType) => { GetList = async (listType) => {
if (listType == "Chyron") { if (true) {
chyronListRequestOBJ = { ListRequestOBJ = {
'request_name': "Chyron", 'request_name': listType,
'request_type': "list" 'request_type': "list"
} }
params = "?request_name="+encodeURIComponent(chyronListRequestOBJ.request_name)+"&"+"request_type="+encodeURIComponent(chyronListRequestOBJ.request_type); params = "?request_name="+encodeURIComponent(ListRequestOBJ.request_name)+"&"+"request_type="+encodeURIComponent(ListRequestOBJ.request_type);
targetURL = "http://127.0.0.1:5500/api/v1/user_client/get"+params; targetURL = "http://127.0.0.1:5500/api/v1/user_client/get"+params;
console.log(targetURL) console.log(targetURL)
a = await fetch_GetList(targetURL); a = await fetch_GetList(targetURL);
console.log(a); //console.log("return: "+a);
return a return a
} }
else { else {
@ -56,4 +49,48 @@ async function GetListChyron() {
return returnedList return returnedList
} }
GetListChyron(); async function GetListCommands() {
returnedList = await GetList("Commands");
var obj_main = JSON.parse(returnedList);
console.log(returnedList);
console.log(obj_main);
console.log(typeof obj_main["message"])
console.log(obj_main["message"]);
obj_temp = JSON.parse(obj_main["message"]);
searchPattern = "(?<='command': ')[^]'+";
searchPattern = "(?<='command': ')[^']+"
newString = returnedList.search(searchPattern);
console.log(newString)
//obj_temp = JSON.parse(obj_main["message"]);
for (var x in Object.keys(obj_main)) {
console.log(x);
}
console.log(obj_main['message']['!lights']);
return returnedList
}
var returnedCommands = GetListCommands();
async function GetListRewards() {
returnedList = await GetList("Rewards");
obj = JSON.parse(returnedList);
console.log(obj["message"])
return returnedList
}
async function GetListTimers() {
returnedList = await GetList("Timers");
obj = JSON.parse(returnedList);
console.log(obj["message"])
return returnedList
}
async function GetListTextSources() {
returnedList = await GetList("TextSources");
obj = JSON.parse(returnedList);
console.log(obj["message"])
return returnedList
}

View File

@ -0,0 +1,51 @@
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)

View File

@ -56,6 +56,10 @@ 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(" ")