matrix-bot/matrix_bot/plugins/echo.py

18 lines
566 B
Python
Raw Normal View History

2020-08-06 17:16:43 +02:00
from nio import MatrixRoom, RoomMessageText
from ..message import MarkdownMessage
from ._plugin import _Plugin
class Plugin(_Plugin):
help = 'Echo the given input back into the room'
async def on_command(self, room: MatrixRoom,
message: RoomMessageText) -> None:
body = message.body
if (message.formatted_body):
body = MarkdownMessage.clean_html(message.formatted_body)
body = ' '.join(body.split(' ')[2:])
message = MarkdownMessage(body)
await message.send(self.client, room)