From a9bf7cadf951be06bf6ebb2a19174189357ff2db Mon Sep 17 00:00:00 2001 From: vitrinekast Date: Mon, 12 Feb 2024 09:45:33 +0100 Subject: [PATCH] set distance --- app.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index d6bd923..47360af 100644 --- a/app.js +++ b/app.js @@ -3,7 +3,7 @@ const express = require('express') const tmi = require('tmi.js'); const { init, translate, circle, rectangle, to, label } = require("./hpgl.js"); -const distance = 3; +let distance = 3; const app = express() const client = new tmi.Client({ @@ -61,12 +61,18 @@ app.listen(3001, () => { const parseMessage = (message) => { + message = message.trim(); + if (message.toLowerCase().startsWith("lb")) { var words = message.toLowerCase().replace("lb", ""); toPlotter(label(words)); } else if (message.toLowerCase().startsWith("distance")) { + console.log("do: ", message); + var value = Number(message.replace("distance ", "")); + console.log("do the value of ", value); + distance = value; } else { switch (message.toLowerCase()) { case 'init':