From a8775640867dd236922c06c9bc87c7dc5442a274 Mon Sep 17 00:00:00 2001 From: Hri7566 Date: Sun, 17 Sep 2023 02:59:59 -0400 Subject: [PATCH] init --- .gitignore | 2 ++ .prettierrc | 5 +++ index.js | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 16 ++++++++++ pnpm-lock.yaml | 42 ++++++++++++++++++++++++++ 5 files changed, 147 insertions(+) create mode 100644 .gitignore create mode 100644 .prettierrc create mode 100644 index.js create mode 100644 package.json create mode 100644 pnpm-lock.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e8c9f45 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +.env diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..8bccdd1 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "arrowParens": "always", + "tabWidth": 4, + "trailingComma": "none" +} diff --git a/index.js b/index.js new file mode 100644 index 0000000..94b2bba --- /dev/null +++ b/index.js @@ -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); diff --git a/package.json b/package.json new file mode 100644 index 0000000..fe2381d --- /dev/null +++ b/package.json @@ -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" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..a2838ed --- /dev/null +++ b/pnpm-lock.yaml @@ -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