master updates #41
@ -8,11 +8,12 @@ from os import listdir
|
||||
from os.path import isfile, join
|
||||
|
||||
class event_log():
|
||||
def __init__(self, eventName, eventTime, eventType, eventData):
|
||||
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
|
||||
|
||||
|
||||
@ -47,6 +48,7 @@ class Event_Log_Module():
|
||||
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:
|
||||
@ -65,9 +67,10 @@ class Event_Log_Module():
|
||||
eventName = d['eventName']
|
||||
eventTime = d['eventTime']
|
||||
eventType = d['eventType']
|
||||
eventSender = d['eventSender']
|
||||
eventData = d['eventData']
|
||||
|
||||
foundLog = event_log(eventName, eventTime, eventType, eventData)
|
||||
foundLog = event_log(eventName, eventTime, eventType, eventSender, eventData)
|
||||
newList.append(foundLog)
|
||||
return newList
|
||||
|
||||
@ -98,8 +101,8 @@ class Event_Log_Module():
|
||||
os.mkdir(path, 0x777)
|
||||
return path
|
||||
|
||||
def make_event(self, eventName, eventTime, eventType, eventData):
|
||||
newLog = event_log(eventName, eventTime, eventType, eventData)
|
||||
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)
|
||||
|
||||
@ -1,9 +1,14 @@
|
||||
import flask
|
||||
from flask import request
|
||||
from flask import Flask, request, after_this_request
|
||||
|
||||
import commands.loader as command_loader
|
||||
from commands.command_base import AbstractCommand
|
||||
|
||||
from json import loads
|
||||
from urllib.parse import urlencode
|
||||
|
||||
import requests
|
||||
|
||||
import os
|
||||
import praxis_logging
|
||||
praxis_logger_obj = praxis_logging.praxis_logger()
|
||||
@ -53,6 +58,20 @@ def handle_command(source, username, command, rest, bonusData):
|
||||
|
||||
#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'])
|
||||
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'])
|
||||
|
||||
@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__':
|
||||
init()
|
||||
|
||||
@ -39,8 +39,8 @@ def init():
|
||||
print("starting up... ",)
|
||||
logging_module.main()
|
||||
|
||||
def add_event(eventName, eventTime, eventType, eventData):
|
||||
logging_module.make_event(eventName, eventTime, eventType, eventData)
|
||||
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(eventCount=100):
|
||||
@ -77,10 +77,12 @@ def add_event_log():
|
||||
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['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')
|
||||
def get_event_log():
|
||||
|
||||
@ -200,11 +200,12 @@ class Twitch_Pubsub():
|
||||
pass
|
||||
|
||||
#FINISH THIS EVENT LOG
|
||||
def send_EventLog(self, eventName, eventTime, eventType, eventData):
|
||||
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)
|
||||
|
||||
@ -77,7 +77,7 @@ class Twitch_Module():
|
||||
try:
|
||||
is_actionable = self.is_command(command)
|
||||
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")
|
||||
except:
|
||||
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)
|
||||
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(
|
||||
{'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)
|
||||
|
||||
@ -4,6 +4,13 @@ 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
|
||||
|
||||
@ -34,11 +41,82 @@ api.config["DEBUG"] = True
|
||||
def init():
|
||||
print("starting up... ",)
|
||||
|
||||
def handle_request_get(requestName, requestType):
|
||||
return flask.make_response("{\"message\": \"%s\"}" % "message123123", 200, {"Content-Type": "application/json"})
|
||||
|
||||
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"})
|
||||
|
||||
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):
|
||||
pass
|
||||
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():
|
||||
@ -58,8 +136,12 @@ def get_data():
|
||||
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'])
|
||||
return handle_request_get(request.args['request_name'], request.args['request_type'], requestData)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -18,55 +18,72 @@
|
||||
</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"><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 id="header">
|
||||
<div class="" style="display:flex;">
|
||||
<!--<div class="" style="display:flex;">
|
||||
<div class="headerItem left"><p class="headerText">Home</p></div>
|
||||
</div>
|
||||
<div class="" style="display:flex;">
|
||||
<div class="headerItem"><p class="headerText">Settings</p></div>
|
||||
<div class="headerItem"><p class="headerText">About</p></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>-->
|
||||
</div>
|
||||
|
||||
|
||||
<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="s12 card waves-effect waves-light btn-large colsInSideBar" style="background-color: #42A5F5;">
|
||||
<i class="material-icons">menu</i>
|
||||
</div>
|
||||
<div class="lineSeperator"></div>
|
||||
<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">arrow_upward</i>
|
||||
</div></a>
|
||||
<div class="lineSeperator blue"></div>
|
||||
<a href="#Chyron"><div class="s12 card waves-effect waves-light btn-large colsInSideBar" style="background-color: #42A5F5;">
|
||||
<p>Chyron</p>
|
||||
</div>
|
||||
<div class="s12 card waves-effect waves-light btn-large colsInSideBar" style="background-color: #42A5F5;">
|
||||
</div></a>
|
||||
<a href="#Commands"><div class="s12 card waves-effect waves-light btn-large colsInSideBar" style="background-color: #42A5F5;">
|
||||
<p>Commands</p>
|
||||
</div>
|
||||
<div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;">
|
||||
</div></a>
|
||||
<a href="#Rewards"><div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;">
|
||||
<p>Rewards</p>
|
||||
</div>
|
||||
<div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;">
|
||||
</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>
|
||||
<div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;">
|
||||
</div></a>
|
||||
<a href="#TextSources"><div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;">
|
||||
<p>Text Sources</p>
|
||||
</div>
|
||||
<div class="lineSeperator"></div>
|
||||
</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>
|
||||
<div class="s12 card colsInSideBar waves-effect waves-light btn-large" style="background-color: #42A5F5;">
|
||||
<p>Modules</p>
|
||||
</div>
|
||||
</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">
|
||||
<div id="main_area" class="col s12 m9 right card">
|
||||
|
||||
<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;">
|
||||
<i class="material-icons">add</i>
|
||||
</a><h3>Chyron:</h3></div>
|
||||
@ -74,54 +91,51 @@
|
||||
<div class="col s3"><p>Section Name:</p></div>
|
||||
<div class="col s3"><p>Title:</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 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;">
|
||||
<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 hide" style="margin-right: 10px;">
|
||||
<i class="material-icons">add</i>
|
||||
</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="col s3"><p>Cmd Name:</p></div>
|
||||
<div class="col s3"><p>Trigger:</p></div>
|
||||
<div class="col s3"><p>Responses:</p></div>
|
||||
<div class="col s1 right"><p>O</p></div>
|
||||
<div class="col s3"><p>Command Name:</p></div>
|
||||
<div class="col s1 switch"><label>Enabled:<input type="checkbox"><span class="lever"></span></label></div>
|
||||
</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;">
|
||||
<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 hide" style="margin-right: 10px;">
|
||||
<i class="material-icons">add</i>
|
||||
</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="col s3"><p>Rwd Name:</p></div>
|
||||
<div class="col s3"><p>Trigger:</p></div>
|
||||
<div class="col s3"><p>Responses:</p></div>
|
||||
<div class="col s1 right"><p>O</p></div>
|
||||
<div class="col s3"><p>Reward Name:</p></div>
|
||||
<div class="col s1 switch"><label>Enabled:<input type="checkbox"><span class="lever"></span></label></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;">
|
||||
<i class="material-icons">add</i>
|
||||
</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>Trigger:</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 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;">
|
||||
<div id="TextSources" style="padding-top: 20px;"></div><div class="rowsInMain center card">
|
||||
<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>
|
||||
</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="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>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 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;">
|
||||
<i class="material-icons">add</i>
|
||||
<div id="EventHistory" style="padding-top: 20px;"></div><div class="rowsInMain center card">
|
||||
<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">refresh</i>
|
||||
</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="col s3"><p>Event:</p></div>
|
||||
<div class="col s3"><p>User:</p></div>
|
||||
@ -172,8 +186,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rowsInMain center card"><h3>Modules:</h3></div>
|
||||
<div class="row">
|
||||
<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">
|
||||
@ -228,6 +242,14 @@
|
||||
</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="js/materialize.js"></script>
|
||||
|
||||
0
user_client/v1/settings.html
Normal file
0
user_client/v1/settings.html
Normal file
@ -29,12 +29,12 @@ p {
|
||||
}
|
||||
|
||||
#sidebar_area{
|
||||
background-color: aquamarine;
|
||||
background-color: rgb(235, 235, 235);;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
#main_area{
|
||||
background-color: rgb(195, 246, 255);
|
||||
background-color: rgb(221, 221, 221);
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
@ -121,6 +121,16 @@ p {
|
||||
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;
|
||||
|
||||
@ -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) => {
|
||||
if (listType == "Chyron") {
|
||||
chyronListRequestOBJ = {
|
||||
'request_name': "Chyron",
|
||||
if (true) {
|
||||
ListRequestOBJ = {
|
||||
'request_name': listType,
|
||||
'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;
|
||||
console.log(targetURL)
|
||||
a = await fetch_GetList(targetURL);
|
||||
console.log(a);
|
||||
//console.log("return: "+a);
|
||||
return a
|
||||
}
|
||||
else {
|
||||
@ -56,4 +49,48 @@ async function GetListChyron() {
|
||||
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
|
||||
}
|
||||
51
user_client_module_InfoLookup.py
Normal file
51
user_client_module_InfoLookup.py
Normal 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)
|
||||
@ -56,6 +56,10 @@ def get_dir(selected_dir):
|
||||
os.mkdir(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):
|
||||
containsSlur: bool = False
|
||||
parsedMessage = input.split(" ")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user