Emergency push
This commit is contained in:
parent
1cdfd3c82c
commit
93a31b87be
|
@ -0,0 +1,4 @@
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn handleCommand(argc: isize, argv: ) {
|
||||||
|
|
||||||
|
}
|
|
@ -3,8 +3,13 @@ import EventEmitter from "events";
|
||||||
export abstract class ServiceAgent<T> extends EventEmitter {
|
export abstract class ServiceAgent<T> extends EventEmitter {
|
||||||
constructor(public client: T) {
|
constructor(public client: T) {
|
||||||
super();
|
super();
|
||||||
|
this.bindEventListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract start(): void;
|
public abstract start(): void;
|
||||||
public abstract stop(): void;
|
public abstract stop(): void;
|
||||||
|
|
||||||
|
protected bindEventListeners() {
|
||||||
|
this.on("log", txt => console.log(txt));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,11 @@ export class ServiceLoader {
|
||||||
public static agents = new Array<ServiceAgent<unknown>>();
|
public static agents = new Array<ServiceAgent<unknown>>();
|
||||||
|
|
||||||
public static loadServices() {
|
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();
|
testAgent.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,11 @@ import Client from "mpp-client-net";
|
||||||
import { ServiceAgent } from "../ServiceAgent";
|
import { ServiceAgent } from "../ServiceAgent";
|
||||||
|
|
||||||
export class MPPAgent extends ServiceAgent<Client> {
|
export class MPPAgent extends ServiceAgent<Client> {
|
||||||
|
public desiredUser = {
|
||||||
|
name: "🟇 𝙎𝙪𝙥𝙚𝙧 Cosmic (*help)",
|
||||||
|
color: "#1d0054"
|
||||||
|
};
|
||||||
|
|
||||||
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);
|
||||||
|
@ -10,10 +15,35 @@ export class MPPAgent extends ServiceAgent<Client> {
|
||||||
public start() {
|
public start() {
|
||||||
this.client.start();
|
this.client.start();
|
||||||
// TODO get rid of this gay shit
|
// TODO get rid of this gay shit
|
||||||
this.client.setChannel("Simon Says");
|
this.client.setChannel("blackmidi (huge lag)");
|
||||||
}
|
}
|
||||||
|
|
||||||
public stop() {
|
public stop() {
|
||||||
this.client.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;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
import z from "zod";
|
import z from "zod";
|
||||||
import { createEnv } from "@t3-oss/env-core";
|
import { createEnv } from "@t3-oss/env-core";
|
||||||
|
import { configDotenv } from "dotenv";
|
||||||
|
|
||||||
|
configDotenv();
|
||||||
|
|
||||||
export const env = createEnv({
|
export const env = createEnv({
|
||||||
isServer: true,
|
isServer: true,
|
||||||
|
|
Loading…
Reference in New Issue