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