Emergency push

This commit is contained in:
Hri7566 2023-10-16 14:35:05 -04:00
parent 1cdfd3c82c
commit 93a31b87be
6 changed files with 48 additions and 2 deletions

View File

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

View File

@ -3,8 +3,13 @@ import EventEmitter from "events";
export abstract class ServiceAgent<T> extends EventEmitter {
constructor(public client: T) {
super();
this.bindEventListeners();
}
public abstract start(): void;
public abstract stop(): void;
protected bindEventListeners() {
this.on("log", txt => console.log(txt));
}
}

View File

@ -7,7 +7,11 @@ export class ServiceLoader {
public static agents = new Array<ServiceAgent<unknown>>();
public static loadServices() {
const testAgent = new MPPAgent("wss://mppclone.com", env.MPPNET_TOKEN);
const testAgent = new MPPAgent(
"wss://smnmpp.hri7566.info:8448",
env.MPPNET_TOKEN
);
testAgent.start();
}
}

View File

@ -2,6 +2,11 @@ import Client from "mpp-client-net";
import { ServiceAgent } from "../ServiceAgent";
export class MPPAgent extends ServiceAgent<Client> {
public desiredUser = {
name: "🟇 𝙎𝙪𝙥𝙚𝙧 Cosmic (*help)",
color: "#1d0054"
};
constructor(uri: string, token: string) {
const cl = new Client(uri, token);
super(cl);
@ -10,10 +15,35 @@ export class MPPAgent extends ServiceAgent<Client> {
public start() {
this.client.start();
// TODO get rid of this gay shit
this.client.setChannel("Simon Says");
this.client.setChannel("blackmidi (huge lag)");
}
public stop() {
this.client.stop();
}
protected bindEventListeners(): void {
super.bindEventListeners();
this.client.on("hi", msg => {
this.emit("log", msg.u);
if (
msg.u.name !== this.desiredUser.name ||
msg.u.color !== this.desiredUser.color
) {
this.client.sendArray([
{
m: "userset",
set: this.desiredUser
}
]);
}
});
this.client.on("a", msg => {
const argv = msg.a.split(" ");
const argc = argv.length;
});
}
}

View File

@ -1,5 +1,8 @@
import z from "zod";
import { createEnv } from "@t3-oss/env-core";
import { configDotenv } from "dotenv";
configDotenv();
export const env = createEnv({
isServer: true,