Fix mbc init python template

This commit is contained in:
Tulir Asokan 2019-02-13 18:48:48 +02:00
parent 3068245b1f
commit 56a11fdceb

View File

@ -1,6 +1,9 @@
from maubot import Plugin from typing import Type
{% if config %} {% if config %}
from mautrix.util.config import BaseProxyConfig, ConfigUpdateHelper from mautrix.util.config import BaseProxyConfig, ConfigUpdateHelper
{% endif %}
from maubot import Plugin
{% if config %}
class Config(BaseProxyConfig): class Config(BaseProxyConfig):
def do_update(self, helper: ConfigUpdateHelper) -> None: def do_update(self, helper: ConfigUpdateHelper) -> None:
@ -9,18 +12,14 @@ class Config(BaseProxyConfig):
helper.copy("example_2.value") helper.copy("example_2.value")
{% endif %} {% endif %}
class {{ name }}: class {{ name }}(Plugin):
async def start() -> None: async def start(self) -> None:{% if config %}
{% if config %}
self.config.load_and_update() self.config.load_and_update()
self.log.debug("Loaded %s from config example 2", self.config["example_2.value"]) self.log.debug("Loaded %s from config example 2", self.config["example_2.value"]){% else %}
{% else %} pass{% endif %}
pass
{% endif %}
async def stop() -> None: async def stop(self) -> None:
pass pass
{% if config %} {% if config %}
@classmethod @classmethod
def get_config_class(cls) -> Type[BaseProxyConfig]: def get_config_class(cls) -> Type[BaseProxyConfig]: