diff --git a/src/server/dispatcher.ts b/src/server/dispatcher.ts index bc53aad3..7c8a8277 100644 --- a/src/server/dispatcher.ts +++ b/src/server/dispatcher.ts @@ -27,6 +27,7 @@ export class ServerDispatcher extends BaseDispatcher { } catch (err) { this.handleError(player, text, err); interactionData = { + path: commandPath, executor: player, text, reply: { @@ -52,7 +53,7 @@ export class ServerDispatcher extends BaseDispatcher { return this.executeCommand(path, executor, text).catch((err) => { this.handleError(executor, text, err); - const interaction = new CommandInteraction(executor, text); + const interaction = new CommandInteraction(path, executor, text); interaction.error("An error occurred."); return interaction; }); diff --git a/src/shared/core/dispatcher.ts b/src/shared/core/dispatcher.ts index 51ed07ea..a5a9de66 100644 --- a/src/shared/core/dispatcher.ts +++ b/src/shared/core/dispatcher.ts @@ -15,7 +15,7 @@ export abstract class BaseDispatcher { text: string, ) { const command = this.registry.getCommand(path); - const interaction = new CommandInteraction(executor, text); + const interaction = new CommandInteraction(path, executor, text); if (command === undefined) { interaction.error("Command not found."); diff --git a/src/shared/core/interaction.ts b/src/shared/core/interaction.ts index 5a6622ec..40f930bc 100644 --- a/src/shared/core/interaction.ts +++ b/src/shared/core/interaction.ts @@ -1,4 +1,5 @@ import { CommandInteractionData, CommandReply } from "../types"; +import { CommandPath } from "./path"; /** * A data structure containing the executor of a command, the @@ -9,6 +10,7 @@ export class CommandInteraction { private replyData?: CommandReply; constructor( + readonly path: CommandPath, readonly executor: Player, readonly text: string, ) {} @@ -22,6 +24,7 @@ export class CommandInteraction { */ getData(): CommandInteractionData { return { + path: this.path, executor: this.executor, text: this.text, reply: this.replyData, diff --git a/src/shared/types.ts b/src/shared/types.ts index fd554d89..26326e2f 100644 --- a/src/shared/types.ts +++ b/src/shared/types.ts @@ -1,6 +1,7 @@ import { Result } from "@rbxts/rust-classes"; import { t } from "@rbxts/t"; import { CommandInteraction } from "./core/interaction"; +import { CommandPath } from "./core/path"; export type CommandGuard = ( runNext: () => void, @@ -53,6 +54,7 @@ export interface CommandReply { } export interface CommandInteractionData { + path: CommandPath; executor: Player; text: string; reply?: CommandReply;