From 42e6ee24a28485ef89796db0b0eff00ad0692dec Mon Sep 17 00:00:00 2001 From: kaname-png Date: Fri, 2 Sep 2022 15:14:05 -0600 Subject: [PATCH] fix: some errors --- src/listeners/commands/accepted.ts | 6 +++--- src/utils/interfaces/command.ts | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/listeners/commands/accepted.ts b/src/listeners/commands/accepted.ts index 9ae8c2f..3224135 100644 --- a/src/listeners/commands/accepted.ts +++ b/src/listeners/commands/accepted.ts @@ -3,7 +3,7 @@ import { Result } from '@sapphire/result'; import { Listener } from '../../lib/structures/listener'; import { CommandEvents } from '../../utils/enums/command'; -import type { CommandAcceptedPayload } from '../../utils/interfaces/command'; +import type { CommandAcceptedPayload, CommandRunContext } from '../../utils/interfaces/command'; export class CoreListener extends Listener { public constructor(context: PieceContext) { @@ -12,8 +12,8 @@ export class CoreListener extends Listener { }); } - public async run(payload: CommandAcceptedPayload) { - const { command, message, parameters, context } = payload; + public async run(payload: CommandAcceptedPayload, context: CommandRunContext) { + const { command, message, parameters } = payload; const args = await command.preParse(message, parameters, context); const result = await Result.fromAsync(async () => { this.container.client.emit(CommandEvents.CommandRun, { command, message }); diff --git a/src/utils/interfaces/command.ts b/src/utils/interfaces/command.ts index 99e9bd6..5c92f7b 100644 --- a/src/utils/interfaces/command.ts +++ b/src/utils/interfaces/command.ts @@ -1,4 +1,5 @@ import type { AliasPieceJSON, AliasPieceOptions } from '@sapphire/pieces'; +import type { ResultError } from '@sapphire/result'; import type { NonNullObject } from '@sapphire/utilities'; import type { Message, API } from 'revolt.js'; @@ -142,7 +143,7 @@ export interface CommandAcceptedPayload extends CommandPreAcceptedPayload { export interface CommandErrorPayload { command: Command; message: Message; - error: unknown; + error: ResultError; } export interface CommandNameNotFoundPayload {