Maubot plugin for getting system load.

This commit is contained in:
Alex Manning 2021-07-07 12:47:22 +00:00
commit a210e8bc0f
3 changed files with 27 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.mbp

19
load.py Normal file
View file

@ -0,0 +1,19 @@
import os
from maubot import MessageEvent, Plugin
from maubot.handlers import command
from mautrix.types import Format, MessageType, TextMessageEventContent
class LoadBot(Plugin):
@command.new("load", help="Get load average.")
@command.argument("message", pass_raw=True)
async def load_handler(self, evt: MessageEvent, message: str) -> None:
load = str(os.getloadavg())
content = TextMessageEventContent(
msgtype=MessageType.NOTICE,
format=Format.HTML,
body=f"{load}",
formatted_body=f"{load}",
)
await evt.respond(content)

7
maubot.yaml Normal file
View file

@ -0,0 +1,7 @@
maubot: 0.1.0
id: uk.a09.maubot.load
version: 0.0.1
license: MIT
modules:
- load
main_class: LoadBot