mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-02 21:16:09 +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,
|
WebhookMessageStructure,
|
||||||
} from '../../client/transformers';
|
} from '../../client/transformers';
|
||||||
import type { If, MakeRequired, UnionToTuple, When } from '../../common';
|
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 { type AllChannels, ChatInputCommandInteraction, type Message } from '../../structures';
|
||||||
import { MessageFlags } from '../../types';
|
import { MessageFlags } from '../../types';
|
||||||
import { BaseContext } from '../basecontext';
|
import { BaseContext } from '../basecontext';
|
||||||
@ -54,14 +58,6 @@ export class CommandContext<
|
|||||||
metadata: CommandMetadata<UnionToTuple<M>> = {} as never;
|
metadata: CommandMetadata<UnionToTuple<M>> = {} as never;
|
||||||
globalMetadata: GlobalMetadata = {};
|
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() {
|
get fullCommandName() {
|
||||||
return this.resolver.fullCommandName;
|
return this.resolver.fullCommandName;
|
||||||
}
|
}
|
||||||
@ -136,6 +132,11 @@ export class CommandContext<
|
|||||||
return this.write(body as InteractionCreateBodyRequest, withResponse);
|
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<
|
async fetchResponse(): Promise<
|
||||||
If<InferWithPrefix, WebhookMessageStructure | MessageStructure, WebhookMessageStructure>
|
If<InferWithPrefix, WebhookMessageStructure | MessageStructure, WebhookMessageStructure>
|
||||||
> {
|
> {
|
||||||
|
@ -10,6 +10,7 @@ import type {
|
|||||||
InteractionCreateBodyRequest,
|
InteractionCreateBodyRequest,
|
||||||
InteractionMessageUpdateBodyRequest,
|
InteractionMessageUpdateBodyRequest,
|
||||||
MakeRequired,
|
MakeRequired,
|
||||||
|
MessageWebhookCreateBodyRequest,
|
||||||
ModalCreateBodyRequest,
|
ModalCreateBodyRequest,
|
||||||
UnionToTuple,
|
UnionToTuple,
|
||||||
When,
|
When,
|
||||||
@ -77,6 +78,10 @@ export class EntryPointContext<M extends keyof RegisteredMiddlewares = never> ex
|
|||||||
return this.interaction.editOrReply<WR>(body as InteractionCreateBodyRequest, withResponse);
|
return this.interaction.editOrReply<WR>(body as InteractionCreateBodyRequest, withResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
followup(body: MessageWebhookCreateBodyRequest) {
|
||||||
|
return this.interaction.followup(body);
|
||||||
|
}
|
||||||
|
|
||||||
fetchResponse(): Promise<WebhookMessageStructure> {
|
fetchResponse(): Promise<WebhookMessageStructure> {
|
||||||
return this.interaction.fetchResponse();
|
return this.interaction.fetchResponse();
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
type InteractionCreateBodyRequest,
|
type InteractionCreateBodyRequest,
|
||||||
type InteractionMessageUpdateBodyRequest,
|
type InteractionMessageUpdateBodyRequest,
|
||||||
type MakeRequired,
|
type MakeRequired,
|
||||||
|
type MessageWebhookCreateBodyRequest,
|
||||||
type ModalCreateBodyRequest,
|
type ModalCreateBodyRequest,
|
||||||
type UnionToTuple,
|
type UnionToTuple,
|
||||||
type When,
|
type When,
|
||||||
@ -101,6 +102,10 @@ export class MenuCommandContext<
|
|||||||
return this.interaction.editOrReply<WR>(body as InteractionCreateBodyRequest, withResponse);
|
return this.interaction.editOrReply<WR>(body as InteractionCreateBodyRequest, withResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
followup(body: MessageWebhookCreateBodyRequest) {
|
||||||
|
return this.interaction.followup(body);
|
||||||
|
}
|
||||||
|
|
||||||
fetchResponse(): Promise<WebhookMessageStructure> {
|
fetchResponse(): Promise<WebhookMessageStructure> {
|
||||||
return this.interaction.fetchResponse();
|
return this.interaction.fetchResponse();
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import type {
|
|||||||
InteractionCreateBodyRequest,
|
InteractionCreateBodyRequest,
|
||||||
InteractionMessageUpdateBodyRequest,
|
InteractionMessageUpdateBodyRequest,
|
||||||
MakeRequired,
|
MakeRequired,
|
||||||
|
MessageWebhookCreateBodyRequest,
|
||||||
ModalCreateBodyRequest,
|
ModalCreateBodyRequest,
|
||||||
UnionToTuple,
|
UnionToTuple,
|
||||||
When,
|
When,
|
||||||
@ -130,6 +131,10 @@ export class ComponentContext<
|
|||||||
return this.interaction.editOrReply<FR>(body as InteractionCreateBodyRequest, fetchReply);
|
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
|
* @returns A Promise that resolves to the fetched message
|
||||||
*/
|
*/
|
||||||
|
@ -12,6 +12,7 @@ import type {
|
|||||||
InteractionCreateBodyRequest,
|
InteractionCreateBodyRequest,
|
||||||
InteractionMessageUpdateBodyRequest,
|
InteractionMessageUpdateBodyRequest,
|
||||||
MakeRequired,
|
MakeRequired,
|
||||||
|
MessageWebhookCreateBodyRequest,
|
||||||
ModalCreateBodyRequest,
|
ModalCreateBodyRequest,
|
||||||
UnionToTuple,
|
UnionToTuple,
|
||||||
When,
|
When,
|
||||||
@ -99,6 +100,10 @@ export class ModalContext<M extends keyof RegisteredMiddlewares = never> extends
|
|||||||
return this.interaction.editOrReply<FR>(body as InteractionCreateBodyRequest, fetchReply);
|
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
|
* @returns A Promise that resolves to the fetched message
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user