Rename to solar

This commit is contained in:
Hri7566 2023-10-27 14:54:18 -04:00
parent be10818d04
commit 5961c48ff6
10 changed files with 47 additions and 13 deletions

BIN
bun.lockb

Binary file not shown.

View File

@ -9,7 +9,8 @@
"devDependencies": { "devDependencies": {
"@types/react": "^18.2.21", "@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7", "@types/react-dom": "^18.2.7",
"bun-types": "latest" "bun-types": "latest",
"postcss-import": "^15.1.0"
}, },
"peerDependencies": { "peerDependencies": {
"typescript": "^5.0.0" "typescript": "^5.0.0"
@ -17,6 +18,7 @@
"dependencies": { "dependencies": {
"mppclone-client": "^1.1.3", "mppclone-client": "^1.1.3",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0" "react-dom": "^18.2.0",
"tailwindcss": "^3.3.5"
} }
} }

View File

@ -56,7 +56,7 @@ async function build() {
.toString(); .toString();
const artifact = fs.readFileSync("build/index.js").toString(); const artifact = fs.readFileSync("build/index.js").toString();
fs.writeFileSync("build/Saturn.user.js", userscriptHeader + artifact); fs.writeFileSync("build/Solar.user.js", userscriptHeader + artifact);
console.log("Done"); console.log("Done");
} }

View File

@ -1,9 +1,10 @@
// ==UserScript== // ==UserScript==
// @name Saturn // @name Solar
// @namespace MPP // @namespace MPP
// @match https://mppclone.com/* // @match https://mppclone.com/*
// @match https://multiplayerpiano.net/*
// @grant none // @grant none
// @version 1.0 // @version 1.0
// @author Hri7566, Foonix // @author Hri7566
// @description 9/15/2023, 6:42:49 AM // @description 9/15/2023, 6:42:49 AM
// ==/UserScript== // ==/UserScript==

View File

@ -8,5 +8,3 @@ export const help = new Command(
return "help menu TODO"; return "help menu TODO";
} }
); );
console.log(help);

View File

@ -18,13 +18,20 @@ export class CommandHandler {
public static commandGroups = new Array<CommandGroup>(); public static commandGroups = new Array<CommandGroup>();
public static handleCommand(msg: CustomChatMessage) { public static handleCommand(msg: CustomChatMessage) {
let foundCommand: Command | undefined;
for (const group of this.commandGroups) { for (const group of this.commandGroups) {
for (const command of group.commands) { for (const command of group.commands) {
command.callback(msg); for (const alias of command.aliases) {
} }
} }
} }
if (!foundCommand) return;
foundCommand.callback(msg);
}
public static addCommandGroup(commandGroup: CommandGroup) { public static addCommandGroup(commandGroup: CommandGroup) {
this.commandGroups.push(commandGroup); this.commandGroups.push(commandGroup);
} }

View File

@ -6,10 +6,10 @@ export interface CustomChatMessage extends ChatMessage {
} }
export class ChatBot { export class ChatBot {
public static prefixes = ["sat"]; public static prefixes = ["sol"];
public static handleMessage(msg: ChatMessage) { public static handleMessage(msg: ChatMessage) {
console.log(`[Saturn] ${msg.p.name}: ${msg.a}`); console.log(`[Solar] ${msg.p.name}: ${msg.a}`);
let usedPrefix: string | undefined; let usedPrefix: string | undefined;

7
src/ui/App.tsx Normal file
View File

@ -0,0 +1,7 @@
import ReactDOM from "react-dom/client";
import React from "react";
import { Chat } from "./chat";
export function App(props: React.PropsWithChildren) {
return <Chat />;
}

16
src/ui/chat/index.tsx Normal file
View File

@ -0,0 +1,16 @@
import ReactDOM from "react-dom/client";
import React from "react";
export function Chat() {
return (
<div id="#chat">
<ul></ul>
<input
id="chat-input"
type="text"
className="translate"
maxLength={512}
/>
</div>
);
}

View File

@ -1,12 +1,15 @@
import ReactDOM from "react-dom/client"; import ReactDOM from "react-dom/client";
import React from "react"; import React from "react";
import { App } from "./App";
const document = (globalThis as any).document; const document = (globalThis as any).document;
const reactRoot = document.createElement("div"); const reactRoot = document.createElement("div");
reactRoot.setAttribute("id", "saturn"); reactRoot.setAttribute("id", "solar");
document.body.appendChild(reactRoot); document.body.appendChild(reactRoot);
const root = ReactDOM.createRoot(reactRoot); const root = ReactDOM.createRoot(reactRoot);
const test = <p></p>; // document.querySelector("#chat").remove();
root.render(test);
const r = <App></App>;
root.render(r);