weechat-rocketchat/main.py

38 lines
1.2 KiB
Python
Raw Normal View History

2022-05-09 16:23:23 +00:00
import os
import weechat
# See if there is a `venv` directory next to our script, and use that if
# present. This first resolves symlinks, so this also works when we are
# loaded through a symlink (e.g. from autoload).
# See https://virtualenv.pypa.io/en/latest/userguide/#using-virtualenv-without-bin-python
# This does not support pyvenv or the python3 venv module, which do not
# create an activate_this.py: https://stackoverflow.com/questions/27462582
activate_this = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "venv", "bin", "activate_this.py"
)
if os.path.exists(activate_this):
exec(open(activate_this).read(), {"__file__": activate_this})
# yapf: disable
WEECHAT_SCRIPT_NAME = "weechat-rocketchat"
WEECHAT_SCRIPT_DESCRIPTION = "rocketchat plugin"
WEECHAT_SCRIPT_AUTHOR = "Michael Zhang <mail@mzhang.io>"
WEECHAT_SCRIPT_VERSION = "0.3.0"
WEECHAT_SCRIPT_LICENSE = "ISC"
# yapf: enable
logger = Logger("weechat-rocketchat")
if __name__ == "__main__":
if weechat.register(
WEECHAT_SCRIPT_NAME,
WEECHAT_SCRIPT_AUTHOR,
WEECHAT_SCRIPT_VERSION,
WEECHAT_SCRIPT_LICENSE,
WEECHAT_SCRIPT_DESCRIPTION,
"matrix_unload_cb",
"",
):
pass