trigger the command from the cl

master
vitrinekast 9 months ago
parent 4818bec831
commit b9a9481da0

@ -107,22 +107,19 @@ const parseMessage = (message) => {
} }
client.on('message', (channel, tags, message, self) => { client.on('message', (channel, tags, message, self) => {
console.log(`${tags['display-name']}: ${message}`); console.log(`${tags['display-name']}: ${message}`);
parseMessage(message) parseMessage(message)
}); });
const readline = require('node:readline').createInterface({
input: process.stdin,
output: process.stdout,
});
var testMessages = ['init','pu','pd','up','down','left','right','right','rectangle','circle','LBhaihai']; const askQuestion = message => {
var testIndex = 0; console.log(`sending ${message}! \n`);
var interval = setInterval(function () { readline.question(`What do you want the plotter to do? \n`, askQuestion);
console.log("----- about to send a test message: ", testMessages[testIndex]); parseMessage(message)
parseMessage(testMessages[testIndex]); }
if(testIndex < (testMessages.length - 1)) { readline.question(`What do you want the plotter to do?`, askQuestion);
testIndex++;
} else {
console.log("completed the test")
clearInterval(interval);
}
}, 1000);
Loading…
Cancel
Save