mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 12:36:08 +00:00
feat: make deferReplyResponse and reply awaitable
This commit is contained in:
parent
23c9c2a710
commit
92ab65be7b
@ -219,8 +219,8 @@ export interface ClientOptions extends BaseClientOptions {
|
||||
};
|
||||
commands?: BaseClientOptions['commands'] & {
|
||||
prefix?: (message: MessageStructure) => Awaitable<string[]>;
|
||||
deferReplyResponse?: (ctx: CommandContext) => Parameters<Message['write']>[0];
|
||||
reply?: (ctx: CommandContext) => boolean;
|
||||
deferReplyResponse?: (ctx: CommandContext) => Awaitable<Parameters<Message['write']>[0]>;
|
||||
reply?: (ctx: CommandContext) => Awaitable<boolean>;
|
||||
};
|
||||
handlePayload?: ShardManagerOptions['handlePayload'];
|
||||
resharding?: PickPartial<NonNullable<ShardManagerOptions['resharding']>, 'getInfo'>;
|
||||
|
@ -79,7 +79,7 @@ export class CommandContext<
|
||||
if (this.interaction) return this.interaction.write(body, withResponse);
|
||||
const options = (this.client as Client | WorkerClient).options?.commands;
|
||||
return (this.messageResponse = await (this.message! as Message)[
|
||||
!this.messageResponse && options?.reply?.(this) ? 'reply' : 'write'
|
||||
!this.messageResponse && (await options?.reply?.(this)) ? 'reply' : 'write'
|
||||
](body)) as never;
|
||||
}
|
||||
|
||||
@ -97,8 +97,8 @@ export class CommandContext<
|
||||
return this.interaction.deferReply(ephemeral ? MessageFlags.Ephemeral : undefined, withResponse);
|
||||
this.__deferred = true;
|
||||
const options = (this.client as Client | WorkerClient).options?.commands;
|
||||
return (this.messageResponse = await (this.message! as Message)[options?.reply?.(this) ? 'reply' : 'write'](
|
||||
options?.deferReplyResponse?.(this) ?? { content: 'Thinking...' },
|
||||
return (this.messageResponse = await (this.message! as Message)[(await options?.reply?.(this)) ? 'reply' : 'write'](
|
||||
(await options?.deferReplyResponse?.(this)) ?? { content: 'Thinking...' },
|
||||
)) as never;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user