diff --git a/app.js b/app.js index 58f2c2c..7d2b413 100644 --- a/app.js +++ b/app.js @@ -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); \ No newline at end of file +readline.question(`What do you want the plotter to do?`, askQuestion); \ No newline at end of file