mirror of
https://github.com/maubot/maubot.git
synced 2024-10-01 01:06:10 -04:00
26 lines
711 B
Python
26 lines
711 B
Python
|
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"])
|