This commit is contained in:
Hri7566 2023-09-17 02:59:59 -04:00
commit a877564086
5 changed files with 147 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules
.env

5
.prettierrc Normal file
View File

@ -0,0 +1,5 @@
{
"arrowParens": "always",
"tabWidth": 4,
"trailingComma": "none"
}

82
index.js Normal file
View File

@ -0,0 +1,82 @@
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);

16
package.json Normal file
View File

@ -0,0 +1,16 @@
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node ."
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"dotenv": "^16.3.1",
"mppclone-client": "^1.1.3"
}
}

42
pnpm-lock.yaml Normal file
View File

@ -0,0 +1,42 @@
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
dependencies:
dotenv:
specifier: ^16.3.1
version: 16.3.1
mppclone-client:
specifier: ^1.1.3
version: 1.1.3
packages:
/dotenv@16.3.1:
resolution: {integrity: sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==}
engines: {node: '>=12'}
dev: false
/mppclone-client@1.1.3:
resolution: {integrity: sha512-5DSkQmZOj823/BPwi6CQa4UWkoAX7itfNxf6L26NJS/qj9AljuKoqnIZxhtSKdak75qZd5Jgx+zD1aXflRNxHg==}
dependencies:
ws: 8.14.1
transitivePeerDependencies:
- bufferutil
- utf-8-validate
dev: false
/ws@8.14.1:
resolution: {integrity: sha512-4OOseMUq8AzRBI/7SLMUwO+FEDnguetSk7KMb1sHwvF2w2Wv5Hoj0nlifx8vtGsftE/jWHojPy8sMMzYLJ2G/A==}
engines: {node: '>=10.0.0'}
peerDependencies:
bufferutil: ^4.0.1
utf-8-validate: '>=5.0.2'
peerDependenciesMeta:
bufferutil:
optional: true
utf-8-validate:
optional: true
dev: false