From 56a11fdceb87a1e3df6223004a6f0ef93aa58ee6 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 13 Feb 2019 18:48:48 +0200 Subject: [PATCH] Fix mbc init python template --- maubot/cli/res/plugin.py.j2 | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/maubot/cli/res/plugin.py.j2 b/maubot/cli/res/plugin.py.j2 index 7e3ccc9..05d5341 100644 --- a/maubot/cli/res/plugin.py.j2 +++ b/maubot/cli/res/plugin.py.j2 @@ -1,6 +1,9 @@ -from maubot import Plugin +from typing import Type {% if config %} from mautrix.util.config import BaseProxyConfig, ConfigUpdateHelper +{% endif %} +from maubot import Plugin +{% if config %} class Config(BaseProxyConfig): def do_update(self, helper: ConfigUpdateHelper) -> None: @@ -9,18 +12,14 @@ class Config(BaseProxyConfig): helper.copy("example_2.value") {% endif %} -class {{ name }}: - async def start() -> None: -{% if config %} +class {{ name }}(Plugin): + async def start(self) -> None:{% if config %} self.config.load_and_update() - self.log.debug("Loaded %s from config example 2", self.config["example_2.value"]) -{% else %} - pass -{% endif %} + self.log.debug("Loaded %s from config example 2", self.config["example_2.value"]){% else %} + pass{% endif %} - async def stop() -> None: + async def stop(self) -> None: pass - {% if config %} @classmethod def get_config_class(cls) -> Type[BaseProxyConfig]: