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 db
|
||||
import tts
|
||||
@ -15,8 +16,12 @@ class User_Module():
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.dbCredential: credentials.DB_Credential
|
||||
self.commands = command_loader.load_commands_new(AbstractCommand.CommandType.Praxis)
|
||||
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):
|
||||
print("\nWaiting on User input...\n")
|
||||
@ -27,7 +32,7 @@ class User_Module():
|
||||
while inputLoop:
|
||||
keyboardInput = input()
|
||||
message = UserMessage()
|
||||
message.makeMessage(message=keyboardInput)
|
||||
message.makeMessage(self.currentUser, keyboardInput)
|
||||
|
||||
if "exit" in keyboardInput:
|
||||
print("Quitting [User Module] Interface...")
|
||||
@ -48,6 +53,7 @@ class User_Module():
|
||||
return isCommand
|
||||
|
||||
def runCommand(self, message):
|
||||
if not self.eval_commands_SpecialActionCheck():
|
||||
self.eval_commands(message)
|
||||
|
||||
def eval_commands(self, message):
|
||||
@ -76,22 +82,46 @@ class User_Module():
|
||||
#print(e)
|
||||
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):
|
||||
print(returnedMessage)
|
||||
|
||||
def tts(self, message):
|
||||
tts.tts(message)
|
||||
|
||||
class UserMessage():
|
||||
def __init__(self):
|
||||
class User():
|
||||
def __init__(self, username:str = "user"):
|
||||
super().__init__()
|
||||
self.user = "User"
|
||||
self.message = ""
|
||||
self.name = username
|
||||
self.flags = []
|
||||
|
||||
class UserMessage():
|
||||
def __init__(self, user = "User", message = ""):
|
||||
super().__init__()
|
||||
self.user = user
|
||||
self.message = message
|
||||
|
||||
def makeMessage(self, user = "User", message = ""):
|
||||
self.user = user
|
||||
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__":
|
||||
testModule = User_Module()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user