implement room joins - closes #14

master
lub 7 years ago
parent 8eff841b24
commit 0cb978d9d0

@ -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```'); 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 = '<container>';
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);
})
});
}; };