|
|
@ -96,39 +96,52 @@ app.listen(3000, () => {
|
|
|
|
const tmi = require('tmi.js');
|
|
|
|
const tmi = require('tmi.js');
|
|
|
|
|
|
|
|
|
|
|
|
const client = new tmi.Client({
|
|
|
|
const client = new tmi.Client({
|
|
|
|
channels: [ 'twitchplaysplotter' ]
|
|
|
|
channels: ['twitchplaysplotter']
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
client.connect();
|
|
|
|
client.connect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let penIsUp = false;
|
|
|
|
|
|
|
|
var initMessage = "IN;SC0,0,100,0,100;";
|
|
|
|
|
|
|
|
|
|
|
|
client.on('message', (channel, tags, message, self) => {
|
|
|
|
client.on('message', (channel, tags, message, self) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log("\n");
|
|
|
|
console.log(`${tags['display-name']}: ${message}`);
|
|
|
|
console.log(`${tags['display-name']}: ${message}`);
|
|
|
|
|
|
|
|
|
|
|
|
switch ( message.toLowerCase() ) {
|
|
|
|
switch (message.toLowerCase()) {
|
|
|
|
case 'pu':
|
|
|
|
case 'pu':
|
|
|
|
console.log("Performing a PU");
|
|
|
|
console.log("Performing a PU");
|
|
|
|
|
|
|
|
toPlotter(initMessage);
|
|
|
|
|
|
|
|
toPlotter(`PU;`);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'pd':
|
|
|
|
case 'pd':
|
|
|
|
console.log("Performing a PD");
|
|
|
|
toPlotter(initMessage);
|
|
|
|
|
|
|
|
toPlotter(`PD;`);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'up':
|
|
|
|
case 'up':
|
|
|
|
|
|
|
|
toPlotter(initMessage);
|
|
|
|
console.log("Performing a move UP");
|
|
|
|
console.log("Performing a move UP");
|
|
|
|
|
|
|
|
toPlotter(`PR0,100;`);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'down':
|
|
|
|
case 'down':
|
|
|
|
console.log("Performing a move DOWN");
|
|
|
|
toPlotter(initMessage);
|
|
|
|
|
|
|
|
toPlotter(`PR0,-100;`);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'left':
|
|
|
|
case 'left':
|
|
|
|
|
|
|
|
toPlotter(initMessage);
|
|
|
|
console.log("Performing a move LEFT");
|
|
|
|
console.log("Performing a move LEFT");
|
|
|
|
|
|
|
|
toPlotter(`PR-100,0;`);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'right':
|
|
|
|
case 'right':
|
|
|
|
|
|
|
|
toPlotter(initMessage);
|
|
|
|
console.log("Performing a move RIGHT");
|
|
|
|
console.log("Performing a move RIGHT");
|
|
|
|
|
|
|
|
toPlotter(`PR100,0;`);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
|
|
|
|
toPlotter(initMessage);
|
|
|
|
console.log("Message not recognized");
|
|
|
|
console.log("Message not recognized");
|
|
|
|
toPlotter(`IN;SC0,0,100,0,100;SP1;PA60,60;PU`)
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|