Update hello world example and add config example

This commit is contained in:
Tulir Asokan 2019-01-07 08:14:29 +02:00
parent 400c9aaebc
commit ac69c50b80
8 changed files with 49 additions and 10 deletions

View file

@ -0,0 +1,25 @@
from typing import Type
from mautrix.util.config import BaseProxyConfig, ConfigUpdateHelper
from maubot import Plugin, MessageEvent
from maubot.handlers import command
class Config(BaseProxyConfig):
def do_update(self, helper: ConfigUpdateHelper) -> None:
helper.copy("message")
class DatabaseBot(Plugin):
async def start(self) -> None:
await super().start()
self.config.load_and_update()
@classmethod
def get_config_class(cls) -> Type[BaseProxyConfig]:
return Config
@command.new("getmessage")
async def handler(self, event: MessageEvent) -> None:
if event.sender != self.client.mxid:
await event.reply(self.config["message"])