From 0cb978d9d0af461b4532bd948936338ebb411fae Mon Sep 17 00:00:00 2001 From: lub Date: Wed, 18 Oct 2017 00:16:32 +0200 Subject: [PATCH] implement room joins - closes #14 --- projects/lubiland.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/projects/lubiland.js b/projects/lubiland.js index d0343d7..ecd7ca1 100644 --- a/projects/lubiland.js +++ b/projects/lubiland.js @@ -21,4 +21,23 @@ lubiland['infrastructure']['rebuild'].exec = (args, room, event) => { matrixClient.sendNotice(room.roomId, event.sender.userId + '\nrebuild of container ' + container + ' failed.\ncode: ' + process.code + '\nstdout: \n```\n' + process.stdout + '```\nstderr: \n```\n' + process.stderr + '\n```'); }); }); +}; + + +lubiland['heimdall'] = {}; + +lubiland['heimdall']['join'] = {}; +lubiland['heimdall']['join'].regex = /^(.*)$/; +lubiland['heimdall']['join'].usage = ''; +lubiland['heimdall']['join'].exec = (args, room, event) => { + return new Promise((resolve, reject) => { + const roomId = args[1]; + + matrixClient.joinRoom(roomId) + .then((success) => { + matrixClient.sendNotice(room.roomId, ' joined ' + success.name); + }, (fail) => { + matrixClient.sendNotice(room.roomId, 'error while trying to join the other room: ' + fail.message); + }) + }); }; \ No newline at end of file