mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
refactor: npx knip
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
"build:prod": "tsup --minify",
|
||||
"publish": "npm run build:prod",
|
||||
"pretty": "prettier --write .",
|
||||
"tdd" : "vitest",
|
||||
"tdd": "vitest",
|
||||
"test": "vitest --run"
|
||||
},
|
||||
"keywords": [
|
||||
@@ -47,7 +47,6 @@
|
||||
"@typescript-eslint/eslint-plugin": "5.58.0",
|
||||
"@typescript-eslint/parser": "5.58.0",
|
||||
"discord.js": "14.11.0",
|
||||
"esbuild": "^0.15.2",
|
||||
"esbuild-ifdef": "^0.2.0",
|
||||
"eslint": "8.38.0",
|
||||
"prettier": "2.8.7",
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { afterEach, describe, it, vi } from "vitest";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { PluginType, SernOptionsData, controller } from '../../src/index'
|
||||
import { partitionPlugins, treeSearch } from "../../src/core/functions";
|
||||
import { expect } from "chai";
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { ApplicationCommandOptionType, AutocompleteInteraction } from "discord.js";
|
||||
|
||||
|
||||
232
yarn.lock
232
yarn.lock
@@ -90,13 +90,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@esbuild/android-arm@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "@esbuild/android-arm@npm:0.15.18"
|
||||
conditions: os=android & cpu=arm
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@esbuild/android-arm@npm:0.17.16":
|
||||
version: 0.17.16
|
||||
resolution: "@esbuild/android-arm@npm:0.17.16"
|
||||
@@ -223,13 +216,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@esbuild/linux-loong64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "@esbuild/linux-loong64@npm:0.15.18"
|
||||
conditions: os=linux & cpu=loong64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@esbuild/linux-loong64@npm:0.17.16":
|
||||
version: 0.17.16
|
||||
resolution: "@esbuild/linux-loong64@npm:0.17.16"
|
||||
@@ -608,7 +594,6 @@ __metadata:
|
||||
"@typescript-eslint/eslint-plugin": 5.58.0
|
||||
"@typescript-eslint/parser": 5.58.0
|
||||
discord.js: 14.11.0
|
||||
esbuild: ^0.15.2
|
||||
esbuild-ifdef: ^0.2.0
|
||||
eslint: 8.38.0
|
||||
iti: ^0.6.0
|
||||
@@ -1390,48 +1375,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-android-64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-android-64@npm:0.15.18"
|
||||
conditions: os=android & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-android-arm64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-android-arm64@npm:0.15.18"
|
||||
conditions: os=android & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-darwin-64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-darwin-64@npm:0.15.18"
|
||||
conditions: os=darwin & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-darwin-arm64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-darwin-arm64@npm:0.15.18"
|
||||
conditions: os=darwin & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-freebsd-64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-freebsd-64@npm:0.15.18"
|
||||
conditions: os=freebsd & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-freebsd-arm64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-freebsd-arm64@npm:0.15.18"
|
||||
conditions: os=freebsd & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-ifdef@npm:^0.2.0":
|
||||
version: 0.2.0
|
||||
resolution: "esbuild-ifdef@npm:0.2.0"
|
||||
@@ -1441,181 +1384,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-linux-32@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-linux-32@npm:0.15.18"
|
||||
conditions: os=linux & cpu=ia32
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-linux-64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-linux-64@npm:0.15.18"
|
||||
conditions: os=linux & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-linux-arm64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-linux-arm64@npm:0.15.18"
|
||||
conditions: os=linux & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-linux-arm@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-linux-arm@npm:0.15.18"
|
||||
conditions: os=linux & cpu=arm
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-linux-mips64le@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-linux-mips64le@npm:0.15.18"
|
||||
conditions: os=linux & cpu=mips64el
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-linux-ppc64le@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-linux-ppc64le@npm:0.15.18"
|
||||
conditions: os=linux & cpu=ppc64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-linux-riscv64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-linux-riscv64@npm:0.15.18"
|
||||
conditions: os=linux & cpu=riscv64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-linux-s390x@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-linux-s390x@npm:0.15.18"
|
||||
conditions: os=linux & cpu=s390x
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-netbsd-64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-netbsd-64@npm:0.15.18"
|
||||
conditions: os=netbsd & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-openbsd-64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-openbsd-64@npm:0.15.18"
|
||||
conditions: os=openbsd & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-sunos-64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-sunos-64@npm:0.15.18"
|
||||
conditions: os=sunos & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-windows-32@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-windows-32@npm:0.15.18"
|
||||
conditions: os=win32 & cpu=ia32
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-windows-64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-windows-64@npm:0.15.18"
|
||||
conditions: os=win32 & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild-windows-arm64@npm:0.15.18":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild-windows-arm64@npm:0.15.18"
|
||||
conditions: os=win32 & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild@npm:^0.15.2":
|
||||
version: 0.15.18
|
||||
resolution: "esbuild@npm:0.15.18"
|
||||
dependencies:
|
||||
"@esbuild/android-arm": 0.15.18
|
||||
"@esbuild/linux-loong64": 0.15.18
|
||||
esbuild-android-64: 0.15.18
|
||||
esbuild-android-arm64: 0.15.18
|
||||
esbuild-darwin-64: 0.15.18
|
||||
esbuild-darwin-arm64: 0.15.18
|
||||
esbuild-freebsd-64: 0.15.18
|
||||
esbuild-freebsd-arm64: 0.15.18
|
||||
esbuild-linux-32: 0.15.18
|
||||
esbuild-linux-64: 0.15.18
|
||||
esbuild-linux-arm: 0.15.18
|
||||
esbuild-linux-arm64: 0.15.18
|
||||
esbuild-linux-mips64le: 0.15.18
|
||||
esbuild-linux-ppc64le: 0.15.18
|
||||
esbuild-linux-riscv64: 0.15.18
|
||||
esbuild-linux-s390x: 0.15.18
|
||||
esbuild-netbsd-64: 0.15.18
|
||||
esbuild-openbsd-64: 0.15.18
|
||||
esbuild-sunos-64: 0.15.18
|
||||
esbuild-windows-32: 0.15.18
|
||||
esbuild-windows-64: 0.15.18
|
||||
esbuild-windows-arm64: 0.15.18
|
||||
dependenciesMeta:
|
||||
"@esbuild/android-arm":
|
||||
optional: true
|
||||
"@esbuild/linux-loong64":
|
||||
optional: true
|
||||
esbuild-android-64:
|
||||
optional: true
|
||||
esbuild-android-arm64:
|
||||
optional: true
|
||||
esbuild-darwin-64:
|
||||
optional: true
|
||||
esbuild-darwin-arm64:
|
||||
optional: true
|
||||
esbuild-freebsd-64:
|
||||
optional: true
|
||||
esbuild-freebsd-arm64:
|
||||
optional: true
|
||||
esbuild-linux-32:
|
||||
optional: true
|
||||
esbuild-linux-64:
|
||||
optional: true
|
||||
esbuild-linux-arm:
|
||||
optional: true
|
||||
esbuild-linux-arm64:
|
||||
optional: true
|
||||
esbuild-linux-mips64le:
|
||||
optional: true
|
||||
esbuild-linux-ppc64le:
|
||||
optional: true
|
||||
esbuild-linux-riscv64:
|
||||
optional: true
|
||||
esbuild-linux-s390x:
|
||||
optional: true
|
||||
esbuild-netbsd-64:
|
||||
optional: true
|
||||
esbuild-openbsd-64:
|
||||
optional: true
|
||||
esbuild-sunos-64:
|
||||
optional: true
|
||||
esbuild-windows-32:
|
||||
optional: true
|
||||
esbuild-windows-64:
|
||||
optional: true
|
||||
esbuild-windows-arm64:
|
||||
optional: true
|
||||
bin:
|
||||
esbuild: bin/esbuild
|
||||
checksum: ec12682b2cb2d4f0669d0e555028b87a9284ca7f6a1b26e35e69a8697165b35cc682ad598abc70f0bbcfdc12ca84ef888caf5ceee389237862e8f8c17da85f89
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"esbuild@npm:^0.17.5":
|
||||
version: 0.17.19
|
||||
resolution: "esbuild@npm:0.17.19"
|
||||
|
||||
Reference in New Issue
Block a user