mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-02 04:56:07 +00:00
feat(types): type AnyContext
This commit is contained in:
parent
00d7f75610
commit
3cb52086cb
3
src/cache/index.ts
vendored
3
src/cache/index.ts
vendored
@ -33,6 +33,9 @@ import {
|
||||
import type { InternalOptions, UsingClient } from '../commands';
|
||||
import { Overwrites } from './resources/overwrites';
|
||||
import { Messages } from './resources/messages';
|
||||
export { BaseResource } from './resources/default/base';
|
||||
export { GuildRelatedResource } from './resources/default/guild-related';
|
||||
export { GuildBasedResource } from './resources/default/guild-based';
|
||||
|
||||
export type InferAsyncCache = InternalOptions extends { asyncCache: infer P } ? P : false;
|
||||
export type ReturnCache<T> = If<InferAsyncCache, Promise<T>, T>;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { ApplicationCommandOptionType, type APIApplicationCommandOptionChoice, type ChannelType } from '../../types';
|
||||
import type {
|
||||
AutocompleteCallback,
|
||||
EntryPointContext,
|
||||
MenuCommandContext,
|
||||
OnAutocompleteErrorCallback,
|
||||
ReturnOptionsTypes,
|
||||
@ -82,17 +83,13 @@ export function createAttachmentOption<T extends SeyfertAttachmentOption = Seyfe
|
||||
return { ...data, type: ApplicationCommandOptionType.Attachment } as const;
|
||||
}
|
||||
|
||||
export function createMiddleware<
|
||||
T = any,
|
||||
C extends
|
||||
| CommandContext
|
||||
| MenuCommandContext<MessageCommandInteraction<boolean> | UserCommandInteraction<boolean>>
|
||||
| ComponentContext
|
||||
| ModalContext =
|
||||
| CommandContext
|
||||
| MenuCommandContext<MessageCommandInteraction<boolean> | UserCommandInteraction<boolean>>
|
||||
| ComponentContext
|
||||
| ModalContext,
|
||||
>(data: MiddlewareContext<T, C>) {
|
||||
export type AnyContext =
|
||||
| CommandContext
|
||||
| MenuCommandContext<MessageCommandInteraction<boolean> | UserCommandInteraction<boolean>>
|
||||
| ComponentContext
|
||||
| ModalContext
|
||||
| EntryPointContext;
|
||||
|
||||
export function createMiddleware<T = any, C extends AnyContext = AnyContext>(data: MiddlewareContext<T, C>) {
|
||||
return data;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user