diff --git a/action.py b/action.py index 6f39d6d..758ac01 100644 --- a/action.py +++ b/action.py @@ -26,11 +26,12 @@ def __init__(self, parameters=None, client: Client = None): self.gdb = self.get(parameters, 'gdb') client.markAsDelivered(self.thread_id, self.message_object.uid) client.markAsRead(self.thread_id) - if 'memory' not in self.database: - self.database['memory']: dict = {} - self.memory = self.database['memory'] - if str(self.author_id) not in self.memory: self.memory[str(self.author_id)]: dict = {} - self.memory = self.memory[str(self.author_id)] + if parameters: + if 'memory' not in self.database: + self.database['memory']: dict = {} + self.memory = self.database['memory'] + if str(self.author_id) not in self.memory: self.memory[str(self.author_id)]: dict = {} + self.memory = self.memory[str(self.author_id)] self.define_documentation() def process(self): diff --git a/commands/command.py b/commands/command.py index 4b92cdb..549219e 100644 --- a/commands/command.py +++ b/commands/command.py @@ -8,8 +8,9 @@ class Command(Action): def __init__(self, parameters=None, client: Client = None): Action.__init__(self, parameters, client) self.user_params: list = self.get(parameters, 'user') - if 'commands' not in self.memory: - self.memory['commands'] = {} - self.memory = self.memory['commands'] - if self.trigger not in self.memory: - self.memory[self.trigger] = {} \ No newline at end of file + if parameters: + if 'commands' not in self.memory: + self.memory['commands'] = {} + self.memory = self.memory['commands'] + if self.trigger not in self.memory: + self.memory[self.trigger] = {} \ No newline at end of file diff --git a/commands/help.py b/commands/help.py index 57f2f41..ea903ff 100644 --- a/commands/help.py +++ b/commands/help.py @@ -46,9 +46,11 @@ def run(self): instance = self.get_instance(x) response_text += "\n\n!" + x + ": " + instance.documentation["function"] response_text += "\n\nIf you want to learn more about a specific command, send '!help !COMMAND_NAME'." - except: + except ValueError: # sends detailed information about a specific command c_name = str(self.user_params[0]).replace("!", "", 1) + print(c_name) + print(modules) if c_name in modules: instance = self.get_instance(c_name) response_text += """ diff --git a/keywords/keyword.py b/keywords/keyword.py index eeb62ca..f1c9212 100644 --- a/keywords/keyword.py +++ b/keywords/keyword.py @@ -10,9 +10,10 @@ def __init__(self, parameters=None, client: Client=None): "trigger": "", "function": "" } - if 'keywords' not in self.memory: - self.memory['keywords'] = {} - self.memory = self.memory['keywords'] - if self.trigger not in self.memory: - self.memory[self.trigger] = {} + if parameters: + if 'keywords' not in self.memory: + self.memory['keywords'] = {} + self.memory = self.memory['keywords'] + if self.trigger not in self.memory: + self.memory[self.trigger] = {}