Update user_module.py
This commit is contained in:
parent
4f0d3892a3
commit
5a0fd3c447
@ -1,3 +1,4 @@
|
|||||||
|
from enum import Enum
|
||||||
import config as config
|
import config as config
|
||||||
import db
|
import db
|
||||||
import tts
|
import tts
|
||||||
@ -15,8 +16,12 @@ class User_Module():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.dbCredential: credentials.DB_Credential
|
self.dbCredential: credentials.DB_Credential
|
||||||
self.commands = command_loader.load_commands_new(AbstractCommand.CommandType.Praxis)
|
|
||||||
self.MessageLog:list = []
|
self.MessageLog:list = []
|
||||||
|
self.commands = command_loader.load_commands_new(AbstractCommand.CommandType.Praxis)
|
||||||
|
self.UseFlagTypeMap = { # this is a mapping of the UserFlagTypes enum to function pointers
|
||||||
|
UserFlagTypes.REACTIVE: self.eval_commands_Special_Reactive}
|
||||||
|
|
||||||
|
self.currentUser:User = User()
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
print("\nWaiting on User input...\n")
|
print("\nWaiting on User input...\n")
|
||||||
@ -27,7 +32,7 @@ class User_Module():
|
|||||||
while inputLoop:
|
while inputLoop:
|
||||||
keyboardInput = input()
|
keyboardInput = input()
|
||||||
message = UserMessage()
|
message = UserMessage()
|
||||||
message.makeMessage(message=keyboardInput)
|
message.makeMessage(self.currentUser, keyboardInput)
|
||||||
|
|
||||||
if "exit" in keyboardInput:
|
if "exit" in keyboardInput:
|
||||||
print("Quitting [User Module] Interface...")
|
print("Quitting [User Module] Interface...")
|
||||||
@ -48,7 +53,8 @@ class User_Module():
|
|||||||
return isCommand
|
return isCommand
|
||||||
|
|
||||||
def runCommand(self, message):
|
def runCommand(self, message):
|
||||||
self.eval_commands(message)
|
if not self.eval_commands_SpecialActionCheck():
|
||||||
|
self.eval_commands(message)
|
||||||
|
|
||||||
def eval_commands(self, message):
|
def eval_commands(self, message):
|
||||||
# containsURL: bool = self.contains_url(message)
|
# containsURL: bool = self.contains_url(message)
|
||||||
@ -76,22 +82,46 @@ class User_Module():
|
|||||||
#print(e)
|
#print(e)
|
||||||
pass # we don't care
|
pass # we don't care
|
||||||
|
|
||||||
|
def eval_commands_SpecialActionCheck(self):
|
||||||
|
foundSomething = False
|
||||||
|
return foundSomething
|
||||||
|
|
||||||
|
def eval_commands_Special_Reactive(self):
|
||||||
|
pass
|
||||||
|
|
||||||
def return_message(self, returnedMessage):
|
def return_message(self, returnedMessage):
|
||||||
print(returnedMessage)
|
print(returnedMessage)
|
||||||
|
|
||||||
def tts(self, message):
|
def tts(self, message):
|
||||||
tts.tts(message)
|
tts.tts(message)
|
||||||
|
|
||||||
class UserMessage():
|
class User():
|
||||||
def __init__(self):
|
def __init__(self, username:str = "user"):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.user = "User"
|
self.name = username
|
||||||
self.message = ""
|
self.flags = []
|
||||||
|
|
||||||
|
class UserMessage():
|
||||||
|
def __init__(self, user = "User", message = ""):
|
||||||
|
super().__init__()
|
||||||
|
self.user = user
|
||||||
|
self.message = message
|
||||||
|
|
||||||
def makeMessage(self, user = "User", message = ""):
|
def makeMessage(self, user = "User", message = ""):
|
||||||
self.user = user
|
self.user = user
|
||||||
self.message = message
|
self.message = message
|
||||||
|
|
||||||
|
class UserFlagTypes(Enum):
|
||||||
|
REACTIVE = 1
|
||||||
|
|
||||||
|
class UserFlags():
|
||||||
|
def __init__(self, flagName = "User", flagType:UserFlagTypes = None):
|
||||||
|
super().__init__()
|
||||||
|
self.name = flagName
|
||||||
|
self.flagType:UserFlagTypes = flagType
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
testModule = User_Module()
|
testModule = User_Module()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user