blob: 32dc3d563ed9fdadd11ef418fa443564a9641159 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
from __future__ import annotations
import os
import sys
import weechat
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
import globals as G # pylint: disable=wrong-import-position
from config import SlackConfig, SlackWorkspace # pylint: disable=wrong-import-position
from task import create_task # pylint: disable=wrong-import-position
def shutdown_cb():
weechat.config_write(G.config.weechat_config.pointer)
return weechat.WEECHAT_RC_OK
async def init():
print(G.workspaces)
if "wee-slack-test" not in G.workspaces:
G.workspaces["wee-slack-test"] = SlackWorkspace("wee-slack-test")
G.workspaces[
"wee-slack-test"
].config.api_token.value = weechat.config_get_plugin("api_token")
G.workspaces[
"wee-slack-test"
].config.api_cookies.value = weechat.config_get_plugin("api_cookie")
workspace = G.workspaces["wee-slack-test"]
print(workspace)
print(workspace.config.slack_timeout.value)
print(G.config.color.reaction_suffix.value)
if __name__ == "__main__":
if weechat.register(
G.SCRIPT_NAME,
G.SCRIPT_AUTHOR,
G.SCRIPT_VERSION,
G.SCRIPT_LICENSE,
G.SCRIPT_DESC,
shutdown_cb.__name__,
"",
):
G.weechat_version = int(weechat.info_get("version_number", "") or 0)
G.workspaces = {}
G.config = SlackConfig()
G.config.config_read()
create_task(init(), final=True)
|