|
|
|
@ -107,22 +107,19 @@ const parseMessage = (message) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
client.on('message', (channel, tags, message, self) => {
|
|
|
|
|
|
|
|
|
|
console.log(`${tags['display-name']}: ${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'];
|
|
|
|
|
var testIndex = 0;
|
|
|
|
|
var interval = setInterval(function () {
|
|
|
|
|
console.log("----- about to send a test message: ", testMessages[testIndex]);
|
|
|
|
|
parseMessage(testMessages[testIndex]);
|
|
|
|
|
const askQuestion = message => {
|
|
|
|
|
console.log(`sending ${message}! \n`);
|
|
|
|
|
readline.question(`What do you want the plotter to do? \n`, askQuestion);
|
|
|
|
|
parseMessage(message)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(testIndex < (testMessages.length - 1)) {
|
|
|
|
|
testIndex++;
|
|
|
|
|
} else {
|
|
|
|
|
console.log("completed the test")
|
|
|
|
|
clearInterval(interval);
|
|
|
|
|
}
|
|
|
|
|
}, 1000);
|
|
|
|
|
readline.question(`What do you want the plotter to do?`, askQuestion);
|