From 9e433f5f6ab42b320b40c355fe8e34b9601555d8 Mon Sep 17 00:00:00 2001 From: lub Date: Sun, 15 Oct 2017 17:03:13 +0200 Subject: [PATCH] switch to lower camelcase --- index.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index 59a2850..5c1d1c6 100644 --- a/index.js +++ b/index.js @@ -1,20 +1,20 @@ const fs = require('fs'); -const node_ssh = require('node-ssh'); +const nodeSsh = require('node-ssh'); const sdk = require('matrix-js-sdk'); const yaml = require('js-yaml'); const config = yaml.safeLoad(fs.readFileSync('config.yaml')); -const matrixclient = sdk.createClient({ +const matrixClient = sdk.createClient({ baseUrl: config.matrix.baseurl, accessToken: config.matrix.accesstoken, userId: config.matrix.userid }); -const ssh = new node_ssh(); +const ssh = new nodeSsh(); // Autojoin for the bot (keep commented out when not needed to prevent abuse) -/*matrixclient.on('RoomMember.membership', function(event, member) { +/*matrixClient.on('RoomMember.membership', function(event, member) { if(member.membership === 'invite' && member.userId === userid) { - matrixclient.joinRoom(member.roomId).done(function() { + matrixClient.joinRoom(member.roomId).done(function() { console.log('Auto-joined %s', member.roomId); }); } @@ -58,20 +58,20 @@ commands['rebuild'].usage = '!rebuild '; commands['rebuild'].exec = function(args, room, event) { const container = args[1]; - matrixclient.sendNotice(room.roomId, 'rebuilding container ' + container); + matrixClient.sendNotice(room.roomId, 'rebuilding container ' + container); remoterun('./rebuild.sh ' + container) .then(function(result) { - matrixclient.sendNotice(room.roomId, event.sender.userId + '\nrebuilt container ' + container); + matrixClient.sendNotice(room.roomId, event.sender.userId + '\nrebuilt container ' + container); }, function(result) { - matrixclient.sendNotice(room.roomId, event.sender.userId + '\nrebuild of container ' + container + ' failed.\ncode: ' + result.code + '\nstdout: \n```\n' + result.stdout + '```\nstderr: \n```\n' + result.stderr + '\n```'); + matrixClient.sendNotice(room.roomId, event.sender.userId + '\nrebuild of container ' + container + ' failed.\ncode: ' + result.code + '\nstdout: \n```\n' + result.stdout + '```\nstderr: \n```\n' + result.stderr + '\n```'); }); }; -matrixclient.on('Room.timeline', function(event, room, resettimeline) { - if(resettimeline) { +matrixClient.on('Room.timeline', function(event, room, resetTimeline) { + if(resetTimeline) { return; } if(event.getType() !== 'm.room.message') { @@ -91,7 +91,7 @@ matrixclient.on('Room.timeline', function(event, room, resettimeline) { const args = body.match(command.regex); if(args === null) { - matrixclient.sendNotice(room.roomId, 'usage: ' + command.usage); + matrixClient.sendNotice(room.roomId, 'usage: ' + command.usage); return; } @@ -101,4 +101,4 @@ matrixclient.on('Room.timeline', function(event, room, resettimeline) { -matrixclient.startClient(); +matrixClient.startClient();