mirror of
https://github.com/sern-handler/handler
synced 2026-06-17 05:12:16 +00:00
refactor: npx knip
This commit is contained in:
@@ -1,19 +1,8 @@
|
||||
import type {
|
||||
APIApplicationCommandBasicOption,
|
||||
APIApplicationCommandOptionBase,
|
||||
APIApplicationCommandOptionChoice,
|
||||
APIApplicationCommandRoleOption,
|
||||
ApplicationCommandAttachmentOption,
|
||||
ApplicationCommandChannelOptionData,
|
||||
ApplicationCommandChoicesData,
|
||||
ApplicationCommandNonOptionsData,
|
||||
ApplicationCommandNumericOptionData,
|
||||
ApplicationCommandOptionData,
|
||||
ApplicationCommandOptionType,
|
||||
ApplicationCommandSubCommandData,
|
||||
ApplicationCommandSubGroupData,
|
||||
BaseApplicationCommandOptionsData,
|
||||
CommandOptionNonChoiceResolvableType,
|
||||
} from 'discord.js';
|
||||
import {
|
||||
AutocompleteInteraction,
|
||||
@@ -192,10 +181,10 @@ export interface SernAutocompleteData
|
||||
command: AutocompleteCommand;
|
||||
}
|
||||
|
||||
export type CommandModuleNoPlugins = {
|
||||
type CommandModuleNoPlugins = {
|
||||
[T in CommandType]: Omit<CommandModuleDefs[T], 'plugins' | 'onEvent'>;
|
||||
};
|
||||
export type EventModulesNoPlugins = {
|
||||
type EventModulesNoPlugins = {
|
||||
[T in EventType]: Omit<EventModuleDefs[T], 'plugins' | 'onEvent'>;
|
||||
};
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ export type EventArgs<
|
||||
J extends PluginType = PluginType,
|
||||
> = EventArgsMatrix[I][J];
|
||||
|
||||
export interface CommandArgsMatrix {
|
||||
interface CommandArgsMatrix {
|
||||
[CommandType.Text]: {
|
||||
[PluginType.Control]: [Context, ['text', string[]]];
|
||||
[PluginType.Init]: [InitArgs<Processed<TextCommand>>];
|
||||
@@ -132,7 +132,7 @@ export interface CommandArgsMatrix {
|
||||
};
|
||||
}
|
||||
|
||||
export interface EventArgsMatrix {
|
||||
interface EventArgsMatrix {
|
||||
[EventType.Discord]: {
|
||||
[PluginType.Control]: /* library coupled */ ClientEvents[keyof ClientEvents];
|
||||
[PluginType.Init]: [InitArgs<Processed<DiscordEventCommand>>];
|
||||
|
||||
@@ -13,7 +13,7 @@ import { BothCommand, CommandModule, Module } from '../../core/types/modules';
|
||||
import { Args } from '../../shared';
|
||||
|
||||
|
||||
export function dispatchInteraction<T extends CommandModule, V extends BaseInteraction | Message>(
|
||||
function dispatchInteraction<T extends CommandModule, V extends BaseInteraction | Message>(
|
||||
payload: { module: Processed<T>; event: V },
|
||||
createArgs: (m: typeof payload.event) => unknown[],
|
||||
) {
|
||||
@@ -30,7 +30,7 @@ export function dispatchMessage(module: Processed<CommandModule>, args: [Context
|
||||
};
|
||||
}
|
||||
|
||||
export function dispatchAutocomplete(payload: {
|
||||
function dispatchAutocomplete(payload: {
|
||||
module: Processed<BothCommand>;
|
||||
event: AutocompleteInteraction;
|
||||
}) {
|
||||
@@ -52,7 +52,7 @@ export function contextArgs(wrappable: Message | BaseInteraction, messageArgs?:
|
||||
return [ctx, args] as [Context, Args];
|
||||
}
|
||||
|
||||
export function interactionArg<T extends BaseInteraction>(interaction: T) {
|
||||
function interactionArg<T extends BaseInteraction>(interaction: T) {
|
||||
return [interaction] as [T];
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ function apiType(t: CommandType | EventType) {
|
||||
* A is for any ApplicationCommand. C is for any ComponentCommand
|
||||
* Then, another number generated by apiType function is appended
|
||||
*/
|
||||
export function uniqueSuffix(t: CommandType | EventType) {
|
||||
function uniqueSuffix(t: CommandType | EventType) {
|
||||
const am = (appBitField & t) !== 0 ? 'A' : 'C';
|
||||
return am + apiType(t);
|
||||
}
|
||||
|
||||
@@ -26,8 +26,6 @@ export interface SernEventsMapping {
|
||||
|
||||
export type Awaitable<T> = PromiseLike<T> | T;
|
||||
|
||||
export type Deprecated<Message extends string> = [never, Message];
|
||||
|
||||
export interface Wrapper {
|
||||
commands: string;
|
||||
defaultPrefix?: string;
|
||||
@@ -45,7 +43,7 @@ export interface Wrapper {
|
||||
}
|
||||
|
||||
// Thanks to @kelsny
|
||||
export type ParseType<T> = {
|
||||
type ParseType<T> = {
|
||||
[K in keyof T]: T[K] extends unknown ? [k: K, args: T[K]] : never;
|
||||
}[keyof T];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user