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