diff --git a/builds/maubot-resotU/main.py b/builds/maubot-resotU/main.py
new file mode 100644
index 0000000..518fd5d
--- /dev/null
+++ b/builds/maubot-resotU/main.py
@@ -0,0 +1,47 @@
+from time import time
+import aiohttp
+import asyncio
+
+from mautrix.types import TextMessageEventContent, MessageType, Format, RelatesTo, RelationType, MediaMessageEventContent
+from maubot import Plugin, MessageEvent
+from maubot.handlers import command
+
+async def download_image(url):
+ async with aiohttp.ClientSession() as session:
+ async with session.get(url) as response:
+ return await response.read()
+
+class UCLouvainRestoUBot(Plugin):
+ # Highly inspired by https://github.com/maubot/echo
+ @command.new("ping", help="Ping")
+ async def ping_handler(self, evt: MessageEvent, message: str = "") -> None:
+ diff = int(time() * 1000) - evt.timestamp
+
+ content = TextMessageEventContent(
+ msgtype=MessageType.NOTICE, format=Format.HTML,
+ body=f"{evt.sender}: Pong! (ping took {diff} ms to arrive)",
+ formatted_body=f"{evt.sender}: Pong! "
+ f"(ping "
+ f"took {diff} ms to arrive)",
+ relates_to=RelatesTo(
+ rel_type=RelationType("xyz.maubot.pong"),
+ event_id=evt.event_id,
+ ))
+
+ await evt.respond(content)
+
+
+ @command.new("menu", help="Menu")
+ async def menu_handler(self, evt: MessageEvent, message: str = "") -> None:
+ data = await download_image("https://cdn.uclouvain.be/groups/cms-editors-resto-u/menu_51063_Restaurants_Universitaires_UCLouvain__Le_Sablon_-_Le_Galilee_-__LPzNYH61112.jpeg")
+ url = await self.client.upload_media(data, mime_type="application/json")
+
+ content = MediaMessageEventContent(
+ msgtype=MessageType.IMAGE,
+ url=url,
+ relates_to=RelatesTo(
+ rel_type=RelationType("xyz.maubot.menu"),
+ event_id=evt.event_id,
+ ))
+
+ await evt.respond(content)
diff --git a/builds/maubot-resotU/maubot.yaml b/builds/maubot-resotU/maubot.yaml
new file mode 100644
index 0000000..f94dc87
--- /dev/null
+++ b/builds/maubot-resotU/maubot.yaml
@@ -0,0 +1,8 @@
+maubot: 0.1.0
+id: com.bhasher.uclouvainrestou
+version: 0.0.1
+license: MIT
+modules:
+ - main
+main_class:
+ UCLouvainRestoUBot
diff --git a/builds/maubot-resotU/upload.sh b/builds/maubot-resotU/upload.sh
new file mode 100755
index 0000000..ee5142b
--- /dev/null
+++ b/builds/maubot-resotU/upload.sh
@@ -0,0 +1 @@
+docker exec -it matrix-maubot mbc build /plugin -u
diff --git a/bxl-shp/apps/docker-compose.matrix.yaml b/bxl-shp/apps/docker-compose.matrix.yaml
index 4d1e3bf..a19cdf5 100644
--- a/bxl-shp/apps/docker-compose.matrix.yaml
+++ b/bxl-shp/apps/docker-compose.matrix.yaml
@@ -49,6 +49,7 @@ services:
- TZ=Europe/Paris
volumes:
- $DATA/matrix/maubot:/data
+ - /home/shp/homelab/builds/maubot-resotU:/plugin:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.matrix-maubot.rule=Host(`maubot.bhasher.com`)"