Compare commits

...

1053 Commits

Author SHA1 Message Date
Almeida
07f1d8f5b3 feat(core)!: rename getAllMembers to getMembers with query support (#11484)
BREAKING CHANGE: getAllMembers has been removed. Use getMembers instead, which accepts an optional query parameter.
2026-05-23 02:05:55 +01:00
Almeida
37892ead4c feat(ClientApplication): add fetchActivityInstance method (#11481)
* feat(ClientApplication): add fetchActivityInstance method

* refactor: requested changes

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-05-22 22:53:39 +00:00
Qjuh
9f111ed4df docs(Role): fix Role#tags docs (#11524)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-05-22 22:51:00 +00:00
Fadi Raad
c313bc58f1 docs: fix typos and duplicated words in comments and guide (#11502)
- fix "wether" -> "whether" and "dependant" -> "dependent" in RedisGateway JSDoc
- fix duplicated "the" in useful-packages guide
- fix duplicated "for" in two internal JSDoc param descriptions

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-05-22 22:47:15 +00:00
Almeida
76478c4ba5 feat(ShardingManager): allow setting custom api url (#11471)
* feat(ShardingManager): allow setting custom api url

* Apply suggestion from @Jiralite

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-05-22 23:40:09 +01:00
Kshitij Anurag
28dd65d322 feat: add shared client theme support (#11454)
* feat: add shared client theme support

* Apply suggestion from @Qjuh

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

* chore: tests

* chore: format

* chore: apply suggestions from code review

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-05-22 22:31:00 +00:00
Denis-Adrian Cristea
e490a230a3 fix(stringOption): zod validation (#11532)
fix: zod validation

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-05-21 15:46:49 +00:00
Qjuh
1e88dcdc05 feat(DMChannel)!: allow partial DMChannel without client user (#11443)
BREAKING CHANGE: `DMChannel#recipientId` is now nullable.
2026-05-20 19:05:16 +01:00
Almeida
40ce0791a8 feat(ApplicationsAPI): add getActivityInstance method (#11482)
feat(core): add getActivityInstance to ApplicationsAPI

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-04-24 17:11:18 +00:00
Dramex
8ea7c7c7e4 fix(collection): preserve ReadonlyCollection through tap/each (#11501)
* fix(collection): preserve ReadonlyCollection through tap/each

`each` and `tap` return polymorphic `this`, which TypeScript resolves
against the `Omit<Collection, ...>` portion of `ReadonlyCollection`
rather than the full intersection. That let callers reach `set` and
`delete` on the result of a chain started from a `ReadonlyCollection`:

    const ro: ReadonlyCollection<string, number> = new Collection(...);
    ro.tap(() => {}).set('x', 0); // compiled, mutated the underlying Map

The fix omits `each` and `tap` from the base `Omit` and re-declares
them on the `ReadonlyCollection` side of the intersection so the return
type narrows back to `ReadonlyCollection`.

Closes #10514

* test(collection): gate readonly-chain checks behind if(false)

Previously the `@ts-expect-error` lines still executed the `set` and
`delete` mutations at runtime, and the final `size === 1` passed only
because they happened to cancel out. Wrapping the assertions in
`if (false)` keeps the compile-time guarantee while the backing
collection is truly untouched, and adds a `get('a') === 1` check as
a belt.

* test(collection): move readonly type checks to *.test-d.ts

Addresses review feedback. The type-level assertions around tap() and
each() preserving ReadonlyCollection belong in a *.test-d.ts file so
they run through vitest's typecheck pass instead of runtime.

Replaces the if(false)-gated @ts-expect-error block in collection.test.ts
with expectTypeOf assertions in a new collection.test-d.ts. Covers both
the no-thisArg and with-thisArg overloads of tap and each.
2026-04-20 19:15:29 +00:00
2^1
58c5ebdd08 chore(readme): update related libraries link (#11487)
* fix(readme): related libraries link broke

* docs(readme): update all related-libs links
2026-04-13 16:20:06 +00:00
Almeida
aa1e6be792 fix: github icon size (#11488) 2026-04-09 19:59:41 +00:00
Qjuh
aa2767bd6f fix(MessagePayload): allow AttachmentBuilder in files payload (#11423)
* fix(MessagePayload): allow AttachmentBuilder in files payload

* fix: typo

* chore: apply suggestions from code review

Co-authored-by: Almeida <github@almeidx.dev>

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-04-09 09:27:02 +00:00
René
1f9affd979 perf(collection): avoid duplicated population of new collections (#11473) 2026-04-01 09:56:37 +00:00
Almeida
339b8b5655 chore: upgrade dependencies (#11470)
* chore: upgrade dependencies

* chore: upgrade some major dependencies

* chore: bump shiki to v4

* chore: bump actions dependencies

* chore: upgrade meilisearch dependency

* chore: set aria-hidden on GitHubIcon

* fix: use official github icon
2026-03-31 09:57:57 +01:00
Almeida
9b7ea5a1b7 fix: sendSoundboardSound return type (#11452)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-03-29 09:25:00 +00:00
Almeida
8bcf8c94e9 feat(GuildMember): add collectibles (#11468)
feat(GuildMember): add collectibles, fix partial update handling
2026-03-29 09:19:42 +00:00
Muhammad Bin Ali
22b820fbf2 fix(util): detect Cloudflare Workers in shouldUseGlobalFetchAndWebSocket (#11456)
Co-authored-by: Muhammad Ali <muhammadali@cloudflare.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-03-26 15:46:57 +00:00
epochzx
9ade8dcc71 docs: fix typo in sharding guide (#11467)
Fix a typo in sharding guide
2026-03-26 10:26:40 +00:00
Jiralite
2a067216c4 chore: Release @discordjs/voice 0.19.2 (#11450)
chore(voice): release @discordjs/voice@0.19.2

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
2026-03-13 15:23:33 +00:00
Denis-Adrian Cristea
fe5e3c2a82 chore: remove file from root (#11442)
chore: oops

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-03-13 09:28:42 +00:00
Snazzah
c486fb8127 fix(voice): strip padding from packets and add guards (#11449)
* fix(voice): strip padding from incoming packets

* fix(voice): add additional guards to voice recieve

* chore: apply comments

* chore: fix formatting
2026-03-13 08:36:01 +00:00
Jiralite
f3942a6319 chore: Release @discordjs/voice 0.19.1 (#11446)
* chore(voice): release @discordjs/voice@1.0.0

* chore(voice): release 0.19.1

---------

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
2026-03-09 21:26:11 +00:00
Denis-Adrian Cristea
84b85f4c91 refactor!: remove builders and formatters re-export (#11361)
BREAKING CHANGE: removed builders and formatters re-export
2026-03-07 12:25:00 +02:00
Almeida
52173b6ca8 fix: disable per option validation on chat input subcommands (#11405)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-03-07 00:02:56 +00:00
Denis-Adrian Cristea
41439d3a40 feat(RedisBroker): discordjs/core gateway impl (#11005)
* feat(RedisBroker): discordjs/core gateway impl

* fix: import

Co-authored-by: Almeida <github@almeidx.dev>

* chore: iterate

* fix: publish properly

* chore: deps and docs

* chore: leftover comment

* chore: suggested changes

* doc: bad comment

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-03-05 12:27:14 +00:00
Qjuh
d6e1609408 docs(discord.js): less omit types for better docs (#11323)
* docs(discord.js): less omit types for better docs

* chore: refactor guild scheduled event types

* fix: duplicate properties

* fix: use correct type type

* chore: apply suggestion from @almeidx

Co-authored-by: Almeida <github@almeidx.dev>

---------

Co-authored-by: Almeida <github@almeidx.dev>
2026-03-02 21:37:24 +00:00
Naiyar
3e6364070b feat: modal radio group and checkbox components (#11395)
* feat: radio group and checkbox component in modal

* chore: some doc and type fixes

* chore: missing types

* chore: update component names

* docs: radio group value now returns null if not selected

* Remove empty line at the beginning of ModalSubmitInteraction.js

* Change value property to be nullable in RadioGroupModalData

* chore: review

* chore: missing "type"

* chore: suggestion

Co-authored-by: Almeida <github@almeidx.dev>

* chore: review

Co-authored-by: Almeida <github@almeidx.dev>

---------

Co-authored-by: Almeida <github@almeidx.dev>
2026-03-02 21:09:03 +00:00
Almeida
3c9d90ad7e chore: move proxy-container to apps (#11435)
* chore: move proxy-container to apps

* chore: limit next/react rules to next apps

* chore: add standalone issue template

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-03-02 19:34:45 +00:00
VAKiliner
ec796caf00 fix(GuildChannel): Handle empty overwrite must only handle @everyone (#11221)
* Add check overwrite id

* Update GuildChannel.js

* Update GuildChannel.js

* chore: fmt

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-03-02 19:02:24 +00:00
Almeida
f1949271a0 docs: add missing ApplicationCommandPermissionsUpdateData (#11415)
* docs: add missing ApplicationCommandPermissionsUpdateData

* Update packages/discord.js/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-03-02 10:43:55 +00:00
Asad Humayun
fce498982a fix(structures): add missing toJSON method on Subscription structure (#11431)
fix(structures): add missing `toJSON` method on Subscription

When writing tests for #11407, it became apparent that I had forgotten to add the `toJSON` method for this structure when I was initially wrote the structure. I have now added this method and it passes when running the tests that I have written for this (which will be merged in a following PR).

Signed-off-by: Asad Humayun <asad.humayun@asadh.io>
2026-03-01 21:10:26 +00:00
Almeida
307b64f139 chore: make docgen package private (#11434) 2026-03-01 12:44:06 +00:00
faceboy
0cb8be490c docs(builders): edited docs to correctly link to splice (#11430)
fix(builders): edited docs to correctly link to splice

StringSelectMenuBuilder.splice()'s docs incorrectly linked to slice instead of splice in MDN docs, fixed that
2026-02-25 05:46:25 +00:00
Jiralite
77e767277b build: Upgrade dependencies and pnpm (#11420)
* build: upgrade dependencies

* build: upgrade pnpm

* test: fix voice

* build: regenerate file

* fix: reports by ESLint

* fix: docs errors

* build: downgrades

* build: no upstream bump

* build: discord-api-types 0.38.40

* build: pnpm 10.30.1

* fix: ignore @typescript-eslint/no-duplicate-type-constituents

* fix: jsdoc lint in api-extractor

* build: update template for ESLint

Co-authored-by: Almeida <github@almeidx.dev>

* chore: explicit TODO

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

* chore: revert typings lint change

---------

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
Co-authored-by: Almeida <github@almeidx.dev>
2026-02-20 17:44:38 +00:00
Qjuh
ccce987fa1 types: broadcastEval overload order (#11421)
* types: broadcastEval overload order

* types: also apply to ShardClientUtil
2026-02-16 13:20:59 +00:00
Almeida
a3e189df00 feat: emit voiceServerUpdate event (#11414)
* feat: emit voiceServerUpdate event

* fix: add back debug log

* refactor: censor token in debug logs

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-02-08 16:48:49 +00:00
Asad
c460a920ac feat(structure): add Webhook structure (#11401)
* feat(structure): add barrel exports for Webhook structure

* feat(structure): add Webhook structure

* chore(structures): lib exports consistency

* docs: update docs
2026-02-06 16:57:49 +00:00
Asad
c71228aab3 feat(structures): add SKU structure (#11389)
* feat(structures): update barrel exports in preparation for SKU structure

* feat(structures): add SKUFlagsBitField to /bitfields

* feat(structures): add SKU structure

* chore(structures): correct barrel exports

* chore(structures): export SKUBitfieldFlags

* docs(structures): correct usage of see/link doc comments

* chore(structures): correct usage of bitfields in extending classes

* docs(structures): remove unnecessary links

* fix(structures): correctly apply bitfields, introduced in #11404

---------

Co-authored-by: Almeida <github@almeidx.dev>
2026-01-28 01:08:43 +00:00
Asad
b0e413c116 feat(structure): add voice structure (#11400)
* feat(structure): add Voice structures

* feat(structure): add VoiceState structure

* feat(structure): add VoiceRegion structure

* chore(structures): lib exports consistency

---------

Co-authored-by: Almeida <github@almeidx.dev>
2026-01-27 23:17:01 +00:00
Asad
65386034b6 feat(structures): add SoundboardSound structure (#11390)
* feat(structures): update barrel exports in preparation for new structure

* feat(structures): add SoundboardSound structure

* chore(structures): update doc comment

* chore(structures): address review suggestions

* chore(structures): consistency changes and use isIdSet to retrieve id

* docs(structures): add remarks to conditionally present attributes

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-01-27 23:10:19 +00:00
Asad
1251d479b0 feat(structures): add StickerPack structure (#11398)
* feat(structures): update barrel exports

* feat(structures): add StickerPack structure

* chore(structures): add createdAt and createdTimestamp to Sticker struct

* docs(structure): correct usage of links in see/link blocks

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-01-27 23:06:28 +00:00
Asad
693fcbc32b feat(structures): add Stage Instance structure (#11397)
* feat(structures): update barrel exports for stage instance structure

* feat(structures): add stage instance structure

* docs(structure): cleanup and use see/link correctly

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-01-27 23:03:09 +00:00
Asad
c126367140 feat(structures): add Team structure (#11396)
* feat(structures): add and update barrel exports in prep for new struct

* feat(structures): add TeamMember substructure

* feat(structures): add Team structure

* chore(structures): add ownerUserId attribute back

* chore(structures): add teamId attribute

* docs(structures): correctly use see/link blocks and cleanup

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-01-27 22:59:42 +00:00
Asad
fc5ba6be70 feat(structures): add Subscription structure (#11399)
* feat(structure): update barrel exports for new structure

* chore(structure): add new symbols for the Subscription structure

* feat(structure): add Subscription structure

* docs(structure): correct typos

* chore(structure): add default attributes on class params

* fix(structures): correctly expose [..]Ids properties and update docs

* fix(structures): add canceled_at to DataTemplate

* docs(structures): update doc clarity on canceledAt getter - @almeidx

This was a suggestion by Almedia.

Co-authored-by: Almeida <github@almeidx.dev>

* style: fix

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-01-27 22:56:06 +00:00
Qjuh
7a7fecbe3c fix(structures): correctly check if flags are present (#11404)
* fix(structures): correctly check if flags are present

* chore: isFieldSet type guard

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-01-27 16:47:56 +00:00
Vlad Frangu
323d8e7571 fix(voice): always install Davey as DAVE is becoming required (#11385)
* fix(voice): always install Davey as DAVE is becoming required

* chore: requested changes

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-01-25 20:28:04 +00:00
Asad
3550b497f6 feat(structures): add AutoModeration structures (#11381)
* feat(structures): add barrel exports in preparation new structures

* feat(structures): add AutoModerationRule structure

* feat(structures): add AutoModerationRuleTriggerMetadata structure

* feat(structures): add AutoModerationAction substructure

* feat(structure): add AutoModerationActionMetadata substructure

* chore: correct typo

* chore: do not expose exemptRoles and exemptChannels as getters

* feat(structures): rename substructure files

* chore(structures): update barrel exports

* chore(structures): export automod structures in package barrel exports
2026-01-24 19:40:01 +00:00
René
838cd2da34 perf(collection): use object destructuring of entry tuples (#11391) 2026-01-22 09:13:43 +00:00
Almeida
017176926a refactor: move full validation to ChatInputCommandBuilder (#11304)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-01-16 16:54:51 +00:00
ManHam
be78e26729 feat: add Bun templates for create-discord-bot (#11348)
* feat: add Bun templates for create-discord-bot

- Add TypeScript Bun template with complete src structure
- Add JavaScript Bun template with complete src structure
- Both templates mirror the Node.js versions with Bun-specific configuration

Closes #11346

* fix: update template and bun template loading

---------

Co-authored-by: almeidx <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-01-16 15:32:20 +00:00
jacobhumston
52a69d77d0 feat(create-discord-bot): allow certain files/folders to be included in the target directory (#11368)
* feat(create-discord-bot): allow empty git repositories

* feat(create-discord-bot): create a .gitignore for git repositories

* fix(create-discord-bot): correctly handle .git file edge case

* refactor(create-discord-bot): use next.js "is-folder-empty" utility

* refactor(create-discord-bot): combine checks

* revert: revert comment change

This reverts commit 2f8422e90d.

* feat(create-discord-bot): add .gitignore to templates

* docs(create-discord-bot): add source link to isFolderEmpty util

* docs(create-discord-bot): add @license JSDoc tag to license comment

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-01-16 12:57:47 +00:00
Asad
3d74122215 feat(structures): add entitlement structure (#11377)
* feat(structures): add entitlement structure

* feat(structures): create and update barrel exports

* chore: reword comment for entitlment deleted getter to be clearer

* feat(structures): add symbols to optimise ends_at, starts_at fields

* feat(structures): optimise starts_at and ends_at fields

* feat(structures): manage Date and Discord ISOs appropriately

* chore: remove accidental whitespace

* chore: correct name styles on symbols (remove 'at')

* chore: correct name styles on AtTimestamp fields (remove 'at')

* chore: call super.toJSON on toJSON override

* chore: run prettier to clear linting/formatter errors

* chore: correct usage of optimizeData

* chore: update DataTemplate override for Entitlement

* chore: update class default type param, update DataTemplate doc

* Apply suggestions from code review

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2026-01-15 23:43:39 +00:00
Asad
69432a1bca feat(structures): add emoji structure (#11369)
* feat(structures): add emoji structure

* chore: update deps

* chore: update deps

* chore: update deps

* Revert "chore: update deps"

This reverts commit 8332f48611.

* Revert "chore: update deps"

This reverts commit a168e735a3.

* Revert "chore: update deps"

This reverts commit 0b19058cda.

* chore: consistency (capitalisation)

* fix(structures): do not export substructures from emoji structure

* chore(structures): add remark detailing substructures

* chore: update remarks to reflect exported substructures (remove roles)

* chore: update remarks to explain why roles not exposed on structure
2026-01-15 23:31:35 +00:00
Aryan Bagade
8ccae833e7 types(UserManager): fix send() return type to Promise<Message<false>> (#11337)
* types(UserManager): fix send() return type to Promise<Message<false>>

UserManager.send() always sends a direct message (DM), so the return type should b Promise<Message<false>> instead of Promise<Message> to correctly indicate that the message is not in a guild context.

Closes #11331

* fix: requested changes

---------

Co-authored-by: almeidx <github@almeidx.dev>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2026-01-02 17:56:34 +00:00
Souji
c921e84531 feat(guide): update member fetch errors (#11374)
* feat(guide): update member fetch errors

* member count is no longer relevant, since the timeout resets on each chunk
* add link to the dev portal on members didn't arrive in time
* add section about opcode 8 gateway rate limit

resolves #11245 #11277

* chore: add missing period on list item

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-01-02 14:17:24 +00:00
kikorp78
311413e5f2 fix: broken link on sharding page (#11373) 2025-12-26 00:45:21 +00:00
yokkkoso
7884ecd3a0 fix(emojiPredicate): wrong min name length (#11371) 2025-12-23 18:54:17 +00:00
Pavel-Boyazov
427636ee75 types(Message): specify rawData arg type (#11123)
Co-authored-by: Almeida <github@almeidx.dev>
2025-12-17 19:04:17 +00:00
Almeida
cad826fc03 feat(RoleManager): add fetchMemberCounts (#11352)
* feat(RoleManager): add `fetchMemberCounts`

* docs: improve description

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-12-17 18:59:50 +00:00
Vlad Frangu
51b5d38342 feat: proper authorizing integration owners structure (#11366)
* feat: proper authorizing integration owners structure

chore: fix ci

chore: fix types

chore: fix types

chore: nits

chore: tests

chore: requested changes

chore: drop it from apitypes

chore: requested 2

chore: rofl

chore: docs

* chore: docs

* chore: docs

* Apply suggestions from code review

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-12-17 18:55:05 +00:00
Marko Kajzer
5f93fbd0f2 fix(voice): handle negative timeouts (#11362) 2025-12-17 18:53:10 +00:00
Snazzah
c4fc79a3cd fix(voice): handle multiple transitions simultaneously (#11100)
* fix(voice): handle multiple transitions simultaneously

* fix: fix execute transition return

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-12-12 15:49:37 +00:00
Vlad Frangu
5b4dbd541e feat: zstd streaming support (#10758)
* feat(ws): zstd streaming support

* chore: naming of the mode

* fix: remove `@ts-expect-error`

---------

Co-authored-by: Almeida <github@almeidx.dev>
2025-12-12 13:01:25 +00:00
Almeida
df0c28afc2 feat(GuildsAPI): add getRoleMemberCounts (#11353)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-12-11 01:48:28 +00:00
Almeida
451a6380c6 fix: handle github api errors gracefully (#11357)
* fix: handle github api errors gracefully

* fix: remove forks and improve log
2025-12-10 23:03:32 +01:00
Almeida
01f31f374a chore: bump dependencies (#11356)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-12-10 17:53:48 +00:00
Denis-Adrian Cristea
9bf1f739e0 chore: remove usage of the prefer-global rules (#11279) 2025-12-10 14:05:29 +00:00
Copilot
548d75258b perf: Optimize Collection.equals() to reduce redundant map lookups (#11344)
* Initial plan

* Optimize Collection.equals() to avoid redundant map lookups

Co-authored-by: iCrawl <20760160+iCrawl@users.noreply.github.com>

* Add explanatory comment for equals() undefined check optimization

Co-authored-by: iCrawl <20760160+iCrawl@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: iCrawl <20760160+iCrawl@users.noreply.github.com>
Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-12-09 21:22:14 +00:00
Almeida
6a129bc054 chore: lower concurrency on index upload (#11351)
* chore: lower concurrency on index upload

* chore: increase timeout
2025-12-09 21:02:57 +00:00
Almeida
f60d3d65fe refactor!: move embedLength function to util package (#11327)
BREAKING CHANGE: Builders no longer exports a `embedLength` function. Import it from `@discordjs/util` instead.

Co-authored-by: Danial Raza <danialrazafb@gmail.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-12-09 18:40:34 +00:00
jNullj
4db1092f8f docs(voice): add DAVE dependency section (#11061)
* docs(voice): add DAVE dependency section

continues work found at https://github.com/discordjs/discord.js/issues/10735

Read more at https://discord.com/developers/docs/change-log#voice-endtoend-encryption-dave-protocol

* docs(voice): fix dave dependency note order

* remove explicit warning regarding optional dependency being optional

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Almeida <github@almeidx.dev>
2025-12-09 17:48:24 +00:00
Almeida
eaa6863f93 fix: lockfile (#11347) 2025-12-09 13:29:01 +00:00
Almeida
06c8da23d1 chore: update deps & search indice action refactor (#11339)
* chore: update deps & search indice action refactor

- Updated pnpm, dependencies and regenerated the lockfile
- Removed immer and some eslint plugins that weren't being used
- Updated the version of `@types/node` to v24 on internal packages as
  that's the version that is being used on github actions
- Refactored the uploadSearchIndices action slightly and upgraded the
  meilisearch dependency

* chore: remove more deps
2025-12-09 13:47:46 +01:00
Jiralite
2c3bf5c817 ci: Upload README.md files (#11342)
* feat: upload README.md files

* ci: build actions

* fix: build action

* chore: force rename
2025-12-09 03:22:39 +01:00
Almeida
ec3ef7b1bd feat: use native node typescript (#11259)
* feat: use native node typescript

* fix: use basename

* Update packages/create-discord-bot/template/Bun/TypeScript/tsconfig.json

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Change module and moduleResolution to ESNext and Bundler

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-09 03:22:16 +01:00
Almeida
c9bc33c758 fix(stringOptionPredicate): min_length and max_length min values (#11340)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-12-09 00:20:15 +00:00
Noel
f38395ec4e fix: update MeiliSearch API key 2025-12-09 00:48:57 +01:00
Almeida
ec76b17be3 chore: workflow and docker image tweaks (#11341) 2025-12-09 00:15:14 +01:00
Jiralite
d90a86a048 fix(Message): Optional parameter for setting allowed mentions (#11338)
feat: allow empty allowed mentions

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-12-08 23:14:34 +00:00
Egologics
fa43c40d34 fix(builders): handle 0 as valid attachment ID (#11330)
* fix(builders): handle 0 as valid attachment ID

Fixes #11314

The AttachmentBuilder.getRawFile() method was using a falsy check that treated 0 as invalid. Changed to use the 'in' operator to properly check for the existence of the id property.

* Update packages/builders/__tests__/messages/fileBody.test.ts

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* Apply suggestion from @almeidx

* fix: lint

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-12-08 23:08:36 +00:00
Almeida
d0745afbea chore: upgrade vitest to v4 (#11336) 2025-12-08 18:55:45 +00:00
Almeida
d518c97840 chore: upgrade storybook to v10 (#11334)
- Replaced deprecated `@storybook/addon-styling` with `@storybook/addon-themes`
- Removed deprecated `@storybook/addon-essentials` and `@storybook/addon-interactions`
- Upgraded `chromatic`, although it's seemingly unused anywhere
- Upgraded `@types/node` to match the ones in the guide and website

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-12-08 08:27:04 +00:00
Denis-Adrian Cristea
9005c8ae9c refactor!: remove AttachmentBuilder and support new file body encodables (#11278)
BREAKING CHANGE: Remove AttachmentBuilder

---------

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-12-08 10:19:43 +02:00
Almeida
5888663392 test: fix type errors (#11325)
* test: fix type errors

* chore: use MockedFunction

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-12-08 00:24:29 +00:00
Almeida
8d33188ac1 feat: use turbopack for prod builds (#11335) 2025-12-08 00:17:16 +00:00
Jiralite
5e6bd4b3d7 build: Bump dependencies (#11333)
* build: bump dependencies

* fix: guide build

* build: amend package.json.hbs

* build: create-discord-bot

* style: formatting

* build: final change

---------

Co-authored-by: almeidx <github@almeidx.dev>
2025-12-06 22:55:07 +00:00
Almeida
0aaba0305f fix(undiciRequest): file uploading (#11320)
* fix(undiciRequest): file uploading

* fix: different approach

* fix: revert to the previous approach

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-12-03 14:40:15 +00:00
IllagerCaptain
633fdd8f28 feat(Guild): Add maximumStageBitrate (#11313)
* Add `maximumStageBitrate : number`

* Add `maximumStageBitrate : number`

* oops

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-12-02 23:26:15 +00:00
Almeida
87b359e44d fix: replace usages of Buffer#slice() with Buffer#subarray() (#11326)
fix: replace usages of Buffer.slice() with Buffer.subarray()

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-12-02 23:13:10 +00:00
Jiralite
ec7047572e chore: Delete the pull request template (#11301)
Delete .github/PULL_REQUEST_TEMPLATE.md

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-30 21:59:23 +00:00
Jiralite
2520a0fb96 chore: @favware/cliff-jumper schema (#11328)
* chore: add schema

* chore: template pain

* build: remove from docgen
2025-11-30 21:54:51 +00:00
Jiralite
a57b4d4d29 fix: Allow mixing subcommands with subcommand groups (#11303)
fix: allow subcommand with groups

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-30 16:48:19 +00:00
Jiralite
8162ae8ce0 test: Add toJSON() to tests (#11321)
test: fix validation

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-30 16:41:48 +00:00
Jiralite
ace834b274 fix: Adjust label predicates and fix buttons emoji/label behaviour (#11317)
* fix: buttons with custom id

* fix: button labels

* fix: also add refinement to link buttons

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-30 16:17:50 +00:00
Rie
d59857e901 fix(builders): add proper snowflake validation (#11290)
* fix(builders): add proper snowflake validation

close #11289

* fix(builders): use snowflake validation for attachment id

* test(builders): add validation tests for snowflake attachment IDs

* fix: better regex

Co-authored-by: Almeida <github@almeidx.dev>

* test(builders): fix snowflake validation in fileBody test

* Update packages/builders/src/Assertions.ts

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* fix: update regex

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-30 15:30:04 +00:00
Qjuh
19253f6b7b feat: message structures (#10982)
* feat: message structures

* fix: docs

* chore: components and more

* feat: embed and more

* feat: more substructures and code review suggestions

* chore: tests and date conversions

* chore: jsdoc strings

* fix: tests

* fix: tests

* feat: hexColor getters

* chore: remove getters for nested data

* chore: apply suggestions from code review

* fix: burst_colors in toJSON

* docs: rephrase SectionBuilder remark

* chore: add LabelComponent

* fix: add name and size to file component

* chore: move resolved interaction data to interactions dir

* fix: code review

* chore: bump discord-api-types

* chore: apply code review suggestions

* fix: lockfile

* chore: update remark

* fix: missing export

* chore: code review and tests

* build: fix file

* fix: typo

* fix: missing toJSON

* fix: remove redundant patch overrides

* chore: missing component suffix

* chore: better name

* chore: add comment explaining timestamp conversion

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-11-28 16:52:42 +00:00
VAKiliner
aeb8986aa1 fix(Client): Move client initialization code (#11184)
* Update index.js

* Fix

* Fix path to ClientUser

* Update Client.js

* Migrating back to READY.js

* Move _checkReady()

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Denis-Adrian Cristea <didinele.dev@gmail.com>
2025-11-28 14:12:23 +00:00
Souji
444e55a093 feat(guide): updating section (#11322)
feat: sidebar, layout, initial content

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-11-28 11:37:19 +00:00
William Bowen
b2cbdf1567 feat(guide): updated modal page for label (#11169)
* feat(guide): updated modal page for label

* feat(guide): updated modal page with modal component sections

* feat(guide): added modal to select menu page

* fix(guide): moved select menu and add text display callout

* feat(guide): reworked to show modal together instead of separately

* feat(guide): added file upload  to modal

* fix: code block focus in modals

* fix: grammar

* fix: grammar and wording

* feat: structure and readability

General improvements to structure and reading flow
* Reword sentence structure
* Use semantic code highlights
* Consistent heading casing
* Add additional explanations and elaborations
* Adapt legacy examples in text
* Omit repeated code for brevity and less scrolling

* fix: updated example Image

* chore: typos, grammar, rephrasing

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Ryan Munro <monbrey@gmail.com>

* chore: review rephrasing

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Ryan Munro <monbrey@gmail.com>

* chore: rephrasing for correctness

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* chore: rephrasing for correctness

* chore: rephrasing for correctness

* chore: formatting

* chore: rephrasing for correctness

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* chore: update text

---------

Co-authored-by: almostSouji <timoqueezle@gmail.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Ryan Munro <monbrey@gmail.com>
2025-11-28 11:33:26 +00:00
Jiralite
02fc101069 fix(DJSError): Differentiate error type (#11295)
* fix(DJSError): differentiate error type

* fix: remove `?.`
2025-11-22 20:22:55 +00:00
Jiralite
db41d5cb68 refactor(DJSError): Prefer this.constructor.name (#11294)
refactor(DJSError): prefer `this.constructor.name`
2025-11-22 12:45:33 +00:00
Danial Raza
179525d9fc fix: typos (#11293) 2025-11-22 10:08:20 +00:00
Jiralite
0b12263371 fix(GuildEmojiManager)!: Allow CreateGuildExpressions for retrieving author data (#11283)
* fix(GuildEmojiManager): allow `CreateGuildExpressions`

* fix!: update error code

BREAKING CHANGE: `MissingManageGuildExpressionsPermission` has become `MissingGuildExpressionsPermission`.
2025-11-20 23:15:58 +00:00
Almeida
456a6f4548 fix: header link on packages with entrypoints (#11285)
* fix: header link on packages with entrypoints

* types: add types

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-20 21:22:36 +00:00
Jiralite
5130d6f56c fix: Sort package versions (#11284)
* fix: sort package versions

* refactor: remove spaces

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-20 21:17:28 +00:00
Jiralite
5dea94602e ci: Remove tags instead of only deprecating (#11263)
ci: deprecate -> remove

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-20 20:17:00 +00:00
Denis-Adrian Cristea
68bb8af58a feat(builders): multipart form data output support (#11248)
* feat(builders): multipart form data output support

* refactor: proper key management

* chore: add missing remarks

* chore: requested changes

* chore: rename encodables file

* chore: requested changes

* chore: requested changes

* chore: nits

Co-authored-by: Almeida <github@almeidx.dev>

* chore: requested change

* chore: requested change

---------

Co-authored-by: Almeida <github@almeidx.dev>
2025-11-19 21:59:51 +00:00
Jiralite
315f422781 fix: Mark external links as external (#11282)
fix: mark external links as external
2025-11-18 15:56:57 +00:00
Jiralite
9d5c6b4588 fix(Util): Resolve circular dependency (#11276)
* fix(Util): resolve circular

* refactor: lazily load all other circulars
2025-11-15 10:06:05 +00:00
Danial Raza
7349a6ee3e refactor(client)!: remove BaseClient (#11274)
BREAKING CHANGE: `BaseClient` has been removed and its functionality has been merged into `Client`.
2025-11-14 23:03:39 +01:00
Jiralite
87364c7ed9 docs(MessageManager): Update fetchPins() wording (#11275)
docs(MessageManager): update `fetchPins()` wording
2025-11-14 21:23:58 +00:00
Denis-Adrian Cristea
25aff7e218 feat(GuildMemberManager): handle gateway request rate limit (#11252)
* feat(GuildMemberManager): handle gateway request ratelimit

* chore: typo no one saw

* fix: cleanup listener properly

* types: add error code

* refactor: requested changes

* fix: update emitted warning

* chore: requested changes

* refactor: remove event

* refactor: warning

* chore: wording

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
2025-11-14 20:51:54 +00:00
ckohen
9f18cb2129 refactor(Webhooks)!: remove WebhookClient (#11266)
BREAKING CHANGE: WebhookClient has been removed, use @discordjs/core instead or fetch webhooks. Alternative solutions are in the works
BREAKING CHANGE: `WebhookURLInvalid` is no longer an error code (obsolete).

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-11-13 12:57:00 -08:00
Jiralite
837af56cf8 fix: Remove data conditional check (#11250)
* fix: remove conditional

* types: sort types
2025-11-12 13:31:13 +00:00
Danial Raza
e8217e335c feat!: support new s/S timestamp styles (#11267)
BREAKING CHANGE: `TimestampStyles.LongTime` has been removed. Use `TimestampStyles.MediumTime` instead.
BREAKING CHANGE: `TimestampStyles.ShortDateTime` has been removed. Use `TimestampStyles.LongDateShortTime` instead.
BREAKING CHANGE: `TimestampStyles.LongDateTime` has been removed. Use `TimestampStyles.FullDateShortTime` instead.
2025-11-12 10:55:20 +00:00
Almeida
538b47dd00 feat: upgrade zod to v4 (#11258)
* feat: upgrade zod to v4

* fix: requested changes

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-12 10:07:58 +00:00
Danial Raza
d923e90ae6 chore: migrate eslint configs (#11234)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-12 09:50:07 +00:00
Jiralite
8ed93b3269 types(DiscordjsErrorCodes): Add missing permission overwrites error codes (#11256)
types: add missing types

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-12 07:25:30 +00:00
Qjuh
5619137acd feat(api-extractor-model): use correct version for external packages (#11255)
Co-authored-by: Danial Raza <danialrazafb@gmail.com>
2025-11-11 20:40:22 +00:00
Souji
35996b7d75 fix: issue template guide (#11254)
* Add guide content issue template

* remove empty line

* fix: typo

* chore: add guide as issue template code owners

* chore: add core as additional template code owners

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-11 20:28:25 +00:00
Denis-Adrian Cristea
d3d6777ef8 feat(core): handle request all guild members rate limit (#11251)
* feat(core): handle request all guild members rate limit

BREAKING CHANGE: `Gateway` now requires `off` `once` methods

* fix: weird import update

* refactor: error class

* refactor: error class again

* refactor: requested changes

* chore: fix dep

* fix: suggested changes

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-11 07:14:57 +00:00
Denis-Adrian Cristea
37a38883d7 refactor(publish-dev): take ref instead (#11236)
* refactor(publish-dev): take ref instead

* fix: main checks

* chore: relevant examples

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-10 14:39:42 +00:00
Josef
c85f18c1ee feat: optimize role manager cache getter (#11239)
Co-authored-by: Almeida <github@almeidx.dev>
2025-11-09 10:51:40 +00:00
Kendell R
9723cc590b fix: improve handling of italics in the presence of links (#11064)
* fix(formatters): don't escape * in links

* add test for * -> * in url

* `\S+` -> `\S*` (tested locally)

* @Qjuh: handle italics both inside+outside <url>s

* more accurate <link> matcher

---------

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
2025-11-09 09:02:25 +00:00
Jiralite
3cb3ecae21 docs(BaseSelectMenu): Adjust maximum wording (#11249)
docs(BaseSelectMenu): adjust wording

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-05 19:30:36 +00:00
Almeida
dafdc78e73 chore: upgrade actions/setup-node to v6 and node.js to v24 (#11237)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-05 18:38:02 +00:00
Jiralite
3122da4ea4 ci(deprecate-tag): Remove comment (#11246)
ci: remove #

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-05 18:36:06 +00:00
Souji
4da0c03784 chore: add guide issue template (#11247)
* Add guide content issue template

* remove empty line
2025-11-05 19:31:40 +01:00
Denis-Adrian Cristea
4c18a89c2f feat(ci): deprecate tag (#11235)
* feat(ci): deprecate tag

* fix: wildcard

* chore: newer deps

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-05 11:35:01 +00:00
Almeida
4359914d1a fix: open graph image in metadata (#11244)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-03 20:14:39 +00:00
ckohen
b026d0ee35 ci: fix pinning (#11243) 2025-11-03 06:37:21 +00:00
ckohen
3bb13f96b4 ci(dev): pin associated dev versions (#11238) 2025-11-02 05:38:17 +00:00
Naiyar
06a75e80bc docs: clarify wording for maximum values (#11231)
* docs(FileUpload): clarify wording

* chore: missed instances

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-11-01 14:33:34 +00:00
Danial Raza
f26a5ed869 fix: only pass relevant options to API when fetching (#11228)
* fix: only pass relevant options to API when fetching

* chore: requested changes

* fix: missed instance
2025-10-31 20:48:51 +00:00
Almeida
d06d8c0806 chore: update readme package list (#11218)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-31 11:23:16 +00:00
ckohen
d8b913449e ci: refactor turbo team to use var (#11219)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-31 11:21:42 +00:00
Almeida
fb5c629638 chore: bump dependencies (#11225) 2025-10-31 11:15:45 +00:00
TÆMBØØ
178c9cb348 fix(GuildMember): joinedAt possibly being NaN (#11224) 2025-10-30 20:59:02 +00:00
Danial Raza
94a9b4d03c fix(Message): update pinnable to use PinMessages (#11202)
* fix(Message): update `pinnable` to use `PinMessages`

* refactor: use bitwise OR

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* fix: check if in voice based channel for pinnable

* Update packages/discord.js/src/structures/Message.js

* Update packages/discord.js/src/structures/Message.js

Co-authored-by: Almeida <github@almeidx.dev>

* Update packages/discord.js/src/structures/Message.js

Co-authored-by: Almeida <github@almeidx.dev>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Almeida <github@almeidx.dev>
2025-10-28 14:54:22 +00:00
Almeida
4c0d667773 fix: retry google fonts fetch on fail (#11217)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-26 22:15:12 +00:00
Almeida
4f9475d937 chore: fix executable file permissions (#11216)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-26 21:48:40 +00:00
Jiralite
868be4eafc feat: Annotate result of releasing packages (#11200)
* feat: annotate result

* feat: note dry runs

* refactor: summaries
2025-10-26 21:40:49 +00:00
Copilot
ed143a6cda fix(GuildMemberFlagsBitField): Remove duplicate "guild" word (#11212)
* Initial plan

* Fix duplicate 'guild' word in GuildMemberFlagsBitField documentation

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-10-26 10:46:16 +00:00
Jiralite
56662ebad7 types(FileUploadModalData): Correct fields (#11210)
* types(FileUploadModalData): update fields

* docs: update more fields
2025-10-25 22:57:00 +00:00
Jiralite
8066821faa types(LabelModalData): Singular ModalData (#11207)
types(LabelModalData): no array
2025-10-25 19:12:17 +00:00
Jiralite
3048c3c0aa types(FileUploadComponentData): required should be a boolean (#11205)
types(FileUploadComponentData): `boolean`
2025-10-25 16:19:50 +00:00
Jiralite
2a5d99f0a0 ci(documentation): Ignore tag pushes for create-discord-bot (#11201)
ci(documentation): ignore create*
2025-10-25 02:42:22 +02:00
Jiralite
633d4813ef fix: Remove outdated documentation logic (#11203)
fix: remove unused stuff
2025-10-25 02:32:01 +02:00
Noel
08b87d9087 refactor(website,guide): cloudflare workers support (#11204) 2025-10-25 02:17:59 +02:00
Jiralite
756eac6bb1 fix: Use D1 for indices (#11199)
* fix: use D1 for indices

* fix: use D1 for indices

* build: remove unused packages

* fix: pass variables

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-24 20:08:49 +00:00
ckohen
ee3be2c3c3 refactor(ApplicationCommand)!: make options nullable (#11167)
BREAKING CHANGE: ApplicationCommand#options is now nullable

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-10-24 20:32:41 +01:00
Jiralite
c05f653f0a chore: Release create-discord-app/bot (#11198)
* build: bump versions

* build: specify `monoRepo`

Specifying that this is a monorepo seems to fix changelog generation and the conventional bumping.

* chore(create-discord-bot): release create-discord-bot@4.1.0
2025-10-24 19:06:45 +01:00
Vlad Frangu
0c1ff5ea29 types(core): use result types instead of direct types (#11140)
* types(core): use result types instead of direct types

fix: import pains

chore: apply suggestion from review

Co-authored-by: Almeida <github@almeidx.dev>

chore: fmt script

chore: requested change

* chore: rename script, fix build

* chore: types

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-24 15:36:54 +00:00
Jiralite
a990eefa31 fix: 404 for an unknown package's landing page (#11193)
* fix(page): 404 if no package

* fix: we go hard

Co-authored-by: Denis-Adrian Cristea <didinele.dev@gmail.com>

* fix: pain

Co-authored-by: Denis-Adrian Cristea <didinele.dev@gmail.com>

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Denis-Adrian Cristea <didinele.dev@gmail.com>
2025-10-24 15:06:14 +00:00
ckohen
63417e8b6c refactor(makeCache)!: make params an object (#11172)
BREAKING CHANGE: `Options.makeCache` now sends all of its parameters in an object rather than 3 individual parameters

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-10-24 15:55:29 +01:00
Naiyar
c9a9b6ce9d feat: file upload component (#11114)
* feat: file upload component

* docs: correct min values

* chore: rebase

* chore: resolve attachments

* chore: typings

* chore: whyyyyyyyyy

* types: `Snowflake`

* types: `Snowflake`

* docs: `Snowflake`

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-10-24 11:09:33 +00:00
Jiralite
83ec0fdcdf refactor: Use idPredicate for file uploads (#11195)
refactor: use `idPredicate`
2025-10-24 10:45:37 +00:00
Jiralite
c84024968e feat: File upload support (#11108)
* build: bump discord-api-types

* feat: add support

* docs: correct examples

* fix(MappedComponentTypes): fix description

Co-authored-by: advaith <advaithj1@gmail.com>

* fix: use `z.int()`

* chore: remove errors

---------

Co-authored-by: advaith <advaithj1@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-24 10:16:05 +00:00
thelegendfox
63b5923deb fix: Singular misplaced comma (#11194)
docs: Fix misplaced comma
2025-10-24 09:54:33 +00:00
Qjuh
886d4a7fcb fix(website): don't error if unstable node missing (#11191)
fix: don't error if unstable node missing
2025-10-22 16:19:33 +00:00
Qjuh
697556fd16 feat(website): parse and show unstable tsdoc tag (#11187)
feat(website): parse and show unstable tsDoc tag
2025-10-22 11:53:56 +00:00
Naiyar
68835b3ff7 refactor(guide): redirect old urls to /legacy (#11170)
* refactor(guide): redirect old urls to /legacy

* chore: suggestion

Co-authored-by: Almeida <github@almeidx.dev>

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-10-20 13:13:36 +00:00
Jiralite
0cc92bd5b0 fix(textInput): Allow empty strings for a value (#11182)
fix: allow empty strings

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-16 13:55:15 +00:00
Souji
d03eb5e26e chore(guide): manually sort popular topics (#11174) 2025-10-16 09:21:07 +00:00
Jiralite
25b22c67aa fix(ModalSubmitInteraction): Resolve components correctly (#11168)
* fix: resolve components correctly

* fix: remove redundant parameter

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-14 22:01:10 +00:00
ckohen
0add790169 chore: remove old release ci (#11171)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-14 19:11:43 +00:00
Naiyar
1a305fe4ad build: bump discord-api-types to 0.38.30 (#11178)
* build: bump discord-api-types to 0.38.30

* chore: slap the errors
2025-10-14 18:02:10 +00:00
Souji
93e96eb6c0 feat(guide): add reason for missing access (#11173)
* feat(guide): add reason for missing access

* chore: grammar

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-14 12:04:52 +00:00
ckohen
7a3a21b26e ci(release): better final output (#11177)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-14 09:26:11 +00:00
Souji
a2d4f187ca chore(guide): consistent sidebar capitalization (#11175) 2025-10-14 00:16:26 +00:00
Denis-Adrian Cristea
f9ca29e3e4 chore: update readme badges (#11152)
* chore: update readme badges

* chore: add href

* chore: other readmes

* chore: reintroduce badge

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-13 12:54:08 +00:00
jNullj
180dd60c61 feat(voice): Add info about DAVE protocol dependencies and support (#11145)
* Add info about DAVE protocol dependencies and support

Changes remade from https://github.com/discordjs/guide/pull/1630 due to project moving from that repo to this one.

* remove explicit warning regarding optional dependency being optional

Co-authored-by: Almeida <github@almeidx.dev>

* style: format

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-10-11 12:58:28 +00:00
Almeida
dd795252d6 refactor!: remove special cases for bot guild owner (#11160)
BREAKING CHANGE: The `GuildOwned` error code and message has been removed.

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-10-11 11:57:20 +01:00
Denis-Adrian Cristea
847fa9938d fix(GuildChannel): manageable perm check (#11166) 2025-10-11 09:01:39 +00:00
Jiralite
a97ac82619 fix(guide): Miscellaneous fixes (#11147)
* fix: miscellaneous fixes

* docs: fix contributing link

* fix: link

* fix: you

* fix: main links

* fix: update source

* fix: update link

* fix: update update link

* fix: [

* fix: remove locale

* fix: update links

* fix: update GitHub link

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-09 12:41:15 +00:00
Almeida
7f29356950 fix: ending uncached polls (#11157) 2025-10-08 21:04:05 +00:00
Jiralite
230e746b31 ci(documentation): Skip unknown packages on old refs (#11154)
ci(documentation): handle old refs for unknown packages
2025-10-08 17:05:34 +00:00
Denis-Adrian Cristea
0c2975e3fd ci: implement workflow to publish dev versions (#11120)
* ci: implement workflow to publish dev versions

* ci: refactor into the other dev job

* fix: use dev tag

* chore: clarify

* fix: always use actions from main

* fix: conditionally

* chore: don't ask for meaningless perm
2025-10-08 11:08:39 +00:00
Denis-Adrian Cristea
fcf7f27fd7 ci(release): handling for create-discord-app (#11143)
* ci(release): handling for create-discord-app

* ci(deprecate): cda support

* ci: update our custom action to handle the renaming when invoked

* fix: don't double release on github

* chore: just in case

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-08 10:33:51 +00:00
Almeida
aac247cc18 feat: add {add,remove}GroupDMRecipient methods (#11135)
* feat: add `{add,delete}GroupDMRecipient methods`

* fix: requested changes

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-08 08:37:02 +00:00
Jiralite
a78dd012dc feat(guild): Support incident actions (#11131)
* feat(guild): add incident actions

* fix: add result

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-08 08:07:17 +00:00
Denis-Adrian Cristea
af923fee8e fix(WebSocketShard): bad error re-throw (#11151)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-07 09:59:40 +00:00
Jiralite
f1087c7e87 fix: Guide content path for CODEOWNERS (#11148)
fix: update guide path

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-07 09:55:46 +00:00
Almeida
7de5b4a349 refactor: remove guide route prefix (#11146)
* refactor: remove guide route prefix

* chore: implement backwards compat redirect

* Change guide redirect destination and permanence

Updated the redirect destination and permanence for the guide route.

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-07 09:50:53 +00:00
Jiralite
f109fc9b42 chore(guide): Update name of legacy path (#11149)
chore: update name of legacy path

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-07 09:49:30 +00:00
Pavel-Boyazov
b80dd8ce7f types(ClientEventTypes): fix messageDeleteBulk event arg (#11122)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-10-07 08:44:26 +00:00
Almeida
88778df0e5 ci: bump actions/setup-node to v5 (#11134)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-06 22:47:49 +00:00
Almeida
985b525556 chore: bump dependencies (#11133)
* chore: bump dependencies

* chore: another bump
2025-10-06 22:42:31 +00:00
Jiralite
2c08b0f975 feat(thread)!: Add query to getting a thread member (#11136)
BREAKING CHANGE: Third parameter of `ThreadsAPI#getMember()` is now `query`, pushing `options` to the fourth.

* feat(thread): add query to getting a thread member

* Apply suggestion from @almeidx

Co-authored-by: Almeida <github@almeidx.dev>

* Apply suggestion from @almeidx

Co-authored-by: Almeida <github@almeidx.dev>

---------

Co-authored-by: Almeida <github@almeidx.dev>
2025-10-06 10:35:31 +01:00
Almeida
fbdec3d828 feat!: add escapeQuote and escapeBlockQuote (#11129)
BREAKING CHANGE: `escapeMarkdown` now escapes quotes and block quotes by default.

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-10-06 10:30:36 +01:00
Pavel-Boyazov
cf88ef91fd types(Webhook): specify message type (#11142)
* types(Webhook): specify message type

* test(Webhook): update types
2025-10-05 20:42:15 +00:00
Almeida
dee79efbaf fix: sidebar tab icon (#11141) 2025-10-05 19:46:59 +02:00
Vlad Frangu
05224e78ec fix(builders): correct assertion for select menu string min/max values (#11139)
* fix(builders): correct assertion for select menu string min/max values

* fix: actually fix the logic

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-05 15:28:34 +00:00
Almeida
612c49b546 fix: adjust types for typescript upgrade (#11132)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-05 12:43:49 +00:00
Jiralite
ffbb7b6936 feat: Add gateway endpoints (#11130)
feat: add gateway

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-04 16:35:21 +00:00
Denis-Adrian Cristea
d251e065cd feat(RedisBroker): ability to explicitly tell the library to pick a random group (#11002)
feat(RedisBroker): randomly pick group via symbol
2025-10-04 14:20:27 +00:00
Denis-Adrian Cristea
cf89260c98 feat(RedisBroker): poll for unacked events (#11004)
Co-authored-by: Noel <buechler.noel@outlook.com>
2025-10-04 10:59:48 +02:00
Denis-Adrian Cristea
2c750a4e00 refactor!: make RedisBroker require consumer name (#11001)
* refactor(RedisBroker): require consumer name

* chore: spelling

Co-authored-by: Noel <buechler.noel@outlook.com>

---------

Co-authored-by: Noel <buechler.noel@outlook.com>
2025-10-04 10:51:43 +02:00
ckohen
6431cea24b ci(release): use main action always (#11125)
* ci(release): use main action always

* ci(release): use more descriptive names

* ci: review fixes

* ci(release): fixes from testing

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-10-04 08:50:30 +00:00
Naiyar
f510b5ffab docs(ModalComponentResolver): correct getTextInputValue return type (#11128) 2025-10-01 18:09:54 +00:00
Almeida
1c5674d9b2 fix(ThreadMemberFlagsBitField): use ThreadMemberFlags enum in Flags (#11118)
feat(ThreadMemberFlagsBitField): use `ThreadMemberFlags` enum in `Flags`
2025-09-27 15:36:51 +00:00
Almeida
5efde1162f docs: use LocalizationMap where applicable (#11117) 2025-09-27 14:48:06 +00:00
Jiralite
9201243f32 docs(APITypes): Add APISelectMenuDefaultValue (#11111)
docs: add `APISelectMenuDefaultValue`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-09-26 16:40:22 +00:00
Jiralite
0d76f1149f fix: Add idPredicate (#11109)
* fix: `idPredicate`

* fix: add test

* test: add negative test
2025-09-26 16:06:22 +00:00
Naiyar
b3705df547 fix: use in operator when resolving modal component (#11115) 2025-09-26 09:10:51 +00:00
Jiralite
2d740d5279 fix(GuildMember): Use editMe() conditionally for setNickname() helper (#11113)
fix(GuildMember): use `editMe()` conditionally

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-09-24 20:38:47 +00:00
Jiralite
beed098bf2 fix: Add type to some predicates (#11110)
fix: add `type`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-09-22 09:10:20 +00:00
Jiralite
7886d9b098 feat(GuildMemberManager)!: Add new modify self fields (#11089)
BREAKING CHANGE: `GuildMemberManager#edit()` no longer handles the /@me route for editing the current application's guild member. This has split out into `GuildMemberManager#editMe()`
2025-09-21 22:51:57 +01:00
Naiyar
5247afe983 feat!: text display and other select menus for modal (#11097)
BREAKING CHANGE: `ModalSubmitFields` is no longer exported
BREAKING CHANGE: `ModalSubmitInteraction#fields` is removed
BREAKING CHANGE: `ModalSubmitInteraction#components` is now `ModalOptionResolver`
BREAKING CHANGE: `DjsErrorCodes#ModalSubmitInteractionFieldNotFound` & `DjsErrorCodes#ModalSubmitInteractionFieldType` are now renamed to `DjsErrorCodes#ModalSubmitInteractionComponentNotFound` & `DjsErrorCodes#ModalSubmitInteractionComponentType` respectively

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-09-21 22:18:18 +01:00
Jiralite
b66f52f9aa feat!: More label components and text display in modal (#11078)
BREAKING CHANGE: Modals only have adding (no setting) and splicing has been replaced with a generalised splice method to support all components.
2025-09-14 09:09:56 +01:00
Almeida
126529f460 fix: overflow on package home (#11101) 2025-09-13 16:21:20 +00:00
Jiralite
90aac127fa fix(users): Correct type for editing current guild member (#11099)
* fix(user): use correct type

* fix: imports

* fix: imports

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-09-10 21:11:52 +00:00
Naiyar
4ec03ae517 feat!: label component and selects in modal (#11081)
BREAKING CHANGE: TextInputComponentData no longer accepts label
BREAKING CHANGE: ActionRow and ActionRowData no longer accept TextInput
BREAKING CHANGE: `ModalSubmitInteraction#transformComponent` is now private and no longer exposed publicly

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-09-10 21:34:57 +01:00
ckohen
f1bcff46b6 feat(rest): callbacks for timeout and retry backoff (#11067)
* feat(rest): callbacks for timeout and retry backoff

* test: add tests for callback utils

* test: fix typo

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

* fix(retryBackoff): efficient math

* docs: minor tweaks

* docs: captalisation

---------

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-09-10 09:23:28 +00:00
Jiralite
5d5a6945e4 build: Update discord-api-types to 0.38.23 (#11095)
build: update
2025-09-10 08:30:00 +00:00
Almeida
352c9819b6 feat: send voice messages (#10462)
* feat: send voice messages

* fix: title reference

Co-authored-by: ckohen <chaikohen@gmail.com>

* docs: clarify voice message attachment properties in documentation

---------

Co-authored-by: ckohen <chaikohen@gmail.com>
2025-09-06 11:12:24 +00:00
Jiralite
f7c77a73de feat(builders)!: Support select in modals (#11034)
BREAKING CHANGE: Text inputs no longer accept a label.
BREAKING CHANGE: Modals now only set labels instead of action rows.
2025-09-05 17:56:14 +01:00
VAKiliner
ddf9f818e8 fix: Ensure discriminator detection respects webhooks too (#11062)
* Replace discriminator === '0' to Number(discriminator)

* Fix

* Replacing !Number() to ['0', '0000'].includes

* chore: fmt

* perf: no array

---------

Co-authored-by: almeidx <github@almeidx.dev>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-09-05 07:39:35 +00:00
Almeida
8ca279e0c3 refactor: update deno template and loader logic (#11060)
* refactor: update deno template and loader logic

* yeet

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-09-04 12:36:26 +00:00
Almeida
5a656b849f refactor(PollAnswer)!: remove fetchVoters (#11059)
BREAKING CHANGE: The `PollAnswer#fetchVoters` method has been removed. Use `PollAnswer#voters#fetch` instead.

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-09-02 17:51:24 +01:00
Jiralite
bb67f3c154 feat: Guest invites (#11055)
* feat: guest invites

* types: add types

* docs: add `InviteFlags`

* docs: grammar

Co-authored-by: Sören Stabenow <71461991+thehairy@users.noreply.github.com>

---------

Co-authored-by: Sören Stabenow <71461991+thehairy@users.noreply.github.com>
2025-09-01 22:14:24 +00:00
Almeida
90813b33aa build: use the same timestamp for release versions (#11069) 2025-08-31 20:43:22 +00:00
Almeida
cc43dadcae chore: bump dependencies (#11051)
* chore: bump dependencies

* build: bump discord-api-types to 0.38.22

* fix: fix builders

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-08-29 12:01:54 +00:00
Jiralite
cde757b7cb ci(pr-triage): Make validate title run always (#11056)
ci(pr-triage): fix bad name merge

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-08-29 11:57:22 +00:00
ckohen
368edeaaff fix(rest): emit warning on HTTP 401 with non-zero code (#11066)
* fix(rest): emit warning on HTTP 401 with non-zero code

* fix: typos

Co-authored-by: Almeida <github@almeidx.dev>

* fix: explicit globalThis

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-08-29 10:33:17 +00:00
Jiralite
d548a5911e fix(Guild)!: Remove setting owner (#11068)
BREAKING CHANGE: Setting the owner of a guild is removed.
2025-08-29 11:12:14 +01:00
Almeida
50018979ed feat: add email and phoneNumber formatters (#11050)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-08-26 21:26:05 +00:00
Souji
55ab46dbc3 fix(GuildChannel): account for everyone base permissions (#11053)
When calculating permissions after overwrites, the base permission of the at-everyone role need to be accounted for.
Role#permissions is not sufficient, as it only describes base permissions of the role itself.

fixes #11052
2025-08-22 11:03:33 +00:00
Vlad Frangu
4b6060dcd8 feat: bump discord.js in create-discord-bot/app (#11048)
* feat: bump discord.js in create-discord-bot/app

* chore: forgot core
2025-08-21 06:58:35 +00:00
J4C0B3Y
b1d96e251f refactor(ActionsManager): register actions without using class name (#11047) 2025-08-19 08:51:52 +00:00
ckohen
7710decf6a ci(release): use full commit hash (#11046) 2025-08-18 07:57:24 +00:00
ckohen
29173f12f3 chore(voice): release @discordjs/voice@0.19.0 (#11045) 2025-08-17 22:33:16 +00:00
Almeida
e68829770f build: fix package name argument parsing (#11044) 2025-08-17 22:12:19 +00:00
Jiralite
059d274aff chore: Fix typos (#11043)
chore: fix typos
2025-08-17 19:45:38 +00:00
Jiralite
fdc305dd6a ci: Use actions/checkout@v5 (#11040)
ci: actions/checkout@v5

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-08-16 21:09:51 +00:00
Jiralite
1014af382b chore: Add more partials to issue form (#11018)
chore: add more partials

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-08-16 21:08:21 +00:00
ckohen
ac290aea95 ci(release): use app user (#11038)
* ci(release): set git user

* ci(release): refactor to use app

* ci(release): use only app token

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-08-16 21:05:36 +00:00
Jiralite
9be62b35c9 chore: Update deno.unstable to an array (#11032)
chore: update `deno.unstable`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-08-12 07:10:46 +00:00
Jiralite
bdcb3e1df7 build: Upgrade pnpm-lock.yaml (#11036)
* build: upgrade pnpm-lock.yaml

* style: format
2025-08-09 21:45:57 +00:00
Jiralite
698b92c2ad fix(guild)!: Remove API related to guild ownership (#11029)
* fix(guild): deprecate guild owner API

* style: prettier
2025-08-06 21:36:09 +03:00
Jiralite
a2ee3932b6 fix(guild): Creating a template actually creates a template (#11030)
feat(guild): add creating a template
2025-08-04 18:46:26 +00:00
Jiralite
8f5ac55d82 fix!: Remove API related to guild ownership (#11021)
BREAKING CHANGE: API related to guild ownership has been removed, such as setting the MFA level, deleting a guild, creating a guild, and creating a guild from a guild template.
2025-07-31 19:24:17 +01:00
Almeida
c3dc58169b fix: attachment sending (#11015)
* fix: attachment sending

* test: add tests

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-07-30 10:53:44 +00:00
ckohen
593369dbb8 ci(release): fix dev releases (#11016) 2025-07-28 01:59:22 +02:00
Jiralite
c0c1ac2879 ci(release): Miscellaneous fixes (#11014)
* ci: some fixes

* ci: typo in property

* fix: yaml-schema errors

* ci: oven-sh/setup-bun@v2

* ci: typo in dev release

---------

Co-authored-by: ckohen <chaikohen@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-07-27 10:53:48 +00:00
Almeida
08a61ca8e3 refactor(WebSocketManager)!: remove deprecated rest option (#10998)
BREAKING CHANGE: The `rest` option in the `WebSocketManager` constructor has been removed. Pass a `fetchGatewayInformation` function instead.
2025-07-27 11:49:29 +01:00
Jiralite
2e9bfba5f4 fix!: Remove guild creation (#11012)
BREAKING CHANGE: Guild creation is no longer possible.
2025-07-26 12:25:36 +01:00
ckohen
6cdfa3864b ci: better release workflow (#10325)
* ci: better release workflow

* ci: simplify + use changelog

* ci(release): better parsing and exclusions

* ci(release): remove tree log

* ci(release): improve logs

* ci(release): properly check inputs

* ci(release): better promise handling

Co-authored-by: Aura <kyradiscord@gmail.com>

* ci: refactor release to use bun

* ci(release): whitespace

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>

* ci(release): add dev release handling

* ci(release): fixes from testing

* ci(release): make the promise run

* ci(release): when specifying package, skip exclusions

* ci(dev): create-discord-bot dev release

* ci(release): improve changelog detection

* ci: fix typo and allow releasing branches

* ci(release): set make_latest for gh releases

* ci(release): add ssh_key so pushed tags run workflow

---------

Co-authored-by: Aura <kyradiscord@gmail.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-07-25 11:56:02 +02:00
Jiralite
f2fec9177f feat: Enforce limit of URLs for link buttons (#11011)
feat: enforce limit of URLs for link buttons
2025-07-23 14:20:56 +00:00
Jiralite
90b3692941 docs: Add structures to main README.md (#11008)
docs: Add structures to main

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-07-22 10:53:44 +00:00
Jiralite
3a060f7494 docs: Replace Discord API with Discord Developers (#10968)
docs: replace with Discord Developers
2025-07-22 10:33:42 +00:00
Jiralite
a7f711b30f fix: Remove trailing color references (#11007)
fix: role colour fixes
2025-07-20 12:26:24 +00:00
Jiralite
43a995bef0 refactor!: Invite classes (#10888)
BREAKING CHANGE: Invites are now split up into classes based on their type.
2025-07-17 13:34:25 +01:00
Jiralite
aee6d311c0 fix(Container): Use the same discord-api-types version (#10999)
fix(Container): use v10
2025-07-17 07:38:16 +00:00
Jiralite
1dfc511e4f fix(contextMenu): Remove regular expression validation (#10994)
* fix: remove regex validation

* test: remove incorrect test

This is fine to create.

* fix: guard against whitespace
2025-07-16 15:47:29 +00:00
Danial Raza
9ff04820b3 feat: support user guilds (#10962)
* feat: support user guilds

* chore: add cdn test

* chore: suggested changes

* refactor: move to user primary guild to its own class

* docs: update description of `badgeHash` parameter

* chore: export UserPrimaryGuild

* refactor: revert to no `UserPrimaryGuild`

* fix: use key in data

* fix: both `in` and is truthy check

* docs: remove `-`

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-07-16 07:26:00 +00:00
Jiralite
d03cacbde4 feat(MessageManager)!: New pinned messages routes (#10989)
BREAKING CHANGE: `fetchPinned()` has been renamed to `fetchPins()`, which is a paginated endpoint to fetch pinned messages.
2025-07-15 16:13:24 +01:00
Danial Raza
5a611be8de feat(User): add collectibles (#10939)
* feat(User): add `collectibles`

* docs: nullable collectibles and nameplate data

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-07-14 23:35:00 +00:00
Jiralite
1105ec9abc feat(channel)!: New pinned messages routes (#10988)
* feat(channel): new pinned messages routes

* fix: `query` is optional

Co-authored-by: Almeida <github@almeidx.dev>

---------

Co-authored-by: Almeida <github@almeidx.dev>
2025-07-14 22:11:04 +01:00
Jiralite
7e3d4e536c refactor(ThreadChannel): Remove trimming of name (#10984)
refactor(ThreadChannel): no need to trim name

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-07-13 20:00:12 +00:00
Jiralite
8a36c42942 fix(DirectoryChannel): Export class (#10985)
fix: export directory channels
2025-07-13 19:57:40 +00:00
Almeida
de2b2dd330 chore: bump dependencies (#10967) 2025-07-13 19:39:47 +00:00
Snazzah
8bdea6232b feat: implement DAVE end-to-end encryption (#10921)
* feat(voice): implement DAVE E2EE encryption

* chore(voice): update dependencies

* chore(voice): update debug logs and dependency report

* feat(voice): emit and propogate DAVESession errors

* chore(voice): export dave session things

* chore(voice): move expiry numbers to consts

* feat(voice): keep track of and pass connected client IDs

* fix(voice): dont set initial transitions as pending

* feat(voice): dave encryption

* chore(voice): directly reference package name in import

* feat(voice): dave decryption

* chore(deps): update @snazzah/davey

* fix(voice): handle decryption failure tolerance

* fix(voice): move and update decryption failure logic to DAVESession

* feat(voice): propogate voice privacy code

* fix(voice): actually send a transition ready when ready

* feat(voice): propogate transitions and verification code function

* feat(voice): add dave options

* chore: resolve format change requests

* chore: emit debug messages on bad transitions

* chore: downgrade commit/welcome errors as debug messages

* chore: resolve formatting change requests

* chore: update davey dependency

* chore: add types for underlying dave session

* fix: fix rebase

* chore: change "ID" to "id" in typedocs

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-07-13 17:02:56 +00:00
Qjuh
3cff4d7412 feat: @discordjs/structures (#10900)
* chore: init /structures

* feat: base structure

* feat: initial structures design attempt

* refactor(Structure): use unknown to store in kData

* feat(Structure): add Invite

refactor(Structure): patch to _patch

* refactor: symbol names and override location

* fix: don't possibly return 0 if discord borks

Co-authored-by: Synbulat Biishev <signin@syjalo.dev>

* refactor: use getter value instead of api

Co-authored-by: Synbulat Biishev <signin@syjalo.dev>

* refactor: cache createdTimestamp value

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

* docs: better docs for what's done so far

* feat: add Mixin

* refactor(User): remove bitfield getters and add displayName

* feat(structures): add Connection

* feat(structures): add Channel base

* refactor(Mixin): trace prototype chain, allow construction

* fix(structures): fix mixin behavior

* fix(structures): data optimization call behavior from perf testing

* feat: channel mixins

* chore: update deps

* feat: channels and mixins

* chore: more typeguard tests

* fix: tests and some other issues

* feat: add ChannelWebhookMixin

* fix: more tests

* chore: tests and docs

* chore: docs

* fix: remove unneccessary omitted

* chore: apply code suggestions

* refactor: change how extended invite works

* fix: type imports

* Apply suggestions from code review

Co-authored-by: Almeida <github@almeidx.dev>

* fix: tests

* chore: add jsdoc

* refactor: apply code suggestions

* fix: don't instantiate sub-structures

* fix: don't do null default twice

* chore: use formatters, add _cache

* chore: lockfile

* chore: move MixinTypes to declaratiion file

* fix: tests

* fix: don't include source d.ts files for docs

* feat: bitfields

* feat: more bitfields

* refactor: remove DirectoryChannel structure

* chore: apply suggestions from code review

* chore: remove unused import

* refactor: use symbol for mixin toJSON, remove _ prefix

* chore: apply suggestions from code review

* refactor: remove bitfield casts

* refactor: remove special case for threadchannel types

* fix: apply code review suggestions

* refactor: bitfields always store bigint

* fix: tests

* chore: apply suggestions from code review

* fix: lint

* refactor: conditional structuredClone

* Apply suggestions from code review

Co-authored-by: ckohen <chaikohen@gmail.com>

* fix: code review errors

* fix: lint

* chore: bump dtypes

* Update packages/structures/cliff.toml

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* docs: link to VideoQualityMode

* chore: typo in comment

* chore: small nits in docs links

* chore: small nits

* docs: forgot one

* chore: update template

* chore: typos and things

* chore: apply suggestions from code review

* fix: tests and typeguards

* chore: don't clone appliedTags

* refactor: use a symbol for patch method

* fix: add missing readonly

* chore: remove todo comment

* refactor: use symbol for clone

* fix: add constraint to DataType

* chore: apply suggestions

* fix: dtypes bump

* chore: fix comment

* chore: add todo comment

* chore: mark bitfield as todo
chore: mark bit field as todo and edit readme

---------

Co-authored-by: ckohen <chaikohen@gmail.com>
Co-authored-by: Synbulat Biishev <signin@syjalo.dev>
Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-07-12 18:24:30 +00:00
Souji
591668099e feat(guide): port remaining prs/issues from legacy (#10974)
* chore: remove await wait placeholder

prefer using an explanatory placeholder rather than this artificial
example
original issue: https://github.com/discordjs/guide/issues/1360

* chore: remove implicit grant guide and add disclaimer

issue: https://github.com/discordjs/guide/issues/1370/
pr: https://github.com/discordjs/guide/pull/1543/

* chore(sharding): improve broadcast sample and use of context argument

original PR: https://github.com/discordjs/guide/pull/1624

* feat: add page about setup with proxy

original PR: https://github.com/discordjs/guide/pull/1623

* chore: clarify hiding of commands

original PR: https://github.com/discordjs/guide/pull/1617

* feat(voice): seeking

original PR: https://github.com/discordjs/guide/pull/1483

* chore(oauth2): typo

* chore: align with rest of the guide

remove abstraction layers in ws proxy handling in favour of directly setting globals

* chore: branding over grammar

* Apply suggestions from code review

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

* chore: remove now obsolete example explanation from comments

---------

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
2025-07-12 00:13:54 +00:00
Jiralite
1f0fe39156 refactor(CDN)!: Use an object for the constructor (#10978)
BREAKING CHANGE: The CDN class requires an object to construct.
2025-07-11 15:44:25 +01:00
Jiralite
35cc57ab92 fix: Adjust reason in methods options (#10976)
* fix(channel): allow reason in editing

* fix(channel): allow reason in `delete()`

* fix(channel): allow reason in creating threads

* chore: run format

* fix(guild): remove incorrect `reason` option

---------

Co-authored-by: Danial Raza <danialrazafb@gmail.com>
2025-07-10 23:16:07 +00:00
Danial Raza
7242352884 feat!: role gradient colors (#10961)
* feat: role gradient colors

* refactor: `options.colors && { ... }`

* refactor(Role)!: remove `color`

* feat: `RoleColorsResolvable`

* feat(Constants): add `HolographicStyle`
2025-07-10 23:46:25 +02:00
Souji
bc6005f446 feat(guide): port legacy guide (#10938)
* feat: initial attempt at porting legacy guide

* feat: completion of legacy guide backport

* chore: lockfile shenanigans

* fix: handle svgs

* fix: replace svg with mermaid integration

* chore: format

* chore: remove unnecssary bullet

* chore: cleanup code highlights

* chore: explicit return

* chore: move display components after interactive components in sidebar

* chore: voice

* top link should be installation
* add docs link to sidebar

* feat: subguide-based accent styles

* chore: don't list faq twice

* chore: mention display components in interactive components

* fix: remove unoccs/order rule from guide

* chore: redirect to legacy guide instead of /guide root

* refactor: use `<kbd>`

* refactor: more kbd use

* Update apps/guide/content/docs/legacy/app-creation/handling-events.mdx

Co-authored-by: Naiyar <137700126+imnaiyar@users.noreply.github.com>

* chore: fix typos

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

* chore: fix typos

* chore: fix links regarding secret stores across coding platforms

* chore: fix typo

* chore: link node method directly

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

* chore: typos

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>

* chore: typo

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>

* fix: prevent v14 changes from being listed twice

* chore: prefer relative links

* chore: missed link conversion

* chore: missed link conversion

* chore: fix link

* chore: remove legacy code highlight markers

* chore: rephrase and extend contributing guidelines

* feat(setup): suggest cli flag over dotenv package

* chore: move introduction in sidebar

better navigation experience if the 'next page' in intro refers to getting started vs. updating/faq

* fix: replace outdated link

* fix: update voice dependencies

* chore: update node install instructions

* fix: list in missing access callout

* chore: match bun env file format

* chore: restore ffmpeg disclaimer

* fix: lockfile conflict

* chore: action row typo

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>

* chore: no longer use at-next for pino

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
Co-authored-by: Naiyar <137700126+imnaiyar@users.noreply.github.com>
Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
2025-07-08 13:01:50 +00:00
Superchupu
ee3ca6f7c6 refactor(create-discord-bot): replace deps with built-in apis (#10971) 2025-07-08 07:14:19 +00:00
Danial Raza
024ae5c566 build: bump discord-api-types to 0.38.15 (#10966) 2025-07-05 16:33:10 +00:00
Qjuh
42fbca83c8 types: reverse interface inheritance to omit Omit (#10923) 2025-07-04 15:24:01 +00:00
René
e6d59eaf9a types(ReadonlyCollection): derivation logic (#10964)
types(collection): ReadonlyCollection derivation logic

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-07-03 08:06:35 +00:00
Almeida
a5bd4cfe73 feat!: use zod v4 (#10922)
* feat: zod 4

* feat: zod v3, but v4

feat: validation error class

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

* chore: bump

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
2025-07-03 01:02:45 +01:00
LJ
4dbeed933b chore(WebSocketShard): improve zlib-sync errors (#10808)
* chore(WebSocketShard): improve zlib-sync errors

* chore(WebSocketShard): move zlib-sync error numbers to constants file

* chore(WebSocketShard): move enum, zlib-sync is lazily loaded

---------

Co-authored-by: Almeida <github@almeidx.dev>
2025-07-02 23:18:11 +00:00
Danial Raza
02fbb706aa build: bump discord-api-types to 0.38.14 (#10960) 2025-07-01 04:44:33 +00:00
Jiralite
536a546514 fix(containerPredicate): Remove maximum limit (#10959)
fix: remove maximum limit
2025-06-30 14:24:41 +00:00
Vlad Frangu
d53b203174 chore: update tests badge across repository (#10948)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-06-25 23:36:47 +00:00
Jiralite
d7e63ce291 fix(ClientUser): Remove token assignment (#10953)
fix(ClientUser): remove token assignment
2025-06-25 15:15:17 +00:00
Qjuh
43160a6ad7 fix(api-extractor): remove console debug statement (#10952)
fix(api-extractor): remove  console debug statement
2025-06-24 18:10:11 +00:00
Souji
615faf5f6f chore(readme): clarify the use of ES modules in readme examples (#10934)
* chore(readme): clarify the use of ES modules in readme examples

resolves #10932

* fix: revert api extractor readme changes
2025-06-23 19:27:55 +00:00
Vlad Frangu
cd76c9a47b chore: fix create-discord-bot -> create-discord-app formatting (#10951)
* chore: fix create-discord-bot -> create-discord-app formatting

* chore: readme for bun

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-06-22 22:37:55 +00:00
Almeida
9680f42ba3 feat(ClientApplication): add approximateUserAuthorizationCount (#10933)
Co-authored-by: Danial Raza <danialrazafb@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-06-22 22:31:56 +00:00
Danial Raza
01c2fbea6e feat(GuildMember): add avatarDecorationData (#10942)
* feat(GuildMember): add `avatarDecorationData`

* feat: add `displayAvatarDecoration()`

* docs: missing `@returns`

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-06-22 22:21:36 +00:00
Vlad Frangu
8e374aa8e3 chore(create-discord-bot): release create-discord-bot@4.0.0 (#10947)
* chore(create-discord-bot): release create-discord-bot@4.0.0

* chore(ci): handle identical deploy to create-discord-app

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-06-22 21:39:09 +00:00
Jiralite
cbb20566c5 feat(webhook): Support with_components (#10945)
feat: support `with_components`
2025-06-22 09:42:01 +00:00
Vlad Frangu
127bb59638 chore: bump discord.js across create-discord-x templates (#10935) 2025-06-18 09:46:34 +00:00
Crytek1012
2852a529cf docs: update param wording for consistency (#10930) 2025-06-12 10:33:01 +00:00
Danial Raza
4e0beff17b types(ClientEventTypes): add missing guildSoundboardSoundsUpdate (#10928) 2025-06-08 15:01:47 +00:00
Almeida
8e03af6eaf feat: update @types/node to v22 (#10926) 2025-06-07 13:21:57 +00:00
Qjuh
9708717204 fix(api-extractor): links including entrypoints (#10924) 2025-06-07 13:17:29 +02:00
Almeida
db8c1d3edb fix: background on pages with little content (#10925) 2025-06-07 13:16:58 +02:00
Snazzah
d40ceedad4 feat(voice): use voice gateway v8 (#10918)
* feat(voice): use voice gateway v8

* docs: small typo

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-06-02 17:38:50 +00:00
Almeida
e094faf225 docs: add missing, fix existing (#10842)
* docs: add missing, fix existing

* refactor: new stuff

* fix: requested changes

* fix: use `@link` for `@mixes`

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

* chore: disable bad eslint rule

---------

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-06-02 17:35:43 +00:00
Qjuh
8d50e92516 chore: ignore eslint-config-neon change commit in blame (#10919) 2025-06-02 19:32:07 +02:00
Qjuh
727c7e225f docs: don't generate all sub-package docs for /next (#10916) 2025-06-02 19:24:32 +02:00
Qjuh
b03c65c34c refactor: using eslint-config-neon on mainlib (#10876)
* refactor: using eslint-config-neon on mainlib

* fix: lint

* fix: lint

* fix: the way we lint

* chore: lint some more

* fix: more lint changes

* fix: type tests

* chore: port eslint rule

* refactor: lintstaged doesn't need this

* fix: eslint was a bit too eager

* fix: forgot Client

* Apply suggestions from code review

Co-authored-by: Almeida <github@almeidx.dev>

* chore: more lint fixes

* fix: remove useless Boolean()

* fix: get docs back

* fix: snowflake docs

* refactor: don't use typescript lint rules

* fix: code review

* fix: tidy up disabled rules

* chore: code review

* chore: code review

* chore: code review

* fix: consistent spacing in typings

* fix: tests

* fix: unsort ErrorCodes

* chore: get comments back

* Update packages/discord.js/src/client/websocket/handlers/THREAD_LIST_SYNC.js

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* fix: remove unused parameter

* fix: merge messed up types

* fix: more type mess from merge

* fix: generate script for ActionsManager

* fix: code review

* Update packages/discord.js/src/structures/MessageMentions.js

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* Update packages/discord.js/src/structures/Presence.js

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* fix: replace is faster, unicorn is wrong

* fix: consistency

* fix: delete obsolete file

* fix: minor nit in test file

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-06-02 17:23:40 +00:00
Amgelo563
ef2c1bfa77 fix(Emoji): remove incorrect nullables, add ApplicationEmoji#available (#10913)
* types: remove unintended nullables from app and base guild emojis

* feat: add ApplicationEmoji#available

* types(BaseGuildEmoji): fix incorrect JSDoc type for BaseGuildEmoji#name

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

* types(Emoji): switch from # to . for property deprecation links

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

* fix: remove default nulls in app emoji constructor on non-nullables

* types(Emoji): replace raw data type pre 78d512c

* types(Emoji): switch to ImageURLOptions for imageURL()

Re-applies changes from #10613

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

* types(Emoji): remove deprecated `url` props types and descriptions

Added by mistake in PR that used to target v14

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* refactor(Emoji): wording and formatting changes to prop descriptions

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* refactor(Emoji): missed wording and formatting change to prop descriptions

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* fix(Emoji)!: remove non present Emoji#url from typings

* fix(Emoji): re-apply emoji url types from 2c35084

---------

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-05-30 19:06:06 +00:00
iCrawl
762bbc6525 refactor(website): switch to dynamic only 2025-05-30 02:29:15 +02:00
Jiralite
2c35084ecd feat!: Support animated WebP (#10911)
* feat: support animated WebP

* refactor: change the rest

* fix: remove redundant code
2025-05-27 10:18:30 +01:00
Almeida
78d512c347 docs: export all visible symbols (#10760)
* docs: export all visible symbols

* fix: discord.js except raw

* refactor: remove raw data types

* docs: add back discord.js tsdoc file

* refactor: remove underscores

* fix: merge

* docs(RPCRedis): make `promises` as internal

---------

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-05-26 17:41:08 +00:00
Jack
c1f5bb2fba fix(InteractionResponses): Optional parameter for update() (#10797)
* fix: 🔧 don't error out if no options are provided

This commit stops calls to `options.withResponse`, etc erroring out when `interaction.update();` is called alone with no params.

* tweak: ⚙️ make options optional on typedef

* fix: 🔧 update index.d.ts

Update types to allow options to be optional

* types: add tests

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-05-25 12:01:35 +00:00
Qjuh
8605fc81fa fix(api-extractor): include entrypoint in links (#10902)
* fix(api-extractor): include entrypoint in links

* chore: prettier
2025-05-18 20:36:17 +02:00
iCrawl
33d8619a4e feat(website): include loading indicators when data is fetching 2025-05-16 00:19:17 +02:00
iCrawl
576443c29a fix(website): don't crash if no version was found 2025-05-15 22:05:38 +02:00
iCrawl
c92a8c27a2 fix: sidebar behaviour when switching package/version 2025-05-15 17:11:47 +02:00
Qjuh
14e226b72b fix(website): remove several obsolete special handling of dtypes (#10898)
* fix(website): remove several obsolete special handling of dtypes

* fix: reduce hardcoded places

* chore: api-extractor.json setting mainEntryPointName
2025-05-13 20:40:41 +02:00
iCrawl
aa533efe26 feat: discord-api-types on docs 2025-05-13 01:33:48 +02:00
Qjuh
b3db92edfb feat(api-extractor): support multiple entrypoints (#10829)
* feat(api-extractor): support multiple entrypoints

* chore: initial support in generateSplitDocumentation

* chore: bring in line with upstream

* refactor: multiple entrypoints in scripts

* fix: split docs

* feat: website

* fix: docs failing on next

* fix: don't include dtypes for now

* refactor: don't fetch entrypoint if there is none

---------

Co-authored-by: iCrawl <buechler.noel@outlook.com>
2025-05-12 23:48:41 +02:00
Qjuh
4f5e5c7c14 feat: components v2 (#10847)
* feat: components v2

* fix: tests

* fix: merge

* fix: lint

* Update packages/discord.js/src/util/Components.js

* fix: forward-port fixes from v14

* fix: getter

* fix: missing UnfurledMediaItem#toJSON()

* fix: find interactive component in container

* docs(APIMediaGalleryItem): Correct tag

* fix: forward port

* Apply suggestions from code review

Co-authored-by: Danial Raza <danialrazafb@gmail.com>

---------

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Danial Raza <danialrazafb@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-05-11 20:46:09 +00:00
Danial Raza
2c21de68f3 refactor: remove registerEvents function (#10877)
* refactor: remove `registerEvents` function

* refactor: use try-catch

* fix: missing `await`
2025-05-11 12:21:13 +00:00
Jiralite
4f6fedfb1f fix(ChannelManager): Remove threads from cache upon deletion (#10883)
* fix(ChannelManager): remove threads from cache upon deletion

* refactor: loop over thread ids

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-05-09 11:06:35 +00:00
Danial Raza
c4cd6ea637 feat: soundboard forward port (#10859)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-05-09 07:43:40 +00:00
Qjuh
f6da9495ed fix(website): link to enum members in search index (#10875)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-05-07 21:26:43 +00:00
Almeida
f686c83b18 fix: codeblock background and other mobile issues (#10892)
* fix: codeblock background

* fix: horizontal scroll on properties

* fix: badge text wrapping

* fix: wrap overload tab list
2025-05-07 23:17:09 +02:00
Jiralite
436784f945 perf(Components): Hash table (#10890)
refactor(Components): hash table

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-05-07 21:14:58 +00:00
Jiralite
320e3a6246 fix(PartialGroupDMChannel): Prevent undefined values (#10889)
fix(PartialGroupDMChannel): prevent `undefined` values

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-05-07 16:45:47 +00:00
Almeida
026440c256 build: exclude type tests from pack (#10886)
* build: exclude type tests from pack

* fix: requested changes

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-05-07 16:32:11 +00:00
Jiralite
432cdbe88a refactor(Client): Remove with_expiration query parameter (#10800)
refactor(Client): remove `with_expiration`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-05-06 14:24:12 +00:00
brynpttrsn
c48cc74c4b fix: syntaxhighlighter fill scrollbar width (#10887)
Co-authored-by: Bryan P. <bryanp.@iMac.lan>
2025-05-06 10:48:05 +02:00
Qjuh
6efdf3b901 fix(website): link to external constructors (#10869)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-05-05 07:15:53 +00:00
Danial Raza
4acb71496f chore: update create-discord-bot dependencies (#10878)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-05-05 07:00:35 +00:00
Almeida
4646a74565 build: fix deploy failure (#10885) 2025-05-05 06:59:14 +00:00
Almeida
bae1b4c17d docs: fix missing type (#10882) 2025-05-04 09:12:18 +00:00
Almeida
28e5dd2e80 fix: padding on codeblocks (#10881) 2025-05-03 22:57:04 +02:00
Qjuh
65f41bea96 fix(website): constructors show on too many items (#10880) 2025-05-03 20:25:00 +00:00
Qjuh
75179fbf9f chore: bump zlib-sync to 0.1.10 (#10873) 2025-05-01 20:43:44 +00:00
iCrawl
696d8339a3 docs: use correct base url 2025-04-28 02:37:42 +02:00
iCrawl
c3c12fb78b docs: redirect to guide 2025-04-28 02:31:29 +02:00
Noel
2184085fda docs: guide setup (#10862) 2025-04-28 02:23:27 +02:00
Vlad Frangu
291012c18a chore: forward-port release metadata from side branches (#10848)
* chore(rest): forward-port release metadata from v14 branch

* chore(formatters): forward-port release metadata from builders/v1 branch

* chore(builders): forward-port release metadata from builders/v1 branch

* chore(core): forward-port release metadata from v14 branch

* chore(ws): forward-port release metadata from v14 branch

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-04-27 18:30:38 +00:00
Qjuh
d32aacd14c feat(website): show examples on constructors (#10856)
* feat(website): show examples on constructors

* fix: lint

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-04-27 00:48:18 +00:00
Almeida
a4f3a2574d ci: update list of packages in codecov uploads (#10846)
* ci: update list of packages in coverage upload

* build: remove test dependencies

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-04-27 00:45:54 +00:00
Almeida
8f375275ca fix: message builders (#10802)
* fix: message builders

- Added `clearParse`, `clearRoles`, and `clearUsers` methods to the `AllowedMentionsBuilder`, since passing an empty array and omitting the these fields behave differently
- Strictened assertions
- Removed `AttachmentBuilder#clearId`, as it is a required field
- Added missing `MessageBuilder#setEmbeds`
- Added missing `MessageReferenceBuilder#setFailIfNotExists`
- Improve/fix documentation
- Consistency™️

* fix: updater functions return type

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-04-25 20:52:00 +00:00
Danial Raza
d81b4be2cd feat: add soundboard (#10590)
* feat: add soundboard

* types(PartialSoundboardSound): add `available`

* feat(VoiceChannelEffect): add `soundboardSound` getter

* types: improve return types

* docs: requested changes

* feat: support multiple audio file types

* types(GuildSoundboardSoundCreateOptions): add `contentType`

* types: add default and guild soundboard sound

* fix: requested changes

* docs: use `@fires` tag

* docs: remove misleading tag

* chore: requested changes and missing things

* feat: add send soundboard sound options
2025-04-25 19:43:17 +00:00
Naiyar
8e4e319c24 feat: entry-point command (#10640)
* feat: entry point command

* chore: update tests

* chore: suggested change

* chore: suggestion

Co-authored-by: Almeida <github@almeidx.dev>

* chore: suggestion

Co-authored-by: Almeida <github@almeidx.dev>

* chore: suggestion

Co-authored-by: Almeida <github@almeidx.dev>

* chore: suggestion

Co-authored-by: Almeida <github@almeidx.dev>

* chore: suggestion

Co-authored-by: Almeida <github@almeidx.dev>

* chore: remove extra info closing tag

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-04-24 19:55:30 +00:00
Qjuh
5a4de953fa fix: generateSplitDocumentation for external docs on main (#10827)
* fix: generateSplitDocumentation for external docs on main

* fix: remove console.log

* chore: apply suggestion

Co-authored-by: Almeida <github@almeidx.dev>

* fix: mixes tag

* chore: docs include collection

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-04-24 19:19:52 +00:00
Sammy
891fe277bf fix(builders): export container component (#10844) 2025-04-24 17:13:34 +00:00
Vlad Frangu
abc5d99ce8 feat: components v2 in builders (#10788)
* feat: thumbnail component

* chore: just a temp file to track remaining components

* feat: file component

* feat: section component

* feat: text display component

* chore: bump alpha version of dtypes

* chore: simplify ComponentBuilder base type

* feat: MediaGallery

* feat: Section builder

* chore: tests for sections

* chore: forgot you

* chore: docs

* fix: missing comma

* fix: my bad

* feat: container builder

* chore: requested changes

* chore: missed u

* chore: type tests

* chore: setId/clearId

* chore: apply suggestions from code review

* chore: unify pick

* chore: some requested changes

* chore: tests and small fixes

* chore: added tests that need fixing

* fix: tests

* chore: cleanup on isle protected

* docs: remove locale

* chore: types for new message builder

* chore: fix tests

* chore: attempt 1 at message builder assertions

* chore: apply suggestions

* Update packages/builders/src/messages/Assertions.ts

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* Update packages/builders/src/components/v2/Thumbnail.ts

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* fix: tests

* chore: fmt

* Apply suggestions from code review

Co-authored-by: Denis-Adrian Cristea <didinele.dev@gmail.com>

* chore: fix pnpm lockfile revert

---------

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Denis-Adrian Cristea <didinele.dev@gmail.com>
2025-04-23 17:29:15 +00:00
Vlad Frangu
42ce116226 chore(deps): bump discord-api-types (#10841)
* chore(deps): bump discord-api-types

* chore: tests

* chore: tests 2

* chore: replace ImageSize type with dtypes type
2025-04-22 17:12:34 +00:00
柚子Youzi
8f35dfd039 docs(readme): add import statement for pure REST usage to align with other examples (#10838)
* docs(readme): add import statement for pure REST usage to align with other examples

Added missing `import` statements in the "Independent REST API Usage" section to maintain consistency with the rest of the README examples.  
This change also ensures that the usage of `@discordjs/core` reflects a REST-only setup by importing from `@discordjs/core/http-only`, which avoids dependency issues like `Can't resolve 'zlib-sync'`.

* fix: standardize import quotes in README.md

* style: organise imports

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-04-20 14:10:24 +00:00
Qjuh
92e07c8f7f types: add missing BaseMessageCreateOptions (#10833)
* types: add missing BaseMessageCreateOptions

* build: trigger tests

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: almeidx <github@almeidx.dev>
2025-04-18 16:46:55 +00:00
Qjuh
feec5efe45 fix: don't set ready status twice (#10807)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-04-17 18:11:24 +00:00
Danial Raza
57c3da2e8e docs(ApplicationCommand): incorrect method in example (#10837) 2025-04-16 17:26:28 +00:00
Almeida
5c0b714557 fix: structure imports on windows (#10835) 2025-04-13 19:45:11 +00:00
Almeida
f0ea40586b build: bump discord-api-types to 0.37.120 (#10832)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-04-11 08:26:23 +00:00
iCrawl
056c691281 ci: update pnpm version when building main 2025-04-11 01:56:42 +02:00
iCrawl
8ce8f7ff46 ci: fix upload to database 2025-04-11 01:09:24 +02:00
iCrawl
e22a7bb505 ci: upload docs to cf 2025-04-11 00:55:57 +02:00
Qjuh
74110b3e7d fix(website): add type to variables (#10779)
* fix(website): add type to variables

* chore: apply suggestion

* chore: lint
2025-04-10 22:44:35 +02:00
Almeida
53ba3b6016 feat(BaseInteraction): add attachmentSizeLimit (#10830)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-04-10 20:41:52 +00:00
Noel
2e3bc69602 refactor: website facelift (#10823) 2025-04-10 22:02:37 +02:00
Almeida
1fe53c7ca2 chore: move pnpm settings to pnpm-workspace.yaml (#10828)
* chore: move pnpm settings to pnpm-workspace.yaml

* chore: remove contentlayer remains

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-04-10 17:42:05 +00:00
Jiralite
3b76c7072d build: Bump Undici to 7.8.0 (#10831)
build: bump Undici
2025-04-10 13:40:46 +00:00
Danial Raza
d93a52c1dd chore: remove has PR label (#10820)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-04-07 16:22:31 +00:00
Jiralite
2e99c26c6d build: allowAny instead of allowedAny (#10825) 2025-04-07 05:07:45 +00:00
Noel
f580de8025 chore: upgrade deps (#10824) 2025-04-05 13:18:56 +02:00
Danial Raza
432aba3df7 types(ModalSubmitFields): fix fields type (#10816)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-03-30 11:45:37 +00:00
Almeida
646ecae47f fix(Message): forwarded messages are not crosspostable (#10821)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-03-29 08:17:51 +00:00
Almeida
93f2ba0fc8 fix(PollAnswer): only define _emoji property once (#10811)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-03-27 18:05:05 +00:00
Jacob Morrison
3234fc6b3b fix(Poll): ensure this.answers is set before we reference it (#10809)
* Ensure 	his.answers is set sooner if it's null during a patch

* Move data.answers block up as well to ensure the patched answers are set

* Ensure collection is set in constructor instead

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-03-27 18:01:05 +00:00
Almeida
73f2ef9c87 fix: all shards spawning on shard 0 with sharding manager (#10814) 2025-03-22 20:17:14 +00:00
Jiralite
4d19426810 fix(textInput): Value must be at least 1 character in length (#10805)
fix(textInput): value must be at least 1 in length
2025-03-17 15:31:44 +00:00
Muhammad Nizamuddin Aulia
79b79b6a44 fix(create-discord-bot): register command files in subdirectories (#10775)
* feat(create-discord-bot): add user command in utility subdirectory

* fix(create-discord-bot): command files in the subdirectory were skipped

* fix(create-discord-bot): fix command files in subdirectory were skipped in Deno template

* fix: minor fix

* fix: lint

* refactor: suggested changes

revert: unrelated change

---------

Co-authored-by: almeidx <github@almeidx.dev>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-03-16 18:38:48 +00:00
Jiralite
eabcc52594 refactor(constants): Update guide URL (#10803)
refactor(constants): update guide URL
2025-03-16 17:18:25 +00:00
Qjuh
a151424261 fix(website): correctly link type parameters in docs (#10801) 2025-03-15 22:39:29 +00:00
Denis-Adrian Cristea
09beb8a6a0 feat: message builder (#10793)
* feat: attachment builder

* feat: message builder

* chore: nits

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* fix: nonce assertion

* chore: strip bad method

* chore: nit

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* chore: nits

* chore: address final review

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-03-14 08:09:15 +00:00
Almeida
ab6a69401e docs: remove hardcoded locale from links (#10794)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-03-07 21:23:42 +00:00
Jiralite
12638cd43c fix(embed): Allow attachment protocols for thumbnails and images (#10795)
fix(embed): allow attachment protocols for thumbnails and images

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-03-07 20:19:14 +00:00
Jiralite
c78407e751 fix(GuildMemberManager): Ensure empty object for fetching many guild members (#10796)
fix(GuildMemberManager): pass empty object for fetching many
2025-03-07 20:15:54 +00:00
Danial Raza
e273afbb93 feat: override groupBy to return Collection (#10791)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-03-05 20:19:20 +00:00
Danial Raza
b7e334e74a feat(Webhook): allow setting withComponents (#10792)
* feat(Webhook): allow setting `withComponents`

* docs: remove brackets

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-03-05 19:08:22 +00:00
Denis-Adrian Cristea
0f89353443 refactor!: remove discord.js builders (#10529)
BREAKING CHANGE: Removed all builder extensions within discord.js
2025-03-05 14:34:49 +02:00
Denis-Adrian Cristea
28a945069f fix(ContextMenuCommandBuilder): allow emoji in name (#10790)
* fix(ContextMenuCommandBuilder): allow emoji in name

* test: add emoji from 16.0

https://emojipedia.org/fingerprint

* chore: non rule-breaking regex

* feat: use simplified regex

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

* style: prettier

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
2025-03-05 12:15:54 +00:00
Almeida
d1f56ffb2a fix: poll builders (#10783)
* fix: poll builders

- Fixed validations
- Added missing documentation
- Removed redundant code
- Consistency™️

* fix: tests

* feat: missing answers test
2025-03-01 14:57:00 +00:00
TÆMBØ
88bfeaab22 feat: PollBuilder (#10324)
* Add PollBuilder

* Add exports

* Update typings

* Update validations

* Use correct enum validator method

* Fix assertion, formatting

* Add tests

* Fix assertion

* Add JSDoc, format

* Make requested changes

* Remove unnecessary blank import

* Add support for PollBuilder in mainlib discord.js

* Add types, fix formatting

* Correct typings & assertions for poll answer emojis

* Improve typings readability

* Add JSDoc typings for overrides

* Add types for using PollBuilder in message payload

* Add tests, allow passing Emoji instance to emoji option

* Fix formatting

* Update max poll duration

* refactor: implement builders v2 pattern
2025-02-28 10:07:27 +00:00
Danial Raza
b6fda781c8 refactor: remove parameter reassignment (#10715)
* refactor: remove parameter reassignment

* refactor: requested changes

Co-authored-by: Almeida <github@almeidx.dev>

* chore: requested changes

Co-authored-by: Qjuh <Qjuh@users.noreply.github.com>

* chore: requested changes

* refactor: destructure in parameters

Co-authored-by: Almeida <github@almeidx.dev>

* refactor: apply suggested changes

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Qjuh <Qjuh@users.noreply.github.com>
2025-02-26 15:31:29 +00:00
Almeida
bb6767113f feat: re-emit REST debug logs (#10782) 2025-02-25 06:20:10 +00:00
Jiralite
1054f4abce refactor(PackageSelect): Redirect to stable (#10778)
refactor(PackageSelect): redirect to stable

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-02-23 19:13:16 +00:00
Almeida
c429cc112b types(ShardClientUtil): remove count and ids (#10780) 2025-02-23 16:13:59 +00:00
Almeida
a1d19b909a refactor!: remove polyfillDispose (#10776)
BREAKING CHANGE: The `polyfillDispose` function has been removed
2025-02-22 00:52:06 +00:00
Danial Raza
ed55c029d6 fix(MessagePayload): preserve existing flags when editing (#10765)
* fix(MessagePayload): preserve existing flags when editing

* refactor: request changes

* fix: missing `.bitfield`
2025-02-21 15:17:33 +00:00
Danial Raza
cbb33ecdac types(InteractionCallbackResponse): add missing InGuild generic (#10767)
Co-authored-by: TÆMBØ <TAEMBO@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-02-21 15:11:07 +00:00
Naiyar
c4fbe89f48 fix(GuildChannelManager): properly resolve avatar for createWebhook (#10772)
fix(GuildChannelManager): properly resolve avatr for createWebhook
2025-02-21 11:14:38 +00:00
TÆMBØ
0e7bdb0728 feat!: create forwards and add ChannelManager#createMessage() (#10559)
BREAKING CHANGE: `MessageCreateOptions` no longer accepts `forward` or `reply`. Use `messageReference` instead.

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-02-20 21:53:52 +00:00
Vlad Frangu
19d48f6d6c feat: print out support for aes-256-gcm in native node:crypto (#10764) 2025-02-19 20:59:17 +00:00
Kevin
e3e3c212bd feat: polls overhaul (#10328)
* feat(Managers): add PollAnswerVoterManager

* feat(Partials): make Polls partial-safe

* types: add typings

* chore: add tests

* fix: use fetch method in manager instead

* chore: add tests for manager

* feat: add partial support to poll actions

* style: formatting

* fix: change all .users references to .voters

* refactor: add additional logic for partials

* fix: actually add the partials

* fix: fixed issue where event does not emit on first event

* fix: align property type with DAPI documentation

* fix: resolve additional bugs with partials

* typings: update typings to reflect property type change

* fix: tests

* fix: adjust tests

* refactor: combine partials logic into one statement

* docs: mark getter as readonly

* refactor: apply suggestions

Co-authored-by: Almeida <github@almeidx.dev>

* refactor(Actions): apply suggestions

* refactor(PollAnswerVoterManager): apply suggestions

* refactor(Message): check for existing poll before creating a poll

* refactor(Polls): apply suggestions

* revert(types): remove unused method from Poll class

* refactor(Actions): consolidate poll creation logic into action class

* refactor(PollAnswerVoterManager): set default for fetch parameter

* refactor(Message): apply suggestion

* fix: remove partial setter

* refactor(Polls): apply suggestions

* types: apply suggestions

* refactor: remove clones

* docs: spacing

* refactor: move setters from constructor to _patch

* types: adjust partials for poll classes

* test: add more tests for polls

* refactor: move updates around, more correct partial types

* fix: handle more cases

* refactor: requested changes

* fix: missing imports

* fix: update imports

* fix: require file extensions

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
2025-02-15 20:20:54 +00:00
Qjuh
44b0f7dd99 chore: Update CODEOWNERS (#10759)
* chore: Update CODEOWNERS

* Update CODEOWNERS

* sort

---------

Co-authored-by: Almeida <github@almeidx.dev>
2025-02-15 13:49:03 +00:00
Luna
b7fd2d105f refactor(Client)!: Remove emojis getter (#10754)
BREAKING CHANGE: Removed `Client#emojis`

---------

Co-authored-by: Danial Raza <danialrazafb@gmail.com>
2025-02-15 13:46:29 +02:00
Amgelo563
4b63bb8046 fix: Do not omit falsy default values (#10755)
* fix(docs): fix default falsy values being omitted

* fix(docs): swap defaultValue check to avoid negated condition

* fix: fix pr by removing everything it added and committing something entirely different

---------

Co-authored-by: almeidx <github@almeidx.dev>
2025-02-12 19:52:02 +00:00
Jiralite
5c49b6d9af docs: Fix close tags (#10756)
* docs: fix close tag

* remove extra spaces

---------

Co-authored-by: Almeida <github@almeidx.dev>
2025-02-12 19:08:07 +00:00
Danial Raza
64494137da types: rename CategoryChannelType to CategoryChannelChildTypes (#10750)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-02-12 11:26:13 +00:00
Almeida
58a111d6fe chore: use Node.js 22 and fix corepack installation (#10746)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-02-11 00:21:09 +00:00
Lobo Metalúrgico
5c48979096 build: Update undici to 6.21.1 (#10743)
fix: undici bumping to 6.21.1

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-02-10 23:07:06 +00:00
Almeida
2183c5eebb fix(EmbedFieldBuilder): allow empty name and value (#10745) 2025-02-10 21:54:31 +00:00
Jiralite
af3ab2211a chore: Update GuildEmojisAndStickers in bug report form (#10741)
chore: update intent name
2025-02-08 15:19:15 +00:00
Jiralite
90105338f0 chore: Remove "typings" scope from cliff.toml (#10738)
chore: remove typings from generator
2025-02-02 15:44:53 +00:00
ŊʂƓ PRIYANSHU
5f463eb9e9 chore: Add contributors and last commit badges (#10428)
* chore: add new fancy badges

* chore: add util

* style: remove extra space

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-29 10:51:05 +00:00
Jiralite
529ce6b472 docs: Use link tags to render links on the documentation (#10731)
* docs: use link tags

* docs(DateResolvable): update link

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-29 09:27:58 +00:00
Jiralite
fa0d4b507d feat: Incident Actions (#10727)
* feat: initial commit

* feat: add guild helper

* docs: `guild` is required

* docs(IncidentActions): move to guild

* fix: `incidents_data` is nullable

* fix: method typo

* fix: default to `null`

* fix: use `new Date()`

* docs: note that it is not received over the gateway

* refactor: use transformer

* chore: resolve TODO

* chore: typo

Co-authored-by: Danial Raza <danialrazafb@gmail.com>

* chore: suggestions

Co-authored-by: Almeida <github@almeidx.dev>

* chore: consistency

Co-authored-by: Almeida <github@almeidx.dev>

---------

Co-authored-by: Danial Raza <danialrazafb@gmail.com>
Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-28 19:43:20 +00:00
Danial Raza
6e61ec6358 feat(Client): add request soundboard sounds (#10608)
* feat(Client): add request soundboard sounds

* docs: add `guildId` to example

Co-authored-by: Almeida <github@almeidx.dev>

* refactor: remove `groupBy` polyfill

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-28 12:33:34 +00:00
Jiralite
6df42db33d build: bump discord-api-types to 0.37.118 (#10730) 2025-01-28 10:09:09 +00:00
Jiralite
3db8ce70a2 build!: Bump Node.js to 22.12.0 (#10726)
BREAKING CHANGE: Node.js 22.12.0 or above is required.
2025-01-26 14:56:39 +00:00
Jiralite
9b8b0f828c build: Properly add typecheck tests (#10722)
* build: exclude type tests from running

* refactor: use `tsc`

* test: fix broker test

* test: fix voice test

* test: fix builders test

* test: use vitest typecheck

remove unused test scripts
skip lib check
rm vitest.d.ts

* fix: remove tsd from core and ws

* fix: extend local tsconfig

---------

Co-authored-by: almeidx <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-26 14:28:45 +00:00
cobalt
b820daadd4 fix(GuildAuditLogEntry)!: Fix some incorrect types and runtime logic (#10591)
BREAKING CHANGE: It also doesn't have a `options.channel_id`, so I stopped `.extra.channel` from being set to `{ id: undefined }`
BREAKING CHANGE: Fixed both types and runtime logic here, it previously created a broken `AutoModerationRule`
BREAKING CHANGE: Removed `Targets.GuildOnboarding`, it will fallback to `Targets.Unknown` and generate a placeholder `target` from the `changes`

---------

Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Denis-Adrian Cristea <didinele.dev@gmail.com>
Co-authored-by: Almeida <github@almeidx.dev>
2025-01-26 13:48:57 +00:00
René
b7e0fe3689 feat(collection): honour subclassing via @@species in static methods (#10723)
* feat(collection): use @@species in static methods

* test(collection): subclassing tests

* chore: trigger ci

---------

Co-authored-by: almeidx <github@almeidx.dev>
2025-01-26 13:14:48 +00:00
Vlad Frangu
0ab6abbcff types: remove fields that cannot be set by the client (#10711)
* types: remove fields that cannot be set by the client

* chore: cleanup JS lands too

* chore: requested changes

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-26 10:34:34 +00:00
Danial Raza
695f592361 refactor!: consolidate parameters into a single options object (#10718)
BREAKING CHANGE: `ApplicationCommandManager#fetch` and `GuildApplicationCommandManager#fetch` no longer accept 2 parameters. Instead, the first parameter accepts `id` or `options` which can now also have the `id` property.

---------

Co-authored-by: Micah Benac <OfficialSirH@users.noreply.github.com>
Co-authored-by: Almeida <github@almeidx.dev>
2025-01-25 20:43:20 +00:00
Almeida
2cbf418008 types!: remove GuildMemberResolvable (#10713)
BREAKING CHANGE: The `GuildMemberResolvable` union has been removed. Use `UserResolvable` instead.
2025-01-24 12:39:37 +00:00
Almeida
670667d65b feat: add auth option in api methods (#10717)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Denis-Adrian Cristea <didinele.dev@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-24 11:23:17 +00:00
Amgelo563
54d8750a2d docs(Message): improve message snapshots description (#10709)
* docs(Message): improve message snapshots description

* docs(Message): remove snapshots single entry callout

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-01-24 10:32:56 +00:00
Almeida
8e3ab32942 refactor!: return void on bans/kick/addRole/removeRole methods (#10714)
BREAKING CHANGE: The following methods don't return anything: `GuildMember#ban`, `GuildMember#kick`, `GuildMemberManager#ban`, `GuildMemberManager#unban`, `GuildMemberManager#kick`, `GuildMemberManager#addRole`, `GuildMemberManager#removeRole`, `GuildBanManager#create`, and `GuildBanManager#remove`.
2025-01-24 10:21:40 +00:00
Almeida
bbec50b134 style: require file extensions in file imports (#10724) 2025-01-24 10:17:02 +00:00
Almeida
db3cb48246 refactor: use throw instead of Promise.reject (#10712)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Renegade334 <Renegade334@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-24 09:39:05 +00:00
Jiralite
702a3762d1 test: Fix collector tests (#10725)
test: fix collector tests
2025-01-24 09:34:30 +00:00
Naiyar
a3fa1a8dcd feat(interactions): add launchActivity method (#10646)
* feat(interactions): add launchActivity method

* chore: suggestion

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* chore: suggestion

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* fix: overload and add tests

* chore: wording

* chore: wording

* chore: spacing

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-24 09:11:18 +00:00
Jiralite
3d85d96f08 docs(guild): Remove "all" for listing guild members (#10719)
docs(guild): remove "all" for listing

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-24 09:03:43 +00:00
Almeida
687e2ae672 refactor!: use AsyncEventEmitter instead of EventEmitter (#10710)
BREAKING CHANGE: The `BaseClient`, `Shard`, `ShardingManager`, and `Collector` classes now extend `AsyncEventEmitter` instead of `EventEmitter`.
2025-01-23 09:20:05 +00:00
Naiyar
aa90f00d11 types(interactions): fix overloads (#10702)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-01-18 19:19:41 +00:00
Danial Raza
ad6b006d35 refactor: standardize export style to named exports (#10630)
* refactor: standardize export style to named exports

* refactor: export enums directly

* fix: update importing in generateRequires script

* fix: missed places

* feat: add eslint rule

* fix: ci errors

* fix: leftovers

* fix: remove accidentally readded interaction response

* fix: remove interaction response export

* fix: correct collection export

* chore: add another eslint rule

---------

Co-authored-by: almeidx <github@almeidx.dev>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-18 18:58:28 +00:00
Danial Raza
c6e16c3675 types(ThreadOnlyChannel): remove incorrect messages property (#10708)
* types(ThreadOnlyChannel): remove incorrect `messages` property

Co-authored-by: TÆMBØ <TAEMBO@users.noreply.github.com>

* test: t e s t s

* test: revamp tests

---------

Co-authored-by: TÆMBØ <TAEMBO@users.noreply.github.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-01-18 07:38:00 +00:00
Vlad Frangu
052ed7fbe7 chore: backport-candidate GitHub label (#10623)
* chore: backport-candidate GitHub label

* chore: sort label script

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-18 07:22:50 +00:00
Danial Raza
21096884b1 types: add undefined to flags for exactOptionalPropertyTypes (#10707) 2025-01-16 19:34:10 +00:00
Idris
0c40bc195e refactor(Emoji)!: make imageURL() change extension dynamically (#10613)
BREAKING CHANGE: Image URLs of emojis now automatically return GIF or static extensions.
BREAKING CHANGE: `CDN#emoji()` now has an `animated` required parameter.
2025-01-16 09:59:28 +00:00
Jiralite
e2bbfe7b13 refactor!: Return only snowflakes for bulk delete (#10704)
BREAKING CHANGE: Bulk deleting will only return the message ids that were deleted.

---------

Co-authored-by: Almeida <github@almeidx.dev>
2025-01-16 09:47:15 +00:00
Danial Raza
6a42c5f929 fix!: move crosspost() to GuildMessageManager (#10703)
BREAKING CHANGE: The `crosspost()` method from `MessageManager` has been moved to `GuildMessageManager`.
2025-01-15 11:29:35 +00:00
Naiyar
1fd587c935 types: Allow only ephemeral for defer reply (#10696)
* fix(types): remove unusable flags from InteractionDeferReplyOptions

* fix: include flags in WebhookMessageEditOptions

* chore: update jsdoc

* fix: wrong order

* chore: specify the flag

* chore: extend MessageEditOptions

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-01-14 14:16:33 +00:00
Naiyar
a65c982ddb feat(PartialGroupDMChannel): add missing properties (#10502)
* fix(PartialGroupDMChannel): add missing ownerId property

* refactor: make ownerID nullable

* feat: add last_message_id & last_pin_timestamp prop

* feat: add component collector methods

* fix: handle null case

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>

---------

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-14 09:22:14 +00:00
Almeida
18ab0cf62a refactor(actions): removed unnecessary actions (#10666)
Removed actions that were only being used in their
respective websocket handlers. The remaining
actions either were either being used elsewhere or
were using methods from the `GenericAction` class.

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
2025-01-13 11:29:57 +00:00
Almeida
28afb0ca0a refactor: remove data resolver exports (#10701)
refactor!: remove data resolver exports

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-13 10:26:31 +00:00
Vlad Frangu
5f7d335290 feat: fetch gateway information without requiring rest in ws (#10651)
* feat: overridable initial gateway URL

* chore: discussion changes

* chore: requested change

* chore: other changes

* Update packages/ws/src/ws/WebSocketManager.ts

* style: run ESLint

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-13 10:23:41 +00:00
Digital
1e29bb4049 fix(PresenceUpdate): correctly add user regardless of their properties (#10672)
* fix(PresenceUpdate): correctly add user regardless of their properties

* refactor(PresenceUpdate): reflect partials

* refactor(PresenceUpdate): prettier

* refactor(PresenceUpdate): add import

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-13 10:20:44 +00:00
Naiyar
34b6a82935 refactor(IntegrationApplication): move common properties to Application (#10627)
* refactor(IntegrationApplication): move common properties to Application

* fix: remove prop from ClientApplication
2025-01-13 10:16:14 +00:00
Almeida
6314d96ed1 types: remove createComponent and createComponentBuilder (#10687)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-13 10:08:26 +00:00
ckohen
ae0265eefc feat(rest)!: allow passing tokens per request (#10682)
BREAKING CHANGE: `RequestData.authPrefix` has been removed in favor of `RequestData.auth.prefix`
2025-01-13 05:36:05 +00:00
Jiralite
11438c230b refactor!: Unpin @discordjs/collection (#10665)
BREAKING CHANGE: discord.js now uses @discordjs/collection v3—a major version increase.
2025-01-13 04:48:30 +00:00
Naiyar
101bef1c52 fix(InteractionResponses): mark replied true for followUps (#10688)
fix: mark replied true for followUps

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-01-12 21:52:45 +00:00
Jiralite
7e81d3b6c8 refactor!: Remove InteractionResponse (#10689)
BREAKING CHANGE: `InteractionResponse` has been removed. Create interaction collectors via `with_response` or fetching the reply.
2025-01-12 21:48:08 +00:00
Ryan Munro
f70ab41d56 fix(IntegrationApplication)!: remove hook (#10699)
BREAKING CHANGE: IntegrationApplication#hook has been removed.
2025-01-12 20:51:58 +00:00
Vlad Frangu
24f395412c types: fix recurrence rule types (#10693)
* types: fix recurrence rule types

* fix: endAt not endsAt

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-12 20:22:09 +00:00
Jiralite
3ddb73287b refactor!: Better application command mention format approach (#10639)
BREAKING CHANGE: The parameters of `chatInputApplicationCommandMention()` have been reordered.
2025-01-12 20:09:03 +00:00
Jiralite
91f59cf183 fix(fetchVersions): Sort package versions (#10695)
* fix(fetchVersions): sort package versions

* fix(middleware): fix stable redirect
2025-01-12 19:09:46 +01:00
ckohen
01e64b4e9a fix(actions): respect ratelimits on split docs upload (#10697)
* fix(actions): respect ratelimits on split docs upload

* fix: set failed on missing uploads
2025-01-12 19:05:35 +01:00
Jiralite
9a400730f5 test: Include type checks on builders (#10692)
test: include type checks on builders
2025-01-05 12:16:25 +00:00
GodderE2D
28126cd375 fix: make version and package select openable on mobile (#10684) 2025-01-05 09:59:15 +00:00
Jiralite
0c9901e5e4 style: Run Prettier (#10691)
style: prettier
2025-01-05 02:53:44 +01:00
Jiralite
071015caef test: Add with_response overload tests (#10685)
test: add overload tests

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-05 00:22:58 +00:00
Synbulat Biishev
f5d2926c5a feat(NewsChannel)!: return followed channel data (#8566)
BREAKING CHANGE: `GuildChannelManager#addFollower` and `AnnouncementChannel#addFollower` now return `FollowedChannelData`
2025-01-04 17:43:22 +00:00
Jiralite
1986c2d2a8 fix(Message): Ensure channel is defined for clean content (#10681)
fix(Message): ensure channel is defined for clean content

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-04 17:19:56 +00:00
Jiralite
28a2503845 fix(interactions): options should be optional (#10683)
fix(interactions): fix optional overloads
2025-01-03 23:10:09 +00:00
René
bacc08b45f refactor(PermissionOverwrites)!: cache-independent resolve (#10528)
BREAKING CHANGE: `PermissionOverwrites#resolve`'s `overwrite` arg now requires `type` if the `id` is a Snowflake
2025-01-03 11:40:59 +02:00
Jiralite
9fea0698af fix: Correct guild member banner URL (#10677)
fix: correct guild member banner URL

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2025-01-02 08:19:33 +00:00
ckohen
65883f344e chore(cliff): don't skip breaking commits (#10675)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2025-01-02 00:48:21 +00:00
Almeida
ad0d9a295e chore(create-discord-bot): release create-discord-bot@1.0.0 (#10674)
* chore: fix cliff-jumper config

* chore(create-discord-bot): release create-discord-bot@1.0.0

---------

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
2025-01-01 23:28:01 +00:00
Jiralite
a111cddcea feat: Upgrade create-discord-bot dependencies (#10673)
feat: upgrade cdb deps
2025-01-01 23:13:06 +00:00
pat
bc3a0c8389 fix(voice): mark stream as ended (#10455)
* fix: mark stream as ended

refactor: prefer destroying the stream

* refactor: callback for nextTick

test: wait duration ms to check end

chore: eslint

test: end before timeout

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-12-31 20:45:24 +00:00
Almeida
a6685a319e build: bump dependencies (#10671) 2024-12-31 21:31:34 +01:00
Denis-Adrian Cristea
b854c7b979 fix(SimpleIdentifyThrottler): don't sleep negative amounts (#10669)
* fix(SimpleIdentifyThrottler): don't sleep negative amounts

* fix: test
2024-12-31 18:16:57 +00:00
Qjuh
b81ad113a0 ci: make docs run succeed for old tags (#10668) 2024-12-30 15:27:43 +01:00
Danial Raza
c484e3de25 feat(Subscription): add renewalSkuIds (#10662) 2024-12-21 22:19:36 +00:00
Danial Raza
f1bce54a28 fix(InteractionResponses): properly resolve message flags (#10660) 2024-12-18 14:39:04 +00:00
Jiralite
35ebcc7d5a refactor!: Remove deprecations (#10645)
BREAKING CHANGE: `GuildsAPI#editUserVoiceState()` has been removed. Use `VoiceAPI#editUserVoiceState()` instead.
BREAKING CHANGE: `GuildsAPI#setUserVoiceState()` has been removed. Use `VoiceAPI#setUserVoiceState()` instead.
BREAKING CHANGE: `InteractionsAPI#sendPremiumRequired()` has been removed.
BREAKING CHANGE: `StickersAPI#getNitroStickers()` has been removed. Use `StickersAPI#getStickers()` instead.
2024-12-13 18:21:10 +00:00
Jiralite
0848fc6b4e fix: Handle unknown versions (#10657) 2024-12-12 20:09:05 +01:00
Danial Raza
fd1958bd67 refactor!: replace isAnySelectMenu with isSelectMenu (#10656)
BREAKING CHANGE: `BaseInteraction#isAnySelectMenu()` has been removed. Use `BaseInteraction#isSelectMenu()` instead.

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-12-12 10:21:00 +00:00
Naiyar
89940d55e3 fix: use Message#interactionMetadata (#10654) 2024-12-12 02:56:22 +00:00
Denis-Adrian Cristea
2ff47d85cf refactor(IContextFetchingStrategy): explicitly name forwarded properties (#10652) 2024-12-10 06:34:15 +00:00
Jiralite
5d00332b8c refactor!: Remove deprecations (#10647)
refactor: remove deprecations

BREAKING CHANGE: `ApplicationCommand#dmPermission` has been removed. Use `ApplicationCommand#contexts` instead.
BREAKING CHANGE: `ApplicationCommandData#dmPermission` has been removed. Use `ApplicationCommandData#contexts` instead.
BREAKING CHANGE: `ApplicationCommandData#setDMPermission` has been removed.
BREAKING CHANGE: `Message#setcon` has been removed. Use `Message#interactionMetadata` instead.
2024-12-09 13:15:57 +00:00
Rodrigo Leitão
310563ba07 refactor(GuildChannel)!: default setParent's lockPermissions to false (#9016)
BREAKING CHANGE: `GuildChannel#setParent`'s `lockPermissions` now defaults to false
2024-12-09 10:51:39 +02:00
Jiralite
231954d630 types(InteractionReplyOptions): Add withResponse (#10637)
types(InteractionReplyOptions): add `withResponse`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-12-09 08:44:14 +00:00
Naiyar
1cfc835e97 fix(interactions): wrong return type and missing implementation of with_response in core (#10644)
* fix(types): wrong return type with with_response

* fix: missing implementation of with_response

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-12-09 08:40:35 +00:00
Almeida
b3d4259f8a refactor!: remove deprecated CDN method overloads (#10649)
BREAKING CHANGE: Removed user avatar decoration overload from `CDN#avatarDecoration()`
BREAKING CHANGE: Removed non-object options overload from `CDN#emoji()`

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-12-09 06:58:47 +00:00
Jiralite
af4018c25f refactor!: Remove underscore (#10648)
BREAKING CHANGE: Removed the `underscore()` formatter. Use `underline()` instead.
2024-12-09 00:02:34 +00:00
Jiralite
00dceb32ba test: Remove unused test (#10638)
test: remove unused test

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-12-05 23:19:33 +00:00
Jaw0r3k
0ac140cd9f refactor!: escape expanded markdown by default (#9463)
feat: support markdown

BREAKING CHANGE: `heading`, `bulletedList`, `numberedList`, `maskedLink` in `EscapeMarkdownOptions` now defaults to `true`.

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-12-05 22:43:40 +00:00
Jiralite
25633a024e docs(InteractionDeferReplyOptions): Associate flags with its <info> (#10635)
docs(InteractionDeferReplyOptions): move `flags` down
2024-12-05 21:58:47 +00:00
Jaw0r3k
dd430c090d refactor(guild)!: remove deprecated get guild overload (#10052)
BREAKING CHANGE: Removed `GuildsAPI#get` overload that allowed passing options as 2nd parameter

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-12-05 21:05:15 +02:00
Naiyar
6304c0177e feat(ClientApplication): add webhook events (#10588)
* feat(ClientApplication): add webhook events

* refactor: update enum names and add external types

* docs(APITypes): reorder

* chore: requested changes

* chore: requested changes

* docs: remove redundancy

* Update ClientApplication.js

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Almeida <github@almeidx.dev>
2024-12-05 18:52:02 +00:00
Qjuh
07eb3865c4 types: fix Client#lastPingTimestamps (#10634)
* types: fix Client#lastPingTimestamps

* docs: consistency

* types: use ReadonlyCollection
2024-12-05 16:46:38 +00:00
Jiralite
0560842a21 feat(EntitlementManager): Support get entitlement (#10606)
* feat: support get entitlement

* docs: add return type

Co-authored-by: Danial Raza <danialrazafb@gmail.com>

* fix: property typo

Co-authored-by: Almeida <github@almeidx.dev>

* fix: property typo

Co-authored-by: Almeida <github@almeidx.dev>

---------

Co-authored-by: Danial Raza <danialrazafb@gmail.com>
Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-12-05 15:55:50 +00:00
Jiralite
a6390716fe feat(monetization): Add get entitlement endpoint (#10605)
feat(monetization): add get entitlement endpoint

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-12-05 15:43:35 +00:00
Jiralite
abf4b6103c types: Export some core-specific types (#10620)
types: export core-specific types

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-12-05 09:09:43 +00:00
Jiralite
eceaa85ad4 fix(ThreadChannel): Make ownerId always present (#10618)
fix: thread owner id is always present

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-12-05 08:40:46 +00:00
Danial Raza
d0dc864888 fix: update clientReady event name references (#10632) 2024-12-04 17:42:07 +00:00
Qjuh
bd7a995717 feat(website): include reexported members in docs (#10518)
* feat(website): add re-exported members to docs site

* refactor(scripts): rewrite sourceURL for externals

* feat(website): add external badge

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-12-02 18:28:44 +00:00
René
5f0d28c0fe fix(collection)!: default sort comparison algorithm (#10412)
BREAKING CHANGE: This replaces the previously inaccurate default sort algorithm, which may alter sort results where a user-defined comparison function is not provided.
2024-12-02 08:23:48 +00:00
Jiralite
f5445c8104 fix(RoleManager): Fetching roles is not nullable (#10629)
fix(RoleManager): `fetch()` not nullable

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-29 18:40:12 +00:00
Jiralite
a69600546a docs: Typos (#10628)
chore: typos

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-29 17:39:24 +00:00
Jiralite
8efb72e761 refactor(FetchApplicationCommandOptions): Use Locale over LocaleString (#10625)
refactor(FetchApplicationCommandOptions): prefer `Locale`
2024-11-29 09:57:00 +00:00
Vlad Frangu
5b125eeec9 docs: correct discord-api-types URLs (#10622)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-28 17:50:34 +00:00
Danial Raza
a870bc1bd3 refactor: use cache.get() for snowflakes, resolve() otherwise (#10626)
* refactor: use `cache.get()` for snowflakes, `resolve()` otherwise

* fix: requested changes

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* chore: remove unnecessary `?? null`

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-28 17:48:04 +00:00
Jiralite
9d62ff57d6 refactor(commands): Use Locale over LocaleString (#10624)
* refactor: use `Locale`

* test: update `LocaleString` tests
2024-11-28 17:33:40 +00:00
Ryan Munro
2b0944a92f feat(InteractionResponses)!: support with_response query parameter (#10499)
BREAKING CHANGE: `InteractionDeferUpdateOptions#fetchReply` was removed, use `InteractionDeferUpdateOptions#withResponse` instead

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-11-28 10:32:05 +02:00
Danial Raza
108943a397 feat: add subscriptions (#10541)
* feat: add subscriptions

* types: fix fetch options types

* fix: correct properties in patch method

* chore: requested changes

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* fix: correct export syntax

* chore(Entitlement): mark `ends_at` as nullable`

* types(FetchSubscriptionOptions): add missing `cache` option

* Revert "types(FetchSubscriptionOptions): add missing `cache` option"

This reverts commit ba472bdc599e1860754e59fce4806610f06ac682.

* chore(Entitlement): mark `startsTimestamp` as nullable

* fix: requested changes

* docs(SubscriptionManager): correct return type

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-28 08:18:44 +00:00
Jiralite
9010b121f4 fix: query is optional for some endpoints (#10621)
* fix(monetization): `query` is optional

* refactor: more defaults
2024-11-28 08:11:23 +00:00
Jiralite
e89c6b66ac build!: Bump Node.js to 20 (#10616)
BREAKING CHANGE: Node.js 20 or above is required.
2024-11-27 16:37:35 +00:00
Jiralite
3a1b3cc8e1 build: Bump discord-api-types to 0.37.109 (#10619)
build: bump discord-api-types
2024-11-27 15:40:21 +00:00
Jiralite
97ffa201a2 test: Update deprecated emoji test (#10607)
test: update deprecated emoji test

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-27 08:31:11 +00:00
Vlad Frangu
0374079c67 chore(deps): bump discord-api-types (#10611) 2024-11-23 00:07:57 +00:00
Jiralite
98153baf91 build: Update dependencies (#10601)
* build: update dependencies

* build: upgrade pnpm to 9.13.2
2024-11-19 10:30:06 +00:00
Jiralite
b03a9e4043 feat: Emit reaction type on gateway events (#10598)
feat: emit reaction type

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-18 11:58:18 +00:00
Jiralite
2fa7d6246f fix(MessageReaction): Address undefined burst properties (#10597)
* fix(MessageReaction): `undefined` burst properties

* refactor: simpler burst colour check

Co-authored-by: Almeida <github@almeidx.dev>

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-18 11:14:29 +00:00
Ryan Munro
40fbd827fa feat(interactions): support with_response query parameter in core (#10512)
* feat(interactions): support with_response query parameter

* fix: address feedback from comments

* chore: remove extraneous documentation

* fix: return type is now undefined

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-17 22:48:30 +00:00
Jiralite
28d5c84ddc style: Run Prettier (#10604)
style: prettier
2024-11-17 22:31:18 +00:00
Jiralite
c8977f29bd docs: Use info markdown (#10603) 2024-11-17 22:22:26 +00:00
Vlad Frangu
7397dfe49e chore(voice): release @discordjs/voice@0.18.0 (#10602)
* chore(voice): release @discordjs/voice@0.18.0

* chore: aes-256 note in readme
2024-11-17 22:17:45 +00:00
pat
9f8b9b1d66 feat(voice)!: add new encryption methods, remove old methods (#10451)
BREAKING CHANGE: This library no longer supports using `tweetnacl` as an encryption library due to Discord deprecating the algorithms that `tweetnacl` helped us support (read more [here](https://discord.com/developers/docs/change-log#voice-encryption-modes)). Please migrate to one of: `sodium-native`, `sodium`, `@stablelib/xchacha20poly1305`, `@noble/ciphers` or `libsodium-wrappers` unless your system supports `aes-256-gcm` (verify by running `require('node:crypto').getCiphers().includes('aes-256-gcm')`).

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
2024-11-18 00:08:51 +02:00
Jiralite
51a017a14e test: Fix builder methods in type test (#10599)
* test: fix builder methods in type test

* test: remove unused import
2024-11-17 12:18:46 +00:00
Qjuh
c45d912c98 refactor(GuildAuditLogsEntry)!: add type guard for narrowing (#10521)
BREAKING CHANGE: removed `GuildAuditLogsEntry.Targets.All` which wasn’t used anywhere

---------

Co-authored-by: Almeida <github@almeidx.dev>
2024-11-15 14:28:06 +00:00
Jiralite
3669d5e112 docs(channel): Clarify emoji parameter (#10595)
* docs(channel): clarify emoji parameter

* docs: actually add `@example`

* docs: clarify the kind of encoding

Co-Authored-By: Vlad Frangu <me@vladfrangu.dev>

---------

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-15 10:04:31 +00:00
Jiralite
6775175459 feat: Voice Channel Effect Send (#10318)
* feat: Voice Channel Send Effects (#9288)

* feat: add soundboard fields

* chore: address TODO

* docs: volume is a closed interval

* types: use `GatewayVoiceChannelEffectSendDispatchData`

* refactor: prefer getting from cache

* fix: correctly access cache

Co-authored-by: Danial Raza <danialrazafb@gmail.com>

---------

Co-authored-by: Danial Raza <danialrazafb@gmail.com>
2024-11-14 21:00:04 +00:00
Jiralite
e2df0e0dbc docs: Remove Node.js 10 notice (#10593)
docs: remove Node.js 10 notice
2024-11-12 06:50:35 +00:00
Naiyar
b8f5a68297 fix(InteractionResponses): throw error on deleting response of unacknowledged interaction (#10587)
fix: error on deleting response of non-acknowledged interaction

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-11 15:48:52 +00:00
cobalt
f2f7f1f65b refactor(formatters): Change :_: emoji name placeholder (#10567)
* Change `:_:` emoji name placeholder

* Update tests

* Format
2024-11-11 00:42:04 +00:00
René
c97310681d types(collection): simplify ambient constructor declaration (#10549)
- deduplicates constructor definition
- removes Collection's "internal" JSDoc description block
- removes unnecessary `extends` clause

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-07 11:12:53 +00:00
René
ea042458a3 perf(collection): optimisations (#10552)
* perf: `merge()`: deduplicate boolean checks

* perf: `toSorted()`: remove redundant closure

* perf: `last[Key]()`: order of operations

- do not perform iterable-to-array until required
- test ! before <

* perf: `{at,keyAt}()`: manually iterate to target

* perf: `first[Key]()`: avoid `Array.from()`

* perf: `map()`: avoid `Array.from()`

* perf: `random[Key]()`: avoid `Array.from()`

* test: `.{at,keyAt}()` indices

* perf: `last[Key]()`: use `.at()`/`.keyAt()` for single element

* perf: `first[Key]()`: use iterable-to-array if returning all

* perf: `random[Key]()`: use `{at,keyAt}()` for single value

- skip iterable-to-array for returning single value
- short-circuit if amount or collection size is zero

* perf: `random[Key]()`: use Durstenfeld shuffle

* refactor: `{key,keyAt}()`: reorder index check

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-07 11:03:26 +00:00
Jiralite
c34a57b798 fix(ThreadChannel): Address parameter type on fetchOwner() (#10579)
* fix(ThreadChannel): address parameter on owner helper method

* docs: fix description

Co-authored-by: Almeida <github@almeidx.dev>

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-05 22:19:48 +00:00
Naiyar
1184b38d3e refactor(ThreadManager)!: match parent ID when fetching a single thread (#10557)
BREAKING CHANGE: `ThreadManager#fetch` now throws when the provided thread ID doesn't belong to the current channel
2024-11-05 13:00:44 +02:00
Danial Raza
939e3644e1 types: add missing Caches managers (#10540)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-05 09:36:41 +00:00
Souji
f02bdc3be3 docs: add note about idempotence to role add/remove routes (#10586)
* chore(docs): Add note about idempotence to role add/remove routes

* chore: remove trailing spaces
2024-11-05 09:29:29 +00:00
Danial Raza
1fd662629d feat: add subscriptions (#10486)
* feat: add subscriptions

* docs: requested changes

Co-authored-by: Almeida <github@almeidx.dev>

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-04 10:48:41 +00:00
Jiralite
ef2a6879d3 feat(GuildMember): Banners (#10384)
* feat: initial support for guild member banners

* feat: serialise in `toJSON()`

* feat: serialise in `toJSON()`

* docs: lowercase i

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-11-04 10:43:34 +00:00
Danial Raza
a9f629b0d3 feat: add soundboard (#10536)
* feat: add soundboard

* chore: disable `jsdoc/check-param-names` rule

* fix: export `SoundboardSoundsAPI`
2024-11-04 10:03:13 +00:00
Pablo
ed78e45706 build: bump discord-api-types version (#10575)
* chore: bump discord-api-types version

* fix: delete extra file
2024-10-27 06:15:28 +00:00
Jiralite
b932b64d94 refactor: remove extra traversing (#10580)
* refactor: remove extra traversion

* refactor(GuildScheduledEventManager): address fetch
2024-10-25 09:39:47 +00:00
Jiralite
48a9c665de refactor(InteractionResponses)!: Remove ephemeral response option (#10564)
BREAKING CHANGE: MessagePayload#isInteraction no longer serves a purpose and has been removed.
BREAKING CHANGE: InteractionDeferReplyOptions no longer accepts ephemeral. Use flags instead.
BREAKING CHANGE: InteractionReplyOptions no longer accepts ephemeral. Use flags instead.
2024-10-22 09:10:30 +03:00
Qjuh
6cbe2487bc fix: missing tsdocConfig in api.json preventing index generation (#10565) 2024-10-19 21:34:51 +02:00
Qjuh
3540c3176c feat(website): type parameters links, builtin doc links, default values (#10515)
* feat(website): links to type parameters, builtin doc links in api.json

* feat(website): show default values for params and props in excerpt

* fix: link in jsdoc

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-10-19 00:04:01 +00:00
Qjuh
93b84ae7a6 refactor!: fix several issues with /ws incorporation (#10556)
BREAKING CHANGE: `Client#ping` is nullable now
2024-10-19 00:53:56 +01:00
Vlad Frangu
a9c92efba1 chore: make semver:major block kodiak (#10548)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-10-18 23:44:44 +00:00
Qjuh
62fb9de9c9 docs: allow @mixes TSDoc tag for documenting mixins (#10545) 2024-10-16 02:31:04 +02:00
almeidx
960a80dbae docs(Client): fix incorrect managers descriptions
Co-authored-by: Luna <84203950+Wolvinny@users.noreply.github.com>
2024-10-12 01:11:56 +03:00
almeidx
b16d851770 revert: docs: fix incorrect managers descriptions (#10519)
This reverts commit eded459335.
2024-10-12 01:11:56 +03:00
Luna
eded459335 docs(Client): fix incorrect managers descriptions (#10519)
* Edit manager descriptions

Some managers had incorrect descriptions, which applied only to the cache of the manager

* Update Client.js

* remove trailing space
2024-10-11 20:54:55 +00:00
Naiyar
79423c80b4 refactor!: exclude removed events from their enum (#10547)
BREAKING CHANGE: Removed the following members from `Events` enum: `Raw`, `ShardResume`, `ShardError`, `ShardReady`, `ShardReconnecting`, `ShardResume`, `ShardDisconnect`

BREAKING CHANGE: Removed `Reconnecting` from `ShardEvents` enum
2024-10-11 10:44:57 +03:00
Eejit
1925c11a48 fix(GuildScheduledEvent): handle null recurrence_rule (#10543)
* fix(GuildScheduledEvent): handle null recurrence_rule

* refactor: consistency

* feat: implement suggested logic change

* fix: correct data.recurrence_rule check

---------

Co-authored-by: Almeida <github@almeidx.dev>
2024-10-11 04:24:08 +00:00
Denis Cristea
c36728a814 fix(Client): never pass token in ws constructor (#10544)
* fix(Client): never pass token in ws constructor

* chore: don't reassign parameter

Co-authored-by: Almeida <github@almeidx.dev>

---------

Co-authored-by: Almeida <github@almeidx.dev>
2024-10-09 10:49:27 +00:00
Naiyar
c8ef899a68 refactor(NewsChannel)!: rename NewsChannel to AnnouncementChannel (#10532)
BREAKING CHANGE: The `NewsChannel` class was renamed to `AnnouncementChannel`, in line with the type name change
2024-10-09 12:35:12 +03:00
Qjuh
a65c762950 refactor!: fully integrate /ws into mainlib (#10420)
BREAKING CHANGE: `Client#ws` is now a `@discordjs/ws#WebSocketManager`
BREAKING CHANGE: `WebSocketManager` and `WebSocketShard` are now re-exports from `@discordjs/ws`
BREAKING CHANGE: Removed the `WebSocketShardEvents` enum
BREAKING CHANGE: Renamed the `Client#ready` event to `Client#clientReady` event to not confuse it with the gateway `READY` event
BREAKING CHANGE: Added `Client#ping` to replace the old `WebSocketManager#ping`
BREAKING CHANGE: Removed the `Shard#reconnecting` event which wasn’t emitted anymore since 14.8.0 anyway
BREAKING CHANGE: Removed `ShardClientUtil#ids` and `ShardClientUtil#count` in favor of `Client#ws#getShardIds()` and `Client#ws#getShardCount()`
BREAKING CHANGE: `ClientUser#setPresence()` and `ClientPresence#set()` now return a Promise which resolves when the gateway call was sent successfully
BREAKING CHANGE: Removed `Guild#shard` as `WebSocketShard`s are now handled by `@discordjs/ws`
BREAKING CHANGE: Removed the following deprecated `Client` events: `raw`, `shardDisconnect`, `shardError`, `shardReady`, `shardReconnecting`, `shardResume` in favor of events from `@discordjs/ws#WebSocketManager`
BREAKING CHANGE: Removed `ClientOptions#shards` and `ClientOptions#shardCount` in favor of `ClientOptions#ws#shardIds` and `ClientOptions#ws#shardCount`
2024-10-08 22:41:25 +01:00
Denis Cristea
8ab4124ef9 feat: implement zod-validation-error (#10534)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-10-06 14:43:06 +00:00
pat
24128a3c45 test: replace jest with vitest (#10472)
* chore: vitest config

* feat: vitest

* fix: do not actually create ws

* chore: config

* chore: lockfile

* chore: revert downgrade, up node

* chore: package - 'git add -A'

* chore: delete mock-socket

* chore: delete mock-socket

* fix: lockfile

---------

Co-authored-by: almeidx <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-10-06 14:26:53 +00:00
Amgelo563
bb04e09f8b types: remove newMessage partial on messageUpdate event typing (#10526)
* types: remove newMessage partial on messageUpdate event typing

* types: omit partial group DM for newMessage on messageUpdate

* types: omit partial group DM for oldMessage on messageUpdate

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-10-06 14:23:44 +00:00
Danial Raza
04df3c4130 feat: add linked roles formatters (#10461)
* feat: add linked roles formatters

* docs: requested changes

Co-authored-by: Almeida <github@almeidx.dev>

* docs: remove locale

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-10-06 14:19:50 +00:00
Denis Cristea
12e510671b chore!: remove all deprecated features/props (#10421)
BREAKING CHANGE: Removed `Client#fetchPremiumStickerPacks` method
BREAKING CHANGE: Removed `Client#webhookUpdate` event
BREAKING CHANGE: Removed various error codes
BREAKING CHANGE: Removed `Formatters` namespace
BREAKING CHANGE: Removed `InviteStageInstance` class
BREAKING CHANGE: Removed `Invite#stageInstance` property
BREAKING CHANGE: Removed `StageInstance#discoverable_disabled` property
BREAKING CHANGE: Removed `SelectMenuBuilder` alias
BREAKING CHANGE: Removed `SelectMenuComponent` alias
BREAKING CHANGE: Removed `SelectMenuInteraction` alias
BREAKING CHANGE: Removed `SelectMenuOptionBuilder` alias
BREAKING CHANGE: Removed `BaseInteraction#isSelectMenu` alias
BREAKING CHANGE: Removed `deleteMessageDays` option from `GuildBanManager#create`
BREAKING CHANGE: Removed `ActionRow#from` method
BREAKING CHANGE: Removed `Emoji#url` getter
BREAKING CHANGE: Removed `TeamMember#permissions` property
BREAKING CHANGE: Removed `User#avatarDecoration` property
BREAKING CHANGE: Removed `InteractionResponses#sendPremiumRequired` method
BREAKING CHANGE: Removed `DeletableMessageTypes` constant
2024-10-04 14:17:34 +03:00
Superchupu
c1b849fa5a docs(discord.js): remove utf-8-validate (#10531) 2024-10-03 18:10:46 +00:00
René
b339a7cb08 fix(ThreadMember): remove audit log reason parameter (#10023)
fix(ThreadMember): remove audit log reason

Co-authored-by: René <Renegade334@users.noreply.github.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-10-01 16:33:25 +00:00
MrMythicalYT
05541d8288 fix(User): remove fetchFlags() (#8755)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-10-01 16:29:31 +00:00
Rodrigo Leitão
493a079fdf refactor(CommandInteractionOptionResolver): remove getFull from getFocused() (#9789)
* refactor(CommandInteractionOptionResolver): remove getFull from getFocused()

* docs: update return type

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-10-01 16:21:42 +00:00
Denis Cristea
ab32f26cbb refactor: builders (#10448)
BREAKING CHANGE: formatters export removed (prev. deprecated)
BREAKING CHANGE: `SelectMenuBuilder` and `SelectMenuOptionBuilder` have been removed (prev. deprecated)
BREAKING CHANGE: `EmbedBuilder` no longer takes camalCase options
BREAKING CHANGE: `ActionRowBuilder` now has specialized `[add/set]X` methods as opposed to the current `[add/set]Components`
BREAKING CHANGE: Removed `equals` methods
BREAKING CHANGE: Sapphire -> zod for validation
BREAKING CHANGE: Removed the ability to pass `null`/`undefined` to clear fields, use `clearX()` instead
BREAKING CHANGE: Renamed all "slash command" symbols to instead use "chat input command"
BREAKING CHANGE: Removed `ContextMenuCommandBuilder` in favor of `MessageCommandBuilder` and `UserCommandBuilder`
BREAKING CHANGE: Removed support for passing the "string key"s of enums
BREAKING CHANGE: Removed `Button` class in favor for specialized classes depending on the style
BREAKING CHANGE: Removed nested `addX` styled-methods in favor of plural `addXs`

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
Co-authored-by: Almeida <github@almeidx.dev>
2024-10-01 19:11:56 +03:00
Moebits
c633d5c7f6 feat: Add ApplicationEmoji to EmojiResolvable and MessageReaction#emoji (#10477)
* types: add ApplicationEmoji to EmojiResolvable

* typings: add ApplicationEmoji to MessageReaction#emoji

* removed ApplicationEmoji from MessageReaction

* update BaseGuildEmojiManager

* chore: lint error

* feat: add ApplicationEmoji to MessageReaction#emoji getter

* refactor: check application emojis first

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-10-01 12:33:40 +00:00
Qjuh
b20346f430 chore: unpin discord-api-types (#10524)
* chore: unpin discord-api-types

* chore: bump discord-api-types
2024-10-01 10:07:58 +00:00
Almeida
9aa3b635ef feat: recurring scheduled events (#10447)
* feat: recurring scheduled events

* fix: nullable on patch

* docs: remove unnecessary parenthesis

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>

---------

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2024-09-29 18:41:57 +00:00
TÆMBØ
e1012cc54a feat: message forwarding (#10464)
* feat: message forwarding

* fix: redundant usage

* feat: add additional snapshot fields

* refactor: use collection to store snapshots

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-09-29 11:35:40 +00:00
Vlad Frangu
0873f9a4c3 chore(discord.js): release discord.js@14.16.3 (#10522) 2024-09-29 11:20:02 +00:00
Ryan Munro
6c77fee41b fix(BaseInteraction): add missing props (#10517)
* fix(AutocompleteInteraction): add missing authorizingIntegrationOwners

* fix(AutocompleteInteraction): add missing context

* fix(AutocompleteInteraction): types

* fix: move to BaseInteraction

* fix: remove props from CommandInteraction

* Update packages/discord.js/typings/index.d.ts

Co-authored-by: Danial Raza <danialrazafb@gmail.com>

---------

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
Co-authored-by: Danial Raza <danialrazafb@gmail.com>
2024-09-23 14:13:14 +00:00
Danial Raza
cda8d88ad5 build: bump discord-api-types to 0.37.100 (#10488)
* build: bump discord-api-types to 0.37.100

* build: fix lockfile

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-09-17 09:15:00 +00:00
TÆMBØ
665bf1486a types(MessageEditOptions): Omit poll (#10509)
fix: creating poll from message edit

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-09-17 08:18:08 +00:00
Qjuh
99136d6be8 fix(website): nullable parameters on events (#10510) 2024-09-15 19:27:43 +00:00
ckohen
896dc8b21e chore: update cliff configs (#10471)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-09-15 17:58:21 +00:00
Qjuh
651f2d036a feat: show default values in docs (#10465) 2024-09-15 19:49:31 +02:00
Qjuh
2adee06b6e fix: GuildChannel#guildId not being patched to undefined (#10505)
* fix: `GuildChannel#guildId` not being patched to `undefined`

* fix: guildId to guild_id check
2024-09-14 17:14:03 +00:00
Almeida
495bc60345 fix: docs search (#10501) 2024-09-12 23:24:07 +02:00
Vlad Frangu
d9d578391a chore(discord.js): release discord.js@14.16.2 (#10500) 2024-09-12 11:18:05 +03:00
Ryan Munro
3c74aa2049 fix(ApplicationCommand): incorrect comparison in equals method (#10497) 2024-09-11 07:40:54 +00:00
Danial Raza
799fa54fa4 docs: update discord documentation links (#10484) 2024-09-10 19:23:53 +00:00
Denis Cristea
8a74f144ac chore: pin builders in discord.js (#10490) 2024-09-06 13:12:19 +00:00
Vlad Frangu
dea68400a3 fix: type guard for sendable text-based channels (#10482)
* fix: type-guard for sendable text-based channels

* chore: suggested change

* Update packages/discord.js/typings/index.test-d.ts

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>

* fix: make isSendable strictly check for `.send`

* fix: tests

---------

Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-09-06 07:16:38 +00:00
Danial Raza
c13f18e90e docs(Message): mark interaction as deprecated (#10481)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-09-04 22:22:10 +00:00
Qjuh
aff772c7aa types: export GroupDM helper type (#10478)
* types: export GroupDM helper type

* refactor: rename type

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-09-04 22:16:54 +00:00
Danial Raza
4594896b54 docs(ApplicationEmojiManager): fix fetch example (#10480)
* docs(ApplicationEmojiManager): fix fetch example

* docs: requested changes
2024-09-03 22:20:01 +00:00
Vlad Frangu
a11ff75631 chore(discord.js): release discord.js@14.16.1 (#10476) 2024-09-03 00:24:53 +03:00
Vlad Frangu
9257a09abb fix(Message): reacting returning undefined (#10475) 2024-09-03 00:20:16 +03:00
space
4810f7c863 fix(Transformers): pass client to recursive call (#10474) 2024-09-02 21:12:28 +00:00
Vlad Frangu
18ce10a9af chore: bump major releases to node 20 2024-09-02 22:26:25 +03:00
Vlad Frangu
ed1c1737df chore: everyone goes to node 18+ 2024-09-02 22:26:25 +03:00
Vlad Frangu
90ed51e06e chore: url fixing 2024-09-02 22:26:25 +03:00
Vlad Frangu
641a980b60 chore(discord.js): release discord.js@14.16.0 2024-09-02 22:26:25 +03:00
Vlad Frangu
1f2047ff90 chore(create-discord-app): update discord.js version for templates 2024-09-02 22:26:25 +03:00
Vlad Frangu
23636a9a2f chore: add versions mentions for versions with meta changes only 2024-09-02 22:26:25 +03:00
Vlad Frangu
6a6bc63973 chore: requested cleanup 2024-09-02 22:26:25 +03:00
Vlad Frangu
b715b7d653 chore: cleanup 2 2024-09-02 22:26:25 +03:00
Vlad Frangu
2cb2d81b82 chore: cleanup changelogs 2024-09-02 22:26:25 +03:00
Vlad Frangu
0411ce268e chore(create-discord-bot): fix changelog link 2024-09-02 22:26:25 +03:00
Vlad Frangu
584bd6f2fc chore(core): release @discordjs/core@2.0.0 2024-09-02 22:26:25 +03:00
Vlad Frangu
c887388db6 chore(ws): release @discordjs/ws@2.0.0 2024-09-02 22:26:25 +03:00
Vlad Frangu
4059432c78 chore(proxy): release @discordjs/proxy@2.1.1 2024-09-02 22:26:25 +03:00
Vlad Frangu
6b34486f3f chore(rest): release @discordjs/rest@2.4.0 2024-09-02 22:26:25 +03:00
Vlad Frangu
b3f3d54f18 chore(builders): release @discordjs/builders@1.9.0 2024-09-02 22:26:25 +03:00
Vlad Frangu
ea597aa886 chore(util): release @discordjs/util@1.1.1 2024-09-02 22:26:25 +03:00
Vlad Frangu
5e08ea68d2 chore(formatters): release @discordjs/formatters@0.5.0 2024-09-02 22:26:25 +03:00
Vlad Frangu
ec7b20f51d chore(create-discord-bot): release create-discord-bot@0.3.1 2024-09-02 22:26:25 +03:00
Vlad Frangu
74df5c7fa4 chore(collection): release @discordjs/collection@2.1.1 2024-09-02 22:26:25 +03:00
Vlad Frangu
cec816f9f5 chore(brokers): release @discordjs/brokers@1.0.0 2024-09-02 22:26:25 +03:00
Vlad Frangu
3979f0b6e6 chore: add in more data to changelog entries (#10470)
* chore: add in more data to changelog entries

* chore: missed template
2024-09-02 09:26:08 +00:00
TÆMBØ
13dc779029 fix: message reaction crash (#10469) 2024-09-02 07:46:05 +00:00
Synbulat Biishev
fc0b6f7f8e feat: user-installable apps (#10227)
* feat: inital user-installable apps support

* docs: add deprecation warnings

* feat: add equality checks

* fix: possibly `null` cases

* docs: tweaks

* docs: add deprecations

* fix(ApplicationCommandManager): amend transform command

* feat: properly support `integration_types_config`

* docs: add .

* docs: minor changes

* featBaseApplicationCommandData): update type

* style: prettier

* chore: fix issues

* fix: correct casing

Co-authored-by: Superchupu <53496941+SuperchupuDev@users.noreply.github.com>

* refactor: remove console log

* fix: use case that satisfies `/core` and the API

* fix: `oauth2InstallParams` property is not nullable

* fix: do not convert keys into strings

* feat: update transforer to return the full map

* feat: update transformers

* feat: add `PartialGroupDMMessageManager `

Hope this is not a breaking change

* docs: fix type

* feat: add approximate count of users property

* fix: messageCreate doesn't emit in PartialGroupDMChannel

* fix: add GroupDM to TextBasedChannelTypes

* feat: add NonPartialGroupDMChannel helper

* fix: expect PartialGroupDMChannel

* feat: narrow generic type

* test: exclude PartialGroupDMChannel

* feat: use structure's channel type

* docs: narrow type

* feat: remove transformer

* refactor: remove unnecessary parse

* feat: add APIAutoModerationAction transformer

* fix: use the right transformer during recursive parsing of interaction metadata

* docs: add external types

* docs: add `Message#interactionMetadata` property docs

* docs: make nullable

* docs: add d-docs link

* docs: use optional

* fix: make `oauth2InstallParams` nullable

* types: update `IntegrationTypesConfiguration`

Co-authored-by: Almeida <github@almeidx.dev>

* docs: update `IntegrationTypesConfigurationParameters`

Co-authored-by: Almeida <github@almeidx.dev>

* types: update `IntegrationTypesConfigurationParameters`

* refactor: improve readability

* docs: mark integrationTypesConfig nullable

* refactor: requested changes

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Superchupu <53496941+SuperchupuDev@users.noreply.github.com>
Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
Co-authored-by: Almeida <github@almeidx.dev>
2024-09-01 20:44:51 +00:00
Jaw0r3k
a5afc406b9 feat: super reactions (#9336)
* feat: super reactions

* docs: Touch-up

* feat: count super reactions in events

* feat: document me_burst property

Co-authored-by: Danial Raza <danialrazafb@gmail.com>

* feat: document type query for fetching reaction users

* fix: cover case when burstColors can be undefined at init of a reaction

* Update packages/discord.js/src/structures/MessageReaction.js

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>

* chore: futureproof so use an object

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Danial Raza <danialrazafb@gmail.com>
Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2024-08-27 22:30:16 +00:00
Jeroen Claassens
437437461e chore: bump to @favware/cliff-jumper v4.1.0 and fix changelog generation (#10459)
* chore: bump to @favware/cliff-jumper v4

* chore: cleanup changelogs

* chore: set `topo_order` to `false` for cliff config

* chore: clean cliff.toml diffs

* chore(changelog): fix missing / incorrect entries
2024-08-24 13:06:35 +00:00
Almeida
e2e71b4d09 build: bump dependencies (#10457)
* build: bump `@vladfrangu/async_event_emitter`

* chore: bump again + fixes

* build: bump types/node and some dev deps

* build: bump discord-api-types again

* style: remove unused eslint-ignore comment

* build: sync dependencies and update templates

* build: bump turbo

* build: vercel + vitest

* build: bump undici

---------

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
2024-08-22 17:33:35 +02:00
Luna
bddf018f26 docs: correct documentation for BaseInteraction#inCachedGuild (#10456)
* Update BaseInteraction.js

inCachedGuild typeguard had incorrect wording

* docs: wording

---------

Co-authored-by: Almeida <github@almeidx.dev>
2024-08-22 13:05:22 +00:00
Almeida
ec9080b883 ci: skip coverage upload on missing files (#10453)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-22 11:55:02 +00:00
Almeida
bba0e72e22 refactor: use get guild role endpoint (#10443)
* refactor: use get guild role endpoint

* style: import order

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-21 22:14:33 +00:00
Almeida
00accf7470 fix: failed build in node and bad lints (#10444)
* fix: failed build in node and bad lints

* chore: update tsconfigs

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-20 22:40:37 +00:00
n1ck_pro
dd795da790 fix(MessagePayload): crash when resolving body (#10454)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-20 16:04:59 +00:00
Cat++
b0f8df0f6c fix(Shard): add env, execArgv, and argv for worker-based shards (#10429)
* fix(Shard): add env, execArgv, and argv to worker-based threads

* chore: remove process only docs assertion from certain shard options

* chore: update comments for Shard.js

* refactor: Use SHARE_ENV for worker shard's env

* chore: import order

---------

Co-authored-by: Cat++ <69035887+NotGhex@users.noreply.github.com>
2024-08-20 13:33:23 +00:00
Ron Buckton
bf83db9480 fix(build): update to support strictBuiltinIteratorReturn (#10394)
* fix(build): update to support strictBuiltinIteratorReturn

* types: assert Value to be identical to InitialValue

Co-authored-by: René <9092381+Renegade334@users.noreply.github.com>

---------

Co-authored-by: ckohen <chaikohen@gmail.com>
Co-authored-by: René <9092381+Renegade334@users.noreply.github.com>
Co-authored-by: Almeida <github@almeidx.dev>
2024-08-20 10:21:19 +00:00
Almeida
1b1ae2f0cb feat: use get sticker pack endpoint (#10445)
* feat: use get sticker pack endpoint

* fix: mark fetchPack as async

* style: resolve eslint warning

---------

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-20 10:13:26 +00:00
cobalt
1f7d1f8094 types: Use ThreadChannel and AnyThreadChannel consistently (#10181)
* types: Use `ThreadChannel` and `AnyThreadChannel` consistently

Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>

* types: use union in typeguard

Signed-off-by: cobalt <61329810+RedGuy12@users.noreply.github.com>

* types: update `AnyThreadChannel`

Signed-off-by: cobalt <61329810+RedGuy12@users.noreply.github.com>

* types: fix `CommandOptionResolver` tests

Signed-off-by: cobalt <61329810+RedGuy12@users.noreply.github.com>

* types: revert caches changes

Signed-off-by: cobalt <61329810+RedGuy12@users.noreply.github.com>

---------

Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Signed-off-by: cobalt <61329810+RedGuy12@users.noreply.github.com>
Co-authored-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Almeida <github@almeidx.dev>
2024-08-20 10:09:13 +00:00
Naiyar
9907ff915e feat(VoiceState): add methods for fetching voice state (#10442)
* feat(VoiceState): add methods for fetching voice state

* fix: links to new methods

* chore: remove unused import

* chore: use member id

* chore: requested changes

* chore: '@me' as fetch param

* chore: add ediUserVoiceState return type

* refactor: redirect function calls to VoiceAPI

---------

Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-20 10:02:17 +00:00
René
9b707f2b83 types(Client): EventEmitter static method overrides (#10360)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-20 09:52:36 +00:00
Danial Raza
5d92525596 feat: application emojis (#10399)
* feat: application emojis

* chore: requested changes

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-20 09:33:25 +00:00
René
45f7e1a2e8 fix(GuildAuditLogsEntry): correct mapped AuditLogChange objects (#10438)
* refactor(GuildAuditLogsEntry): correct mapped AuditLogChange objects

* test: check union narrowing behaviour of AuditLogChange

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-20 09:20:35 +00:00
Lars_und_so
69adc6f4b9 feat(OAuth2API): add revokeToken method (#10440)
* feat(OAuth2API): add 'revokeToken' method

* Buffer => btoa

Co-authored-by: Almeida <github@almeidx.dev>

* Response is empty, dont return

Co-authored-by: Almeida <github@almeidx.dev>

* Redundant override

Co-authored-by: Almeida <github@almeidx.dev>

* chore: fmt

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-20 09:02:53 +00:00
Naiyar
3d37660107 build: bump discord-api-types to 0.37.96 (#10452)
* build: bump discord-api-types to 0.37.95

* feat: Add support for Automated Message nonce handling (#10381)

* Add support for Automated Message nonce handling

* Fix options property

* Address PR feedback

* Handled case where it was explicitly set to false for that iteration to not generate a nonce, and PR feedback

* Fix lint issue

* Fix lint issue

* Move to MessagePayload.resolveBody instead

* Fix test errors

* Update packages/discord.js/src/structures/MessagePayload.js

Co-authored-by: Almeida <github@almeidx.dev>

* PR feedback

* Merge

* Let and not const

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Almeida <almeidx@pm.me>

* feat(Attachment): add `title` (#10423)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* types: Fix wrong auto moderation target type (#10391)

types: fix wrong auto moderation target type

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* feat(builders): update to @sapphire/shapeshift v4 (#10291)

feat: update to @sapphire/shapeshift v4

* refactor(actions): safer getChannel calls (#10434)

* refactor(actions): safer getChannel calls

* chore: consistency

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* build: bump discord-api-types tp 0.37.96

---------

Co-authored-by: Jacob Morrison <jake.morrison24@gmail.com>
Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: Danial Raza <danialrazafb@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Jeroen Claassens <support@favware.tech>
Co-authored-by: DD <didinele.dev@gmail.com>
2024-08-20 08:42:13 +00:00
DD
87776bb0e8 refactor(actions): safer getChannel calls (#10434)
* refactor(actions): safer getChannel calls

* chore: consistency

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-19 19:53:42 +00:00
Jeroen Claassens
2d5531f35c feat(builders): update to @sapphire/shapeshift v4 (#10291)
feat: update to @sapphire/shapeshift v4
2024-08-19 18:15:30 +00:00
Jiralite
bbef68d271 types: Fix wrong auto moderation target type (#10391)
types: fix wrong auto moderation target type

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-19 15:34:40 +00:00
Danial Raza
c63bde9479 feat(Attachment): add title (#10423)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-19 15:30:47 +00:00
Jacob Morrison
2ca187bd34 feat: Add support for Automated Message nonce handling (#10381)
* Add support for Automated Message nonce handling

* Fix options property

* Address PR feedback

* Handled case where it was explicitly set to false for that iteration to not generate a nonce, and PR feedback

* Fix lint issue

* Fix lint issue

* Move to MessagePayload.resolveBody instead

* Fix test errors

* Update packages/discord.js/src/structures/MessagePayload.js

Co-authored-by: Almeida <github@almeidx.dev>

* PR feedback

* Merge

* Let and not const

---------

Co-authored-by: Almeida <github@almeidx.dev>
Co-authored-by: Almeida <almeidx@pm.me>
2024-08-19 14:07:46 +00:00
Qjuh
8fb400827f fix(website): duplicate method in docs when interface merging (#10435) 2024-08-19 15:26:08 +02:00
Almeida
bb71dc825e build: bump discord-api-types to 0.37.94 (#10446) 2024-08-19 13:26:00 +00:00
DD
defb083528 fix(WebSocketShard): buffer native zlib decompression payload (#10416)
* fix(WebSocketShard): buffer native zlib decompression payload

* refactor: nit

Co-authored-by: Almeida <almeidx@pm.me>

---------

Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-15 16:15:08 +00:00
DD
a6de2707fc refactor(WebSocketShard): error event handling (#10436)
* refactor(WebSocketShard): error event handling

* chore: blehhhh :pppp

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-15 16:10:25 +00:00
Almeida
432e9b8425 chore: pin /ws version in discord.js (#10427) 2024-08-08 21:55:34 +00:00
ckohen
54303d085d chore: allow ! to indicate breaking changes (#10430)
* chore: allow `!` to indicate breaking changes

* chore: update commit convention too

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-08-08 21:50:20 +00:00
Almeida
5c90b7f716 revert: chore: deprecate client options presence (#10426)
Revert "chore: deprecate client options presence (#10419)"

This reverts commit 8f97d2bacf.
2024-08-06 18:21:10 +00:00
Qjuh
f623e7a315 fix(scripts): show name of inheriting class on search index (#10424)
* fix(scripts): show name of inheriting class on search index

* fix: sanity check
2024-08-03 20:45:21 +00:00
Qjuh
bb459d95e9 refactor(website): search index name of members includes class now (#10415) 2024-08-02 08:24:40 +00:00
Qjuh
48682ad474 ci: fix docs source url on tag push (#10398) 2024-07-31 19:56:54 +00:00
Vlad Frangu
057fc89c92 chore: update emails (#10364)
* chore: update Vlad's email

* chore: my email too

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-07-31 19:45:07 +00:00
Danial Raza
dc13324ddc build: bump discord-api-types to 0.37.93 (#10404)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-07-31 19:35:01 +00:00
DD
de94eaf351 feat(WebsocketManager): retroactive token setting (#10418)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-07-31 11:46:39 +00:00
DD
8f97d2bacf chore: deprecate client options presence (#10419)
* chore: deprecate client options presence

* chore: deprecate in typings

* fix: actually use the new prop

* chore: nit

Co-authored-by: Almeida <almeidx@pm.me>

* fix: use correct prop

---------

Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-07-31 11:20:49 +00:00
DD
5eabec14d4 fix(WebSocketManager): heartbeat event had outdated types (#10417) 2024-07-31 07:40:36 +00:00
Jiralite
785ec8fd75 docs: Lowercase "image" URL (#10386)
docs: lowercase i

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-07-28 13:44:05 +00:00
René
6b383350a6 types(collection): reduce* method signatures (#10405)
* types(collection): reduce* method signatures

* test: explicit expect() types

* test: add tests for arbitrary accumulator type

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-07-28 13:37:45 +00:00
DD
bf6761a44a refactor(ws): event layout (#10376)
* refactor(ws): event layout

BREAKING CHANGE: All events now emit shard id as its own param

* fix: worker event forwarding

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-07-24 18:40:34 +00:00
Danial Raza
fcd35ea2e7 feat: add subtext formatter (#10400)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-07-24 10:23:55 +00:00
Amgelo563
b2970bb2dd feat(SlashCommandBuilder): Add explicit command type when building (#10395)
* feat(SlashCommandBuilder): add explicit command type when building

* test: add tests

* chore: merge import

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: almeidx <github@almeidx.dev>
2024-07-21 15:08:24 +00:00
Qjuh
efa16a6095 fix(website): links to enum members from excerpts (#10388) 2024-07-13 18:06:25 +00:00
DD
be04acd534 fix: retry for EAI_AGAIN I/O error (#10383) 2024-07-11 12:53:49 +00:00
Jiralite
9461045e5a refactor(GuildChannelManager): Remove redundant edit code (#10370)
refactor(GuildChannelManager): remove redundant edit code

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-07-10 13:41:04 +00:00
Almeida
3654efede2 feat(GuildAuditLogsEntry): onboarding events (#9726)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-07-09 18:58:11 +00:00
Almeida
d8e94d8f10 test: complete collection coverage (#10380) 2024-07-06 20:32:01 +00:00
Jiralite
4f59b740d0 feat: Premium buttons (#10353)
* feat: premium buttons

* docs: deprecation string

* feat(InteractionResponses): add deprecation message

* feat(builders): add tests

* chore: remove @ts-expect-errors

* test: update method name

* refactor(formatters): stricter types

* docs: deprecate method in typings

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-07-04 18:57:35 +00:00
DD
093ac924ae feat(WebSocketShard): explicit time out network error handling (#10375)
* feat(WebSocketShard): explicit time out network error handling

* refactor: use constant
2024-07-02 20:25:22 +00:00
Jiralite
ab8bf0f4d2 fix(GuildMemberManager): Fix data type check for add() method (#10338)
fix(GuildMemberManager): fix data type check

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-06-29 06:48:32 +00:00
TÆMBØ
9c76bbea17 feat: add user-installable apps support (#10348)
* feat(SlashCommandBuilder): `addContexts()` and `addIntegrationTypes()`

* Add methods to ContextMenuCommandbuilder

* Fix JSDoc

* Use `setX` over `addX`

* Fix tests

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-06-27 18:56:47 +00:00
Jiralite
b8397b24e5 types(ApplicationCommandManager): Snowflake fetch (#10366) 2024-06-27 11:27:59 +00:00
Jiralite
ba0cb66ff9 chore: Remove "typings", "wip", and "workflow" scope (#10340)
* chore: remove "typings" commit lint

* chore: remove "workflow" too

* chore: also remove wip

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-06-18 18:42:35 +00:00
Jiralite
15021990e8 build: Bump discord-api-types to 0.37.90 (#10354)
build: bump discord-api-types

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-06-18 18:37:16 +00:00
Adnan Khan
a76b1b60f7 ci: Reference title via environment variable (#10342)
Reference title via environment variable.

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-06-18 18:30:41 +00:00
DD
9c8784fe51 fix: package gen script (#10352)
* fix: package gen script

* fix: files without extensions didn't have handlebars stripped

* chore: requested change
2024-06-18 09:55:02 +00:00
Qjuh
b0e57126dc fix(website): link tags to events named same as methods (#10351)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-06-17 13:26:58 +00:00
Qjuh
e723230dff fix(website): link tags with explicit URL showed undefined (#10350) 2024-06-16 12:57:30 +00:00
Jiralite
38c699bc8a fix: Consistent debug log spacing (#10349)
* fix: consistent debug log spacing

* refactor: simplify formatting

* refactor: more readable ternary

Co-Authored-By: Synbulat Biishev <contact@syjalo.dev>

* fix: modify parameters and types

---------

Co-authored-by: Synbulat Biishev <contact@syjalo.dev>
2024-06-13 16:07:37 +00:00
Qjuh
c5d40d3807 fix(website): remove merged interface from sitemap (#10343) 2024-06-09 19:07:33 +00:00
Jiralite
02d196474a ci(pr-triage): Split job up (#10341)
ci: split job up
2024-06-09 01:31:01 +00:00
Danial Raza
68031210f5 feat(Message): add call (#10283)
* feat(Message): add `call`

* refactor: make `endedAt` a getter

* types: fix `endedAt` return type

* types(Message): add `call` property

* docs: requested changes

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-06-08 20:30:21 +00:00
Jiralite
3cdddbe31d ci: Check pull request titles for the commit convention format (#10334)
ci: check pull request titles
2024-06-08 20:04:17 +00:00
Jiralite
757bed0b1f docs: Update rule trigger types (#9708)
docs: update rule trigger types
2024-06-07 22:04:56 +00:00
Jiralite
599ad3eab5 fix: Correct base path for GIF stickers (#10330)
* fix: correct base path for GIF stickers

* test: add sticker GIF

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-06-07 15:19:37 +00:00
Amir Farzamnia
7f60a8fc5d docs(stageInstances): Correct reference for stage instance creation (#10333)
Update stageInstances.ts

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-06-07 15:11:23 +00:00
Jiralite
885defbce4 fix: Update config file to address labeller file changes (#10332)
fix: update label script
2024-06-07 13:38:08 +00:00
ckohen
4f174c644d ci: fix coverage upload (#10331) 2024-06-07 12:24:02 +00:00
Jiralite
346d1be72b build: Bump dependencies (#10322)
* build: bump dependencies

* build: update pnpm to 9.1.4
2024-06-05 09:42:33 +00:00
Danial Raza
94cc02a258 refactor: native zlib support (#10316)
Revert "revert: refactor: native zlib support (#10314)"

This reverts commit 4ea73bb64e.

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-06-02 22:51:26 +00:00
Danial Raza
17d4c78fde feat(Invite): add type (#10280) 2024-06-02 22:43:14 +00:00
Almeida
3b5c600b9e feat(User): add avatarDecorationData (#9888)
* feat(User): add `avatarDecorationData`

* fix: remove options

* fix(User): check avatar decoration in equals() methods

* docs: Add full reference

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-06-02 21:26:31 +00:00
Jiralite
311aaf2605 chore(release): @discordjs/builders 1.8.2, @discordjs/ws 1.1.1, and discord.js 14.15.3 (#10315)
Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
2024-06-03 00:13:41 +03:00
Jiralite
4ea73bb64e revert: refactor: native zlib support (#10314)
Revert "refactor: native zlib support (#10243)"

This reverts commit 20258f94bf.
2024-06-02 19:53:31 +00:00
CodeGoat
aae2faf9e9 docs(SelectMenuBuilder): correct grammatical errors (#10309)
docs(SelectMenuBuilder): correct documentation

Corrects gramatical errors in the documentation for various set methods.

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-06-02 15:19:11 +00:00
Dylan Yang
9b07036d70 fix(OAuth2API): enable token exchange without token (#10312)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-06-02 13:21:48 +00:00
CodeGoat
c1e6890132 docs(TextInputBuilder): correct constructor documentation (#10308)
feat(builders): fix text input docs

Fixes incorrect references to select menu options in text input docs.

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-06-02 12:42:11 +00:00
Nitzan Savion
38a37b5caf refactor(brokers): re-design API to make groups a constructor option (#10297)
* fix(BaseRedis): remove listeners on destroy and stop pooling when no subscription

* refactor(BaseRedis): group as constructor param and cleanup subscribers

* fix(BaseRedis): remove listeners on destroy and stop pooling when no subscription

* refactor(BaseRedis): group as constructor param and cleanup subscribers

* chore(RPCRedis): group

* Update packages/brokers/src/brokers/Broker.ts

* Update packages/brokers/src/brokers/Broker.ts

* Update packages/brokers/src/brokers/redis/BaseRedis.ts

Removed `removeAllListeners` from destroy

* chore(BaseRedis): destroy unsubscribe spread array

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-06-02 12:35:16 +00:00
CodeGoat
29a50bb476 docs(MappedComponentTypes): fix "inpiut" typo (#10306)
* Fix typo in components

Fixes a typo in components.

* docs: an -> a

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-05-30 22:41:43 +00:00
iCrawl
d22b55fc82 fix: restore 404 page 2024-05-26 18:43:34 +02:00
Danial Raza
a468ae8bb5 fix(Message): properly compare attachments and embeds (#10282)
* fix(Message): properly compare `attachments` and `embeds`

* refactor: use `has` instead of `get`

* refactor: keep length checks

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-05-24 14:19:28 +00:00
Jiralite
638b896efa fix: Throw error on no message id for Message#fetchReference() (#10295)
* docs(MessageReference): ? is nullable, not `undefined`

* docs(MessageReference): sort by message type

* fix(Message): add throw

* docs(MessageReference): fix English

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-05-24 13:09:59 +00:00
ducktrshessami
27d0659a45 fix(ThreadChannel): invalid owner fetch option (#10292)
fix(ThreadChannel): invalid owner fetch options

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-05-24 11:06:27 +00:00
iCrawl
a35d760421 fix: prerender bailout 2024-05-24 02:10:07 +02:00
iCrawl
7f467ed2d1 feat: error handling 2024-05-24 01:57:50 +02:00
iCrawl
f5dd6879a2 chore: /ui react type dep 2024-05-24 01:55:14 +02:00
iCrawl
f9ba11eba3 chore: update nextjs 2024-05-24 01:47:07 +02:00
Danial Raza
b36ec98382 feat: add reason to followAnnouncements method (#10275)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-05-19 09:58:26 +00:00
iCrawl
bb884fc260 chore: react compiler 2024-05-19 03:44:42 +02:00
René
555961b3b8 refactor(GuildChannelManager): improve addFollower errors (#10277)
refactor(GuildChannelManager): improve errors

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-05-17 13:14:03 +00:00
Jiralite
92c1a511dc fix(Action): Ensure all properties on getChannel() are passed (#10278)
* fix(Action): ensure all properties on `getChannel()` are passed

* refactor: flip `recipient` check
2024-05-16 07:27:00 +00:00
cobalt
35207b0b31 types: Forum starter messages do not support polls (#10276)
fix(types): Forums do not support polls

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-05-15 17:43:31 +00:00
TÆMBØ
29fd89f23c fix(SlashCommandBuilder): add missing shared properties (#10255)
* types(SlashCommandBuilder): add missing shared properties

* Add tests for types

* Fix formatting

* Enable Vitest type checking

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-05-15 17:36:02 +00:00
Frank
c2432d5704 types: Add defaultValues to respective select menu components data (#10265)
* Update index.d.ts

Added 'defaultValues' typings for ChannelSelectMenuComponentData, RoleSelectMenuComponentData, and UserSelectMenuComponentData.

* Update index.d.ts

Adding 'defaultValues' typing to MentionableSelectMenuComponentData

* style: prettier

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-05-13 13:29:16 +00:00
DD
616208ba77 fix: deno compat (#10271)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2024-05-13 12:04:01 +00:00
Jiralite
3640fe7bca ci: Fix labels action (#10272)
ci: fix labels action
2024-05-13 13:59:56 +02:00
Jiralite
c78af13c1e ci: Update versions of actions (#10270)
* ci: update versions of actions

* ci: attempt fix
2024-05-13 11:35:25 +02:00
Qjuh
914cc4ba54 fix(docs): some link tags didn't resolve correctly (#10269)
* fix(docs): some link tags didn't resolve in summaries

* fix: add TextBasedChannels type
2024-05-13 09:34:11 +00:00
DD
393ded4ea1 refactor(brokers): make option props more correct (#10242)
* refactor(brokers): make option props more correct

BREAKING CHANGE: Classes now take redis client as standalone parameter, various props from the base option interface moved to redis options

* chore: update comment

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-05-11 15:54:06 +00:00
DD
20258f94bf refactor: native zlib support (#10243)
* refactor: remove zlib-sync

* fix: bad length check

* refactor: support both options

BREAKING CHANGE: renamed compression related options

* chore: fix doc comment

* chore: update debug messages

* chore: better wording

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* chore: suggested changes

* chore: better naming

* refactor: lazy node:zlib import and lib detection

* chore: zlib capitalization

* fix: use proper var

* refactor: better inflate check

Co-authored-by: Aura <kyradiscord@gmail.com>

* chore: debug label

Co-authored-by: Superchupu <53496941+SuperchupuDev@users.noreply.github.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Aura <kyradiscord@gmail.com>
Co-authored-by: Superchupu <53496941+SuperchupuDev@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-05-11 15:32:05 +00:00
Jiralite
7816ec2e6b fix(actions): Handle missing poll object (#10266)
fix(actions): handle missing poll object

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-05-11 08:45:59 +00:00
Qjuh
5498e18bf4 fix(website): links to builtin documentation not showing in summary (#10267) 2024-05-10 20:38:43 +00:00
Qjuh
e673b3c129 fix: add inherited properties to search index (#10257) 2024-05-06 17:30:06 +00:00
Vlad Frangu
776880d06b chore: fix changelogs 2024-05-05 21:00:59 +03:00
Vlad Frangu
c05244af61 chore(discord.js): release discord.js@14.15.2 2024-05-05 21:00:59 +03:00
Vlad Frangu
12deea85e5 chore(builders): release @discordjs/builders@1.8.1 2024-05-05 21:00:59 +03:00
Qjuh
07c12101e5 fix: slashcommand builder type split (#10253) 2024-05-05 10:03:14 +00:00
XCraftTM
30d79e85fb fix(PollAnswer): fetchVoters route changed to MessageManager (#10251)
Update PollAnswer.js
2024-05-04 21:18:04 +00:00
Vlad Frangu
f2794e1221 chore(discord.js): release discord.js@14.15.1 (#10250)
* chore(discord.js): release discord.js@14.15.1

* chore: fix changelog

* chore: update link
2024-05-04 19:18:07 +00:00
DD
0474a43751 fix(MessageManager): poll methods don't need a channel id (#10249)
* fix(MessageManager): end poll does not need channel id

* chore: rest of the work
2024-05-04 19:06:03 +00:00
Almeida
c91d03c535 ci: fix documentation workflow (#10248) 2024-05-04 18:18:45 +00:00
Vlad Frangu
d92695cdd6 chore: brother why 2024-05-04 20:50:15 +03:00
Vlad Frangu
1d27b3bde0 chore: fix duplicated discord.js changelog 2024-05-04 20:50:15 +03:00
Vlad Frangu
903a7d3404 chore: fix duplicated voice changelog 2024-05-04 20:50:15 +03:00
Vlad Frangu
840dc565cd chore: update templates for create-discord-bot 2024-05-04 20:50:15 +03:00
Vlad Frangu
a84086194e chore(discord.js): release discord.js@14.15.0 2024-05-04 20:50:15 +03:00
Vlad Frangu
b66c067dd7 chore(core): release @discordjs/core@1.2.0 2024-05-04 20:50:15 +03:00
Vlad Frangu
e9d560f128 chore(ws): release @discordjs/ws@1.1.0 2024-05-04 20:50:15 +03:00
Vlad Frangu
6f986886c5 chore(proxy): release @discordjs/proxy@2.1.0 2024-05-04 20:50:15 +03:00
Vlad Frangu
7b913b674f chore(rest): release @discordjs/rest@2.3.0 2024-05-04 20:50:15 +03:00
Vlad Frangu
7dc51aa935 chore(builders): release @discordjs/builders@1.8.0 2024-05-04 20:50:15 +03:00
Vlad Frangu
16df4f3c38 chore(voice): release @discordjs/voice@0.17.0 2024-05-04 20:50:15 +03:00
Vlad Frangu
6239f24f19 chore(util): release @discordjs/util@1.1.0 2024-05-04 20:50:15 +03:00
Vlad Frangu
92501ae343 chore(formatters): release @discordjs/formatters@0.4.0 2024-05-04 20:50:15 +03:00
Vlad Frangu
35f2b3a8c9 chore(create-discord-bot): release create-discord-bot@0.3.0 2024-05-04 20:50:15 +03:00
Vlad Frangu
23ed447ec2 chore(collection): release @discordjs/collection@2.1.0 2024-05-04 20:50:15 +03:00
Vlad Frangu
5d61197ca3 chore(brokers): release @discordjs/brokers@0.3.0 2024-05-04 20:50:15 +03:00
Almeida
a6b9f1b37e fix(Message): not crosspostable if has a poll (#10246) 2024-05-04 16:21:04 +00:00
Jacob Morrison
cb961f5be3 types: add Poll to Message (#10245)
* Add poll to message type

* Add poll to message type without whitespace changes
2024-05-04 16:06:16 +00:00
codershiba
96169add6d docs: Remove duplicate word in comment (#10244)
* fix: Remove duplicate word in comment

* Update README.md

not part of the typo

---------

Co-authored-by: Souji <timoqueezle@gmail.com>
2024-05-04 08:33:24 +00:00
DD
728164ed86 feat(ws): support for custom worker messaging (#10241) 2024-05-03 14:53:09 +00:00
Almeida
6cf094c282 feat(MessageManager): poll methods (#10239)
* feat(MessageManager): poll methods

* docs: wording

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-05-02 20:54:00 +00:00
Almeida
997887069a feat: consumable entitlements (#10235)
* feat: consumable entitlements

* feat: move logic to EntitlementManager

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-05-01 17:57:25 +00:00
Almeida
a1aeaeb9d8 feat: polls (#10185)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-04-30 23:21:07 +00:00
Almeida
c7adce351a build: bump discord-api-types to 0.37.83 (#10238)
build: bump discord-api-types to 0.37.82
2024-04-30 23:04:00 +00:00
Parbez
7ea3638dbc fix: don't mutate user provided array (#10014)
* fix(builders): don't mutate user provided array

* test: add normalize array tests

* chore: revert vscode autochange

* Update util.test.ts

* refactor: remove unnecessary clone

---------

Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Almeida <github@almeidx.dev>
2024-04-30 20:46:21 +00:00
DD
798f28cb9b fix(actions): always emit message create for own messages (#10211)
* fix(actions): always emit message create for own messages

* fix: don't re-cache

* fix: user can be missing

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-04-27 22:37:16 +00:00
Synbulat Biishev
14f9ff7412 chore: Add funding field to package.json (#10230)
* chore: funding

* chore: one more package.json

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-04-27 17:26:11 +00:00
Almeida
c2e68ceaad build: bump discord-api-types to 0.37.82 (#10226)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-04-27 17:16:20 +00:00
Almeida
dc8f14967c test: skip flaky rest test (#10234) 2024-04-27 19:11:03 +02:00
Qjuh
b79b7068e9 fix(api-extractor-model): resolve doc reference for classes with merged interfaces (#10225)
fix(api-extractor-model): resolve doc reference with merged interfaces
2024-04-27 16:35:25 +02:00
Synbulat Biishev
dae897bd09 ci: optimize tests (#10231)
chore: optimize tests
2024-04-27 16:34:58 +02:00
Jacob Morrison
4ad285804b perf(Presence): prefer boolean client status comparison before activity checks (#10213)
Prefer boolean client status comparison before activity checks

Co-authored-by: Jacob Morrison <jake@matchmd.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-04-20 23:08:26 +00:00
iCrawl
6759f5b9c5 chore: deps 2024-04-16 21:44:21 +02:00
Qjuh
c6721d9aa7 fix(api-extractor): link class in docs if interface merging happened (#10217) 2024-04-16 21:34:43 +02:00
Qjuh
1c5de21a29 feat(api-extractor): support export * as ___ syntax (#10173)
* feat(api-extractor): support `export * as ___` syntax

* fix: typescript version
2024-04-16 08:35:34 +00:00
Qjuh
7baa9e4333 feat(website): add type field to search index to sort by (#10212) 2024-04-14 19:53:16 +02:00
Qjuh
afb97fbd00 fix(website): use correct version for cross-package links (#10193) 2024-04-11 17:38:04 +02:00
Qjuh
7dc5bdfef5 ci: fix call to generateSplitDocumentation if run on tag (#10209)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-04-10 16:27:20 +00:00
Dawid Jaworski
de14c92c11 feat(ClientUser): Add support for setting bot banner (#10176)
* feat(discord.js): added support to setting bot banner

added feature to set banner for bot from code level
the function is in the experimental phase of Discord.

* fix: resolve requested changes

* fix: add missing type in ClientUserEditOptions

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-04-09 14:09:01 +00:00
Jiralite
464d627f1d ci: Ensure reviews in progress label do not merge (#10208)
ci: ensure reviews do not merge
2024-04-07 23:09:39 +02:00
Almeida
bfc3b100da feat(GuildsAPI): bulk ban users (#10202)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-04-06 07:24:16 +00:00
n1ck_pro
f1f2683dc7 docs: remove unused Locale typedef (#10191)
docs: remove unused typedef

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-04-04 19:34:13 +00:00
avoidaway
26af3868a5 docs: remove duplicated words (#10178)
chore: remove repetitive words

Signed-off-by: avoidaway <cmoman@126.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-04-04 19:29:34 +00:00
codershiba
b6bdd578b9 feat(GuildBanManager): Add bulkCreate() method (#10182) 2024-04-02 19:38:48 +00:00
Almeida
ba6476d07e build: bump discord-api-types to 0.37.78 (#10201) 2024-04-01 17:55:45 +00:00
Qjuh
980a2b71c7 types: generic for Webhook type (#10188)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-03-31 14:15:21 +00:00
Qjuh
654f1a48b9 chore: remove ws dependency (#10180) 2024-03-31 14:09:38 +00:00
LeCarbonator
a1a3a95c94 feat: allow RestOrArray for command option builders (#10175)
* feat(builders): allow RestOrArray for command option builders

change ApplicationCommandOption methods to allow both rest and array params,
which previously wasn't consistent with other builders.

* chore: merge imports

---------

Co-authored-by: almeidx <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-03-24 18:12:05 +00:00
Danial Raza
ddc927fabd fix(Embed): address equals method issue (#10152)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-03-24 14:45:56 +00:00
Danial Raza
f500ad6e2e refactor(ThreadChannel): use single thread member endpoint (#10136)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-03-24 14:41:29 +00:00
cobalt
6cc5fa28e6 fix(types): Export ReadonlyCollection (#10184) 2024-03-20 13:10:34 +00:00
iCrawl
93c174bc82 chore: fix test type import 2024-03-11 18:15:21 +01:00
iCrawl
0d4c26ba4c chore: deps 2024-03-11 17:50:39 +01:00
Qjuh
5f2095b76c ci: use correct github tag in docs source links (#10163)
* ci: use correct github tag in docs source links

* fix: also apply on new tags
2024-03-09 13:52:38 +01:00
Superchupu
a66fc65742 ci: enable npm provenance (#10164)
* chore: enable npm provenance

* chore: do the same for dev releases

* chore: actually enable it in normal releases

* chore: specify provenance in `package.json`

* chore: remove `publishConfig` from api-extractor-utils as it's `private`
2024-03-04 21:11:32 +00:00
Qjuh
a1010c61f5 types: fix duplicate props in merged interfaces (#10160)
types(discord.js): fix duplicate props in merged interfaces
2024-03-04 11:55:01 +01:00
Superchupu
8de8371204 chore(gitattributes): mark pnpm-lock.yaml as generated (#10159) 2024-03-04 00:15:47 +01:00
iCrawl
0efd1bea46 fix: anchor link for events 2024-03-04 00:02:52 +01:00
iCrawl
9fa115df86 fix: can't use node internals on edge 2024-03-03 02:36:06 +01:00
iCrawl
79fbda3aac feat: local and preview detection 2024-03-03 02:30:08 +01:00
iCrawl
2848591e21 fix: switch out syntax highlighter themes 2024-03-03 00:54:47 +01:00
iCrawl
3fd36f745f ci: remove debug logging 2024-03-02 22:26:09 +01:00
iCrawl
34936a0312 chore: never cache doc generation 2024-03-02 22:21:48 +01:00
iCrawl
e401841f63 ci: more logging 2024-03-02 22:14:02 +01:00
iCrawl
d6bf0fe43e ci: logging for ci 2024-03-02 21:52:10 +01:00
iCrawl
59f4db3e1d ci: update split upload 2024-03-02 21:19:13 +01:00
iCrawl
71bba547b6 refactor: docs ordering 2024-03-02 20:25:51 +01:00
Noel
18cce83d80 refactor: docs (#10126) 2024-02-29 04:37:52 +01:00
cobalt
0f9017ef95 fix(Faces): Escape backslash in Shrug (#10156)
* fix(Faces): Escape backslash in `Shrug`

* Update formatters.ts

* Update formatters.ts

* Update formatters.test.ts
2024-02-27 17:23:31 +00:00
Jiralite
efa3cac6f2 types: Update accessibility modifiers on constructors (#10147)
types: update accessibility modifiers on constructors
2024-02-23 12:51:13 +00:00
Synbulat Biishev
bfbd62e3e0 types(Builder.from): fix wrong types (#10071)
* types(Builder.from): fix wrong types

* test: add tests

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-23 11:54:41 +00:00
Almeida
c8bbdb70f2 fix(ReadonlyCollection): omit clear method (#10148)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-23 09:02:24 +00:00
Danial Raza
f67da74a5a docs(ActionRow): fix deprecated message (#10130)
docs(ActionRow): fix deprecated link

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-23 00:37:43 +00:00
Almeida
bcd4c2cb23 types: use readonly array / collection types for user input (#10045)
* types: use readonly arrays

* chore: check on interface properties

* chore: ReadonlyCollection

* chore: exclude EventEmitter methods

* chore: resolve false positive
2024-02-23 00:29:06 +00:00
Jiralite
8c2ababa78 feat(guild): Add with_counts to getting guilds (#10143)
* feat(guild): add get with counts

* refactor: simplify `query`

Co-authored-by: Almeida <almeidx@pm.me>

---------

Co-authored-by: Almeida <almeidx@pm.me>
2024-02-21 21:52:26 +00:00
Danial Raza
1d565443b0 refactor: improve structure validation with zod (#10103)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-21 20:19:43 +00:00
Matt Rubin
906ade9cc5 refactor(oauth2): remove unnecessary dependency on 'node:url' (#10141)
This change fixes a runtime error when using '@discordjs/core/http-only' on Cloudflare Workers.
2024-02-21 20:15:26 +00:00
Almeida
c89c343b0a types(InteractionReplyOptions): allow setting MessageFlags.SuppressNotifications (#9199) 2024-02-20 20:28:37 +00:00
Danial Raza
992aa67841 feat(MessageCreateOptions): add enforceNonce (#10129)
Co-authored-by: almeidx <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-17 18:31:14 +00:00
Danial Raza
e9d654772d docs(ApplicationCommandPermissionsManager): remove incorrect comment (#10123)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-17 18:03:33 +00:00
Suneet Tipirneni
543d61737e feat: add support for using keyword on discord.js Client and WebSocketManager (#10063)
* feat: add support for `using` keyword on client

* fix: use async dispose

* feat: add support for web socket manager disposing

* fix: use interface for client

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-13 17:48:56 +00:00
Almeida
f48cb2a357 refactor: remove usage of mixin on error classes (#10128) 2024-02-13 11:54:56 +00:00
Qjuh
54106dbd81 types: replace Mixins with interface merging (#10094)
* types(TextBasedChannelMixin): refactor to user interface merging instead

* types(WebhookMixin): refactor to interface merging

* fix: ignore empty-interface tslint errors

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-11 19:26:20 +00:00
Qjuh
ce6b2b74bc fix(docs): remove spaces in type parameter brackets (#10127)
* fix(docs): remove spaces in type parameter brackets

* fix: missing global flag
2024-02-11 18:59:03 +01:00
Qjuh
36db77f107 fix(docs): use ts types for inherited properties instead of jsdoc (#10125)
* fix(docs): use ts types for inherited properties instead of jsdoc

* fix(docs): remove spaces in type parameters
2024-02-10 21:36:25 +01:00
iCrawl
597340f288 docs: split docs.api.json into multiple json files 2024-02-06 17:24:18 +01:00
iCrawl
ae57d7facb chore: deps 2024-02-06 01:53:30 +01:00
Jiralite
3755e66d41 fix(resolveColor): Address case for numbers (#10115)
fix(resolveColor): address case for numbers

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-05 22:11:41 +00:00
DD
c878b65ef5 refactor(WebSocketShard): payload sending (#10098)
* refactor(WebSocketShard): payload sending

* fix: adjust ratelimit state onopen

* fix: use >=

* chore: spelling

Co-authored-by: space <spaceeec@yahoo.com>

---------

Co-authored-by: space <spaceeec@yahoo.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-05 18:42:33 +00:00
Suneet Tipirneni
f401cff3f4 fix: Correct testing local changes in CONTRIBUTING.md (#10066)
fix: remove unneeded step for testing local changes

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-04 20:11:36 +00:00
brynpttrsn
bff1caebd1 fix(website): move function header into switcher (#10077)
fix(website): move header into switcher
2024-02-04 21:06:50 +01:00
Qjuh
ef83bc3e41 fix(api-extractor): link to enum types on inherited properties (#10085)
* fix: link to enum types on inherited properties

* fix: `undefined` in properties without access modifier
2024-02-04 21:06:03 +01:00
Qjuh
bc9b487eb1 fix(website): always link in TypeAlias (#10105)
* fix(website): always link in TypeAlias

* fix: use div instead span for DocParagraph
2024-02-04 00:39:00 +00:00
brynpttrsn
56943a72f4 fix(website): resolve linkTags in meta description (#10088)
* fix(website): resolve linkTags in summaries

* fix: case body as block

* fix: add discord-api-types support

* fix: remove urlDestination when undefined

* fix: breaks to if/else

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-03 22:10:28 +00:00
Vinayak Kulkarni
9f8d7fe7b4 build: Update husky to v9 (#10102)
* refactor(dev-deps): migrate to husky v9

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>

* revert: only core committers in package.json

* chore: remove hashbang 🎉

* chore: remove install from prepare script 

* chore: upgrade to latest minor

---------

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>
Co-authored-by: almeidx <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-03 22:06:19 +00:00
Almeida
42bc5d2c74 fix: invert deletable message types list (#10093)
* fix: invert deletable message types list

* docs: consistency

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-03 21:49:11 +00:00
brynpttrsn
f69165883f fix(website): cmdk duplicate values (#10100)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-03 21:45:28 +00:00
Jiralite
d4472f85a5 refactor(resolveColor): Prioritise number type check (#10116)
* refactor(resolveColor): prioritise number type check

* refactor: prefer `!Number.isInteger()`

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-02-03 21:42:16 +00:00
Jiralite
b16647e6cc fix(BaseClient): Fall back to userAgentAppendix (#10113)
fix(BaseClient): fall back to `Options.userAgentAppendix`
2024-02-02 16:32:18 +00:00
DD
278396e815 feat(REST): dynamic rate limit offsets (#10099)
* feat(REST): dynamic rate limit offsets

* chore: update tests

* chore: better doc comment

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* fix: don't overlook globalReset

Co-authored-by: ckohen <chaikohen@gmail.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: ckohen <chaikohen@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-01-30 09:29:42 +00:00
Jiralite
fc1f8ae374 refactor(Messages): Improve ColorConvert error (#10108)
* feat(Messages): improve `ColorConvert` error

* style(Util): consistency
2024-01-30 07:17:45 +00:00
Almeida
bfc7bb5564 docs: convert comment into private remark (#10097)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-01-22 18:45:49 +00:00
Qjuh
a0c83a254c refactor: make builders types great again (#10026)
* refactor: make builders types great again

* fix: subcommands only type

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-01-22 15:02:34 +00:00
Jacob Morrison
fed7f341be Skip sweeping if the guild is not available (#10070)
* Skip sweeping if the guild is not available

* Typo

* Fix formatting

* Fix lint

* Check  if key in guild

* Bwck to guild a ailable

---------

Co-authored-by: Jake Morrison <jake.morrison@pinnsg.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-01-22 13:17:23 +00:00
Danial Raza
f48787eef1 docs(BaseInteraction): correct return type of member (#10096) 2024-01-22 11:40:13 +00:00
Qjuh
1431c18769 fix(website): search hanging on complex types (#10095) 2024-01-21 17:08:31 +00:00
Almeida
33674be85e feat(Webhook): allow setting appliedTags on send() (#10027)
* feat(Webhook): allow setting `appliedTags` on `send()`

* docs: fix grammar

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-01-15 22:29:49 +00:00
James
7e12bee337 docs: remove utf-8-validate (#10059)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2024-01-13 11:10:10 +00:00
codershiba
7b8e0debeb refactor(formatters): Add support for object and name param in formatEmoji() (#10076)
* feat: add support for name param and object in `formatEmoji()`

* Update formatters.ts

* refactor: swap priority

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2024-01-13 11:02:41 +00:00
Jiralite
136c66c213 build: Bump versions (#9986)
fix: bump versions

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-12-30 18:03:00 +00:00
Danial Raza
ce84d3efee fix(Gateway): Export interface (#10060)
* fix(types): export missing `Gateway` interface

* docs(Gateway): update link to `WebSocketManager`
2023-12-30 17:40:20 +00:00
Renegade334
4824ac154d docs(ThreadMember): fix docblock async return type (#10058) 2023-12-28 12:24:30 +00:00
Almeida
0f1e02b3dd fix(escape*): dont escape urls (#9958)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-12-24 16:16:33 +00:00
Almeida
c4fcee3ef6 feat: premium application subscriptions (#9907)
* feat: premium application subscriptions

* types: readonly array

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* fix: requested changes

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* fix: core client types

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-12-24 15:49:58 +00:00
iCrawl
520d6f64dd fix: nextjs unreliable params in route 2023-12-21 05:19:32 +01:00
iCrawl
1c3211a5fc fix: remove ppr from website for now 2023-12-21 04:39:14 +01:00
iCrawl
891a67ac4d fix: use proper api endpoint 2023-12-20 23:49:39 +01:00
iCrawl
7b5c31b2bc refactor: fetch versions on the client 2023-12-20 23:21:49 +01:00
iCrawl
d869d9b3fe style: fix up lint 2023-12-19 14:45:28 +01:00
iCrawl
171cb182ed chore: deps 2023-12-19 14:33:04 +01:00
Jiralite
db56324624 types(DirectoryChannel): Ensure directory channels cannot contain user mentions when stringified (#10043)
* types(DirectoryChannel): `ChannelMention` `toString()`

* refactor: dynamic test
2023-12-18 22:30:24 +00:00
Almeida
a000df624c chore: use double quotes for globs in scripts (#10032) 2023-12-18 18:14:15 +01:00
Danial Raza
6cd6e3baaf chore: use string values in vs code settings (#10028) 2023-12-18 18:13:55 +01:00
Qjuh
e43f96cec5 ci: always use the workflows from main branch (#10048) 2023-12-18 18:13:30 +01:00
Danial Raza
461948c07d fix: deprecate underscore in favor of underline (#10054)
* fix: deprecate `underscore` in favor of `underline`

* refactor: use `underline` in `underscore`

Co-authored-by: Almeida <github@almeidx.dev>

---------

Co-authored-by: Almeida <github@almeidx.dev>
2023-12-17 20:44:54 +00:00
advaith
1acc9abae2 types: change Awaitable<void> to void (#10017)
Co-authored-by: Almeida <almeidx@pm.me>
2023-12-17 13:54:21 +00:00
Jiralite
18c2dccd0e feat: Utilise create-discord-bot (#10013)
* feat: utilise create-discord-bot

* chore: hide line numbers

* feat: add intents page

* feat: add more Node.js variants

* refactor: redo page a bit

* fix: 👀

* chore: touch up introduction page

* chore: touch up what's new

* chore: touch up how to contribute

* chore: remove enforced locale

* chore: Fix typo

Co-authored-by: Danial Raza <danialrazafb@gmail.com>

* chore: commit suggestions

Co-authored-by: Souji <timoqueezle@gmail.com>

* chore: address improper capitalisation

Co-authored-by: Souji <timoqueezle@gmail.com>

* refactor: remove `applications.commands`

* refactor: remove unique comment

* fix(intents): remove shard comment

* docs(intents): add missing info

---------

Co-authored-by: Danial Raza <danialrazafb@gmail.com>
Co-authored-by: Souji <timoqueezle@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-12-14 21:15:27 +00:00
Qjuh
adfd9cd3b3 refactor: use interfaces for AsyncEventEmitter event maps (#10044)
* refactor: use interfaces for AsyncEventEmitter event maps

* refactor: apply suggestions from code review and add tests

* refactor: better errors on missing dispatch types
2023-12-14 16:09:13 +00:00
Qjuh
f2138bb5a8 ci: always generate docs with latest main ae (#10037) 2023-12-13 14:06:50 +01:00
Qjuh
651ffc2caf feat(website): more builtin docs links (#10030)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-12-10 14:06:09 +00:00
Vlad Frangu
319ef9a70b feat: use globally available WebSocket client in runtimes that have it (#10042) 2023-12-10 13:42:02 +00:00
Jiralite
8ace6face8 docs(CategoryCreateChannelOptions): Update reference (#10031)
docs(CategoryCreateChannelOptions): update reference

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-12-05 19:26:27 +00:00
Jiralite
e245a390e7 docs(resolvePartialEmoji): Add @internal to all overloads (#10033)
docs: add `@internal`
2023-12-05 19:19:52 +00:00
Jiralite
2b8ac35e56 refactor: Document relevant types as @internal (#9974)
* refactor: mark data resolver as internal

* docs: mark relevant TypeScript symbols as `@internal`

* docs: extra additions

* style: prefer at end

* docs: add more `@internal`s

* test: update template code
2023-12-05 18:15:08 +00:00
Danial Raza
62e31cb9ee fix(InteractionResponses): check if ephemeral message flag is used (#10021) 2023-12-04 20:16:26 +00:00
Ryan Munro
941642ad2f fix: replace internal calls to Emoji#url (#10025) 2023-12-03 22:53:02 +00:00
Jiralite
54453b04e5 chore(uploadDocumentation): Expose full error (#10012)
chore: expose full error

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-12-02 12:50:53 +00:00
Danial Raza
b992019a78 docs(PermissionOverwriteManager): PermissionsFlagsBit typo (#10004)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-12-01 20:58:21 +00:00
Qjuh
17a6f5d3c9 types: omit unnecessary methods from <ContextMenuCommandInteraction>.options (#10003)
* types: omit getUser/Member/Message from ContextMenu interaction

* types: omit getAttachment and add tests

* fix: remove duplicate tests
2023-12-01 20:13:20 +00:00
Qjuh
a44ada661f feat(website): show union members of type aliases (#10001)
* feat(website): show union members of type aliases

* refactor: suggestions from code review

* Apply suggestions from code review

---------

Co-authored-by: Noel <buechler.noel@outlook.com>
2023-12-01 02:19:07 +01:00
Qjuh
b229240731 ci: documentation.yml refactor branch/tag check to one place only (#10008)
* ci: fix documentation manual dispatch run on tag

* ci: move conditional to env var

* fix: spacing
2023-12-01 02:12:36 +01:00
Qjuh
1ec2901f56 feat(website): type parameters on methods and overloads (#9998)
* feat(website): type parameters on methods and overloads

* refactor: add collapsible parameter list
2023-12-01 02:11:59 +01:00
Renegade334
179af387d0 refactor(ThreadMemberManager): #remove accepts UserResolvable (#10000)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-12-01 00:35:59 +00:00
Vlad Frangu
e412a22ceb fix: export "ESM" types when discord.js is imported in ESM land (#10009)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-30 23:19:22 +00:00
Jiralite
30f6a5fc56 types(InteractionWebhook): Add client (#9997)
types(InteractionWebhook): add `client`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-30 21:48:54 +00:00
brynpttrsn
cbbbfb9823 fix(website): serialize methods with overload index (#10005)
fix: add overload index to methods
2023-11-30 22:43:43 +01:00
Qjuh
fe90487974 ci: fix documentation manual dispatch run on tag (#10007) 2023-11-30 22:41:55 +01:00
Noel
d0aa8d25e2 ci: fix deploy-website 2023-11-24 12:23:31 +01:00
Qjuh
bc2ecef73d fix: cross package links again (#9995) 2023-11-24 12:10:16 +01:00
Qjuh
9fdbf0ad65 fix(website): doc links to other packages (#9994)
* fix(website): doc links to other packages

* fix: missing parameter

* Apply suggestions from code review

Co-authored-by: Almeida <almeidx@pm.me>

---------

Co-authored-by: Almeida <almeidx@pm.me>
2023-11-22 19:06:13 +01:00
Qjuh
57c414be21 fix(website): discord-api-types links, URL links and some minor doc issues (#9990)
* fix(website): correctly link to discord-api-types in link tags

* fix: url links and some minor doc issues

* fix: unneeded import

* fix: another unneccessary import

* fix: several linting issues

* refactor: simplify ApiItemLike interface

* refactor: apply suggestions

* fix: missing newline in docComment

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-22 08:26:43 +00:00
Jiralite
e9ff99101b docs: Remove hyphen after @returns (#9989)
docs: remove hyphen after `@returns`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-21 17:16:51 +00:00
Qjuh
3d1c884926 refactor(website): remove unneccessary addPackageToModel function (#9983)
* types: fix links in @deprecated tags

* Merge branch 'main' into fix/deprecated-links-d.ts

* fix: searchIndices

* refactor: apply review suggestions

* refactor: remove addPackageToModel function

* fix: event links in search index

* fix: wrong overload condition
2023-11-21 10:06:13 +01:00
Rahul Mishra
ce0be392d8 fix(Bun): Fix typo for Bun template (#9987)
fix(create-discord-bot): Fix typo for Bun Template which caused install errors
2023-11-18 16:58:33 +00:00
Qjuh
802ec63a48 fix(website): cross package deprecated links (#9981)
* refactor: minify api.json by shortening keys

* fix: links to other packages

* refactor: get doclink from canonicalReference, not model

* fix: types

* fix: again

* fix: @link tags with alt texts

* fix(website): cross-package links in @deprecated
2023-11-18 11:45:32 +01:00
Qjuh
5a715706df fix(website): search index generation (#9980)
* types: fix links in @deprecated tags

* Merge branch 'main' into fix/deprecated-links-d.ts

* fix: searchIndices

* refactor: apply review suggestions
2023-11-18 10:44:06 +00:00
Vlad Frangu
ae58053dc8 chore: release @discordjs/rest@2.2.0 & @discordjs/core@1.1.1 (#9978)
* chore(rest): release @discordjs/rest@2.2.0

* chore(core): release @discordjs/core@1.1.1

* chore: at this point might as well hand write
2023-11-18 00:01:40 +00:00
Jiralite
5da5be2bc9 fix(route): Conditionally prefix package names (#9975)
fix(route): conditionally prefix package names
2023-11-17 23:38:49 +01:00
Noel
55be1c901a ci: properly extract name from minified docs files 2023-11-17 23:37:14 +01:00
Qjuh
492f86af39 refactor: minify api.json by shortening keys (#9971)
* refactor: minify api.json by shortening keys

* fix: links to other packages

* refactor: get doclink from canonicalReference, not model

* fix: types

* fix: again

* fix: @link tags with alt texts
2023-11-17 23:26:48 +01:00
Qjuh
9868772b64 docs: fix links in @deprecated tags (#9976)
types: fix links in @deprecated tags
2023-11-17 20:44:39 +00:00
Vlad Frangu
6df233de14 feat: present x-ratelimit-scope for 429s hit (#9973)
* feat: present x-ratelimit-scope for 429s hit

* fix: get scope from headers for burst too
2023-11-16 10:49:05 +00:00
Qjuh
0aa7dc1b86 fix: replace Object< with Record< (#9970) 2023-11-15 20:20:21 +01:00
Qjuh
cab60142ff fix: type mapping for docgen methods/props (#9969)
* fix: minify mainlib docs json

* fix: minify them all

* fix: type mapping for docgen methods/props
2023-11-14 20:54:29 +00:00
Qjuh
4b88306dcb fix: minify mainlib docs json (#9963)
* fix: minify mainlib docs json

* fix: minify them all
2023-11-14 09:13:28 +01:00
iCrawl
f9177be61b fix: don't hardcode discordjs special case 2023-11-14 02:04:02 +01:00
iCrawl
75137bac6f refactor: don't prebuild on preview builds 2023-11-14 01:55:08 +01:00
iCrawl
00063912ee fix: conflict resolution 2023-11-14 01:35:08 +01:00
iCrawl
8f432400d8 build: multi-config build and dep update 2023-11-14 01:26:22 +01:00
iCrawl
75fc7f2454 ci: include secret 2023-11-13 23:21:35 +01:00
iCrawl
01c63d2e0f refactor: switch to vercel blob for docs 2023-11-13 23:15:16 +01:00
iCrawl
ffc3ea5c3f fix: hardcode redirect for main lib for now 2023-11-13 21:37:59 +01:00
iCrawl
1d2d01e1f5 ci: dont set the ci to failed on fail to upload docs 2023-11-13 21:31:46 +01:00
iCrawl
0063dae43b fix: use correct pkg variable 2023-11-13 21:30:05 +01:00
iCrawl
69c949ab28 fix: properly switch versions 2023-11-13 21:17:42 +01:00
iCrawl
25d552b318 fix: missing on conflict clause 2023-11-13 21:09:43 +01:00
iCrawl
c4767bacde refactor: switch to vercel pg 2023-11-13 21:07:01 +01:00
iCrawl
9a8110047e fix: cache nextjs cache output with turbo 2023-11-13 19:55:08 +01:00
iCrawl
d4ebc369ca fix: dont cache nextjs cache 2023-11-13 19:31:55 +01:00
iCrawl
b150d4ac27 fix: provide full path for pre-gen 2023-11-13 19:19:26 +01:00
iCrawl
81a892e27f fix: properly create index 2023-11-13 19:13:32 +01:00
iCrawl
bc8f83368a feat: reintroduce outline navigation 2023-11-13 18:03:23 +01:00
Qjuh
7c935dc84b feat: docs for mixin methods, examples (#9960) 2023-11-13 15:03:47 +01:00
iCrawl
8d04cbc203 chore: add loading page for suspense 2023-11-13 11:23:59 +01:00
iCrawl
356cadb382 chore: enable prefetch 2023-11-13 11:07:47 +01:00
iCrawl
978a39f6d3 chore: disable prefetch 2023-11-13 10:48:51 +01:00
iCrawl
516be87a87 fix: properly display all versions in selector 2023-11-13 10:22:44 +01:00
Qjuh
b79351ba99 fix(website): misc improvements (#9940)
* refactor: use tokenRange for typeParams in heritage

* fix: correct type param replacement

* fix: ae config, link builtin in summary, `: | T` => `: T`, mainlib tsdoc

* fix: requested changes and tests

* chore: better deprecation messages and code cleanup

* fix: cleanup optional chainings

---------

Co-authored-by: Almeida <almeidx@pm.me>
2023-11-13 09:55:23 +01:00
iCrawl
2d63d93558 ci: add readmes to build output for cache 2023-11-13 00:17:43 +01:00
iCrawl
b305194841 ci: revert deploying vercel with ci for now 2023-11-13 00:12:37 +01:00
Vlad Frangu
2550c7931d chore(discord.js): release discord.js@14.14.1 (#9957)
* chore(discord.js): release discord.js@14.14.1

* chore: actual changelog
2023-11-12 22:06:14 +00:00
Almeida
40726db722 refactor: use formatters (#9956)
* refactor: use formatters

* fix: imports

* fix: imports pt.2

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-12 21:56:10 +00:00
Aura
1e4ef35436 docs: use preferred nullable syntax (?T over T | null) (#9946)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-12 21:45:02 +00:00
Aura
4bc1dae36f types: use wrapper utilities (#9945)
* types: use `Awaitable<T>` instead of `Promise<T> | T`

* types: use `JSONEncodable<T>` over raw definition

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-12 21:40:59 +00:00
Almeida
cc07a28f12 fix(Emoji): id set as undefined edge case (#9953) 2023-11-12 21:34:24 +00:00
Jiralite
f93abf7e35 fix(BaseClient): Default in objects properly (#9952)
fix(BaseClient): default in objects properly
2023-11-12 21:14:09 +00:00
Jiralite
f0ec70dfda feat: bump package versions (#9951)
* feat: bump package versions

* chore(create-discord-bot): release create-discord-bot@0.2.3

---------

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2023-11-12 20:22:55 +00:00
Jaw0r3k
8a6045f600 fix: import picocolors as default (#9949) 2023-11-12 19:39:08 +00:00
Vlad Frangu
418032ae1f chore(ci): fix release workflow (#9947) 2023-11-12 19:12:13 +00:00
Vlad Frangu
dbb92e5bc4 chore(releases): release party (#9943)
* chore(brokers): release @discordjs/brokers@0.2.3

* chore(collection): release @discordjs/collection@2.0.0

* chore(formatters): release @discordjs/formatters@0.4.0

* chore(util): release @discordjs/util@1.0.2

* chore(voice): release @discordjs/voice@0.16.1

* chore(builders): release @discordjs/builders@1.7.0

* chore(rest): release @discordjs/rest@2.1.0

* chore(proxy): release @discordjs/proxy@2.0.2

* chore(ws): release @discordjs/ws@1.0.2

* chore(core): release @discordjs/core@1.1.0

* chore(discord.js): release discord.js@14.14.0

* chore: small borked changelogs

* chore(create-discord-bot): release create-discord-bot@0.2.2

* chore: bork

* chore: fix wrong bump

* chore: git cliff pls
2023-11-12 18:11:58 +00:00
Almeida
975d5f18ae chore: use descriptive type parameter names (#9937)
* chore: use descriptive type parameter names

* refactor: requested changes

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-12 17:21:51 +00:00
Jaw0r3k
4ff3ea4a1b feat: default select menu values (#9867)
* feat: default select menu values

* feat(Message): support

* fix: fix crashes when an array is supplied and remove assertion

* docs(transformResolved): `BaseChannel` is the correct type

* refactor: prefer assignment

* chore: export function again

* fix(Util): fix circular dependency

* refactor(MentionableSelectMenu): clone in method

* docs: remove semicolon

* feat(MentionableSelectMenu): add `addDefaultValues()`

* refactor: reduce overhead

* types: adjust `channel`

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-11-12 16:32:41 +00:00
Jiralite
b5e23ec2ec fix(Client): Ensure destroyed connections are not ready (#9942)
* fix(Client): ensure destroyed connections are not ready

* refactor(Client): prefer `!`

Co-authored-by: Aura <kyradiscord@gmail.com>

---------

Co-authored-by: Aura <kyradiscord@gmail.com>
2023-11-12 16:06:42 +00:00
Vlad Frangu
81e7866903 feat: expose Retry-After and sublimit timeouts in RatelimitData (#9864)
* feat: expose Retry-After and sublimit timeouts in RatelimitData

* chore: better docs?

* Apply suggestions from code review

Co-authored-by: ckohen <chaikohen@gmail.com>

---------

Co-authored-by: ckohen <chaikohen@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-12 14:36:12 +00:00
iCrawl
62e6573296 fix(website): caching and revalidation 2023-11-11 21:05:25 +01:00
David Malchin
cf49f405b0 fix(REST): strip webhook tokens (#9723)
* fix(REST): strip webhook tokens

* fix(REST): implement requested changes

Co-authored-by: ckohen <chaikohen@gmail.com>

---------

Co-authored-by: ckohen <chaikohen@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-11 18:31:39 +00:00
iCrawl
2a25eeaf13 chore: remove nextjs patch 2023-11-11 19:19:14 +01:00
Qjuh
5a4c9755c3 feat(api-extractor): replace type parameters with their actual values on inherited members (#9939)
* refactor: use tokenRange for typeParams in heritage

* fix: correct type param replacement
2023-11-11 15:18:08 +01:00
Aura
5b0aa92c81 refactor(utils): remove mergeDefault (#9938)
* refactor(utils): remove `mergeDefault`

`BaseClient` and `ShardingManager` not longer mutate options

* refactor(ShardingManager): avoid reassigning method argument
2023-11-11 09:50:50 +00:00
Almeida
d28814d869 fix: properly support multiple extends/implements (#9934)
* fix: properly support multiple extends/implements

* refactor: use flexbox instead of space util

Co-authored-by: Noel <buechler.noel@outlook.com>

---------

Co-authored-by: Noel <buechler.noel@outlook.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-10 22:01:30 +00:00
Almeida
ff24bc5729 build: rerun docs scripts on changes to api-extractor packages (#9935)
* build: rerun docs scripts on changes to api-extractor-*

* refactor: requested changes

Co-authored-by: Noel <buechler.noel@outlook.com>

---------

Co-authored-by: Noel <buechler.noel@outlook.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-10 17:42:55 +00:00
Almeida
81334a2a2c feat: link basic types to MDN/TS documentation (#9913)
* feat: link basic types to MDN/TS documentation

* refactor: requested changes
2023-11-10 14:50:25 +00:00
Almeida
6dca8013af chore: remove parameter list from events (#9933) 2023-11-09 00:38:13 +01:00
Suneet Tipirneni
a87b267fba fix: treat primitives as references instead of content (#9932)
* fix: treat primitives as references instead of content

* chore: add typeof keyword

* fix: add missing keywords
2023-11-09 00:37:50 +01:00
iCrawl
aad82f088b build: fix the messy dependency graph 2023-11-09 00:13:01 +01:00
iCrawl
e5f3f3130e fix: path generation for search 2023-11-08 19:01:32 +01:00
iCrawl
4a5e9fc1de fix: pin source-map dependency and clean up website 2023-11-08 18:43:02 +01:00
iCrawl
e72b552ae2 chore: remaining deps and lighthouse removal 2023-11-08 18:20:16 +01:00
iCrawl
34d0224b68 refactor: display readme correctly 2023-11-08 14:49:28 +01:00
iCrawl
fcfe5cf142 refactor: remove banner 2023-11-08 13:51:51 +01:00
iCrawl
fb2e7a0aac ci: correctly apply permissions 2023-11-08 13:36:55 +01:00
iCrawl
4575e49ea1 ci: deploy on vercel again 2023-11-08 13:27:04 +01:00
iCrawl
2bda883a0f fix: handle older generated docs better 2023-11-08 12:30:32 +01:00
Almeida
fffe70a039 feat(Client): AsyncIterator-returning method for fetching members (#9771)
* feat(Client): AsyncIterator-returning method for fetching members

* fix: requested changes

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-11-08 10:43:15 +00:00
iCrawl
413d6d67c5 ci: separate website deploy 2023-11-08 10:38:44 +01:00
Qjuh
da455bceea feat: mainlib docs on new website (#9930)
* fix(ExceptText): don't display import("d..-types/v10"). in return type

* Squashed 'packages/api-extractor-model/' content from commit 39ecb196c

git-subtree-dir: packages/api-extractor-model
git-subtree-split: 39ecb196ca210bdf84ba6c9cadb1bb93571849d7

* Squashed 'packages/api-extractor/' content from commit 341ad6c51

git-subtree-dir: packages/api-extractor
git-subtree-split: 341ad6c51b01656d4f73b74ad4bdb3095f9262c4

* feat(api-extractor): add api-extractor and -model

* fix: package.json docs script

* fix(SourcLink): use <> instead of function syntax

* fix: make packages private

* fix: rest params showing in docs, added labels

* fix: missed two files

* feat: merge docs.json from docgen and docs.api.json

* fix: cpy-cli & pnpm-lock

* fix: increase icon size

* fix: icon size again

* feat: run both docs on mainlib

* chore: website fixes

* fix: more website fixes

* fix: tests and dev database script

* chore: comment out old docs

* fix: increase max fetch cache

* fix: env should always be a string

* fix: try to reapply patches

* fix: remove prepare for docgen

* fix: temporary cosmetic fixes

* fix: horizontal scroll

* feat: generate index for new docs

---------

Co-authored-by: Noel <buechler.noel@outlook.com>
2023-11-08 10:16:54 +01:00
iCrawl
f713e47b0a fix: gracefully handle no docs 2023-11-08 03:23:51 +01:00
Neutron
defeee5eec feat: return entries instead of values in toJSON method (#9345)
* feat(collection): return entries instead of values in toJSON method

* test: adjust test

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-08 01:28:27 +00:00
iCrawl
67a2538b4d fix: handle errors gracefully 2023-11-08 02:22:51 +01:00
iCrawl
7208d69c05 ci: rename github deployment env 2023-11-08 02:04:22 +01:00
iCrawl
6b9f906b03 chore: properly rename folder 2023-11-08 00:44:39 +01:00
iCrawl
347df4e083 chore: typo 2023-11-08 00:38:35 +01:00
iCrawl
ee2afb0aae chore: update engine field in packages & deploy website manually 2023-11-08 00:25:38 +01:00
Qjuh
5c0fad3b2d build: package api-extractor and -model (#9920)
* fix(ExceptText): don't display import("d..-types/v10"). in return type

* Squashed 'packages/api-extractor-model/' content from commit 39ecb196c

git-subtree-dir: packages/api-extractor-model
git-subtree-split: 39ecb196ca210bdf84ba6c9cadb1bb93571849d7

* Squashed 'packages/api-extractor/' content from commit 341ad6c51

git-subtree-dir: packages/api-extractor
git-subtree-split: 341ad6c51b01656d4f73b74ad4bdb3095f9262c4

* feat(api-extractor): add api-extractor and -model

* fix: package.json docs script

* fix(SourcLink): use <> instead of function syntax

* fix: make packages private

* fix: rest params showing in docs, added labels

* fix: missed two files

* fix: cpy-cli & pnpm-lock

* fix: increase icon size

* fix: icon size again
2023-11-07 21:53:36 +01:00
Almeida
95c0b1a59f chore: pin @discordjs/collection version in discord.js (#9929) 2023-11-07 19:32:04 +01:00
Almeida
65966ae6ec feat: align some methods with the Change By Copy proposal (#9207)
BREAKING CHANGE: The `sorted` method has been renamed to `toSorted`
2023-11-07 18:26:48 +00:00
Almeida
3b8df63a5a feat: align some methods with the Set Methods proposal (#8890)
feat(collection): align/add methods with/from Set Methods proposal

BREAKING CHANGE: The `intersect` method has been renamed to `intersection`
BREAKING CHANGE: The `difference` method has been renamed to `symmetricDifference`
BREAKING CHANGE: The `subtract` method has been renamed to `difference`
2023-11-07 18:04:51 +00:00
Jaw0r3k
054eaec7d7 fix: update broken links (#9926)
fix: update some links

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-11-07 17:51:10 +00:00
iCrawl
c8227ca533 build(scripts): send correct data to meilisearch 2023-11-07 16:48:02 +01:00
iCrawl
1eee9dc257 build(scripts): use correct env vars 2023-11-07 16:44:08 +01:00
iCrawl
6a6c4bdcae build: make sure to cache bust tsup config changes in all packages 2023-11-07 16:41:15 +01:00
iCrawl
c39c94374a ci: fix building upload search indicies action 2023-11-07 16:27:07 +01:00
iCrawl
792840bae6 ci: update search with github actions 2023-11-07 16:22:17 +01:00
iCrawl
009c0a3bae refactor: use planetscale instead of custom api 2023-11-07 15:08:03 +01:00
iCrawl
344a3f9344 chore: @types/node and unocss fix 2023-11-06 23:55:13 +01:00
iCrawl
a1abc6b273 chore: fixup eslint 2023-11-06 22:29:20 +01:00
iCrawl
4f4dde2a09 chore: regen pnpm lock and patch itemLink component 2023-11-06 22:17:07 +01:00
iCrawl
0ca0254d83 chore: upgrade to nextjs canary 2023-11-06 21:49:58 +01:00
iCrawl
6cd3adf030 chore: update deps 2023-11-06 21:38:45 +01:00
Jacob Morrison
637e1a4ddb refactor: Move getNode/canEnableFFmpegOptimizations into a lazy loaded call (#9918)
* Move the getNode/canEnableFFMPEGOptimizations into a lazy loaded call the first time it's actually ever referenced

* PR feedback: Make initializeNodes return a map then nullably assign NODES, this removes an extra variable and cleans up the code

* chore: lint suggestion

Co-authored-by: Aura Román <kyradiscord@gmail.com>

* Use local map instead of recursive

* Run prettier

* Fix lint

---------

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: Aura Román <kyradiscord@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-06 09:17:19 +00:00
Jaw0r3k
ac645084f0 feat: support findLast and reduceRight methods (#9573)
* feat(collection): findLast and reverseRight

* chore(collection): performance and tests change

Co-authored-by: kyra <kyradiscord@gmail.com>

* remove unnecessary code

* Update packages/collection/src/collection.ts

Co-authored-by: Aura Román <kyradiscord@gmail.com>

* Apply suggestions from code review

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: kyra <kyradiscord@gmail.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-11-05 18:49:53 +00:00
Kin
c051ed9427 feat: add guild member (#9877)
* feat: add guild member

* slightly change the description for the guildId and userId parameters in the addMember function

* fix description syntax

* Update packages/core/src/api/guild.ts

Co-authored-by: Jaw0r3k <jaworekwiadomosci@gmail.com>

* add jsdoc for options param

* fix formatting

* add missed semicolon

Co-authored-by: Jaw0r3k <jaworekwiadomosci@gmail.com>

* style: prettier

---------

Co-authored-by: Jaw0r3k <jaworekwiadomosci@gmail.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-05 18:42:17 +00:00
Jaw0r3k
c2349d4be4 feat(cleanContent): add slash commands and emojis (#9809)
* feat(cleanContent): add missing commands and emojis

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>

* fix: check for every possible name

* fix: use non capturing group

---------

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-05 18:36:16 +00:00
Aura Román
31d914e44b fix(Webhook): do not call client.deleteWebhook in delete (#9786)
* fix(Webhook): do not call `client.deleteWebhook` in `delete`

Partially reverts #9777 which caused a regression (#9785) when using `WebhookClient`

* chore: add comment

Co-Authored-By: Souji <timoqueezle@gmail.com>

* fix: move `deleteWebhook` from `Client` to `BaseClient`

---------

Co-authored-by: Souji <timoqueezle@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-05 18:23:32 +00:00
Almeida
efbcda70fc docs: remove markdown (#9914)
docs(formatters): remove markdown

The documentation website does not support rendering markdown

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-05 18:18:23 +00:00
Jiralite
b6c762cb84 feat(Emoji): Add imageURL() (#9788)
feat(Emoji): add `imageURL()`
2023-11-05 18:01:45 +00:00
dank
85a78f96d4 docs(Message): remove duplicated word 'of' in description (#9923)
fix(Message): remove duplicated word 'of' in description

This commit removes the secondary 'of' in the description for the Message structure. This doesn't change anything drastically in terms of the actual code as it's just a JSDoc comment.

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-11-04 22:47:52 +00:00
Synbulat Biishev
85753a9d6f fix(GuildManager#fetch): inject shard id (#9921) 2023-11-04 22:43:11 +00:00
Jiralite
a9e1f6026c fix: Add extension (#9900)
fix: add extension
2023-11-01 16:10:15 +01:00
Almeida
e80194e3fb build: bump discord-api-types (#9908) 2023-10-23 13:09:35 +00:00
Renegade334
0e0b85b766 fix: prevent 'undefined' debug message on intentional shard closure (#9846)
* style: prevent 'undefined' debug message on intentional shard closure

addresses #9594

* refactor(WebSocketManager#destroy): improve debug messaging

cleaner stacktrace format
gracefully closing shards will display an appropriate debug `reason`

* style: unresumable debug messaging

---------

Co-authored-by: Almeida <almeidx@pm.me>
2023-10-21 13:53:41 +00:00
Jiralite
5b4a51945c build: Bump dependencies (#9899)
build: bump dependencies

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-17 20:47:47 +00:00
Almeida
7671a836f4 feat: onboarding mode and edit method (#9647)
* feat: onboarding mode and edit method

* feat(guild): add `editOnboarding`

* fix: use discord-api-types

* types: make arrays readonly

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* fix: bring up to date

* docs: id is a snowflake

* fix: requested changes

* refactor: make most options optional

* refactor: provide GuildEmoji or Emoji instance

* revert: changes to Util

* fix: rebase leftovers

* fix: allow passing option id

* fix: requested changes

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-17 19:30:10 +00:00
Jiralite
e307581442 ci(labels): Use strings in values (#9883)
ci: quote needed `color`s
2023-10-17 18:16:57 +02:00
Jiralite
77be0f0f2d build: Fix create-package script (#9882)
build: fix create-package script
2023-10-17 18:16:21 +02:00
Bartek Szopka
e38d03fbe7 docs(GuildMember): clarify display color (#9891) 2023-10-17 15:52:31 +00:00
Nick
6a63c441fe fix: forward x-audit-log-reason header (#9889)
fix(proxy): forward x-audit-log-reason header
2023-10-16 05:10:19 +00:00
synicalsyntax
8964504d07 fix(website): generate right dapi-types URLs for enum members (#9865)
Fixes #9780

Co-authored-by: syn <hi@syn.gay>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-10-14 19:54:11 +00:00
Jiralite
7276e7c4b7 build: Fix search_indices script (#9869)
build: fix search_indicies script

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-10 14:14:41 +00:00
Jiralite
8cfadb6953 docs: Remove duplicate APIEmoji (#9880)
* types: remove duplicate type definition

* chore: add `Emoji` to method

* types(resolvePartialEmoji): overload method
2023-10-10 13:44:21 +00:00
Jan Parisek
7422d9f172 types(Partials): add toString() method to supported Partials (#9835)
* types(Partials): add toString() method to supported Partials

- includes `PartialDMChannel`, `PartialGuildMember` and `PartialUser`
- does not include
    - `PartialMessage`, since `<PartialMessage>.content` is always null
    - `PartialMessageReaction`, since `MessageReaction` has no `toString()` method
    - `PartialThreadMember`, since `ThreadMember` has no `toString()` method

* types(Partials): replace type of `toString()` methods with return type

* test(Partials): add tests

* types(Partialize): refactor Partialize

* test(PartialThreadMember): fix typo

* types(Partials): clean up unnecessary type overrides

* test(Partials): add tests for <Partials>.partial property

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-10-10 13:39:28 +00:00
Jiralite
1fe7247528 feat: Support new application properties and patch endpoint (#9709)
* feat: support new application endpoints

* chore: edit comment

* fix(ClientApplication): handle flags properly

* types: `readonly`

* chore: update route

* feat: add to core

* refactor(ClientApplication): add to user manager

* chore: remove comments

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-10 13:25:26 +00:00
Jiralite
44a3cbf39e docs: Consolidate API types (#9881)
docs: deduplicate API types

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-10 13:22:02 +00:00
Jiralite
332b624aed docs(stickers): Reveal link in the website (#9870)
docs(stickers): reveal link

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-10 13:19:52 +00:00
cobalt
699b232922 feat(BaseChannel): Add isThreadOnly() (#9847)
* add isThreadBased

* Update typings

* fix name

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-10 13:13:57 +00:00
Danial Raza
11f6955ed9 refactor: use proper variable names in callbacks (#9840)
* refactor: use proper variable names in callbacks

* refactor: change parameter names

* refactor: change remaining parameter names

* refactor: change remaining variable names

* refactor(GuildAuditLogsEntry): abstract reduce logic into a new function

* chore: undo unrelated changes

This undoes commit b2d93dce51 as it's unrelated

* refactor: more name changes

* chore: fix tests failing

* refactor: use option instead of opt

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-10-09 19:49:49 +00:00
Jiralite
2aa3250584 types(MessageEditOptions): Correct attachments type (#9874)
types(MessageEditOptions): fix `attachments` type

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-09 07:18:41 +00:00
Jiralite
ec47e72b41 ci: Use non-deprecated output parameters (#9878)
ci: update to output parameters
2023-10-07 23:35:11 +02:00
Jiralite
e1edba17c4 build: Bump discord-api-types to 0.37.60 (#9876)
build: bump discord-api-types

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-07 16:17:12 +00:00
Vlad Frangu
0529b2af95 fix(Role): calculate position correctly when rawPositions are equal (#9871)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-07 16:14:22 +00:00
Eray
f58628385c fix: update module to NodeNext in tsconfig.json (#9875)
an error was occurring due to the module resolution :3
2023-10-07 16:07:16 +00:00
Jiralite
a674989fe2 docs(collection): Minor article additions (#9868)
docs(collection): add articles
2023-10-04 04:43:23 +00:00
Jiralite
cd987b592b chore: No identifier base in development versions (#9848)
feat: no identifier base in development versions
2023-10-03 19:24:13 +00:00
Jiralite
ec63818bcf build: Disable import/extensions (#9849)
build: update eslint-config-neon
2023-10-03 21:01:31 +02:00
Jiralite
3e516e6e9b build: Bump discord-api-types to 0.37.59 (#9854)
build: bump discord-api-types
2023-10-03 20:06:22 +02:00
Jaw0r3k
5aeb6e1ae6 ci: Disable publishing multiple dev versions under the same commit (#9740)
* chore: disable publishing mutliple versions

Co-authored-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Co-authored-by: Rodrigo Leitão <38259440+ImRodry@users.noreply.github.com>

* Update .github/workflows/publish-dev.yml

Co-authored-by: Aura Román <kyradiscord@gmail.com>

* fix: commit suggestion

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* chore: add suggested changes

* style: add back line

---------

Co-authored-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Co-authored-by: Rodrigo Leitão <38259440+ImRodry@users.noreply.github.com>
Co-authored-by: Aura Román <kyradiscord@gmail.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-10-03 20:05:22 +02:00
DD
93e5bed87d chore: update license files (#9862) 2023-09-30 00:42:43 +00:00
Jiralite
3c043d83a9 types(UserContextMenuCommandInteraction): Nullify targetMember (#9844)
types(UserContextMenuCommandInteraction): nullify `targetMember`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-29 16:14:36 +00:00
Almeida
931c3ed593 feat(StageInstanceManager): add guildScheduledEvent to create() (#8885)
* feat(StageInstanceManager): add `guildScheduledEvent` to `create()`

* fix: requested changes

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-09-28 18:27:15 +00:00
Jiralite
eaabcdfda6 docs: Remove FileOptions (#9855)
docs: remove `FileOptions`
2023-09-26 19:44:09 +00:00
Danial Raza
19ea0baa00 refactor(GuildAuditLogsEntry): abstract reduce logic into a new function (#9845) 2023-09-23 22:40:45 +00:00
Jiralite
1e5c14b741 feat: Support default_thread_rate_limit_per_user in channel creation (#9273)
feat: support `default_thread_rate_limit_per_user` in channel creation
2023-09-19 18:11:46 +00:00
Jiralite
ec3bcb93a5 ci(publish-release): Use correct environment variable (#9838)
ci(publish-release): use correct environment variable for pnpm

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-19 17:49:51 +00:00
Jiralite
5a7b5b56ae ci: Deprecate step after publish & standalone file (#9837)
* ci: deprecate step after publish & standalone file

* docs: update contributing file

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-19 17:47:50 +00:00
Almeida
5bdb34b3be docs: remove broken markdown links (#9822)
chore: remove broken markdown links to documentation

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-18 15:24:49 +00:00
Jiralite
571aedd58a feat: Add media channels (#9662)
* feat: add media channels

* refactor: rename to `ThreadOnlyChannel`

* feat: support media channels more

* docs(ThreadOnlyChannel): update class description

* types: update references

* test: add more tests

* chore: update code

* refactor: `abstract`

Co-authored-by: space <spaceeec@yahoo.com>

---------

Co-authored-by: space <spaceeec@yahoo.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-18 07:35:47 +00:00
Jiralite
e02a59bbb6 refactor: Stickers are free (no more "premium" packs) (#9791)
refactor: stickers are free

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-18 07:29:47 +00:00
Jiralite
32d614ccd3 fix(GuildScheduledEvent): Use if...else pattern and handle partials (#9802)
fix: handle partial case

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-18 07:26:22 +00:00
Jiralite
4588e075c3 docs(DiscordjsErrorCodes): Deprecate unused properties (#9790)
docs(DiscordjsErrorCodes): deprecate unused properties

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-17 21:52:38 +00:00
Jiralite
b6a2441819 feat: Support widget image URL (#9782)
* feat: add widget image URL

* docs(GuildManager): correct parameter type

Co-authored-by: space <spaceeec@yahoo.com>

---------

Co-authored-by: space <spaceeec@yahoo.com>
2023-09-17 18:26:47 +00:00
Souji
310979808e feat(GuildAuditLogsEntry): expose extra integrationType in relevant log types (#9796)
* feat(GuildAuditLogsEntry): expose ingrationType

* fix: not optional, if extra is present on these types

not necessary, as it is conditionally assigned

* fix: remove non-extra approach

* fix(types): string is not guaranteed to be the known enum

* fix: adapt type tests to new extra properties

* fix: include null in type, since extra is not always populated

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-09-17 09:47:46 +00:00
Jaw0r3k
ed14135844 docs(ApplicationCommandManager): id parameter can take options (#9664)
* docs: mention about possible options

* chore: add suggested changes

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-09-17 09:42:36 +00:00
Danial Raza
85b24988a5 docs(Attachment): add MIME types link to contentType (#9824)
* docs(Attachment): add MIME types link to contentType

* docs: don't force locale

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-17 09:37:55 +00:00
Jiralite
7cdfc6c72a ci: Modify environment variable to fix development releases (#9826)
* ci: fix development releases

* build: remove .yarnrc.yml
2023-09-16 21:53:49 +02:00
Danial Raza
c66636da11 feat: add support for teams update (#9805)
* refactor(TeamMember): deprecate permissions property

* feat: add support for team member roles

* feat: add reference to external team member role enum

* docs: suggested changes

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-15 18:18:33 +00:00
Superchupu
9dbc9542c4 types: don't include dom types (#9831)
* types: don't include dom types

* types: try to fix websocket imports
2023-09-11 19:59:36 +00:00
DD
e68ab167c2 fix(WebSocketManager): available sessions check (#9823)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-10 12:42:38 +00:00
n1ck_pro
6404c013e7 types(Client): fix isReady narrowing (#9828)
* types(Client): fix isReady narrowing

* chore: add requested changes

* chore: test both ready cases

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-10 11:49:00 +00:00
Jiralite
c50809e206 docs: Fix "its" typo (#9825)
docs: fix "its" typo
2023-09-09 18:20:15 +00:00
Jeremy Rifkin
8d97e2d2c5 docs(GuildMember): Clarify timeout parameter wording (#9800)
* Update GuildMember.js

* Update GuildMember.js

* Update GuildMember.js

* Update GuildMember.js

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-09-08 07:33:09 +00:00
DD
ff1fda7b59 ci: fix npm dev release workflow (#9817)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-02 11:06:54 +00:00
Jiralite
ba31972d86 build: Bump discord-api-types to 0.37.56 (#9815)
build: bump discord-api-types to 0.37.56

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-02 11:04:25 +00:00
Jiralite
778df45166 feat(CDN): Support emoji size (#9787)
* feat(CDN): support emoji size

* refactor: try to warn in all environments

* feat: add prefix

* refactor: better feedback message

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-02 09:56:09 +00:00
Jiralite
23a6424261 docs(ApplicationsAPI): Fix getCurrent() options description (#9816)
docs(ApplicationsAPI): fix `getCurrent()` options description
2023-08-31 18:21:52 +00:00
Colin McDonnell
7157748fe3 docs(create-discord-bot): support bun in create-discord-bot (#9798) 2023-08-28 09:36:26 +02:00
Jiralite
85d03a3000 ci: Stop documentation upload for create-discord-bot (#9781)
ci: stop documentation upload for create-discord-bot
2023-08-28 09:34:38 +02:00
iCrawl
e1ae7b4d57 chore(create-discord-bot): disable eslint rule for ts 2023-08-27 21:08:42 +02:00
Noel
e96a8a977f build: pnpm (#9806) 2023-08-27 20:24:03 +02:00
Jaw0r3k
8325fa6540 feat: Add no-install option (#9604)
* chore: no install option + fix type

* chore: apply suggestions

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Jaw0r3k <jaw0r3k.git@gmail.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-08-26 21:31:22 +00:00
Souji
485dd718c5 feat(Presence): Expose sync_id in Activity (#9766)
* feat(Presence): Expose sync_id in Activity

* chore: mention non-documentation

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-08-25 19:53:53 +00:00
Almeida
566d5e2c81 feat(formatters): add guild navigation mentions (#9436)
* feat(formatters): add guild navigation mentions

* docs: dont force support article locale

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-08-25 12:01:58 +00:00
Danial Raza
0d787e9f79 feat: add new markdown formatters (#9613)
* feat: add new markdown formatters

Co-authored-by: Jaw0r3k <jaw0r3k.g@gmail.com>

* Update packages/formatters/src/formatters.ts

Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>

* refactor: remove unnecessary index tracking and rename 'array' to 'items'

Co-authored-by: Almeida <almeidx@pm.me>

* refactor: rename 'array' to 'items'

Co-authored-by: Almeida <almeidx@pm.me>

* refactor(heading): consolidate heading functions into a single function

Also correct param names from array to items.

Co-authored-by: Jaw0r3k <jaw0r3k.g@gmail.com>

* refactor: add HeadingLevel enum and use switch case

* fix: export HeadingLevel enum

Co-authored-by: Jaw0r3k <jaworekwiadomosci@gmail.com>

* feat(heading): add missing documentation for level parameter

* refactor: update list formatters

* docs: correct heading formatter description

* refactor: update list formatters

* fix(heading): remove unnecessary space

* refactor: move list callback function to outer scope

* test: add tests

* refactor: requested changes

* refactor: suggested changes

* docs: add missing documentation

* style: suggested change

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* refactor: use math max method instead

Co-authored-by: Almeida <almeidx@pm.me>

---------

Co-authored-by: Jaw0r3k <jaw0r3k.g@gmail.com>
Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: Jaw0r3k <jaworekwiadomosci@gmail.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: space <spaceeec@yahoo.com>
2023-08-25 10:06:13 +00:00
Jiralite
50106c77db feat: Implement GET current application (#9797)
* feat: implement current application route

* refactor: pluralisation

Co-authored-by: Suneet Tipirneni <77477100+suneettipirneni@users.noreply.github.com>

---------

Co-authored-by: Suneet Tipirneni <77477100+suneettipirneni@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-08-25 09:33:33 +00:00
iCrawl
22011575cd build: fixup vscode-eslint 2023-08-24 23:44:35 +02:00
iCrawl
e3127a0735 build: fix linting 2023-08-24 23:08:29 +02:00
iCrawl
9811514deb build: ignores/swap/concurrency 2023-08-24 21:58:34 +02:00
iCrawl
6ea63d000b chore: regen lockfile 2023-08-24 20:33:50 +02:00
iCrawl
fb81f7befb build: refactor linting setup 2023-08-24 06:43:23 +02:00
White Wolf
788888ab9a fix(TransformerGraph): Explicitly include input args for readable input cases instead of just for string input cases (#9793)
Explicitly add input args for readable input cases instead of just for string input cases.
Change also ensures that constant arrays are passed by value instead of by reference, preventing them from accidentally being modified.

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-08-23 16:10:22 +00:00
iCrawl
f6c7c14c9e chore: cleanup from debug 2023-08-22 09:48:36 +02:00
iCrawl
d37632da05 build: refactor linting 2023-08-22 09:40:11 +02:00
iCrawl
2e40a05adf chore: fixup exports and move prettier/lintstaged to mjs 2023-08-22 01:58:54 +02:00
iCrawl
1e3aed0d97 chore: config overhaul 2023-08-22 01:33:47 +02:00
iCrawl
5d7c59c301 chore: deps 2023-08-22 00:30:08 +02:00
Jiralite
899bc5f78b build: bump Undici and discord-api-types (#9779)
* build: bump discord-api-types

* build: bump Undici too

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-08-21 21:00:14 +00:00
Noel
dd5e7453e8 feat(create-discord-bot): bun/deno templates (#9795) 2023-08-21 22:48:13 +02:00
iCrawl
8eb978d32c chore(discord.js): release discord.js@14.13.0 2023-08-17 21:45:00 +02:00
iCrawl
5d1b233047 chore(core): release @discordjs/core@1.0.1 2023-08-17 21:44:09 +02:00
iCrawl
4ab05e994e chore(ws): release @discordjs/ws@1.0.1 2023-08-17 21:43:19 +02:00
iCrawl
4bc2667a5f chore(proxy): release @discordjs/proxy@2.0.1 2023-08-17 21:42:44 +02:00
iCrawl
84ead6e554 chore(rest): release @discordjs/rest@2.0.1 2023-08-17 21:41:52 +02:00
iCrawl
0220fb7278 chore(builders): release @discordjs/builders@1.6.5 2023-08-17 21:40:56 +02:00
iCrawl
6da456767e chore(util): release @discordjs/util@1.0.1 2023-08-17 21:39:49 +02:00
iCrawl
67b30355ea chore(formatters): release @discordjs/formatters@0.3.2 2023-08-17 21:38:59 +02:00
iCrawl
58d9024245 chore(create-discord-bot): release create-discord-bot@0.2.1 2023-08-17 21:38:20 +02:00
1922 changed files with 140317 additions and 60817 deletions

View File

@@ -1,11 +1,13 @@
{
"$schema": "https://json.schemastore.org/commitlintrc.json",
"extends": ["@commitlint/config-angular"],
"rules": {
"type-enum": [
2,
"always",
["chore", "build", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test", "types", "typings"]
["chore", "build", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test", "types"]
],
"scope-case": [0]
"scope-case": [0],
"subject-exclamation-mark": [0]
}
}

View File

@@ -1,11 +0,0 @@
{
"root": true,
"extends": ["neon/common", "neon/node", "neon/typescript", "neon/prettier"],
"parserOptions": {
"project": ["./tsconfig.eslint.json", "./apps/*/tsconfig.eslint.json", "./packages/*/tsconfig.eslint.json"]
},
"rules": {
"@typescript-eslint/consistent-type-definitions": ["error", "interface"]
},
"ignorePatterns": ["**/dist/*"]
}

3
.git-blame-ignore-revs Normal file
View File

@@ -0,0 +1,3 @@
# .git-blame-ignore-revs
# switched to eslint-config-neon for mainlib discord.js
b03c65c34c6e8bab7f97d507d6ccd7c441a14360

1
.gitattributes vendored
View File

@@ -1 +1,2 @@
* text=auto eol=lf
pnpm-lock.yaml linguist-generated=true text=auto eol=lf

View File

@@ -2,7 +2,7 @@ version = 1
[merge]
require_automerge_label = false
blocking_labels = ['blocked']
blocking_labels = ['blocked', 'in review', 'semver:major']
method = 'squash'
[merge.message]

14
.github/CODEOWNERS vendored
View File

@@ -1,13 +1,21 @@
# Learn how to add code owners here:
# https://help.github.com/en/articles/about-code-owners
# https://help.github.com/articles/about-code-owners
* @iCrawl
package.json @discordjs/core
pnpm-lock.yaml @discordjs/core
/.github/ISSUE_TEMPLATE/ @discordjs/guide @discordjs/core
/apps/guide/ @discordjs/website @discordjs/guide
/apps/guide/src/content/ @discordjs/guide
/apps/guide/content/ @discordjs/guide
/apps/proxy-container/ @discordjs/proxy
/apps/website/ @discordjs/website
/packages/actions/ @discordjs/actions
/packages/api-extractor/ @discordjs/api-extractor-utils
/packages/api-extractor-model/ @discordjs/api-extractor-utils
/packages/api-extractor-utils/ @discordjs/api-extractor-utils
/packages/brokers/ @discordjs/brokers
/packages/builders/ @discordjs/builders
@@ -19,9 +27,9 @@
/packages/formatters/ @discordjs/formatters
/packages/next/ @discordjs/core
/packages/proxy/ @discordjs/proxy
/packages/proxy-container/ @discordjs/proxy
/packages/rest/ @discordjs/rest
/packages/scripts/ @discordjs/scripts
/packages/structures/ @discordjs/structures
/packages/ui/ @discordjs/ui
/packages/util/ @discordjs/util
/packages/voice/ @discordjs/core

View File

@@ -7,7 +7,7 @@
Messages must be matched by the following regex:
```js
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|types|wip)(\(.+\))?: .{1,72}/;
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|build|ci|chore|types)(\(.+\))?!?: .{1,72}/;
```
#### Examples
@@ -55,6 +55,7 @@ A commit message consists of a **header**, **body** and **footer**. The header h
```
The **header** is mandatory and the **scope** of the header is optional.
If the commit contains **Breaking Changes**, a `!` can be added before the `:` as an indicator.
### Revert

View File

@@ -11,22 +11,20 @@ is a great boon to your development process.
To get ready to work on the codebase, please do the following:
1. Fork & clone the repository, and make sure you're on the **main** branch
2. Run `yarn --immutable` ([install](https://yarnpkg.com/getting-started/install))
3. Run `yarn build` to build local packages
2. Run `pnpm install --frozen-lockfile` ([install](https://pnpm.io/installation))
3. Run `pnpm run build` to build local packages
4. Code your heart out!
5. Run `yarn test` to run ESLint and ensure any JSDoc changes are valid
5. Run `pnpm run test` to run ESLint and ensure any JSDoc changes are valid
6. [Submit a pull request](https://github.com/discordjs/discord.js/compare) (Make sure you follow the [conventional commit format](https://github.com/discordjs/discord.js/blob/main/.github/COMMIT_CONVENTION.md))
## Testing changes locally
If you want to test changes you've made locally, you can do so by using `yarn link`. This will create a symlink to your local copy of the discord.js libraries.
If you want to test changes you've made locally, you can do so by using `pnpm link <package-you-want-to-link-to-your-current-package>`. This will create a symlink to your local copy of the discord.js libraries.
1. Create a new directory `mkdir discordjs-test` and move into it `cd discordjs-test`
2. Initialize a new yarn 3 project `yarn init -2`
3. Disable pnp `yarn config set nodeLinker node-modules`
4. Now link the local discord.js project you cloned earlier `yarn link -A {PATH_TO_DISCORDJS_REPO}`
5. Install packages you'd like to test locally `yarn add discord.js@latest`, `yarn add @discordjs/rest@latest`, etc. **Note: Make sure you use `latest` tag or else yarn will try to install the remote package from npm**
6. Import the package in your source code and test them out!
2. Initialize a new pnpm project `pnpm init`
3. Now link the discord.js package from the directory you cloned earlier `pnpm link {PATH_TO_DISCORDJS_REPO}/packages/<package>`. (e.g. `pnpm link ~/discord.js/packages/rest`)
4. Import the package in your source code and test them out!
### Working with TypeScript packages
@@ -34,15 +32,18 @@ When testing local changes, you may notice you need to manually recompile TypeSc
To avoid this you can use the `--watch` parameter in the package build script to automatically recompile the project when changes are detected.
For example, to automatically recompile the `@discordjs/rest` project when changes are detected, run `yarn turbo run build --filter=@discordjs/rest -- --watch` in the root folder of where you cloned the discord.js repo.
For example, to automatically recompile the `@discordjs/rest` project when changes are detected, run `pnpm turbo run build --filter='@discordjs/rest' -- --watch` in the root folder of where you cloned the discord.js repo.
## Adding new packages
If you'd like to create another package under the `@discordjs` organization run the following command:
```sh
yarn create-package <package-name> [package-description]
pnpm run create-package <package-name> [package-description]
```
This will create new package directory under `packages/` with the required configuration files. You can
begin to make changes within the `src/` directory. It may also be required to update the CODEOWNERS file.
This will create new package directory under `packages/` with the required configuration files. You may begin
to make changes within the `src/` directory. You may also need to:
- Update workflows that utilize packages
- Update the CODEOWNERS file

View File

@@ -22,8 +22,8 @@ body:
- formatters
- next
- proxy
- proxy-container
- rest
- structures
- ui
- util
- voice
@@ -61,9 +61,9 @@ body:
label: Versions
description: List necessary versions here. This includes your package version, runtime version, operating system etc.
placeholder: |
- discord.js 14.12.1 (`npm ls discord.js` or another package)
- Node.js 16.11.0 (`node --version`)
- TypeScript 5.1.6 (`npm ls typescript` if you use it)
- discord.js 14.24.2 (`npm ls discord.js` or another package)
- Node.js 24.11.0 (`node --version`)
- TypeScript 5.9.3 (`npm ls typescript` if you use it)
- macOS Ventura 13.3.1
validations:
required: true
@@ -93,6 +93,9 @@ body:
- Reaction
- GuildScheduledEvent
- ThreadMember
- Poll
- PollAnswer
- SoundboardSound
multiple: true
validations:
required: true
@@ -107,7 +110,7 @@ body:
- Guilds
- GuildMembers
- GuildModeration
- GuildEmojisAndStickers
- GuildExpressions
- GuildIntegrations
- GuildWebhooks
- GuildInvites
@@ -123,6 +126,8 @@ body:
- GuildScheduledEvents
- AutoModerationConfiguration
- AutoModerationExecution
- GuildMessagePolls
- DirectMessagePolls
multiple: true
validations:
required: true

View File

@@ -0,0 +1,51 @@
name: Proxy Container bug report
description: Report an issue with the proxy container.
labels: [bug, need repro, apps:proxy-container]
body:
- type: markdown
attributes:
value: |
Thank you for filing an issue! If you are here to ask a question, use Discord instead: https://discord.gg/djs
This issue form is for the proxy container.
- type: textarea
id: description
attributes:
label: Issue description
description: Describe the issue in as much detail as possible.
validations:
required: true
- type: textarea
id: steps_to_reproduce
attributes:
label: Steps to Reproduce
description: What steps must be taken to reproduce this issue?
placeholder: |
1. Pull the container image
2. Run the container with specific configuration
3. Send a request
4. Observe behavior
validations:
required: true
- type: textarea
id: versions
attributes:
label: Versions
description: List necessary versions here. This includes the container image tag, Docker version, operating system etc.
placeholder: |
- discordjs/proxy 1.0.0
- Docker 27.5.1
- Linux 6.1.0
validations:
required: true
- type: dropdown
id: priority
attributes:
label: Issue priority
description: Please be realistic. If you need to elaborate on your reasoning, please use the issue description field above.
options:
- Low (slightly annoying)
- Medium (should be fixed soon)
- High (immediate attention needed)
validations:
required: true

View File

@@ -16,6 +16,7 @@ body:
- discord.js
- Documentation
- Guide
- Proxy Container
- brokers
- builders
- collection
@@ -24,8 +25,8 @@ body:
- formatters
- next
- proxy
- proxy-container
- rest
- structures
- ui
- util
- voice

27
.github/ISSUE_TEMPLATE/05-guide.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: Guide content
description: Request to add to the guide or change existing content
labels: [apps:guide]
type: Task
body:
- type: markdown
attributes:
value: |
Thanks for filing a suggestion! If you are here to ask a question, use Discord instead: https://discord.gg/djs
- type: dropdown
id: issuetype
attributes:
label: What is your suggestion about?
options:
- Requesting new content
- Changing existing content
- Correcting wrong information
validations:
required: true
- type: input
id: section
attributes:
label: Guide section the suggestion is about.
- type: textarea
id: body
attributes:
label: Describe your suggestion in detail.

View File

@@ -1,12 +0,0 @@
**Please describe the changes this PR makes and why it should be merged:**
**Status and versioning classification:**
<!--
Please move lines that apply to you out of the comment:
- Code changes have been tested against the Discord API, or there are no code changes
- I know how to update typings and have done so, or typings don't need updating
- This PR changes the library's interface (methods or parameters added)
- This PR includes breaking changes (methods removed or renamed, parameters moved or removed)
- This PR **only** includes non-code changes, like changes to documentation, README, etc.
-->

View File

@@ -1,6 +1,9 @@
apps:guide:
- "### Which (application|package|application or package) is this (bug
report|feature request) for\\?\\n\\nGuide\\n"
apps:proxy-container:
- "### Which (application|package|application or package) is this (bug
report|feature request) for\\?\\n\\nProxy Container\\n"
apps:website:
- "### Which (application|package|application or package) is this (bug
report|feature request) for\\?\\n\\nDocumentation\\n"
@@ -31,12 +34,12 @@ packages:next:
packages:proxy:
- "### Which (application|package|application or package) is this (bug
report|feature request) for\\?\\n\\nproxy\\n"
packages:proxy-container:
- "### Which (application|package|application or package) is this (bug
report|feature request) for\\?\\n\\nproxy-container\\n"
packages:rest:
- "### Which (application|package|application or package) is this (bug
report|feature request) for\\?\\n\\nrest\\n"
packages:structures:
- "### Which (application|package|application or package) is this (bug
report|feature request) for\\?\\n\\nstructures\\n"
packages:ui:
- "### Which (application|package|application or package) is this (bug
report|feature request) for\\?\\n\\ui\\n"

125
.github/labeler.yml vendored
View File

@@ -1,54 +1,105 @@
apps:guide:
- apps/guide/*
- apps/guide/**/*
- changed-files:
- any-glob-to-any-file:
- apps/guide/*
- apps/guide/**/*
apps:proxy-container:
- changed-files:
- any-glob-to-any-file:
- apps/proxy-container/*
- apps/proxy-container/**/*
apps:website:
- apps/website/*
- apps/website/**/*
- changed-files:
- any-glob-to-any-file:
- apps/website/*
- apps/website/**/*
packages:api-extractor:
- changed-files:
- any-glob-to-any-file:
- packages/api-extractor/*
- packages/api-extractor/**/*
packages:api-extractor-model:
- changed-files:
- any-glob-to-any-file:
- packages/api-extractor-model/*
- packages/api-extractor-model/**/*
packages:brokers:
- packages/brokers/*
- packages/brokers/**/*
- changed-files:
- any-glob-to-any-file:
- packages/brokers/*
- packages/brokers/**/*
packages:builders:
- packages/builders/*
- packages/builders/**/*
- changed-files:
- any-glob-to-any-file:
- packages/builders/*
- packages/builders/**/*
packages:collection:
- packages/collection/*
- packages/collection/**/*
- changed-files:
- any-glob-to-any-file:
- packages/collection/*
- packages/collection/**/*
packages:core:
- packages/core/*
- packages/core/**/*
- changed-files:
- any-glob-to-any-file:
- packages/core/*
- packages/core/**/*
packages:create-discord-bot:
- packages/create-discord-bot/*
- packages/create-discord-bot/**/*
- changed-files:
- any-glob-to-any-file:
- packages/create-discord-bot/*
- packages/create-discord-bot/**/*
packages:discord.js:
- packages/discord.js/*
- packages/discord.js/**/*
- changed-files:
- any-glob-to-any-file:
- packages/discord.js/*
- packages/discord.js/**/*
packages:docgen:
- packages/docgen/*
- packages/docgen/**/*
- changed-files:
- any-glob-to-any-file:
- packages/docgen/*
- packages/docgen/**/*
packages:formatters:
- packages/formatters/*
- packages/formatters/**/*
- changed-files:
- any-glob-to-any-file:
- packages/formatters/*
- packages/formatters/**/*
packages:next:
- packages/next/*
- packages/next/**/*
- changed-files:
- any-glob-to-any-file:
- packages/next/*
- packages/next/**/*
packages:proxy:
- packages/proxy/*
- packages/proxy/**/*
packages:proxy-container:
- packages/proxy-container/*
- packages/proxy-container/**/*
- changed-files:
- any-glob-to-any-file:
- packages/proxy/*
- packages/proxy/**/*
packages:rest:
- packages/rest/*
- packages/rest/**/*
- changed-files:
- any-glob-to-any-file:
- packages/rest/*
- packages/rest/**/*
packages:structures:
- changed-files:
- any-glob-to-any-file:
- packages/structures/*
- packages/structures/**/*
packages:ui:
- packages/ui/*
- packages/ui/**/*
- changed-files:
- any-glob-to-any-file:
- packages/ui/*
- packages/ui/**/*
packages:util:
- packages/util/*
- packages/util/**/*
- changed-files:
- any-glob-to-any-file:
- packages/util/*
- packages/util/**/*
packages:voice:
- packages/voice/*
- packages/voice/**/*
- changed-files:
- any-glob-to-any-file:
- packages/voice/*
- packages/voice/**/*
packages:ws:
- packages/ws/*
- packages/ws/**/*
- changed-files:
- any-glob-to-any-file:
- packages/ws/*
- packages/ws/**/*

22
.github/labels.yml vendored
View File

@@ -1,15 +1,19 @@
- name: api changes
color: 5663e9
color: '5663e9'
- name: api support
color: 5663e9
color: '5663e9'
- name: apps:guide
color: fbca04
- name: apps:proxy-container
color: fbca04
- name: apps:website
color: fbca04
- name: backlog
color: 7ef7ef
- name: backport
color: 88aabb
- name: backport-candidate
color: 0075ca
- name: blocked
color: fc1423
- name: bug
@@ -23,7 +27,7 @@
- name: dependencies
color: 276bd1
- name: discord
color: 5663e9
color: '5663e9'
- name: discussion
color: b6b1f9
- name: documentation
@@ -38,10 +42,8 @@
color: 80c042
- name: good first issue
color: 7057ff
- name: has PR
color: 4b1f8e
- name: help wanted
color: 008672
color: '008672'
- name: in progress
color: ffccd7
- name: in review
@@ -52,6 +54,10 @@
color: e4e669
- name: need repro
color: c66037
- name: packages:api-extractor
color: fbca04
- name: packages:api-extractor-model
color: fbca04
- name: packages:brokers
color: fbca04
- name: packages:builders
@@ -72,10 +78,10 @@
color: fbca04
- name: packages:proxy
color: fbca04
- name: packages:proxy-container
color: fbca04
- name: packages:rest
color: fbca04
- name: packages:structures
color: fbca04
- name: packages:ui
color: fbca04
- name: packages:util

35
.github/workflows/cleanup-cache.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
# https://docs.github.com/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries
name: Cleanup caches
on:
pull_request:
types:
- closed
workflow_dispatch:
jobs:
cleanup:
name: Cleanup caches
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Cleanup caches
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

35
.github/workflows/deploy-website.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Deploy website
on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
deploy-website:
name: Deploy website
runs-on: ubuntu-latest
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
if: github.repository_owner == 'discordjs'
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Node.js v24
uses: actions/setup-node@v6
with:
node-version: 24
package-manager-cache: false
- name: Install dependencies
uses: ./packages/actions/src/pnpmCache
- name: Pull vercel production environment
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build website artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy website artifacts to vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}

56
.github/workflows/deprecate-version.yml vendored Normal file
View File

@@ -0,0 +1,56 @@
name: Deprecate version
on:
workflow_dispatch:
inputs:
package:
description: Package
required: true
type: choice
options:
- '@discordjs/brokers'
- '@discordjs/builders'
- '@discordjs/collection'
- '@discordjs/core'
- 'create-discord-app'
- 'create-discord-bot'
- '@discordjs/formatters'
- 'discord.js'
- '@discordjs/next'
- '@discordjs/proxy'
- '@discordjs/rest'
- '@discordjs/structures'
- '@discordjs/util'
- '@discordjs/voice'
- '@discordjs/ws'
version:
description: Version(s)
required: true
type: string
message:
description: Deprecation message
required: false
type: string
jobs:
deprecate:
runs-on: ubuntu-latest
if: github.repository_owner == 'discordjs'
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Node.js v24
uses: actions/setup-node@v6
with:
node-version: 24
package-manager-cache: false
- name: Install dependencies
uses: ./packages/actions/src/pnpmCache
- name: Deprecate
uses: ./packages/actions/src/deprecateVersion
with:
package: ${{ inputs.package }}
version: ${{ inputs.version }}
message: ${{ inputs.message }}
node-auth-token: ${{ secrets.NPM_PUBLISH_TOKEN }}

View File

@@ -5,8 +5,12 @@ on:
- 'main'
paths:
- 'packages/*/src/**'
- '!packages/create-discord-bot/**'
- '!packages/ui/**'
tags:
- '**'
- '!create-discord-app@*'
- '!create-discord-bot@*'
workflow_dispatch:
inputs:
ref:
@@ -23,94 +27,210 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
build-docs:
name: Build & upload documentation
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
REF_TYPE: ${{ inputs.ref_type || github.ref_type }}
if: github.repository_owner == 'discordjs'
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v6
with:
ref: ${{ inputs.ref || '' }}
- name: Install node.js v18
uses: actions/setup-node@v3
- name: Install Node.js v24
uses: actions/setup-node@v6
with:
node-version: 18
node-version: 24
package-manager-cache: false
- name: Install dependencies
uses: ./packages/actions/src/yarnCache
uses: ./packages/actions/src/pnpmCache
- name: Build dependencies
run: yarn build
run: pnpm run build
- name: Build docs
run: yarn docs
- name: Checkout docs repository
uses: actions/checkout@v3
- name: Checkout main repository
if: ${{ inputs.ref && inputs.ref != 'main' }}
uses: actions/checkout@v6
with:
repository: 'discordjs/docs'
token: ${{ secrets.DJS_DOCS }}
path: 'out'
path: 'main'
- name: Build main
if: ${{ inputs.ref && inputs.ref != 'main' }}
shell: bash
env:
COREPACK_ENABLE_STRICT: 0
run: |
cd main
pnpm self-update 10
pnpm install --frozen-lockfile --prefer-offline --loglevel error
pnpm run build
cd ..
- name: Extract package and semver from tag
if: ${{ github.ref_type == 'tag' }}
if: ${{ env.REF_TYPE == 'tag' }}
id: extract-tag
uses: ./packages/actions/src/formatTag
with:
tag: ${{ github.ref_name }}
tag: ${{ inputs.ref || github.ref_name }}
- name: Apply tag to api-extractor config
if: ${{ env.REF_TYPE == 'tag' && !inputs.ref }}
run: sed -i 's!https://github.com/discordjs/discord.js/tree/main!https://github.com/discordjs/discord.js/tree/${{ github.ref_name }}!' "packages/${{ steps.extract-tag.outputs.package}}/api-extractor.json"
- name: Build docs
run: pnpm run docs
- name: Build docs with main api-extractor
if: ${{ inputs.ref && inputs.ref != 'main' }}
run: |
declare -a PACKAGES=("brokers" "builders" "collection" "core" "discord.js" "formatters" "next" "proxy" "rest" "structures" "util" "voice" "ws")
for PACKAGE in "${PACKAGES[@]}"; do
if [ ! -d "packages/${PACKAGE}" ]; then
echo "::notice::${PACKAGE} does not exist on this ref. Skipping..."
continue
fi
cd "packages/${PACKAGE}"
sed -i 's!https://github.com/discordjs/discord.js/tree/main!https://github.com/discordjs/discord.js/tree/${{ inputs.ref }}!' api-extractor.json
../../main/packages/api-extractor/bin/api-extractor run --local --minify
../../main/packages/scripts/bin/generateSplitDocumentation.js
cd ../..
done
- name: Upload documentation to database
if: ${{ github.ref_type == 'tag' }}
if: ${{ env.REF_TYPE == 'tag' && (!inputs.ref || inputs.ref == 'main') }}
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
CF_D1_DOCS_API_KEY: ${{ secrets.CF_D1_DOCS_API_KEY }}
CF_D1_DOCS_ID: ${{ secrets.CF_D1_DOCS_ID }}
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
CF_R2_DOCS_BUCKET_URL: ${{ secrets.CF_R2_DOCS_BUCKET_URL }}
uses: ./packages/actions/src/uploadDocumentation
with:
package: ${{ steps.extract-tag.outputs.package }}
version: ${{ steps.extract-tag.outputs.semver }}
- name: Move docs to correct directory
if: ${{ github.ref_type == 'tag' }}
- name: Upload documentation to database
if: ${{ env.REF_TYPE == 'tag' && inputs.ref && inputs.ref != 'main' }}
env:
PACKAGE: ${{ steps.extract-tag.outputs.package }}
SEMVER: ${{ steps.extract-tag.outputs.semver }}
run: |
mkdir -p "out/${PACKAGE}"
if [[ "${PACKAGE}" == "discord.js" ]]; then
mv "packages/${PACKAGE}/docs/docs.json" "out/${PACKAGE}/${SEMVER}.json"
else
mv "packages/${PACKAGE}/docs/docs.api.json" "out/${PACKAGE}/${SEMVER}.api.json"
fi
CF_D1_DOCS_API_KEY: ${{ secrets.CF_D1_DOCS_API_KEY }}
CF_D1_DOCS_ID: ${{ secrets.CF_D1_DOCS_ID }}
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
CF_R2_DOCS_BUCKET_URL: ${{ secrets.CF_R2_DOCS_BUCKET_URL }}
uses: ./main/packages/actions/src/uploadDocumentation
with:
package: ${{ steps.extract-tag.outputs.package }}
version: ${{ steps.extract-tag.outputs.semver }}
- name: Upload split documentation to blob storage
if: ${{ env.REF_TYPE == 'tag' && (!inputs.ref || inputs.ref == 'main') }}
env:
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
uses: ./packages/actions/src/uploadSplitDocumentation
with:
package: ${{ steps.extract-tag.outputs.package }}
version: ${{ steps.extract-tag.outputs.semver }}
- name: Upload split documentation to blob storage
if: ${{ env.REF_TYPE == 'tag' && inputs.ref && inputs.ref != 'main' }}
env:
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
uses: ./main/packages/actions/src/uploadSplitDocumentation
with:
package: ${{ steps.extract-tag.outputs.package }}
version: ${{ steps.extract-tag.outputs.semver }}
- name: Upload documentation to database
if: ${{ github.ref_type == 'branch' }}
if: ${{ env.REF_TYPE == 'branch' && (!inputs.ref || inputs.ref == 'main') }}
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
CF_D1_DOCS_API_KEY: ${{ secrets.CF_D1_DOCS_API_KEY }}
CF_D1_DOCS_ID: ${{ secrets.CF_D1_DOCS_ID }}
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
CF_R2_DOCS_BUCKET_URL: ${{ secrets.CF_R2_DOCS_BUCKET_URL }}
uses: ./packages/actions/src/uploadDocumentation
- name: Move docs to correct directory
if: ${{ github.ref_type == 'branch' }}
run: |
declare -a PACKAGES=("brokers" "builders" "collection" "core" "discord.js" "next" "formatters" "proxy" "rest" "util" "voice" "ws")
for PACKAGE in "${PACKAGES[@]}"; do
if [[ "${PACKAGE}" == "discord.js" ]]; then
mkdir -p "out/${PACKAGE}"
mv "packages/${PACKAGE}/docs/docs.json" "out/${PACKAGE}/${GITHUB_REF_NAME}.json"
else
mkdir -p "out/${PACKAGE}"
mv "packages/${PACKAGE}/docs/docs.api.json" "out/${PACKAGE}/${GITHUB_REF_NAME}.api.json"
fi
done
- name: Upload documentation to database
if: ${{ env.REF_TYPE == 'branch' && inputs.ref && inputs.ref != 'main' }}
env:
CF_D1_DOCS_API_KEY: ${{ secrets.CF_D1_DOCS_API_KEY }}
CF_D1_DOCS_ID: ${{ secrets.CF_D1_DOCS_ID }}
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
CF_R2_DOCS_BUCKET_URL: ${{ secrets.CF_R2_DOCS_BUCKET_URL }}
uses: ./main/packages/actions/src/uploadDocumentation
- name: Commit and push
run: |
cd out
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git add .
git commit -m "Docs build for ${GITHUB_REF_TYPE} ${GITHUB_REF_NAME}: ${GITHUB_SHA}" || true
git push
- name: Upload split documentation to blob storage
if: ${{ env.REF_TYPE == 'branch' && (!inputs.ref || inputs.ref == 'main') }}
env:
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
uses: ./packages/actions/src/uploadSplitDocumentation
- name: Upload split documentation to blob storage
if: ${{ env.REF_TYPE == 'branch' && inputs.ref && inputs.ref != 'main' }}
env:
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
uses: ./main/packages/actions/src/uploadSplitDocumentation
build-indices:
needs: build-docs
name: Build & upload search indices
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
if: github.repository_owner == 'discordjs'
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Node.js v24
uses: actions/setup-node@v6
with:
node-version: 24
package-manager-cache: false
- name: Install dependencies
uses: ./packages/actions/src/pnpmCache
- name: Build dependencies
run: pnpm run build
- name: Upload search indices to meilisearch
env:
CF_D1_DOCS_API_KEY: ${{ secrets.CF_D1_DOCS_API_KEY }}
CF_D1_DOCS_ID: ${{ secrets.CF_D1_DOCS_ID }}
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
SEARCH_API_URL: ${{ secrets.SEARCH_API_URL }}
SEARCH_API_KEY: ${{ secrets.SEARCH_API_KEY }}
uses: ./packages/actions/src/uploadSearchIndices

View File

@@ -6,7 +6,7 @@ jobs:
issue-triage:
runs-on: ubuntu-latest
steps:
- uses: github/issue-labeler@v3.1
- uses: github/issue-labeler@v3.4
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
configuration-path: .github/issue-labeler.yml

View File

@@ -15,9 +15,9 @@ jobs:
if: github.repository_owner == 'discordjs'
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v6
- name: Label sync
uses: crazy-max/ghaction-github-labeler@v4
uses: crazy-max/ghaction-github-labeler@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,20 +0,0 @@
name: 'Lighthouse Audit (main)'
on:
workflow_dispatch:
jobs:
lighthouse_audit_main:
name: 'Lighthouse Audit (main)'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Audit production URLs with Lighthouse
id: lighthouse_audit
uses: treosh/lighthouse-ci-action@v9
with:
urls: |
https://discordjs.dev
https://guide.discordjs.dev
uploadArtifacts: true
temporaryPublicStorage: true

View File

@@ -1,88 +0,0 @@
name: 'Lighthouse Audit'
on:
issue_comment:
types: [created, edited]
jobs:
lighthouse_audit:
name: 'Lighthouse Audit'
if: ${{ github.event.issue.pull_request }}
runs-on: ubuntu-latest
steps:
- name: Get Vercel preview URL
id: get_preview_url
uses: actions/github-script@v6
with:
script: |
const comment = context.payload.comment;
const regex = /https:\/\/[a-z0-9-]+\.vercel\.app/g;
const matches = comment.body.match(regex);
let previewUrl = "";
if (matches && matches.length) {
previewUrl = matches[0];
console.log('Preview url found:', previewUrl);
}
console.log("No preview url found.");
core.setOutput('vercel_preview_url', previewUrl);
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Add comment to PR
if: ${{ steps.get_preview_url.outputs.vercel_preview_url != '' }}
id: loading_comment_to_pr
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.issue.number }}
header: lighthouse
message: |
Running Lighthouse audit...
- name: Checkout repository
if: ${{ steps.get_preview_url.outputs.vercel_preview_url != '' }}
uses: actions/checkout@v3
- name: Audit preview URL with Lighthouse
if: ${{ steps.get_preview_url.outputs.vercel_preview_url != '' }}
id: lighthouse_audit
uses: treosh/lighthouse-ci-action@v9
with:
urls: |
${{ steps.get_preview_url.outputs.vercel_preview_url }}
uploadArtifacts: true
temporaryPublicStorage: true
- name: Format lighthouse score
if: ${{ steps.get_preview_url.outputs.vercel_preview_url != '' }}
id: format_lighthouse_score
uses: actions/github-script@v6
with:
script: |
const result = ${{ steps.lighthouse_audit.outputs.manifest }}[0].summary
const links = ${{ steps.lighthouse_audit.outputs.links }}
const formatResult = (res) => Math.round((res * 100))
Object.keys(result).forEach(key => result[key] = formatResult(result[key]))
const score = res => res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'
const comment = [
`⚡️ [Lighthouse report](${Object.values(links)[0]}) for the changes in this PR:`,
'| Category | Score |',
'| --- | --- |',
`| ${score(result.performance)} Performance | ${result.performance} |`,
`| ${score(result.accessibility)} Accessibility | ${result.accessibility} |`,
`| ${score(result['best-practices'])} Best practices | ${result['best-practices']} |`,
`| ${score(result.seo)} SEO | ${result.seo} |`,
`| ${score(result.pwa)} PWA | ${result.pwa} |`,
' ',
`*Lighthouse ran on [${Object.keys(links)[0]}](${Object.keys(links)[0]})*`
].join('\n')
core.setOutput("comment", comment);
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Add comment to PR
if: ${{ steps.get_preview_url.outputs.vercel_preview_url != '' }}
id: comment_to_pr
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ github.event.issue.number }}
header: lighthouse
message: |
${{ steps.format_lighthouse_score.outputs.comment }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -3,15 +3,15 @@ on:
schedule:
- cron: '0 16 * * *'
workflow_dispatch:
permissions:
issues: write
concurrency:
group: lock
jobs:
action:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: dessant/lock-threads@v4
- uses: dessant/lock-threads@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
issue-inactive-days: 365

View File

@@ -1,26 +0,0 @@
name: npm auto deprecate
on:
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
jobs:
npm-auto-deprecate:
name: npm auto deprecate
runs-on: ubuntu-latest
if: github.repository_owner == 'discordjs'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install node.js v18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
uses: ./packages/actions/src/yarnCache
- name: Deprecate versions
run: 'yarn npm-deprecate --name "*dev*" --package @discordjs/brokers @discordjs/builders @discordjs/collection @discordjs/core @discordjs/formatters discord.js @discordjs/next @discordjs/proxy @discordjs/rest @discordjs/util @discordjs/voice @discordjs/ws'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

View File

@@ -1,13 +1,34 @@
name: 'PR Triage'
on:
pull_request_target:
types:
- opened
- edited
- reopened
- synchronize
jobs:
pr-triage:
name: PR Triage
label:
name: Label
if: github.event.action != 'edited'
runs-on: ubuntu-latest
steps:
- name: Automatically label PR
uses: actions/labeler@v4
- name: Label pull request
uses: actions/labeler@v5
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
sync-labels: true
validate-title:
name: Validate title
runs-on: ubuntu-latest
steps:
- name: Validate pull request title
env:
TITLE: ${{ github.event.pull_request.title }}
run: |
REGEX="^(revert: )?(feat|fix|docs|style|refactor|perf|test|build|ci|chore|types)(\\(.+\\))?!?: .{1,72}$"
echo "Title: \"$TITLE\""
if [[ ! "$TITLE" =~ $REGEX ]]; then
exit 1
fi

View File

@@ -3,31 +3,88 @@ on:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
env:
IMAGE_NAME: discordjs/proxy
jobs:
docker-publish:
name: Docker publish
runs-on: ubuntu-latest
if: github.repository_owner == 'discordjs'
build:
name: Build ${{ matrix.platform }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
runner: ubuntu-latest
- platform: linux/arm64
runner: ubuntu-24.04-arm
steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v3
- name: Install node.js v18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
uses: ./packages/actions/src/yarnCache
- name: Build dependencies
run: yarn build
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
run: echo ${{ secrets.DOCKER_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Build & push docker image
run: yarn docker build --buildkit @discordjs/proxy-container -t discordjs/proxy:latest --push
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
context: .
file: apps/proxy-container/Dockerfile
platforms: ${{ matrix.platform }}
outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v5
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
name: Create and push manifest list
runs-on: ubuntu-latest
needs: build
steps:
- name: Download digests
uses: actions/download-artifact@v6
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:latest \
$(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:latest

View File

@@ -3,63 +3,92 @@ on:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
inputs:
ref:
description: 'The ref to check out. e.g. main, feat/new-feature, refs/pull/1234/head'
required: false
default: 'main'
tag:
description: 'The tag to use, generally a feature name'
required: false
type: string
dry_run:
description: 'Perform a dry run that skips publishing and outputs logs indicating what would have happened'
type: boolean
default: false
jobs:
npm-publish:
name: npm publish
strategy:
fail-fast: false
matrix:
include:
- package: '@discordjs/brokers'
folder: 'brokers'
- package: '@discordjs/builders'
folder: 'builders'
- package: '@discordjs/collection'
folder: 'collection'
- package: '@discordjs/core'
folder: 'core'
- package: '@discordjs/formatters'
folder: 'formatters'
- package: 'discord.js'
folder: 'discord.js'
- package: '@discordjs/next'
folder: 'next'
- package: '@discordjs/proxy'
folder: 'proxy'
- package: '@discordjs/rest'
folder: 'rest'
- package: '@discordjs/util'
folder: 'util'
- package: '@discordjs/voice'
folder: 'voice'
- package: '@discordjs/ws'
folder: 'ws'
runs-on: ubuntu-latest
permissions:
id-token: write
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
if: github.repository_owner == 'discordjs'
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.DISCORDJS_APP_ID }}
private-key: ${{ secrets.DISCORDJS_APP_KEY_RELEASE }}
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
ref: ${{ inputs.ref }}
- name: Install node.js v18
uses: actions/setup-node@v3
- name: Install Node.js v24
uses: actions/setup-node@v6
with:
node-version: 18
node-version: 24
package-manager-cache: false
registry-url: https://registry.npmjs.org/
- name: Install dependencies
uses: ./packages/actions/src/yarnCache
uses: ./packages/actions/src/pnpmCache
- name: Build dependencies
run: yarn build
run: pnpm run build
- name: Publish package
run: |
yarn workspace ${{ matrix.package }} release --preid "dev.$(date +%s)-$(git rev-parse --short HEAD)"
yarn workspace ${{ matrix.package }} npm publish --tag dev || true
- name: Checkout main repository (non-main ref)
if: ${{ inputs.ref != 'main' }}
uses: actions/checkout@v6
with:
path: 'main'
- name: Install action deps (non-main ref)
if: ${{ inputs.ref != 'main' }}
shell: bash
working-directory: ./main
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
COREPACK_ENABLE_STRICT: 0
run: |
pnpm self-update 10
pnpm install --filter @discordjs/actions --frozen-lockfile --prefer-offline --loglevel error
- name: Publish packages (non-main ref)
if: ${{ inputs.ref != 'main' }}
uses: ./main/packages/actions/src/releasePackages
with:
exclude: '@discordjs/docgen'
dry: ${{ inputs.dry_run }}
dev: true
tag: ${{ inputs.tag || 'dev' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish packages (main ref)
if: ${{ inputs.ref == 'main' }}
uses: ./packages/actions/src/releasePackages
with:
exclude: '@discordjs/docgen'
dry: ${{ inputs.dry_run }}
dev: true
tag: ${{ inputs.tag || 'dev' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,30 +1,98 @@
name: Publish docker images
on:
workflow_dispatch:
env:
IMAGE_NAME: discordjs/proxy
jobs:
docker-publish:
name: Docker publish
runs-on: ubuntu-latest
build:
name: Build ${{ matrix.platform }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
runner: ubuntu-latest
- platform: linux/arm64
runner: ubuntu-24.04-arm
steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v3
- name: Install node.js v18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
uses: ./packages/actions/src/yarnCache
- name: Build dependencies
run: yarn build
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
run: echo ${{ secrets.DOCKER_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Build & push docker image
run: yarn docker build --buildkit @discordjs/proxy-container -t discordjs/proxy:$(cut -d '.' -f1 <<< $(jq --raw-output '.version' packages/proxy-container/package.json)) --push
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
context: .
file: apps/proxy-container/Dockerfile
platforms: ${{ matrix.platform }}
outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v5
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
name: Create and push manifest list
runs-on: ubuntu-latest
needs: build
steps:
- name: Download digests
uses: actions/download-artifact@v6
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
- name: Checkout repository
uses: actions/checkout@v6
- name: Get Major Version
id: version
run: |
FULL_VER=$(jq --raw-output '.version' apps/proxy-container/package.json)
MAJOR=$(echo $FULL_VER | cut -d '.' -f1)
echo "major=$MAJOR" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.major }} \
$(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.major }}

View File

@@ -1,39 +0,0 @@
name: Publish Release
on:
release:
types: [released]
jobs:
npm-publish:
name: npm publish
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
if: github.repository_owner == 'discordjs'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install node.js v18
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- name: Install dependencies
uses: ./packages/actions/src/yarnCache
- name: Build dependencies
run: yarn build
- name: Extract package and semver from tag
id: extract-tag
uses: ./packages/actions/src/formatTag
with:
tag: ${{ github.ref_name }}
- name: Publish package
run: |
yarn workspace ${{ steps.extract-tag.outputs.subpackage == 'true' && '@discordjs/' || '' }}${{ steps.extract-tag.outputs.package }} npm publish
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

112
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,112 @@
name: Release
on:
workflow_dispatch:
inputs:
ref:
description: 'The branch, tag or SHA to checkout'
required: true
default: 'main'
package:
description: 'The published name of a single package to release'
type: choice
required: false
options:
- all
- discord.js
- '@discordjs/brokers'
- '@discordjs/builders'
- '@discordjs/collection'
- '@discordjs/core'
- 'create-discord-bot'
# - '@discordjs/docgen'
- '@discordjs/formatters'
- '@discordjs/next'
- '@discordjs/proxy'
- '@discordjs/rest'
- '@discordjs/structures'
- '@discordjs/util'
- '@discordjs/voice'
- '@discordjs/ws'
exclude:
description: 'Comma separated list of packages to exclude from release (if not depended upon)'
required: false
type: string
default: '@discordjs/docgen,@discordjs/next'
dry_run:
description: Perform a dry run?
type: boolean
default: false
jobs:
npm-publish:
name: npm publish
runs-on: ubuntu-latest
permissions:
id-token: write
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
if: github.repository_owner == 'discordjs'
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.DISCORDJS_APP_ID }}
private-key: ${{ secrets.DISCORDJS_APP_KEY_RELEASE }}
permission-contents: write
- name: Checkout repository
uses: actions/checkout@v6
with:
token: ${{ steps.app-token.outputs.token }}
ref: ${{ inputs.ref || '' }}
- name: Install Node.js v24
uses: actions/setup-node@v6
with:
node-version: 24
package-manager-cache: false
registry-url: https://registry.npmjs.org/
- name: Install dependencies
uses: ./packages/actions/src/pnpmCache
- name: Build dependencies
run: pnpm run build
- name: Checkout main repository
if: ${{ inputs.ref && inputs.ref != 'main' }}
uses: actions/checkout@v6
with:
path: 'main'
- name: Install action deps (non-main ref only)
if: ${{ inputs.ref && inputs.ref != 'main' }}
shell: bash
working-directory: ./main
env:
COREPACK_ENABLE_STRICT: 0
run: |
pnpm self-update 10
pnpm install --filter @discordjs/actions --frozen-lockfile --prefer-offline --loglevel error
- name: Release packages (non-main ref)
if: ${{ inputs.ref && inputs.ref != 'main' }}
uses: ./main/packages/actions/src/releasePackages
with:
package: ${{ inputs.package }}
exclude: ${{ inputs.exclude }}
dry: ${{ inputs.dry_run }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Release packages (main ref)
if: ${{ !inputs.ref || inputs.ref == 'main' }}
uses: ./packages/actions/src/releasePackages
with:
package: ${{ inputs.package }}
exclude: ${{ inputs.exclude }}
dry: ${{ inputs.dry_run }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

60
.github/workflows/remove-tag.yml vendored Normal file
View File

@@ -0,0 +1,60 @@
name: Remove tag
on:
workflow_dispatch:
inputs:
tag:
description: The tag to remove
required: true
type: string
message:
description: Deprecation message
required: false
type: string
jobs:
removal:
runs-on: ubuntu-latest
if: github.repository_owner == 'discordjs'
strategy:
matrix:
package:
- '@discordjs/brokers'
- '@discordjs/builders'
- '@discordjs/collection'
- '@discordjs/core'
- 'create-discord-app'
- 'create-discord-bot'
- '@discordjs/formatters'
- 'discord.js'
- '@discordjs/next'
- '@discordjs/proxy'
- '@discordjs/rest'
- '@discordjs/structures'
- '@discordjs/util'
- '@discordjs/voice'
- '@discordjs/ws'
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
uses: ./packages/actions/src/pnpmCache
- name: Remove tag
run: pnpm dist-tag rm "${{ matrix.package }}" "${{ inputs.tag }}"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Deprecate version
uses: ./packages/actions/src/deprecateVersion
with:
package: ${{ matrix.package }}
version: '*-${{ inputs.tag }}.*'
message: ${{ inputs.message }}
node-auth-token: ${{ secrets.NPM_PUBLISH_TOKEN }}

View File

@@ -12,53 +12,56 @@ jobs:
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install node.js v18
uses: actions/setup-node@v3
- name: Install Node.js v24
uses: actions/setup-node@v6
with:
node-version: 18
node-version: 24
package-manager-cache: false
- name: Install dependencies
uses: ./packages/actions/src/yarnCache
uses: ./packages/actions/src/pnpmCache
- name: Build dependencies (PR)
if: ${{ github.event_name != 'push' }}
run: yarn build --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]"
run: pnpm exec turbo run build --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]" --concurrency=4
- name: Build dependencies (Push)
if: ${{ github.event_name == 'push' }}
run: yarn build --filter="...[HEAD^1]"
- name: ESLint (PR)
if: ${{ github.event_name != 'push' }}
run: yarn lint --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]" -- --format=compact
- name: ESLint (Push)
if: ${{ github.event_name == 'push' }}
run: yarn lint --filter="...[HEAD^1]" -- --format=compact
run: pnpm exec turbo run build --filter="...[HEAD^1]" --concurrency=4
- name: Tests (PR)
if: ${{ github.event_name != 'push' }}
run: yarn test --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]"
run: pnpm exec turbo run test --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]" --concurrency=4
- name: Tests (Push)
if: ${{ github.event_name == 'push' }}
run: yarn test --filter="...[HEAD^1]"
run: pnpm exec turbo run test --filter="...[HEAD^1]" --concurrency=4
- name: ESLint (PR)
if: ${{ github.event_name != 'push' }}
run: pnpm exec turbo run lint --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]" --concurrency=4 -- --format=compact
- name: ESLint (Push)
if: ${{ github.event_name == 'push' }}
run: pnpm exec turbo run lint --filter="...[HEAD^1]" --concurrency=4 -- --format=compact
- name: Docs (PR)
if: ${{ github.event_name != 'push' }}
run: yarn docs --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]"
run: pnpm exec turbo run docs --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]" --concurrency=4
- name: Docs (Push)
if: ${{ github.event_name == 'push' }}
run: yarn docs --filter="...[HEAD^1]"
run: pnpm exec turbo run docs --filter="...[HEAD^1]" --concurrency=4
- name: Upload Coverage
if: github.repository_owner == 'discordjs'
uses: ./packages/actions/src/uploadCoverage
with:
codecov_token: ${{ secrets.CODECOV_TOKEN }}

42
.github/workflows/upload-readmes.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Upload README.md files
on:
push:
branches:
- 'main'
paths:
- 'packages/*/README.md'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
upload-readmes:
name: Upload README.md files
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
if: github.repository_owner == 'discordjs'
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 24
package-manager-cache: false
- name: Install dependencies
uses: ./packages/actions/src/pnpmCache
- name: Build dependencies
run: pnpm --filter @discordjs/actions... run build
- name: Upload README.md files
env:
CF_R2_READMES_ACCESS_KEY_ID: ${{ secrets.CF_R2_READMES_ACCESS_KEY_ID }}
CF_R2_READMES_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_READMES_SECRET_ACCESS_KEY }}
CF_R2_READMES_BUCKET: ${{ secrets.CF_R2_READMES_BUCKET }}
CF_R2_READMES_URL: ${{ secrets.CF_R2_READMES_URL }}
uses: ./packages/actions/src/uploadReadmeFiles

12
.gitignore vendored
View File

@@ -17,10 +17,11 @@ pids
# Dist
dist
dist-docs
packages/discord-api-types
# Miscellaneous
.tmp
.vscode
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
.idea
@@ -29,6 +30,15 @@ dist-docs
tsconfig.tsbuildinfo
coverage
out
package.tgz
tsup.config.bundled*
vitest.config.ts.timestamp*
# Deno
deno.lock
# Bun
bun.lockb
# yarn
.pnp.*

View File

@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn commitlint --edit $1
pnpm exec commitlint --edit $1

View File

@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn build:affected && yarn lint-staged
pnpm run build:affected && pnpm exec lint-staged

View File

@@ -1,5 +1,6 @@
{
"$schema": "https://json.schemastore.org/lintstagedrc.schema.json",
"*": "prettier --ignore-unknown --write",
"{src/**,__tests__/**}.{mjs,js,cjs,ts,tsx}": "eslint --ext .mjs,.js,.cjs,.ts,.tsx --fix",
"{src/**,__tests__/**}.{mjs,js,cjs,ts,tsx}": "eslint --fix",
"src/**.ts": "vitest related --run --config ../../vitest.config.ts"
}

View File

@@ -1,2 +1,5 @@
CODEOWNERS
CHANGELOG.md
tsup.config.bundled*
vitest.config.ts.timestamp*
pnpm-lock.yaml

View File

@@ -1,4 +1,5 @@
{
"$schema": "https://json.schemastore.org/prettierrc.json",
"printWidth": 120,
"useTabs": true,
"singleQuote": true,

View File

@@ -8,7 +8,6 @@
"eamodio.gitlens",
"christian-kohler.npm-intellisense",
"christian-kohler.path-intellisense",
"antfu.unocss",
"unifiedjs.vscode-mdx"
]
}

51
.vscode/settings.json vendored
View File

@@ -1,18 +1,57 @@
{
"eslint.workingDirectories": [{ "pattern": "./apps/*" }, { "pattern": "./packages/*" }],
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
"eslint.useESLintClass": true,
"eslint.useFlatConfig": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": false
"source.organizeImports": "never",
"source.fixAll.eslint": "always",
"source.fixAll": "always"
},
"editor.trimAutoWhitespace": false,
"files.associations": {
"*.mdx": "markdown"
"tsconfig.json": "jsonc",
"tsconfig.eslint.json": "jsonc"
},
"files.insertFinalNewline": true,
"files.eol": "\n",
"npm.packageManager": "yarn",
"typescript.tsdk": "node_modules/typescript/lib"
"search.exclude": {
"**/.yarn": true,
"**/.next": true,
"**/dist": true,
"**/coverage": true,
"**/test-results": true
},
"search.followSymlinks": false,
"search.useParentIgnoreFiles": true,
"files.watcherExclude": {
"**/.next/*/**": true,
"**/.yarn/*/**": true,
"**/coverage/*/**": true,
"**/dist/*/**": true,
"**/test-results/*/**": true
},
"unocss.disable": true,
"npm.packageManager": "pnpm",
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"tailwindCSS.experimental.classRegex": [
["cva\\(((?:[^()]|\\([^()]*\\))*)\\)", "[\"'`]?([^\"'`]+)[\"'`]?"],
["cx\\(((?:[^()]|\\([^()]*\\))*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"],
["class:\\s*?[\"'`]([^\"'`]*).*?,"]
],
"workbench.editor.customLabels.patterns": {
"**/app/**/page.tsx": "${dirname} (${filename}.${extname}) - Page",
"**/app/**/layout.tsx": "${dirname} (${filename}.${extname}) - Layout",
"**/app/**/template.tsx": "${dirname} (${filename}.${extname}) - Template",
"**/app/**/error.tsx": "${dirname} (${filename}.${extname}) - Error",
"**/app/**/not-found.tsx": "${dirname} (${filename}.${extname}) - Not Found",
"**/components/**/page.tsx": "${dirname} (${filename}.${extname}) - Component"
},
"deno.enable": false,
"deno.enablePaths": ["./packages/create-discord-bot/template/Deno"],
"deno.lint": false,
"deno.unstable": [],
"deno.config": "./packages/create-discord-bot/template/Deno/deno.jsonc"
}

View File

@@ -1,18 +0,0 @@
diff --git a/package.json b/package.json
index fc35658a40f9ba3e3513c459ba9f4f6e1b3f59f5..bc35eda66f270c95ba52e721cb6976fd61622c58 100644
--- a/package.json
+++ b/package.json
@@ -26,11 +26,13 @@
},
"exports": {
".": {
+ "types": "./dist/index.d.ts",
"node": "./dist/index.js",
"default": "./browser/index.js"
},
"./package.json": "./package.json",
"./util": {
+ "types": "./dist/util.d.ts",
"node": "./dist/util.js",
"default": "./browser/dist/util.js"
}

View File

@@ -1,260 +0,0 @@
/* eslint-disable */
module.exports = {
name: '@yarnpkg/plugin-docker-build',
factory: function (require) {
var plugin;
(() => {
'use strict';
var t = {
d: (e, o) => {
for (var r in o) t.o(o, r) && !t.o(e, r) && Object.defineProperty(e, r, { enumerable: !0, get: o[r] });
},
o: (t, e) => Object.prototype.hasOwnProperty.call(t, e),
r: (t) => {
'undefined' != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(t, Symbol.toStringTag, { value: 'Module' }),
Object.defineProperty(t, '__esModule', { value: !0 });
},
},
e = {};
t.r(e), t.d(e, { default: () => u });
const o = require('@yarnpkg/cli'),
r = require('clipanion'),
i = require('@yarnpkg/core'),
a = require('@yarnpkg/plugin-patch'),
n = require('@yarnpkg/fslib');
const s = require('@yarnpkg/plugin-pack');
async function c({ workspace: t, destination: e, report: o }) {
await s.packUtils.prepareForPack(t, { report: o }, async () => {
const r = await s.packUtils.genPackList(t),
a = i.Report.progressViaCounter(r.length),
c = o.reportProgress(a);
try {
for (const i of r) {
const r = n.ppath.join(t.cwd, i),
s = n.ppath.join(e, t.relativeCwd, i);
o.reportInfo(null, i), await n.xfs.copyPromise(s, r, { overwrite: !0 }), a.tick();
}
} finally {
c.stop();
}
});
}
function p(t, e) {
const o = (0, n.toFilename)(e);
return n.ppath.isAbsolute(o) ? n.ppath.relative(t, o) : o;
}
const l = /^builtin<([^>]+)>$/;
var d = function (t, e, o, r) {
var i,
a = arguments.length,
n = a < 3 ? e : null === r ? (r = Object.getOwnPropertyDescriptor(e, o)) : r;
if ('object' == typeof Reflect && 'function' == typeof Reflect.decorate) n = Reflect.decorate(t, e, o, r);
else
for (var s = t.length - 1; s >= 0; s--)
(i = t[s]) && (n = (a < 3 ? i(n) : a > 3 ? i(e, o, n) : i(e, o)) || n);
return a > 3 && n && Object.defineProperty(e, o, n), n;
};
class f extends o.BaseCommand {
constructor() {
super(...arguments), (this.args = []);
}
async execute() {
const t = await i.Configuration.find(this.context.cwd, this.context.plugins),
{ project: e } = await i.Project.find(t, this.context.cwd),
o = e.getWorkspaceByIdent(i.structUtils.parseIdent(this.workspaceName)),
r = (function ({
project: t,
workspaces: e,
production: o = !1,
scopes: r = o ? ['dependencies'] : i.Manifest.hardDependencies,
}) {
const a = new Set([...e]);
for (const e of a)
for (const o of r) {
const r = e.manifest.getForScope(o).values();
for (const e of r) {
const o = t.tryWorkspaceByDescriptor(e);
o && a.add(o);
}
}
for (const e of t.workspaces)
a.has(e)
? o && e.manifest.devDependencies.clear()
: (e.manifest.dependencies.clear(),
e.manifest.devDependencies.clear(),
e.manifest.peerDependencies.clear());
return a;
})({ project: e, workspaces: [o], production: this.production }),
s = await (async function (t, e = 'Dockerfile') {
const o = (0, n.toFilename)(e);
if (n.ppath.isAbsolute(o)) return o;
const r = [n.ppath.join(t.cwd, o), n.ppath.join(t.project.cwd, o)];
for (const t of r) if (await n.xfs.existsPromise(t)) return t;
throw new Error('Dockerfile is required');
})(o, this.dockerFilePath),
d = await i.Cache.find(t);
return (
await i.StreamReport.start(
{ configuration: t, stdout: this.context.stdout, includeLogs: !this.context.quiet },
async (t) => {
await t.startTimerPromise('Resolution Step', async () => {
await e.resolveEverything({ report: t, cache: d });
}),
await t.startTimerPromise('Fetch Step', async () => {
await e.fetchEverything({ report: t, cache: d });
}),
await n.xfs.mktempPromise(async (o) => {
const f = n.ppath.join(o, (0, n.toFilename)('manifests')),
u = n.ppath.join(o, (0, n.toFilename)('packs'));
await t.startTimerPromise('Copy files', async () => {
await (async function ({ destination: t, project: e, report: o }) {
const r = e.configuration.get('rcFilename');
o.reportInfo(null, r),
await n.xfs.copyPromise(n.ppath.join(t, r), n.ppath.join(e.cwd, r), { overwrite: !0 });
})({ destination: f, project: e, report: t }),
await (async function ({ destination: t, project: e, report: o }) {
const r = n.ppath.join((0, n.toFilename)('.yarn'), (0, n.toFilename)('plugins'));
o.reportInfo(null, r),
await n.xfs.copyPromise(n.ppath.join(t, r), n.ppath.join(e.cwd, r), { overwrite: !0 });
})({ destination: f, project: e, report: t }),
await (async function ({ destination: t, project: e, report: o }) {
const r = e.configuration.get('yarnPath'),
i = n.ppath.relative(e.cwd, r),
a = n.ppath.join(t, i);
o.reportInfo(null, i), await n.xfs.copyPromise(a, r, { overwrite: !0 });
})({ destination: f, project: e, report: t }),
await (async function ({ destination: t, workspaces: e, report: o }) {
for (const r of e) {
const e = n.ppath.join(r.relativeCwd, i.Manifest.fileName),
a = n.ppath.join(t, e),
s = {};
r.manifest.exportTo(s),
o.reportInfo(null, e),
await n.xfs.mkdirpPromise(n.ppath.dirname(a)),
await n.xfs.writeJsonPromise(a, s);
}
})({ destination: f, workspaces: e.workspaces, report: t }),
await (async function ({ destination: t, report: e, project: o, parseDescriptor: r }) {
const a = new Set();
for (const s of o.storedDescriptors.values()) {
const c = r(
i.structUtils.isVirtualDescriptor(s) ? i.structUtils.devirtualizeDescriptor(s) : s,
);
if (!c) continue;
const { parentLocator: p, paths: d } = c;
for (const r of d) {
if (l.test(r)) continue;
if (n.ppath.isAbsolute(r)) continue;
const i = o.getWorkspaceByLocator(p),
s = n.ppath.join(i.relativeCwd, r);
if (a.has(s)) continue;
a.add(s);
const c = n.ppath.join(i.cwd, r),
d = n.ppath.join(t, s);
e.reportInfo(null, s),
await n.xfs.mkdirpPromise(n.ppath.dirname(d)),
await n.xfs.copyFilePromise(c, d);
}
}
})({
destination: f,
report: t,
project: e,
parseDescriptor: (t) => {
if (t.range.startsWith('exec:')) {
const e = (function (t) {
const { params: e, selector: o } = i.structUtils.parseRange(t),
r = n.npath.toPortablePath(o);
return {
parentLocator:
e && 'string' == typeof e.locator ? i.structUtils.parseLocator(e.locator) : null,
path: r,
};
})(t.range);
if (!e || !e.parentLocator) return;
return { parentLocator: e.parentLocator, paths: [e.path] };
}
if (t.range.startsWith('patch:')) {
const { parentLocator: e, patchPaths: o } = a.patchUtils.parseDescriptor(t);
if (!e) return;
return { parentLocator: e, paths: o };
}
},
}),
await (async function ({ destination: t, project: e, cache: o, report: r }) {
for (const i of o.markedFiles) {
const o = n.ppath.relative(e.cwd, i);
(await n.xfs.existsPromise(i)) &&
(r.reportInfo(null, o), await n.xfs.copyPromise(n.ppath.join(t, o), i));
}
})({ destination: f, project: e, cache: d, report: t }),
await (async function ({ destination: t, project: e, report: o }) {
const r = (0, n.toFilename)(e.configuration.get('lockfileFilename')),
i = n.ppath.join(t, r);
o.reportInfo(null, r),
await n.xfs.mkdirpPromise(n.ppath.dirname(i)),
await n.xfs.writeFilePromise(i, e.generateLockfile());
})({ destination: f, project: e, report: t }),
this.copyFiles &&
this.copyFiles.length &&
(await (async function ({ destination: t, files: e, dockerFilePath: o, report: r }) {
const i = n.ppath.dirname(o);
for (const o of e) {
const e = p(i, o),
a = n.ppath.join(i, e),
s = n.ppath.join(t, e);
r.reportInfo(null, e), await n.xfs.copyPromise(s, a);
}
})({ destination: f, files: this.copyFiles, dockerFilePath: s, report: t }));
});
for (const e of r) {
const o = e.manifest.name ? i.structUtils.stringifyIdent(e.manifest.name) : '';
await t.startTimerPromise('Pack workspace ' + o, async () => {
await c({ workspace: e, report: t, destination: u });
});
}
const h = this.buildKit ? ['buildx', 'build'] : ['build'];
await i.execUtils.pipevp('docker', [...h, ...this.args, '-f', s, '.'], {
cwd: o,
strict: !0,
stdin: this.context.stdin,
stdout: this.context.stdout,
stderr: this.context.stderr,
});
});
},
)
).exitCode();
}
}
(f.usage = r.Command.Usage({
category: 'Docker-related commands',
description: 'Build a Docker image for a workspace',
details:
'\n This command will build a efficient Docker image which only contains necessary dependencies for the specified workspace.\n\n You have to create a Dockerfile in your workspace or your project. You can also specify the path to Dockerfile using the "-f, --file" option.\n\n Additional arguments can be passed to "docker build" directly, please check the Docker docs for more info: https://docs.docker.com/engine/reference/commandline/build/\n\n You can copy additional files or folders to a Docker image using the "--copy" option. This is useful for secret keys or configuration files. The files will be copied to "manifests" folder. The path can be either a path relative to the Dockerfile or an absolute path.\n ',
examples: [
['Build a Docker image for a workspace', 'yarn docker build @foo/bar'],
['Pass additional arguments to docker build command', 'yarn docker build @foo/bar -t image-tag'],
[
'Copy additional files to a Docker image',
'yarn docker build --copy secret.key --copy config.json @foo/bar',
],
['Install production dependencies only', 'yarn docker build --production @foo/bar'],
['Build a Docker image using BuildKit', 'yarn docker build --buildkit @foo/bar'],
],
})),
d([r.Command.String()], f.prototype, 'workspaceName', void 0),
d([r.Command.Proxy()], f.prototype, 'args', void 0),
d([r.Command.String('-f,--file')], f.prototype, 'dockerFilePath', void 0),
d([r.Command.Array('--copy')], f.prototype, 'copyFiles', void 0),
d([r.Command.Boolean('--production')], f.prototype, 'production', void 0),
d([r.Command.Boolean('--buildkit')], f.prototype, 'buildKit', void 0),
d([r.Command.Path('docker', 'build')], f.prototype, 'execute', null);
const u = { commands: [f] };
plugin = e;
})();
return plugin;
},
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,23 +0,0 @@
logFilters:
- code: YN0002
level: discard
- code: YN0013
level: discard
- code: YN0032
level: discard
- code: YN0060
level: discard
nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools'
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: '@yarnpkg/plugin-version'
- path: .yarn/plugins/@yarnpkg/plugin-docker-build.cjs
spec: 'https://github.com/Dcard/yarn-plugins/releases/latest/download/plugin-docker-build.js'
yarnPath: .yarn/releases/yarn-3.6.1.cjs

View File

@@ -5,11 +5,14 @@
</p>
<br />
<p>
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
<a href="https://discord.gg/djs"><img src="https://img.shields.io/badge/join_us-on_discord-5865F2?logo=discord&logoColor=white" alt="Discord server" /></a>
<a href="https://www.npmjs.com/package/discord.js"><img src="https://img.shields.io/npm/v/discord.js.svg?maxAge=3600" alt="npm version" /></a>
<a href="https://www.npmjs.com/package/discord.js"><img src="https://img.shields.io/npm/dt/discord.js.svg?maxAge=3600" alt="npm downloads" /></a>
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/test.yml/badge.svg" alt="Tests status" /></a>
<a href="https://codecov.io/gh/discordjs/discord.js" ><img src="https://codecov.io/gh/discordjs/discord.js/branch/main/graph/badge.svg?precision=2" alt="Code coverage" /></a>
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/tests.yml/badge.svg" alt="Tests status" /></a>
<a href="https://github.com/discordjs/discord.js/commits/main"><img src="https://img.shields.io/github/last-commit/discordjs/discord.js.svg?logo=github&logoColor=ffffff" alt="Last commit." /></a>
<a href="https://github.com/discordjs/discord.js/graphs/contributors"><img src="https://img.shields.io/github/contributors/discordjs/discord.js.svg?maxAge=3600&logo=github&logoColor=fff&color=00c7be" alt="contributors" /></a>
<a href="https://opencollective.com/discordjs"><img src="https://img.shields.io/opencollective/backers/discordjs?maxAge=3600&logo=opencollective" alt="backers" /></a>
<a href="https://codecov.io/gh/discordjs/discord.js"><img src="https://codecov.io/gh/discordjs/discord.js/branch/main/graph/badge.svg?precision=2" alt="Code coverage" /></a>
</p>
<p>
<a href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"><img src="https://raw.githubusercontent.com/discordjs/discord.js/main/.github/powered-by-vercel.svg" alt="Vercel" /></a>
@@ -24,6 +27,7 @@ This repository contains multiple packages with separate [releases][github-relea
## Packages
- `discord.js` ([source][source]) - A powerful Node.js module for interacting with the Discord API
- `create-discord-bot` ([source][create-discord-bot-source]) - A CLI tool to quickly scaffold a Discord bot project
- `@discordjs/brokers` ([source][brokers-source]) - A collection of brokers for use with discord.js
- `@discordjs/builders` ([source][builders-source]) - A utility package for easily building Discord API payloads
- `@discordjs/collection` ([source][collection-source]) - A powerful utility data structure
@@ -31,10 +35,15 @@ This repository contains multiple packages with separate [releases][github-relea
- `@discordjs/formatters` ([source][formatters-source]) - A collection of functions for formatting strings
- `@discordjs/proxy` ([source][proxy-source]) - A wrapper around `@discordjs/rest` for running an HTTP proxy
- `@discordjs/rest` ([source][rest-source]) - A module for interacting with the Discord REST API
- `@discordjs/voice` ([source][voice-source]) - A module for interacting with the Discord Voice API
- `@discordjs/structures` ([source][structures-source]) - A wrapper around Discord's structures
- `@discordjs/util` ([source][util-source]) - A collection of utility functions
- `@discordjs/voice` ([source][voice-source]) - A module for interacting with the Discord Voice API
- `@discordjs/ws` ([source][ws-source]) - A wrapper around Discord's gateway
## Containers
- `discordjs/proxy` ([source][proxy-container-source]) - A lightweight HTTP proxy for Discord's API
## Links
- [Website][website] ([source][website-source])
@@ -42,7 +51,7 @@ This repository contains multiple packages with separate [releases][github-relea
- [Guide][guide] ([source][guide-source])
Also see the v13 to v14 [Update Guide][guide-update], which includes updated and removed items from the library.
- [discord.js Discord server][discord]
- [Discord API Discord server][discord-api]
- [Discord Developers Discord server][discord-developers]
- [GitHub][source]
- [npm][npm]
- [Related libraries][related-libs]
@@ -62,18 +71,19 @@ If you don't understand something in the documentation, you are experiencing pro
[website]: https://discord.js.org
[website-source]: https://github.com/discordjs/discord.js/tree/main/apps/website
[documentation]: https://discord.js.org/docs
[guide]: https://discordjs.guide/
[guide-source]: https://github.com/discordjs/guide
[guide-update]: https://discordjs.guide/additional-info/changes-in-v14.html
[guide]: https://discordjs.guide
[guide-source]: https://github.com/discordjs/discord.js/tree/main/apps/guide
[guide-update]: https://discordjs.guide/legacy/additional-info/changes-in-v14
[discord]: https://discord.gg/djs
[discord-api]: https://discord.gg/discord-api
[discord-developers]: https://discord.gg/discord-developers
[source]: https://github.com/discordjs/discord.js/tree/main/packages/discord.js
[npm]: https://www.npmjs.com/package/discord.js
[related-libs]: https://discord.com/developers/docs/topics/community-resources#libraries
[related-libs]: https://docs.discord.com/developers/developer-tools/community-resources#libraries
[rpc]: https://www.npmjs.com/package/discord-rpc
[rpc-source]: https://github.com/discordjs/RPC
[contributing]: https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md
[github-releases]: https://github.com/discordjs/discord.js/releases
[create-discord-bot-source]: https://github.com/discordjs/discord.js/tree/main/packages/create-discord-bot
[brokers-source]: https://github.com/discordjs/discord.js/tree/main/packages/brokers
[builders-source]: https://github.com/discordjs/discord.js/tree/main/packages/builders
[collection-source]: https://github.com/discordjs/discord.js/tree/main/packages/collection
@@ -81,7 +91,9 @@ If you don't understand something in the documentation, you are experiencing pro
[formatters-source]: https://github.com/discordjs/discord.js/tree/main/packages/formatters
[proxy-source]: https://github.com/discordjs/discord.js/tree/main/packages/proxy
[rest-source]: https://github.com/discordjs/discord.js/tree/main/packages/rest
[voice-source]: https://github.com/discordjs/discord.js/tree/main/packages/voice
[structures-source]: https://github.com/discordjs/discord.js/tree/main/packages/structures
[util-source]: https://github.com/discordjs/discord.js/tree/main/packages/util
[voice-source]: https://github.com/discordjs/discord.js/tree/main/packages/voice
[ws-source]: https://github.com/discordjs/discord.js/tree/main/packages/ws
[proxy-container-source]: https://github.com/discordjs/discord.js/tree/main/apps/proxy-container
[good-first-issue]: https://github.com/discordjs/discord.js/contribute

View File

@@ -89,42 +89,50 @@
* DEFAULT VALUE: no overrideTsconfig section
*/
"overrideTsconfig": {
// Type Checking
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true,
"useUnknownInCatchVariables": true,
"noUncheckedIndexedAccess": true,
"compilerOptions": {
// Type Checking
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": false,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true,
// Modules
"module": "ESNext",
"moduleResolution": "node",
"resolveJsonModule": true,
// Modules
"allowArbitraryExtensions": false,
"allowImportingTsExtensions": false,
"module": "ESNext",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"resolvePackageJsonExports": false,
"resolvePackageJsonImports": false,
// Emit
"declaration": true,
"declarationMap": true,
"importHelpers": true,
"inlineSources": true,
"newLine": "lf",
"noEmitHelpers": true,
"outDir": "dist",
"removeComments": false,
"sourceMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
// Emit
"declaration": true,
"declarationMap": true,
"importHelpers": false,
"newLine": "lf",
"noEmitHelpers": true,
"outDir": "dist",
"removeComments": false,
"sourceMap": true,
// Language and Environment
"experimentalDecorators": true,
"lib": ["ESNext"],
"target": "ES2021",
"useDefineForClassFields": true
// Interop Constraints
"esModuleInterop": false,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
// Language and Environment
"experimentalDecorators": true,
"lib": ["ESNext"],
"target": "ES2022",
"useDefineForClassFields": true
}
}
/**
* This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended
@@ -216,7 +224,7 @@
/**
* (REQUIRED) Whether to generate the .d.ts rollup file.
*/
"enabled": true,
"enabled": false,
/**
* Specifies the output path for a .d.ts rollup file to be generated without any trimming.

View File

@@ -0,0 +1 @@
NEXT_PUBLIC_LOCAL_DEV=true

View File

@@ -1 +0,0 @@
next-env.d.ts

View File

@@ -1,12 +0,0 @@
{
"extends": ["../../.eslintrc.json", "neon/react", "neon/next", "neon/edge", "@unocss", "neon/prettier"],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"react/react-in-jsx-scope": 0,
"react/jsx-filename-extension": [1, { "extensions": [".tsx"] }]
}
}

10
apps/guide/.gitignore vendored
View File

@@ -16,13 +16,13 @@ pids
.env*.local
# Dist
.contentlayer
.open-next
.next
public/searchIndex
src/styles/unocss.css
.wrangler
.source
# Miscellaneous
.tmp
.vscode
lighthouse-results
.vercel
next-env.d.ts

View File

@@ -1 +1,2 @@
/** @type {import('lint-staged').Config} */
module.exports = require('../../.lintstagedrc.json');

View File

@@ -1,7 +1,8 @@
.contentlayer
.next
.turbo
.vscode
coverage
src/assets/readme
src/styles/unocss.css
next-env.d.ts
.source

View File

@@ -1 +1,6 @@
module.exports = require('../../.prettierrc.json');
/** @type {import('prettier').Config} */
module.exports = {
...require('../../.prettierrc.json'),
plugins: ['prettier-plugin-tailwindcss'],
tailwindFunctions: ['cva', 'cx'],
};

135
apps/guide/CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,135 @@
# Contributing
## Local development
Clone the code base into a local folder, `cd` into it, and install the dependencies:
```bash
git clone https://github.com/discordjs/discord.js.git
cd discord.js/apps/guide
pnpm --filter guide install
```
You can and should use `pnpm dev` to check your changes out locally before pushing them for review.
## Adding pages
To add a new page to the guide, create a `filename.mdx` file in the folder of your choice located under `/content`. Fumadocs will pick it up and route appropriately. To list the section in the sidebar, make sure it is listed in the `meta.json` file of the directory you placed it in under the `pages` key. The order in the `pages` array determines the order pages have in the sidebar.
## Framework and components
The guide uses the fumadocs documentation framework for Next.js. You can find examples as well as documentation for the components you can use at <https://fumadocs.dev/docs/ui>.
## General guidelines
Please try your best to follow the guidelines below. They help to make the guide appear as a coherent piece of work rather than a collection of disconnected pieces with different writing styles.
### Spelling, grammar, and wording
Improper grammar, strange wording, and incorrect spelling are all things that may lead to confusion when a user reads a guide page. It's important to attempt to keep the content clear and consistent. Re-read what you've written and place yourself in the shoes of someone else for a moment to see if you can fully understand everything without any confusion.
Don't worry if you aren't super confident with your grammar/spelling/wording skills; all pull requests get thoroughly reviewed, and comments are left in areas that need to be fixed or could be done better/differently.
#### "You"/"your" instead of "we"/"our"
When explaining parts of the guide, we recommend to use "you" instead of "we" when referring to the read or things they can do:
```diff
- To check our Node version, we can run `node -v`.
+ To check your Node version, you can run `node -v`.
- To delete a message, we can do: `message.delete();`
+ To delete a message, you can do: `message.delete();`
- Our final code should look like this: ...
+ Your final code should look like this: ...
- Before we can actually do this, we need to update our configuration file.
+ Before you can actually do this, you need to update your configuration file.
```
#### "We" instead of "I"
When referring to yourself, use "we" (as in "the writers of this guide") instead of "I". For example:
```diff
- If you don't already have this package installed, I would highly recommend doing so.
+ If you don't already have this package installed, we would highly recommend doing so.
# Valid alternative:
+ If you don't already have this package installed, it's highly recommended that you do so.
- In this section, I'll be covering how to do that really cool thing everyone's asking about.
+ In this section, we'll be covering how to do that really cool thing everyone's asking about.
```
#### Inclusive language
Try to avoid using gendered and otherwise non-inclusive language. The following are just examples to give you an idea of what we expect. Don't understand this as a complete list of "banned terms":
- Use they/them/their instead of gendered pronouns (he/him/his, she/her/hers).
- Avoid using "master" and "slave", you can use "primary" and "replica" or "secondary" instead.
- Avoid gendered terms like "guys", "folks" and "people" work just as well.
- Avoid ableist terms "sanity check", use "confidence check" or "coherence check" instead.
- Avoid talking about "dummy" values, call them "placeholder" or "sample value" instead.
### Paragraph structure
Try to keep guide articles formatted nicely and easy to read. If paragraphs get too long, you can usually split them up where they introduce a new concept or facet. Adding a bit of spacing can make the guide easier to digest and follow! Try to avoid run-on sentences with many embedded clauses.
## Semantic components
You can find the full documentation for the guide framework at <https://fumadocs.dev/docs/ui/>. If you are unsure what to use when, consider looking through the existing guide pages and how they approach things.
### Callouts
You can use [Callouts](https://fumadocs.dev/docs/ui/markdown#callouts) to describe additional context that doesn't fully fit into the flow of the paragraph or requires special attention. Prefer to MDX syntax `<Callout />` over Remark `:::` admonitions.
### Code
Fumadocs integrates [Shiki transformers](https://fumadocs.dev/docs/ui/markdown#shiki-transformers) for visual highlighting through the use of [Rhype Code](https://fumadocs.dev/docs/headless/mdx/rehype-code).
When describing changes or additions to code, prefer using the appropriate language (`js` in most cases for this guide) with diff transformers over `diff` highlights:
```js
console.log('Hello'); // [!code --]
console.log('Hello World'); // [!code ++]
```
You can put the transformer syntax above the respective line and declare ranges instead of repeating formatting intsructions. You can also combine different transformers on the same line. Note that word highlights highlight the word across the code block by default, but do respect ranges.
```js
console.log('Hello'); // [!code --:2]
console.log('World');
// [!code ++]
console.log('Hello World');
```
```js
// ...
// [!code focus:2] [!code word:log:1]
console.log('Hello World!'); // this instance of "log" is highlighted
console.log('Foobar'); // this one is not
// ...
```
When introducing new functions in a paragraph, consider highlighting them in the following code snippet to draw additional attention to their use. For example, if you just described the `log` function:
```js
console.log('Hello World'); // [!code word:log]
```
Make sure to denote the file names or paths if you describe progress in a specific code sample. When descrbing multiple files, use [tab groups](https://fumadocs.dev/docs/ui/markdown#tab-groups).
````md
```json title="package.json" tab="Configuration"
{ ... }
```
```js tab="Usage"
// code showing how to use what is being configured
```
````
### Directory Structure
You can use the [Files](https://fumadocs.dev/docs/ui/components/files) component to visualize the expected directory structure, if it is relevant to the approach you describe.

View File

@@ -176,7 +176,6 @@
END OF TERMS AND CONDITIONS
Copyright 2022 Noel Buechler
Copyright 2022 Charlotte Cristea
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@@ -5,8 +5,9 @@
</p>
<br />
<p>
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/test.yml/badge.svg" alt="Build status" /></a>
<a href="https://discord.gg/djs"><img src="https://img.shields.io/badge/join_us-on_discord-5865F2?logo=discord&logoColor=white" alt="Discord server" /></a>
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/tests.yml/badge.svg" alt="Build status" /></a>
<a href="https://opencollective.com/discordjs"><img src="https://img.shields.io/opencollective/backers/discordjs?maxAge=3600&logo=opencollective" alt="backers" /></a>
</p>
<p>
<a href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"><img src="https://raw.githubusercontent.com/discordjs/discord.js/main/.github/powered-by-vercel.svg" alt="Vercel" /></a>
@@ -14,26 +15,21 @@
</p>
</div>
## About
The official guide for discord.js, made to help you get started easily with the library.
## Links
- [Website][website] ([source][website-source])
- [Documentation][documentation]
- [Guide][guide] ([source][guide-source])
Also see the v13 to v14 [Update Guide][guide-update], which includes updated and removed items from the library.
- [discord.js Discord server][discord]
- [Discord API Discord server][discord-api]
- [GitHub][source]
- [Related libraries][related-libs]
## Contributing
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
[documentation][documentation].
See [the contribution guide][contributing] if you'd like to submit a PR.
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the existing guide. See [the contributing guide][contributing] if you'd like to submit a pull request.
## Local Development
To install and run just the guide portion of the repository for development, you can install dependencies with `pnpm --filter guide install` and serve a development version of the guide on localhost with `pnpm dev`.
## Help
@@ -42,11 +38,9 @@ If you don't understand something in the documentation, you are experiencing pro
[website]: https://discord.js.org
[website-source]: https://github.com/discordjs/discord.js/tree/main/apps/website
[documentation]: https://discord.js.org/docs
[guide]: https://discordjs.guide/
[guide-source]: https://github.com/discordjs/guide
[guide-update]: https://discordjs.guide/additional-info/changes-in-v14.html
[guide]: https://discordjs.guide
[guide-source]: https://github.com/discordjs/discord.js/tree/main/apps/guide
[guide-update]: https://discordjs.guide/legacy/additional-info/changes-in-v14
[discord]: https://discord.gg/djs
[discord-api]: https://discord.gg/discord-api
[source]: https://github.com/discordjs/discord.js/tree/main/apps/guide
[related-libs]: https://discord.com/developers/docs/topics/community-resources#libraries
[contributing]: https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md

View File

@@ -0,0 +1,103 @@
---
title: Cooldowns
---
Spam is something you generally want to avoid, especially if one of your commands require calls to other APIs or takes a bit of time to build/send.
<Callout>
This section assumes you followed the [Command Handling](../app-creation/handling-commands) part of the guide.
</Callout>
First, add a cooldown property to your command. This will determine how long the user would have to wait (in seconds) before using the command again.
```js title="commands/utility/ping.js"
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
cooldown: 5, // [!code ++]
data: new SlashCommandBuilder().setName('ping').setDescription('Replies with Pong!'),
async execute(interaction) {
// ...
},
};
```
In your main file, initialize a [Collection](../additional-info/collections) to store cooldowns of commands:
```js
client.cooldowns = new Collection();
```
The key will be the command names, and the values will be Collections associating the user's id (key) to the last time (value) this user used this command. Overall the logical path to get a user's last usage of a command will be `cooldowns > command > user > timestamp`.
In your `InteractionCreate` event handler, add the following code:
```js title="index.js / interactionCreate.js (if you followed the event handler section)"
// ...
// [!code ++:14]
const { cooldowns } = interaction.client;
if (!cooldowns.has(command.data.name)) {
cooldowns.set(command.data.name, new Collection());
}
const now = Date.now();
const timestamps = cooldowns.get(command.data.name);
const defaultCooldownDuration = 3;
const cooldownAmount = (command.cooldown ?? defaultCooldownDuration) * 1_000;
if (timestamps.has(interaction.user.id)) {
// ...
}
```
You check if the `cooldowns` Collection already has an entry for the command being used. If this is not the case, you can add a new entry, where the value is initialized as an empty Collection. Next, create the following variables:
1. `now`: The current timestamp.
2. `timestamps`: A reference to the Collection of user ids and timestamp key/value pairs for the triggered command.
3. `cooldownAmount`: The specified cooldown for the command, converted to milliseconds for straightforward calculation. If none is specified, this defaults to three seconds.
If the user has already used this command in this session, get the timestamp, calculate the expiration time, and inform the user of the amount of time they need to wait before using this command again. Note the use of the `return` statement here, causing the code below this snippet to execute only if the user has not used this command in this session or the wait has already expired.
Continuing with your current setup, this is the complete `if` statement:
```js title="index.js / interactionCreate.js (if you followed the event handler section)"
const defaultCooldownDuration = 3;
const cooldownAmount = (command.cooldown ?? defaultCooldownDuration) * 1_000;
// [!code focus:13]
if (timestamps.has(interaction.user.id)) {
// ... // [!code --]
// [!code ++:9]
const expirationTime = timestamps.get(interaction.user.id) + cooldownAmount;
if (now < expirationTime) {
const expiredTimestamp = Math.round(expirationTime / 1_000);
return interaction.reply({
content: `Please wait, you are on a cooldown for \`${command.data.name}\`. You can use it again <t:${expiredTimestamp}:R>.`,
flags: MessageFlags.Ephemeral,
});
}
}
```
Since the `timestamps` Collection has the user's id as the key, you can use the `get()` method on it to get the value and sum it up with the `cooldownAmount` variable to get the correct expiration timestamp and further check to see if it's expired or not.
The previous user check serves as a precaution in case the user leaves the guild. You can now use the `setTimeout` method, which will allow you to execute a function after a specified amount of time and remove the timeout.
```js
// [!code focus]
if (timestamps.has(interaction.user.id)) {
const expiredTimestamp = Math.round(expirationTime / 1_000);
return interaction.reply({
content: `Please wait, you are on a cooldown for \`${command.data.name}\`. You can use it again <t:${expiredTimestamp}:R>.`,
flags: MessageFlags.Ephemeral,
});
} // [!code focus]
// [!code ++:2] [!code focus:2]
timestamps.set(interaction.user.id, now);
setTimeout(() => timestamps.delete(interaction.user.id), cooldownAmount);
```
This line causes the entry for the user under the specified command to be deleted after the command's cooldown time has expired for them.

View File

@@ -0,0 +1,3 @@
{
"title": "Additional Features"
}

View File

@@ -0,0 +1,74 @@
---
title: Reloading Commands
---
When writing your commands, you may find it tedious to restart your bot every time for testing the smallest changes. With a command handler, you can eliminate this issue and reload your commands while your bot is running.
<Callout>
ESM does not support require and clearing import cache. You can use [hot-esm](https://www.npmjs.com/package/hot-esm)
to import files without cache. Windows support is experimental per [this
issue](https://github.com/vinsonchuong/hot-esm/issues/33).
</Callout>
<Callout>
This section assumes you followed the [Command Handling](../app-creation/handling-commands) part of the guide.
</Callout>
```js title="commands/utility/reload.js"
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('reload')
.setDescription('Reloads a command.')
.addStringOption((option) => option.setName('command').setDescription('The command to reload.').setRequired(true)),
async execute(interaction) {
// ...
},
};
```
First off, you need to check if the command you want to reload exists. You can do this check similarly to getting a command.
```js
module.exports = {
// ...
// [!code focus:10]
async execute(interaction) {
// ... // [!code --]
// [!code ++:6]
const commandName = interaction.options.getString('command', true).toLowerCase();
const command = interaction.client.commands.get(commandName);
if (!command) {
return interaction.reply(`There is no command with name \`${commandName}\`!`);
}
},
};
```
<Callout type="warn">
The reload command ideally should not be used by every user. You should deploy it as a guild command in a private
guild.
</Callout>
To build the correct file path, you will need the file name. You can use `command.data.name` for doing that.
In theory, all there is to do is delete the previous command from `client.commands` and require the file again. In practice, you cannot do this easily as `require()` caches the file. If you were to require it again, you would load the previously cached file without any changes. You first need to delete the file from `require.cache`, and only then should you require and set the command file to `client.commands`:
```js
delete require.cache[require.resolve(`./${command.data.name}.js`)];
try {
const newCommand = require(`./${command.data.name}.js`);
interaction.client.commands.set(newCommand.data.name, newCommand);
await interaction.reply(`Command \`${newCommand.data.name}\` was reloaded!`);
} catch (error) {
console.error(error);
await interaction.reply(
`There was an error while reloading a command \`${command.data.name}\`:\n\`${error.message}\``,
);
}
```
The snippet above uses a `try...catch` block to load the command file and add it to `client.commands`. In case of an error, it will log the full error to the console and notify the user about it with the error's message component `error.message`. Note that you never actually delete the command from the commands Collection and instead overwrite it. This behavior prevents you from deleting a command and ending up with no command at all after a failed `require()` call, as each use of the reload command checks that Collection again.

View File

@@ -1,10 +1,7 @@
---
title: Understanding async/await
category: Additional info
---
# Understanding async/await
If you aren't very familiar with ECMAScript 2017, you may not know about async/await. It's a useful way to handle Promises in a hoisted manner. It's also slightly faster and increases overall readability.
## How do Promises work?
@@ -13,96 +10,82 @@ Before we can get into async/await, you should know what Promises are and how th
Promises are a way to handle asynchronous tasks in JavaScript; they are the newer alternative to callbacks. A Promise has many similarities to a progress bar; they represent an unfinished and ongoing process. An excellent example of this is a request to a server (e.g., discord.js sends requests to Discord's API).
A Promise can have three states; pending, resolved, and rejected
A Promise can have three states; pending, resolved, and rejected.
The **pending** state means that the Promise still is ongoing and neither resolved nor rejected.
The **resolved** state means that the Promise is done and executed without any errors.
The **rejected** state means that the Promise encountered an error and could not execute correctly.
- The **pending** state means that the Promise still is ongoing and neither resolved nor rejected.
- The **resolved** state means that the Promise is done and executed without any errors.
- The **rejected** state means that the Promise encountered an error and could not execute correctly.
One important thing to know is that a Promise can only have one state simultaneously; it can never be pending and resolved, rejected and resolved, or pending and rejected. You may be asking, "How would that look in code?". Here is a small example:
<Alert title="Tip" type="success">
This example uses ES6 code. If you do not know what that is, you should read up on that
[here](/additional-info/es6-syntax.md).
</Alert>
<CH.Code>
<Callout>
This example uses ES6 code. If you do not know what that is, you should read up on that [here](./es6-syntax).
</Callout>
```js
function deleteMessages(amount) {
return new Promise((resolve) => {
if (amount > 10) throw new Error("You can't delete more than 10 Messages at a time.");
setTimeout(() => resolve('Deleted 10 messages.'), 2000);
// [!code word:Promise]
return new Promise((resolve, reject) => {
if (amount > 10) return reject(new Error("You can't delete more than 10 Messages at a time."));
setTimeout(() => resolve('Deleted 10 messages.'), 2_000);
});
}
deleteMessages(5)
// [!code word:then]
.then((value) => {
// `deleteMessages` is complete and has not encountered any errors
// the resolved value will be the string "Deleted 10 messages"
})
// [!code word:catch]
.catch((error) => {
// `deleteMessages` encountered an error
// the error will be an Error Object
});
```
</CH.Code>
In this scenario, the _`deleteMessages`_ function returns a Promise. The _`.then()`_ method will trigger if the Promise resolves, and the _`.catch()`_ method if the Promise rejects. In the _`deleteMessages`_ function, the Promise is resolved after 2 seconds with the string "Deleted 10 messages.", so the _`.catch()`_ method will never be executed. You can also pass the _`.catch()`_ function as the second parameter of _`.then()`_.
In this scenario, the `deleteMessages` function returns a Promise. The `.then()` method will trigger if the Promise resolves, and the `.catch()` method if the Promise rejects. In the `deleteMessages` function, the Promise is resolved after 2 seconds with the string "Deleted 10 messages.", so the `.catch()` method will never be executed. You can also pass the `.catch()` function as the second parameter of `.then()`.
## How to implement async/await
### Theory
The following information is essential to know before working with async/await. You can only use the _`await`_ keyword inside a function declared as _`async`_ (you put the _`async`_ keyword before the _`function`_ keyword or before the parameters when using a callback function).
The following information is essential to know before working with async/await. You can only use the `await` keyword inside a function declared as `async` (you put the `async` keyword before the `function` keyword or before the parameters when using a callback function).
A simple example would be:
<CH.Code>
```js
// [!code word:async]
async function declaredAsAsync() {
// ...
}
```
</CH.Code>
or
<CH.Code>
```js
// [!code word:async]
const declaredAsAsync = async () => {
// ...
};
```
</CH.Code>
You can use that as well if you use the arrow function as an event listener.
<CH.Code>
```js
client.on('event', async (first, last) => {
// ...
});
```
</CH.Code>
An important thing to know is that a function declared as _`async`_ will always return a Promise. In addition to this, if you return something, the Promise will resolve with that value, and if you throw an error, it will reject the Promise with that error.
An important thing to know is that a function declared as `async` will always return a Promise. In addition to this, if you return something, the Promise will resolve with that value, and if you throw an error, it will reject the Promise with that error.
### Execution with discord.js code
Now that you know how Promises work and what they are used for, let's look at an example that handles multiple Promises. Let's say you want to react with letters (regional indicators) in a specific order. For this example, here's a basic template for a discord.js bot with some ES6 adjustments.
<CH.Code>
```js
import { Client, Events, GatewayIntentBits } from 'discord.js';
```js title="promise-example.js" lineNumbers
const { Client, Events, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
@@ -121,17 +104,15 @@ client.on(Events.InteractionCreate, (interaction) => {
client.login('your-token-goes-here');
```
</CH.Code>
If you don't know how Node.js asynchronous execution works, you would probably try something like this:
<CH.Code>
```js mark=4:7
client.on('interactionCreate', (interaction) => {
```js title="promise-example.js" lineNumbers=9
client.on(Events.InteractionCreate, (interaction) => {
// ...
// [!code focus:7]
if (commandName === 'react') {
const message = interaction.reply({ content: 'Reacting!', fetchReply: true });
const response = interaction.reply({ content: 'Reacting!', withResponse: true }); // [!code ++:5]
const { message } = response.resource;
message.react('🇦');
message.react('🇧');
message.react('🇨');
@@ -139,18 +120,18 @@ client.on('interactionCreate', (interaction) => {
});
```
</CH.Code>
But since all of these methods are started at the same time, it would just be a race to which server request finished first, so there would be no guarantee that it would react at all (if the message isn't fetched) or in the order you wanted it to. In order to make sure it reacts after the message is sent and in order (a, b, c), you'd need to use the `.then()` callback from the Promises that these methods return. The code would look like this:
But since all of these methods are started at the same time, it would just be a race to which server request finished first, so there would be no guarantee that it would react at all (if the message isn't fetched) or in the order you wanted it to. In order to make sure it reacts after the message is sent and in order (a, b, c), you'd need to use the _`.then()`_ callback from the Promises that these methods return. The code would look like this:
<CH.Code>
```js mark=4:12
client.on('interactionCreate', (interaction) => {
```js title="promise-example.js" lineNumbers=9
client.on(Events.InteractionCreate, (interaction) => {
// ...
if (commandName === 'react') {
interaction.reply({ content: 'Reacting!', fetchReply: true }).then((message) => {
message
interaction.reply({ content: 'Reacting!', withResponse: true }).then((response) => {
const { message } = response.resource;
message.react('🇦'); // [!code --:3]
message.react('🇧');
message.react('🇨');
message // [!code ++:7]
.react('🇦')
.then(() => message.react('🇧'))
.then(() => message.react('🇨'))
@@ -162,38 +143,37 @@ client.on('interactionCreate', (interaction) => {
});
```
</CH.Code>
In this piece of code, the Promises are [chain resolved](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise/then#Chaining) with each other, and if one of the Promises gets rejected, the function passed to `.catch()` gets called. Here's the same code but with async/await:
In this piece of code, the Promises are [chain resolved](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then#Chaining) with each other, and if one of the Promises gets rejected, the function passed to _`.catch()`_ gets called. Here's the same code but with async/await:
<CH.Code>
```js mark=1,4:7
client.on('interactionCreate', async (interaction) => {
```js title="promise-example.js" lineNumbers=9
client.on(Events.InteractionCreate, async (interaction) => {
// ...
if (commandName === 'react') {
const message = await interaction.reply({ content: 'Reacting!', fetchReply: true });
await message.react('🇦');
const response = await interaction.reply({ content: 'Reacting!', withResponse: true });
const { message } = response.resource;
message.react('🇦'); // [!code --:3]
message.react('🇧');
message.react('🇨');
await message.react('🇦'); // [!code ++:3]
await message.react('🇧');
await message.react('🇨');
}
});
```
</CH.Code>
It's mostly the same code, but how would you catch Promise rejections now since `.catch()` isn't there anymore? That is also a useful feature with async/await; the error will be thrown if you await it so that you can wrap the awaited Promises inside a try/catch, and you're good to go.
It's mostly the same code, but how would you catch Promise rejections now since _`.catch()`_ isn't there anymore? That is also a useful feature with async/await; the error will be thrown if you await it so that you can wrap the awaited Promises inside a try/catch, and you're good to go.
<CH.Code>
```js mark=1,4:11
client.on('interactionCreate', async (interaction) => {
```js title="promise-example.js" lineNumbers=9
client.on(Events.InteractionCreate, async (interaction) => {
if (commandName === 'react') {
// [!code ++]
try {
const message = await interaction.reply({ content: 'Reacting!', fetchReply: true });
const response = await interaction.reply({ content: 'Reacting!', withResponse: true });
const { message } = response.resource;
await message.react('🇦');
await message.react('🇧');
await message.react('🇨');
// [!code ++:3]
} catch (error) {
// handle failure of any Promise rejection inside here
}
@@ -201,23 +181,19 @@ client.on('interactionCreate', async (interaction) => {
});
```
</CH.Code>
This code looks clean and is also easy to read.
So you may be asking, "How would I get the value the Promise resolved with?".
Let's look at an example where you want to delete a sent reply.
<CH.Code>
```js mark=3:10
client.on('interactionCreate', (interaction) => {
```js title="promise-example.js"
client.on(Events.InteractionCreate, (interaction) => {
// ...
if (commandName === 'delete') {
interaction
.reply({ content: 'This message will be deleted.', fetchReply: true })
.then((replyMessage) => setTimeout(() => replyMessage.delete(), 10000))
.reply({ content: 'This message will be deleted.', withResponse: true })
.then((response) => setTimeout(() => response.resource.message.delete(), 10_000)) // [!code word:response]
.catch((error) => {
// handle error
});
@@ -225,18 +201,14 @@ client.on('interactionCreate', (interaction) => {
});
```
</CH.Code>
The return value of a `.reply()` with the `withResponse` option set to `true` is a promise which resolves with `InteractionCallbackResponse`, but how would the same code with async/await look?
The return value of a _`.reply()`_ with the _`fetchReply`_ option set to _`true`_ is a Promise which resolves with the reply when it has been sent, but how would the same code with async/await look?
<CH.Code>
```js mark=1,4:10
client.on('interactionCreate', async (interaction) => {
```js title="promise-example.js"
client.on(Events.InteractionCreate, async (interaction) => {
if (commandName === 'delete') {
try {
const replyMessage = await interaction.reply({ content: 'This message will be deleted.', fetchReply: true });
setTimeout(() => replyMessage.delete(), 10000);
const response = await interaction.reply({ content: 'This message will be deleted.', withResponse: true }); // [!code word:response]
setTimeout(() => response.resource.message.delete(), 10_000);
} catch (error) {
// handle error
}
@@ -244,6 +216,4 @@ client.on('interactionCreate', async (interaction) => {
});
```
</CH.Code>
With async/await, you can assign the awaited function to a variable representing the returned value. Now you know how you use async/await.

View File

@@ -0,0 +1,674 @@
---
title: Updating to v14
---
## Before you start
Make sure you're using the latest LTS version of Node. To check your Node version, use `node -v` in your terminal or command prompt, and if it's not high enough, update it! There are many resources online to help you with this step based on your host system.
### Various packages are now included in v14
If you previously had `@discordjs/builders`, `@discordjs/formatters`, `@discordjs/rest`, or `discord-api-types` manually installed, it's _highly_ recommended that you uninstall the packages to avoid package version conflicts.
```sh tab="npm"
npm uninstall @discordjs/builders @discordjs/formatters @discordjs/rest discord-api-types
```
```sh tab="yarn"
yarn remove @discordjs/builders @discordjs/formatters @discordjs/rest discord-api-types
```
```sh tab="pnpm"
pnpm remove @discordjs/builders @discordjs/formatters @discordjs/rest discord-api-types
```
## Breaking Changes
### API version
discord.js v14 makes the switch to Discord API v10!
### Common Breakages
### Enum Values
Any areas that used to accept a `string` or `number` type for an enum parameter will now only accept exclusively `number`s.
In addition, the old enums exported by discord.js v13 and lower are replaced with new enums from [discord-api-types](https://discord-api-types.dev/api/discord-api-types-v10).
#### New enum differences
Most of the difference between enums from discord.js and discord-api-types can be summarized as so:
1. Enums are singular, i.e., `ApplicationCommandOptionTypes` -> `ApplicationCommandOptionType`
2. Enums that are prefixed with `Message` no longer have the `Message` prefix, i.e., `MessageButtonStyles` -> `ButtonStyle`
3. Enum values are `PascalCase` rather than `SCREAMING_SNAKE_CASE`, i.e., `.CHAT_INPUT` -> `.ChatInput`
<Callout>
You might be inclined to use raw `number`s (most commonly referred to as [magic numbers](<https://en.wikipedia.org/wiki/Magic_number_(programming)>)) instead of enum values. This is highly discouraged. Enums provide more readability and are more resistant to changes in the API. Magic numbers can obscure the meaning of your code in many ways, check out this [blog post](https://blog.webdevsimplified.com/2020-02/magic-numbers/) if you want more context on as to why they shouldn't be used.
</Callout>
#### Common enum breakages
Areas like `Client` initialization, JSON slash commands and JSON message components will likely need to be modified to accommodate these changes:
##### Common Client Initialization Changes
```js
const { Client, Intents } = require('discord.js'); // [!code --]
const { Client, GatewayIntentBits, Partials } = require('discord.js'); // [!code ++]
const client = new Client({ intents: [Intents.FLAGS.GUILDS], partials: ['CHANNEL'] }); // [!code --]
const client = new Client({ intents: [GatewayIntentBits.Guilds], partials: [Partials.Channel] }); // [!code ++]
```
##### Common Application Command Data changes
```js
const { ApplicationCommandType, ApplicationCommandOptionType } = require('discord.js'); // [!code ++]
const command = {
name: 'ping',
type: 'CHAT_INPUT', // [!code --]
type: ApplicationCommandType.ChatInput, // [!code ++]
options: [
{
name: 'option',
description: 'A sample option',
type: 'STRING', // [!code --]
type: ApplicationCommandOptionType.String, // [!code ++]
},
],
};
```
##### Common Button Data changes
```js
const { ButtonStyle } = require('discord.js'); // [!code ++]
const button = {
label: 'test',
style: 'PRIMARY', // [!code --]
style: ButtonStyle.Primary, // [!code ++]
customId: '1234',
};
```
### Removal of method-based type guards
#### Channels
Some channel type guard methods that narrowed to one channel type have been removed. Instead compare the `type` property against a [ChannelType](https://discord-api-types.dev/api/discord-api-types-v10/enum/ChannelType) enum member to narrow channels.
```js
const { ChannelType } = require('discord.js'); // [!code ++]
channel.isText(); // [!code --]
channel.type === ChannelType.GuildText; // [!code ++]
channel.isVoice(); // [!code --]
channel.type === ChannelType.GuildVoice; // [!code ++]
channel.isDM(); // [!code --]
channel.type === ChannelType.DM; // [!code ++]
```
### Builders
Builders are no longer returned by the API like they were previously. For example you send the API an `EmbedBuilder` but you receive an `Embed` of the same data from the API. This may affect how your code handles received structures such as components. Refer to [message component changes section](#messagecomponent) for more details.
Added `disableValidators()` and `enableValidators()` as top-level exports which disable or enable validation (enabled by default).
### Consolidation of `create()` & `edit()` parameters
Various `create()` and `edit()` methods on managers and objects have had their parameters consolidated. The changes are below:
- `Guild#edit()` now takes `reason` in the `data` parameter
- `GuildChannel#edit()` now takes `reason` in the `data` parameter
- `GuildEmoji#edit()` now takes `reason` in the `data` parameter
- `Role#edit()` now takes `reason` in the `data` parameter
- `Sticker#edit()` now takes `reason` in the `data` parameter
- `ThreadChannel#edit()` now takes `reason` in the `data` parameter
- `GuildChannelManager#create()` now takes `name` in the `options` parameter
- `GuildChannelManager#createWebhook()` (and other text-based channels) now takes `channel` and `name` in the `options` parameter
- `GuildChannelManager#edit()` now takes `reason` as a part of `data`
- `GuildEmojiManager#edit()` now takes `reason` as a part of `data`
- `GuildManager#create()` now takes `name` as a part of `options`
- `GuildMemberManager#edit()` now takes `reason` as a part of `data`
- `GuildMember#edit()` now takes `reason` as a part of `data`
- `GuildStickerManager#edit()` now takes `reason` as a part of `data`
- `RoleManager#edit()` now takes `reason` as a part of `options`
- `Webhook#edit()` now takes `reason` as a part of `options`
- `GuildEmojiManager#create()` now takes `attachment` and `name` as a part of `options`
- `GuildStickerManager#create()` now takes `file`, `name`, and `tags` as a part of `options`
### Activity
The following properties have been removed as they are not documented by Discord:
- `Activity#id`
- `Activity#platform`
- `Activity#sessionId`
- `Activity#syncId`
### Application
`Application#fetchAssets()` has been removed as it is no longer supported by the API.
### BitField
- BitField constituents now have a `BitField` suffix to avoid naming conflicts with the enum names:
```js
new Permissions(); // [!code --]
new PermissionsBitField(); // [!code ++]
new MessageFlags(); // [!code --]
new MessageFlagsBitField(); // [!code ++]
new ThreadMemberFlags(); // [!code --]
new ThreadMemberFlagsBitField(); // [!code ++]
new UserFlags(); // [!code --]
new UserFlagsBitField(); // [!code ++]
new SystemChannelFlags(); // [!code --]
new SystemChannelFlagsBitField(); // [!code ++]
new ApplicationFlags(); // [!code --]
new ApplicationFlagsBitField(); // [!code ++]
new Intents(); // [!code --]
new IntentsBitField(); // [!code ++]
new ActivityFlags(); // [!code --]
new ActivityFlagsBitField(); // [!code ++]
```
- `#FLAGS` has been renamed to `#Flags`
### CDN
The methods that return CDN URLs have changed. Here is an example on a User:
```js
const url = user.displayAvatarURL({ dynamic: true, format: 'png', size: 1_024 }); // [!code --]
const url = user.displayAvatarURL({ extension: 'png', size: 1_024 }); // [!code ++]
```
Dynamic URLs use `ImageURLOptions` and static URLs use `BaseImageURLOptions`. Since dynamic URLs are returned by default, this option has been renamed to `forceStatic` which forces the return of a static URL. Additionally, `format` has been renamed to `extension`.
### CategoryChannel
`CategoryChannel#children` is no longer a `Collection` of channels the category contains. It is now a manager (`CategoryChannelChildManager`). This also means `CategoryChannel#createChannel()` has been moved to the `CategoryChannelChildManager`.
### Channel
The following type guards have been removed:
- `Channel#isText()`
- `Channel#isVoice()`
- `Channel#isDirectory()`
- `Channel#isDM()`
- `Channel#isGroupDM()`
- `Channel#isCategory()`
- `Channel#isNews()`
Refer to [this section](#channels) for more context.
The base channel class is now `BaseChannel`.
### Client
The `restWsBridgeTimeout` client option has been removed.
### CommandInteractionOptionResolver
`CommandInteractionOptionResolver#getMember()` no longer has a parameter for `required`. See [this pull request](https://github.com/discordjs/discord.js/pull/7188) for more information.
### Constants
- Many constant objects and key arrays are now top-level exports for example:
```js
const { Constants } = require('discord.js'); // [!code --]
const { Colors } = Constants; // [!code --]
const { Colors } = require('discord.js'); // [!code ++]
```
- The refactored constants structures have `PascalCase` member names as opposed to `SCREAMING_SNAKE_CASE` member names.
- Many of the exported constants structures have been replaced and renamed:
```js
Opcodes; // [!code --]
GatewayOpcodes; // [!code ++]
WSEvents; // [!code --]
GatewayDispatchEvents; // [!code ++]
WSCodes; // [!code --]
GatewayCloseCodes; // [!code ++]
InviteScopes; // [!code --]
OAuth2Scopes; // [!code ++]
```
### Events
The `message` and `interaction` events are now removed. Use `messageCreate` and `interactionCreate` instead.
`applicationCommandCreate`, `applicationCommandDelete` and `applicationCommandUpdate` have all been removed. See [this pull request](https://github.com/discordjs/discord.js/pull/6492) for more information.
The `threadMembersUpdate` event now emits the users who were added, the users who were removed, and the thread respectively.
### GuildBanManager
Developers should utilise `deleteMessageSeconds` instead of `days` and `deleteMessageDays`:
```js
<GuildBanManager>.create('123456789', {
days: 3 // [!code --]
deleteMessageDays: 3 // [!code --]
deleteMessageSeconds: 3 * 24 * 60 * 60 // [!code ++]
});
```
`deleteMessageDays` (introduced with version 14) and `days` are both deprecated and will be removed in the future.
### Guild
`Guild#setRolePositions()` and `Guild#setChannelPositions()` have been removed. Use `RoleManager#setPositions()` and `GuildChannelManager#setPositions()` instead respectively.
`Guild#maximumPresences` no longer has a default value of 25,000.
`Guild#me` has been moved to `GuildMemberManager#me`. See [this pull request](https://github.com/discordjs/discord.js/pull/7669) for more information.
### GuildAuditLogs & GuildAuditLogsEntry
`GuildAuditLogs.build()` has been removed as it has been deemed defunct. There is no alternative.
The following properties & methods have been moved to the `GuildAuditLogsEntry` class:
- `GuildAuditLogs.Targets`
- `GuildAuditLogs.actionType()`
- `GuildAuditLogs.targetType()`
### GuildMember
`GuildMember#pending` is now nullable to account for partial guild members. See [this issue](https://github.com/discordjs/discord.js/issues/6546) for more information.
### IntegrationApplication
`IntegrationApplication#summary` has been removed as it is no longer supported by the API.
### Interaction
Whenever an interaction is replied to and one fetches the reply, it could possibly give an `APIMessage` if the guild was not cached. However, interaction replies now always return an `InteractionCallbackResponse` with `withResponse` set to `true`.
The base interaction class is now `BaseInteraction`.
### Invite
`Invite#inviter` is now a getter and resolves structures from the cache.
### MessageAttachment
`MessageAttachment` has now been renamed to `AttachmentBuilder`. // [!code --]
```js
new MessageAttachment(buffer, 'image.png'); // [!code --]
new AttachmentBuilder(buffer, { name: 'image.png' }); // [!code ++]
```
### MessageComponent
- MessageComponents have been renamed as well. They no longer have the `Message` prefix, and now have a `Builder` suffix:
```js
const button = new MessageButton(); // [!code --]
const button = new ButtonBuilder(); // [!code ++]
const selectMenu = new MessageSelectMenu(); // [!code --]
const selectMenu = new StringSelectMenuBuilder(); // [!code ++]
const actionRow = new MessageActionRow(); // [!code --]
const actionRow = new ActionRowBuilder(); // [!code ++]
const textInput = new TextInputComponent(); // [!code --]
const textInput = new TextInputBuilder(); // [!code ++]
```
- Components received from the API are no longer directly mutable. If you wish to mutate a component from the API, use `ComponentBuilder#from`. For example, if you want to make a button mutable:
```js
const editedButton = receivedButton // [!code --]
.setDisabled(true); // [!code --]
const { ButtonBuilder } = require('discord.js'); // [!code ++]
const editedButton = ButtonBuilder.from(receivedButton) // [!code ++]
.setDisabled(true); // [!code ++]
```
### MessageManager
`MessageManager#fetch()`'s second parameter has been removed. The `BaseFetchOptions` the second parameter once was is now merged into the first parameter.
```js
messageManager.fetch('1234567890', { cache: false, force: true }); // [!code --]
messageManager.fetch({ message: '1234567890', cache: false, force: true }); // [!code ++]
```
### MessageSelectMenu
- `MessageSelectMenu` has been renamed to `StringSelectMenuBuilder`
- `StringSelectMenuBuilder#addOption()` has been removed. Use `StringSelectMenuBuilder#addOptions()` instead.
### MessageEmbed
- `MessageEmbed` has now been renamed to `EmbedBuilder`.
- `EmbedBuilder#setAuthor()` now accepts a sole `EmbedAuthorOptions` object.
- `EmbedBuilder#setFooter()` now accepts a sole `EmbedFooterOptions` object.
- `EmbedBuilder#addField()` has been removed. Use `EmbedBuilder#addFields()` instead.
```js
new MessageEmbed().addField('Inline field title', 'Some value here', true); // [!code --]
new EmbedBuilder().addFields([ // [!code ++]
{ name: 'one', value: 'one', inline: true }, // [!code ++]
{ name: 'two', value: 'two', inline: true }, // [!code ++]
+]);
```
### Modal
- `Modal` has been renamed as well and now has a `Builder` suffix:
```js
const modal = new Modal(); // [!code --]
const modal = new ModalBuilder(); // [!code ++]
```
### PartialTypes
The `PartialTypes` string array has been removed. Use the `Partials` enum instead.
In addition to this, there is now a new partial: `Partials.ThreadMember`.
### Permissions
Thread permissions `USE_PUBLIC_THREADS` and `USE_PRIVATE_THREADS` have been removed as they are deprecated in the API. Use `CREATE_PUBLIC_THREADS` and `CREATE_PRIVATE_THREADS` respectively.
`ManageEmojisAndStickers` has been deprecated due to API changes. Its replacement is `ManageGuildExpressions`. See [this pull request](https://github.com/discord/discord-api-docs/pull/6017) for more information.
### PermissionOverwritesManager
Overwrites are now keyed by the `PascalCase` permission key rather than the `SCREAMING_SNAKE_CASE` permission key.
### REST Events
#### apiRequest
This REST event has been removed as discord.js now uses [Undici](https://github.com/nodejs/undici) as the underlying request handler. You must now use a [Diagnostics Channel](https://undici.nodejs.org/#/docs/api/DiagnosticsChannel). Here is a simple example:
```js
import diagnosticsChannel from 'node:diagnostics_channel';
diagnosticsChannel.channel('undici:request:create').subscribe((data) => {
// If you use TypeScript, `data` may be casted as
// `DiagnosticsChannel.RequestCreateMessage`
// from Undici to receive type definitions.
const { request } = data;
console.log(request.method); // Log the method
console.log(request.path); // Log the path
console.log(request.headers); // Log the headers
console.log(request); // Or just log everything!
});
```
You can find further examples at the [Undici Diagnostics Channel documentation](https://undici.nodejs.org/#/docs/api/DiagnosticsChannel).
#### apiResponse
This REST event has been renamed to `response` and moved to `Client#rest`:
```js
client.on('apiResponse', ...); // [!code --]
client.rest.on('response', ...); // [!code ++]
```
#### invalidRequestWarning
This REST event has been moved to `Client#rest`:
```js
client.on('invalidRequestWarning', ...); // [!code --]
client.rest.on('invalidRequestWarning', ...); // [!code ++]
```
#### rateLimit
This REST event has been renamed to `rateLimited` and moved to `Client#rest`:
```js
client.on('rateLimit', ...); // [!code --]
client.rest.on('rateLimited', ...); // [!code ++]
```
### RoleManager
`Role.comparePositions()` has been removed. Use `RoleManager#comparePositions()` instead.
### Sticker
`Sticker#tags` is now a nullable string (`string | null`). Previously, it was a nullable array of strings (`string[] | null`). See [this pull request](https://github.com/discordjs/discord.js/pull/8010) for more information.
### ThreadChannel
The `MAX` helper used in `ThreadAutoArchiveDuration` has been removed. Discord has since allowed any guild to use any auto archive time which makes this helper redundant.
### ThreadMemberManager
`ThreadMemberManager#fetch()`'s second parameter has been removed. The `BaseFetchOptions` the second parameter once was is now merged into the first parameter. In addition, the boolean helper to specify `cache` has been removed.
Usage is now as follows:
```js
// The second parameter is merged into the first parameter.
threadMemberManager.fetch('1234567890', { cache: false, force: true }); // [!code --]
threadMemberManager.fetch({ member: '1234567890', cache: false, force: true }); // [!code ++]
// The lone boolean has been removed. One must be explicit here.
threadMemberManager.fetch(false); // [!code --]
threadMemberManager.fetch({ cache: false }); // [!code ++]
```
### Util
`Util.removeMentions()` has been removed. To control mentions, you should use `allowedMentions` on `BaseMessageOptions` instead.
`Util.splitMessage()` has been removed. This utility method is something the developer themselves should do.
`Util.resolveAutoArchiveMaxLimit()` has been removed. Discord has since allowed any guild to use any auto archive time which makes this method redundant.
Other functions in `Util` have been moved to top-level exports so you can directly import them from `discord.js`.
```js
import { Util } from 'discord.js'; // [!code --]
Util.escapeMarkdown(message); // [!code --]
import { escapeMarkdown } from 'discord.js'; // [!code ++]
escapeMarkdown(message); // [!code ++]
```
### `.deleted` Field(s) have been removed
You can no longer use the `deleted` property to check if a structure was deleted. See [this issue](https://github.com/discordjs/discord.js/issues/7091) for more information.
### VoiceChannel
`VoiceChannel#editable` has been removed. You should use `GuildChannel#manageable` instead.
### VoiceRegion
`VoiceRegion#vip` has been removed as it is no longer part of the API.
### Webhook
`Webhook#fetchMessage()`'s second parameter no longer allows a boolean to be passed. The `cache` option in `WebhookFetchMessageOptions` should be used instead.
## Features
### ApplicationCommand
NSFW commands are supported.
### Attachment
Added support for voice message metadata fields.
### AutocompleteInteraction
`AutocompleteInteraction#commandGuildId` has been added which is the id of the guild the invoked application command is registered to.
### BaseChannel
Added support for `BaseChannel#flags`.
Store channels have been removed as they are no longer part of the API.
`BaseChannel#url` has been added which is a link to a channel, just like in the client.
Additionally, new typeguards have been added:
- `BaseChannel#isDMBased()`
- `BaseChannel#isTextBased()`
- `BaseChannel#isVoiceBased()`
### BaseInteraction
Added `BaseInteraction#isRepliable()` to check whether a given interaction can be replied to.
### ClientApplication
Added support for role connection metadata.
### Collection
- Added `Collection#merge()` and `Collection#combineEntries()`.
- New type: `ReadonlyCollection` which indicates an immutable `Collection`.
### Collector
A new `ignore` event has been added which is emitted whenever an element is not collected by the collector.
Component collector options now use the `ComponentType` enum values:
```js
const { ComponentType } = require('discord.js'); // [!code ++]
const collector = interaction.channel.createMessageComponentCollector({
filter: collectorFilter,
componentType: 'BUTTON', // [!code --]
componentType: ComponentType.Button, // [!code ++]
time: 20_000,
});
```
### CommandInteraction
`CommandInteraction#commandGuildId` has been added which is the id of the guild the invoked application command is registered to.
### CommandInteractionOptionResolver
`CommandInteractionOptionResolver#getChannel()` now has a third parameter which narrows the channel type.
### Events
Added support for `guildAuditLogEntryCreate` event.
### ForumChannel
Added support for forum channels.
Added support for `ForumChannel#defaultForumLayout`.
### Guild
Added `Guild#setMFALevel()` which sets the guild's MFA level.
Added `Guild#maxVideoChannelUsers` which indicates the maximum number of video channel users.
Added `Guild#maxStageVideoChannelUsers` which indicates the maximum number of video channel users for stage channels.
Added `Guild#disableInvites()` which disables the guild's invites.
Added support for the `after` parameter in `Guild#fetchAuditLogs()`.
### GuildChannelManager
`videoQualityMode` may be used whilst creating a channel to initially set the camera video quality mode.
### GuildEmojiManager
Added `GuildEmojiManager#delete()` and `GuildEmojiManager#edit()` for managing existing guild emojis.
### GuildForumThreadManager
Added `GuildForumThreadManager` as manager for threads in forum channels.
### GuildMember
Added support for `GuildMember#flags`.
### GuildMembersChunk
This object now supports the `GuildMembersChunk#notFound` property.
### GuildMemberManager
Added `GuildMemberManager#fetchMe()` to fetch the client user in the guild.
Added `GuildMemberManager#addRole()` and `GuildMemberManager#removeRole()`. These methods allow a single addition or removal of a role respectively to a guild member, even if uncached.
### GuildTextThreadManager
Added `GuildTextThreadManager` as manager for threads in text channels and announcement channels.
### Message
`Message#position` has been added as an approximate position in a thread.
Added support for role subscription data.
### MessageReaction
Added `MessageReaction#react()` to make the client user react with the reaction the class belongs to.
### Role
Added support for role subscriptions.
Added support for `Role#tags#guildConnections`.
### StageChannel
Stage channels now allow messages to be sent in them, much like voice channels.
### Sticker
Added support for GIF stickers.
### ThreadMemberManager
The new `withMember` options returns the associated guild member with the thread member.
When fetching multiple thread members alongside `withMember`, paginated results will be returned. The `after` and `limit` option are supported in this scenario.
### Webhook
Added `Webhook#applicationId`.
Added the `threadName` property in `Webhook#send()` options which allows a webhook to create a post in a forum channel.
### WebSocketManager
discord.js uses `@discordjs/ws` internally

View File

@@ -0,0 +1,106 @@
---
title: Collections
---
discord.js comes with a utility class known as `Collection`.
It extends JavaScript's native `Map` class, so it has all the `Map` features and more!
<Callout type="warn">
If you're not familiar with `Map`, read [MDN's page on
it](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map) before continuing. You should be
familiar with `Array` [methods](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) as
well. We will also use some ES6 features, so read up [here](./es6-syntax) if you do not know what they are.
</Callout>
A `Map` allows for an association between unique keys and their values.
For example, how can you transform every value or filter the entries in a `Map` easily?
This is the point of the `Collection` class!
## Array-like Methods
Many of the methods on `Collection` correspond to their namesake in `Array`. One of them is `find`:
```js
// Assume we have an array of users and a collection of the same users.
array.find((u) => u.discriminator === '1000'); // [!code word:find]
collection.find((u) => u.discriminator === '1000');
```
The interface of the callback function is very similar between the two.
For arrays, callbacks usually pass the parameters `(value, index, array)`, where `value` is the value iterated to,
`index` is the current index, and `array` is the array. For collections, you would have `(value, key, collection)`.
Here, `value` is the same, but `key` is the key of the value, and `collection` is the collection itself instead.
Methods that follow this philosophy of staying close to the `Array` interface are as follows:
- `find`
- `filter` - Note that this returns a `Collection` rather than an `Array`.
- `map` - Yet this returns an `Array` of values instead of a `Collection`!
- `every`
- `some`
- `reduce`
- `concat`
- `sort`
## Converting to Array
Since `Collection` extends `Map`, it is an [iterable](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Iteration_protocols), and can be converted to an `Array` through either `Array.from()` or spread syntax (`...collection`).
```js
// For values.
Array.from(collection.values());
[...collection.values()];
// For keys.
Array.from(collection.keys());
[...collection.keys()];
// For [key, value] pairs.
Array.from(collection);
[...collection];
```
<Callout>
Many people convert Collections to Arrays way too much!
This can lead to unnecessary and confusing code. Before you use `Array.from()` or similar, ask yourself if whatever you are trying to do can't be done with the given `Map` or `Collection` methods or with a for-of loop. Not being familiar with a new data structure should not mean you default to transforming it into the other.
There is usually a reason, why a `Map` or `Collection` is used. Most structures in Discord can be identified with an `id`, which lends itself well to `key -> value` associations like in `Map`s.
</Callout>
## Extra Utilities
Some methods are not from `Array` and are instead entirely new to standard JavaScript.
```js
// A random value.
collection.random();
// The first value.
collection.first();
// The first 5 values.
collection.first(5);
// Similar to `first`, but from the end.
collection.last();
collection.last(2);
// Removes anything that meets the condition from the collection.
// Sort of like `filter`, but in-place.
collection.sweep((user) => user.username === 'Bob');
```
A more complicated method is `partition`, which splits a single Collection into two new Collections based on the provided function.
You can think of it as two `filter`s, but done at the same time (and because of that much more performant):
```js
// `bots` is a Collection of users where their `bot` property was true.
// `humans` is a Collection where the property was false instead!
const [bots, humans] = collection.partition((u) => u.bot); // [!code word:partition]
// Both return true.
bots.every((b) => b.bot);
humans.every((h) => !h.bot); // note the "not" ! operator
```

View File

@@ -0,0 +1,243 @@
---
title: ES6 Syntax
---
If you've used JavaScript for only a (relatively) small amount of time or don't have much experience with it, you might not be aware of what ES6 is and what beneficial features it includes. Since this is a guide primarily for Discord bots, we'll be using some discord.js code as an example of what you might have versus what you could do to benefit from ES6.
Here's the startup code we'll be using:
```js title="index.js" lineNumbers
const { Client, Events, GatewayIntentBits } = require('discord.js'); // [!code word:const]
const config = require('./config.json');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
// [!code word:=>]
client.once(Events.ClientReady, () => {
console.log('Ready!');
});
client.on(Events.InteractionCreate, (interaction) => {
if (!interaction.isChatInputCommand()) return;
const { commandName } = interaction;
if (commandName === 'ping') {
interaction.reply('Pong.');
} else if (commandName === 'beep') {
interaction.reply('Boop.');
} else if (commandName === 'server') {
interaction.reply('Guild name: ' + interaction.guild.name + '\nTotal members: ' + interaction.guild.memberCount);
} else if (commandName === 'user-info') {
interaction.reply('Your username: ' + interaction.user.username + '\nYour ID: ' + interaction.user.id);
}
});
client.login(config.token);
```
If you haven't noticed, this piece of code is already using a bit of ES6 here! The `const` keyword and arrow function declaration (`() => ...`) is ES6 syntax, and we recommend using it whenever possible.
As for the code above, there are a few places where things can be done better. Let's look at them.
## Template literals
If you check the code above, it's currently doing things like `'Guild name: ' + interaction.guild.name` and `'Your username: ' + interaction.user.username`, which is perfectly valid. It is a bit hard to read, though, and it's not too fun to constantly type out. Fortunately, there's a better alternative.
```js title="index.js" lineNumbers=19
} else if (commandName === 'server') {
interaction.reply('Guild name: ' + interaction.guild.name + '\nTotal members: ' + interaction.guild.memberCount); // [!code --]
interaction.reply(`Guild name: ${interaction.guild.name}\nTotal members: ${interaction.guild.memberCount}`); // [!code ++]
}
else if (commandName === 'user-info') {
interaction.reply('Your username: ' + interaction.user.username + '\nYour ID: ' + interaction.user.id); // [!code --]
interaction.reply(`Your username: ${interaction.user.username}\nYour ID: ${interaction.user.id}`); // [!code ++]
}
```
Easier to read and write! The best of both worlds.
### Template literals vs string concatenation
If you've used other programming languages, you might be familiar with the term "string interpolation". Template literals would be JavaScript's implementation of string interpolation. If you're familiar with the heredoc syntax, it's very much like that; it allows for string interpolation, as well as multiline strings.
The example below won't go too much into detail about it, but if you're interested in reading more, you can [read about them on MDN](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals).
```js
const username = 'Sanctuary';
const password = 'pleasedonthackme';
function letsPretendThisDoesSomething() {
return 'Yay for sample data.';
}
console.log('Your username is: **' + username + '**.'); // [!code --:2]
console.log('Your password is: **' + password + '**.');
console.log(`Your username is: **${username}**.`); // [!code ++:2]
console.log(`Your password is: **${password}**.`);
console.log('1 + 1 = ' + (1 + 1)); // [!code --]
console.log(`1 + 1 = ${1 + 1}`); // [!code ++]
console.log("And here's a function call: " + letsPretendThisDoesSomething()); // [!code --]
console.log(`And here's a function call: ${letsPretendThisDoesSomething()}`); // [!code ++]
console.log('Putting strings on new lines\n' + 'can be a bit painful\n' + 'with string concatenation.'); // [!code --]
// [!code ++:5]
console.log(`
Putting strings on new lines
is a breeze
with template literals!
`);
```
<Callout>
As you will notice, template literals will also render the white space inside them, including the indentation! There
are ways around this, which we will discuss in another section.
</Callout>
You can see how it makes things easier and more readable. In some cases, it can even make your code shorter! This one is something you'll want to take advantage of as much as possible.
## Arrow functions
Arrow functions are shorthand for regular functions, with the addition that they use a lexical `this` context inside of their own. If you don't know what the `this` keyword is referring to, don't worry about it; you'll learn more about it as you advance.
Here are some examples of ways you can benefit from arrow functions over regular functions:
```js
// [!code --:3]
client.once(Events.ClientReady, function () {
console.log('Ready!');
});
client.once(Events.ClientReady, () => console.log('Ready!')); // [!code ++]
// [!code --:3]
client.on(Events.TypingStart, function (typing) {
console.log(typing.user.tag + ' started typing in #' + typing.channel.name);
});
client.on(Events.TypingStart, (typing) => console.log(`${typing.user.tag} started typing in #${typing.channel.name}`)); // [!code ++]
// [!code --:3]
client.on(Events.MessageCreate, function (message) {
console.log(message.author.tag + ' sent: ' + message.content);
});
client.on(Events.MessageCreate, (message) => console.log(`${message.author.tag} sent: ${message.content}`)); // [!code ++]
// [!code --:3]
var doubleAge = function (age) {
return 'Your age doubled is: ' + age * 2;
};
const doubleAge = (age) => `Your age doubled is: ${age * 2}`; // [!code ++]
// [!code --:4]
var collectorFilter = function (m) {
return m.content === 'I agree' && !m.author.bot;
};
var collector = message.createMessageCollector({ filter: collectorFilter, time: 15_000 });
const collectorFilter = (m) => m.content === 'I agree' && !m.author.bot; // [!code ++:2]
const collector = message.createMessageCollector({ filter: collectorFilter, time: 15_000 });
```
There are a few important things you should note here:
- The parentheses around function parameters are optional when you have only one parameter but are required otherwise. If you feel like this will confuse you, it may be a good idea to use parentheses.
- You can cleanly put what you need on a single line without curly braces.
- Omitting curly braces will make arrow functions use **implicit return**, but only if you have a single-line expression. The `doubleAge` and `filter` variables are a good example of this.
- Unlike the `function someFunc() { ... }` declaration, arrow functions cannot be used to create functions with such syntax. You can create a variable and give it an anonymous arrow function as the value, though (as seen with the `doubleAge` and `filter` variables).
We won't be covering the lexical `this` scope with arrow functions in here, but you can Google around if you're still curious. Again, if you aren't sure what `this` is or when you need it, reading about lexical `this` first may only confuse you.
## Destructuring
Destructuring is an easy way to extract items from an object or array. If you've never seen the syntax for it before, it can be a bit confusing, but it's straightforward to understand once explained!
### Object destructuring
Here's a common example where object destructuring would come in handy:
```js
const config = require('./config.json');
const prefix = config.prefix;
const token = config.token;
```
This code is a bit verbose and not the most fun to write out each time. Object destructuring simplifies this, making it easier to both read and write. Take a look:
```js
const config = require('./config.json'); // [!code --:3]
const prefix = config.prefix;
const token = config.token;
const { prefix, token } = require('./config.json'); // [!code ++]
```
Object destructuring takes those properties from the object and stores them in variables. If the property doesn't exist, it'll still create a variable but with the value of `undefined`. So instead of using `config.token` in your `client.login()` method, you'd simply use `token`. And since destructuring creates a variable for each item, you don't even need that `const prefix = config.prefix` line. Pretty cool!
Additionally, you could do this for your commands:
```js
client.on(Events.InteractionCreate, (interaction) => {
const { commandName } = interaction;
if (commandName === 'ping') {
// ping command here...
} else if (commandName === 'beep') {
// beep command here...
}
// other commands here...
});
```
The code is shorter and looks cleaner, but it shouldn't be necessary if you follow along with the [command handler](../app-creation/handling-commands) part of the guide.
You can also rename variables when destructuring, if necessary. A good example is when you're extracting a property with a name already being used or conflicts with a reserved keyword. The syntax is as follows:
```js
// `default` is a reserved keyword
const { default: defaultValue } = someObject;
console.log(defaultValue);
// 'Some default value here'
```
### Array destructuring
Array destructuring syntax is very similar to object destructuring, except that you use brackets instead of curly braces. In addition, since you're using it on an array, you destructure the items in the same order the array is. Without array destructuring, this is how you'd extract items from an array:
```js
// assuming we're in a `profile` command and have an `args` variable
const name = args[0];
const age = args[1];
const location = args[2];
```
Like the first example with object destructuring, this is a bit verbose and not fun to write out. Array destructuring eases this pain.
```js
const name = args[0]; // [!code --:3]
const age = args[1];
const location = args[2];
const [name, age, location] = args; // [!code ++]
```
A single line of code that makes things much cleaner! In some cases, you may not even need all the array's items (e.g., when using `string.match(regex)`). Array destructuring still allows you to operate in the same sense.
```js
const [, username, id] = message.content.match(someRegex);
```
In this snippet, we use a comma without providing a name for the item in the array we don't need. You can also give it a placeholder name (`_match` or similar) if you prefer, of course; it's entirely preference at that point.
<Callout>
The underscore `_` prefix is a convention for unused variables. Some lint rules will error or warn if you define
identifiers without using them in your code but ignore identifiers starting with `_`.
</Callout>
## var, let, and const
Since there are many, many articles out there that can explain this part more in-depth, we'll only be giving you a TL;DR and an article link if you choose to read more about it.
1. The `var` keyword is what was (and can still be) used in JavaScript before `let` and `const` came to surface. There are many issues with `var`, though, such as it being function-scoped, hoisting related issues, and allowing redeclaration.
2. The `let` keyword is essentially the new `var`; it addresses many of the issues `var` has, but its most significant factor would be that it's block-scoped and disallows redeclaration (_not_ reassignment).
3. The `const` keyword is for giving variables a constant value that is unable to be reassigned. `const`, like `let`, is also block-scoped.
The general rule of thumb recommended by this guide is to use `const` wherever possible, `let` otherwise, and avoid using `var`. Here's a [helpful article](https://madhatted.com/2016/1/25/let-it-be) if you want to read more about this subject.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -0,0 +1,4 @@
{
"title": "Additional Info",
"pages": ["async-await", "collections", "es6-syntax", "notation", "rest-api", "proxy"]
}

View File

@@ -0,0 +1,61 @@
---
title: Understanding Notation
---
Throughout the discord.js docs and when asking for help on the official server, you will run into many different kinds of notations. To help you understand the texts that you read, we will be going over some standard notations.
<Callout>
Always keep in mind that notation is not always rigorous. There will be typos, misunderstandings, or contexts that
will cause notation to differ from the usual meanings.
</Callout>
## Classes
Some common notations refer to a class or the properties, methods, or events of a class. There are many variations on these notations, and they are very flexible depending on the person, so use your best judgment when reading them.
The notation `<Class>` means an instance of the `Class` class. For example, a snippet like `<BaseInteraction>.reply('Hello')` is asking you to replace `<BaseInteraction>` with some value that is an instance of `BaseInteraction`, e.g. `interaction.reply('Hello')`. It could also just be a placeholder, e.g., `<id>` would mean a placeholder for some ID.
The notation `Class#foo` can refer to the `foo` property, method, or event of the `Class` class. Which one the writer meant needs to be determined from context. For example:
- `BaseInteraction#user` means that you should refer to the `user` property on a `BaseInteraction`.
- `TextChannel#send` means that you should refer to the `send` method on a `TextChannel`.
- `Client#interactionCreate` means that you should refer to the `interactionCreate` event on a `Client`.
<Callout>
Remember that this notation is not valid JavaScript; it is a shorthand to refer to a specific piece of code.
</Callout>
Sometimes, the notation is extended, which can help you determine which one the writer meant. For example, `TextChannel#send(options)` is definitely a method of `TextChannel`, since it uses function notation. `Client#event:messageCreate` is an event since it says it is an event.
The vital thing to take away from this notation is that the `#` symbol signifies that the property, method, or event can only be accessed through an instance of the class. Unfortunately, many abuse this notation, e.g., `<Message>#send` or `Util#resolveColor`. `<Message>` is already an instance, so this makes no sense, and `resolveColor` is a static methodyou should write it as `Util.resolveColor`. Always refer back to the docs if you are confused.
As an example, the documentation's search feature uses this notation.
![Docs search](./images/search.png)
Notice the use of the `.` operator for the static method, `Role.comparePositions` and the `#` notation for the method, `Role#comparePositionsTo`.
## Types
In the discord.js docs, there are type signatures everywhere, such as in properties, parameters, or return values. If you do not come from a statically typed language, you may not know what specific notations mean.
The symbol `*` means any type. For example, methods that return `*` mean that they can return anything, and a parameter of type `*` can be anything.
The symbol `?` means that the type is nullable. You can see it before or after the type (e.g. `?T` or `T?`). This symbol means that the value can be of the type `T` or `null`. An example is `GuildMember#nickname`; its type is `?string` since a member may or may not have a nickname.
The expression `T[]` means an array of `T`. You can sometimes see multiple brackets `[]`, indicating that the array is multi-dimensional, e.g., `string[][]`.
The expression `...T` signifies a rest parameter of type `T`. This means that the function can take any amount of arguments, and all those arguments must be of the type `T`.
The operator `|`, which can read as "or", creates a union type, e.g. `A|B|C`. Simply, it means the value can be of any one of the types given.
The angle brackets `<>` are used for generic types or parameterized types, signifying a type that uses another type(s). The notation looks like `A<B>` where `A` is the type and `B` is a type parameter. If this is hard to follow, it is enough to keep in mind that whenever you see `A<B>`, you can think of an `A` containing `B`. Examples:
- `Array<String>` means an array of strings.
- `Promise<User>` means a `Promise` that contains a `User`.
- `Array<Promise<User|GuildMember>>` would be an array of `Promise`s, each containing a `User` or a `GuildMember`.
- `Collection<Snowflake, User>` would be a `Collection`, containing key-value pairs where the keys are `Snowflake`s, and the values are `User`s.
![TextChannel#send on the docs](./images/send.png)
In this piece of the docs, you can see two type signatures, `string`, `MessagePayload`, or `MessageOptions`, and `Promise<(Message|Array<Message>)>`. The meaning of the word "or" here is the same as `|`.

View File

@@ -0,0 +1,73 @@
---
title: Using a Proxy
---
This guide will show you how to set up a proxy with discord.js. This may be necessary if you are deploying your bot to a server with a firewall only allowing outside traffic through the proxy.
Proxying discord.js requires two components: a REST proxy and a WebSocket proxy.
## Prerequisites
To achieve these two components you can utilize the `undici` and `global-agent` packages:
```sh tab="npm"
npm install undici global-agent
```
```sh tab="yarn"
yarn add undici global-agent
```
```sh tab="pnpm"
pnpm add undici global-agent
```
```sh tab="bun"
bun add undici global-agent
```
## Setting up the proxy for REST calls
The `@discordjs/rest` package handling HTTP requests in discord.js uses the `undici` package. Accordingly, you can provide a custom `ProxyAgent` configuration to the client constructor:
```js title="index.js" lineNumbers
const { ProxyAgent } = require('undici'); // [!code word:ProxyAgent]
const { Client } = require('discord.js');
const client = new Client({
// ...other client options
rest: {
agent: new ProxyAgent('http://my-proxy-server:port'),
},
});
client.login('your-token-goes-here');
```
<Callout>
For further information on the `undici` `ProxyAgent`, please refer to the [undici
documentation](https://undici.nodejs.org/#/docs/api/ProxyAgent.md).
</Callout>
## Setting up the proxy for the WebSocket connection
To set up a proxy for WebSocket, you can use the `global-agent` package. You will need to import and call the `bootstrap()` function and set the required `GLOBAL_AGENT` globals as shown below:
```js title="index.js" lineNumbers
const { ProxyAgent } = require('undici');
const { Client } = require('discord.js');
const { bootstrap } = require('global-agent'); // [!code ++:5]
bootstrap(); // [!code word:bootstrap]
global.GLOBAL_AGENT.HTTP_PROXY = 'http://my-proxy-server:port';
global.GLOBAL_AGENT.HTTPS_PROXY = 'https://my-proxy-server:port';
const client = new Client({
// ...other client options
rest: {
agent: new ProxyAgent('http://my-proxy-server:port'),
},
});
client.login('your-token-goes-here');
```

View File

@@ -0,0 +1,176 @@
---
title: REST APIs
---
REST APIs are extremely popular on the web and allow you to freely grab a site's data if it has an available API over an HTTP connection.
## Making HTTP requests with Node
In these examples, we will be using [undici](https://www.npmjs.com/package/undici), an excellent library for making HTTP requests.
To install undici, run the following command:
```sh tab="npm"
npm i install undici
```
```sh tab="yarn"
yarn add undici
```
```sh tab="pnpm"
pnpm add undici
```
## Skeleton code
To start off, you will be using the following skeleton code. Since both the commands you will be adding in this section require an interaction with external APIs, you will defer the reply, so your application responds with a "thinking..." state. You can then edit the reply once you got the data you need:
```js title="rest-examples.js" lineNumbers
const { Client, EmbedBuilder, Events, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once(Events.ClientReady, (readyClient) => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isChatInputCommand()) return;
const { commandName } = interaction;
await interaction.deferReply();
// ...
});
client.login('your-token-goes-here');
```
<Callout>
We're taking advantage of [destructuring](./es6-syntax#destructuring) in this tutorial to maintain readability.
</Callout>
## Using undici
Undici is a Promise-based HTTP/1.1 client, written from scratch for Node.js. If you aren't already familiar with Promises, you should read up on them [here](./async-await).
In this tutorial, you will be making a bot with two API-based commands using the [random.cat](https://aws.random.cat) and [Urban Dictionary](https://www.urbandictionary.com) APIs.
On top of your file, import the library function you will be using:
```js
const { request } = require('undici');
```
### Random Cat
<Callout title="No more cats :(" type="error">
Unfortunately, the `aws.random.cat` API doesn't work anymore. We will keep the example as-is until we find a better
showcase!
</Callout>
Random cat's API is available at [https://aws.random.cat/meow](https://aws.random.cat/meow) and returns a [JSON](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON) response. To actually fetch data from the API, you're going to do the following:
```js
const catResult = await request('https://aws.random.cat/meow');
const { file } = await catResult.body.json();
```
If you just add this code, it will seem like nothing happens. What you do not see, is that you are launching a request to the random.cat server, which responds some JSON data. The helper function parses the response data to a JavaScript object you can work with. The object will have a `file` property with the value of a link to a random cat image.
Next, you will implement this approach into an application command:
```js
client.on(Events.InteractionCreate, async (interaction) => {
// ...
if (commandName === 'cat') {
const catResult = await request('https://aws.random.cat/meow');
const { file } = await catResult.body.json();
interaction.editReply({ files: [file] });
}
});
```
So, here's what's happening in this code:
1. Your application sends a `GET` request to random.cat.
2. random.cat sees the request and gets a random file url from their database.
3. random.cat then sends that file's URL as a JSON object in a stringified form that contains a link to the image.
4. undici receives the response and you parse the body to a JSON object.
5. Your application then attaches the image and sends it in Discord.
### Urban Dictionary
Urban Dictionary's API is available at [https://api.urbandictionary.com/v0/define](https://api.urbandictionary.com/v0/define), accepts a `term` parameter, and returns a JSON response.
The following code will fetch data from this api:
```js
// ...
client.on(Events.InteractionCreate, async (interaction) => {
// ...
if (commandName === 'urban') {
const term = interaction.options.getString('term');
const query = new URLSearchParams({ term }); // [!code word:URLSearchParams]
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
const { list } = await dictResult.body.json();
}
});
```
Here, you are using JavaScript's native [URLSearchParams class](https://developer.mozilla.org/docs/Web/API/URLSearchParams) to create a [query string](https://en.wikipedia.org/wiki/Query_string) for the URL so that the Urban Dictionary server can parse it and know what you want to look up.
If you were to do `/urban hello world`, then the URL would become https://api.urbandictionary.com/v0/define?term=hello%20world since the string `"hello world"` is encoded.
You can get the respective properties from the returned JSON. If you were to view it in your browser, it usually looks like a bunch of mumbo jumbo. If it doesn't, great! If it does, then you should get a JSON formatter/viewer. If you're using Chrome, [JSON Formatter](https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa) is one of the more popular extensions. If you're not using Chrome, search for "JSON formatter/viewer &lt;your browser&gt;" and get one.
Now, if you look at the JSON, you can see that it has a `list` property, which is an array of objects containing various definitions for the term (maximum 10). Something you always want to do when making API-based commands is to handle the case when no results are available. So, if you throw a random term in there (e.g. `njaksdcas`) and then look at the response the `list` array should be empty. Now you are ready to start writing!
As explained above, you'll want to check if the API returned any answers for your query, and send back the definition if that's the case:
```js
if (commandName === 'urban') {
// ...
if (!list.length) {
return interaction.editReply(`No results found for **${term}**.`);
}
interaction.editReply(`**${term}**: ${list[0].definition}`);
}
```
Here, you are only getting the first object from the array of objects called `list` and grabbing its `definition` property.
If you've followed the tutorial, you should have something like this:
Now, you can make it an [embed](../popular-topics/embeds) for easier formatting.
You can define the following helper function at the top of your file. In the code below, you can use this function to truncate the returned data and make sure the embed doesn't error, because field values exceed 1024 characters.
```js
const trim = (str, max) => (str.length > max ? `${str.slice(0, max - 3)}...` : str);
```
And here is how you can build the embed from the API data:
```js
const [answer] = list;
const embed = new EmbedBuilder()
.setColor(0xefff00)
.setTitle(answer.word)
.setURL(answer.permalink)
.addFields(
{ name: 'Definition', value: trim(answer.definition, 1_024) },
{ name: 'Example', value: trim(answer.example, 1_024) },
{ name: 'Rating', value: `${answer.thumbs_up} thumbs up. ${answer.thumbs_down} thumbs down.` },
);
interaction.editReply({ embeds: [embed] });
```
<Callout>
Check out display components for a newer approach to message formatting! You can read the [display
components](../popular-topics/display-components) section of this guide to learn more about using them!
</Callout>

View File

@@ -0,0 +1,139 @@
---
title: Creating Slash Commands
---
import { Step, Steps } from 'fumadocs-ui/components/steps';
import { File, Folder, Files } from 'fumadocs-ui/components/files';
Discord allows developers to register [slash commands](https://discord.com/developers/docs/interactions/application-commands), which provide users a first-class way of interacting directly with your application.
Slash commands provide a huge number of benefits over manual message parsing, including:
- Integration with the Discord client interface.
- Automatic command detection and parsing of the associated options/arguments.
- Typed argument inputs for command options, e.g. "String", "User", or "Role".
- Validated or dynamic choices for command options.
- In-channel private responses (ephemeral messages).
- Pop-up form-style inputs for capturing additional information.
...and many more!
## Before you continue
Assuming you've followed the guide so far, your project directory should look something like this:
<Files>
<Folder name="discord-bot" defaultOpen>
<Folder name="node_modules" defaultOpen />
<File name="config.json" />
<File name="index.js" />
<File name="package-lock.json" />
<File name="package.json" />
</Folder>
</Files>
<Steps>
<Step>
### Command Files
The individual command files, containing slash command definitions and functionality.
</Step>
<Step>
### Command Handler
The [command handler](./handling-commands), dynamically reads the command files and executes commands.
</Step>
<Step>
### Command Deployment
The command [deployment script](./deploying-commands) to register your slash commands with Discord.
</Step>
</Steps>
These steps can be followed in any order, but are all required to make your bot work. This page details step **1**. Make sure you also check out the other linked pages.
## Individual command files
Create a new folder named `commands` and a subfolder named `utility` inside it, which is where you'll store all of your utility command files. You'll be using the class to construct the command definitions.
At a minimum, the definition of a slash command must have a name and a description. Slash command names must be between 1-32 characters and contain no capital letters, spaces, or symbols other than `-` and `_`. Using the builder, a simple `ping` command definition would look like this:
```js
new SlashCommandBuilder().setName('ping').setDescription('Replies with Pong!');
```
A slash command also requires a function to run when the command is used, to respond to the interaction. Using an interaction response method confirms to Discord that your bot successfully received the interaction, and has responded to the user. Discord enforces this to ensure that all slash commands provide a good user experience (UX). Failing to respond will cause Discord to show that the command failed, even if your bot is performing other actions as a result.
The simplest way to acknowledge and respond to an interaction is the `interaction.reply()` method. Other methods of replying are covered on the [Response methods](../slash-commands/response-methods) page later in this section.
```js
async execute(interaction) {
await interaction.reply('Pong!')
}
```
Put these two together by creating a `ping.js` file in the `commands/utility` folder for your first command. Inside this file, you're going to define and export two items.
- The `data` property, which will provide the command definition shown above for registering to Discord.
- The `execute` method, which will contain the functionality to run from our event handler when the command is used.
These are placed inside `module.exports` so they can be read by other files; namely the command loader and command deployment scripts mentioned earlier.
```js title="commands/utility/ping.js"
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder().setName('ping').setDescription('Replies with Pong!'),
async execute(interaction) {
await interaction.reply('Pong!');
},
};
```
<Callout>
[`module.exports`](https://nodejs.org/api/modules.html#modules_module_exports) is how you export data in Node.js so that you can [`require()`](https://nodejs.org/api/modules.html#modules_require_id) it in other files.
If you need to access your client instance from inside a command file, you can access it via `interaction.client`. If you need to access external files, packages, etc., you should `require()` them at the top of the file.
</Callout>
That's it for your basic ping command. Below are examples of two more commands we're going to build upon throughout the guide, so create two more files for these before you continue reading.
```js tab="User" title="commands/utility/user.js"
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder().setName('user').setDescription('Provides information about the user.'),
async execute(interaction) {
// interaction.user is the object representing the User who ran the command
// interaction.member is the GuildMember object, which represents the user in the specific guild
await interaction.reply(
`This command was run by ${interaction.user.username}, who joined on ${interaction.member.joinedAt}.`,
);
},
};
```
```js tab="Server" title="commands/utility/server.js"
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder().setName('server').setDescription('Provides information about the server.'),
async execute(interaction) {
// interaction.guild is the object representing the Guild in which the command was run
await interaction.reply(
`This server is ${interaction.guild.name} and has ${interaction.guild.memberCount} members.`,
);
},
};
```
#### Next steps
You can implement additional commands by creating new files within a dedicated subfolder in the `commands` folder, but these three are the ones we're going to use for the examples as we go on. For now let's move on to the code you'll need for command handling, to load the files and respond to incoming interactions.

View File

@@ -0,0 +1,153 @@
---
title: Registering Commands
---
import { Step, Steps } from 'fumadocs-ui/components/steps';
For fully functional slash commands, you need three important pieces of code:
<Steps>
<Step>
### Command Files
The individual command files, containing [slash command](./creating-commands) definitions and functionality.
</Step>
<Step>
### Command Handler
The [command handler](./handling-commands), dynamically reads the command files and executes commands.
</Step>
<Step>
### Command Deployment
The command deployment script to register your slash commands with Discord.
</Step>
</Steps>
These steps can be followed in any order, but are all required to make your bot work. This page details step **3**. Make sure you also check out the other linked pages.
## Command registration
Slash commands can be registered in two ways; in one specific guild, or for every guild the bot is in. We're going to look at single-guild registration first, as this is a good way to develop and test your commands before a global deployment.
Your application will need the `applications.commands` scope authorized in a guild for any of its slash commands to appear, and to be able to register them in a specific guild without error.
Slash commands only need to be registered once, and updated when the definition (description, options etc) is changed. As there is a daily limit on command creations, it's not necessary nor desirable to connect a whole client to the gateway or do this on every `ready` event. As such, a standalone script using the lighter REST manager is preferred.
This script is intended to be run separately, only when you need to make changes to your slash command **definitions** - you're free to modify parts such as the execute function as much as you like without redeployment.
### Guild commands
Create a `deploy-commands.js` file in your project directory. This file will be used to register and update the slash commands for your bot application.
Add two more properties to your `config.json` file, which we'll need in the deployment script:
- `clientId`: Your application's client id ([Discord Developer Portal](https://discord.com/developers/applications) > "General Information" > application id)
- `guildId`: Your development server's id ([Enable developer mode](https://support.discord.com/hc/articles/206346498) > Right-click the server title > "Copy ID")
```json title="config.json"
{
"token": "your-token-goes-here",
// [!code ++:2]
"clientId": "your-application-id-goes-here",
"guildId": "your-server-id-goes-here"
}
```
With these defined, you can use the deployment script below:
```js title="deploy-commands.js" lineNumbers
const { REST, Routes } = require('discord.js');
const { clientId, guildId, token } = require('./config.json');
const fs = require('node:fs');
const path = require('node:path');
const commands = [];
// Grab all the command folders from the commands directory you created earlier
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);
for (const folder of commandFolders) {
// Grab all the command files from the commands directory you created earlier
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter((file) => file.endsWith('.js'));
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}
// Construct and prepare an instance of the REST module
const rest = new REST().setToken(token);
// and deploy your commands!
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);
// [!code word:Guild]
// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands });
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
```
Once you fill in these values, run `node deploy-commands.js` in your project directory to register your commands to the guild specified. If you see the success message, check for the commands in the server by typing `/`! If all goes well, you should be able to run them and see your bot's response in Discord!
### Global commands
Global application commands will be available in all the guilds your application has the `applications.commands` scope authorized in, and in direct messages by default.
To deploy global commands, you can use the same script from the guild commands section above and simply adjust the route in the script to `.applicationCommands(clientId)`
```js
await rest.put(Routes.applicationCommands(clientId), { body: commands });
```
### Where to deploy
<Callout>
Guild-based deployment of commands is best suited for development and testing in your own personal server. Once you're satisfied that it's ready, deploy the command globally to publish it to all guilds that your bot is in.
You may wish to have a separate application and token in the Discord Dev Portal for your dev application, to avoid duplication between your guild-based commands and the global deployment.
</Callout>
#### Further reading
You've successfully sent a response to a slash command! However, this is only the most basic of command event and response functionality. Much more is available to enhance the user experience including:
<Cards>
<Card title="Event Handling" href="./handling-events">
Apply a similar dynamic, modular handling approach to client events.
</Card>
<Card title="Response Methods" href="../slash-commands/response-methods">
Utilize different response methods for slash commands.
</Card>
<Card title="Advanced Command Creation" href="../slash-commands/advanced-creation">
Expand on the command examples with additional, validated, option types.
</Card>
<Card title="Display Components" href="../popular-topics/display-components">
Level up command responses with formatted content and display components.
</Card>
<Card title="Interactive Components" href="../interactive-components/action-rows">
Enhance your commands with more input methods using Buttons, Select Menus, and Modals!
</Card>
</Cards>

View File

@@ -0,0 +1,171 @@
---
title: Command Handling
---
import { Step, Steps } from 'fumadocs-ui/components/steps';
Unless your bot project is small, it's not a very good idea to have a single file with a giant `if`/`else if` chain for commands. If you want to implement features into your bot and make your development process a lot less painful, you'll want to implement a command handler. Let's get started on that!
For fully functional slash commands, you need three important pieces of code:
<Steps>
<Step>
### Command Files
The individual command files, containing [slash command](./creating-commands) definitions and functionality.
</Step>
<Step>
### Command Handler
The command handler, dynamically reads the command files and executes commands.
</Step>
<Step>
### Command Deployment
The command [deployment script](./deploying-commands) to register your slash commands with Discord.
</Step>
</Steps>
These steps can be followed in any order, but are all required to make your bot work. This page details step **2**. Make sure you also check out the other linked pages.
## Loading command files
Now that your command files have been created, your bot needs to load these files on startup.
In your `index.js` file, make these additions to the base template:
```js title="index.js" lineNumbers
// [!code ++:4]
const fs = require('node:fs');
const path = require('node:path');
const { Client, Collection, Events, GatewayIntentBits, MessageFlags } = require('discord.js');
const { token } = require('./config.json');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once(Events.ClientReady, (readyClient) => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});
client.commands = new Collection(); // [!code ++]
```
We recommend attaching a `.commands` property to your client instance so that you can access your commands in other files. The rest of the examples in this guide will follow this convention. For TypeScript users, we recommend extending the base Client class to add this property, [casting](https://www.typescripttutorial.net/typescript-tutorial/type-casting/), or [augmenting the module type](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
<Callout>
- The [`fs`](https://nodejs.org/api/fs.html) module is Node's native file system module. `fs` is used to read the
`commands` directory and identify our command files. - The [`path`](https://nodejs.org/api/path.html) module is Node's
native path utility module. `path` helps construct paths to access files and directories. One of the advantages of the
`path` module is that it automatically detects the operating system and uses the appropriate joiners. - The
`Collection` class extends JavaScript's native
[`Map`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map) class, and includes more
extensive, useful functionality. `Collection` is used to store and efficiently retrieve commands for execution.
</Callout>
Next, using the modules imported above, dynamically retrieve your command files with a few more additions to the `index.js` file:
```js title="index.js" lineNumbers=12
client.commands = new Collection();
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);
for (const folder of commandFolders) {
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter((file) => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
// Set a new item in the Collection with the key as the command name and the value as the exported module
if ('data' in command && 'execute' in command) {
client.commands.set(command.data.name, command);
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}
```
First, [`path.join()`](https://nodejs.org/api/path.html#pathjoinpaths) helps to construct a path to the `commands` directory. The first [`fs.readdirSync()`](https://nodejs.org/api/fs.html#fs_fs_readdirsync_path_options) method then reads the path to the directory and returns an array of all the folder names it contains, currently `['utility']`. The second `fs.readdirSync()` method reads the path to this directory and returns an array of all the file names they contain, currently `['ping.js', 'server.js', 'user.js']`. To ensure only command files get processed, `Array.filter()` removes any non-JavaScript files from the array.
With the correct files identified, the last step is dynamically set each command into the `client.commands` Collection. For each file being loaded, check that it has at least the `data` and `execute` properties. This helps to prevent errors resulting from loading empty, unfinished, or otherwise incorrect command files while you're still developing.
## Receiving command interactions
You will receive an interaction for every slash command executed. To respond to a command, you need to create a listener for the `interactionCreate` event that will execute code when your application receives an interaction. Place the code below in the `index.js` file you created earlier.
```js title="index.js" lineNumbers=32
// [!code ++:3]
client.on(Events.InteractionCreate, (interaction) => {
console.log(interaction);
});
```
Not every interaction is a slash command (e.g. `MessageComponent` interactions). Make sure to only handle slash commands in this function by making use of the `BaseInteraction#isChatInputCommand` method to exit the handler if another type is encountered. This method also provides typeguarding for TypeScript users, narrowing the type from `BaseInteraction` to a `ChatInputCommandInteraction`.
```js title="index.js" lineNumbers=32
client.on(Events.InteractionCreate, (interaction) => {
if (!interaction.isChatInputCommand()) return; // [!code ++]
console.log(interaction);
});
```
## Executing commands
When your bot receives a `interactionCreate` event, the interaction object contains all the information you need to dynamically retrieve and execute your commands!
Let's take a look at the `ping` command again. Note the `execute()` function that will reply to the interaction with "Pong!".
```js title="commands/utility/ping.js"
// [!code word:execute]
module.exports = {
data: new SlashCommandBuilder().setName('ping').setDescription('Replies with Pong!'),
async execute(interaction) {
await interaction.reply('Pong!');
},
};
```
First, you need to get the matching command from the `client.commands` Collection based on the `interaction.commandName`. Your `Client` instance is always available via `interaction.client`. If no matching command is found, log an error to the console and ignore the event.
With the right command identified, all that's left to do is call the command's `.execute()` method and pass in the `interaction` variable as its argument. In case something goes wrong, catch and log any error to the console.
```js title="index.js" lineNumbers=32
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isChatInputCommand()) return;
// [!code ++:23]
const command = interaction.client.commands.get(interaction.commandName);
if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}
try {
await command.execute(interaction);
} catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({
content: 'There was an error while executing this command!',
flags: MessageFlags.Ephemeral,
});
} else {
await interaction.reply({
content: 'There was an error while executing this command!',
flags: MessageFlags.Ephemeral,
});
}
}
});
```
#### Next steps
Your command files are now loaded into your bot, and the event listener is prepared and ready to respond. In the next section, we cover the final step: a command deployment script you'll need to register your commands so they appear in the Discord client.

View File

@@ -0,0 +1,215 @@
---
title: Event Handling
---
import { File, Folder, Files } from 'fumadocs-ui/components/files';
Node.js uses an event-driven architecture, making it possible to execute code when a specific event occurs. The discord.js library takes full advantage of this. You can visit the `Client` documentation to see the full list of events.
<Callout>
This page assumes you've followed the guide up to this point, and created your `index.js` and individual slash
commands according to those pages.
</Callout>
At this point, your `index.js` file has listeners for two events: `ClientReady` and `InteractionCreate`.
```js title="index.js"
// [!code word:ClientReady]
client.once(Events.ClientReady, (readyClient) => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
// [!code word:InteractionCreate]
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isChatInputCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);
if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}
try {
await command.execute(interaction);
} catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({
content: 'There was an error while executing this command!',
flags: MessageFlags.Ephemeral,
});
} else {
await interaction.reply({
content: 'There was an error while executing this command!',
flags: MessageFlags.Ephemeral,
});
}
}
});
```
Currently, the event listeners are in the `index.js` file. `Client#ready`emits once when the `Client` becomes ready for use, and `Client#interactionCreate` emits whenever an interaction is received. Moving the event listener code into individual files is simple, and we'll be taking a similar approach to the command handler.
<Callout type="warn">
You're only going to move these two events from `index.js`. The code for [loading command
files](./handling-commands#loading-command-files) will stay here!
</Callout>
## Individual event files
Your project directory should look something like this:
<Files>
<Folder name="discord-bot" defaultOpen>
<Folder name="commands" defaultOpen />
<Folder name="node_modules" defaultOpen />
<File name="config.json" />
<File name="deploy-commands.js" />
<File name="index.js" />
<File name="package-lock.json" />
<File name="package.json" />
</Folder>
</Files>
Create an `events` folder in the same directory. You can then move the code from your event listeners in `index.js` to separate files: `events/ready.js` and `events/interactionCreate.js`.
```js tab="Ready Handler" title="events/ready.js"
const { Events } = require('discord.js');
module.exports = {
name: Events.ClientReady,
once: true,
execute(client) {
console.log(`Ready! Logged in as ${client.user.tag}`);
},
};
```
```js tab="Interaction Handler" title="events/interactionCreate.js"
const { Events, MessageFlags } = require('discord.js');
module.exports = {
name: Events.InteractionCreate,
async execute(interaction) {
if (!interaction.isChatInputCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);
if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}
try {
await command.execute(interaction);
} catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({
content: 'There was an error while executing this command!',
flags: MessageFlags.Ephemeral,
});
} else {
await interaction.reply({
content: 'There was an error while executing this command!',
flags: MessageFlags.Ephemeral,
});
}
}
},
};
```
```js title="index.js" tab="Main File (after removing events)"
const fs = require('node:fs');
const path = require('node:path');
const { Client, Collection, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.commands = new Collection();
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);
for (const folder of commandFolders) {
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter((file) => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
client.commands.set(command.data.name, command);
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}
client.login(token);
```
The `name` property states which event this file is for, and the `once` property holds a boolean value that specifies if the event should run only once. You don't need to specify this in `interactionCreate.js` as the default behavior will be to run on every event instance. The `execute` function holds your event logic, which will be called by the event handler whenever the event emits.
## Reading event files
Next, let's write the code for dynamically retrieving all the event files in the `events` folder. We'll be taking a similar approach to our [command handler](./handling-commands). Place the new code highlighted below in your `index.js`.
`fs.readdirSync().filter()` returns an array of all the file names in the given directory and filters for only `.js` files, i.e. `['ready.js', 'interactionCreate.js']`.
```js title="index.js"
const fs = require('node:fs');
const path = require('node:path');
const { Client, Collection, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.commands = new Collection();
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);
for (const folder of commandFolders) {
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter((file) => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
client.commands.set(command.data.name, command);
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}
// [!code ++:12]
const eventsPath = path.join(__dirname, 'events');
const eventFiles = fs.readdirSync(eventsPath).filter((file) => file.endsWith('.js'));
for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
const event = require(filePath);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}
client.login(token);
```
You'll notice the code looks very similar to the command loading above it - read the files in the events folder and load each one individually.
The `Client` class in discord.js extends the [`EventEmitter`](https://nodejs.org/api/events.html#events_class_eventemitter) class. Therefore, the `client` object exposes the [`.on()`](https://nodejs.org/api/events.html#events_emitter_on_eventname_listener) and [`.once()`](https://nodejs.org/api/events.html#events_emitter_once_eventname_listener) methods that you can use to register event listeners. These methods take two arguments: the event name and a callback function. These are defined in your separate event files as `name` and `execute`.
The callback function passed takes argument(s) returned by its respective event, collects them in an `args` array using the `...` [rest parameter syntax](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Functions/rest_parameters), then calls `event.execute()` while passing in the `args` array using the `...` [spread syntax](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/Spread_syntax). They are used here because different events in discord.js have different numbers of arguments. The rest parameter collects these variable number of arguments into a single array, and the spread syntax then takes these elements and passes them to the `execute` function.
After this, listening for other events is as easy as creating a new file in the `events` folder. The event handler will automatically retrieve and register it whenever you restart your bot.
<Callout>
In most cases, you can access your `client` instance in other files by obtaining it from one of the other discord.js
structures, e.g. `interaction.client` in the `interactionCreate` event. You do not need to manually pass it to your
events.
</Callout>

View File

@@ -0,0 +1,50 @@
---
title: The Main File
---
<Callout>
This page assumes you've already prepared the [configuration files](../app-creation/project-setup#configuration-files)
from the previous page. We're using the `config.json` approach, however feel free to substitute your own!
</Callout>
## Creating the main file
Open your code editor and create a new file. We suggest that you save the file as `index.js`, but you may name it whatever you wish.
Here's the base code to get you started:
```js title="index.js"
// Require the necessary discord.js classes
const { Client, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
// Create a new client instance
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
// When the client is ready, run this code (only once).
// The distinction between `client: Client<boolean>` and `readyClient: Client<true>` is important for TypeScript developers.
// It makes some properties non-nullable.
client.once(Events.ClientReady, (readyClient) => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});
// Log in to Discord with your client's token
client.login(token);
```
This is how you create a client instance for your Discord bot and log in to Discord. The `GatewayIntentBits.Guilds` intents option is necessary for the discord.js client to work as you expect it to, as it ensures that the caches for guilds, channels, and roles are populated and available for internal use.
<Callout>The term "guild" is used by the Discord API and in discord.js to refer to a Discord server.</Callout>
Intents also define which events Discord should send to your bot, and you may wish to enable more than just the minimum. You can read more about the other intents in the [Intents topic](../popular-topics/intents).
## Running your application
Open your terminal and run `node index.js` to start the process. If you see "Ready!" after a few seconds, you're good to go! The next step is to start adding slash commands to develop your app's functionality.
<Callout>
You can open your `package.json` file and edit the `"main": "index.js"` field to point to your main file. You can then run `node .` in your terminal to start the process!
After closing the process with <kbd>Ctrl</kbd> <kbd>C</kbd>, you can press the up arrow on your keyboard to bring up the latest commands you've run. Pressing up and then enter after closing the process is a quick way to start it up again.
</Callout>

View File

@@ -0,0 +1,11 @@
{
"title": "Creating Your App",
"pages": [
"project-setup",
"main-file",
"creating-commands",
"handling-commands",
"deploying-commands",
"handling-events"
]
}

View File

@@ -0,0 +1,101 @@
---
title: Project Setup
---
## Configuration files
Once you [add your bot to a server](../preparations/adding-your-app), the next step is to start coding and get it online! Let's start by creating a config file for your client token and a main file for your bot application.
As explained in the ["What is a token, anyway?"](../preparations/app-setup#what-is-a-token-anyway) section, your token is essentially your bot's password, and you should protect it as best as possible. This can be done through a `config.json` file or by using environment variables.
Open your application in the [Discord Developer Portal](https://discord.com/developers/applications) and go to the "Bot" page to copy your token.
## Using `config.json`
Storing data in a `config.json` file is a common way of keeping your sensitive values safe. Create a `config.json` file in your project directory and paste in your token. You can access your token inside other files by using `require()`.
```json tab="Config" title="config.json"
{
"token": "your-token-goes-here"
}
```
```js tab="Usage"
const { token } = require('./config.json');
console.log(token);
```
<Callout title="Danger" type="error">
If you're using Git, you should not commit files containing secrets. Read on to find out how to [exclude them from
versioning by using `.gitignore`](#git-and-gitignore).
</Callout>
## Using environment variables
Environment variables are, as the name suggests, values you can pass to your environment (e.g. terminal session, Docker container, node process). This has the benefit that you can keep your code the same for different execution contexts.
```txt title=".env"
A=Hello World
B=123
DISCORD_TOKEN=MTI3NDMxMjA3PDQ3ODIxNzIzNg.G6uEbl.IpA3-9YeScYr9pu9K1utMlpP4p-KJwNxcIAbi8
```
<Callout title="Danger" type="error">
If you're using Git, you should not commit `.env` or other environment files containing secrets. Read on to find out
how to [exclude them from versioning by using `.gitignore`](#git-and-gitignore).
</Callout>
To use environment variables in Node.js, we recommend you use the command line interface flag `--env-file` to point to the `.env` file you want to use. Note that the file name `.env` is just a convention. You could for example have a `.env.development` and `.env.production` file with different values depending on the Discord application you want to run your code.
You can also read multiple environment files by using the `--env-file` flag multiple times.
```sh
node --env-file=.env index.js
```
<Callout>You don't need to pass any special flags when using Bun! Bun reads `.env` files automatically.</Callout>
The values you specify in `.env` files this way are exposed through the `process.env` global variable in any file. Note that values passed this way will always be strings. If you want to do calculations on environment numbers, you will have to parse them:
```js title="index.js"
// [!code word:env]
console.log(process.env.A);
console.log(process.env.B + 9); // 1239 (this concatenates the number to the string!)
console.log(Number(process.env.C) + 9); // 132
console.log(process.env.DISCORD_TOKEN);
```
## Online editors
While we generally do not recommend using online editors as hosting solutions, but rather invest in a proper virtual private server, these services do offer ways to keep your credentials safe as well! Please see the respective service's documentation and help articles for more information on how to keep sensitive values safe:
<Cards>
<Card title="Glitch" href="https://help.glitch.com/s/article/Adding-Private-Data">
Learn more about storing secrets in `.env` files using Glitch
</Card>
<Card title="Heroku" href="https://devcenter.heroku.com/articles/config-vars">
Learn more about configuration variables in Heroku
</Card>
<Card title="Replit" href="https://docs.replit.com/replit-workspace/workspace-features/secrets#secrets">
Learn more about secrets and environment variables in Replit
</Card>
</Cards>
## Git and `.gitignore`
Git is a fantastic tool to keep track of your code changes and allows you to upload progress to services like [GitHub](https://github.com/), [GitLab](https://about.gitlab.com/), or [Bitbucket](https://bitbucket.org/product). While this is super useful to share code with other developers, it also bears the risk of uploading your configuration files with sensitive values!
You can specify files that Git should ignore in its versioning systems with a `.gitignore` file. Create a `.gitignore` file in your project directory and add the names of the files and folders you want to ignore. The following example ignores the `config.json` and `.env` files as well as the `node_modules` directory:
```txt title=".gitignore"
node_modules
.env
config.json
```
<Callout>
`.gitignore` files can specify intricate patterns and help with your general development flow. Apart from keeping your
credentials safe, you should exclude `node_modules` from version control as well, its contents can be restored from
the entries in your `package.json` and `package-lock.json` files.
</Callout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,3 @@
{
"title": "Improving Your Dev Environment"
}

View File

@@ -0,0 +1,200 @@
---
title: Package Scripts
---
## Setting up package.json scripts
An easy way to run scripts like a script to start your bot, a script to lint your bot's files, or whatever scripts you use is by storing them in your `package.json` file. After you store these scripts in your `package.json` file, you can run the `start` script to start your bot or the `lint` script to lint your code for errors.
```sh tab="npm"
npm run start
npm run lint
```
```sh tab="yarn"
yarn run start
yarn run lint
```
```sh tab="pnpm"
pnpm run start
pnpm run lint
```
```sh tab="bun"
bun run start
bun run lint
```
## Getting started
<Callout>
Before getting started, you'll need to have a `package.json` file. If you don't have a `package.json` file yet, you can run the following command in the console to generate one.
```sh tab="npm"
npm init -y
```
```sh tab="yarn"
yarn init -y
```
```sh tab="pnpm"
pnpm init
```
```sh tab="bun"
bun init -y
```
</Callout>
If you haven't touched your `package.json` file yet (excluding installing dependencies), your `package.json` file should look similar to the following:
```json title="package.json"
{
"name": "my-bot",
"version": "1.0.0",
"description": "A Discord bot!",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
```
Let's zoom in more. Below `main`, you'll see `scripts`. You can specify your scripts there. In this guide, we'll show how to start and lint your bot using a `package.json` script.
## Adding your first script
<Callout>
We'll assume you have finished the [creating your app](../app-creation/project-setup) section of the guide. If you
haven't, ensure to follow it first!
</Callout>
Over at your `package.json` file, add the following line to the `scripts`:
```json title="package.json"
{
"name": "my-bot",
"version": "1.0.0",
"description": "A Discord bot!",
"main": "index.js",
"scripts": { // [!code focus:5]
"test": "echo \"Error: no test specified\" && exit 1" // needs a comma // [!code --]
"test": "echo \"Error: no test specified\" && exit 1", // [!code ++]
"start": "node ." // [!code ++]
},
"keywords": [],
"author": "",
"license": "ISC"
}
```
<Callout>
The `node .` script will run the file you have specified at the `main` entry in your `package.json` file. If you don't
have it set yet, make sure to select your bot's main file as `main`!
</Callout>
Now, whenever you run the `start` script in your bot's directory, it will run the `node .` command.
```sh tab="npm"
npm run start
```
```sh tab="yarn"
yarn run start
```
```sh tab="pnpm"
pnpm run start
```
```sh tab="bun"
bun run start
```
Let's create another script to lint your code via the command line. Add the following line to your scripts:
```json title="package.json"
{
"name": "my-bot",
"version": "1.0.0",
"description": "A Discord bot!",
"main": "index.js",
"scripts": { // [!code focus:6]
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node ." // needs a comma // [!code --]
"start": "node .", // [!code ++]
"lint": "eslint ." // [!code ++]
},
"keywords": [],
"author": "",
"license": "ISC"
}
```
Now, whenever you run the `lint` script, ESLint will lint your `index.js` file.
```sh tab="npm"
npm run lint
```
```sh tab="yarn"
yarn run lint
```
```sh tab="pnpm"
pnpm run lint
```
```sh tab="bun"
bun run lint
```
Your `package.json` file should now look similar to the following:
```json
{
"name": "my-bot",
"version": "1.0.0",
"description": "A Discord bot!",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node .",
"lint": "eslint ."
},
"keywords": [],
"author": "",
"license": "ISC"
}
```
And that's it! You can always add more scripts now, running them with:
```sh tab="npm"
npm run <script-name>
```
```sh tab="yarn"
yarn run <script-name>
```
```sh tab="pnpm"
pnpm run <script-name>
```
```sh tab="bun"
bun run <script-name>
```
<Cards>
<Card title="Package Scripts" href="https://docs.npmjs.com/cli/v7/using-npm/scripts">
Package scripts allow some more configuration (like pre-, post- and lifecycle scripts) than we can cover in this
guide. Check out the official documentation on for more information.
</Card>
</Cards>

View File

@@ -0,0 +1,113 @@
---
title: PM2
---
PM2 is a process manager. It manages your applications' states, so you can start, stop, restart, and delete processes. It offers features such as monitoring running processes and setting up a "start with operating system" (be that Windows, Linux, or Mac) so your processes start when you boot your system.
## Installation
You can install PM2 via the following command:
```sh tab="npm"
npm install --global pm2
```
```sh tab="yarn"
yarn global add pm2
```
```sh tab="pnpm"
pnpm add --global pm2
```
```sh tab="bun"
bun add --global pm2
```
## Starting your app
After you install PM2, the easiest way you can start your app is by going to the directory your bot is in and then run the following:
```sh
pm2 start your-app-name.js
```
### Additional notes
The `pm2 start` script allows for more optional command-line arguments.
- `--name`: This allows you to set the name of your process when listing it up with `pm2 list` or `pm2 monit`:
```sh
pm2 start your-app-name.js --name "Some cool name"
```
- `--watch`: This option will automatically restart your process as soon as a file change is detected, which can be useful for development environments:
```bash
pm2 start your-app-name.js --watch
```
<Callout>
The `pm2 start` command can take more optional parameters, but only these two are relevant. If you want to see all the
parameters available, you can check the documentation of pm2
[here](https://pm2.keymetrics.io/docs/usage/pm2-doc-single-page/).
</Callout>
Once the process launches with pm2, you can run `pm2 monit` to monitor all console outputs from the processes started by pm2. This accounts for any `console.log()` in your code or outputted errors.
In a similar fashion to how you start the process, running `pm2 stop` will stop the current process without removing it from PM2's interface:
```sh
pm2 stop your-app-name.js
```
## Setting up booting with your system
Perhaps one of the more useful features of PM2 is being able to boot up with your Operating System. This feature will ensure that your bot processes will always be started after an (unexpected) reboot (e.g., after a power outage).
The initial steps differ per OS. In this guide, we'll cover those for Windows and Linux/macOS.
### Initial steps for Windows
It is recommended to use `pm2-installer`. Follow the steps over at their [`GitHub`](https://github.com/jessety/pm2-installer).
### Initial steps for Linux/macOS
You'll need a start script, which you can get by running the following command:
```sh
# Detects the available init system, generates the config, and enables startup system
pm2 startup
```
Or, if you want to specify your machine manually, select one of the options with the command:
```sh
pm2 startup [ubuntu | ubuntu14 | ubuntu12 | centos | centos6 | arch | oracle | amazon | macos | darwin | freesd | systemd | systemv | upstart | launchd | rcd | openrc]
```
The output of running one of the commands listed above will output a command for you to run with all environment variables and options configured.
**Example output for an Ubuntu user:**
```
[PM2] You have to run this command as root. Execute the following command:
sudo su -c "env PATH=$PATH:/home/user/.nvm/versions/node/v8.9/bin pm2 startup ubuntu -u user --hp /home/user
```
After running that command, you can continue to the next step.
### Saving the current process list
To save the current process list so it will automatically get started after a restart, run the following command:
```sh
pm2 save
```
To disable this, you can run the following command:
```sh
pm2 unstartup
```

View File

@@ -1,18 +1,19 @@
---
title: Introduction
category: Home
---
# Introduction
import { GithubInfo } from '@/components/GitHubInfo';
<GithubInfo owner="discordjs" repo="discord.js" />
If you're reading this, it probably means you want to learn how to make a bot with discord.js. Awesome! You've come to the right place.
This guide will teach you things such as:
- How to get a bot [up and running](/preparations/) from scratch;
- How to properly [create](/creating-your-bot/), [organize](/creating-your-bot/command-handling.md), and expand on your commands;
- In-depth explanations and examples regarding popular topics (e.g. [reactions](/popular-topics/reactions.md), [embeds](/popular-topics/embeds.md), [canvas](/popular-topics/canvas.md));
- Working with databases (e.g. [sequelize](/sequelize/) and [keyv](/keyv/));
- Getting started with [sharding](/sharding/);
- How to get a bot [up and running](./legacy/preparations/app-setup) from scratch;
- How to properly [create](./legacy/app-creation/project-setup), [organize](./legacy/app-creation/handling-commands), and expand on your commands;
- In-depth explanations and examples regarding popular topics (e.g. [components](./legacy/popular-topics/display-components), [reactions](./legacy/popular-topics/reactions), [embeds](./legacy/popular-topics/embeds), [canvas](./legacy/popular-topics/canvas));
- Working with databases (e.g. [sequelize](./legacy/sequelize/) and [keyv](./legacy/keyv/keyv));
- Getting started with [sharding](./legacy/sharding/);
- And much more.
This guide will also cover subjects like common errors and how to solve them, keeping your code clean, setting up a proper development environment, etc.
@@ -29,7 +30,7 @@ If you don't know JavaScript but would like to learn about it, here are a few li
- [JavaScript.info, a modern javascript tutorial](https://javascript.info/)
- [Codecademy's interactive JavaScript course](https://www.codecademy.com/learn/introduction-to-javascript)
- [Nodeschool, for both JavaScript and Node.js lessons](https://nodeschool.io/)
- [MDN's JavaScript guide and full documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript)
- [MDN's JavaScript guide and full documentation](https://developer.mozilla.org/docs/Web/JavaScript)
- [Google, your best friend](https://google.com)
Take your pick, learn some JavaScript, and once you feel like you're confident enough to make a bot, come back and get started!

View File

@@ -0,0 +1,52 @@
---
title: Context Menus
---
Context Menus are application commands which appear when right clicking or tapping a user or a message, in the Apps submenu.
<Callout>
This page is a follow-up to the [slash commands](../slash-commands/advanced-creation) section. Please carefully read
those pages first so that you can understand the methods used in this section.
</Callout>
## Registering context menu commands
To create a context menu command, use the `ContextMenuCommandBuilder` class. You can then set the type of the context menu (user or message) using the `setType()` method.
```js
const { ContextMenuCommandBuilder, ApplicationCommandType } = require('discord.js');
const data = new ContextMenuCommandBuilder().setName('User Information').setType(ApplicationCommandType.User);
```
## Receiving context menu command interactions
Context menus commands, just like slash commands, are received via an interaction. You can check if a given interaction is a context menu by invoking the `isContextMenuCommand()` method, or the `isMessageContextMenuCommand()` and `isUserContextMenuCommand()` methods to check for the specific type of context menu interaction:
```js
client.on(Events.InteractionCreate, (interaction) => {
if (!interaction.isUserContextMenuCommand()) return;
console.log(interaction);
});
```
## Extracting data from context menus
For user context menus, you can get the targeted user by accessing the `targetUser` or `targetMember` property from the `UserContextMenuCommandInteraction`.
For message context menus, you can get the targeted message by accessing the `targetMessage` property from the `MessageContextMenuCommandInteraction`.
```js
client.on(Events.InteractionCreate, (interaction) => {
if (!interaction.isUserContextMenuCommand()) return;
// Get the User's username from context menu
const { username } = interaction.targetUser;
console.log(username);
});
```
## Notes
- Context menu commands cannot have subcommands or any options.
- Responding to context menu commands functions the same as slash commands. Refer to our [slash command responses](../slash-commands/response-methods) guide for more information.
- Context menu command permissions also function the same as slash commands. Refer to our [slash command permissions](../slash-commands/permissions) guide for more information.

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View File

@@ -0,0 +1,3 @@
{
"title": "Other Interactions"
}

View File

@@ -0,0 +1,419 @@
---
title: Modals
---
Modals are pop-up forms that allow you to prompt users for additional input. This form-like interaction response blocks the user from interacting with Discord until the modal is submitted or dismissed. In this section, we will cover how to create, show, and receive modals using discord.js!
<Callout>
This page is a follow-up to the [interactions (slash commands) page](../slash-commands/advanced-creation). Reading
that page first will help you understand the concepts introduced in this page.
</Callout>
## Building and responding with modals
With the `ModalBuilder` class, discord.js offers a convenient way to build modals step by step using setters and callbacks.
<Callout>
You can have a maximum of five top-level components per modal, each of which can be a label or a text display
component.
</Callout>
```js
const { Events, ModalBuilder } = require('discord.js');
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'ping') {
const modal = new ModalBuilder().setCustomId('myModal').setTitle('My Modal');
// TODO: Add components to modal...
}
});
```
<Callout>
The `customId` is a developer-defined string of up to 100 characters and uniquely identifies this modal instance. You
can use it to differentiate incoming interactions.
</Callout>
The next step is adding components to the modal, which may either request input or present information.
### Label
Label components wrap around other modal components (text input, select menus, etc.) to add a label and description to it.
Since labels are not stand-alone components, we will use this example label to wrap a text input component in the next section:
```js
const { LabelBuilder, ModalBuilder } = require('discord.js');
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'ping') {
// [!code focus:11]
// Create the modal
const modal = new ModalBuilder().setCustomId('myModal').setTitle('My Modal');
// [!code ++:5]
const hobbiesLabel = new LabelBuilder()
// The label is a large header text that identifies the interactive component for the user.
.setLabel('What are some of your favorite hobbies?')
// The description is an additional optional subtext that aids the label.
.setDescription('Activities you like to participate in');
// [!code ++:2]
// Add label to the modal
modal.addLabelComponents(hobbiesLabel);
}
});
```
<Callout>
The `label` field has a max length of 45 characters. The `description` field has a max length of 100 characters.
</Callout>
### Text input
Text input components prompt users for single or multi line free-form text.
```js
const { LabelBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'ping') {
// [!code focus:10]
// Create the modal
const modal = new ModalBuilder().setCustomId('myModal').setTitle('My Modal');
// [!code ++:6]
const hobbiesInput = new TextInputBuilder()
.setCustomId('hobbiesInput')
// Short means a single line of text.
.setStyle(TextInputStyle.Short)
// Placeholder text displayed inside the text input box
.setPlaceholder('card games, films, books, etc.');
// [!code focus:10]
const hobbiesLabel = new LabelBuilder()
// The label is a large header that identifies the interactive component for the user.
.setLabel("What's some of your favorite hobbies?")
// The description is an additional optional subtext that aids the label.
.setDescription('Activities you like to participate in')
// [!code ++:2]
// Set text input as the component of the label
.setTextInputComponent(hobbiesInput);
// Add the label to the modal
modal.addLabelComponents(hobbiesLabel);
}
});
```
#### Input styles
Discord offers two different input styles:
- `Short`, a single-line text entry
- `Paragraph`, a multi-line text entry
#### Input properties
A text input field can be customized in a number of ways to apply validation or set default values via the following `TextInputBuilder` methods:
```js
const input = new TextInputBuilder()
// Set the component id (this is not the custom id)
.setId(1)
// Set the maximum number of characters allowed
.setMaxLength(1_000)
// Set the minimum number of characters required for submission
.setMinLength(10)
// Set a default value to prefill the text input
.setValue('Default')
// Require a value in this text input field (defaults to true)
.setRequired(true);
```
<Callout>
The `id` field is used to differentiate components within interactions (which text input, selection, etc.). In
contrast, the `customId` covered earlier identifies the interaction (which modal, command, etc.).
</Callout>
### Select menu
Select menus allow you to limit user input to a preselected list of values. Discord also offers select menus linked directly to native Discord entities like users, roles, and channels.
Since they behave very similarly to how they do in messages, please refer to the [corresponding guide page](../interactive-components/select-menus) for more information on configuring select menus.
Here again, you wrap the select menu with a label component to add context to the selection and add the label to the modal:
```js
// ...
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'ping') {
// Create the modal
const modal = new ModalBuilder().setCustomId('myModal').setTitle('My Modal');
// ...
// [!code focus:24]
// [!code ++:23]
const favoriteStarterSelect = new StringSelectMenuBuilder()
.setCustomId('starter')
.setPlaceholder('Make a selection!')
// Modal only property on select menus to prevent submission, defaults to true
.setRequired(true)
.addOptions(
// String select menu options
new StringSelectMenuOptionBuilder()
// Label displayed to user
.setLabel('Bulbasaur')
// Description of option
.setDescription('The dual-type Grass/Poison Seed Pokémon.')
// Value returned to you in modal submission
.setValue('bulbasaur'),
new StringSelectMenuOptionBuilder()
.setLabel('Charmander')
.setDescription('The Fire-type Lizard Pokémon.')
.setValue('charmander'),
new StringSelectMenuOptionBuilder()
.setLabel('Squirtle')
.setDescription('The Water-type Tiny Turtle Pokémon.')
.setValue('squirtle'),
);
// ...
// [!code focus:4]
// [!code ++:4]
const favoriteStarterLabel = new LabelBuilder()
.setLabel("What's your favorite Gen 1 Pokémon starter?")
// Set string select menu as component of the label
.setStringSelectMenuComponent(favoriteStarterSelect);
// [!code focus:3]
// Add labels to modal
modal.addLabelComponents(hobbiesLabel); // [!code --]
modal.addLabelComponents(hobbiesLabel, favoriteStarterLabel); // [!code ++]
}
});
```
### Text display
Text display components offer you a way to give additional context to the user that doesn't fit into labels or isn't directly connected to any specific input field.
```js
// ...
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'ping') {
// Create the modal
const modal = new ModalBuilder().setCustomId('myModal').setTitle('My Modal');
// ...
// [!code focus:3]
// [!code ++:3]
const text = new TextDisplayBuilder().setContent(
'Text that could not fit in to a label or description\n-# Markdown can also be used',
);
// [!code focus:5]
// Add components to modal
modal
// [!code --]
.addLabelComponents(hobbiesLabel, favoriteStarterLabel);
// [!code ++:2]
.addLabelComponents(hobbiesLabel, favoriteStarterLabel)
.addTextDisplayComponents(text);
}
});
```
### File upload
File upload components allow you to prompt the user to upload a file from their system.
<Callout type="warn">
Discord **does not send the file data** itself in the resulting interaction. You will have to download it from
Discords CDN to process and validate it. Do not execute arbitrary code people upload via your app!
</Callout>
```js
// ...
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'ping') {
// Create the modal
const modal = new ModalBuilder().setCustomId('myModal').setTitle('My Modal');
// ...
// [!code focus:2]
// [!code ++]
const pictureOfTheWeekUpload = new FileUploadBuilder().setCustomId('picture');
// ...
// [!code focus:12]
// [!code ++:5]
const pictureOfTheWeekLabel = new LabelBuilder()
.setLabel('Picture of the Week')
.setDescription('The best pictures you have taken this week')
// Set file upload as component of the label
.setFileUploadComponent(pictureOfTheWeekUpload);
// Add components to modal
modal
.addLabelComponents(hobbiesLabel, favoriteStarterLabel)
// [!code --]
.addTextDisplayComponents(text);
// [!code ++:2]
.addTextDisplayComponents(text)
.addLabelComponents(pictureOfTheWeekLabel);
}
});
```
#### File upload properties
A file upload component can be customized to apply validation via the following `FileUploadBuilder` methods:
```js
const pictureOfTheWeekUpload = new FileUploadBuilder()
// Set the optional identifier for component
.setId(1)
// Minimum number of items that must be uploaded (defaults to 1); min 0, max 10
.setMinValues(1)
// Maximum number of items that can be uploaded (defaults to 1); max 10
.setMaxValues(1)
// Require a value in this file upload component (defaults to true)
.setRequired(true);
```
<Callout>
The `id` field is used to differentiate components within interactions (which text input, selection, etc.).
In contrast, the `customId` covered earlier identifies the interaction (which modal, command, etc.).
You **cannot** limit and validate the **file size** or the **file extension**.
</Callout>
### Responding with a modal
With the modal built, call `ChatInputCommandInteraction#showModal()` to send the interaction response to Discord and display the modal to the user.
<Callout type="warn">
Showing a modal must be the first response to an interaction. You **cannot** defer modals.
</Callout>
```js
// ...
// [!code focus:5]
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'ping') {
// Create the modal
const modal = new ModalBuilder().setCustomId('myModal').setTitle('My Modal');
// ...
// [!code focus:9]
// Add components to modal
modal
.addLabelComponents(hobbiesLabel, favoriteStarterLabel)
.addTextDisplayComponents(text)
.addLabelComponents(pictureOfTheWeekLabel);
// [!code ++:2]
// Show modal to the user
await interaction.showModal(modal);
}
});
```
Restart your bot and invoke the `/ping` command again. You should see the modal as shown below:
![Modal Example](./images/modal-example.png)
## Receiving modal submissions
### Interaction collectors
Modal submissions can be collected within the scope of the interaction that sent the modal by utilizing an `InteractionCollector`, or the `ChatInputCommandInteraction#awaitModalSubmit` promisified version. These both provide instances of the `ModalSubmitInteraction` class as collected items.
For a detailed guide on handling interactions with collectors, please refer to the [collectors guide](../popular-topics/collectors#interaction-collectors).
### The interactionCreate event
To receive a `ModalSubmitInteraction` event, attach an `Client#interactionCreate` event listener to your client and use the `BaseInteraction#isModalSubmit` type guard to make sure you only receive modals:
```js
client.on(Events.InteractionCreate, (interaction) => {
// ...
// [!code word:isModalSubmit] [!code highlight:2]
if (!interaction.isModalSubmit()) return;
console.log(interaction);
});
```
## Responding to modal submissions
The `ModalSubmitInteraction` class provides the same methods as the `ChatInputCommandInteraction` class. These methods behave equally:
- `reply()`
- `editReply()`
- `deferReply()`
- `fetchReply()`
- `deleteReply()`
- `followUp()`
If the modal was prompted through a button or select menu interaction, these methods may be used to update the underlying message:
- `update()`
- `deferUpdate()`
```js
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isModalSubmit()) return;
console.log(interaction);
if (interaction.customId === 'myModal') {
// [!code highlight] [!code word:reply]
await interaction.reply({ content: 'Your submission was received successfully!' });
}
});
```
<Callout>
If you're using TypeScript, you can use the `ModalSubmitInteraction#isFromMessage()` type guard to make sure the
received interaction originated from a `MessageComponentInteraction`.
</Callout>
## Extracting data from modal submissions
You can process the submitted input fields through the use of convenience getters on `ModalSubmitInteraction#fields`. The library provides getters for all modal components with user submitted data:
```js
client.on(Events.InteractionCreate, (interaction) => {
if (!interaction.isModalSubmit()) return;
if (interaction.customId === 'myModal') {
await interaction.reply({ content: 'Your submission was received successfully!' });
// [!code focus:6]
// Get the data entered by the user
const hobbies = interaction.fields.getTextInputValue('hobbiesInput');
const starter = interaction.fields.getStringSelectValues('starter');
const picture = interaction.fields.getUploadedFiles('picture');
console.log({ hobbies, starter, picture });
}
});
```
<Callout>
Empty text input submissions return an empty string `""`. Select menus without a selection return an empty array `[]`.
</Callout>

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