mirror of
https://github.com/sern-handler/handler
synced 2026-06-28 02:32:15 +00:00
style: pretty please (#162)
* style: pretty please * feat: no package.lock.json anymore Co-authored-by: jacoobes <jacoobes@users.noreply.github.com> Co-authored-by: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
71cec6f142
commit
8d18c4b182
@@ -22,36 +22,43 @@ export type SlashOptions = Omit<CommandInteractionOptionResolver, 'getMessage' |
|
||||
*/
|
||||
export type DefinedCommandModule = CommandModule & { name: string; description: string };
|
||||
export type DefinedEventModule = EventModule & { name: string };
|
||||
export type AnyDefinedModule = DefinedCommandModule | DefinedEventModule
|
||||
export type AnyDefinedModule = DefinedCommandModule | DefinedEventModule;
|
||||
export type Payload =
|
||||
| { type: PayloadType.Success; module: AnyModule }
|
||||
| { type: PayloadType.Failure; module?: AnyModule; reason: string | Error }
|
||||
| { type: PayloadType.Warning; reason: string};
|
||||
| { type: PayloadType.Warning; reason: string };
|
||||
export type SernEventsMapping = {
|
||||
'module.register': [Payload];
|
||||
'module.activate': [Payload];
|
||||
'error': [Payload];
|
||||
'warning': [Payload];
|
||||
error: [Payload];
|
||||
warning: [Payload];
|
||||
};
|
||||
export type LogPayload<T = unknown> = { message: T }
|
||||
export type Singleton<T> = () => T
|
||||
export type LogPayload<T = unknown> = { message: T };
|
||||
export type Singleton<T> = () => T;
|
||||
export type Transient<T> = () => () => T;
|
||||
|
||||
export interface Dependencies {
|
||||
'@sern/client': Singleton<EventEmitter>;
|
||||
'@sern/logger'?: Singleton<Logging>;
|
||||
'@sern/emitter': Singleton<SernEmitter>;
|
||||
'@sern/store' : Singleton<ModuleStore>;
|
||||
'@sern/modules' : Singleton<ModuleManager>;
|
||||
'@sern/store': Singleton<ModuleStore>;
|
||||
'@sern/modules': Singleton<ModuleManager>;
|
||||
'@sern/errors': Singleton<ErrorHandling>;
|
||||
}
|
||||
|
||||
export type ReplyOptions = string | Omit<InteractionReplyOptions, 'fetchReply'> | MessageReplyOptions;
|
||||
export type ReplyOptions =
|
||||
| string
|
||||
| Omit<InteractionReplyOptions, 'fetchReply'>
|
||||
| MessageReplyOptions;
|
||||
|
||||
export type MapDeps<
|
||||
Deps extends Dependencies,
|
||||
T extends readonly unknown[]
|
||||
> = T extends [infer First extends keyof Deps, ...infer Rest extends readonly unknown[]]
|
||||
? [ UnpackFunction<Deps[First]>, ...(MapDeps<Deps, Rest> extends [never] ? [] : MapDeps<Deps,Rest>)] : [never]
|
||||
export type MapDeps<Deps extends Dependencies, T extends readonly unknown[]> = T extends [
|
||||
infer First extends keyof Deps,
|
||||
...infer Rest extends readonly unknown[],
|
||||
]
|
||||
? [
|
||||
UnpackFunction<Deps[First]>,
|
||||
...(MapDeps<Deps, Rest> extends [never] ? [] : MapDeps<Deps, Rest>),
|
||||
]
|
||||
: [never];
|
||||
//Basically, '@sern/client' | '@sern/store' | '@sern/modules' | '@sern/error' | '@sern/emitter' will be provided defaults, and you can exclude the rest
|
||||
export type OptionalDependencies = '@sern/logger';
|
||||
export type OptionalDependencies = '@sern/logger';
|
||||
|
||||
@@ -18,7 +18,7 @@ import type {
|
||||
ChannelSelectMenuInteraction,
|
||||
MentionableSelectMenuInteraction,
|
||||
RoleSelectMenuInteraction,
|
||||
StringSelectMenuInteraction
|
||||
StringSelectMenuInteraction,
|
||||
} from 'discord.js';
|
||||
import type {
|
||||
DiscordEventCommand,
|
||||
@@ -36,7 +36,7 @@ export interface Module {
|
||||
type?: CommandType | EventType;
|
||||
name?: string;
|
||||
description?: string;
|
||||
execute: (...args: any[]) => any
|
||||
execute: (...args: any[]) => any;
|
||||
}
|
||||
|
||||
export interface TextCommand extends Module {
|
||||
@@ -162,10 +162,10 @@ export type CommandModuleDefs = {
|
||||
[CommandType.CtxUser]: ContextMenuUser;
|
||||
[CommandType.Button]: ButtonCommand;
|
||||
[CommandType.StringSelect]: StringSelectCommand;
|
||||
[CommandType.RoleSelect] : RoleSelectCommand;
|
||||
[CommandType.ChannelSelect] : ChannelSelectCommand;
|
||||
[CommandType.MentionableSelect] : MentionableSelectCommand;
|
||||
[CommandType.UserSelect] : UserSelectCommand;
|
||||
[CommandType.RoleSelect]: RoleSelectCommand;
|
||||
[CommandType.ChannelSelect]: ChannelSelectCommand;
|
||||
[CommandType.MentionableSelect]: MentionableSelectCommand;
|
||||
[CommandType.UserSelect]: UserSelectCommand;
|
||||
[CommandType.Modal]: ModalSubmitCommand;
|
||||
};
|
||||
|
||||
@@ -175,7 +175,8 @@ export type EventModuleDefs = {
|
||||
[EventType.External]: ExternalEventCommand;
|
||||
};
|
||||
|
||||
export interface SernAutocompleteData extends Omit<BaseApplicationCommandOptionsData, 'autocomplete'> {
|
||||
export interface SernAutocompleteData
|
||||
extends Omit<BaseApplicationCommandOptionsData, 'autocomplete'> {
|
||||
autocomplete: true;
|
||||
type:
|
||||
| ApplicationCommandOptionType.String
|
||||
@@ -212,4 +213,4 @@ export type SernOptionsData<U extends ApplicationCommandOptionData = Application
|
||||
? SernSubCommandData
|
||||
: U extends ApplicationCommandSubGroupData
|
||||
? SernSubCommandGroupData
|
||||
: BaseOptions;
|
||||
: BaseOptions;
|
||||
|
||||
Reference in New Issue
Block a user