Add full example plugin

Also switch to yaml plugin metadata in example file (ref #33)
This commit is contained in:
Tulir Asokan 2018-12-09 15:17:21 +02:00
parent 5704b3e53b
commit 55685dfd6e
4 changed files with 64 additions and 9 deletions

View file

@ -0,0 +1,14 @@
from maubot import Plugin, MessageEvent
from mautrix.types import EventType
class HelloWorldBot(Plugin):
async def start(self) -> None:
self.client.add_event_handler(self.handler, EventType.ROOM_MESSAGE)
async def stop(self) -> None:
self.client.remove_event_handler(self.handler, EventType.ROOM_MESSAGE)
async def handler(self, event: MessageEvent) -> None:
if event.sender != self.client.mxid:
await event.reply("Hello, World!")