mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-04 22:16:08 +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 type { InternalOptions, UsingClient } from '../commands';
|
||||||
import { Overwrites } from './resources/overwrites';
|
import { Overwrites } from './resources/overwrites';
|
||||||
import { Messages } from './resources/messages';
|
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 InferAsyncCache = InternalOptions extends { asyncCache: infer P } ? P : false;
|
||||||
export type ReturnCache<T> = If<InferAsyncCache, Promise<T>, T>;
|
export type ReturnCache<T> = If<InferAsyncCache, Promise<T>, T>;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { ApplicationCommandOptionType, type APIApplicationCommandOptionChoice, type ChannelType } from '../../types';
|
import { ApplicationCommandOptionType, type APIApplicationCommandOptionChoice, type ChannelType } from '../../types';
|
||||||
import type {
|
import type {
|
||||||
AutocompleteCallback,
|
AutocompleteCallback,
|
||||||
|
EntryPointContext,
|
||||||
MenuCommandContext,
|
MenuCommandContext,
|
||||||
OnAutocompleteErrorCallback,
|
OnAutocompleteErrorCallback,
|
||||||
ReturnOptionsTypes,
|
ReturnOptionsTypes,
|
||||||
@ -82,17 +83,13 @@ export function createAttachmentOption<T extends SeyfertAttachmentOption = Seyfe
|
|||||||
return { ...data, type: ApplicationCommandOptionType.Attachment } as const;
|
return { ...data, type: ApplicationCommandOptionType.Attachment } as const;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createMiddleware<
|
export type AnyContext =
|
||||||
T = any,
|
| CommandContext
|
||||||
C extends
|
| MenuCommandContext<MessageCommandInteraction<boolean> | UserCommandInteraction<boolean>>
|
||||||
| CommandContext
|
| ComponentContext
|
||||||
| MenuCommandContext<MessageCommandInteraction<boolean> | UserCommandInteraction<boolean>>
|
| ModalContext
|
||||||
| ComponentContext
|
| EntryPointContext;
|
||||||
| ModalContext =
|
|
||||||
| CommandContext
|
export function createMiddleware<T = any, C extends AnyContext = AnyContext>(data: MiddlewareContext<T, C>) {
|
||||||
| MenuCommandContext<MessageCommandInteraction<boolean> | UserCommandInteraction<boolean>>
|
|
||||||
| ComponentContext
|
|
||||||
| ModalContext,
|
|
||||||
>(data: MiddlewareContext<T, C>) {
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user