2020-03-11 20:42:36 +01:00
|
|
|
var http = require("http");
|
|
|
|
|
|
|
|
http
|
|
|
|
.createServer(function(request, response) {
|
|
|
|
response.writeHead(200, { "Content-Type": "text/plain" });
|
|
|
|
response.end(
|
|
|
|
"welcome to hri's bot page :)\nthis is just here so heroku/glitch doesn't freak out"
|
|
|
|
);
|
|
|
|
})
|
|
|
|
.listen(process.env.PORT || 3000);
|
|
|
|
|
|
|
|
console.log("HTTP Host Established");
|
|
|
|
|
|
|
|
const MPPClient = require('mpp-client-xt');
|
|
|
|
const client = new MPPClient("http://www.multiplayerpiano.com", undefined);
|
|
|
|
|
|
|
|
client.start();
|
|
|
|
|
|
|
|
client.on("hi", () => {
|
2020-03-11 21:18:17 +01:00
|
|
|
setTimeout(function() {
|
|
|
|
client.sendArray([{m:'userset', set:{name:"dvdbot [dvd!help](made by Hri7566)"}}]);
|
|
|
|
})
|
|
|
|
|
2020-03-11 20:42:36 +01:00
|
|
|
client.setChannel("✧𝓡𝓟 𝓡𝓸𝓸𝓶✧");
|
2018-03-13 21:25:39 +01:00
|
|
|
});
|
|
|
|
|
2020-03-11 20:42:36 +01:00
|
|
|
function chat(string) {
|
|
|
|
client.sendArray([{m:'a', message:string}]);
|
|
|
|
}
|
|
|
|
|
|
|
|
var ctoggle = true;
|
|
|
|
|
2020-03-11 20:54:22 +01:00
|
|
|
var cursormode = "dvd";
|
|
|
|
|
2020-03-11 21:18:17 +01:00
|
|
|
|
2020-03-11 20:42:36 +01:00
|
|
|
client.on("a", (msg) => {
|
|
|
|
let args = msg.a.split(' ');
|
|
|
|
let cmd = args[0].toLowerCase();
|
|
|
|
let argcat = msg.a.substring(cmd.length).trim();
|
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case "dvd!help":
|
2020-03-11 20:54:22 +01:00
|
|
|
chat("cmds: dvd!help // dvd!cursor");
|
|
|
|
break;
|
|
|
|
case "dvd!cursor":
|
|
|
|
if (!argcat || argcat == "") {
|
2020-03-11 21:06:20 +01:00
|
|
|
chat("Modes: on // off // frantic");
|
2020-03-11 20:54:22 +01:00
|
|
|
} else {
|
|
|
|
switch (argcat) {
|
|
|
|
case "on":
|
|
|
|
ctoggle = true;
|
|
|
|
pos = {x: 5, y: 5};
|
2020-03-11 21:06:20 +01:00
|
|
|
vel = {x: 2/5, y: 2/7};
|
2020-03-11 20:54:22 +01:00
|
|
|
cursormode = "dvd";
|
|
|
|
break;
|
|
|
|
case "off":
|
|
|
|
ctoggle = false;
|
|
|
|
cursormode = "none";
|
2020-03-11 21:06:20 +01:00
|
|
|
pos = {x: -500, y: -500};
|
|
|
|
break;
|
|
|
|
case "frantic":
|
|
|
|
ctoggle = true;
|
|
|
|
pos = {x: 5, y: 5};
|
|
|
|
vel = {x: 10, y: 15};
|
|
|
|
cursormode = "frantic";
|
2020-03-11 20:54:22 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-03-11 20:42:36 +01:00
|
|
|
break;
|
|
|
|
}
|
2020-02-19 23:18:49 +01:00
|
|
|
});
|
|
|
|
|
2020-03-11 20:42:36 +01:00
|
|
|
var pos = {x: -42, y: 5};
|
|
|
|
var vel = {x: 2/5, y: 2/7};
|
|
|
|
|
|
|
|
var cursor = setInterval(function() {
|
2020-03-11 21:06:20 +01:00
|
|
|
client.sendArray([{m:'m', x: client.getOwnParticipant().x = pos.x + 50, y: client.getOwnParticipant().y = pos.y + 50}]);
|
2018-03-13 21:25:39 +01:00
|
|
|
});
|
2020-03-11 20:42:36 +01:00
|
|
|
|
|
|
|
var cursorupdate = setInterval(function() {
|
2020-03-11 20:54:22 +01:00
|
|
|
switch (cursormode) {
|
|
|
|
case "dvd":
|
2020-03-11 21:06:20 +01:00
|
|
|
case "frantic":
|
2020-03-11 20:54:22 +01:00
|
|
|
pos.x += vel.x;
|
|
|
|
pos.y += vel.y;
|
|
|
|
if (pos.x >= 50) {
|
|
|
|
vel.x = -vel.x;
|
|
|
|
}
|
|
|
|
if (pos.y >= 50) {
|
|
|
|
vel.y = -vel.y;
|
|
|
|
}
|
|
|
|
if (pos.x <= -50) {
|
|
|
|
vel.x = -vel.x;
|
|
|
|
}
|
|
|
|
if (pos.y <= -50) {
|
|
|
|
vel.y = -vel.y;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2020-03-11 21:18:17 +01:00
|
|
|
}, 25);
|