diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2022-09-09 13:51:52 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2022-09-09 13:51:52 +0200 |
commit | 86dd3902f78f470d4e571213fb126119c079b1c6 (patch) | |
tree | e951e200341b59b3869a18542900a50322ed5e57 /labbot/bot.py | |
parent | 78f3ee84bcb1164b0260325d42fe7ef96c034ed0 (diff) | |
download | lab-bot-86dd3902f78f470d4e571213fb126119c079b1c6.tar.gz lab-bot-86dd3902f78f470d4e571213fb126119c079b1c6.zip |
add command framework, correct access token and secret passing
Diffstat (limited to 'labbot/bot.py')
-rw-r--r-- | labbot/bot.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/labbot/bot.py b/labbot/bot.py index 72d01ca..f5371f6 100644 --- a/labbot/bot.py +++ b/labbot/bot.py @@ -6,6 +6,7 @@ import logging import labbot import labbot.config +import labbot.commands log = logging.getLogger(__name__) @@ -26,7 +27,7 @@ class Bot: if "addon_path" in self.config: self.addon_paths.append(self.config.get("addon_path")) - self.instance = GitLabBot(self.name, **kwargs) + self.instance = GitLabBot(self.name, access_token=self.access_token, secret=self.secret, **kwargs) for path in self.addon_paths: sys.path.insert(0, path) @@ -37,9 +38,12 @@ class Bot: for path in self.addon_paths: sys.path.remove(path) + labbot.commands.commands.setup_hook(self) + def load_addon(self, addon: str) -> None: try: + module = import_module(f"{addon}") import_module(f"{addon}").setup(self) log.info(f"Loaded {addon}") self.addons.append(addon) @@ -58,6 +62,9 @@ class Bot: def register_issue_hook(self, func, *args, **kwargs) -> None: self.register(func, "Issue Hook", *args, **kwargs) + def register_comment_hook(self, func, *args, **kwargs) -> None: + self.register(func, "Issue Hook", *args, **kwargs) + def register_note_hook(self, func, *args, **kwargs) -> None: self.register(func, "Note Hook", *args, **kwargs) |