Compare commits

...

2 Commits

Author SHA1 Message Date
Alex Orid
f34e53fe1f working without docker 2021-04-27 19:06:58 -04:00
Alex Orid
0d6e26a2a5 Revert "logging"
This reverts commit b106eaa9dd.
2021-04-27 18:55:23 -04:00
30 changed files with 273 additions and 352 deletions

View File

@ -9,31 +9,25 @@ from commands.command_base import AbstractCommand
import credentials
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__))
class Command_Management_Module():
def __init__(self):
super().__init__()
self.dbCredential: credentials.DB_Credential
def main_test(self):
praxis_logger_obj.log("[TEST Module]> test")
print("[TEST Module]> test")
tempModule = user_module.User_Module()
#tempModule.commands = command_loader.load_commands_new(AbstractCommand.CommandType.Praxis)
praxis_logger_obj.log(self.getCommandsList(tempModule.commands))
print(self.getCommandsList(tempModule.commands))
def getCommandsList(self, targetModuleCommands):
praxis_logger_obj.log(type(targetModuleCommands))
print(type(targetModuleCommands))
commandsList = "\n"
for cmd in targetModuleCommands:
targetCommand = targetModuleCommands[cmd]
praxis_logger_obj.log(targetCommand.command)
praxis_logger_obj.log(targetCommand.isCommandEnabled)
print(targetCommand.command)
print(targetCommand.isCommandEnabled)
return commandsList

View File

@ -1,13 +1,7 @@
import importlib
import importlib.util
import inspect
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__))
import sys
from typing import Dict
@ -16,7 +10,7 @@ from channel_rewards.channelRewards_base import AbstractChannelRewards
#New
def load_rewards(channelRewardsType: AbstractChannelRewards.ChannelRewardsType) -> Dict[str, AbstractChannelRewards]:
praxis_logger_obj.log(" -Loading ", channelRewardsType ," ChannelRewards...\n")
print(" -Loading ", channelRewardsType ," ChannelRewards...\n")
ChannelRewards = compile_and_load(channelRewardsType)
return ChannelRewards
@ -32,10 +26,10 @@ def compile_and_load_file(path: str, channelRewardsType: AbstractChannelRewards.
if inspect.isclass(obj) and name.startswith("ChannelReward"):
ChannelReward_inst = obj()
if channelRewardsType == ChannelReward_inst.get_ChannelRewardType():
praxis_logger_obj.log(" ---Successfully loaded %s: %s" % (channelRewardsType, ChannelReward_inst.get_ChannelRewardName()))
print(" ---Successfully loaded %s: %s" % (channelRewardsType, ChannelReward_inst.get_ChannelRewardName()))
return ChannelReward_inst.get_ChannelRewardName(), ChannelReward_inst
elif channelRewardsType != ChannelReward_inst.get_ChannelRewardType():
praxis_logger_obj.log(" -%s ChannelRewardsType did not match: %s for: %s" % (ChannelReward_inst.get_ChannelRewardType(), channelRewardsType, ChannelReward_inst.get_ChannelRewardName()))
print(" -%s ChannelRewardsType did not match: %s for: %s" % (ChannelReward_inst.get_ChannelRewardType(), channelRewardsType, ChannelReward_inst.get_ChannelRewardName()))
return "", None
@ -46,7 +40,7 @@ def compile_and_load(ChannelRewardType: AbstractChannelRewards.ChannelRewardsTyp
for dirName, subdirList, fileList in os.walk(implementations):
for file in fileList:
name = os.path.join(dirName, file)
praxis_logger_obj.log("compiling: %s" % name)
print("compiling: %s" % name)
name, reward = compile_and_load_file(name, ChannelRewardType)
if reward is not None and reward.ChannelRewardType is ChannelRewardType:
dic[name] = reward
@ -62,7 +56,7 @@ def get_base_dir() -> str:
elif current == 'Praxis_Bot' or current == 'Praxis':
return check_dir(os.path.join(cwd, "channel_rewards"))
else:
praxis_logger_obj.log("could not find working directory for Praxis_Bot/channel_rewards")
print("could not find working directory for Praxis_Bot/channel_rewards")
raise Exception

View File

@ -18,6 +18,8 @@ class ChannelReward_Hydration_v2(AbstractChannelRewards, metaclass=ABCMeta):
self.isChannelRewardEnabled = True
def do_ChannelReward(self, source = AbstractChannelRewards.ChannelRewardsSource.default, user = "User", rewardName = "", rewardPrompt = "", userInput = "", bonusData = None):
#print("sending:",user, 16, "!lights hydration")
self.dothething(user, 16, "!lights hydration", "")
return None
@ -28,7 +30,7 @@ class ChannelReward_Hydration_v2(AbstractChannelRewards, metaclass=ABCMeta):
url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params
resp = requests.get(url)
if resp.status_code == 200:
praxis_logger_obj.log("Got the following message: %s" % resp.text)
print("Got the following message: %s" % resp.text)
data = loads(resp.text)
msg = data['message']
if msg is not None:

View File

@ -1,10 +1,6 @@
import config
import utilities_script as utilities
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__))
class Chyron_Module():
def __init__(self):
@ -81,7 +77,7 @@ class Chyron_Module():
file = open(real_file_path, "rb")
text = file.read()
#praxis_logger_obj.log(text)
#print(text)
file.close
return text
@ -98,7 +94,7 @@ class ChyronItem():
self.itemComputedString = ""
def setupItem(self, name, title, content):
praxis_logger_obj.log("\nSetting up Item {", name,"}[", title, content, "]")
print("\nSetting up Item {", name,"}[", title, content, "]")
self.itemName = name
self.itemTitle = title
self.itemContent = content
@ -118,6 +114,6 @@ if __name__ == "__main__":
testModule.chyron_stringUpdater()
test = testModule.chyron_computedString + "<<<|"
praxis_logger_obj.log(test)
print(test)
testModule.updateChyronFile()

View File

@ -1,10 +1,9 @@
from abc import ABCMeta
import lights_module
from commands.command_base import AbstractCommand
from json import loads
from urllib.parse import urlencode
import requests
import utilities_script as utility
class Command_lights_v2(AbstractCommand, metaclass=ABCMeta):
"""
@ -19,27 +18,58 @@ class Command_lights_v2(AbstractCommand, metaclass=ABCMeta):
self.isCommandEnabled = True
def do_command(self, source = AbstractCommand.CommandSource.default, user = "User", command = "", rest = "", bonusData = None):
returnString = self.dothething(user, 16, command, rest)
praxis_logger_obj.log(returnString)
returnString = ""
return None
tempBool = True
if tempBool == True:
LightModule = lights_module.Lights_Module()
LightModule.main()
#bot.return_message("\nRGB Command Detected!")
tempFix = command + " " + rest
def dothething(self, username, light_group, command, rest):
# todo need to url-escape command and rest
params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest})
#standalone_lights
url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params
resp = requests.get(url)
if resp.status_code == 200:
praxis_logger_obj.log("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
tempParsedMessage = tempFix.split(" ")
sceneCommand = False
if (len(tempParsedMessage)) > 2:
#bot.return_message("RGB Command!")
rgb_r = float(tempParsedMessage[1])
rgb_g = float(tempParsedMessage[2])
rgb_b = float(tempParsedMessage[3])
xy_result = LightModule.rgb_to_xy(rgb_r, rgb_g, rgb_b)
#bot.return_message("got XY")
LightModule.bridge_.set_group(16, "xy", xy_result)
#bot.return_message("sent color to [Lights_Module]")
else:
if "stream" in tempParsedMessage:
sceneCommand = True
LightModule.bridge_.run_scene("Downstairs", "Stream")
elif "normal" in tempParsedMessage:
sceneCommand = True
LightModule.bridge_.run_scene("Downstairs", "Bright")
elif "haxor" in tempParsedMessage:
sceneCommand = True
LightModule.bridge_.run_scene("Downstairs", "hacker vibes")
elif "off" in tempParsedMessage:
sceneCommand = True
LightModule.bridge_.set_group("Downstairs", "on", False)
elif "on" in tempParsedMessage:
sceneCommand = True
LightModule.bridge_.set_group("Downstairs", "on", True)
elif "ravemode" in tempParsedMessage:
sceneCommand = True
LightModule.raveMode()
else:
#bot.return_message("Color Command!")
xy_result = LightModule.color_string_parser(tempParsedMessage)
#bot.return_message("got XY")
LightModule.bridge_.set_group(16, "xy", xy_result)
#bot.return_message("sent color to [Lights_Module]")
#if sceneCommand == True:
#bot.return_message("Scene Command!")
returnString = user + " changed the light's color!"
return returnString
def get_help(self):
return self.help

View File

@ -47,7 +47,7 @@ class Command_roll_v2(AbstractCommand, metaclass=ABCMeta):
loopBool = False
if roll_type == 1:
praxis_logger_obj.log("-rolling...")
print("-rolling...")
# If roll is in xdx+x format
if loopBool == True:
rolls: list = []
@ -78,7 +78,7 @@ class Command_roll_v2(AbstractCommand, metaclass=ABCMeta):
if roll_type == 2:
praxis_logger_obj.log("-fate Rolling....")
print("-fate Rolling....")
# !roll 4df
# If roll is in xdx+x format
if loopBool == True:

View File

@ -18,7 +18,7 @@ class Command_test_v2(AbstractCommand, metaclass=ABCMeta):
def do_command(self, source = AbstractCommand.CommandSource.default, user = "User", command = "", rest = "", bonusData = None):
returnString = user + " sent: [ " + command + " ] with: " + rest
#praxis_logger_obj.log(returnString)
#print(returnString)
return returnString
def get_help(self):

View File

@ -1,13 +1,7 @@
import importlib
import importlib.util
import inspect
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__))
import sys
from typing import Dict
@ -16,7 +10,7 @@ from commands.command_base import AbstractCommand
#New
def load_commands(commandType: AbstractCommand.CommandType) -> Dict[str, AbstractCommand]:
praxis_logger_obj.log(" -Loading ", commandType ," Commands...\n")
print(" -Loading ", commandType ," Commands...\n")
commands = compile_and_load(commandType)
return commands
@ -32,10 +26,10 @@ def compile_and_load_file(path: str, commandType: AbstractCommand.CommandType):
if inspect.isclass(obj) and name.startswith("Command"):
command_inst = obj()
if commandType == command_inst.get_commandType():
praxis_logger_obj.log(" ---Successfully loaded %s: %s" % (commandType, command_inst.get_command()))
print(" ---Successfully loaded %s: %s" % (commandType, command_inst.get_command()))
return command_inst.get_command(), command_inst
elif commandType != command_inst.get_commandType():
praxis_logger_obj.log(" -%s CommandType did not match: %s for: %s" % (command_inst.get_commandType(), commandType, command_inst.get_command()))
print(" -%s CommandType did not match: %s for: %s" % (command_inst.get_commandType(), commandType, command_inst.get_command()))
return "", None
@ -46,7 +40,7 @@ def compile_and_load(commandType: AbstractCommand.CommandType) -> Dict[str, Abst
for dirName, subdirList, fileList in os.walk(implementations):
for file in fileList:
name = os.path.join(dirName, file)
praxis_logger_obj.log("compiling: %s" % name)
print("compiling: %s" % name)
name, command = compile_and_load_file(name, commandType)
if command is not None and command.command_type is commandType:
dic[name] = command
@ -62,7 +56,7 @@ def get_base_dir() -> str:
elif current == 'Praxis_Bot' or current == 'Praxis':
return check_dir(os.path.join(cwd, "commands"))
else:
praxis_logger_obj.log("could not find working directory for Praxis_Bot/commands")
print("could not find working directory for Praxis_Bot/commands")
raise Exception

View File

@ -7,12 +7,6 @@ from datetime import timedelta
import time
from time import sleep
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__))
class Cooldown_Action:
def __init__(self):
self.tag:str = ""
@ -87,41 +81,41 @@ if __name__ == "__main__":
cdName = "test"
testCD.setupCooldown(cdName, 20, 2)
praxis_logger_obj.log("CD Test 0: ")
print("CD Test 0: ")
for x in range(20):
testCD.actionTrigger("cdName")
sleep(0)
praxis_logger_obj.log(testCD.isCooldownActive("cdName"))
praxis_logger_obj.log("//Test Done//")
print(testCD.isCooldownActive("cdName"))
print("//Test Done//")
sleep(2)
praxis_logger_obj.log("CD Test 1: ")
print("CD Test 1: ")
for x in range(20):
testCD.actionTrigger(cdName)
sleep(0)
praxis_logger_obj.log(testCD.isCooldownActive("test"))
praxis_logger_obj.log("//Test Done//")
print(testCD.isCooldownActive("test"))
print("//Test Done//")
sleep(2)
praxis_logger_obj.log("CD Test 2: ")
print("CD Test 2: ")
for x in range(10):
testCD.actionTrigger(cdName)
sleep(0)
praxis_logger_obj.log(testCD.isCooldownActive(cdName))
praxis_logger_obj.log("//Test Done//")
print(testCD.isCooldownActive(cdName))
print("//Test Done//")
sleep(2)
praxis_logger_obj.log("CD Test 3: ")
print("CD Test 3: ")
for x in range(20):
testCD.actionTrigger(cdName)
sleep(0.05)
praxis_logger_obj.log(testCD.isCooldownActive(cdName))
praxis_logger_obj.log("//Test Done//")
print(testCD.isCooldownActive(cdName))
print("//Test Done//")
sleep(2)
praxis_logger_obj.log("CD Test 4: ")
print("CD Test 4: ")
for x in range(20):
testCD.actionTrigger(cdName)
sleep(0.6)
praxis_logger_obj.log(testCD.isCooldownActive(cdName))
praxis_logger_obj.log("//Test Done//")
print(testCD.isCooldownActive(cdName))
print("//Test Done//")

View File

@ -1,11 +1,7 @@
import json
import os
from enum import Enum
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__))
class Credential(Enum):
Twitch_Credential = 1
@ -63,7 +59,7 @@ class Credentials_Module():
self.DB_Credentials_List: list = []
def load_credentials(self):
praxis_logger_obj.log("Loading credentials...")
print("Loading credentials...")
fileList = self.list_credential_files()
for file in fileList:
if file.lower().find("twitch") != -1:
@ -115,33 +111,33 @@ class Credentials_Module():
return tobj
def find_Credential(self, credentialType, searchParam: str):
praxis_logger_obj.log("Searching for credential named: " + searchParam)
print("Searching for credential named: " + searchParam)
if credentialType.__name__ == Twitch_Credential.__name__:
praxis_logger_obj.log(".\{Twitch Credential Detected}")
print(".\{Twitch Credential Detected}")
credential_search_function = self.credentialSearchFunctions.get(Credential.Twitch_Credential)
output = credential_search_function(self, searchParam)
return output
elif credentialType.__name__ == Discord_Credential.__name__:
praxis_logger_obj.log(".\{Discord Credential Detected}")
print(".\{Discord Credential Detected}")
credential_search_function = self.credentialSearchFunctions.get(Credential.Twitch_Credential)
output = credential_search_function(self, searchParam)
return output
elif credentialType.__name__ == DB_Credential.__name__:
praxis_logger_obj.log(".\{DB Credential Detected}")
print(".\{DB Credential Detected}")
credential_search_function = self.credentialSearchFunctions.get(Credential.DB_Credential)
output = credential_search_function(self, searchParam)
return output
else:
praxis_logger_obj.log(".\{Something else Detected}")
print(".\{Something else Detected}")
return None
def find_Twitch_Credential(self, searchParam: str):
praxis_logger_obj.log("Searching for Twitch Credential named: " + searchParam)
print("Searching for Twitch Credential named: " + searchParam)
foundSomething = False
tempCert: Twitch_Credential = None
for cert in self.Twitch_Credentials_List:
if cert.username == searchParam:
praxis_logger_obj.log("Twitch Credential Found: {" + cert.username + "}")
print("Twitch Credential Found: {" + cert.username + "}")
tempCert = cert
foundSomething = True
if foundSomething:
@ -150,12 +146,12 @@ class Credentials_Module():
return None
def find_Discord_Credential(self, searchParam: str):
praxis_logger_obj.log("Searching for Discord Credential named: " + searchParam)
print("Searching for Discord Credential named: " + searchParam)
foundSomething = False
tempCert: Discord_Credential = None
for cert in self.Discord_Credentials_List:
if cert.nickname == searchParam:
praxis_logger_obj.log("Discord Credential Found: {" + cert.nickname + "}")
print("Discord Credential Found: {" + cert.nickname + "}")
tempCert = cert
foundSomething = True
if foundSomething:
@ -164,12 +160,12 @@ class Credentials_Module():
return None
def find_DB_Credential(self, searchParam: str):
praxis_logger_obj.log("Searching for DB Credential named: " + searchParam)
print("Searching for DB Credential named: " + searchParam)
foundSomething = False
tempCert: DB_Credential = None
for cert in self.DB_Credentials_List:
if cert.nickname == searchParam:
praxis_logger_obj.log("DB Credential Found: {" + cert.nickname + "}")
print("DB Credential Found: {" + cert.nickname + "}")
tempCert = cert
foundSomething = True
if foundSomething:

4
db.py
View File

@ -24,7 +24,7 @@ class db_module():
if createEngine:
self.engine = create_engine(credential.engine_url)
self.currentWorkingDB = credential.databaseName
praxis_logger_obj.log("SQL Engine Created")
print("SQL Engine Created")
def create_table(self, tableName: str = ""):
pass
@ -45,7 +45,7 @@ class db_module():
# temp = df.query(stmt)
# result = temp.get("response")
#
# # praxis_logger_obj.log(result)
# # print(result)
# i = len(temp.index.values)
#
# if i == 1:

View File

@ -2,31 +2,43 @@ version: '3.7'
services:
standalone_command:
image: standalone_command
volumes:
- c:/praxis/logs
ports:
- 6009:6009
environment:
- ISDOCKER=cat
standalone_channelrewards:
image: standalone_channelrewards
volumes:
- c:/praxis/logs
ports:
- 6969:6969
environment:
- ISDOCKER=cat
standalone_lights:
image: standalone_lights
volumes:
- c:/praxis/logs
ports:
- 42069:42069
environment:
- ISDOCKER=cat
standalone_twitchscript:
image: standalone_twitchscript
volumes:
- c:/praxis/logs
environment:
- ISDOCKER=cat
standalone_twitch_pubsub:
image: standalone_twitch_pubsub
volumes:
- c:/praxis/logs
environment:
- ISDOCKER=cat
standalone_discordscript:
image: standalone_discordscript
volumes:
- c:/praxis/logs
environment:
- ISDOCKER=cat

View File

@ -7,19 +7,13 @@ import commands.loader as command_loader
import credentials
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__))
class Help_Module():
def __init__(self):
super().__init__()
#self.dbCredential: credentials.DB_Credential
def main(self):
praxis_logger_obj.log("[Help Module]> help test")
print("[Help Module]> help test")
self.isCommandEnabled = True
def help_command_response(self, command:AbstractCommand, responseType):

View File

@ -8,19 +8,13 @@ import utilities_script as utilities
import credentials
import config
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__))
class Lights_Module():
def __init__(self):
super().__init__()
self.bridge_:Bridge = Bridge('192.168.191.146')
def main(self):
praxis_logger_obj.log("\nStarting up [Lights_Module]...")
print("\nStarting up [Lights_Module]...")
self.bridge_.connect()
self.bridge_.get_api()
@ -30,26 +24,26 @@ class Lights_Module():
groups = self.bridge_.get_group()
groupCount = 0
#praxis_logger_obj.log("\n -Listing Lights...")
#print("\n -Listing Lights...")
for l in light_list:
pass
#praxis_logger_obj.log(l.name)
#praxis_logger_obj.log("\n -Counting Groups...")
#print(l.name)
#print("\n -Counting Groups...")
for g in groups:
#praxis_logger_obj.log(g)
#print(g)
groupCount = int(g)
for gc in range(groupCount):
try:
#praxis_logger_obj.log("group n:" + str(gc))
#print("group n:" + str(gc))
group = self.bridge_.get_group(gc ,'name')
#praxis_logger_obj.log(group)
#print(group)
group_list.append(group)
#praxis_logger_obj.log(" --done adding")
#print(" --done adding")
except:
pass
#praxis_logger_obj.log(" --adding failed")
#print(" --adding failed")
#self.bridge_.set_group(18, "bri", 254) #This is max Brightness
#self.bridge_.set_group(18, "on", True) #This is will turn ON
@ -66,12 +60,12 @@ class Lights_Module():
#sleep(0.1)
#for stuffz in self.bridge_.scenes:
#praxis_logger_obj.log(stuffz)
#print(stuffz)
# This will set the group Downstairs to the Stream scene
#self.bridge_.run_scene("Downstairs", "Stream")
praxis_logger_obj.log("-[Lights_Module] Setup Complete")
print("-[Lights_Module] Setup Complete")
def setLight():
pass
@ -124,22 +118,22 @@ class Lights_Module():
def color_string_parser(self, message):
maxDigits = config.colorParse_maxDigits
praxis_logger_obj.log("Searching for color...")
print("Searching for color...")
xy_color = [0, 0]
for text in message:
#praxis_logger_obj.log("testing word")
#print("testing word")
if "red" in text.lower():
xy_color = self.rgb_to_xy(1,0,0)
praxis_logger_obj.log("-found: red")
print("-found: red")
if "blue" in text.lower():
praxis_logger_obj.log("-found: blue")
print("-found: blue")
xy_color = self.rgb_to_xy(0,0,1)
if "green" in text.lower():
praxis_logger_obj.log("-found: green")
print("-found: green")
xy_color = self.rgb_to_xy(0,1,0)
if "yellow" in text.lower():
praxis_logger_obj.log("-found: yellow")
print("-found: yellow")
xy_color = self.rgb_to_xy(
0.7,
0.64,
@ -147,23 +141,23 @@ class Lights_Module():
if "cyan" in text.lower():
praxis_logger_obj.log("-found: cyan")
print("-found: cyan")
xy_color = self.rgb_to_xy(0,1,1)
if "aquamarine" in text.lower():
praxis_logger_obj.log("-found: aquamarine")
print("-found: aquamarine")
xy_color = self.rgb_to_xy(
round(utilities.rescale_value(111,0,254),maxDigits),
round(utilities.rescale_value(218,0,254),maxDigits),
round(utilities.rescale_value(146,0,254),maxDigits))
if "turquoise" in text.lower():
praxis_logger_obj.log("-found: turquoise")
print("-found: turquoise")
xy_color = self.rgb_to_xy(
round(utilities.rescale_value(172,0,254),maxDigits),
round(utilities.rescale_value(233,0,254),maxDigits),
round(utilities.rescale_value(232,0,254),maxDigits))
if "orange" in text.lower():
praxis_logger_obj.log("-found: orange")
print("-found: orange")
xy_color = self.rgb_to_xy(
1,
round(utilities.rescale_value(126,0,254),maxDigits),
@ -171,21 +165,21 @@ class Lights_Module():
if "magenta" in text.lower():
praxis_logger_obj.log("-found: magenta")
print("-found: magenta")
xy_color = self.rgb_to_xy(
1,
0,
1)
if "purple" in text.lower():
praxis_logger_obj.log("-found: purple")
print("-found: purple")
xy_color = self.rgb_to_xy(
round(utilities.rescale_value(159,0,254),maxDigits),
round(utilities.rescale_value(32,0,254),maxDigits),
round(utilities.rescale_value(239,0,254),maxDigits))
if "violet" in text.lower():
praxis_logger_obj.log("-found: violet")
print("-found: violet")
xy_color = self.rgb_to_xy(
round(utilities.rescale_value(237,0,254),maxDigits),
round(utilities.rescale_value(129,0,254),maxDigits),

View File

@ -0,0 +1,12 @@
INFO:root:Application running!
INFO:root:
-Starting Logs: standalone_channelrewards.py
INFO:root:init stuff
INFO:werkzeug: * Restarting with stat
INFO:root:Application running!
INFO:root:
-Starting Logs: standalone_channelrewards.py
INFO:root:init stuff
WARNING:werkzeug: * Debugger is active!
INFO:werkzeug: * Debugger PIN: 760-498-562
INFO:werkzeug: * Running on http://0.0.0.0:6969/ (Press CTRL+C to quit)

View File

@ -1,16 +0,0 @@
INFO:root:Application running!
INFO:root:testLog
INFO:werkzeug: * Restarting with stat
INFO:root:Application running!
INFO:root:testLog
WARNING:werkzeug: * Debugger is active!
INFO:werkzeug: * Debugger PIN: 760-498-562
INFO:werkzeug: * Running on http://0.0.0.0:6009/ (Press CTRL+C to quit)
INFO:root:Application running!
INFO:root:testLog
INFO:werkzeug: * Restarting with stat
INFO:root:Application running!
INFO:root:testLog
WARNING:werkzeug: * Debugger is active!
INFO:werkzeug: * Debugger PIN: 760-498-562
INFO:werkzeug: * Running on http://0.0.0.0:6009/ (Press CTRL+C to quit)

16
main.py
View File

@ -15,12 +15,6 @@ import credentials
import threading
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__))
testModule_: test_module.Test_Module
userModule_: user_module.User_Module
@ -31,18 +25,18 @@ def main(inputArg):
def test_module_init(dbCert, Empty):
praxis_logger_obj.log("-init [TEST Module]")
print("-init [TEST Module]")
#testModule_.dbCredential = dbCert
testModule_.main()
def user_module_init(dbCert, Empty):
praxis_logger_obj.log("-init [USER Module]")
print("-init [USER Module]")
userModule_.dbCredential = dbCert
userModule_.main()
def thread_main():
if utility.isRunningInDocker() == True:
praxis_logger_obj.log("<[DOCKER Detected]>")
print("<[DOCKER Detected]>")
if not config.skip_splashScreen:
utility.splashScreen()
global credentials_manager
@ -72,11 +66,11 @@ def thread_main():
threads.append(thread_)
thread_.start()
praxis_logger_obj.log("---Post Thread Creation Test---\n")
print("---Post Thread Creation Test---\n")
for t in threads:
t.join()
praxis_logger_obj.log("---Point of no return---")
print("---Point of no return---")
if utility.isRunningInDocker() == False:
input()

View File

@ -10,4 +10,5 @@ class praxis_logger():
logging.info('Application running!')
def log(self, msg):
print(self.logName, msg)
logging.info(msg)

View File

@ -4,12 +4,6 @@ from flask import request
import commands.loader as command_loader
from commands.command_base import AbstractCommand
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__)
# enable/disable this to get web pages of crashes returned
api.config["DEBUG"] = True
@ -27,9 +21,9 @@ def load_commands():
def is_command(command: str) -> bool:
#praxis_logger_obj.log(command)
#print(command)
for cmd in loadedCommands:
#praxis_logger_obj.log(cmd)
#print(cmd)
if command == cmd:
return True
@ -41,7 +35,7 @@ def is_command(command: str) -> bool:
def handle_command(source, username, command, rest, bonusData):
if command == "!echo":
message = "Got payload [%s]" % rest
#praxis_logger_obj.log(message)
#print(message)
return flask.make_response("{\"message\":\"%s\"}" % message, 200, {"Content-Type": "application/json"})
cmd:AbstractCommand = loadedCommands[command]
@ -49,7 +43,7 @@ def handle_command(source, username, command, rest, bonusData):
cmd_response = cmd.do_command(source, username, command, rest, bonusData)
return flask.make_response("{\"message\":\"%s\"}" % cmd_response, 200, {"Content-Type": "application/json"})
#praxis_logger_obj.log("Doing a command")
#print("Doing a command")
@api.route('/api/v1/command', methods=['GET'])

View File

@ -25,12 +25,6 @@ import discord.abc
from cooldowns import Cooldown_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__))
class Discord_Module(discord.Client):
def __init__(self):
super().__init__()
@ -50,17 +44,17 @@ class Discord_Module(discord.Client):
await self.start(self.discordCredential.token)
def main(self):
praxis_logger_obj.log("starting loop")
print("starting loop")
self.loop.create_task(self.startup())
self.loop.run_forever()
async def on_ready(self):
praxis_logger_obj.log('Logged on as', self.user)
print('Logged on as', self.user)
async def on_message(self, message: discord.Message):
praxis_logger_obj.log("{" + message.guild.name + "}[ " + str(message.channel) + " ](" + message.author.display_name + ")> ")
#praxis_logger_obj.log(message.author.mention)
praxis_logger_obj.log(message.content)
print("{" + message.guild.name + "}[ " + str(message.channel) + " ](" + message.author.display_name + ")> ")
#print(message.author.mention)
print(message.content)
if not await self.isSenderBot(message):
# This will check for the praxis_bot-tts channel and will TTS stuff from there.
@ -88,7 +82,7 @@ class Discord_Module(discord.Client):
if self.cooldownModule.isCooldownActive("discordRateLimit") == False:
await self.exec_command(message, command, rest)
except:
praxis_logger_obj.log("something went wrong with a command")
print("something went wrong with a command")
async def is_command(self, word: str) -> bool:
# todo need to url-escape word
@ -103,7 +97,7 @@ class Discord_Module(discord.Client):
url = "http://standalone_command:6009/api/v1/exec_command?%s" % params
resp = requests.get(url)
if resp.status_code == 200:
praxis_logger_obj.log("Got the following message: %s" % resp.text)
print("Got the following message: %s" % resp.text)
data = loads(resp.text)
msg = data['message']
if msg is not None:
@ -127,15 +121,15 @@ class Discord_Module(discord.Client):
for bot in config.botList:
if message.author.display_name.lower() == bot.lower():
isBot = True
praxis_logger_obj.log("<{ bot detected! }> ")
print("<{ bot detected! }> ")
return isBot
async def isChannel_inConfigList(self, selectedChannel, selectedList):
#praxis_logger_obj.log(channel)
#praxis_logger_obj.log(selectedList)
#print(channel)
#print(selectedList)
is_Self = False
for discordChannel in selectedList:
#praxis_logger_obj.log("isSelf: " + str(discordChannel) + " vs " + str(selectedChannel))
#print("isSelf: " + str(discordChannel) + " vs " + str(selectedChannel))
if discordChannel == selectedChannel:
is_Self = True

View File

@ -11,12 +11,6 @@ import config
import flask
from flask import request
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__)
# enable/disable this to get web pages of crashes returned
api.config["DEBUG"] = True
@ -28,7 +22,7 @@ class Lights_Module():
self.bridge_:Bridge = Bridge('192.168.191.146')
def main(self):
praxis_logger_obj.log("\nStarting up [Lights_Module]...")
print("\nStarting up [Lights_Module]...")
self.bridge_.connect()
self.bridge_.get_api()
@ -38,26 +32,26 @@ class Lights_Module():
groups = self.bridge_.get_group()
groupCount = 0
#praxis_logger_obj.log("\n -Listing Lights...")
#print("\n -Listing Lights...")
for l in light_list:
pass
#praxis_logger_obj.log(l.name)
#praxis_logger_obj.log("\n -Counting Groups...")
#print(l.name)
#print("\n -Counting Groups...")
for g in groups:
#praxis_logger_obj.log(g)
#print(g)
groupCount = int(g)
for gc in range(groupCount):
try:
#praxis_logger_obj.log("group n:" + str(gc))
#print("group n:" + str(gc))
group = self.bridge_.get_group(gc ,'name')
#praxis_logger_obj.log(group)
#print(group)
group_list.append(group)
#praxis_logger_obj.log(" --done adding")
#print(" --done adding")
except:
pass
#praxis_logger_obj.log(" --adding failed")
#print(" --adding failed")
#self.bridge_.set_group(18, "bri", 254) #This is max Brightness
#self.bridge_.set_group(18, "on", True) #This is will turn ON
@ -74,13 +68,13 @@ class Lights_Module():
#sleep(0.1)
#for stuffz in self.bridge_.scenes:
#praxis_logger_obj.log(stuffz)
#print(stuffz)
# This will set the group Downstairs to the Stream scene
#self.bridge_.run_scene("Downstairs", "Stream")
#self.bridge_.run_scene("Downstairs", "Stream")
praxis_logger_obj.log("-[Lights_Module] Setup Complete")
self.bridge_.run_scene("Downstairs", "Stream")
print("-[Lights_Module] Setup Complete")
def setLight():
pass
@ -138,22 +132,22 @@ class Lights_Module():
def color_string_parser(self, message):
maxDigits = config.colorParse_maxDigits
praxis_logger_obj.log("Searching for color...")
print("Searching for color...")
xy_color = [0, 0]
for text in message:
#praxis_logger_obj.log("testing word")
#print("testing word")
if "red" in text.lower():
xy_color = self.rgb_to_xy(1,0,0)
praxis_logger_obj.log("-found: red")
print("-found: red")
if "blue" in text.lower():
praxis_logger_obj.log("-found: blue")
print("-found: blue")
xy_color = self.rgb_to_xy(0,0,1)
if "green" in text.lower():
praxis_logger_obj.log("-found: green")
print("-found: green")
xy_color = self.rgb_to_xy(0,1,0)
if "yellow" in text.lower():
praxis_logger_obj.log("-found: yellow")
print("-found: yellow")
xy_color = self.rgb_to_xy(
0.7,
0.64,
@ -161,23 +155,23 @@ class Lights_Module():
if "cyan" in text.lower():
praxis_logger_obj.log("-found: cyan")
print("-found: cyan")
xy_color = self.rgb_to_xy(0,1,1)
if "aquamarine" in text.lower():
praxis_logger_obj.log("-found: aquamarine")
print("-found: aquamarine")
xy_color = self.rgb_to_xy(
round(utilities.rescale_value(111,0,254),maxDigits),
round(utilities.rescale_value(218,0,254),maxDigits),
round(utilities.rescale_value(146,0,254),maxDigits))
if "turquoise" in text.lower():
praxis_logger_obj.log("-found: turquoise")
print("-found: turquoise")
xy_color = self.rgb_to_xy(
round(utilities.rescale_value(172,0,254),maxDigits),
round(utilities.rescale_value(233,0,254),maxDigits),
round(utilities.rescale_value(232,0,254),maxDigits))
if "orange" in text.lower():
praxis_logger_obj.log("-found: orange")
print("-found: orange")
xy_color = self.rgb_to_xy(
1,
round(utilities.rescale_value(126,0,254),maxDigits),
@ -185,21 +179,21 @@ class Lights_Module():
if "magenta" in text.lower():
praxis_logger_obj.log("-found: magenta")
print("-found: magenta")
xy_color = self.rgb_to_xy(
1,
0,
1)
if "purple" in text.lower():
praxis_logger_obj.log("-found: purple")
print("-found: purple")
xy_color = self.rgb_to_xy(
round(utilities.rescale_value(159,0,254),maxDigits),
round(utilities.rescale_value(32,0,254),maxDigits),
round(utilities.rescale_value(239,0,254),maxDigits))
if "violet" in text.lower():
praxis_logger_obj.log("-found: violet")
print("-found: violet")
xy_color = self.rgb_to_xy(
round(utilities.rescale_value(237,0,254),maxDigits),
round(utilities.rescale_value(129,0,254),maxDigits),
@ -214,8 +208,8 @@ def init():
RGB_Lights.main()
def do_lights_command(user="", lightGroup="all", command = "", rest = ""):
returnString = ""
praxis_logger_obj.log("about to do something ......")
returnString = "None"
print("about to do something ......")
#bot.return_message("\nRGB Command Detected!")
if rest is not "":
@ -227,12 +221,12 @@ def do_lights_command(user="", lightGroup="all", command = "", rest = ""):
tempParsedMessage = tempFix.split(" ")
sceneCommand = False
if (len(tempParsedMessage)) > 2:
praxis_logger_obj.log("RGB Command!")
print("RGB Command!")
rgb_r = float(tempParsedMessage[1])
rgb_g = float(tempParsedMessage[2])
rgb_b = float(tempParsedMessage[3])
xy_result = RGB_Lights.rgb_to_xy(rgb_r, rgb_g, rgb_b)
praxis_logger_obj.log("got XY")
print("got XY")
RGB_Lights.bridge_.set_group(16, "xy", xy_result)
#bot.return_message("sent color to [Lights_Module]")
else:
@ -265,12 +259,11 @@ def do_lights_command(user="", lightGroup="all", command = "", rest = ""):
#bot.return_message("sent color to [Lights_Module]")
if sceneCommand == True:
praxis_logger_obj.log("Scene Command!")
print("Scene Command!")
returnString = user + " changed the lights color!"
praxis_logger_obj.log(returnString)
returnString = user + " changed the light's color!"
return flask.make_response("{\"message\":\"%s\"}" % returnString, 200, {"Content-Type": "application/json"})
return returnString
@ -285,7 +278,7 @@ def exec_lights():
if 'command' not in request.args:
return flask.make_response('{\"text\":"Argument \'scene_name\' not in request"}', 400)
praxis_logger_obj.log("about to do something ......")
print("about to do something ......")
RGB_Lights.main()
return do_lights_command(user_name, request.args['light_group'], request.args['command'], request.args['rest'])

View File

@ -20,12 +20,6 @@ from uuid import UUID
from cooldowns import Cooldown_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__))
class Twitch_Pubsub():
def __init__(self):
super().__init__()
@ -48,14 +42,14 @@ class Twitch_Pubsub():
def get_tokens(self):
self.twitch.authenticate_app(self.target_scope)
for scope_ in self.target_scope:
praxis_logger_obj.log(scope_)
print(scope_)
auth = UserAuthenticator(self.twitch, self.target_scope, force_verify=True)
token, refresh_token = auth.authenticate()
if token is not None: praxis_logger_obj.log("found token")
if refresh_token is not None: praxis_logger_obj.log("found refresh_token")
praxis_logger_obj.log(token)
praxis_logger_obj.log(refresh_token)
if token is not None: print("found token")
if refresh_token is not None: print("found refresh_token")
print(token)
print(refresh_token)
self.twitch.set_user_authentication(token, self.target_scope, refresh_token)
@ -63,12 +57,12 @@ class Twitch_Pubsub():
self.pubsub = PubSub(self.twitch)
#self.pubsub.ping_frequency = 30
self.pubsub.start()
praxis_logger_obj.log("started")
print("started")
def next(self):
user_id = self.twitch.get_users(logins=[config.autoJoin_TwitchChannel])['data'][0]['id']
if user_id is not None: praxis_logger_obj.log("found user_id")
praxis_logger_obj.log(user_id)
if user_id is not None: print("found user_id")
print(user_id)
self.uuid_1 = self.pubsub.listen_whispers(user_id, self.callback_whisper)
self.uuid_2 = self.pubsub.listen_channel_points(user_id, self.callback_channelPoints)
#input('press ENTER to close...')
@ -79,22 +73,22 @@ class Twitch_Pubsub():
self.pubsub.stop()
def callback_whisper(self, uuid: UUID, data: dict) -> None:
praxis_logger_obj.log('got callback for UUID ' + str(uuid))
print('got callback for UUID ' + str(uuid))
pprint(data)
def callback_channelPoints(self, uuid: UUID, data: dict) -> None:
praxis_logger_obj.log("Channel Point Redemption")
praxis_logger_obj.log('got callback for UUID ' + str(uuid))
print("Channel Point Redemption")
print('got callback for UUID ' + str(uuid))
pprint(data)
#praxis_logger_obj.log("attempting to get data: ")
#praxis_logger_obj.log(data['data']['redemption']['user']['display_name'])
#praxis_logger_obj.log(data['data']['redemption']['reward']['title'])
#praxis_logger_obj.log(data['data']['redemption']['reward']['prompt'])
#print("attempting to get data: ")
#print(data['data']['redemption']['user']['display_name'])
#print(data['data']['redemption']['reward']['title'])
#print(data['data']['redemption']['reward']['prompt'])
try:
userinput = data['data']['redemption']['user_input']
except:
userinput = ""
#praxis_logger_obj.log(userinput)
#print(userinput)
self.callback_EXEC(
data['data']['redemption']['user']['display_name'],
data['data']['redemption']['reward']['title'],
@ -104,29 +98,29 @@ class Twitch_Pubsub():
data)
def callback_bits(self, uuid: UUID, data: dict) -> None:
praxis_logger_obj.log("Bits Redemption")
praxis_logger_obj.log('got callback for UUID ' + str(uuid))
print("Bits Redemption")
print('got callback for UUID ' + str(uuid))
pprint(data)
def callback_subs(self, uuid: UUID, data: dict) -> None:
praxis_logger_obj.log("Subs Redemption")
praxis_logger_obj.log('got callback for UUID ' + str(uuid))
print("Subs Redemption")
print('got callback for UUID ' + str(uuid))
pprint(data)
def callback_EXEC(self, sender, rewardName:str, rewardType, rewardPrompt, userInput, raw_data):
try:
is_actionable = self.is_reward(rewardName, rewardType)
if is_actionable:
praxis_logger_obj.log("Trying to do the thing")
print("Trying to do the thing")
if self.cooldownModule.isCooldownActive("twitchChat") == False:
self.exec_reward(sender, rewardName, rewardType, rewardPrompt, userInput, raw_data)
except:
praxis_logger_obj.log("something went wrong with a reward")
print("something went wrong with a reward")
def is_reward(self, rewardName, rewardType):
# todo need to url-escape word
clean_param = urlencode({'reward_name': rewardName, 'reward_type':rewardType})
praxis_logger_obj.log(rewardName, rewardType)
print(rewardName, rewardType)
#standalone_channelrewards
url = "http://standalone_channelrewards:6969/api/v1/reward?%s" % clean_param
resp = requests.get(url)
@ -146,7 +140,7 @@ class Twitch_Pubsub():
url = "http://standalone_channelrewards:6969/api/v1/exec_reward?%s" % params
resp = requests.get(url)
if resp.status_code == 200:
praxis_logger_obj.log("Got the following message: %s" % resp.text)
print("Got the following message: %s" % resp.text)
data = loads(resp.text)
msg = data['message']
if msg is not None:

View File

@ -12,12 +12,6 @@ from cooldowns import Cooldown_Module
import commands.command_base
import utilities_script as utility
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__))
class Twitch_Module():
def __init__(self):
super().__init__()
@ -39,7 +33,7 @@ class Twitch_Module():
def join_channel(self, credential: credentials.Twitch_Credential, channel_name: str):
channel_name = "#" + channel_name
praxis_logger_obj.log("Connecting to Channel: " + channel_name + "...")
print("Connecting to Channel: " + channel_name + "...")
if credential is None:
credential = self.twitchCredential
@ -53,23 +47,23 @@ class Twitch_Module():
)
self.chat.subscribe(self.twitch_chat)
praxis_logger_obj.log("Connected to Channel: ", channel_name)
print("Connected to Channel: ", channel_name)
def leave_channel(self):
praxis_logger_obj.log("Leaving Channel", self.chat.channel)
print("Leaving Channel", self.chat.channel)
self.chat.irc.leave_channel(self.chat.channel)
self.chat.irc.socket.close()
def send_message(self, message):
isBlocked = self.isChannel_inConfigList(self.chat.channel, config.block_TwitchChannelsMessaging)
# praxis_logger_obj.log("isBlocked: " + str(isBlocked) + " for: " + self.chat.channel)
# print("isBlocked: " + str(isBlocked) + " for: " + self.chat.channel)
#if self.
if utility.contains_slur(message): isBlocked = True
if self.cooldownModule.isCooldownActive(
"twitchChat") == False and not isBlocked and not config.blockAll_TwitchChatChannelsMessaging:
self.chat.send(message)
# praxis_logger_obj.log("Sent ChatMSG")
# print("Sent ChatMSG")
self.cooldownModule.actionTrigger("twitchChat")
def is_command(self, word: str) -> bool:
@ -85,7 +79,7 @@ class Twitch_Module():
url = "http://standalone_command:6009/api/v1/exec_command?%s" % params
resp = requests.get(url)
if resp.status_code == 200:
praxis_logger_obj.log("Got the following message: %s" % resp.text)
print("Got the following message: %s" % resp.text)
data = loads(resp.text)
msg = data['message']
if msg is not None:
@ -99,7 +93,7 @@ class Twitch_Module():
# This reacts to messages
def twitch_chat(self, message: twitch.chat.Message) -> None:
praxis_logger_obj.log("[#" + message.channel + "](" + message.sender + ")> " + message.text)
print("[#" + message.channel + "](" + message.sender + ")> " + message.text)
command, rest = utility.parse_line(message.text)
try:
@ -108,19 +102,19 @@ class Twitch_Module():
if self.cooldownModule.isCooldownActive("twitchChat") == False:
self.exec_command(message ,command, rest)
except:
praxis_logger_obj.log("something went wrong with a command")
print("something went wrong with a command")
def isChannel_inConfigList(self, selectedChannel, selectedList):
# praxis_logger_obj.log(channel)
# praxis_logger_obj.log(selectedList)
# print(channel)
# print(selectedList)
is_Self = False
for twitchChannel in selectedList:
if twitchChannel == selectedChannel:
is_Self = True
# if is_Self:
# praxis_logger_obj.log("Is Self")
# print("Is Self")
# if not is_Self:
# praxis_logger_obj.log("Is Not Self")
# print("Is Not Self")
return is_Self

View File

@ -20,12 +20,6 @@ import utilities_script as utility
import chyron_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__))
class webSource_Module():
webSources:Flask = Flask('webSources')
@ -34,7 +28,7 @@ class webSource_Module():
self.dbCredential: credentials.DB_Credential
def main(self, port_=5000):
praxis_logger_obj.log("starting up on port: ", port_)
print("starting up on port: ", port_)
self.webSources.run(host="0.0.0.0", port= port_)
@webSources.route('/')
@ -48,7 +42,7 @@ class webSource_Module():
@webSources.route('/temptext/<filename>/')
def textSource_tempText(filename):
praxis_logger_obj.log("trying file: ", filename)
print("trying file: ", filename)
tempModule = tempText_Module.tempText_Module()
return tempModule.getTempTextFile(filename)

View File

@ -1,11 +1,6 @@
import config
import utilities_script as utilities
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__))
class tempText_Module():
def __init__(self):
@ -62,7 +57,7 @@ class tempText_Module():
file = open(real_file_path, "rb")
text = file.read()
#praxis_logger_obj.log(text)
#print(text)
file.close
return text
@ -79,7 +74,7 @@ class tempTextItem():
self.itemComputedString = ""
def setupItem(self, name, title, content):
praxis_logger_obj.log("\nSetting up tempTextItem {", name,"}[", title, content, "]")
print("\nSetting up tempTextItem {", name,"}[", title, content, "]")
self.itemName = name
self.itemTitle = title
self.itemContent = content

View File

@ -3,19 +3,13 @@ import db
import credentials
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__))
class Test_Module():
def __init__(self):
super().__init__()
self.dbCredential: credentials.DB_Credential
def main(self):
praxis_logger_obj.log("[TEST Module]> test")
print("[TEST Module]> test")
if __name__ == "__main__":

11
tts.py
View File

@ -1,11 +1,6 @@
import datetime
import hashlib
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__))
import requests
from gtts import gTTS
@ -19,9 +14,9 @@ streamLabsUrl = "https://streamlabs.com/polly/speak"
def tts(inputText: str, *args):
outpath = create_speech_file(inputText)
if utility.isRunningInDocker() == True:
praxis_logger_obj.log("Docker Detected, skipping playsound()")
print("Docker Detected, skipping playsound()")
else:
praxis_logger_obj.log("Playing Sound...")
print("Playing Sound...")
playsound(outpath)
@ -113,6 +108,6 @@ def get_tts_dir():
if __name__ == "__main__":
praxis_logger_obj.log("Enter Text: ")
print("Enter Text: ")
textInput = str(input())
tts(textInput)

View File

@ -10,12 +10,6 @@ from twitchAPI.oauth import UserAuthenticator
from pprint import pprint
from uuid import UUID
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__))
class Twitch_Credential_Maker():
def __init__(self):
@ -27,15 +21,15 @@ class Twitch_Credential_Maker():
def get_tokens(self):
self.twitch.authenticate_app(self.target_scope)
for scope_ in self.target_scope:
praxis_logger_obj.log(scope_)
print(scope_)
auth = UserAuthenticator(self.twitch, self.target_scope, force_verify=True)
token, refresh_token = auth.authenticate()
if token is not None: praxis_logger_obj.log("found token")
if refresh_token is not None: praxis_logger_obj.log("found refresh_token\n")
praxis_logger_obj.log("token: ", token)
praxis_logger_obj.log("refresh_token: ", refresh_token)
praxis_logger_obj.log("")
if token is not None: print("found token")
if refresh_token is not None: print("found refresh_token\n")
print("token: ", token)
print("refresh_token: ", refresh_token)
print("")
return token, refresh_token
@ -51,5 +45,5 @@ if __name__ == "__main__":
#pprint(testModule.twitch.get_users(logins=['thecuriousnerd']))
testModule.get_tokens()
praxis_logger_obj.log("Ready to close")
print("Ready to close")
input()

View File

@ -13,12 +13,6 @@ from cooldowns import Cooldown_Module
import utilities_script as utility
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__))
class User_Module():
def __init__(self):
super().__init__()
@ -33,10 +27,10 @@ class User_Module():
def main(self):
time.sleep(.01)
praxis_logger_obj.log("\nWaiting on User input...\n\n")
print("\nWaiting on User input...\n\n")
if utility.isRunningInDocker() == True:
self.inputLoop = False
praxis_logger_obj.log("\nNo User's Input Allowed")
print("\nNo User's Input Allowed")
while self.inputLoop:
keyboardInput = input()
@ -83,7 +77,7 @@ class User_Module():
command.do_command(self, message)
except Exception as e:
# Undo the following for debug stuff
#praxis_logger_obj.log(e)
#print(e)
pass # we don't care
def eval_commands_SpecialActionCheck(self):
@ -94,7 +88,7 @@ class User_Module():
pass
def return_message(self, returnedMessage):
praxis_logger_obj.log(returnedMessage)
print(returnedMessage)
def tts(self, message):
tts.tts(message)

View File

@ -1,4 +1,5 @@
from asyncio.tasks import sleep
import os
import sys
import re
import psutil
@ -8,12 +9,6 @@ import time
import config as config
import art
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__))
clearScreen = lambda: os.system('cls' if os.name == 'nt' else 'clear')
urlMatcher = re.compile("(https?:(/{1,3}|[a-z0-9%])|[a-z0-9.-]+[.](com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|Ja|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw))")
@ -27,7 +22,7 @@ def get_args(text: str) -> list:
def does_contain_OnlyNumbers(text):
isJustNumbers = False
praxis_logger_obj.log("checking numbers")
print("checking numbers")
try:
for x in range(10):
if str(x) in str(text):
@ -40,9 +35,9 @@ def does_contain_OnlyNumbers(text):
return isJustNumbers
def rescale_value(value, min, max):
#praxis_logger_obj.log("trying Rescale")
#print("trying Rescale")
returnValue = (value - min) / (max - min)
#praxis_logger_obj.log("got ", returnValue)
#print("got ", returnValue)
return returnValue
def get_dir(selected_dir):
@ -67,7 +62,7 @@ def contains_slur(input: str):
break
if containsSlur:
praxis_logger_obj.log("<{ slur detected! }> ")
print("<{ slur detected! }> ")
return containsSlur
def parse_line(message: str):
@ -136,9 +131,9 @@ def splashScreen():
art.tprint("----------",font="slant")
art.tprint("Praxis Bot",font="graffiti")
art.tprint("----------",font="slant")
praxis_logger_obj.log("-Maintained by Alex Orid, TheCuriousNerd.com\nFor help visit discord.gg/thecuriousnerd")
praxis_logger_obj.log("ver: " + config.praxisVersion_Alpha + config.praxisVersion_Delta + config.praxisVersion_Omega)
praxis_logger_obj.log("\n\n\n")
print("-Maintained by Alex Orid, TheCuriousNerd.com\nFor help visit discord.gg/thecuriousnerd")
print("ver: " + config.praxisVersion_Alpha + config.praxisVersion_Delta + config.praxisVersion_Omega)
print("\n\n\n")
if not config.skip_splashScreenSleep:
time.sleep(3)