Skip to content

Commit f3515b5

Browse files
committed
maybe this will fix commands
1 parent de3f4ff commit f3515b5

File tree

10 files changed

+34
-44
lines changed

10 files changed

+34
-44
lines changed

dist/vendetta.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/def.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,14 @@ interface Settings {
168168
export interface ApplicationCommand {
169169
description: string;
170170
name: string;
171-
options: ApplicationCommandOption[];
171+
options?: ApplicationCommandOption[];
172172
execute: (args: any[], ctx: CommandContext) => CommandResult | void | Promise<CommandResult> | Promise<void>;
173173
id?: string;
174-
applicationId: string;
175-
displayName: string;
176-
displayDescription: string;
177-
inputType: ApplicationCommandInputType;
178-
type: ApplicationCommandType;
174+
applicationId?: string;
175+
displayName?: string;
176+
displayDescription?: string;
177+
inputType?: ApplicationCommandInputType;
178+
type?: ApplicationCommandType;
179179
}
180180

181181
export enum ApplicationCommandInputType {

src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { initBadges } from "@/lib/badge/badges";
1111
import logger from "@lib/logger";
1212
import windowObject from "@lib/windowObject";
1313
import { initTweaks } from "./lib/tweak";
14-
import { initCustomCommands } from "./lib/command";
1514

1615
export default async () => {
1716
const unloads = await Promise.all([

src/lib/command/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import { registerCommand } from "../commands";
2-
import debug from "./debug";
3-
import reload from "./reload";
2+
import testing from "./testing";
43

54
export function initCustomCommands(): void {
65
const customCommands = [
7-
...debug,
8-
...reload,
6+
...testing,
97
];
108

11-
registerCommand(customCommands);
9+
// registerCommand(customCommands);
1210
}
1311

1412
export default { initCustomCommands };

src/lib/command/plugins.tsx

Whitespace-only changes.

src/lib/command/print.tsx

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/lib/command/reload.tsx

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/lib/command/shaders.tsx

Whitespace-only changes.

src/lib/command/debug.tsx renamed to src/lib/command/testing.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ import { getAssetIDByName } from "@/ui/assets";
44

55
export default [
66
{
7-
name: 'balls',
7+
name: 'testing',
88
description: 'this makes the balls ball',
9-
execute: Messages.sendBotMessage("hi world!")
9+
execute() {
10+
Messages.sendBotMessage("hi world!");
11+
},
12+
13+
1014
},
1115
] as ApplicationCommand[]
1216

src/lib/commands.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ApplicationCommand, ApplicationCommandInputType, ApplicationCommandType } from "@types";
22
import { commands as commandsModule } from "@metro/common";
33
import { after } from "@lib/patcher";
4+
import testing from "./command/testing";
45

56
let commands: ApplicationCommand[] = [];
67

@@ -15,19 +16,20 @@ export function patchCommands() {
1516
};
1617
}
1718

18-
export function registerCommand(command: ApplicationCommand[]): void {
19-
for(const commandE in command) {
19+
export function registerCommand(command: ApplicationCommand): () => void {
2020
const builtInCommands = commandsModule.getBuiltInCommands(ApplicationCommandType.CHAT, true, false);
2121
builtInCommands.sort((a: ApplicationCommand, b: ApplicationCommand) => parseInt(b.id!) - parseInt(a.id!));
2222
const lastCommand = builtInCommands[builtInCommands.length - 1];
23-
const cmd = command[commandE];
2423

25-
command[commandE] = {
26-
id: (parseInt(lastCommand.id, 10) - 1).toString(),
27-
...cmd,
28-
};
29-
}
24+
command.id = (parseInt(lastCommand.id, 10) - 1).toString();
25+
command.displayName ??= command.name;
26+
command.displayDescription ??= command.description;
27+
command.inputType = ApplicationCommandInputType.BUILT_IN;
3028

31-
commands.push(...command);
29+
30+
commands.push(...testing);
31+
commands.push(command);
32+
33+
return () => (commands = commands.filter(({ id }) => id !== command.id));
3234
}
3335

0 commit comments

Comments
 (0)