diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2022-10-30 07:49:52 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:52 +0100 |
commit | 675ad9bb16e4041afde43f551d7a76bb9b008f5e (patch) | |
tree | 1c09ff2f764f84250b32fd4731c16fdb2af5afa3 /slack | |
parent | 4621f0fedb99c04a90489aa3d2fca64b3d5d2db5 (diff) | |
download | wee-slack-675ad9bb16e4041afde43f551d7a76bb9b008f5e.tar.gz |
Move all into slack directory
Diffstat (limited to 'slack')
-rw-r--r-- | slack/__init__.py | 11 | ||||
-rw-r--r-- | slack/init.py | 26 |
2 files changed, 36 insertions, 1 deletions
diff --git a/slack/__init__.py b/slack/__init__.py index e69de29..431484a 100644 --- a/slack/__init__.py +++ b/slack/__init__.py @@ -0,0 +1,11 @@ +import os +import sys + +sys.path.append(os.path.dirname(os.path.realpath(__file__))) +from slack.init import main # pylint: disable=wrong-import-position +from slack.shared import shared # pylint: disable=wrong-import-position + +shared.weechat_callbacks = globals() + +if __name__ == "__main__": + main() diff --git a/slack/init.py b/slack/init.py index 27a3a40..38efa6e 100644 --- a/slack/init.py +++ b/slack/init.py @@ -1,7 +1,14 @@ import weechat -from slack.config import SlackWorkspace +from slack.config import SlackConfig, SlackWorkspace from slack.shared import shared +from slack.task import create_task +from slack.util import get_callback_name + + +def shutdown_cb(): + weechat.config_write(shared.config.weechat_config.pointer) + return weechat.WEECHAT_RC_OK async def init(): @@ -18,3 +25,20 @@ async def init(): print(workspace) print(workspace.config.slack_timeout.value) print(shared.config.color.reaction_suffix.value) + + +def main(): + if weechat.register( + shared.SCRIPT_NAME, + shared.SCRIPT_AUTHOR, + shared.SCRIPT_VERSION, + shared.SCRIPT_LICENSE, + shared.SCRIPT_DESC, + get_callback_name(shutdown_cb), + "", + ): + shared.weechat_version = int(weechat.info_get("version_number", "") or 0) + shared.workspaces = {} + shared.config = SlackConfig() + shared.config.config_read() + create_task(init(), final=True) |