aboutsummaryrefslogtreecommitdiffstats
path: root/main.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2022-10-29 19:32:41 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:52 +0100
commit4621f0fedb99c04a90489aa3d2fca64b3d5d2db5 (patch)
tree06c622daf137f0449fe75657bcdc97098ee3b0bc /main.py
parentaf7cd8c200a7d5dafac4ab2e5afdc1978bd3d308 (diff)
downloadwee-slack-4621f0fedb99c04a90489aa3d2fca64b3d5d2db5.tar.gz
Rename to avoid module name collision
Diffstat (limited to 'main.py')
-rw-r--r--main.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/main.py b/main.py
new file mode 100644
index 0000000..94f01b3
--- /dev/null
+++ b/main.py
@@ -0,0 +1,35 @@
+import os
+import sys
+
+import weechat
+
+sys.path.append(os.path.dirname(os.path.realpath(__file__)))
+from slack.config import SlackConfig
+from slack.init import init # pylint: disable=wrong-import-position
+from slack.shared import shared # pylint: disable=wrong-import-position
+from slack.task import create_task # pylint: disable=wrong-import-position
+from slack.util import get_callback_name # pylint: disable=wrong-import-position
+
+shared.weechat_callbacks = globals()
+
+
+def shutdown_cb():
+ weechat.config_write(shared.config.weechat_config.pointer)
+ return weechat.WEECHAT_RC_OK
+
+
+if __name__ == "__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)