From 0c21b2ce922a33ae4d22f7ed2695d00b19961ace Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Tue, 24 Jan 2023 10:52:13 -0500 Subject: [PATCH] testt --- sopel_SpiceBot_Core_1/SBCore/commands/__init__.py | 5 ++++- sopel_SpiceBot_Core_1/SBCore/config/__init__.py | 9 +++++++++ sopel_SpiceBot_Core_1/__init__.py | 8 ++++++++ sopel_SpiceBot_Core_Prerun/__init__.py | 3 ++- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/sopel_SpiceBot_Core_1/SBCore/commands/__init__.py b/sopel_SpiceBot_Core_1/SBCore/commands/__init__.py index a318599..28a27e2 100644 --- a/sopel_SpiceBot_Core_1/SBCore/commands/__init__.py +++ b/sopel_SpiceBot_Core_1/SBCore/commands/__init__.py @@ -22,17 +22,20 @@ class Commands(): @property def multi_split_key(self): # TODO config + # return self.config.spiceBot.multi_split_key return "&&" @property def pipe_split_key(self): # TODO config + # return self.config.spiceBot.pipe_split_key return "|" @property def query_command_key(self): # TODO config - return "|" + # return self.config.spiceBot.query_command_key + return "?" @property def valid_sopel_commands(self): diff --git a/sopel_SpiceBot_Core_1/SBCore/config/__init__.py b/sopel_SpiceBot_Core_1/SBCore/config/__init__.py index cb64123..f9e00d2 100644 --- a/sopel_SpiceBot_Core_1/SBCore/config/__init__.py +++ b/sopel_SpiceBot_Core_1/SBCore/config/__init__.py @@ -6,6 +6,8 @@ import os from sopel.cli.run import build_parser, get_configuration +# from sopel.config.types import StaticSection, ValidatedAttribute + class Config(): @@ -43,3 +45,10 @@ class Config(): else: return None + + +# class SpiceBot_Conf(StaticSection): + +# multi_split_key = ValidatedAttribute('multi_split_key', default="&&") +# pipe_split_key = ValidatedAttribute('pipe_split_key', default="|") +# query_command_key = ValidatedAttribute('query_command_key', default="?") diff --git a/sopel_SpiceBot_Core_1/__init__.py b/sopel_SpiceBot_Core_1/__init__.py index ca32962..1e7ad3c 100644 --- a/sopel_SpiceBot_Core_1/__init__.py +++ b/sopel_SpiceBot_Core_1/__init__.py @@ -8,11 +8,19 @@ import os import pathlib from .SBCore import SpiceBotCore_OBJ +# from .SBCore.config import SpiceBot_Conf SCRIPT_DIR = pathlib.Path(os.path.dirname(os.path.abspath(__file__))) sb = SpiceBotCore_OBJ(SCRIPT_DIR) +# def configure(config): +# config.define_section("spiceBot", SpiceBot_Conf, validate=False) +# config.SpiceBot_Conf.configure_setting('multi_split_key', 'key to split multi-commands') +# config.SpiceBot_Conf.configure_setting('pipe_split_key', 'key to split multi-commands') +# config.SpiceBot_Conf.configure_setting('query_command_key', 'key to split multi-commands') + + def setup(bot): sb.setup(bot) diff --git a/sopel_SpiceBot_Core_Prerun/__init__.py b/sopel_SpiceBot_Core_Prerun/__init__.py index 24a3613..d21a52f 100644 --- a/sopel_SpiceBot_Core_Prerun/__init__.py +++ b/sopel_SpiceBot_Core_Prerun/__init__.py @@ -6,7 +6,7 @@ from sopel.trigger import Trigger from sopel_SpiceBot_Core_1 import sb -def prerun(metadata={}): +def prerun(): """This decorator is the hub of handling for all SpiceBot Commands""" def actual_decorator(function): @@ -15,6 +15,7 @@ def prerun(metadata={}): def internal_prerun(bot, trigger, *args, **kwargs): runfunc = True + metadata = {} comrun = ComRun(bot, trigger, function, metadata)