Remove rust

This commit is contained in:
Hri7566 2023-10-17 02:05:30 -04:00
parent 93a31b87be
commit b1d7477889
5 changed files with 20 additions and 10 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
/build
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore # Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
# Logs # Logs

View File

@ -1,4 +0,0 @@
#[no_mangle]
pub extern "C" fn handleCommand(argc: isize, argv: ) {
}

View File

View File

@ -8,7 +8,7 @@ export class ServiceLoader {
public static loadServices() { public static loadServices() {
const testAgent = new MPPAgent( const testAgent = new MPPAgent(
"wss://smnmpp.hri7566.info:8448", "wss://mppclone.com:8443",
env.MPPNET_TOKEN env.MPPNET_TOKEN
); );

View File

@ -1,12 +1,17 @@
import Client from "mpp-client-net"; import Client from "mpp-client-net";
import { ServiceAgent } from "../ServiceAgent"; import { ServiceAgent } from "../ServiceAgent";
import { ptr } from "bun:ffi";
let p;
export class MPPAgent extends ServiceAgent<Client> { export class MPPAgent extends ServiceAgent<Client> {
public desiredUser = { public desiredUser = {
name: "🟇 𝙎𝙪𝙥𝙚𝙧 Cosmic (*help)", name: "🟇 𝙎𝙪𝙥𝙚𝙧 Cosmic (no commands yet)",
color: "#1d0054" color: "#1d0054"
}; };
public desiredChannel = "nothing";
constructor(uri: string, token: string) { constructor(uri: string, token: string) {
const cl = new Client(uri, token); const cl = new Client(uri, token);
super(cl); super(cl);
@ -14,8 +19,6 @@ export class MPPAgent extends ServiceAgent<Client> {
public start() { public start() {
this.client.start(); this.client.start();
// TODO get rid of this gay shit
this.client.setChannel("blackmidi (huge lag)");
} }
public stop() { public stop() {
@ -27,23 +30,32 @@ export class MPPAgent extends ServiceAgent<Client> {
this.client.on("hi", msg => { this.client.on("hi", msg => {
this.emit("log", msg.u); this.emit("log", msg.u);
this.client.setChannel(this.desiredChannel);
console.log(
msg.u.name !== this.desiredUser.name ||
msg.u.color !== this.desiredUser.color
);
if ( if (
msg.u.name !== this.desiredUser.name || msg.u.name !== this.desiredUser.name ||
msg.u.color !== this.desiredUser.color msg.u.color !== this.desiredUser.color
) { ) {
// setTimeout(() => {
this.client.sendArray([ this.client.sendArray([
{ {
m: "userset", m: "userset",
set: this.desiredUser set: this.desiredUser
} }
]); ]);
// }, 1000);
} }
}); });
this.client.on("a", msg => { this.client.on("a", msg => {
const argv = msg.a.split(" "); p = ptr(new TextEncoder().encode(msg.a).buffer);
const argc = argv.length; // handleCommand(p);
console.log(`${msg.p.name}: ${msg.a}`);
}); });
} }
} }