mpp-test-bot/index.js

83 lines
1.5 KiB
JavaScript

require("dotenv").config();
const Client = require("mppclone-client");
const client = new Client("wss://smnmpp.hri7566.info:8448", process.env.TOKEN);
client.start();
client.setChannel("✧𝓓𝓜 𝓡𝓸𝓸𝓶✧");
const sendChat = (str) => {
client.sendArray([
{
m: "a",
message: `\u034f${str}`
}
]);
};
client.on("hi", (msg) => {
console.log("Connected to smnmpp");
if (msg.u.name !== "test bot") {
client.sendArray([
{
m: "userset",
set: {
name: "test bot",
color: "#9900ff"
}
}
]);
}
});
let prefix = "!";
client.on("a", (msg) => {
const args = msg.a.split(" ");
if (!args[0]) return;
const argcat = msg.a.substring(msg.args[0].length);
if (msg.a.startsWith(prefix + "help")) {
sendChat("todo put help menu here");
}
if (
msg.a.startsWith(prefix + "about") ||
msg.a.startsWith(prefix + "info")
) {
}
});
function setCursor(x, y) {
client.sendArray([
{
m: "m",
x: x,
y: y
}
]);
}
let x = 50;
let y = 50;
let velx = 4 / 5;
let vely = 4 / 7;
setInterval(() => {
x += velx;
y += vely;
if (x > 100 || x < 0) {
velx = -velx;
}
if (y > 100 || y < 0) {
vely = -vely;
}
setCursor(x, y);
}, 1000 / 20);