chore: bump 3.2.1

This commit is contained in:
Socram03 2025-06-17 16:19:49 -04:00
parent 325a39f1bf
commit db38f49ca9
68 changed files with 341 additions and 659 deletions

View File

@ -1 +1 @@
npx lint-staged
npx biome check --write

View File

@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
@ -8,7 +8,16 @@
},
"files": {
"ignoreUnknown": true,
"ignore": ["node_modules/", "build", "lib", "__test__", "package.json", "tsconfig.json", ".vscode"]
"includes": [
"**/src/**",
"!/node_modules/",
"!/build",
"!/lib",
"!/__test__",
"!/package.json",
"!/tsconfig.json",
"!/.vscode"
]
},
"formatter": {
"enabled": true,
@ -18,14 +27,17 @@
"lineEnding": "crlf",
"formatWithErrors": true
},
"organizeImports": {
"enabled": true
"assist": {
"actions": {
"source": {
"organizeImports": "on"
}
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"all": true,
"security": {
"noGlobalEval": "off"
},
@ -41,9 +53,7 @@
},
"correctness": {
"noNodejsModules": "off",
"useImportExtensions": "off",
"noUnusedFunctionParameters": "off",
"noUnusedVariables": "off"
"useImportExtensions": "off"
},
"style": {
"noDefaultExport": "off",
@ -56,8 +66,7 @@
"noParameterAssign": "off",
"useFilenamingConvention": "off",
"useEnumInitializers": "off",
"useExplicitLengthCheck": "off",
"noNamespaceImport": "off"
"useExplicitLengthCheck": "off"
},
"complexity": {
"noForEach": "off",
@ -69,7 +78,8 @@
"noBarrelFile": "off",
"noDelete": "off",
"noReExportAll": "off",
"useTopLevelRegex": "off"
"useTopLevelRegex": "off",
"noNamespaceImport": "off"
}
}
},

View File

@ -1,6 +1,6 @@
{
"name": "seyfert",
"version": "3.2.0",
"version": "3.2.1",
"description": "The most advanced framework for discord bots",
"main": "./lib/index.js",
"module": "./lib/index.js",
@ -21,15 +21,14 @@
"author": "MARCROCK22",
"license": "MIT",
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@biomejs/biome": "2.0.0",
"@changesets/cli": "^2.29.4",
"@commitlint/cli": "^19.8.1",
"@commitlint/config-conventional": "^19.8.1",
"@types/node": "^24.0.1",
"@types/node": "^24.0.3",
"husky": "^9.1.7",
"lint-staged": "^15.5.1",
"typescript": "^5.8.3",
"vitest": "^3.2.3"
"vitest": "^3.2.4"
},
"homepage": "https://seyfert.dev",
"repository": {
@ -65,15 +64,10 @@
"url": "https://github.com/Drylozu"
}
],
"lint-staged": {
"*.ts": [
"biome check --write"
]
},
"pnpm": {
"onlyBuiltDependencies": [
"@biomejs/biome",
"esbuild"
]
}
}
}

529
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -39,10 +39,10 @@ import type {
RESTGetAPIGuildRolesResult,
RESTGetAPIGuildScheduledEventQuery,
RESTGetAPIGuildScheduledEventResult,
RESTGetAPIGuildScheduledEventUsersQuery,
RESTGetAPIGuildScheduledEventUsersResult,
RESTGetAPIGuildScheduledEventsQuery,
RESTGetAPIGuildScheduledEventsResult,
RESTGetAPIGuildScheduledEventUsersQuery,
RESTGetAPIGuildScheduledEventUsersResult,
RESTGetAPIGuildSoundboardSoundsResult,
RESTGetAPIGuildStickerResult,
RESTGetAPIGuildStickersResult,
@ -107,12 +107,12 @@ import type {
RESTPostAPIGuildSoundboardSoundResult,
RESTPostAPIGuildStickerFormDataBody,
RESTPostAPIGuildStickerResult,
RESTPostAPIGuildTemplatesJSONBody,
RESTPostAPIGuildTemplatesResult,
RESTPostAPIGuildsJSONBody,
RESTPostAPIGuildsMFAJSONBody,
RESTPostAPIGuildsMFAResult,
RESTPostAPIGuildsResult,
RESTPostAPIGuildTemplatesJSONBody,
RESTPostAPIGuildTemplatesResult,
RESTPostAPITemplateCreateGuildJSONBody,
RESTPostAPITemplateCreateGuildResult,
RESTPutAPIGuildBanJSONBody,

View File

@ -1,11 +1,11 @@
import { type UUID, randomUUID } from 'node:crypto';
import { type Awaitable, BASE_HOST, Logger, delay, lazyLoadPackage, snowflakeToTimestamp } from '../common';
import { randomUUID, type UUID } from 'node:crypto';
import { type Awaitable, BASE_HOST, delay, Logger, lazyLoadPackage, snowflakeToTimestamp } from '../common';
import { toArrayBuffer, toBuffer } from '../common/it/utils';
import type { WorkerData } from '../websocket';
import type { WorkerSendApiRequest } from '../websocket/discord/worker';
import { Bucket } from './bucket';
import { CDNRouter, Router } from './Router';
import type { APIRoutes } from './Routes';
import { Bucket } from './bucket';
import {
type ApiHandlerInternalOptions,
type ApiHandlerOptions,
@ -384,11 +384,7 @@ export class ApiHandler {
}
}
parseRequest(options: {
url: string;
headers: RequestHeaders;
request: ApiRequestOptions;
}) {
parseRequest(options: { url: string; headers: RequestHeaders; request: ApiRequestOptions }) {
let finalUrl = options.url;
let data: string | FormData | undefined;
if (options.request.auth) {

View File

@ -1,4 +1,4 @@
export * from './api';
export * from './Router';
export * from './Routes';
export * from './api';
export * from './shared';

View File

@ -1,6 +1,6 @@
import { type ActionRow, fromComponent } from '.';
import { type ColorResolvable, type RestOrArray, resolveColor } from '../common';
import { type APIContainerComponent, ComponentType } from '../types';
import { type ActionRow, fromComponent } from '.';
import { BaseComponentBuilder } from './Base';
import type { File } from './File';
import type { MediaGallery } from './MediaGallery';

View File

@ -1,6 +1,6 @@
import { type Button, fromComponent } from '.';
import type { RestOrArray } from '../common';
import { type APISectionComponent, ComponentType } from '../types';
import { type Button, fromComponent } from '.';
import { BaseComponentBuilder } from './Base';
import type { TextDisplay } from './TextDisplay';
import type { Thumbnail } from './Thumbnail';

12
src/cache/index.ts vendored
View File

@ -1,11 +1,5 @@
import { type If, Logger } from '../common';
import type { Adapter } from './adapters';
import { Guilds } from './resources/guilds';
import { Users } from './resources/users';
import type { InternalOptions, UsingClient } from '../commands';
import { type If, Logger } from '../common';
import {
type APIChannel,
type APIEmoji,
@ -20,9 +14,11 @@ import {
GuildMemberFlags,
OverwriteType,
} from '../types';
import type { Adapter } from './adapters';
import { Bans } from './resources/bans';
import { Channels } from './resources/channels';
import { Emojis } from './resources/emojis';
import { Guilds } from './resources/guilds';
import { Members } from './resources/members';
import { Messages } from './resources/messages';
import { Overwrites } from './resources/overwrites';
@ -30,7 +26,9 @@ import { Presences } from './resources/presence';
import { Roles } from './resources/roles';
import { StageInstances } from './resources/stage-instances';
import { Stickers } from './resources/stickers';
import { Users } from './resources/users';
import { VoiceStates } from './resources/voice-states';
export { BaseResource } from './resources/default/base';
export { GuildBasedResource } from './resources/default/guild-based';
export { GuildRelatedResource } from './resources/default/guild-related';

View File

@ -1,7 +1,7 @@
import type { Cache, CacheFrom, ReturnCache } from '..';
import { type GuildStructure, Transformers } from '../../client/transformers';
import { fakePromise } from '../../common';
import type { APIGuild, GatewayGuildCreateDispatchData } from '../../types';
import type { Cache, CacheFrom, ReturnCache } from '..';
import { BaseResource } from './default/base';
export class Guilds extends BaseResource<any, APIGuild | GatewayGuildCreateDispatchData> {

View File

@ -1,5 +1,7 @@
import { promises } from 'node:fs';
import { join } from 'node:path';
import { ApiHandler } from '../api';
import { isBufferLike } from '../api/utils/utils';
import type { Adapter, DisabledCache } from '../cache';
import { Cache, MemoryAdapter } from '../cache';
import type {
@ -16,34 +18,31 @@ import type {
UsingClient,
} from '../commands';
import { IgnoreCommand, type InferWithPrefix, type MiddlewareContext } from '../commands/applications/shared';
import { HandleCommand } from '../commands/handle';
import { CommandHandler } from '../commands/handler';
import {
ApplicationShorter,
assertString,
ChannelShorter,
EmojiShorter,
filterSplit,
GuildShorter,
InteractionShorter,
InvitesShorter,
LogLevels,
Logger,
LogLevels,
type MakeRequired,
MemberShorter,
MergeOptions,
MessageShorter,
magicImport,
ReactionShorter,
RoleShorter,
TemplateShorter,
ThreadShorter,
UsersShorter,
WebhookShorter,
assertString,
filterSplit,
magicImport,
} from '../common';
import { promises } from 'node:fs';
import { isBufferLike } from '../api/utils/utils';
import { HandleCommand } from '../commands/handle';
import { BanShorter } from '../common/shorters/bans';
import { SoundboardShorter } from '../common/shorters/soundboard';
import { VoiceStateShorter } from '../common/shorters/voiceStates';

View File

@ -1,17 +1,17 @@
import type { CommandContext, Message } from '..';
import {
type Awaitable,
assertString,
type DeepPartial,
type If,
lazyLoadPackage,
type PickPartial,
type WatcherPayload,
type WatcherSendToShard,
assertString,
lazyLoadPackage,
} from '../common';
import { EventHandler } from '../events';
import type { GatewayDispatchPayload, GatewayPresenceUpdateData } from '../types';
import { ShardManager, type ShardManagerOptions, properties } from '../websocket';
import { properties, ShardManager, type ShardManagerOptions } from '../websocket';
import { MemberUpdateHandler } from '../websocket/discord/events/memberUpdate';
import { PresenceUpdateHandler } from '../websocket/discord/events/presenceUpdate';
import type { BaseClientOptions, InternalRuntimeConfig, ServicesOptions, StartOptions } from './base';

View File

@ -1,4 +1,4 @@
import { type UUID, randomUUID } from 'node:crypto';
import { randomUUID, type UUID } from 'node:crypto';
import type { UsingClient } from '../commands';
import type { Awaitable, CamelCase } from '../common';
import type { CallbackEventHandler, CustomEventsKeys, GatewayEvents } from '../events';

View File

@ -1,5 +1,5 @@
export type { RuntimeConfig, RuntimeConfigHTTP } from './base';
export * from './client';
export * from './httpclient';
export * from './workerclient';
export * from './transformers';
export * from './workerclient';

View File

@ -8,8 +8,8 @@ import {
BaseGuildChannel,
CategoryChannel,
ClientUser,
DMChannel,
DirectoryChannel,
DMChannel,
Emoji,
Entitlement,
ForumChannel,

View File

@ -1,18 +1,22 @@
import { type UUID, randomUUID } from 'node:crypto';
import { randomUUID, type UUID } from 'node:crypto';
import { ApiHandler, Logger } from '..';
import { WorkerAdapter } from '../cache';
import {
type Awaitable,
calculateShardId,
type DeepPartial,
LogLevels,
lazyLoadPackage,
type MakeRequired,
type When,
calculateShardId,
lazyLoadPackage,
} from '../common';
import { EventHandler } from '../events';
import type { GatewayDispatchPayload, GatewaySendPayload } from '../types';
import { Shard, type ShardManagerOptions, ShardSocketCloseCodes, type WorkerData, properties } from '../websocket';
import { properties, Shard, type ShardManagerOptions, ShardSocketCloseCodes, type WorkerData } from '../websocket';
import { MemberUpdateHandler } from '../websocket/discord/events/memberUpdate';
import { PresenceUpdateHandler } from '../websocket/discord/events/presenceUpdate';
import type { WorkerHeartbeaterMessages } from '../websocket/discord/heartbeater';
import type { ShardData } from '../websocket/discord/shared';
import type {
ClientHeartbeaterMessages,
WorkerDisconnectedAllShardsResharding,
@ -36,11 +40,6 @@ import type { ManagerMessages, ManagerSpawnShards } from '../websocket/discord/w
import type { BaseClientOptions, ServicesOptions, StartOptions } from './base';
import { BaseClient } from './base';
import type { Client, ClientOptions } from './client';
import { MemberUpdateHandler } from '../websocket/discord/events/memberUpdate';
import { PresenceUpdateHandler } from '../websocket/discord/events/presenceUpdate';
import type { WorkerHeartbeaterMessages } from '../websocket/discord/heartbeater';
import type { ShardData } from '../websocket/discord/shared';
import { Collectors } from './collectors';
import { type ClientUserStructure, Transformers } from './transformers';

View File

@ -1,4 +1,4 @@
import { type PermissionStrings, magicImport } from '../../common';
import { magicImport, type PermissionStrings } from '../../common';
import {
ApplicationCommandType,
type ApplicationIntegrationType,

View File

@ -1,4 +1,4 @@
import { type PermissionStrings, magicImport } from '../../common';
import { magicImport, type PermissionStrings } from '../../common';
import type {
ApplicationCommandType,
ApplicationIntegrationType,

View File

@ -13,9 +13,9 @@ import {
type MakeRequired,
type MessageWebhookCreateBodyRequest,
type ModalCreateBodyRequest,
toSnakeCase,
type UnionToTuple,
type When,
toSnakeCase,
} from '../../common';
import type { AllChannels, MessageCommandInteraction, UserCommandInteraction } from '../../structures';
import { type APIMessage, ApplicationCommandType, MessageFlags, type RESTGetAPIGuildQuery } from '../../types';
@ -47,7 +47,6 @@ export class MenuCommandContext<
metadata: CommandMetadata<UnionToTuple<M>> = {} as never;
globalMetadata: GlobalMetadata = {};
// biome-ignore lint/suspicious/useGetterReturn: default don't exist.
get target(): InteractionTarget<T> {
switch (this.interaction.data.type) {
case ApplicationCommandType.Message: {

View File

@ -1,10 +1,3 @@
import type {
AutocompleteCallback,
EntryPointContext,
MenuCommandContext,
OnAutocompleteErrorCallback,
ReturnOptionsTypes,
} from '..';
import type { Awaitable, FlatObjectKeys } from '../../common';
import type { ModalContext } from '../../components';
import type { ComponentContext } from '../../components/componentcontext';
@ -15,6 +8,13 @@ import {
ApplicationCommandOptionType,
} from '../../types';
import type { LocalizationMap } from '../../types/payloads';
import type {
AutocompleteCallback,
EntryPointContext,
MenuCommandContext,
OnAutocompleteErrorCallback,
ReturnOptionsTypes,
} from '..';
import type { CommandContext } from './chatcontext';
import type { DefaultLocale, MiddlewareContext, OKFunction, SeyfertChannelMap, StopFunction } from './shared';

View File

@ -1,7 +1,7 @@
import type {
CategoryChannelStructure,
DMChannelStructure,
DirectoryChannelStructure,
DMChannelStructure,
ForumChannelStructure,
MediaChannelStructure,
NewsChannelStructure,

View File

@ -1,3 +1,32 @@
import type { Client, WorkerClient } from '../client';
import { type MessageStructure, type OptionResolverStructure, Transformers } from '../client/transformers';
import type { MakeRequired } from '../common';
import { INTEGER_OPTION_VALUE_LIMIT } from '../common/it/constants';
import { ComponentContext, ModalContext } from '../components';
import {
type __InternalReplyFunction,
AutocompleteInteraction,
BaseInteraction,
type ChatInputCommandInteraction,
type ComponentInteraction,
type EntryPointInteraction,
type MessageCommandInteraction,
type ModalSubmitInteraction,
type UserCommandInteraction,
} from '../structures';
import type { PermissionsBitField } from '../structures/extra/Permissions';
import {
type APIApplicationCommandInteraction,
type APIApplicationCommandInteractionDataOption,
type APIInteraction,
type APIInteractionDataResolvedChannel,
ApplicationCommandOptionType,
ApplicationCommandType,
ChannelType,
type GatewayMessageCreateDispatchData,
InteractionContextType,
InteractionType,
} from '../types';
import {
BaseCommand,
Command,
@ -19,35 +48,6 @@ import {
SubCommand,
type UsingClient,
} from '.';
import type { Client, WorkerClient } from '../client';
import { type MessageStructure, type OptionResolverStructure, Transformers } from '../client/transformers';
import type { MakeRequired } from '../common';
import { INTEGER_OPTION_VALUE_LIMIT } from '../common/it/constants';
import { ComponentContext, ModalContext } from '../components';
import {
AutocompleteInteraction,
BaseInteraction,
type ChatInputCommandInteraction,
type ComponentInteraction,
type EntryPointInteraction,
type MessageCommandInteraction,
type ModalSubmitInteraction,
type UserCommandInteraction,
type __InternalReplyFunction,
} from '../structures';
import type { PermissionsBitField } from '../structures/extra/Permissions';
import {
type APIApplicationCommandInteraction,
type APIApplicationCommandInteractionDataOption,
type APIInteraction,
type APIInteractionDataResolvedChannel,
ApplicationCommandOptionType,
ApplicationCommandType,
ChannelType,
type GatewayMessageCreateDispatchData,
InteractionContextType,
InteractionType,
} from '../types';
export type CommandOptionWithType = CommandOption & {
type: ApplicationCommandOptionType;

View File

@ -1,6 +1,5 @@
import { promises } from 'node:fs';
import { basename, dirname } from 'node:path';
import type { EntryPointCommand } from '.';
import type { Logger, NulleableCoalising, OmitInsert } from '../common';
import { BaseHandler, isCloudfareWorker } from '../common';
import { PermissionsBitField } from '../structures/extra/Permissions';
@ -17,6 +16,7 @@ import {
type LocaleString,
type LocalizationMap,
} from '../types';
import type { EntryPointCommand } from '.';
import { Command, type CommandOption, SubCommand } from './applications/chat';
import { ContextMenuCommand } from './applications/menu';
import { IgnoreCommand, type UsingClient } from './applications/shared';

View File

@ -1,11 +1,11 @@
export * from './applications/shared';
//
export * from './applications/chat';
export * from './applications/chatcontext';
export * from './applications/entrycontext';
export * from './applications/entryPoint';
export * from './applications/menu';
export * from './applications/menucontext';
export * from './applications/options';
export * from './applications/entryPoint';
export * from './applications/entrycontext';
export * from './applications/shared';
export * from './decorators';
export * from './optionresolver';

View File

@ -1,28 +1,28 @@
export * from './it/constants';
export * from './it/utils';
//
export * from './bot/watcher';
export * from './it/colors';
export { CustomizeLoggerCallback, AssignFilenameCallback, LogLevels, Logger, LoggerOptions } from './it/logger';
export * from './it/constants';
export * from './it/formatter';
// circular lol
export * from './shorters/invites';
export { AssignFilenameCallback, CustomizeLoggerCallback, Logger, LoggerOptions, LogLevels } from './it/logger';
export * from './it/utils';
export * from './shorters/application';
//
export * from './shorters/channels';
export * from './shorters/emojis';
export * from './shorters/guilds';
export * from './shorters/interaction';
// circular lol
export * from './shorters/invites';
export * from './shorters/members';
export * from './shorters/messages';
export * from './shorters/reactions';
export * from './shorters/roles';
export * from './shorters/templates';
export * from './shorters/users';
export * from './shorters/threads';
export * from './shorters/users';
export * from './shorters/webhook';
export * from './shorters/interaction';
export * from './shorters/application';
//
export * from './types/options';
export * from './types/resolvables';
export * from './types/util';
export * from './types/write';
//
export * from './bot/watcher';

View File

@ -1,4 +1,4 @@
import { type WriteStream, createWriteStream, existsSync, mkdirSync, promises } from 'node:fs';
import { createWriteStream, existsSync, mkdirSync, promises, type WriteStream } from 'node:fs';
import { join } from 'node:path';
import { bgBrightWhite, black, bold, brightBlack, cyan, gray, italic, red, stripColor, yellow } from './colors';
import { MergeOptions } from './utils';

View File

@ -1,5 +1,7 @@
import { promises } from 'node:fs';
import { basename, join } from 'node:path';
import type { Cache } from '../../cache';
import { type APIPartialEmoji, FormattingPatterns, GatewayIntentBits } from '../../types';
import {
type ColorResolvable,
DiscordEpoch,
@ -10,8 +12,6 @@ import {
type ObjectToSnake,
type TypeArray,
} from '..';
import type { Cache } from '../../cache';
import { type APIPartialEmoji, FormattingPatterns, GatewayIntentBits } from '../../types';
/**
* Calculates the shard ID for a guild based on its ID.
@ -304,8 +304,6 @@ export function lazyLoadPackage<T>(mod: string): T | undefined {
try {
return require(mod);
} catch (e) {
// biome-ignore lint/suspicious/noConsoleLog:
// biome-ignore lint/suspicious/noConsole:
console.log(`Cannot import ${mod}`, e);
return;
}

View File

@ -1,7 +1,7 @@
import { CacheFrom } from '../../cache';
import type { Overwrites } from '../../cache/resources/overwrites';
import { type MessageStructure, type ThreadChannelStructure, Transformers } from '../../client/transformers';
import { type AllChannels, BaseChannel, type GuildMember, type GuildRole, channelFrom } from '../../structures';
import { type AllChannels, BaseChannel, channelFrom, type GuildMember, type GuildRole } from '../../structures';
import { PermissionsBitField } from '../../structures/extra/Permissions';
import type {
APIChannel,

View File

@ -14,8 +14,8 @@ import {
type AllChannels,
BaseChannel,
type CreateStickerBodyRequest,
type GuildChannelTypes,
channelFrom,
type GuildChannelTypes,
} from '../../structures';
import type {
APIChannel,

View File

@ -1,4 +1,7 @@
import type { ValidAnswerId } from '../../api/Routes/channels';
import { resolveFiles } from '../../builders';
import { CacheFrom } from '../../cache';
import { type MessageStructure, type ThreadChannelStructure, Transformers, type UserStructure } from '../../client';
import { MessagesMethods } from '../../structures';
import type {
RESTGetAPIChannelMessagesQuery,
@ -6,10 +9,6 @@ import type {
RESTPostAPIChannelMessageJSONBody,
RESTPostAPIChannelMessagesThreadsJSONBody,
} from '../../types';
import type { ValidAnswerId } from '../../api/Routes/channels';
import { CacheFrom } from '../../cache';
import { type MessageStructure, type ThreadChannelStructure, Transformers, type UserStructure } from '../../client';
import type { MessageCreateBodyRequest, MessageUpdateBodyRequest } from '../types/write';
import { BaseShorter } from './base';

View File

@ -1,9 +1,9 @@
import { resolveFiles } from '../../builders';
import { Transformers, type WebhookMessageStructure, type WebhookStructure } from '../../client/transformers';
import {
MessagesMethods,
type MessageWebhookMethodEditParams,
type MessageWebhookMethodWriteParams,
MessagesMethods,
} from '../../structures';
import type {
APIWebhook,

View File

@ -1,6 +1,6 @@
import type { Identify } from '..';
import type { CDNUrlOptions } from '../../api';
import type { UsingClient } from '../../commands';
import type { Identify } from '..';
export type ImageOptions = CDNUrlOptions;

View File

@ -1,7 +1,7 @@
import type { EmbedColors, OmitInsert } from '..';
import type { Attachment, AttachmentDataType, AttachmentResolvable } from '../../builders';
import type { GuildMember } from '../../structures';
import type { APIGuildMember, APIPartialEmoji, RESTPostAPIApplicationEmojiJSONBody } from '../../types';
import type { EmbedColors, OmitInsert } from '..';
export type EmojiResolvable = string | Partial<APIPartialEmoji> | `<${string | undefined}:${string}:${string}>`;
export type GuildMemberResolvable = string | Partial<GuildMember> | APIGuildMember;

View File

@ -171,14 +171,10 @@ type OptionalizeAux<T extends object> = Identify<
* it is recursive
*/
export type Optionalize<T> = T extends object
? // biome-ignore lint/style/useShorthandArrayType: typescript things
// biome-ignore lint/style/useConsistentArrayType: <explanation>
T extends Array<unknown>
? T extends Array<unknown>
? number extends T['length']
? T[number] extends object
? // biome-ignore lint/style/useShorthandArrayType: <explanation>
// biome-ignore lint/style/useConsistentArrayType: <explanation>
Array<OptionalizeAux<T[number]>>
? Array<OptionalizeAux<T[number]>>
: T
: Partial<T>
: OptionalizeAux<T>

View File

@ -4,6 +4,7 @@ import {
type ChannelSelectMenu,
type Container,
type File,
fromComponent,
type MediaGallery,
type MentionableSelectMenu,
type RoleSelectMenu,
@ -14,7 +15,6 @@ import {
type TextInput,
type Thumbnail,
type UserSelectMenu,
fromComponent,
} from '../builders';
import {
type APIActionRowComponent,

View File

@ -1,5 +1,5 @@
import { type ContainerComponents, componentFactory } from '.';
import type { APIContainerComponent, ComponentType } from '../types';
import { type ContainerComponents, componentFactory } from '.';
import { BaseComponent } from './BaseComponent';
export class ContainerComponent extends BaseComponent<ComponentType.Container> {

View File

@ -1,5 +1,5 @@
import { componentFactory } from '.';
import type { APISectionComponent, ComponentType } from '../types';
import { componentFactory } from '.';
import { BaseComponent } from './BaseComponent';
import type { ButtonComponent } from './ButtonComponent';
import type { TextDisplayComponent } from './TextDisplay';

View File

@ -9,7 +9,7 @@ import type {
import { LimitedCollection } from '../collection';
import { BaseCommand, type RegisteredMiddlewares, type UsingClient } from '../commands';
import type { FileLoaded } from '../commands/handler';
import { BaseHandler, type Logger, type OnFailCallback, isCloudfareWorker, magicImport } from '../common';
import { BaseHandler, isCloudfareWorker, type Logger, magicImport, type OnFailCallback } from '../common';
import type { ComponentInteraction, ModalSubmitInteraction, StringSelectMenuInteraction } from '../structures';
import { ComponentCommand, InteractionCommandType } from './componentcommand';
import type { ComponentContext } from './componentcontext';

View File

@ -4,11 +4,11 @@ import type { FileLoaded } from '../commands/handler';
import {
BaseHandler,
type CamelCase,
isCloudfareWorker,
type MakeRequired,
magicImport,
ReplaceRegex,
type SnakeCase,
isCloudfareWorker,
magicImport,
} from '../common';
import type { ClientEvents } from '../events/hooks';
import * as RawEvents from '../events/hooks';

View File

@ -1,3 +1,6 @@
import type { UsingClient } from '../../commands';
import { toCamelCase } from '../../common';
import { type AllChannels, channelFrom } from '../../structures';
import type {
GatewayChannelCreateDispatchData,
GatewayChannelDeleteDispatchData,
@ -5,10 +8,6 @@ import type {
GatewayChannelUpdateDispatchData,
} from '../../types';
import type { UsingClient } from '../../commands';
import { toCamelCase } from '../../common';
import { type AllChannels, channelFrom } from '../../structures';
export const CHANNEL_CREATE = (self: UsingClient, data: GatewayChannelCreateDispatchData): AllChannels => {
return channelFrom(data, self);
};

View File

@ -20,8 +20,8 @@ import type {
GatewayGuildIntegrationsUpdateDispatchData,
GatewayGuildMemberAddDispatchData,
GatewayGuildMemberRemoveDispatchData,
GatewayGuildMemberUpdateDispatchData,
GatewayGuildMembersChunkDispatchData,
GatewayGuildMemberUpdateDispatchData,
GatewayGuildRoleCreateDispatchData,
GatewayGuildRoleDeleteDispatchData,
GatewayGuildRoleUpdateDispatchData,

View File

@ -10,13 +10,13 @@ export * from './interactions';
export * from './invite';
export * from './message';
export * from './presence';
export * from './soundboard';
export * from './stage';
export * from './thread';
export * from './typing';
export * from './user';
export * from './voice';
export * from './webhook';
export * from './soundboard';
import type { CamelCase } from '../../common';
import type * as RawEvents from './index';

View File

@ -1,6 +1,6 @@
import { type MessageStructure, Transformers } from '../../client/transformers';
import type { UsingClient } from '../../commands';
import { type ObjectToLower, type OmitInsert, fakePromise, toCamelCase } from '../../common';
import { fakePromise, type ObjectToLower, type OmitInsert, toCamelCase } from '../../common';
import type {
GatewayMessageCreateDispatchData,
GatewayMessageDeleteBulkDispatchData,

View File

@ -5,8 +5,8 @@ import type {
APISoundBoard,
GatewayGuildSoundboardSoundCreateDispatchData,
GatewayGuildSoundboardSoundDeleteDispatchData,
GatewayGuildSoundboardSoundUpdateDispatchData,
GatewayGuildSoundboardSoundsUpdateDispatchData,
GatewayGuildSoundboardSoundUpdateDispatchData,
GatewaySoundboardSoundsDispatchData,
} from '../../types';

View File

@ -5,8 +5,8 @@ import type {
GatewayThreadCreateDispatchData,
GatewayThreadDeleteDispatchData,
GatewayThreadListSyncDispatchData,
GatewayThreadMemberUpdateDispatchData,
GatewayThreadMembersUpdateDispatchData,
GatewayThreadMemberUpdateDispatchData,
GatewayThreadUpdateDispatchData,
} from '../../types';

View File

@ -1,4 +1,5 @@
export * from './client';
import {
BaseClient,
type BaseClientOptions,
@ -10,21 +11,22 @@ import {
import { isCloudfareWorker } from './common';
import type { ClientNameEvents, CustomEventsKeys, ResolveEventParams } from './events';
import { GatewayIntentBits } from './types';
export { Logger, PermissionStrings, Formatter } from './common';
//
export { Collection, LimitedCollection } from './collection';
//
export * from './api';
export * from './builders';
export * from './cache';
//
export { Collection, LimitedCollection } from './collection';
export * from './commands';
export { Formatter, Logger, PermissionStrings } from './common';
export * from './components';
export * from './events';
export * from './langs';
//
export { ShardManager, WorkerManager } from './websocket/discord';
//
export * from './structures';
//
export { ShardManager, WorkerManager } from './websocket/discord';
/**
* Creates an event with the specified data and run function.

View File

@ -4,15 +4,15 @@ import type { CreateInviteFromChannel } from '../common';
import type { ObjectToLower, StructPropState, StructStates, ToClass } from '../common/types/util';
import type { APIGuild, APIPartialGuild, GatewayGuildCreateDispatchData, RESTPatchAPIGuildJSONBody } from '../types';
import { AutoModerationRule } from './AutoModerationRule';
import { BaseChannel, WebhookGuildMethods } from './channels';
import { GuildEmoji } from './Emoji';
import { BaseGuild } from './extra/BaseGuild';
import type { DiscordBase } from './extra/DiscordBase';
import { GuildBan } from './GuildBan';
import { GuildMember } from './GuildMember';
import { GuildRole } from './GuildRole';
import { GuildTemplate } from './GuildTemplate';
import { Sticker } from './Sticker';
import { BaseChannel, WebhookGuildMethods } from './channels';
import { BaseGuild } from './extra/BaseGuild';
import type { DiscordBase } from './extra/DiscordBase';
export interface Guild extends ObjectToLower<Omit<APIGuild, 'stickers' | 'emojis' | 'roles'>>, DiscordBase {}
export class Guild<State extends StructStates = 'api'> extends (BaseGuild as unknown as ToClass<

View File

@ -3,7 +3,7 @@ import type { GuildBanStructure, GuildStructure } from '../client';
import type { UsingClient } from '../commands';
import { Formatter, type MethodContext, type ObjectToLower } from '../common';
import type { BanShorter } from '../common/shorters/bans';
import type { APIBan, ActuallyBan, RESTGetAPIGuildBansQuery } from '../types';
import type { ActuallyBan, APIBan, RESTGetAPIGuildBansQuery } from '../types';
import { DiscordBase } from './extra/DiscordBase';
export interface GuildBan extends DiscordBase, ObjectToLower<Omit<APIBan, 'id'>> {}

View File

@ -1,3 +1,33 @@
import type { RawFile } from '../api';
import { ActionRow, Embed, Modal, PollBuilder, resolveAttachment, resolveFiles } from '../builders';
import type { ReturnCache } from '../cache';
import {
type EntitlementStructure,
type GuildRoleStructure,
type GuildStructure,
type InteractionGuildMemberStructure,
type MessageStructure,
type OptionResolverStructure,
Transformers,
type UserStructure,
type WebhookMessageStructure,
} from '../client/transformers';
import type { ContextOptionsResolved, UsingClient } from '../commands';
import {
type ComponentInteractionMessageUpdate,
type InteractionCreateBodyRequest,
type InteractionMessageUpdateBodyRequest,
type MessageCreateBodyRequest,
type MessageUpdateBodyRequest,
type MessageWebhookCreateBodyRequest,
type ModalCreateBodyRequest,
type ObjectToLower,
type OmitInsert,
type ToClass,
toCamelCase,
type When,
} from '../common';
import { mix } from '../deps/mixer';
import {
type APIActionRowComponent,
type APIApplicationCommandAutocompleteInteraction,
@ -41,37 +71,6 @@ import {
type RESTPostAPIInteractionCallbackJSONBody,
type RESTPostAPIInteractionCallbackResult,
} from '../types';
import type { RawFile } from '../api';
import { ActionRow, Embed, Modal, PollBuilder, resolveAttachment, resolveFiles } from '../builders';
import type { ReturnCache } from '../cache';
import {
type EntitlementStructure,
type GuildRoleStructure,
type GuildStructure,
type InteractionGuildMemberStructure,
type MessageStructure,
type OptionResolverStructure,
Transformers,
type UserStructure,
type WebhookMessageStructure,
} from '../client/transformers';
import type { ContextOptionsResolved, UsingClient } from '../commands';
import {
type ComponentInteractionMessageUpdate,
type InteractionCreateBodyRequest,
type InteractionMessageUpdateBodyRequest,
type MessageCreateBodyRequest,
type MessageUpdateBodyRequest,
type MessageWebhookCreateBodyRequest,
type ModalCreateBodyRequest,
type ObjectToLower,
type OmitInsert,
type ToClass,
type When,
toCamelCase,
} from '../common';
import { mix } from '../deps/mixer';
import { type AllChannels, channelFrom } from './';
import { DiscordBase } from './extra/DiscordBase';
import { PermissionsBitField } from './extra/Permissions';
@ -315,7 +314,6 @@ export class BaseInteraction<
switch (gateway.type) {
case InteractionType.ApplicationCommandAutocomplete:
return new AutocompleteInteraction(client, gateway, undefined, __reply);
// biome-ignore lint/suspicious/noFallthroughSwitchClause: bad interaction between biome and ts-server
case InteractionType.ApplicationCommand:
switch (gateway.data.type) {
case ApplicationCommandType.ChatInput:

View File

@ -1,4 +1,4 @@
import { type AllChannels, Embed, type ReturnCache, componentFactory } from '..';
import { type AllChannels, componentFactory, Embed, type ReturnCache } from '..';
import type { ListenerOptions } from '../builders';
import {
type GuildMemberStructure,
@ -11,8 +11,7 @@ import {
type WebhookStructure,
} from '../client/transformers';
import type { UsingClient } from '../commands';
import { type ObjectToLower, toCamelCase } from '../common';
import { Formatter } from '../common';
import { Formatter, type ObjectToLower, toCamelCase } from '../common';
import type { EmojiResolvable } from '../common/types/resolvables';
import type { MessageCreateBodyRequest, MessageUpdateBodyRequest } from '../common/types/write';
import type { TopLevelComponents } from '../components';
@ -24,8 +23,8 @@ import type {
APIUser,
GatewayMessageCreateDispatchData,
} from '../types';
import type { MessageWebhookMethodEditParams, MessageWebhookMethodWriteParams } from './Webhook';
import { DiscordBase } from './extra/DiscordBase';
import type { MessageWebhookMethodEditParams, MessageWebhookMethodWriteParams } from './Webhook';
export type MessageData = APIMessage | GatewayMessageCreateDispatchData;

View File

@ -5,8 +5,8 @@ import {
type BaseChannelStructure,
type BaseGuildChannelStructure,
type CategoryChannelStructure,
type DMChannelStructure,
type DirectoryChannelStructure,
type DMChannelStructure,
type ForumChannelStructure,
type GuildMemberStructure,
type GuildStructure,
@ -26,13 +26,13 @@ import type { SeyfertChannelMap, UsingClient } from '../commands';
import {
type CreateInviteFromChannel,
type EmojiResolvable,
fakePromise,
type MessageCreateBodyRequest,
type MessageUpdateBodyRequest,
type MethodContext,
type ObjectToLower,
type StringToNumber,
type ToClass,
fakePromise,
} from '../common';
import { mix } from '../deps/mixer';
import {
@ -63,9 +63,9 @@ import {
type ThreadAutoArchiveDuration,
VideoQualityMode,
} from '../types';
import { DiscordBase } from './extra/DiscordBase';
import type { GuildMember } from './GuildMember';
import type { GuildRole } from './GuildRole';
import { DiscordBase } from './extra/DiscordBase';
export class BaseNoEditableChannel<T extends ChannelType> extends DiscordBase<APIChannelBase<ChannelType>> {
declare type: T;

View File

@ -1,6 +1,6 @@
import type { ReturnCache, WorkerClient } from '../..';
import type { GuildStructure } from '../../client';
import { type ObjectToLower, calculateShardId } from '../../common';
import { calculateShardId, type ObjectToLower } from '../../common';
import type { ImageOptions } from '../../common/types/options';
import { type APIPartialGuild, GuildFeature } from '../../types';
import type { ShardManager } from '../../websocket';

View File

@ -1,19 +1,19 @@
export * from './AnonymousGuild';
export * from './AutoModerationRule';
export * from './ClientUser';
export * from './Guild';
export * from './channels';
export * from './Emoji';
export * from './Entitlement';
export * from './Guild';
export * from './GuildBan';
export * from './GuildMember';
export * from './GuildPreview';
export * from './GuildRole';
export * from './GuildTemplate';
export * from './Interaction';
export * from './Message';
export * from './Poll';
export * from './Sticker';
export * from './User';
export * from './VoiceState';
export * from './Webhook';
export * from './channels';
export * from './Poll';
export * from './GuildBan';
export * from './Entitlement';

View File

@ -23,9 +23,9 @@
*/
export * from './gateway';
export * from './rest';
export * from './payloads';
export * from './rest';
export * from './rest';
export * from './utils';
/**

View File

@ -1,7 +1,6 @@
import type { ApplicationIntegrationType, InteractionContextType } from '..';
import type { ChannelType, Permissions, Snowflake } from '../..';
import type { LocaleString } from '../../rest';
import type { ApplicationIntegrationType, InteractionContextType } from '..';
import type {
APIAttachment,
APIChannel,

View File

@ -2,9 +2,9 @@
* Types extracted from https://discord.com/developers/docs/resources/application
*/
import type { APIEmoji, LocalizationMap } from '.';
import type { Permissions, Snowflake } from '..';
import type { MakeRequired } from '../../common';
import type { Permissions, Snowflake } from '..';
import type { APIEmoji, LocalizationMap } from '.';
import type { APIPartialGuild } from './guild';
import type { ApplicationIntegrationType } from './interactions';
import type { OAuth2Scopes } from './oauth2';

View File

@ -1,5 +1,5 @@
import type { APIAttachment, Snowflake } from '..';
import type { Identify, MakeRequired } from '../../common';
import type { APIAttachment, Snowflake } from '..';
import type { ChannelType } from '../utils';
/**

View File

@ -1,6 +1,7 @@
import type { Snowflake } from '..';
import type { APIGuildMember } from './guild';
import type { APIUser } from './user';
interface APIGuildScheduledEventBase<Type extends GuildScheduledEventEntityType> {
/**
* The id of the guild event

View File

@ -2,15 +2,18 @@ export * from './application';
export * from './auditLog';
export * from './autoModeration';
export * from './channel';
export * from './components';
export * from './emoji';
export * from './gateway';
export * from './guild';
export * from './guildScheduledEvent';
export * from './interactions';
export * from './invite';
export * from './monetization';
export * from './oauth2';
export * from './poll';
export * from './permissions';
export * from './poll';
export * from './soundboard';
export * from './stageInstance';
export * from './sticker';
export * from './teams';
@ -18,9 +21,6 @@ export * from './template';
export * from './user';
export * from './voice';
export * from './webhook';
export * from './monetization';
export * from './soundboard';
export * from './components';
import type { LocaleString } from '../rest';

View File

@ -10,16 +10,16 @@ export * from './guild';
export * from './guildScheduledEvent';
export * from './interactions';
export * from './invite';
export * from './monetization';
export * from './oauth2';
export * from './poll';
export * from './soundboard';
export * from './stageInstance';
export * from './sticker';
export * from './template';
export * from './user';
export * from './voice';
export * from './webhook';
export * from './monetization';
export * from './soundboard';
export type DefaultUserAvatarAssets = 0 | 1 | 2 | 3 | 4 | 5;

View File

@ -23,8 +23,8 @@ import type {
GatewayGuildIntegrationsUpdateDispatchData,
GatewayGuildMemberAddDispatchData,
GatewayGuildMemberRemoveDispatchData,
GatewayGuildMemberUpdateDispatchData,
GatewayGuildMembersChunkDispatchData,
GatewayGuildMemberUpdateDispatchData,
GatewayGuildRoleCreateDispatchData,
GatewayGuildRoleDeleteDispatchData,
GatewayGuildRoleUpdateDispatchData,
@ -55,8 +55,8 @@ import type {
GatewayThreadCreateDispatchData,
GatewayThreadDeleteDispatchData,
GatewayThreadListSyncDispatchData,
GatewayThreadMemberUpdateDispatchData,
GatewayThreadMembersUpdateDispatchData,
GatewayThreadMemberUpdateDispatchData,
GatewayTypingStartDispatchData,
GatewayUserUpdateDispatchData,
GatewayVoiceChannelEffectSendDispachData,

View File

@ -1,5 +1,5 @@
import { inflateSync } from 'node:zlib';
import { LogLevels, Logger, type MakeRequired, MergeOptions, delay, hasIntent } from '../../common';
import { delay, hasIntent, Logger, LogLevels, type MakeRequired, MergeOptions } from '../../common';
import {
type APIGuildMember,
GatewayCloseCodes,
@ -56,10 +56,7 @@ export class Shard {
{
members: APIGuildMember[];
presences: GatewayGuildMembersChunkPresence[];
resolve: (value: {
members: APIGuildMember[];
presences: GatewayGuildMembersChunkPresence[];
}) => void;
resolve: (value: { members: APIGuildMember[]; presences: GatewayGuildMembersChunkPresence[] }) => void;
reject: (reason?: any) => void;
}
>();
@ -138,7 +135,6 @@ export class Shard {
);
// @ts-expect-error Use native websocket when using Bun
// biome-ignore lint/correctness/noUndeclaredVariables: /\
this.websocket = new BaseSocket(typeof Bun === 'undefined' ? 'ws' : 'bun', this.currentGatewayURL);
this.websocket.onmessage = ({ data }: { data: string | Buffer }) => {
@ -374,10 +370,7 @@ export class Shard {
) {
const nonce = Date.now().toString() + Math.random().toString(36);
let resolve: (value: {
members: APIGuildMember[];
presences: GatewayGuildMembersChunkPresence[];
}) => void = () => {
let resolve: (value: { members: APIGuildMember[]; presences: GatewayGuildMembersChunkPresence[] }) => void = () => {
//
};
let reject: (reason?: any) => void = () => {

View File

@ -1,11 +1,11 @@
import {
LogLevels,
calculateShardId,
Logger,
LogLevels,
lazyLoadPackage,
type MakeRequired,
MergeOptions,
type WatcherSendToShard,
calculateShardId,
lazyLoadPackage,
} from '../../common';
import type { DeepPartial, MakeDeepPartial } from '../../common/types/util';
import {

View File

@ -1,4 +1,4 @@
import { type UUID, createHash, randomBytes, randomUUID } from 'node:crypto';
import { createHash, randomBytes, randomUUID, type UUID } from 'node:crypto';
import { request } from 'node:https';
import type { Socket } from 'node:net';

View File

@ -1,12 +1,12 @@
import cluster, { type Worker as ClusterWorker } from 'node:cluster';
import { type UUID, randomUUID } from 'node:crypto';
import { randomUUID, type UUID } from 'node:crypto';
import type { Worker as WorkerThreadsWorker } from 'node:worker_threads';
import { ApiHandler, type CustomWorkerManagerEvents, Logger, type UsingClient, type WorkerClient } from '../..';
import { type Adapter, MemoryAdapter } from '../../cache';
import { BaseClient, type InternalRuntimeConfig } from '../../client/base';
import { BASE_HOST, type Identify, MergeOptions, type PickPartial, lazyLoadPackage } from '../../common';
import { BASE_HOST, type Identify, lazyLoadPackage, MergeOptions, type PickPartial } from '../../common';
import type { GatewayPresenceUpdateData, GatewaySendPayload, RESTGetAPIGatewayBotResult } from '../../types';
import { WorkerManagerDefaults, properties } from '../constants';
import { properties, WorkerManagerDefaults } from '../constants';
import { DynamicBucket } from '../structures';
import { ConnectQueue } from '../structures/timeout';
import { Heartbeater, type WorkerHeartbeaterMessages } from './heartbeater';

View File

@ -1,3 +1,3 @@
export * from './SharedTypes';
export * from './constants';
export * from './discord';
export * from './SharedTypes';

View File

@ -1,4 +1,4 @@
import { type Logger, delay } from '../../common';
import { delay, type Logger } from '../../common';
/**
* options of the dynamic bucket