chore: Migrate ESLint and prettier to Biome (#3634)

* Migrate eslint and prettier to biomejs

This does NOT include examples/bigbot as it has its own formatter

* Update to biome 1.8.0

* Readd dotenv dev dependency to rest

During a merge it got lost
This commit is contained in:
Fleny
2024-07-13 13:05:02 -05:00
committed by GitHub
parent 7b3bd76c82
commit 919474069d
132 changed files with 722 additions and 4993 deletions
+1 -1
View File
@@ -17,7 +17,7 @@
// Configure properties specific to VS Code. // Configure properties specific to VS Code.
"vscode": { "vscode": {
// Add the IDs of extensions you want installed when the container is created. // Add the IDs of extensions you want installed when the container is created.
"extensions": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"] "extensions": ["biomejs.biome"]
} }
}, },
-5
View File
@@ -1,5 +0,0 @@
{
"root": true,
// This tells ESLint to load the config from the package `eslint-config-discordeno`
"extends": ["discordeno"]
}
-7
View File
@@ -1,7 +0,0 @@
{
"trailingComma": "all",
"useTabs": false,
"singleQuote": true,
"semi": false,
"printWidth": 150
}
+1 -1
View File
@@ -1,3 +1,3 @@
{ {
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"] "recommendations": ["biomejs.biome"]
} }
+5 -7
View File
@@ -2,38 +2,36 @@
"editor.tabSize": 2, "editor.tabSize": 2,
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.formatOnPaste": true, "editor.formatOnPaste": true,
"editor.codeActionsOnSave": ["source.organizeImports", "source.fixAll.eslint"], "editor.codeActionsOnSave": ["source.organizeImports.biome", "source.fixAll.biome"],
"eslint.validate": ["typescript", "javascript"],
"files.associations": { "files.associations": {
"*.ts": "typescript", "*.ts": "typescript",
"*.js": "javascript" "*.js": "javascript"
}, },
"typescript.tsdk": "node_modules\\typescript\\lib", "typescript.tsdk": "node_modules\\typescript\\lib",
"[json]": { "[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode", "editor.defaultFormatter": "biomejs.biome",
"editor.quickSuggestions": { "editor.quickSuggestions": {
"strings": true "strings": true
}, },
"editor.suggest.insertMode": "replace" "editor.suggest.insertMode": "replace"
}, },
"[jsonc]": { "[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode", "editor.defaultFormatter": "biomejs.biome",
"editor.quickSuggestions": { "editor.quickSuggestions": {
"strings": true "strings": true
}, },
"editor.suggest.insertMode": "replace" "editor.suggest.insertMode": "replace"
}, },
"[yaml]": { "[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.insertSpaces": true, "editor.insertSpaces": true,
"editor.tabSize": 2, "editor.tabSize": 2,
"editor.autoIndent": "advanced", "editor.autoIndent": "advanced",
"diffEditor.ignoreTrimWhitespace": false "diffEditor.ignoreTrimWhitespace": false
}, },
"[javascript]": { "[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint" "editor.defaultFormatter": "biomejs.biome"
}, },
"[typescript]": { "[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint" "editor.defaultFormatter": "biomejs.biome"
} }
} }
-1
View File
@@ -1,5 +1,4 @@
await import(`https://raw.githubusercontent.com/discordeno/discordeno/benchies/benchmarksResult/data.js`) await import(`https://raw.githubusercontent.com/discordeno/discordeno/benchies/benchmarksResult/data.js`)
const commitSha = await Deno.readTextFile('./sha')
const results = JSON.parse(await Deno.readTextFile('./data.json')) const results = JSON.parse(await Deno.readTextFile('./data.json'))
interface BenchmarksData { interface BenchmarksData {
+61
View File
@@ -0,0 +1,61 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 150
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"correctness": {
"noUnusedVariables": "error"
},
"style": {
"noNamespace": "error",
"noNonNullAssertion": "off",
"useConsistentArrayType": {
"level": "error",
"options": { "syntax": "shorthand" }
}
}
}
},
"javascript": {
"formatter": {
"trailingCommas": "all",
"semicolons": "asNeeded",
"quoteStyle": "single"
}
},
"json": {
"parser": {
"allowComments": true,
"allowTrailingCommas": true
}
},
"files": {
"ignore": [
"node_modules",
// Ignore turbo and docusaurus cache/stuff
".docusaurus",
".turbo",
// Remove the yarn script as it is minified
".yarn",
// Ignore build outputs
"bunTestsDist",
"build",
"coverage",
"denoTestsDist",
"dist"
],
"ignoreUnknown": true
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
import fastifyMultipart from '@fastify/multipart'
import fastifyEnv from '@fastify/env' import fastifyEnv from '@fastify/env'
import fastifyHelmet from '@fastify/helmet' import fastifyHelmet from '@fastify/helmet'
import fastifyMultipart from '@fastify/multipart'
import fastify, { type FastifyInstance } from 'fastify' import fastify, { type FastifyInstance } from 'fastify'
export const buildFastifyApp = async (): Promise<FastifyInstance> => { export const buildFastifyApp = async (): Promise<FastifyInstance> => {
+2 -2
View File
@@ -1,5 +1,5 @@
import { type RequestMethods, createRestManager } from '@discordeno/rest'
import type { MultipartFile, MultipartValue } from '@fastify/multipart' import type { MultipartFile, MultipartValue } from '@fastify/multipart'
import { createRestManager, type RequestMethods } from '@discordeno/rest'
import { buildFastifyApp } from './fastify.js' import { buildFastifyApp } from './fastify.js'
const app = await buildFastifyApp() const app = await buildFastifyApp()
@@ -13,7 +13,7 @@ const discordRestManager = createRestManager({
token: app.config.DISCORD_TOKEN, token: app.config.DISCORD_TOKEN,
}) })
app.get('/timecheck', async (request, reply) => { app.get('/timecheck', async (_request, reply) => {
reply.status(200).send({ reply.status(200).send({
message: Date.now(), message: Date.now(),
}) })
+1 -1
View File
@@ -1,4 +1,4 @@
import { createBot, Intents, LogDepth, type logger as discordenoLogger } from '@discordeno/bot' import { Intents, LogDepth, createBot, type logger as discordenoLogger } from '@discordeno/bot'
import { createProxyCache } from 'dd-cache-proxy' import { createProxyCache } from 'dd-cache-proxy'
import { configs } from './config.js' import { configs } from './config.js'
+1 -1
View File
@@ -1,4 +1,4 @@
import { Collection, type ApplicationCommandOption, type ApplicationCommandTypes, type Interaction } from '@discordeno/bot' import { type ApplicationCommandOption, type ApplicationCommandTypes, Collection, type Interaction } from '@discordeno/bot'
export const commands = new Collection<string, Command>() export const commands = new Collection<string, Command>()
+1 -1
View File
@@ -1,4 +1,4 @@
import { ApplicationCommandOptionTypes, ApplicationCommandTypes, createEmbeds, Permissions, type Member, type User } from '@discordeno/bot' import { ApplicationCommandOptionTypes, ApplicationCommandTypes, type Member, Permissions, type User, createEmbeds } from '@discordeno/bot'
import { bot } from '../bot.js' import { bot } from '../bot.js'
import { createCommand } from '../commands.js' import { createCommand } from '../commands.js'
import { calculateMemberPermissions } from '../utils/permissions.js' import { calculateMemberPermissions } from '../utils/permissions.js'
+1 -1
View File
@@ -1,5 +1,5 @@
import { logger } from '@discordeno/bot'
import { readdir } from 'node:fs/promises' import { readdir } from 'node:fs/promises'
import { logger } from '@discordeno/bot'
export default async function importDirectory(folder: string): Promise<void> { export default async function importDirectory(folder: string): Promise<void> {
const files = await readdir(folder, { recursive: true }) const files = await readdir(folder, { recursive: true })
+1 -1
View File
@@ -1,5 +1,5 @@
import { BitwisePermissionFlags, type Guild, type Member } from '@discordeno/bot'
import assert from 'node:assert' import assert from 'node:assert'
import { BitwisePermissionFlags, type Guild, type Member } from '@discordeno/bot'
export async function calculateMemberPermissions(guild: Guild, member: Member): Promise<bigint> { export async function calculateMemberPermissions(guild: Guild, member: Member): Promise<bigint> {
if (member.id === guild.ownerId) return 8n if (member.id === guild.ownerId) return 8n
+1 -1
View File
@@ -1,4 +1,4 @@
import { Collection, type ApplicationCommandOption, type ApplicationCommandTypes, type Interaction } from '@discordeno/bot' import { type ApplicationCommandOption, type ApplicationCommandTypes, Collection, type Interaction } from '@discordeno/bot'
export const commands = new Collection<string, Command>() export const commands = new Collection<string, Command>()
@@ -1,4 +1,4 @@
import { ApplicationCommandOptionTypes, hasProperty, type Guild } from '@discordeno/bot' import { ApplicationCommandOptionTypes, type Guild, hasProperty } from '@discordeno/bot'
import chalk from 'chalk' import chalk from 'chalk'
import { bot } from '../bot.js' import { bot } from '../bot.js'
import { commands } from '../commands.js' import { commands } from '../commands.js'
+5 -5
View File
@@ -1,14 +1,14 @@
import { hasProperty, type Bot, type CreateApplicationCommand, type Guild } from '@discordeno/bot' import { type Bot, type CreateApplicationCommand, type Guild, hasProperty } from '@discordeno/bot'
import { bot } from '../bot.js' import { bot } from '../bot.js'
import { commands, type SubCommand, type SubCommandGroup } from '../commands.js' import { type SubCommand, type SubCommandGroup, commands } from '../commands.js'
import { createLogger } from './logger.js' import { createLogger } from './logger.js'
const logger = createLogger({ name: 'Helpers' }) const logger = createLogger({ name: 'Helpers' })
/** This function will update all commands, or the defined scope */ /** This function will update all commands, or the defined scope */
export async function updateCommands(scope?: 'Guild' | 'Global'): Promise<void> { export async function updateCommands(scope?: 'Guild' | 'Global'): Promise<void> {
const globalCommands: Array<MakeRequired<CreateApplicationCommand, 'name'>> = [] const globalCommands: MakeRequired<CreateApplicationCommand, 'name'>[] = []
const perGuildCommands: Array<MakeRequired<CreateApplicationCommand, 'name'>> = [] const perGuildCommands: MakeRequired<CreateApplicationCommand, 'name'>[] = []
for (const command of commands.values()) { for (const command of commands.values()) {
if (command.scope === 'Guild') { if (command.scope === 'Guild') {
@@ -44,7 +44,7 @@ export async function updateCommands(scope?: 'Guild' | 'Global'): Promise<void>
/** Update commands for a guild */ /** Update commands for a guild */
export async function updateGuildCommands(bot: Bot, guild: Guild): Promise<void> { export async function updateGuildCommands(bot: Bot, guild: Guild): Promise<void> {
const perGuildCommands: Array<MakeRequired<CreateApplicationCommand, 'name'>> = [] const perGuildCommands: MakeRequired<CreateApplicationCommand, 'name'>[] = []
for (const command of commands.values()) { for (const command of commands.values()) {
if (command.scope === 'Guild') { if (command.scope === 'Guild') {
+1 -1
View File
@@ -1,4 +1,4 @@
import { Collection, LogDepth, createBot, type Bot, type logger } from '@discordeno/bot' import { type Bot, Collection, LogDepth, createBot, type logger } from '@discordeno/bot'
import { DISCORD_TOKEN, GATEWAY_AUTHORIZATION, GATEWAY_INTENTS, GATEWAY_URL, REST_AUTHORIZATION, REST_URL } from '../config.js' import { DISCORD_TOKEN, GATEWAY_AUTHORIZATION, GATEWAY_INTENTS, GATEWAY_URL, REST_AUTHORIZATION, REST_URL } from '../config.js'
import type { ManagerGetShardInfoFromGuildId, ShardInfo, WorkerPresencesUpdate, WorkerShardPayload } from '../gateway/worker/types.js' import type { ManagerGetShardInfoFromGuildId, ShardInfo, WorkerPresencesUpdate, WorkerShardPayload } from '../gateway/worker/types.js'
import type { Command } from './commands.js' import type { Command } from './commands.js'
@@ -1,4 +1,4 @@
import { InteractionTypes, LogLevels, commandOptionsParser, type Interaction, type logger } from '@discordeno/bot' import { type Interaction, InteractionTypes, LogLevels, commandOptionsParser, type logger } from '@discordeno/bot'
import chalk from 'chalk' import chalk from 'chalk'
import { bot } from '../../bot.js' import { bot } from '../../bot.js'
@@ -48,6 +48,5 @@ function logCommand(
const command = `Command${autocomplete}: ${chalk.bgYellow.black(commandName || 'Unknown')} - ${chalk.bgBlack(typeColor)}` const command = `Command${autocomplete}: ${chalk.bgYellow.black(commandName || 'Unknown')} - ${chalk.bgBlack(typeColor)}`
const user = chalk.bgGreen.black(`@${interaction.user.username} (${interaction.user.id})`) const user = chalk.bgGreen.black(`@${interaction.user.username} (${interaction.user.id})`)
const guild = chalk.bgMagenta.black(interaction.guildId ? `guildId: ${interaction.guildId}` : 'DM') const guild = chalk.bgMagenta.black(interaction.guildId ? `guildId: ${interaction.guildId}` : 'DM')
;(bot.logger as typeof logger).log(logLevel, `${command} - By ${user} in ${guild}`, ...restArgs) ;(bot.logger as typeof logger).log(logLevel, `${command} - By ${user} in ${guild}`, ...restArgs)
} }
+1 -1
View File
@@ -1,5 +1,5 @@
import { createEmbeds } from '@discordeno/bot'
import { inspect } from 'node:util' import { inspect } from 'node:util'
import { createEmbeds } from '@discordeno/bot'
import { BUGS_ERRORS_REPORT_WEBHOOK } from '../../config.js' import { BUGS_ERRORS_REPORT_WEBHOOK } from '../../config.js'
import { bot } from '../bot.js' import { bot } from '../bot.js'
import { webhookURLToIDAndToken } from '../utils/webhook.js' import { webhookURLToIDAndToken } from '../utils/webhook.js'
+1 -1
View File
@@ -1,6 +1,6 @@
import { join as joinPath } from 'node:path'
import type { DiscordGatewayPayload, GatewayDispatchEventNames } from '@discordeno/bot' import type { DiscordGatewayPayload, GatewayDispatchEventNames } from '@discordeno/bot'
import { connect as connectAmqp } from 'amqplib' import { connect as connectAmqp } from 'amqplib'
import { join as joinPath } from 'node:path'
import { import {
EVENT_HANDLER_HOST, EVENT_HANDLER_HOST,
EVENT_HANDLER_PORT, EVENT_HANDLER_PORT,
@@ -1,5 +1,5 @@
import { createGatewayManager, createLogger, createRestManager, LogDepth } from '@discordeno/bot'
import type { Worker } from 'node:worker_threads' import type { Worker } from 'node:worker_threads'
import { LogDepth, createGatewayManager, createLogger, createRestManager } from '@discordeno/bot'
import { DISCORD_TOKEN, GATEWAY_INTENTS, REST_AUTHORIZATION, REST_URL, SHARDS_PER_WORKER, TOTAL_SHARDS, TOTAL_WORKERS } from '../config.js' import { DISCORD_TOKEN, GATEWAY_INTENTS, REST_AUTHORIZATION, REST_URL, SHARDS_PER_WORKER, TOTAL_SHARDS, TOTAL_WORKERS } from '../config.js'
import { createWorker } from './worker/createWorker.js' import { createWorker } from './worker/createWorker.js'
import type { WorkerMessage } from './worker/types.js' import type { WorkerMessage } from './worker/types.js'
+2 -2
View File
@@ -1,8 +1,8 @@
import { createLogger, DiscordenoShard, GatewayOpcodes, LogDepth } from '@discordeno/bot'
import { connect as connectAmqp, type Channel as amqpChannel } from 'amqplib'
import assert from 'node:assert' import assert from 'node:assert'
import { createHash } from 'node:crypto' import { createHash } from 'node:crypto'
import { workerData as _workerData, parentPort } from 'node:worker_threads' import { workerData as _workerData, parentPort } from 'node:worker_threads'
import { DiscordenoShard, GatewayOpcodes, LogDepth, createLogger } from '@discordeno/bot'
import { type Channel as amqpChannel, connect as connectAmqp } from 'amqplib'
import { promiseWithResolvers } from '../../util.js' import { promiseWithResolvers } from '../../util.js'
import type { ManagerMessage, WorkerCreateData, WorkerMessage } from './types.js' import type { ManagerMessage, WorkerCreateData, WorkerMessage } from './types.js'
+1 -1
View File
@@ -1,4 +1,4 @@
import { createLogger, createRestManager, LogDepth } from '@discordeno/bot' import { LogDepth, createLogger, createRestManager } from '@discordeno/bot'
import { DISCORD_TOKEN } from '../config.js' import { DISCORD_TOKEN } from '../config.js'
import { setupRestAnalyticsHooks } from './influx.js' import { setupRestAnalyticsHooks } from './influx.js'
+1 -1
View File
@@ -1,4 +1,4 @@
import { Collection, Intents, createBot, type Bot } from '@discordeno/bot' import { type Bot, Collection, Intents, createBot } from '@discordeno/bot'
import { configs } from './config.js' import { configs } from './config.js'
import type { Command } from './types/commands.js' import type { Command } from './types/commands.js'
@@ -1,12 +1,12 @@
import { import {
DiscordInteractionContextType,
MessageComponentTypes,
TextStyles,
type ActionRow, type ActionRow,
type ButtonComponent, type ButtonComponent,
DiscordInteractionContextType,
type Interaction, type Interaction,
MessageComponentTypes,
type Role, type Role,
type SelectMenuComponent, type SelectMenuComponent,
TextStyles,
} from '@discordeno/bot' } from '@discordeno/bot'
import { ApplicationCommandOptionTypes, ButtonStyles } from '@discordeno/types' import { ApplicationCommandOptionTypes, ButtonStyles } from '@discordeno/types'
import ItemCollector from '../collector.js' import ItemCollector from '../collector.js'
@@ -1,4 +1,4 @@
import { InteractionTypes, MessageComponentTypes, commandOptionsParser, type EventHandlers, type Interaction } from '@discordeno/bot' import { type EventHandlers, type Interaction, InteractionTypes, MessageComponentTypes, commandOptionsParser } from '@discordeno/bot'
import type ItemCollector from '../collector.js' import type ItemCollector from '../collector.js'
import commands from '../commands/index.js' import commands from '../commands/index.js'
+4 -10
View File
@@ -3,9 +3,7 @@
"version": "19.0.0-alpha.1", "version": "19.0.0-alpha.1",
"private": true, "private": true,
"type": "module", "type": "module",
"workspaces": [ "workspaces": ["packages/*"],
"packages/*"
],
"scripts": { "scripts": {
"build": "turbo run build --no-daemon", "build": "turbo run build --no-daemon",
"build:watch": "echo \"Starting build in watch mode...\" && chokidar \"packages/**/*.ts\" --ignore \"packages/**/dist/**/*.d.ts\" -c \"yarn run build && yarn run build:type\"", "build:watch": "echo \"Starting build in watch mode...\" && chokidar \"packages/**/*.ts\" --ignore \"packages/**/dist/**/*.d.ts\" -c \"yarn run build && yarn run build:type\"",
@@ -13,7 +11,7 @@
"build:type": "turbo run build:type --no-daemon", "build:type": "turbo run build:type --no-daemon",
"dev": "turbo run dev --parallel --no-daemon", "dev": "turbo run dev --parallel --no-daemon",
"fmt": "turbo run fmt --no-daemon", "fmt": "turbo run fmt --no-daemon",
"format": "prettier --write \"**/*.{ts,tsx,md}\"", "format": "biome format --write",
"lint": "turbo run lint --no-daemon", "lint": "turbo run lint --no-daemon",
"prepare": "husky", "prepare": "husky",
"release-build": "turbo run release-build --no-daemon", "release-build": "turbo run release-build --no-daemon",
@@ -28,12 +26,10 @@
"test:unit-coverage": "turbo run test:unit-coverage --no-daemon" "test:unit-coverage": "turbo run test:unit-coverage --no-daemon"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^1.8.0",
"chokidar-cli": "^3.0.0", "chokidar-cli": "^3.0.0",
"eslint": "^8.57.0",
"eslint-config-discordeno": "*",
"husky": "^9.0.11", "husky": "^9.0.11",
"lint-staged": "^15.2.7", "lint-staged": "^15.2.7",
"prettier": "^3.3.3",
"turbo": "^1.11.3", "turbo": "^1.11.3",
"typedoc": "^0.26.4", "typedoc": "^0.26.4",
"typedoc-plugin-markdown": "^4.1.2", "typedoc-plugin-markdown": "^4.1.2",
@@ -43,9 +39,7 @@
"node": ">=18.0.0" "node": ">=18.0.0"
}, },
"lint-staged": { "lint-staged": {
"*.{js,jsx,ts,tsx,md,html,css}": "yarn run prettier --ignore-unknown --write", "*": "yarn biome check --no-errors-on-unmatched --write"
"!(website)/**/*.{js,ts,tsx}": "yarn run eslint --fix --config ./packages/eslint-config-discordeno/index.js --resolve-plugins-relative-to .",
"website/**/*.{js,ts,tsx}": "yarn run eslint --fix --config ./website/.eslintrc.yml --resolve-plugins-relative-to ./website"
}, },
"packageManager": "yarn@4.0.2" "packageManager": "yarn@4.0.2"
} }
+3 -4
View File
@@ -16,8 +16,8 @@
"scripts": { "scripts": {
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types", "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types",
"release-build": "yarn build && yarn build:type", "release-build": "yarn build && yarn build:type",
"fmt": "eslint --fix \"src/**/*.ts*\"", "fmt": "biome format --write",
"lint": "eslint \"src/**/*.ts*\"", "lint": "biome lint --write",
"build": "swc src --strip-leading-paths --delete-dir-on-start --out-dir dist && node ../../scripts/fixBenchExtension.js", "build": "swc src --strip-leading-paths --delete-dir-on-start --out-dir dist && node ../../scripts/fixBenchExtension.js",
"build-message": "swc src/generateMessage.ts --strip-leading-paths -C sourceMaps=false --out-dir ../../scripts && node ../../scripts/fixBenchExtension.js", "build-message": "swc src/generateMessage.ts --strip-leading-paths -C sourceMaps=false --out-dir ../../scripts && node ../../scripts/fixBenchExtension.js",
"bench": "node dist/index.js" "bench": "node dist/index.js"
@@ -31,12 +31,11 @@
"benchmark": "^2.1.4" "benchmark": "^2.1.4"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^1.8.0",
"@swc/cli": "^0.4.0", "@swc/cli": "^0.4.0",
"@swc/core": "^1.4.2", "@swc/core": "^1.4.2",
"@types/benchmark": "^2.1.5", "@types/benchmark": "^2.1.5",
"@types/node": "^20.14.10", "@types/node": "^20.14.10",
"eslint": "^8.57.0",
"eslint-config-discordeno": "*",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"tsconfig": "*", "tsconfig": "*",
"typescript": "^5.5.3" "typescript": "^5.5.3"
+1 -1
View File
@@ -1,4 +1,4 @@
import { createBot, snakeToCamelCase, type Bot } from '@discordeno/bot' import { type Bot, createBot, snakeToCamelCase } from '@discordeno/bot'
import { events as dbEvents } from '../utils/db.js' import { events as dbEvents } from '../utils/db.js'
import { memoryBenchmark } from '../utils/memoryBenchmark.js' import { memoryBenchmark } from '../utils/memoryBenchmark.js'
@@ -1,6 +1,8 @@
import { import {
ApplicationFlags, ApplicationFlags,
type Bot,
ButtonStyles, ButtonStyles,
type DiscordMessage,
InteractionTypes, InteractionTypes,
MemberToggles, MemberToggles,
MessageActivityTypes, MessageActivityTypes,
@@ -13,8 +15,6 @@ import {
UserFlags, UserFlags,
createBot, createBot,
iconHashToBigInt, iconHashToBigInt,
type Bot,
type DiscordMessage,
} from '@discordeno/bot' } from '@discordeno/bot'
import { memoryBenchmark } from '../utils/memoryBenchmark.js' import { memoryBenchmark } from '../utils/memoryBenchmark.js'
@@ -390,7 +390,6 @@ function oldtransformMessage(bot: Bot, payload: DiscordMessage): any {
// UNTRANSFORMED STUFF HERE // UNTRANSFORMED STUFF HERE
content: payload.content ?? '', content: payload.content ?? '',
isFromBot: payload.author.bot ?? false, isFromBot: payload.author.bot ?? false,
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
tag: `${payload.author.username}#${payload.author.discriminator}`, tag: `${payload.author.username}#${payload.author.discriminator}`,
timestamp: Date.parse(payload.timestamp), timestamp: Date.parse(payload.timestamp),
editedTimestamp: payload.edited_timestamp ? Date.parse(payload.edited_timestamp) : undefined, editedTimestamp: payload.edited_timestamp ? Date.parse(payload.edited_timestamp) : undefined,
@@ -483,7 +482,7 @@ await memoryBenchmark(
(object, event: DiscordMessage) => object.cache.push(oldtransformMessage(bot, event)), (object, event: DiscordMessage) => object.cache.push(oldtransformMessage(bot, event)),
// function specify how to add event to the object/ run the object // function specify how to add event to the object/ run the object
[...new Array(MESSAGE_SIZE)].map( [...new Array(MESSAGE_SIZE)].map(
(i) => () =>
({ ({
activity: { activity: {
party_id: 'party_id', party_id: 'party_id',
+1 -2
View File
@@ -1,6 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import type { DiscordGatewayPayload } from '@discordeno/types'
import fs from 'node:fs/promises' import fs from 'node:fs/promises'
import type { DiscordGatewayPayload } from '@discordeno/types'
export const events: Array<{ export const events: Array<{
shardId: number shardId: number
@@ -14,7 +14,6 @@ export async function memoryBenchmark<O, E>(
const stages = ['start', 'loaded', 'end', 'cached'] as const const stages = ['start', 'loaded', 'end', 'cached'] as const
const typesOfMemUsages = ['rss', 'heapUsed', 'heapTotal'] as const const typesOfMemUsages = ['rss', 'heapUsed', 'heapTotal'] as const
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
async function runTest(object: O) { async function runTest(object: O) {
// Determine memory stats now before touching anything // Determine memory stats now before touching anything
const results: { const results: {
+3 -4
View File
@@ -18,8 +18,8 @@
"build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js", "build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js",
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types", "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types",
"release-build": "yarn build && yarn build:type", "release-build": "yarn build && yarn build:type",
"fmt": "eslint --fix \"src/**/*.ts*\"", "fmt": "biome format --write",
"lint": "eslint \"src/**/*.ts*\"", "lint": "biome lint --write",
"test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'", "test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'",
"test:unit": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js discordeno", "test:unit": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js discordeno",
"test:deno-unit": "swc tests --strip-leading-paths --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist/unit", "test:deno-unit": "swc tests --strip-leading-paths --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist/unit",
@@ -35,6 +35,7 @@
"@discordeno/utils": "19.0.0-beta.1" "@discordeno/utils": "19.0.0-beta.1"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^1.8.0",
"@swc/cli": "^0.4.0", "@swc/cli": "^0.4.0",
"@swc/core": "^1.4.2", "@swc/core": "^1.4.2",
"@types/chai": "^4.3.16", "@types/chai": "^4.3.16",
@@ -43,8 +44,6 @@
"@types/sinon": "^17.0.3", "@types/sinon": "^17.0.3",
"c8": "^9.1.0", "c8": "^9.1.0",
"chai": "^5.1.1", "chai": "^5.1.1",
"eslint": "^8.57.0",
"eslint-config-discordeno": "*",
"mocha": "^10.5.1", "mocha": "^10.5.1",
"sinon": "^18.0.0", "sinon": "^18.0.0",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
+3 -3
View File
@@ -3,10 +3,10 @@ import { ShardSocketCloseCodes, createGatewayManager } from '@discordeno/gateway
import type { CreateRestManagerOptions, RestManager } from '@discordeno/rest' import type { CreateRestManagerOptions, RestManager } from '@discordeno/rest'
import { createRestManager } from '@discordeno/rest' import { createRestManager } from '@discordeno/rest'
import type { BigString, DiscordGatewayPayload, DiscordReady, GatewayIntents } from '@discordeno/types' import type { BigString, DiscordGatewayPayload, DiscordReady, GatewayIntents } from '@discordeno/types'
import { createLogger, getBotIdFromToken, type Collection, type logger } from '@discordeno/utils' import { type Collection, createLogger, getBotIdFromToken, type logger } from '@discordeno/utils'
import { createBotGatewayHandlers } from './handlers.js' import { createBotGatewayHandlers } from './handlers.js'
import { createBotHelpers, type BotHelpers } from './helpers.js' import { type BotHelpers, createBotHelpers } from './helpers.js'
import { createTransformers, type Transformers } from './transformers.js' import { type Transformers, createTransformers } from './transformers.js'
import type { ApplicationCommandPermission } from './transformers/applicationCommandPermission.js' import type { ApplicationCommandPermission } from './transformers/applicationCommandPermission.js'
import type { AuditLogEntry } from './transformers/auditLogEntry.js' import type { AuditLogEntry } from './transformers/auditLogEntry.js'
import type { AutoModerationActionExecution } from './transformers/automodActionExecution.js' import type { AutoModerationActionExecution } from './transformers/automodActionExecution.js'
@@ -1,6 +1,6 @@
import type { Bot, DiscordChannel, DiscordGatewayPayload } from '../../index.js' import type { Bot, DiscordChannel, DiscordGatewayPayload } from '../../index.js'
export async function handleChannelCreate(bot: Bot, payload: DiscordGatewayPayload, shardId: number): Promise<void> { export async function handleChannelCreate(bot: Bot, payload: DiscordGatewayPayload, _shardId: number): Promise<void> {
if (!bot.events.channelCreate) return if (!bot.events.channelCreate) return
const data = payload.d as DiscordChannel const data = payload.d as DiscordChannel
@@ -1,7 +1,7 @@
import type { DiscordGatewayPayload, DiscordThreadMembersUpdate } from '@discordeno/types' import type { DiscordGatewayPayload, DiscordThreadMembersUpdate } from '@discordeno/types'
import type { Bot } from '../../index.js' import type { Bot } from '../../index.js'
export async function handleThreadMembersUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> { export async function handleThreadMembersUpdate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
if (!bot.events.threadMembersUpdate) return if (!bot.events.threadMembersUpdate) return
const payload = data.d as DiscordThreadMembersUpdate const payload = data.d as DiscordThreadMembersUpdate
@@ -1,7 +1,7 @@
import type { DiscordGatewayPayload, DiscordThreadMemberUpdate } from '@discordeno/types' import type { DiscordGatewayPayload, DiscordThreadMemberUpdate } from '@discordeno/types'
import type { Bot } from '../../index.js' import type { Bot } from '../../index.js'
export async function handleThreadMemberUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> { export async function handleThreadMemberUpdate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
if (!bot.events.threadMemberUpdate) return if (!bot.events.threadMemberUpdate) return
const payload = data.d as DiscordThreadMemberUpdate const payload = data.d as DiscordThreadMemberUpdate
@@ -1,6 +1,6 @@
import type { Bot, DiscordGatewayPayload, DiscordGuildStickersUpdate } from '../../index.js' import type { Bot, DiscordGatewayPayload, DiscordGuildStickersUpdate } from '../../index.js'
export async function handleGuildStickersUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> { export async function handleGuildStickersUpdate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
if (!bot.events.guildStickersUpdate) return if (!bot.events.guildStickersUpdate) return
const payload = data.d as DiscordGuildStickersUpdate const payload = data.d as DiscordGuildStickersUpdate
@@ -2,7 +2,7 @@ import type { DiscordAutoModerationActionExecution, DiscordGatewayPayload } from
import type { Bot } from '../../../bot.js' import type { Bot } from '../../../bot.js'
/** Requires the MANAGE_GUILD permission. */ /** Requires the MANAGE_GUILD permission. */
export async function handleAutoModerationActionExecution(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> { export async function handleAutoModerationActionExecution(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
if (!bot.events.automodActionExecution) return if (!bot.events.automodActionExecution) return
const payload = data.d as DiscordAutoModerationActionExecution const payload = data.d as DiscordAutoModerationActionExecution
@@ -2,7 +2,7 @@ import type { DiscordAutoModerationRule, DiscordGatewayPayload } from '@discorde
import type { Bot } from '../../../bot.js' import type { Bot } from '../../../bot.js'
/** Requires the MANAGE_GUILD permission. */ /** Requires the MANAGE_GUILD permission. */
export async function handleAutoModerationRuleCreate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> { export async function handleAutoModerationRuleCreate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
if (!bot.events.automodRuleCreate) return if (!bot.events.automodRuleCreate) return
const payload = data.d as DiscordAutoModerationRule const payload = data.d as DiscordAutoModerationRule
@@ -2,7 +2,7 @@ import type { DiscordAutoModerationRule, DiscordGatewayPayload } from '@discorde
import type { Bot } from '../../../bot.js' import type { Bot } from '../../../bot.js'
/** Requires the MANAGE_GUILD permission. */ /** Requires the MANAGE_GUILD permission. */
export async function handleAutoModerationRuleDelete(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> { export async function handleAutoModerationRuleDelete(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
if (!bot.events.automodRuleDelete) return if (!bot.events.automodRuleDelete) return
const payload = data.d as DiscordAutoModerationRule const payload = data.d as DiscordAutoModerationRule
@@ -2,7 +2,7 @@ import type { DiscordAutoModerationRule, DiscordGatewayPayload } from '@discorde
import type { Bot } from '../../../bot.js' import type { Bot } from '../../../bot.js'
/** Requires the MANAGE_GUILD permission. */ /** Requires the MANAGE_GUILD permission. */
export async function handleAutoModerationRuleUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> { export async function handleAutoModerationRuleUpdate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
if (!bot.events.automodRuleUpdate) return if (!bot.events.automodRuleUpdate) return
const payload = data.d as DiscordAutoModerationRule const payload = data.d as DiscordAutoModerationRule
@@ -1,7 +1,7 @@
import type { DiscordGatewayPayload, DiscordScheduledEvent } from '@discordeno/types' import type { DiscordGatewayPayload, DiscordScheduledEvent } from '@discordeno/types'
import type { Bot } from '../../../bot.js' import type { Bot } from '../../../bot.js'
export async function handleGuildScheduledEventCreate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> { export async function handleGuildScheduledEventCreate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
if (!bot.events.scheduledEventCreate) return if (!bot.events.scheduledEventCreate) return
const payload = data.d as DiscordScheduledEvent const payload = data.d as DiscordScheduledEvent
@@ -1,6 +1,6 @@
import type { Bot, DiscordGatewayPayload, DiscordGuildApplicationCommandPermissions } from '../../index.js' import type { Bot, DiscordGatewayPayload, DiscordGuildApplicationCommandPermissions } from '../../index.js'
export async function handleApplicationCommandPermissionsUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> { export async function handleApplicationCommandPermissionsUpdate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
if (!bot.events.applicationCommandPermissionsUpdate) return if (!bot.events.applicationCommandPermissionsUpdate) return
const payload = data.d as DiscordGuildApplicationCommandPermissions const payload = data.d as DiscordGuildApplicationCommandPermissions
@@ -1,7 +1,7 @@
import type { DiscordGatewayPayload, DiscordWebhookUpdate } from '@discordeno/types' import type { DiscordGatewayPayload, DiscordWebhookUpdate } from '@discordeno/types'
import type { Bot } from '../../index.js' import type { Bot } from '../../index.js'
export async function handleWebhooksUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> { export async function handleWebhooksUpdate(bot: Bot, data: DiscordGatewayPayload, _shardId: number): Promise<void> {
if (!bot.events.webhooksUpdate) return if (!bot.events.webhooksUpdate) return
const payload = data.d as DiscordWebhookUpdate const payload = data.d as DiscordWebhookUpdate
+1 -1
View File
@@ -69,8 +69,8 @@ import type {
GetInvite, GetInvite,
GetMessagesOptions, GetMessagesOptions,
GetReactions, GetReactions,
GetScheduledEvents,
GetScheduledEventUsers, GetScheduledEventUsers,
GetScheduledEvents,
GetUserGuilds, GetUserGuilds,
GetWebhookMessageOptions, GetWebhookMessageOptions,
InteractionCallbackData, InteractionCallbackData,
+1 -1
View File
@@ -14,7 +14,7 @@ export type Optionalize<T> = T extends object
? T extends unknown[] ? T extends unknown[]
? number extends T['length'] ? number extends T['length']
? T[number] extends object ? T[number] extends object
? Array<OptionalizeAux<T[number]>> ? OptionalizeAux<T[number]>[]
: T : T
: Partial<T> : Partial<T>
: OptionalizeAux<T> : OptionalizeAux<T>
+96 -96
View File
@@ -55,25 +55,26 @@ import type {
DiscordWelcomeScreen, DiscordWelcomeScreen,
} from '@discordeno/types' } from '@discordeno/types'
import { logger } from '@discordeno/utils' import { logger } from '@discordeno/utils'
import { bigintToSnowflake, snowflakeToBigint, type Bot } from './index.js' import { type Bot, bigintToSnowflake, snowflakeToBigint } from './index.js'
import { transformActivity, type Activity } from './transformers/activity.js' import { type Activity, transformActivity } from './transformers/activity.js'
import { transformApplication, type Application } from './transformers/application.js' import { type Application, transformApplication } from './transformers/application.js'
import { transformApplicationCommand, type ApplicationCommand } from './transformers/applicationCommand.js' import { type ApplicationCommand, transformApplicationCommand } from './transformers/applicationCommand.js'
import { transformApplicationCommandOption, type ApplicationCommandOption } from './transformers/applicationCommandOption.js' import { type ApplicationCommandOption, transformApplicationCommandOption } from './transformers/applicationCommandOption.js'
import { transformApplicationCommandOptionChoice, type ApplicationCommandOptionChoice } from './transformers/applicationCommandOptionChoice.js' import { type ApplicationCommandOptionChoice, transformApplicationCommandOptionChoice } from './transformers/applicationCommandOptionChoice.js'
import { transformApplicationCommandPermission, type ApplicationCommandPermission } from './transformers/applicationCommandPermission.js' import { type ApplicationCommandPermission, transformApplicationCommandPermission } from './transformers/applicationCommandPermission.js'
import { transformAttachment, type Attachment } from './transformers/attachment.js' import { type Attachment, transformAttachment } from './transformers/attachment.js'
import { transformAuditLogEntry, type AuditLogEntry } from './transformers/auditLogEntry.js' import { type AuditLogEntry, transformAuditLogEntry } from './transformers/auditLogEntry.js'
import { transformAutoModerationActionExecution, type AutoModerationActionExecution } from './transformers/automodActionExecution.js' import { type AutoModerationActionExecution, transformAutoModerationActionExecution } from './transformers/automodActionExecution.js'
import { transformAutoModerationRule, type AutoModerationRule } from './transformers/automodRule.js' import { type AutoModerationRule, transformAutoModerationRule } from './transformers/automodRule.js'
import { transformChannel, transformForumTag, type Channel, type ForumTag } from './transformers/channel.js' import { type Channel, type ForumTag, transformChannel, transformForumTag } from './transformers/channel.js'
import { transformComponent, type Component } from './transformers/component.js' import { type Component, transformComponent } from './transformers/component.js'
import { transformEmbed, type Embed } from './transformers/embed.js' import { type Embed, transformEmbed } from './transformers/embed.js'
import { transformDefaultReactionEmoji, transformEmoji, type DefaultReactionEmoji, type Emoji } from './transformers/emoji.js' import { type DefaultReactionEmoji, type Emoji, transformDefaultReactionEmoji, transformEmoji } from './transformers/emoji.js'
import { transformEntitlement, type Entitlement } from './transformers/entitlement.js' import { type Entitlement, transformEntitlement } from './transformers/entitlement.js'
import { transformGatewayBot, type GetGatewayBot } from './transformers/gatewayBot.js' import { type GetGatewayBot, transformGatewayBot } from './transformers/gatewayBot.js'
import { transformGuild, type Guild } from './transformers/guild.js' import { type Guild, transformGuild } from './transformers/guild.js'
import { import {
type AvatarDecorationData,
transformActivityToDiscordActivity, transformActivityToDiscordActivity,
transformApplicationCommandOptionChoiceToDiscordApplicationCommandOptionChoice, transformApplicationCommandOptionChoiceToDiscordApplicationCommandOptionChoice,
transformApplicationCommandOptionToDiscordApplicationCommandOption, transformApplicationCommandOptionToDiscordApplicationCommandOption,
@@ -86,47 +87,46 @@ import {
transformMemberToDiscordMember, transformMemberToDiscordMember,
transformTeamToDiscordTeam, transformTeamToDiscordTeam,
transformUserToDiscordUser, transformUserToDiscordUser,
type AvatarDecorationData,
} from './transformers/index.js' } from './transformers/index.js'
import { transformIntegration, type Integration } from './transformers/integration.js' import { type Integration, transformIntegration } from './transformers/integration.js'
import { transformInteraction, transformInteractionDataOption, type Interaction, type InteractionDataOption } from './transformers/interaction.js' import { type Interaction, type InteractionDataOption, transformInteraction, transformInteractionDataOption } from './transformers/interaction.js'
import { transformInvite, type Invite } from './transformers/invite.js' import { type Invite, transformInvite } from './transformers/invite.js'
import { transformMember, type Member } from './transformers/member.js' import { type Member, transformMember } from './transformers/member.js'
import { import {
transformMessage,
transformMessageCall,
transformMessageInteractionMetadata,
type Message, type Message,
type MessageCall, type MessageCall,
type MessageInteractionMetadata, type MessageInteractionMetadata,
transformMessage,
transformMessageCall,
transformMessageInteractionMetadata,
} from './transformers/message.js' } from './transformers/message.js'
import { transformGuildOnboarding, type GuildOnboarding } from './transformers/onboarding.js' import { type GuildOnboarding, transformGuildOnboarding } from './transformers/onboarding.js'
import { transformPoll, transformPollMedia, type Poll, type PollMedia } from './transformers/poll.js' import { type Poll, type PollMedia, transformPoll, transformPollMedia } from './transformers/poll.js'
import { transformPresence, type PresenceUpdate } from './transformers/presence.js' import { type PresenceUpdate, transformPresence } from './transformers/presence.js'
import { transformAllowedMentionsToDiscordAllowedMentions } from './transformers/reverse/allowedMentions.js' import { transformAllowedMentionsToDiscordAllowedMentions } from './transformers/reverse/allowedMentions.js'
import { transformCreateApplicationCommandToDiscordCreateApplicationCommand } from './transformers/reverse/createApplicationCommand.js' import { transformCreateApplicationCommandToDiscordCreateApplicationCommand } from './transformers/reverse/createApplicationCommand.js'
import { transformInteractionResponseToDiscordInteractionResponse } from './transformers/reverse/interactionResponse.js' import { transformInteractionResponseToDiscordInteractionResponse } from './transformers/reverse/interactionResponse.js'
import { transformRole, type Role } from './transformers/role.js' import { type Role, transformRole } from './transformers/role.js'
import { transformScheduledEvent, type ScheduledEvent } from './transformers/scheduledEvent.js' import { type ScheduledEvent, transformScheduledEvent } from './transformers/scheduledEvent.js'
import { transformSku, type Sku } from './transformers/sku.js' import { type Sku, transformSku } from './transformers/sku.js'
import { transformStageInstance, type StageInstance } from './transformers/stageInstance.js' import { type StageInstance, transformStageInstance } from './transformers/stageInstance.js'
import { transformInviteStageInstance, type InviteStageInstance } from './transformers/stageInviteInstance.js' import { type InviteStageInstance, transformInviteStageInstance } from './transformers/stageInviteInstance.js'
import { transformSticker, transformStickerPack, type Sticker, type StickerPack } from './transformers/sticker.js' import { type Sticker, type StickerPack, transformSticker, transformStickerPack } from './transformers/sticker.js'
import { transformTeam, type Team } from './transformers/team.js' import { type Team, transformTeam } from './transformers/team.js'
import { transformTemplate, type Template } from './transformers/template.js' import { type Template, transformTemplate } from './transformers/template.js'
import { import {
transformThreadMember,
transformThreadMemberGuildCreate,
type ThreadMember, type ThreadMember,
type ThreadMemberGuildCreate, type ThreadMemberGuildCreate,
transformThreadMember,
transformThreadMemberGuildCreate,
} from './transformers/threadMember.js' } from './transformers/threadMember.js'
import { transformUser, type User } from './transformers/user.js' import { type User, transformUser } from './transformers/user.js'
import { transformVoiceRegion, type VoiceRegion } from './transformers/voiceRegion.js' import { type VoiceRegion, transformVoiceRegion } from './transformers/voiceRegion.js'
import { transformVoiceState, type VoiceState } from './transformers/voiceState.js' import { type VoiceState, transformVoiceState } from './transformers/voiceState.js'
import { transformWebhook, type Webhook } from './transformers/webhook.js' import { type Webhook, transformWebhook } from './transformers/webhook.js'
import { transformWelcomeScreen, type WelcomeScreen } from './transformers/welcomeScreen.js' import { type WelcomeScreen, transformWelcomeScreen } from './transformers/welcomeScreen.js'
import { transformWidget, type GuildWidget } from './transformers/widget.js' import { type GuildWidget, transformWidget } from './transformers/widget.js'
import { transformWidgetSettings, type GuildWidgetSettings } from './transformers/widgetSettings.js' import { type GuildWidgetSettings, transformWidgetSettings } from './transformers/widgetSettings.js'
import type { BotInteractionResponse, DiscordComponent, DiscordInteractionResponse, DiscordThreadMemberGuildCreate } from './typings.js' import type { BotInteractionResponse, DiscordComponent, DiscordInteractionResponse, DiscordThreadMemberGuildCreate } from './typings.js'
export interface Transformers { export interface Transformers {
@@ -689,154 +689,154 @@ export function createTransformers(options: Partial<Transformers>, opts?: Create
return { return {
customizers: { customizers: {
channel(bot, payload, channel) { channel(_bot, _payload, channel) {
return channel return channel
}, },
forumTag(bot, payload, forumTag) { forumTag(_bot, _payload, forumTag) {
return forumTag return forumTag
}, },
interaction(bot, payload, interaction) { interaction(_bot, _payload, interaction) {
return interaction return interaction
}, },
member(bot, payload, member) { member(_bot, _payload, member) {
return member return member
}, },
message(bot, payload, message) { message(_bot, _payload, message) {
return message return message
}, },
messageInteractionMetadata(bot, payload, metadata) { messageInteractionMetadata(_bot, _payload, metadata) {
return metadata return metadata
}, },
messageCall(bot, payload, call) { messageCall(_bot, _payload, call) {
return call return call
}, },
role(bot, payload, role) { role(_bot, _payload, role) {
return role return role
}, },
user(bot, payload, user) { user(_bot, _payload, user) {
return user return user
}, },
activity(bot, payload, activity) { activity(_bot, _payload, activity) {
return activity return activity
}, },
application(bot, payload, application) { application(_bot, _payload, application) {
return application return application
}, },
applicationCommand(bot, payload, applicationCommand) { applicationCommand(_bot, _payload, applicationCommand) {
return applicationCommand return applicationCommand
}, },
applicationCommandOption(bot, payload, applicationCommandOption) { applicationCommandOption(_bot, _payload, applicationCommandOption) {
return applicationCommandOption return applicationCommandOption
}, },
applicationCommandOptionChoice(bot, payload, applicationCommandOptionChoice) { applicationCommandOptionChoice(_bot, _payload, applicationCommandOptionChoice) {
return applicationCommandOptionChoice return applicationCommandOptionChoice
}, },
applicationCommandPermission(bot, payload, applicationCommandPermission) { applicationCommandPermission(_bot, _payload, applicationCommandPermission) {
return applicationCommandPermission return applicationCommandPermission
}, },
attachment(bot, payload, attachment) { attachment(_bot, _payload, attachment) {
return attachment return attachment
}, },
auditLogEntry(bot, payload, auditLogEntry) { auditLogEntry(_bot, _payload, auditLogEntry) {
return auditLogEntry return auditLogEntry
}, },
automodActionExecution(bot, payload, automodActionExecution) { automodActionExecution(_bot, _payload, automodActionExecution) {
return automodActionExecution return automodActionExecution
}, },
automodRule(bot, payload, automodRule) { automodRule(_bot, _payload, automodRule) {
return automodRule return automodRule
}, },
component(bot, payload, component) { component(_bot, _payload, component) {
return component return component
}, },
embed(bot, payload, embed) { embed(_bot, _payload, embed) {
return embed return embed
}, },
emoji(bot, payload, emoji) { emoji(_bot, _payload, emoji) {
return emoji return emoji
}, },
defaultReactionEmoji(bot, payload, defaultReactionEmoji) { defaultReactionEmoji(_bot, _payload, defaultReactionEmoji) {
return defaultReactionEmoji return defaultReactionEmoji
}, },
guild(bot, payload, guild) { guild(_bot, _payload, guild) {
return guild return guild
}, },
integration(bot, payload, integration) { integration(_bot, _payload, integration) {
return integration return integration
}, },
interactionDataOptions(bot, payload, interactionDataOptions) { interactionDataOptions(_bot, _payload, interactionDataOptions) {
return interactionDataOptions return interactionDataOptions
}, },
invite(bot, payload, invite) { invite(_bot, _payload, invite) {
return invite return invite
}, },
presence(bot, payload, presence) { presence(_bot, _payload, presence) {
return presence return presence
}, },
scheduledEvent(bot, payload, scheduledEvent) { scheduledEvent(_bot, _payload, scheduledEvent) {
return scheduledEvent return scheduledEvent
}, },
stageInstance(bot, payload, stageInstance) { stageInstance(_bot, _payload, stageInstance) {
return stageInstance return stageInstance
}, },
inviteStageInstance(bot, payload, inviteStageInstance) { inviteStageInstance(_bot, _payload, inviteStageInstance) {
return inviteStageInstance return inviteStageInstance
}, },
sticker(bot, payload, sticker) { sticker(_bot, _payload, sticker) {
return sticker return sticker
}, },
stickerPack(bot, payload, stickerPack) { stickerPack(_bot, _payload, stickerPack) {
return stickerPack return stickerPack
}, },
team(bot, payload, team) { team(_bot, _payload, team) {
return team return team
}, },
template(bot, payload, template) { template(_bot, _payload, template) {
return template return template
}, },
threadMember(bot, payload, threadMember) { threadMember(_bot, _payload, threadMember) {
return threadMember return threadMember
}, },
threadMemberGuildCreate(bot, payload, threadMemberGuildCreate) { threadMemberGuildCreate(_bot, _payload, threadMemberGuildCreate) {
return threadMemberGuildCreate return threadMemberGuildCreate
}, },
voiceRegion(bot, payload, voiceRegion) { voiceRegion(_bot, _payload, voiceRegion) {
return voiceRegion return voiceRegion
}, },
voiceState(bot, payload, voiceState) { voiceState(_bot, _payload, voiceState) {
return voiceState return voiceState
}, },
gatewayBot(bot, payload, getGatewayBot) { gatewayBot(_bot, _payload, getGatewayBot) {
return getGatewayBot return getGatewayBot
}, },
webhook(bot, payload, webhook) { webhook(_bot, _payload, webhook) {
return webhook return webhook
}, },
welcomeScreen(bot, payload, welcomeScreen) { welcomeScreen(_bot, _payload, welcomeScreen) {
return welcomeScreen return welcomeScreen
}, },
widget(bot, payload, widget) { widget(_bot, _payload, widget) {
return widget return widget
}, },
widgetSettings(bot, payload, widgetSettings) { widgetSettings(_bot, _payload, widgetSettings) {
return widgetSettings return widgetSettings
}, },
guildOnboarding(bot, payload, onboarding) { guildOnboarding(_bot, _payload, onboarding) {
return onboarding return onboarding
}, },
entitlement(bot, payload, entitlement) { entitlement(_bot, _payload, entitlement) {
return entitlement return entitlement
}, },
sku(bot, payload, sku) { sku(_bot, _payload, sku) {
return sku return sku
}, },
poll(bot, payload, poll) { poll(_bot, _payload, poll) {
return poll return poll
}, },
pollMedia(bot, payload, pollMedia) { pollMedia(_bot, _payload, pollMedia) {
return pollMedia return pollMedia
}, },
avatarDecorationData(bot, payload, avatarDecorationData) { avatarDecorationData(_bot, _payload, avatarDecorationData) {
return avatarDecorationData return avatarDecorationData
}, },
}, },
+2 -2
View File
@@ -1,14 +1,14 @@
import { import {
DiscordApplicationIntegrationType,
iconHashToBigInt,
type ApplicationFlags, type ApplicationFlags,
type Bot, type Bot,
type DiscordApplication, type DiscordApplication,
DiscordApplicationIntegrationType,
type DiscordUser, type DiscordUser,
type Guild, type Guild,
type OAuth2Scope, type OAuth2Scope,
type Team, type Team,
type User, type User,
iconHashToBigInt,
} from '../index.js' } from '../index.js'
export function transformApplication(bot: Bot, payload: { application: DiscordApplication; shardId: number }): Application { export function transformApplication(bot: Bot, payload: { application: DiscordApplication; shardId: number }): Application {
@@ -1,5 +1,5 @@
import type { AuditLogEvents, DiscordAuditLogEntry, OverwriteTypes } from '@discordeno/types' import type { AuditLogEvents, DiscordAuditLogEntry, OverwriteTypes } from '@discordeno/types'
import { iconHashToBigInt, type Bot } from '../index.js' import { type Bot, iconHashToBigInt } from '../index.js'
export function transformAuditLogEntry(bot: Bot, payload: DiscordAuditLogEntry): AuditLogEntry { export function transformAuditLogEntry(bot: Bot, payload: DiscordAuditLogEntry): AuditLogEntry {
const auditLogEntry = { const auditLogEntry = {
@@ -1,4 +1,4 @@
import { iconHashToBigInt, type Bot, type DiscordAvatarDecorationData } from '../index.js' import { type Bot, type DiscordAvatarDecorationData, iconHashToBigInt } from '../index.js'
export function transformAvatarDecorationData(bot: Bot, payload: DiscordAvatarDecorationData): AvatarDecorationData { export function transformAvatarDecorationData(bot: Bot, payload: DiscordAvatarDecorationData): AvatarDecorationData {
const data = {} as AvatarDecorationData const data = {} as AvatarDecorationData
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import type { import type {
BigString, BigString,
ChannelTypes, ChannelTypes,
@@ -9,7 +8,7 @@ import type {
SortOrderTypes, SortOrderTypes,
VideoQualityModes, VideoQualityModes,
} from '@discordeno/types' } from '@discordeno/types'
import { calculatePermissions, iconHashToBigInt, type Bot, type DefaultReactionEmoji, type ThreadMember, type User } from '../index.js' import { type Bot, type DefaultReactionEmoji, type ThreadMember, type User, calculatePermissions, iconHashToBigInt } from '../index.js'
import { Permissions } from './toggles/Permissions.js' import { Permissions } from './toggles/Permissions.js'
import { ChannelToggles } from './toggles/channel.js' import { ChannelToggles } from './toggles/channel.js'
+1 -1
View File
@@ -1,5 +1,5 @@
import type { DiscordIntegrationCreateUpdate, IntegrationExpireBehaviors, OAuth2Scope } from '@discordeno/types' import type { DiscordIntegrationCreateUpdate, IntegrationExpireBehaviors, OAuth2Scope } from '@discordeno/types'
import { iconHashToBigInt, type Bot, type User } from '../index.js' import { type Bot, type User, iconHashToBigInt } from '../index.js'
export function transformIntegration(bot: Bot, payload: DiscordIntegrationCreateUpdate): Integration { export function transformIntegration(bot: Bot, payload: DiscordIntegrationCreateUpdate): Integration {
const integration = { const integration = {
+7 -7
View File
@@ -1,7 +1,4 @@
import { import {
InteractionResponseTypes,
InteractionTypes,
MessageFlags,
type ApplicationCommandOptionTypes, type ApplicationCommandOptionTypes,
type ApplicationCommandTypes, type ApplicationCommandTypes,
type BigString, type BigString,
@@ -9,14 +6,17 @@ import {
type DiscordInteraction, type DiscordInteraction,
type DiscordInteractionDataOption, type DiscordInteractionDataOption,
type InteractionCallbackData, type InteractionCallbackData,
InteractionResponseTypes,
InteractionTypes,
type MessageComponentTypes, type MessageComponentTypes,
MessageFlags,
} from '@discordeno/types' } from '@discordeno/types'
import { Collection } from '@discordeno/utils' import { Collection } from '@discordeno/utils'
import { import {
DiscordApplicationIntegrationType,
type Bot, type Bot,
type Channel, type Channel,
type Component, type Component,
DiscordApplicationIntegrationType,
type DiscordChannel, type DiscordChannel,
type DiscordInteractionContextType, type DiscordInteractionContextType,
type Guild, type Guild,
@@ -286,7 +286,7 @@ export function transformInteractionDataResolved(bot: Bot, resolved: DiscordInte
if (resolved.messages) { if (resolved.messages) {
transformed.messages = new Collection( transformed.messages = new Collection(
Object.entries(resolved.messages).map(([id, value]) => { Object.entries(resolved.messages).map(([_id, value]) => {
const message: Message = bot.transformers.message(bot, value) const message: Message = bot.transformers.message(bot, value)
return [message.id, message] return [message.id, message]
}), }),
@@ -295,7 +295,7 @@ export function transformInteractionDataResolved(bot: Bot, resolved: DiscordInte
if (resolved.users) { if (resolved.users) {
transformed.users = new Collection( transformed.users = new Collection(
Object.entries(resolved.users).map(([id, value]) => { Object.entries(resolved.users).map(([_id, value]) => {
const user = bot.transformers.user(bot, value) const user = bot.transformers.user(bot, value)
return [user.id, user] return [user.id, user]
}), }),
@@ -313,7 +313,7 @@ export function transformInteractionDataResolved(bot: Bot, resolved: DiscordInte
if (guildId && resolved.roles) { if (guildId && resolved.roles) {
transformed.roles = new Collection( transformed.roles = new Collection(
Object.entries(resolved.roles).map(([id, value]) => { Object.entries(resolved.roles).map(([_id, value]) => {
const role = bot.transformers.role(bot, { role: value, guildId }) const role = bot.transformers.role(bot, { role: value, guildId })
return [role.id, role] return [role.id, role]
}), }),
+1 -1
View File
@@ -1,5 +1,5 @@
import type { DiscordApplication, DiscordInviteCreate, DiscordInviteMetadata, DiscordInviteType } from '@discordeno/types' import type { DiscordApplication, DiscordInviteCreate, DiscordInviteMetadata, DiscordInviteType } from '@discordeno/types'
import { isInviteWithMetadata, type Application, type Bot, type ScheduledEvent, type User } from '../index.js' import { type Application, type Bot, type ScheduledEvent, type User, isInviteWithMetadata } from '../index.js'
import type { InviteStageInstance } from './stageInviteInstance.js' import type { InviteStageInstance } from './stageInviteInstance.js'
export function transformInvite(bot: Bot, payload: { invite: DiscordInviteCreate | DiscordInviteMetadata; shardId: number }): Invite { export function transformInvite(bot: Bot, payload: { invite: DiscordInviteCreate | DiscordInviteMetadata; shardId: number }): Invite {
+2 -2
View File
@@ -1,16 +1,16 @@
import { import {
DiscordApplicationIntegrationType, DiscordApplicationIntegrationType,
MessageFlags,
type DiscordMessage, type DiscordMessage,
type DiscordMessageCall, type DiscordMessageCall,
type DiscordMessageInteractionMetadata, type DiscordMessageInteractionMetadata,
type InteractionTypes, type InteractionTypes,
type MessageActivityTypes, type MessageActivityTypes,
MessageFlags,
type MessageTypes, type MessageTypes,
type StickerFormatTypes, type StickerFormatTypes,
} from '@discordeno/types' } from '@discordeno/types'
import { CHANNEL_MENTION_REGEX } from '../constants.js' import { CHANNEL_MENTION_REGEX } from '../constants.js'
import { snowflakeToTimestamp, type Bot, type Poll } from '../index.js' import { type Bot, type Poll, snowflakeToTimestamp } from '../index.js'
import type { Attachment } from './attachment.js' import type { Attachment } from './attachment.js'
import type { Channel } from './channel.js' import type { Channel } from './channel.js'
import type { Component } from './component.js' import type { Component } from './component.js'
+1 -1
View File
@@ -1,4 +1,4 @@
import { PresenceStatus, type DiscordPresenceUpdate } from '@discordeno/types' import { type DiscordPresenceUpdate, PresenceStatus } from '@discordeno/types'
import type { Activity, Bot, User } from '../index.js' import type { Activity, Bot, User } from '../index.js'
export function transformPresence(bot: Bot, payload: DiscordPresenceUpdate): PresenceUpdate { export function transformPresence(bot: Bot, payload: DiscordPresenceUpdate): PresenceUpdate {
@@ -1,7 +1,7 @@
import type { Bot, DiscordActivity } from '../../index.js' import type { Bot, DiscordActivity } from '../../index.js'
import type { Activity } from '../activity.js' import type { Activity } from '../activity.js'
export function transformActivityToDiscordActivity(bot: Bot, payload: Activity): DiscordActivity { export function transformActivityToDiscordActivity(_bot: Bot, payload: Activity): DiscordActivity {
return { return {
name: payload.name, name: payload.name,
type: payload.type, type: payload.type,
@@ -1,6 +1,6 @@
import type { AllowedMentions, Bot, DiscordAllowedMentions } from '../../index.js' import type { AllowedMentions, Bot, DiscordAllowedMentions } from '../../index.js'
export function transformAllowedMentionsToDiscordAllowedMentions(bot: Bot, mentions: AllowedMentions): DiscordAllowedMentions { export function transformAllowedMentionsToDiscordAllowedMentions(_bot: Bot, mentions: AllowedMentions): DiscordAllowedMentions {
return { return {
parse: mentions.parse, parse: mentions.parse,
replied_user: mentions.repliedUser, replied_user: mentions.repliedUser,
@@ -1,4 +1,4 @@
import { iconBigintToHash, type Bot, type DiscordApplication } from '../../index.js' import { type Bot, type DiscordApplication, iconBigintToHash } from '../../index.js'
import type { Application } from '../application.js' import type { Application } from '../application.js'
export function transformApplicationToDiscordApplication(bot: Bot, payload: Application): DiscordApplication { export function transformApplicationToDiscordApplication(bot: Bot, payload: Application): DiscordApplication {
@@ -2,7 +2,7 @@ import type { Bot, Camelize, DiscordApplicationCommandOptionChoice } from '../..
import type { ApplicationCommandOptionChoice } from '../applicationCommandOptionChoice.js' import type { ApplicationCommandOptionChoice } from '../applicationCommandOptionChoice.js'
export function transformApplicationCommandOptionChoiceToDiscordApplicationCommandOptionChoice( export function transformApplicationCommandOptionChoiceToDiscordApplicationCommandOptionChoice(
bot: Bot, _bot: Bot,
payload: ApplicationCommandOptionChoice | Camelize<DiscordApplicationCommandOptionChoice>, payload: ApplicationCommandOptionChoice | Camelize<DiscordApplicationCommandOptionChoice>,
): DiscordApplicationCommandOptionChoice { ): DiscordApplicationCommandOptionChoice {
return { return {
@@ -1,5 +1,5 @@
import type { DiscordAuditLogEntry } from '@discordeno/types' import type { DiscordAuditLogEntry } from '@discordeno/types'
import { iconBigintToHash, type Bot } from '../../index.js' import { type Bot, iconBigintToHash } from '../../index.js'
import type { AuditLogEntry } from '../auditLogEntry.js' import type { AuditLogEntry } from '../auditLogEntry.js'
export function transformAuditLogEntryToDiscordAuditLogEntry(bot: Bot, payload: AuditLogEntry): DiscordAuditLogEntry { export function transformAuditLogEntryToDiscordAuditLogEntry(bot: Bot, payload: AuditLogEntry): DiscordAuditLogEntry {
@@ -2,7 +2,7 @@ import type { DiscordEmbed } from '@discordeno/types'
import type { Bot } from '../../index.js' import type { Bot } from '../../index.js'
import type { Embed } from '../embed.js' import type { Embed } from '../embed.js'
export function transformEmbedToDiscordEmbed(bot: Bot, payload: Embed): DiscordEmbed { export function transformEmbedToDiscordEmbed(_bot: Bot, payload: Embed): DiscordEmbed {
return { return {
title: payload.title, title: payload.title,
type: payload.type, type: payload.type,
@@ -4,7 +4,7 @@ import type { Bot } from '../../bot.js'
import type { Member } from '../member.js' import type { Member } from '../member.js'
import type { User } from '../user.js' import type { User } from '../user.js'
export function transformUserToDiscordUser(bot: Bot, payload: User): DiscordUser { export function transformUserToDiscordUser(_bot: Bot, payload: User): DiscordUser {
return { return {
id: payload.id.toString(), id: payload.id.toString(),
username: payload.username, username: payload.username,
@@ -1,4 +1,4 @@
import { PresenceStatus, type DiscordPresenceUpdate } from '@discordeno/types' import { type DiscordPresenceUpdate, PresenceStatus } from '@discordeno/types'
import type { Bot } from '../../index.js' import type { Bot } from '../../index.js'
import type { PresenceUpdate } from '../presence.js' import type { PresenceUpdate } from '../presence.js'
@@ -1,5 +1,5 @@
import type { DiscordTeam } from '@discordeno/types' import type { DiscordTeam } from '@discordeno/types'
import { iconBigintToHash, type Bot } from '../../index.js' import { type Bot, iconBigintToHash } from '../../index.js'
import type { Team } from '../team.js' import type { Team } from '../team.js'
export function transformTeamToDiscordTeam(bot: Bot, payload: Team): DiscordTeam { export function transformTeamToDiscordTeam(bot: Bot, payload: Team): DiscordTeam {
@@ -2,7 +2,7 @@ import type { DiscordGuildWidgetSettings } from '@discordeno/types'
import type { Bot } from '../../index.js' import type { Bot } from '../../index.js'
import type { GuildWidgetSettings } from '../widgetSettings.js' import type { GuildWidgetSettings } from '../widgetSettings.js'
export function transformWidgetSettingsToDiscordWidgetSettings(bot: Bot, payload: GuildWidgetSettings): DiscordGuildWidgetSettings { export function transformWidgetSettingsToDiscordWidgetSettings(_bot: Bot, payload: GuildWidgetSettings): DiscordGuildWidgetSettings {
return { return {
enabled: payload.enabled, enabled: payload.enabled,
channel_id: payload.channelId ?? null, channel_id: payload.channelId ?? null,
+1 -1
View File
@@ -1,5 +1,5 @@
import type { BigString, DiscordRole, RoleFlags } from '@discordeno/types' import type { BigString, DiscordRole, RoleFlags } from '@discordeno/types'
import { iconHashToBigInt, type Bot } from '../index.js' import { type Bot, iconHashToBigInt } from '../index.js'
import { Permissions } from './toggles/Permissions.js' import { Permissions } from './toggles/Permissions.js'
import { RoleToggles } from './toggles/role.js' import { RoleToggles } from './toggles/role.js'
@@ -5,7 +5,7 @@ import type {
ScheduledEventPrivacyLevel, ScheduledEventPrivacyLevel,
ScheduledEventStatus, ScheduledEventStatus,
} from '@discordeno/types' } from '@discordeno/types'
import { iconHashToBigInt, type Bot, type User } from '../index.js' import { type Bot, type User, iconHashToBigInt } from '../index.js'
export function transformScheduledEvent(bot: Bot, payload: DiscordScheduledEvent): ScheduledEvent { export function transformScheduledEvent(bot: Bot, payload: DiscordScheduledEvent): ScheduledEvent {
const props = bot.transformers.desiredProperties.scheduledEvent const props = bot.transformers.desiredProperties.scheduledEvent
@@ -24,7 +24,7 @@ export function transformInviteStageInstance(bot: Bot, payload: DiscordInviteSta
export interface InviteStageInstance { export interface InviteStageInstance {
/** The members speaking in the Stage */ /** The members speaking in the Stage */
members: Array<Partial<Member>> members: Partial<Member>[]
/** The number of users in the Stage */ /** The number of users in the Stage */
participantCount: number participantCount: number
/** The number of users speaking in the Stage */ /** The number of users speaking in the Stage */
+1 -1
View File
@@ -1,5 +1,5 @@
import type { DiscordTeam, DiscordTeamMemberRole, TeamMembershipStates } from '@discordeno/types' import type { DiscordTeam, DiscordTeamMemberRole, TeamMembershipStates } from '@discordeno/types'
import { iconHashToBigInt, type Bot, type User } from '../index.js' import { type Bot, type User, iconHashToBigInt } from '../index.js'
export function transformTeam(bot: Bot, payload: DiscordTeam): Team { export function transformTeam(bot: Bot, payload: DiscordTeam): Team {
const id = bot.transformers.snowflake(payload.id) const id = bot.transformers.snowflake(payload.id)
@@ -1,4 +1,4 @@
import { type PermissionStrings, BitwisePermissionFlags } from '@discordeno/types' import { BitwisePermissionFlags, type PermissionStrings } from '@discordeno/types'
import { ToggleBitfieldBigint } from './ToggleBitfield.js' import { ToggleBitfieldBigint } from './ToggleBitfield.js'
export class Permissions extends ToggleBitfieldBigint { export class Permissions extends ToggleBitfieldBigint {
@@ -1,4 +1,4 @@
import { GuildFeatures, type DiscordGuild } from '@discordeno/types' import { type DiscordGuild, GuildFeatures } from '@discordeno/types'
import { ToggleBitfieldBigint } from './ToggleBitfield.js' import { ToggleBitfieldBigint } from './ToggleBitfield.js'
const featureNames = [ const featureNames = [
+1 -2
View File
@@ -1,10 +1,9 @@
import type { DiscordUser, PremiumTypes } from '@discordeno/types' import type { DiscordUser, PremiumTypes } from '@discordeno/types'
import { iconHashToBigInt } from '@discordeno/utils' import { iconHashToBigInt } from '@discordeno/utils'
import { ToggleBitfield, UserToggles, type AvatarDecorationData, type Bot } from '../index.js' import { type AvatarDecorationData, type Bot, ToggleBitfield, UserToggles } from '../index.js'
const baseUser: Partial<User> & BaseUser = { const baseUser: Partial<User> & BaseUser = {
get tag() { get tag() {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
return `${this.username}#${this.discriminator}` return `${this.username}#${this.discriminator}`
}, },
get bot() { get bot() {
+1 -1
View File
@@ -1,5 +1,5 @@
import type { DiscordWebhook, WebhookTypes } from '@discordeno/types' import type { DiscordWebhook, WebhookTypes } from '@discordeno/types'
import { iconHashToBigInt, type Bot, type Channel, type Guild, type User } from '../index.js' import { type Bot, type Channel, type Guild, type User, iconHashToBigInt } from '../index.js'
export function transformWebhook(bot: Bot, payload: DiscordWebhook): Webhook { export function transformWebhook(bot: Bot, payload: DiscordWebhook): Webhook {
const props = bot.transformers.desiredProperties.webhook const props = bot.transformers.desiredProperties.webhook
+1 -1
View File
@@ -1,5 +1,5 @@
import type { DiscordGuildWidget } from '@discordeno/types' import type { DiscordGuildWidget } from '@discordeno/types'
import { iconHashToBigInt, type Bot } from '../index.js' import { type Bot, iconHashToBigInt } from '../index.js'
export function transformWidget(bot: Bot, payload: DiscordGuildWidget): GuildWidget { export function transformWidget(bot: Bot, payload: DiscordGuildWidget): GuildWidget {
const widget = { const widget = {
+1 -1
View File
@@ -1,6 +1,6 @@
import { import {
ApplicationCommandTypes,
type AllowedMentions, type AllowedMentions,
ApplicationCommandTypes,
type ButtonStyles, type ButtonStyles,
type ChannelTypes, type ChannelTypes,
type CreateApplicationCommand, type CreateApplicationCommand,
+3 -4
View File
@@ -19,8 +19,8 @@
"build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js", "build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js",
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types", "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types",
"release-build": "yarn build && yarn build:type", "release-build": "yarn build && yarn build:type",
"fmt": "eslint --fix \"src/**/*.ts*\"", "fmt": "biome format --write",
"lint": "eslint \"src/**/*.ts*\"", "lint": "biome lint --write",
"test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'", "test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'",
"test:unit": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js discordeno", "test:unit": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js discordeno",
"test:deno-unit": "swc --strip-leading-paths tests --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist", "test:deno-unit": "swc --strip-leading-paths tests --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist",
@@ -37,6 +37,7 @@
"commander": "^12.1.0" "commander": "^12.1.0"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^1.8.0",
"@swc/cli": "^0.4.0", "@swc/cli": "^0.4.0",
"@swc/core": "^1.4.2", "@swc/core": "^1.4.2",
"@types/chai": "^4.3.16", "@types/chai": "^4.3.16",
@@ -45,8 +46,6 @@
"@types/sinon": "^17.0.3", "@types/sinon": "^17.0.3",
"c8": "^9.1.0", "c8": "^9.1.0",
"chai": "^5.1.1", "chai": "^5.1.1",
"eslint": "^8.57.0",
"eslint-config-discordeno": "*",
"mocha": "^10.5.1", "mocha": "^10.5.1",
"sinon": "^18.0.0", "sinon": "^18.0.0",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
@@ -1,31 +0,0 @@
module.exports = {
env: {
es2022: true,
node: true,
},
extends: ['standard-with-typescript', 'plugin:prettier/recommended', 'plugin:require-extensions/recommended'],
overrides: [
{
files: ['*.spec.ts'],
rules: {
'@typescript-eslint/no-unused-expressions': 'off',
},
},
],
plugins: ['require-extensions'],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json'],
},
rules: {
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/consistent-type-assertions': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-invalid-void-type': 'off',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-confusing-void-expression': 'off',
},
}
@@ -1,23 +0,0 @@
{
"name": "eslint-config-discordeno",
"version": "0.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.16.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^17.9.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-require-extensions": "^0.1.3",
"prettier": "^3.3.3",
"typescript": "^5.5.3"
},
"publishConfig": {
"access": "public"
}
}
+3 -4
View File
@@ -18,8 +18,8 @@
"build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js", "build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js",
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types", "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types",
"release-build": "yarn build && yarn build:type", "release-build": "yarn build && yarn build:type",
"fmt": "eslint --fix \"src/**/*.ts*\"", "fmt": "biome format --write",
"lint": "eslint \"src/**/*.ts*\"", "lint": "biome lint --write",
"test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'", "test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'",
"test:unit": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js gateway", "test:unit": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js gateway",
"test:deno-unit": "swc --strip-leading-paths tests --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist/unit", "test:deno-unit": "swc --strip-leading-paths tests --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist/unit",
@@ -34,6 +34,7 @@
"ws": "^8.18.0" "ws": "^8.18.0"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^1.8.0",
"@swc/cli": "^0.4.0", "@swc/cli": "^0.4.0",
"@swc/core": "^1.4.2", "@swc/core": "^1.4.2",
"@types/chai": "^4.3.16", "@types/chai": "^4.3.16",
@@ -43,8 +44,6 @@
"@types/ws": "^8.5.10", "@types/ws": "^8.5.10",
"c8": "^9.1.0", "c8": "^9.1.0",
"chai": "^5.1.1", "chai": "^5.1.1",
"eslint": "^8.57.0",
"eslint-config-discordeno": "*",
"mocha": "^10.5.1", "mocha": "^10.5.1",
"sinon": "^18.0.0", "sinon": "^18.0.0",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
+2 -7
View File
@@ -1,8 +1,7 @@
/* eslint-disable @typescript-eslint/no-confusing-void-expression */ import { inflateSync } from 'node:zlib'
import type { DiscordGatewayPayload, DiscordHello, DiscordReady } from '@discordeno/types' import type { DiscordGatewayPayload, DiscordHello, DiscordReady } from '@discordeno/types'
import { GatewayCloseEventCodes, GatewayOpcodes } from '@discordeno/types' import { GatewayCloseEventCodes, GatewayOpcodes } from '@discordeno/types'
import { LeakyBucket, camelize, delay, logger } from '@discordeno/utils' import { LeakyBucket, camelize, delay, logger } from '@discordeno/utils'
import { inflateSync } from 'node:zlib'
import NodeWebSocket from 'ws' import NodeWebSocket from 'ws'
import type { BotStatusUpdate, ShardEvents, ShardGatewayConfig, ShardHeart, ShardSocketRequest } from './types.js' import type { BotStatusUpdate, ShardEvents, ShardGatewayConfig, ShardHeart, ShardSocketRequest } from './types.js'
import { ShardSocketCloseCodes, ShardState } from './types.js' import { ShardSocketCloseCodes, ShardState } from './types.js'
@@ -214,10 +213,7 @@ export class DiscordenoShard {
this.logger.debug(`[Gateway] Resuming Shard #${this.id}, before connecting`) this.logger.debug(`[Gateway] Resuming Shard #${this.id}, before connecting`)
// Before we can resume, we need to create a new connection with Discord's gateway. // Before we can resume, we need to create a new connection with Discord's gateway.
await this.connect() await this.connect()
this.logger.debug( this.logger.debug(`[Gateway] Resuming Shard #${this.id}, after connecting. ${this.sessionId} | ${this.previousSequenceNumber}`)
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
`[Gateway] Resuming Shard #${this.id}, after connecting. ${this.sessionId} | ${this.previousSequenceNumber}`,
)
this.send( this.send(
{ {
@@ -494,7 +490,6 @@ export class DiscordenoShard {
* Passing the shard's id there to make it easier for the dev to use this function. * Passing the shard's id there to make it easier for the dev to use this function.
*/ */
async makePresence(): Promise<BotStatusUpdate | undefined> { async makePresence(): Promise<BotStatusUpdate | undefined> {
// eslint-disable-next-line no-useless-return
return return
} }
+4 -6
View File
@@ -1,18 +1,17 @@
/* eslint-disable @typescript-eslint/no-confusing-void-expression */
import { import {
GatewayIntents,
GatewayOpcodes,
type AtLeastOne, type AtLeastOne,
type BigString, type BigString,
type Camelize, type Camelize,
type DiscordGetGatewayBot, type DiscordGetGatewayBot,
type DiscordMemberWithUser, type DiscordMemberWithUser,
type DiscordReady, type DiscordReady,
GatewayIntents,
GatewayOpcodes,
type RequestGuildMembers, type RequestGuildMembers,
} from '@discordeno/types' } from '@discordeno/types'
import { Collection, delay, logger } from '@discordeno/utils' import { Collection, delay, logger } from '@discordeno/utils'
import Shard from './Shard.js' import Shard from './Shard.js'
import { ShardSocketCloseCodes, type ShardEvents, type ShardSocketRequest, type StatusUpdate, type UpdateVoiceState } from './types.js' import { type ShardEvents, ShardSocketCloseCodes, type ShardSocketRequest, type StatusUpdate, type UpdateVoiceState } from './types.js'
export function createGatewayManager(options: CreateGatewayManagerOptions): GatewayManager { export function createGatewayManager(options: CreateGatewayManagerOptions): GatewayManager {
const connectionOptions = options.connection ?? { const connectionOptions = options.connection ?? {
@@ -282,7 +281,6 @@ export function createGatewayManager(options: CreateGatewayManagerOptions): Gate
for (const bucket of gateway.buckets.values()) { for (const bucket of gateway.buckets.values()) {
for (const worker of bucket.workers.values()) { for (const worker of bucket.workers.values()) {
// eslint-disable-next-line @typescript-eslint/require-array-sort-compare
worker.queue = worker.queue.sort((a, b) => a - b) worker.queue = worker.queue.sort((a, b) => a - b)
} }
} }
@@ -390,7 +388,7 @@ export function createGatewayManager(options: CreateGatewayManagerOptions): Gate
this.shards.delete(shardId) this.shards.delete(shardId)
await shard.shutdown() await shard.shutdown()
}, },
async requestIdentify(shardId: number) { async requestIdentify(_shardId: number) {
gateway.logger.debug(`[Gateway] requesting identify`) gateway.logger.debug(`[Gateway] requesting identify`)
// const bucket = gateway.buckets.get(shardId % gateway.connection.sessionStartLimit.maxConcurrency) // const bucket = gateway.buckets.get(shardId % gateway.connection.sessionStartLimit.maxConcurrency)
// if (!bucket) return // if (!bucket) return
+1 -1
View File
@@ -173,7 +173,7 @@ export interface StatusUpdate {
// /** Unix time (in milliseconds) of when the client went idle, or null if the client is not idle */ // /** Unix time (in milliseconds) of when the client went idle, or null if the client is not idle */
// since: number | null; // since: number | null;
/** The user's activities */ /** The user's activities */
activities?: Camelize<Array<Omit<DiscordActivity, 'created_at'>>> activities?: Camelize<Omit<DiscordActivity, 'created_at'>[]>
/** The user's new status */ /** The user's new status */
status: keyof typeof PresenceStatus status: keyof typeof PresenceStatus
// /** Whether or not the client is afk */ // /** Whether or not the client is afk */
@@ -1,6 +1,6 @@
import { Intents } from '@discordeno/types' import { Intents } from '@discordeno/types'
import uWS from 'uWebSockets.js' import uWS from 'uWebSockets.js'
import { ShardSocketCloseCodes, createGatewayManager, type GatewayManager } from '../../src/index.js' import { type GatewayManager, ShardSocketCloseCodes, createGatewayManager } from '../../src/index.js'
/** /**
* This value needs to be AT LEAST `1017` * This value needs to be AT LEAST `1017`
@@ -36,8 +36,8 @@ async function createUws(options: {
closing?: boolean closing?: boolean
}): Promise<{ port: number; uwsToken: uWS.us_listen_socket }> { }): Promise<{ port: number; uwsToken: uWS.us_listen_socket }> {
options.onOpen ??= () => {} options.onOpen ??= () => {}
options.onMessage ??= (message: any) => {} options.onMessage ??= (_message: any) => {}
options.onClose ??= (code: number, message: string) => {} options.onClose ??= (_code: number, _message: string) => {}
options.closing ??= false options.closing ??= false
return await new Promise<{ port: number; uwsToken: uWS.us_listen_socket }>((resolve, reject) => { return await new Promise<{ port: number; uwsToken: uWS.us_listen_socket }>((resolve, reject) => {
@@ -64,7 +64,7 @@ async function createUws(options: {
) )
options.onOpen!() options.onOpen!()
}, },
message: async (ws, message, isBinary) => { message: async (ws, message, _isBinary) => {
const msg = JSON.parse(Buffer.from(message).toString()) const msg = JSON.parse(Buffer.from(message).toString())
options.onMessage!(msg) options.onMessage!(msg)
if (msg.op === 1) { if (msg.op === 1) {
@@ -116,7 +116,7 @@ async function createUws(options: {
// resume // resume
} }
}, },
close: (ws, code, message) => { close: (_ws, code, message) => {
const msg = Buffer.from(message).toString() const msg = Buffer.from(message).toString()
options.onClose!(code, msg) options.onClose!(code, msg)
}, },
+3 -4
View File
@@ -18,8 +18,8 @@
"build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js", "build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js",
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types", "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types",
"release-build": "yarn build && yarn build:type", "release-build": "yarn build && yarn build:type",
"fmt": "eslint --fix \"src/**/*.ts*\"", "fmt": "biome format --write",
"lint": "eslint \"src/**/*.ts*\"", "lint": "biome lint --write",
"test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'", "test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'",
"test:unit": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest", "test:unit": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest",
"test:deno-unit": "swc tests --strip-leading-paths --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist/unit", "test:deno-unit": "swc tests --strip-leading-paths --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist/unit",
@@ -34,6 +34,7 @@
"@discordeno/utils": "19.0.0-beta.1" "@discordeno/utils": "19.0.0-beta.1"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^1.8.0",
"@swc/cli": "^0.4.0", "@swc/cli": "^0.4.0",
"@swc/core": "^1.4.2", "@swc/core": "^1.4.2",
"@types/chai": "^4.3.16", "@types/chai": "^4.3.16",
@@ -45,8 +46,6 @@
"chai": "^5.1.1", "chai": "^5.1.1",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-config-discordeno": "*",
"mocha": "^10.5.1", "mocha": "^10.5.1",
"sinon": "^18.0.0", "sinon": "^18.0.0",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
-1
View File
@@ -35,7 +35,6 @@ export function createInvalidRequestBucket(options: InvalidRequestBucketOptions)
}, },
waitUntilRequestAvailable: async function () { waitUntilRequestAvailable: async function () {
// eslint-disable-next-line no-async-promise-executor
return await new Promise(async (resolve) => { return await new Promise(async (resolve) => {
// If whatever amount of requests is left is more than the safety margin, allow the request // If whatever amount of requests is left is more than the safety margin, allow the request
if (bucket.isRequestAllowed()) { if (bucket.isRequestAllowed()) {
+4 -9
View File
@@ -1,13 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import { Buffer } from 'node:buffer' import { Buffer } from 'node:buffer'
import { calculateBits, camelize, camelToSnakeCase, delay, getBotIdFromToken, logger, processReactionString, urlToBase64 } from '@discordeno/utils'
import { createInvalidRequestBucket } from './invalidBucket.js'
import { Queue } from './queue.js'
import { import {
InteractionResponseTypes,
type BigString, type BigString,
type Camelize, type Camelize,
type DiscordAccessTokenResponse, type DiscordAccessTokenResponse,
@@ -55,9 +47,13 @@ import {
type DiscordVoiceRegion, type DiscordVoiceRegion,
type DiscordWebhook, type DiscordWebhook,
type DiscordWelcomeScreen, type DiscordWelcomeScreen,
InteractionResponseTypes,
type MfaLevels, type MfaLevels,
type ModifyGuildTemplate, type ModifyGuildTemplate,
} from '@discordeno/types' } from '@discordeno/types'
import { calculateBits, camelToSnakeCase, camelize, delay, getBotIdFromToken, logger, processReactionString, urlToBase64 } from '@discordeno/utils'
import { createInvalidRequestBucket } from './invalidBucket.js'
import { Queue } from './queue.js'
import { createRoutes } from './routes.js' import { createRoutes } from './routes.js'
import type { CreateRequestBodyOptions, CreateRestManagerOptions, MakeRequestOptions, RestManager, SendRequestOptions } from './types.js' import type { CreateRequestBodyOptions, CreateRestManagerOptions, MakeRequestOptions, RestManager, SendRequestOptions } from './types.js'
@@ -545,7 +541,6 @@ export function createRestManager(options: CreateRestManagerOptions): RestManage
const error = new Error() const error = new Error()
error.message = 'Failed to send request to discord.' error.message = 'Failed to send request to discord.'
// eslint-disable-next-line no-async-promise-executor
return await new Promise(async (resolve, reject) => { return await new Promise(async (resolve, reject) => {
const payload: SendRequestOptions = { const payload: SendRequestOptions = {
route, route,
-1
View File
@@ -57,7 +57,6 @@ export class Queue {
/** Pauses the execution until a request is allowed to be made. */ /** Pauses the execution until a request is allowed to be made. */
async waitUntilRequestAvailable(): Promise<void> { async waitUntilRequestAvailable(): Promise<void> {
// eslint-disable-next-line no-async-promise-executor
return await new Promise(async (resolve) => { return await new Promise(async (resolve) => {
// If whatever amount of requests is left is more than the safety margin, allow the request // If whatever amount of requests is left is more than the safety margin, allow the request
if (this.isRequestAllowed()) { if (this.isRequestAllowed()) {
-32
View File
@@ -82,9 +82,7 @@ export function createRoutes(): RestRoutes {
let url = `/channels/${channelId}/messages/${messageId}/reactions/${encodeURIComponent(emoji)}?` let url = `/channels/${channelId}/messages/${messageId}/reactions/${encodeURIComponent(emoji)}?`
if (options) { if (options) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.after) url += `after=${options.after}` if (options.after) url += `after=${options.after}`
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.limit) url += `&limit=${options.limit}` if (options.limit) url += `&limit=${options.limit}`
} }
@@ -182,7 +180,6 @@ export function createRoutes(): RestRoutes {
if (options.before) { if (options.before) {
url += `before=${new Date(options.before).toISOString()}` url += `before=${new Date(options.before).toISOString()}`
} }
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.limit) url += `&limit=${options.limit}` if (options.limit) url += `&limit=${options.limit}`
} }
@@ -195,7 +192,6 @@ export function createRoutes(): RestRoutes {
if (options.before) { if (options.before) {
url += `before=${new Date(options.before).toISOString()}` url += `before=${new Date(options.before).toISOString()}`
} }
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.limit) url += `&limit=${options.limit}` if (options.limit) url += `&limit=${options.limit}`
} }
@@ -208,7 +204,6 @@ export function createRoutes(): RestRoutes {
if (options.before) { if (options.before) {
url += `before=${new Date(options.before).toISOString()}` url += `before=${new Date(options.before).toISOString()}`
} }
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.limit) url += `&limit=${options.limit}` if (options.limit) url += `&limit=${options.limit}`
} }
@@ -246,13 +241,9 @@ export function createRoutes(): RestRoutes {
let url = '/users/@me/guilds?' let url = '/users/@me/guilds?'
if (options) { if (options) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.after) url += `after=${options.after}` if (options.after) url += `after=${options.after}`
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.before) url += `&before=${options.before}` if (options.before) url += `&before=${options.before}`
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.limit) url += `&limit=${options.limit}` if (options.limit) url += `&limit=${options.limit}`
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.withCounts) url += `&with_counts=${options.withCounts}` if (options.withCounts) url += `&with_counts=${options.withCounts}`
} }
@@ -262,15 +253,10 @@ export function createRoutes(): RestRoutes {
let url = `/guilds/${guildId}/audit-logs?` let url = `/guilds/${guildId}/audit-logs?`
if (options) { if (options) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.actionType) url += `action_type=${options.actionType}` if (options.actionType) url += `action_type=${options.actionType}`
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.before) url += `&before=${options.before}` if (options.before) url += `&before=${options.before}`
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.after) url += `&after=${options.after}` if (options.after) url += `&after=${options.after}`
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.limit) url += `&limit=${options.limit}` if (options.limit) url += `&limit=${options.limit}`
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.userId) url += `&user_id=${options.userId}` if (options.userId) url += `&user_id=${options.userId}`
} }
@@ -315,15 +301,11 @@ export function createRoutes(): RestRoutes {
let url = `/guilds/${guildId}/scheduled-events/${eventId}/users?` let url = `/guilds/${guildId}/scheduled-events/${eventId}/users?`
if (options) { if (options) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.limit !== undefined) url += `limit=${options.limit}` if (options.limit !== undefined) url += `limit=${options.limit}`
if (options.withMember !== undefined) { if (options.withMember !== undefined) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
url += `&with_member=${options.withMember.toString()}` url += `&with_member=${options.withMember.toString()}`
} }
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.after !== undefined) url += `&after=${options.after}` if (options.after !== undefined) url += `&after=${options.after}`
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.before !== undefined) url += `&before=${options.before}` if (options.before !== undefined) url += `&before=${options.before}`
} }
@@ -350,15 +332,12 @@ export function createRoutes(): RestRoutes {
if (options) { if (options) {
if (options.withCounts !== undefined) { if (options.withCounts !== undefined) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
url += `with_counts=${options.withCounts.toString()}` url += `with_counts=${options.withCounts.toString()}`
} }
if (options.withExpiration !== undefined) { if (options.withExpiration !== undefined) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
url += `&with_expiration=${options.withExpiration.toString()}` url += `&with_expiration=${options.withExpiration.toString()}`
} }
if (options.scheduledEventId) { if (options.scheduledEventId) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
url += `&guild_scheduled_event_id=${options.scheduledEventId}` url += `&guild_scheduled_event_id=${options.scheduledEventId}`
} }
} }
@@ -379,11 +358,8 @@ export function createRoutes(): RestRoutes {
let url = `/guilds/${guildId}/bans?` let url = `/guilds/${guildId}/bans?`
if (options) { if (options) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.limit) url += `limit=${options.limit}` if (options.limit) url += `limit=${options.limit}`
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.after) url += `&after=${options.after}` if (options.after) url += `&after=${options.after}`
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.before) url += `&before=${options.before}` if (options.before) url += `&before=${options.before}`
} }
@@ -405,9 +381,7 @@ export function createRoutes(): RestRoutes {
let url = `/guilds/${guildId}/members?` let url = `/guilds/${guildId}/members?`
if (options !== undefined) { if (options !== undefined) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.limit) url += `limit=${options.limit}` if (options.limit) url += `limit=${options.limit}`
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.after) url += `&after=${options.after}` if (options.after) url += `&after=${options.after}`
} }
@@ -426,13 +400,10 @@ export function createRoutes(): RestRoutes {
let url = `/guilds/${guildId}/prune?` let url = `/guilds/${guildId}/prune?`
if (options) { if (options) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.days) url += `days=${options.days}` if (options.days) url += `days=${options.days}`
if (Array.isArray(options.includeRoles)) { if (Array.isArray(options.includeRoles)) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
url += `&include_roles=${options.includeRoles.join(',')}` url += `&include_roles=${options.includeRoles.join(',')}`
} else if (options.includeRoles) { } else if (options.includeRoles) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
url += `&include_roles=${options.includeRoles}` url += `&include_roles=${options.includeRoles}`
} }
} }
@@ -448,13 +419,10 @@ export function createRoutes(): RestRoutes {
let url = `/guilds/${guildId}/prune?` let url = `/guilds/${guildId}/prune?`
if (options) { if (options) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
if (options.days) url += `days=${options.days}` if (options.days) url += `days=${options.days}`
if (Array.isArray(options.includeRoles)) { if (Array.isArray(options.includeRoles)) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
url += `&include_roles=${options.includeRoles.join(',')}` url += `&include_roles=${options.includeRoles.join(',')}`
} else if (options.includeRoles) { } else if (options.includeRoles) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
url += `&include_roles=${options.includeRoles}` url += `&include_roles=${options.includeRoles}`
} }
} }
-6
View File
@@ -110,8 +110,6 @@ import type {
GetScheduledEvents, GetScheduledEvents,
GetUserGuilds, GetUserGuilds,
GetWebhookMessageOptions, GetWebhookMessageOptions,
// Type is required for typedoc
// eslint-disable-next-line @typescript-eslint/no-unused-vars
GuildFeatures, GuildFeatures,
InteractionCallbackData, InteractionCallbackData,
InteractionResponse, InteractionResponse,
@@ -126,11 +124,7 @@ import type {
ModifyGuildTemplate, ModifyGuildTemplate,
ModifyRolePositions, ModifyRolePositions,
ModifyWebhook, ModifyWebhook,
// Type is required for typedoc
// eslint-disable-next-line @typescript-eslint/no-unused-vars
ScheduledEventEntityType, ScheduledEventEntityType,
// Type is required for typedoc
// eslint-disable-next-line @typescript-eslint/no-unused-vars
ScheduledEventStatus, ScheduledEventStatus,
SearchMembers, SearchMembers,
StartThreadWithMessage, StartThreadWithMessage,
-1
View File
@@ -45,7 +45,6 @@ describe('Get a user from the api', () => {
}) })
it('With an invalid user id', async () => { it('With an invalid user id', async () => {
// eslint-disable-next-line @typescript-eslint/await-thenable
await expect(rest.getUser('123')).eventually.throws await expect(rest.getUser('123')).eventually.throws
}) })
}) })
+1 -4
View File
@@ -2,8 +2,5 @@
"name": "tsconfig", "name": "tsconfig",
"version": "0.0.0", "version": "0.0.0",
"private": true, "private": true,
"files": [ "files": ["base.json", "test.json"]
"base.json",
"test.json"
]
} }
+2 -2
View File
@@ -6,7 +6,7 @@
"incremental": false, "incremental": false,
"tsBuildInfoFile": null, "tsBuildInfoFile": null,
"rootDir": null, "rootDir": null,
"outDir": null, "outDir": null
}, },
"include": ["${configDir}"], "include": ["${configDir}"]
} }
+3 -4
View File
@@ -18,8 +18,8 @@
"build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js", "build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js",
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types", "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types",
"release-build": "yarn build && yarn build:type", "release-build": "yarn build && yarn build:type",
"fmt": "eslint --fix \"src/**/*.ts*\"", "fmt": "biome format --write",
"lint": "eslint \"src/**/*.ts*\"", "lint": "biome lint --write",
"test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'", "test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'",
"test:unit": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js utils", "test:unit": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js utils",
"test:deno-unit": "swc tests --strip-leading-paths --delete-dir-on-start -C jsc.minify.mangle=false --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist", "test:deno-unit": "swc tests --strip-leading-paths --delete-dir-on-start -C jsc.minify.mangle=false --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist",
@@ -27,13 +27,12 @@
"test:type": "tsc --noEmit" "test:type": "tsc --noEmit"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^1.8.0",
"@swc/cli": "^0.4.0", "@swc/cli": "^0.4.0",
"@swc/core": "^1.4.2", "@swc/core": "^1.4.2",
"@types/mocha": "^10.0.7", "@types/mocha": "^10.0.7",
"@types/node": "^20.14.10", "@types/node": "^20.14.10",
"c8": "^9.1.0", "c8": "^9.1.0",
"eslint": "^8.57.0",
"eslint-config-discordeno": "*",
"mocha": "^10.5.1", "mocha": "^10.5.1",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"tsconfig": "*", "tsconfig": "*",
+7 -7
View File
@@ -498,7 +498,7 @@ export interface DiscordConnection {
/** whether the connection is revoked */ /** whether the connection is revoked */
revoked?: boolean revoked?: boolean
/** an array of partial server integrations */ /** an array of partial server integrations */
integrations?: Array<Partial<DiscordIntegration>> integrations?: Partial<DiscordIntegration>[]
/** whether the connection is verified */ /** whether the connection is verified */
verified: boolean verified: boolean
/** whether friend sync is enabled for this connection */ /** whether friend sync is enabled for this connection */
@@ -879,7 +879,7 @@ export interface DiscordGuild {
/** When this guild was joined at */ /** When this guild was joined at */
joined_at?: string joined_at?: string
/** States of members currently in voice channels; lacks the guild_id key */ /** States of members currently in voice channels; lacks the guild_id key */
voice_states?: Array<Omit<DiscordVoiceState, 'guildId'>> voice_states?: Omit<DiscordVoiceState, 'guildId'>[]
/** Users in the guild */ /** Users in the guild */
members?: DiscordMember[] members?: DiscordMember[]
/** Channels in the guild */ /** Channels in the guild */
@@ -887,7 +887,7 @@ export interface DiscordGuild {
/** All active threads in the guild that the current user has permission to view */ /** All active threads in the guild that the current user has permission to view */
threads?: DiscordChannel[] threads?: DiscordChannel[]
/** Presences of the members in the guild, will only include non-offline members if the size is greater than large threshold */ /** Presences of the members in the guild, will only include non-offline members if the size is greater than large threshold */
presences?: Array<Partial<DiscordPresenceUpdate>> presences?: Partial<DiscordPresenceUpdate>[]
/** Banner hash */ /** Banner hash */
banner: string | null banner: string | null
/** The preferred locale of a Community guild; used in server discovery and notices from Discord; defaults to "en-US" */ /** The preferred locale of a Community guild; used in server discovery and notices from Discord; defaults to "en-US" */
@@ -1922,7 +1922,7 @@ export interface DiscordAuditLog {
/** List of audit log entries, sorted from most to least recent */ /** List of audit log entries, sorted from most to least recent */
audit_log_entries: DiscordAuditLogEntry[] audit_log_entries: DiscordAuditLogEntry[]
/** List of partial integration objects */ /** List of partial integration objects */
integrations: Array<Partial<DiscordIntegration>> integrations: Partial<DiscordIntegration>[]
/** /**
* List of threads found in the audit log. * List of threads found in the audit log.
* Threads referenced in `THREAD_CREATE` and `THREAD_UPDATE` events are included in the threads map since archived threads might not be kept in memory by clients. * Threads referenced in `THREAD_CREATE` and `THREAD_UPDATE` events are included in the threads map since archived threads might not be kept in memory by clients.
@@ -2187,8 +2187,8 @@ export type DiscordAuditLogChange =
| 'communication_disabled_until' | 'communication_disabled_until'
} }
| { | {
new_value: Array<Partial<DiscordRole>> new_value: Partial<DiscordRole>[]
old_value?: Array<Partial<DiscordRole>> old_value?: Partial<DiscordRole>[]
key: '$add' | '$remove' key: '$add' | '$remove'
} }
| { | {
@@ -2408,7 +2408,7 @@ export enum DiscordInviteType {
export interface DiscordInviteStageInstance { export interface DiscordInviteStageInstance {
/** The members speaking in the Stage */ /** The members speaking in the Stage */
members: Array<Partial<DiscordMember>> members: Partial<DiscordMember>[]
/** The number of users in the Stage */ /** The number of users in the Stage */
participant_count: number participant_count: number
/** The number of users speaking in the Stage */ /** The number of users speaking in the Stage */
+9 -9
View File
@@ -58,7 +58,7 @@ export interface CreateMessageOptions {
/** true if this is a TTS message */ /** true if this is a TTS message */
tts?: boolean tts?: boolean
/** Embedded `rich` content (up to 6000 characters) */ /** Embedded `rich` content (up to 6000 characters) */
embeds?: Array<Camelize<DiscordEmbed>> embeds?: Camelize<DiscordEmbed>[]
/** Allowed mentions for the message */ /** Allowed mentions for the message */
allowedMentions?: AllowedMentions allowedMentions?: AllowedMentions
/** Include to make your message a reply */ /** Include to make your message a reply */
@@ -507,7 +507,7 @@ export interface InteractionCallbackData {
/** True if this is a TTS message */ /** True if this is a TTS message */
tts?: boolean tts?: boolean
/** Embedded `rich` content (up to 6000 characters) */ /** Embedded `rich` content (up to 6000 characters) */
embeds?: Array<Camelize<DiscordEmbed>> embeds?: Camelize<DiscordEmbed>[]
/** Allowed mentions for the message */ /** Allowed mentions for the message */
allowedMentions?: AllowedMentions allowedMentions?: AllowedMentions
/** The contents of the files being sent */ /** The contents of the files being sent */
@@ -771,7 +771,7 @@ export interface ExecuteWebhook {
/** The contents of the files being sent */ /** The contents of the files being sent */
files?: FileContent[] files?: FileContent[]
/** Embedded `rich` content */ /** Embedded `rich` content */
embeds?: Array<Camelize<DiscordEmbed>> embeds?: Camelize<DiscordEmbed>[]
/** Allowed mentions for the message */ /** Allowed mentions for the message */
allowedMentions?: AllowedMentions allowedMentions?: AllowedMentions
/** the components to include with the message */ /** the components to include with the message */
@@ -802,7 +802,7 @@ export interface CreateForumPostWithMessage {
/** The message contents (up to 2000 characters) */ /** The message contents (up to 2000 characters) */
content?: string content?: string
/** Embedded `rich` content (up to 6000 characters) */ /** Embedded `rich` content (up to 6000 characters) */
embeds?: Array<Camelize<DiscordEmbed>> embeds?: Camelize<DiscordEmbed>[]
/** Allowed mentions for the message */ /** Allowed mentions for the message */
allowedMentions?: AllowedMentions allowedMentions?: AllowedMentions
/** The components you would like to have sent in this message */ /** The components you would like to have sent in this message */
@@ -999,7 +999,7 @@ export interface EditMessage {
/** The new message contents (up to 2000 characters) */ /** The new message contents (up to 2000 characters) */
content?: string | null content?: string | null
/** Embedded `rich` content (up to 6000 characters) */ /** Embedded `rich` content (up to 6000 characters) */
embeds?: Array<Camelize<DiscordEmbed>> | null embeds?: Camelize<DiscordEmbed>[] | null
/** Edit the flags of the message (only `SUPPRESS_EMBEDS` can currently be set/unset) */ /** Edit the flags of the message (only `SUPPRESS_EMBEDS` can currently be set/unset) */
flags?: MessageFlags | null flags?: MessageFlags | null
/** The contents of the files being sent/edited */ /** The contents of the files being sent/edited */
@@ -1007,7 +1007,7 @@ export interface EditMessage {
/** Allowed mentions for the message */ /** Allowed mentions for the message */
allowedMentions?: AllowedMentions allowedMentions?: AllowedMentions
/** When specified (adding new attachments), attachments which are not provided in this list will be removed. */ /** When specified (adding new attachments), attachments which are not provided in this list will be removed. */
attachments?: Array<Camelize<DiscordAttachment>> attachments?: Camelize<DiscordAttachment>[]
/** The components you would like to have sent in this message */ /** The components you would like to have sent in this message */
components?: MessageComponents components?: MessageComponents
} }
@@ -1045,7 +1045,7 @@ export interface CreateGuild {
/** New guild roles (first role is the everyone role) */ /** New guild roles (first role is the everyone role) */
roles?: Camelize<DiscordRole[]> roles?: Camelize<DiscordRole[]>
/** New guild's channels */ /** New guild's channels */
channels?: Array<Partial<Camelize<DiscordChannel>>> channels?: Partial<Camelize<DiscordChannel>>[]
/** Id for afk channel */ /** Id for afk channel */
afkChannelId?: string afkChannelId?: string
/** Afk timeout in seconds */ /** Afk timeout in seconds */
@@ -1269,7 +1269,7 @@ export interface BeginGuildPrune {
/** https://discord.com/developers/docs/resources/guild#modify-guild-onboarding-json-params */ /** https://discord.com/developers/docs/resources/guild#modify-guild-onboarding-json-params */
export interface EditGuildOnboarding { export interface EditGuildOnboarding {
/** Prompts shown during onboarding and in customize community */ /** Prompts shown during onboarding and in customize community */
prompts: Array<Camelize<DiscordGuildOnboardingPrompt>> prompts: Camelize<DiscordGuildOnboardingPrompt>[]
/** Channel IDs that members get opted into automatically */ /** Channel IDs that members get opted into automatically */
defaultChannelIds: BigString[] defaultChannelIds: BigString[]
/** Whether onboarding is enabled in the guild */ /** Whether onboarding is enabled in the guild */
@@ -1357,7 +1357,7 @@ export interface CreatePoll {
/** The question of the poll. Only `text` is supported. */ /** The question of the poll. Only `text` is supported. */
question: Camelize<DiscordPollMedia> question: Camelize<DiscordPollMedia>
/** Each of the answers available in the poll, up to 10 */ /** Each of the answers available in the poll, up to 10 */
answers: Array<Omit<Camelize<DiscordPollAnswer>, 'answerId'>> answers: Omit<Camelize<DiscordPollAnswer>, 'answerId'>[]
/** /**
* Number of hours the poll should be open for * Number of hours the poll should be open for
* *
+4 -4
View File
@@ -1120,16 +1120,16 @@ export type CamelCase<S extends string> = S extends `${infer T}_${infer U}` ? `$
export type SnakeCase<S extends string> = S extends `${infer T}${infer U}` ? `${T extends Lowercase<T> ? '' : '_'}${Lowercase<T>}${SnakeCase<U>}` : S export type SnakeCase<S extends string> = S extends `${infer T}${infer U}` ? `${T extends Lowercase<T> ? '' : '_'}${Lowercase<T>}${SnakeCase<U>}` : S
export type Camelize<T> = T extends any[] export type Camelize<T> = T extends any[]
? T extends Array<Record<any, any>> ? T extends Record<any, any>[]
? Array<Camelize<T[number]>> ? Camelize<T[number]>[]
: T : T
: T extends Record<any, any> : T extends Record<any, any>
? { [K in keyof T as CamelCase<K & string>]: Camelize<T[K]> } ? { [K in keyof T as CamelCase<K & string>]: Camelize<T[K]> }
: T : T
export type Snakelize<T> = T extends any[] export type Snakelize<T> = T extends any[]
? T extends Array<Record<any, any>> ? T extends Record<any, any>[]
? Array<Snakelize<T[number]>> ? Snakelize<T[number]>[]
: T : T
: T extends Record<any, any> : T extends Record<any, any>
? { [K in keyof T as SnakeCase<K & string>]: Snakelize<T[K]> } ? { [K in keyof T as SnakeCase<K & string>]: Snakelize<T[K]> }
+3 -4
View File
@@ -18,8 +18,8 @@
"build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js", "build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js",
"build:type": "tsc --skipDefaultLibCheck --declaration --emitDeclarationOnly --declarationDir dist/types", "build:type": "tsc --skipDefaultLibCheck --declaration --emitDeclarationOnly --declarationDir dist/types",
"release-build": "yarn build && yarn build:type", "release-build": "yarn build && yarn build:type",
"fmt": "eslint --fix \"src/**/*.ts*\"", "fmt": "biome format --write",
"lint": "eslint \"src/**/*.ts*\"", "lint": "biome lint --write",
"test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'", "test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'",
"test:unit": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js utils", "test:unit": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js utils",
"test:deno-unit": "swc tests --strip-leading-paths --delete-dir-on-start -C jsc.minify.mangle=false --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist", "test:deno-unit": "swc tests --strip-leading-paths --delete-dir-on-start -C jsc.minify.mangle=false --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist",
@@ -32,6 +32,7 @@
"@discordeno/types": "19.0.0-beta.1" "@discordeno/types": "19.0.0-beta.1"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^1.8.0",
"@swc/cli": "^0.4.0", "@swc/cli": "^0.4.0",
"@swc/core": "^1.4.2", "@swc/core": "^1.4.2",
"@types/chai": "^4.3.16", "@types/chai": "^4.3.16",
@@ -40,8 +41,6 @@
"@types/sinon": "^17.0.3", "@types/sinon": "^17.0.3",
"c8": "^9.1.0", "c8": "^9.1.0",
"chai": "^5.1.1", "chai": "^5.1.1",
"eslint": "^8.57.0",
"eslint-config-discordeno": "*",
"mocha": "^10.5.1", "mocha": "^10.5.1",
"sinon": "^18.0.0", "sinon": "^18.0.0",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",

Some files were not shown because too many files have changed in this diff Show More