Compare commits

..

No commits in common. '5d18c804c5fde8f7b915b595e0e7678319060def' and 'f981e57884c89155c2555596b68f893cbbfc0ccf' have entirely different histories.

@ -51,9 +51,6 @@ function fetchCommand(input, commands, threshhold){
return candidates;
}
module.exports.fetchCommand = fetchCommand;
module.exports.getEditDistance = getEditDistance;
/* //Test code
const commands = {};
commands['homeserver'] = {};

@ -2,7 +2,6 @@ const fs = require('fs');
const remoteExec = require('./remoteExec.js');
const sdk = require('matrix-js-sdk');
const yaml = require('js-yaml');
const commandUtil = require('./commands.js');
global.config = yaml.safeLoad(fs.readFileSync('config.yaml'));
const matrixClient = sdk.createClient({
@ -25,6 +24,7 @@ process.on('unhandledRejection', (reason) => {
console.log('Reason: ' + reason);
});
const commands = {};
commands['rebuild'] = {};
@ -61,9 +61,7 @@ matrixClient.on('Room.timeline', function(event, room, resetTimeline) {
}
project = project[1];
let command = commands[project];
if(command !== undefined) {
if(commands[project] !== undefined) {
const command = commands[project];
const args = body.match(command.regex);
@ -73,14 +71,6 @@ matrixClient.on('Room.timeline', function(event, room, resetTimeline) {
}
command.exec(args, room, event);
}else{ //command not found
let tmp = commandUtil.fetchCommand(project, commands);
let suggestions = "";
for(let i = 0; i < tmp.length; i++){
suggestions += "\n"+tmp[i];
}
matrixClient.sendNotice(room.roomId, 'Unrecognized command.\n' +
'Did you mean:'+suggestions);
}
});