mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
feat: add AnyContext.followup (#318)
* fix: return support node18 * feat: support AnyContext.followup
This commit is contained in:
parent
ac2df8133b
commit
ff55a78793
@ -10,7 +10,11 @@ import type {
|
||||
WebhookMessageStructure,
|
||||
} from '../../client/transformers';
|
||||
import type { If, MakeRequired, UnionToTuple, When } from '../../common';
|
||||
import type { InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest } from '../../common/types/write';
|
||||
import type {
|
||||
InteractionCreateBodyRequest,
|
||||
InteractionMessageUpdateBodyRequest,
|
||||
MessageWebhookCreateBodyRequest,
|
||||
} from '../../common/types/write';
|
||||
import { type AllChannels, ChatInputCommandInteraction, type Message } from '../../structures';
|
||||
import { MessageFlags } from '../../types';
|
||||
import { BaseContext } from '../basecontext';
|
||||
@ -54,14 +58,6 @@ export class CommandContext<
|
||||
metadata: CommandMetadata<UnionToTuple<M>> = {} as never;
|
||||
globalMetadata: GlobalMetadata = {};
|
||||
|
||||
get proxy() {
|
||||
return this.client.proxy;
|
||||
}
|
||||
|
||||
get t() {
|
||||
return this.client.t(this.interaction?.locale ?? this.client.langs.defaultLang ?? 'en-US');
|
||||
}
|
||||
|
||||
get fullCommandName() {
|
||||
return this.resolver.fullCommandName;
|
||||
}
|
||||
@ -136,6 +132,11 @@ export class CommandContext<
|
||||
return this.write(body as InteractionCreateBodyRequest, withResponse);
|
||||
}
|
||||
|
||||
followup(body: MessageWebhookCreateBodyRequest) {
|
||||
if (this.interaction) return this.interaction.followup(body);
|
||||
return this.messageResponse!.reply(body);
|
||||
}
|
||||
|
||||
async fetchResponse(): Promise<
|
||||
If<InferWithPrefix, WebhookMessageStructure | MessageStructure, WebhookMessageStructure>
|
||||
> {
|
||||
|
@ -10,6 +10,7 @@ import type {
|
||||
InteractionCreateBodyRequest,
|
||||
InteractionMessageUpdateBodyRequest,
|
||||
MakeRequired,
|
||||
MessageWebhookCreateBodyRequest,
|
||||
ModalCreateBodyRequest,
|
||||
UnionToTuple,
|
||||
When,
|
||||
@ -77,6 +78,10 @@ export class EntryPointContext<M extends keyof RegisteredMiddlewares = never> ex
|
||||
return this.interaction.editOrReply<WR>(body as InteractionCreateBodyRequest, withResponse);
|
||||
}
|
||||
|
||||
followup(body: MessageWebhookCreateBodyRequest) {
|
||||
return this.interaction.followup(body);
|
||||
}
|
||||
|
||||
fetchResponse(): Promise<WebhookMessageStructure> {
|
||||
return this.interaction.fetchResponse();
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import {
|
||||
type InteractionCreateBodyRequest,
|
||||
type InteractionMessageUpdateBodyRequest,
|
||||
type MakeRequired,
|
||||
type MessageWebhookCreateBodyRequest,
|
||||
type ModalCreateBodyRequest,
|
||||
type UnionToTuple,
|
||||
type When,
|
||||
@ -101,6 +102,10 @@ export class MenuCommandContext<
|
||||
return this.interaction.editOrReply<WR>(body as InteractionCreateBodyRequest, withResponse);
|
||||
}
|
||||
|
||||
followup(body: MessageWebhookCreateBodyRequest) {
|
||||
return this.interaction.followup(body);
|
||||
}
|
||||
|
||||
fetchResponse(): Promise<WebhookMessageStructure> {
|
||||
return this.interaction.fetchResponse();
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import type {
|
||||
InteractionCreateBodyRequest,
|
||||
InteractionMessageUpdateBodyRequest,
|
||||
MakeRequired,
|
||||
MessageWebhookCreateBodyRequest,
|
||||
ModalCreateBodyRequest,
|
||||
UnionToTuple,
|
||||
When,
|
||||
@ -130,6 +131,10 @@ export class ComponentContext<
|
||||
return this.interaction.editOrReply<FR>(body as InteractionCreateBodyRequest, fetchReply);
|
||||
}
|
||||
|
||||
followup(body: MessageWebhookCreateBodyRequest) {
|
||||
return this.interaction.followup(body);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns A Promise that resolves to the fetched message
|
||||
*/
|
||||
|
@ -12,6 +12,7 @@ import type {
|
||||
InteractionCreateBodyRequest,
|
||||
InteractionMessageUpdateBodyRequest,
|
||||
MakeRequired,
|
||||
MessageWebhookCreateBodyRequest,
|
||||
ModalCreateBodyRequest,
|
||||
UnionToTuple,
|
||||
When,
|
||||
@ -99,6 +100,10 @@ export class ModalContext<M extends keyof RegisteredMiddlewares = never> extends
|
||||
return this.interaction.editOrReply<FR>(body as InteractionCreateBodyRequest, fetchReply);
|
||||
}
|
||||
|
||||
followup(body: MessageWebhookCreateBodyRequest) {
|
||||
return this.interaction.followup(body);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns A Promise that resolves to the fetched message
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user