feat: finishing autocomplete!!

This commit is contained in:
Jacob Nguyen
2022-05-25 15:29:28 -05:00
parent b08eebf685
commit d63423cfc4
6 changed files with 63 additions and 27 deletions

View File

@@ -1,13 +1,6 @@
import type {
Awaitable,
ClientEvents,
CommandInteractionOptionResolver,
MessageOptions,
MessagePayload,
} from 'discord.js';
import type { Awaitable, ClientEvents, CommandInteractionOptionResolver } from 'discord.js';
import type { EventEmitter } from 'events';
// Anything that can be sent in a `<TextChannel>#send` or `<CommandInteraction>#reply`
export type possibleOutput<T = string> = T | (MessagePayload & MessageOptions);
export type Nullish<T> = T | undefined | null;
// Thanks @cursorsdottsx
export type ParseType<T> = {
@@ -16,8 +9,14 @@ export type ParseType<T> = {
export type Args = ParseType<{ text: string[]; slash: SlashOptions }>;
export type DiscordEvent = ParseType<{ [K in keyof ClientEvents]: (...args: ClientEvents[K]) => Awaitable<void> }>;
export type EventEmitterRegister = [emitter: EventEmitter, k: string, cb: (...args: unknown[]) => Awaitable<void>];
export type DiscordEvent = ParseType<{
[K in keyof ClientEvents]: (...args: ClientEvents[K]) => Awaitable<void>;
}>;
export type EventEmitterRegister = [
emitter: EventEmitter,
k: string,
cb: (...args: unknown[]) => Awaitable<void>,
];
export type SlashOptions = Omit<CommandInteractionOptionResolver, 'getMessage' | 'getFocused'>;
@@ -25,3 +24,10 @@ export type SlashOptions = Omit<CommandInteractionOptionResolver, 'getMessage' |
export type Override<T1, T2> = Omit<T1, keyof T2> & T2;
export type DefinitelyDefined<T, K> = T & Override<T, K>;
export type Expand<T> = T extends object ? { [K in keyof T]: Expand<T[K]> } : T;
type Reconstruct<T> = T extends Omit<infer O, infer _> ? O & Reconstruct<O> : T;
type IsOptional<T> = {
[K in keyof T]-?: T[K] extends Required<T>[K] ? false : true;
};