Compare commits

..

224 Commits

Author SHA1 Message Date
Vlad Frangu
1e06035515 chore(discord.js): release discord.js@13.17.1 (#9955) 2023-11-12 21:38:58 +00:00
Vlad Frangu
f475336b3e fix(ClientPresence): correctly set activity state on CUSTOM activity type (#9954)
* fix(ClientPresence): correctly set activity state on CUSTOM activity type

* Update ClientPresence.js
2023-11-12 21:34:26 +00:00
Vlad Frangu
07caef4cd2 chore(discord.js): release discord.js@13.17.0 (#9944) 2023-11-12 17:40:07 +00:00
Jiralite
efc1536121 fix: Export AttachmentFlags and RoleFlags (#9924)
* fix: export attachment flags

* fix: export `RoleFlags` too
2023-11-05 18:17:44 +00:00
Jiralite
3d5d95775b fix(Action): Conditionally add recipient (#9925)
fix(Action): conditionally add recipient
2023-11-05 18:17:24 +00:00
Jaw0r3k
5dd49339ea chore: run prettier 2023-11-05 19:39:14 +02:00
Jaw0r3k
c08230edc0 types(BaseButtonComponentData): Narrow component type (#9735)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-11-05 19:39:14 +02:00
Jaw0r3k
67dd30a28a feat(Client): add guildAvailable event (#9692)
Co-authored-by: Kyranet <kyradiscord@gmail.com>
2023-11-05 19:39:14 +02:00
Jaw0r3k
2ac8be09a1 feat(Attachment): add flags (#9686)
Co-authored-by: Almeida <almeidx@pm.me>
2023-11-05 19:39:14 +02:00
Jaw0r3k
a222e537c1 feat(Role): add flags (#9694)
Co-authored-by: n1ck_pro <59617443+N1ckPro@users.noreply.github.com>
2023-11-05 19:39:14 +02:00
Jaw0r3k
d0fd79c14a Subject: [PATCH] feat(ClientApplication): Approximate guild count and new
`GET` route (#9713)

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-11-05 19:39:14 +02:00
Jaw0r3k
65bbed8a0f fix(Action): Do not set undefined values (#9755)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-11-05 19:39:14 +02:00
Jaw0r3k
142db0ed8c fix(types): fixed CachedManager constructor arguments in type (#9761) 2023-11-05 19:39:14 +02:00
Jaw0r3k
f217335a9d chore: allow setting activity state (#9743) + (#9742) 2023-11-05 19:39:14 +02:00
brynpttrsn
610bdaa0f1 fix(readme): test badge svg (#9919)
fix test v13 badge
2023-11-04 22:16:38 +00:00
Vlad Frangu
56b481b3e0 fix(Role): calculate position correctly when rawPositions are equal (#9872) 2023-10-09 07:22:55 +00:00
Jaw0r3k
5f6a82d349 feat(StageInstanceManager): add guildScheduledEvent to create() (#9024)
* Update StageInstanceManager.js

* typings

* docs

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-10-03 18:31:19 +00:00
Jaw0r3k
759c0b0d46 feat: support default_thread_rate_limit_per_user in channel creation (#9339)
* feat: support default_thread_rate_limit_per_user in channel creation

* feat: add rawDataTypes

* fix: remove other rawTypes

* chore: missing comma

* types: undo all raw data changes

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-09-20 16:41:34 +00:00
Jaw0r3k
90ca02880a perf: linear speed position getters (#9528)
* perf(Channel): linear speed position getter (#9497)

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

* perf(Role): linear speed position getter

---------

Co-authored-by: kyra <kyradiscord@gmail.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-09-06 10:24:19 +00:00
Elysia
cb11c56a0b feat: user avatar decorations (#9710)
* feat: user avatar decorations

* lint

* Update typings/index.d.ts

Co-authored-by: David Malchin <malchin459@gmail.com>

---------

Co-authored-by: David Malchin <malchin459@gmail.com>
2023-07-15 17:25:14 +00:00
Jiralite
630b9d51ef fix(ChannelUpdate): Check against unknown channels (#9698)
fix(ChannelUpdate): check against unknown channels
2023-07-11 06:32:22 +00:00
Elysia
f9e9843a92 feat: support new username system (#9634)
* feat: support new username system (v13)

* fix(User): check global name in equals

* Update typings/index.d.ts

Co-authored-by: Jaw0r3k <jaworekwiadomosci@gmail.com>

* Update src/util/Util.js

Co-authored-by: Jaw0r3k <jaworekwiadomosci@gmail.com>

* typing

* Update User.js

* Update index.d.ts

* Update User.js

---------

Co-authored-by: Jaw0r3k <jaworekwiadomosci@gmail.com>
2023-07-08 17:01:01 +00:00
Souji
85338ef073 feat(presence): feature parity in image resolve (#9638)
* PR: !9637 for v14
2023-06-14 17:39:22 +00:00
Jiralite
4c072048be chore: Run format script (#9531)
* chore: run Prettier

* ci: ensure this is checked

* chore: requested changes

* style: more changes
2023-05-07 14:39:41 +00:00
Jiralite
24ac27df4d docs: Fix AutoModerationRuleTriggerTypes link (#9530)
docs: fix `AutoModerationRuleTriggerTypes` link
2023-05-07 14:18:11 +00:00
Jaw0r3k
5057f04304 feat: Safety alerts channel and mention raid protection (#9073)
* feat: safety alerts channel and mention raid protection

* feat: add raw types

* Apply suggestions from code review

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

* docs: update guild features

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-05-07 12:44:44 +00:00
Jaw0r3k
c5a42ed5ec feat(GuildAuditLogsEntry): add missing channel property to extra (#9527)
feat(GuildAuditLogsEntry#extra): add missing `channel` property (#9518)

Co-authored-by: Synbulat Biishev <syjalo.dev@gmail.com>
2023-05-07 00:54:06 +00:00
iCrawl
ad57e88744 chore(discord.js): release discord.js@13.16.0 2023-05-06 11:09:51 +02:00
Jiralite
53d347734f fix(Constants): Ordering and missing information (#9500)
fix(Constants): ordering and missing information
2023-05-02 10:44:10 +00:00
Jaw0r3k
21dfac90ac fix: Miscellaneous fixes (#9445)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: kyranet <kyradiscord@gmail.com>
Fix embeds and components (#9437)
fix links and invalid syntax (#9322)
2023-05-01 21:03:19 +02:00
Hampus Kraft
d867936fce feat: update Discord developer documentation links and add new flags (#9473)
- Update developer documentation links in WebSocketShard.js, ActivityFlags.js, Constants.js, and MessageFlags.js
- Add new flags in ApplicationFlags.js, MessageFlags.js, Permissions.js, and SystemChannelFlags.js
- Update typings in index.d.ts for the added flags
2023-04-29 01:15:19 +00:00
Jaw0r3k
3386bab2c0 feat: voice messages (#9444)
* feat: voice messages

* fix: delete unnesseary error
2023-04-23 19:03:29 +00:00
pkdev08
420f379933 feat: add ACTIVE_DEVELOPER user flag (#9428)
* feat: add `ACTIVE_DEVELOPER` user flag

* add trailing comma + typings
2023-04-20 11:34:59 +00:00
Jaw0r3k
4f26ba7c2a feat v13: Support pagination for fetching thread members (#9045)
* feat: support pagnation

* feat: support pagnation

* feat: fix tests

* fix: better fetch

* fix: tests

* Apply suggestions from code review

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

* fix: bad merge

---------

Co-authored-by: Aura Román <kyradiscord@gmail.com>
2023-04-17 13:59:25 +00:00
Ben
71161518ca feat(roleTagData): v13 add guildConnections (#9391)
* feat(roleTagData): add guildConnections

* feat(roleTagData): add guildConnections
2023-04-15 19:44:17 +00:00
Jaw0r3k
28a5c7b125 feat: v13 VIEW_CREATOR_MONETIZATION_ANALYTICS and USE_SOUNDBOARD permissions (#9124)
* feat: view_creator_monetization_analytics perm

* feat: also add USE_SOUNDBOARD
2023-04-14 21:33:56 +00:00
Jaw0r3k
7cf9224c46 feat(StageChannel): v13 support messages (#9145)
Co-authored-by: kyranet <kyradiscord@gmail.com>
2023-04-14 23:32:58 +02:00
Jaw0r3k
add14acc20 feat(AutoModeration): v13 support customMessage (#9173)
* feat: add customMessage

* chore: use main wording
2023-04-13 16:36:46 +00:00
space
5acecf031a chore(discord.js): release discord.js@13.15.1 (#9340) 2023-04-07 13:02:38 +00:00
Jiralite
a8d5325def fix(Message): Fix permissions check in locked threads (#9338)
fix(Message#editable): fix permissions check if channel is thread & locked

Co-authored-by: Erwan <erwan977@gmail.com>
2023-04-07 12:26:16 +00:00
Jiralite
09ca243c2f fix(ClientUser): Fix modifying self (#9318)
fix(ClientUser): fix modifying
2023-04-07 12:25:45 +00:00
Steamed_EGG
8f12054c06 fix: Typo in src/util/MessageFlags.js (#9312) 2023-04-02 12:44:31 +02:00
Jiralite
f79a9b5450 fix(AutocompleteInteraction): Fix responding (#9315) 2023-04-02 12:42:30 +02:00
iCrawl
48f7193ef1 chore: fix changelog 2023-04-02 02:41:39 +02:00
iCrawl
1da4596820 chore: lockfile 2023-04-02 02:38:06 +02:00
iCrawl
3197ad7d1f chore: dont delete gitkeep files 2023-04-02 02:35:41 +02:00
iCrawl
6e11b846bb chore(discord.js): release discord.js@13.15.0 2023-04-02 02:33:26 +02:00
iCrawl
491f268b90 chore: git ignore 2023-04-02 02:25:56 +02:00
Jiralite
a51ddb2b06 chore: Miscellaneous fixes (#9271)
* fix(Message#editable): update editable check in threads locked (#9216)

* fix(Message#editable): update editable check in threads locked

* fix(Message#editable): add check in archived threads

* fix: check manage threads permission only if thread is locked

* fix: adding a full stop at the end of a sentence

Co-authored-by: Jaworek <jaworekwiadomosci@gmail.com>

---------

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

* fix(ThreadManager): Respect `cache` and `force` in fetching (#9239)

* fix(ThreadManager): Respect `cache` and `force` in fetching

* refactor: remove defaults

These are already defaulted down the line.

---------

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

* refactor(FetchThreadsOptions): Remove `active` (#9241)

* refactor(FetchThreadsOptions): remove `active`

* docs(FetchThreadsOptions): update description

---------

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

* docs: add more examples (#9252)

* docs: add more examples

* fix: fix grammar and syntax

Co-authored-by: Jaw0r3k <jaworekwiadomosci@gmail.com>

* chore: fine-tune examples

* chore: replace double quotes with singles

* fix: remove redundant example tag

* fix: fix timeout logging

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

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

---------

Co-authored-by: Jaw0r3k <jaworekwiadomosci@gmail.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* docs(Role): Fix example for `comparePositionTo()`

* docs(FetchArchivedThreadOptions): `before` respects `archive_timestamp`, not creation timestamp (#9240)

docs(FetchArchivedThreadOptions): correct `before` description

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

* fix(snowflake): snowflakes length (#9144)

* fix(snowflake): fix snowflakes length

* fix(snowflake): fix length

* fix(Message): `bulkDeletable` permissions should be retrieved later for DMs (#9146)

* fix(Message): permissions check should be done later

the getter will error if used on a message originating from a DM

* refactor: remove unessercary chaining

* fix: invalid backport

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

* docs(Role): fix comparison example

* fix(ClientUser): no mutation on edit

* refactor: call bans.create directly

* fix(AutocompleteInteraction): Send `name_localizations` correctly (#9238)

fix(AutocompleteInteraction): send locale correctly

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

* fix: resolving string bitfield (#9262)

fix: resolving bitfield

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

* fix: Keep symbols in actions manager (#9293)

fix: keep symbols in actions manager

* fix: add support for new guild feature `GUILD_WEB_PAGE_VANITY_URL` (#9219)

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

* docs: differ `User#send` (#9251)

* docs: differate user#send

* chore: format

* chore: remove some examples

* docs: add GuildMember#send example

---------

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

* docs: describe private properties (#8879)

* feat: describe private properties

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

Co-authored-by: MrMythicalYT <91077061+MrMythicalYT@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: MrMythicalYT <91077061+MrMythicalYT@users.noreply.github.com>

* Apply suggestions from code review

---------

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

---------

Co-authored-by: Erwan <erwan977@gmail.com>
Co-authored-by: Jaworek <jaworekwiadomosci@gmail.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Tetie <tjvssr@gmail.com>
Co-authored-by: DraftMan <contact@draftman.fr>
Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
Co-authored-by: Jaw0r3k <jaw0r3k.g@gmail.com>
Co-authored-by: space <spaceeec@yahoo.com>
Co-authored-by: pkdev08 <54294685+pkdev08@users.noreply.github.com>
Co-authored-by: MrMythicalYT <91077061+MrMythicalYT@users.noreply.github.com>
2023-04-01 23:46:23 +00:00
Jaw0r3k
51c3bf1f54 feat: backport chatInputApplicationCommandMention (#9245)
feat: chatInputApplicationCommandMention formatter
2023-03-25 23:05:00 +00:00
space
b9b037b886 chore(discord.js): release discord.js@13.14.0 (#9227) 2023-03-12 17:47:00 +00:00
MrMythicalYT
af6a0e5d51 fix(ThreadChannel): fetch starter message properly (#9217) 2023-03-12 17:29:13 +00:00
Sammy
e15b70f79a Fix a rare error regarding interactions (#9218) 2023-03-12 17:28:25 +00:00
Vlad Frangu
df68520319 fix(Actions): inject built data by using a symbol (#9204) 2023-03-06 10:31:19 +00:00
Elysia
4bc25c40f5 feat: add support for gif stickers (v13) (#9158)
* update new sticker file type

* update

* lint
2023-03-05 22:43:46 +00:00
Jaworek
120270e8dc feat: v13 support SUPPRESS_NOTIFICATIONS flag (#9184)
feat: add suppress notifications flag
2023-03-03 17:54:54 +00:00
space
9f7d1f3be5 chore(discord.js): release discord.js@13.13.1 (#9156) 2023-02-21 22:54:31 +00:00
Jiralite
224f21c9c0 fix(Constants): enum creation error (#9155)
fix: enum creation error
2023-02-21 22:26:02 +00:00
space
7f1735d50a chore(discord.js): release discord.js@13.13.0 (#9154) 2023-02-21 22:09:52 +00:00
Jaworek
fd494a385e feat(GuildMemberManager): add addRole and removeRole methods (#9108)
* feat: addrole and removerole

* fix: apply suggestions

* Apply suggestions from code review

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

* fix: missdeleted ban :(

---------

Co-authored-by: space <spaceeec@yahoo.com>
2023-02-21 20:14:54 +00:00
ckohen
b586df884b ci: create publish release workflow v13 (#9151) 2023-02-20 20:58:46 +00:00
Jaworek
0188e36283 feat(WebSocketShard): v13 add resume url (#9078)
feat: use resume url
2023-02-17 23:07:47 +00:00
Jaworek
84d34dc258 feat: v13 guildAuditLogEntryCreate event (#9092)
* feat: guildAuditLogEntryCreate event

* Update src/client/actions/GuildAuditLogEntryCreate.js

Co-authored-by: Elysia <71698422+aiko-chan-ai@users.noreply.github.com>

* Update src/client/actions/GuildAuditLogEntryCreate.js

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

---------

Co-authored-by: Elysia <71698422+aiko-chan-ai@users.noreply.github.com>
Co-authored-by: space <spaceeec@yahoo.com>
2023-02-17 23:07:30 +00:00
Jiralite
7737bbe2fe ci: add pull request triage and Kodiak merge workflow (#9109)
* chore: enable kodiak for auto merges

* ci: add pull request triage

* ci: update kentaro-m/auto-assign-action

This supports Node.js 16.

---------

Co-authored-by: iCrawl <buechler.noel@outlook.com>
2023-02-18 00:06:55 +01:00
Jaworek
61fa6f45b4 feat(Constants): add auto moderation events to WSEvents (#9102)
* fix: add automoderation events to WSEvents

* chore: typings :)

* chore: undo unrelated changes

---------

Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
2023-02-17 23:32:53 +01:00
Jiralite
0afa405f5a feat: role subscriptions (#9040)
* feat: add role subscriptions (#8915)

* feat: add role subscriptions

* docs: casing

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

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

* chore: version 13 specific things

---------

Co-authored-by: Almeida <almeidx@pm.me>
2023-02-17 23:12:47 +01:00
Jiralite
eed293f893 fix: minor forums cleanup (#9033)
* docs(GuildChannelResolvable): remove extra `ForumChannel`

* docs: replace `GuildForumThreadChannel`

* docs: `Channel` correct reference

* refactor: move `threadName` to the right method
2023-02-17 23:02:38 +01:00
Jaworek
86329ad66f feat(GuildChannelManager): add addFollower (#9050)
* feat: addFolower method

* Update src/structures/NewsChannel.js

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

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-02-17 22:47:13 +01:00
Jaworek
69d71e967e feat(Guild): add INVITES_DISABLED feature support (#9051)
* feat: disable invites

* Update src/structures/Guild.js

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

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2023-02-17 22:45:10 +01:00
Jaworek
a7dc40f1a8 feat(ClientApplication): add role connections (#9072)
* feat: add add role connections

* feat: add add role connections

* fix: export new class in the index

* Update typings/rawDataTypes.d.ts

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

* chore: invite scope

* docs(ApplicationRoleConnectionMetadata): add docstring for the class

* docs(Constants): fix ApplicationRoleConnectionMetadataTypes jsdoc syntax

---------

Co-authored-by: Aura Román <kyradiscord@gmail.com>
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
2023-02-17 22:44:04 +01:00
Jaworek
32cdaff7eb feat(Webhook): add channel getter (#9074)
* fix: add channel property

* fix: missing new line
2023-02-17 22:25:32 +01:00
Jiralite
123d0f1aca fix(InteractionResponses): spell messages correctly (#9080)
as well as `automatically` in Util.js
2023-02-17 22:21:03 +01:00
Jaworek
d69529e3fe feat(GuildMember): add flags (#9098)
* feat: guildMember flags

* Apply suggestions from code review

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

* Update GuildMember.js

---------

Co-authored-by: Almeida <almeidx@pm.me>
2023-02-17 22:16:49 +01:00
Jaworek
c2968b58f9 feat: applicationCommandPermissionsUpdate event (#9121)
* fix: applicationcommandpermissionupdate

* fix: missing types

* Update index.d.ts
2023-02-17 22:05:19 +01:00
Jaworek
428798374f feat: backport automod (#8886)
Co-authored-by: Aura Román <kyradiscord@gmail.com>
2023-01-13 11:26:32 +01:00
Jiralite
cf3c7a7c54 docs(ThreadEditOptions): Move info tag back to invitable (#9021) 2023-01-12 09:23:46 +01:00
Jiralite
a941cb6ec5 fix(ThreadChannel): reason as second parameter (#9023) 2023-01-10 10:55:21 +01:00
Jiralite
6854df4218 types(ThreadEditOptions): Add appliedTags (#9022) 2023-01-10 10:53:03 +01:00
Jiralite
35f6dadebf types(widget): Add missing name (#9031)
Co-authored-by: Ben <88249114+BenjammingKirby@users.noreply.github.com>
2023-01-10 10:52:12 +01:00
Jiralite
1779e1ba7e docs: Add missing @extends (#9028) 2023-01-10 10:51:10 +01:00
Jaworek
11d010f177 feat v13: add not_found to guildMembersChunk data (#9032) 2023-01-10 10:50:34 +01:00
Jiralite
b01c81dd72 refactor: Move me and add fetchMe() (#9029) 2023-01-10 10:49:43 +01:00
Jiralite
f0d42644df feat(GuildAuditLogs): Support after (#9012) 2023-01-10 10:49:07 +01:00
Jiralite
64575195b5 fix: Import errors correctly (#9030) 2023-01-10 10:46:02 +01:00
iCrawl
5115de9862 chore: add gitkeep files to keep vercel from failing 2023-01-09 18:22:47 +01:00
Elysia
546ac43911 feat: backport guild forum support to v13 (#8651)
Co-authored-by: Jaworek <jaworekwiadomosci@gmail.com>
Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
2023-01-02 16:21:15 +01:00
Voxelli
56e67185fc fix(websocketshard): backport zombie connection fix (#9003) 2023-01-02 15:58:08 +01:00
Jiralite
649058055a types: Swap message reaction and emoji identifier types (#8970)
Co-authored-by: Aura Román <kyradiscord@gmail.com>
2023-01-01 18:28:56 +01:00
Almeida
4ec3355961 fix(Util): flatten ignoring certain fields (v13) (#8936)
Fixes https://github.com/discordjs/discord.js/issues/8929
2022-12-16 14:13:43 +01:00
Synbulat Biishev
ca662b4de8 feat: add Message#bulkDeletable (v13) (#8761) 2022-11-25 18:36:34 +01:00
Raraph84
98846cf863 fix: backport allow deletion of ephemeral messages to v13 (#8811)
Co-authored-by: Noel <buechler.noel@outlook.com>
2022-11-25 18:35:19 +01:00
Jaworek
0e0851aa18 feat(InteractionResponses): add message parameter (v13) (#8838)
Co-authored-by: MrMythicalYT <91077061+MrMythicalYT@users.noreply.github.com>
Co-authored-by: Noel <buechler.noel@outlook.com>
2022-11-25 18:19:25 +01:00
Eejit
eecc50bfda fix(Activity): Fix equals() not checking for differing emoji (v13) (#8842)
Co-authored-by: Jaworek <jaworekwiadomosci@gmail.com>
2022-11-25 18:09:22 +01:00
RedGuy12
caf6f66073 fix(escapeMarkdown): fix double escaping (v13) (#8799) 2022-10-31 19:01:06 +01:00
iCrawl
c312da795e chore: changelog 2022-10-10 19:38:44 +02:00
iCrawl
312923d370 chore(discord.js): release discord.js@13.12.0 2022-10-10 19:36:50 +02:00
RedGuy12
8a6588a132 feat(Util): backport escapeMarkdown PRs to v13 (#8703) 2022-10-10 19:14:36 +02:00
vunsh
ea117bfb7e docs: update UserContextMenu documentation v13 (#8721)
Co-authored-by: A. Román <kyradiscord@gmail.com>
Co-authored-by: Noel <buechler.noel@outlook.com>
2022-10-09 23:05:10 +02:00
iCrawl
8d6a55d2c7 chore(discord.js): release discord.js@13.11.0 2022-09-15 20:44:27 +02:00
iCrawl
5ef30a0173 chore: deps 2022-09-15 20:30:24 +02:00
Almeida
8f94a9ca2f chore: fix typescript tests (v13) (#8628) 2022-09-15 20:21:15 +02:00
Almeida
fcd52d7fc6 docs: update misleading Client#guildMemberAvailable event description (v13) (#8627) 2022-09-15 20:14:15 +02:00
RedGuy12
f4e81330bf types(GuildChannelManager): correct fetch return type (v13) (#8551) 2022-09-13 09:10:47 +02:00
Jeroen Claassens
e6ee7d8374 fix: fixed TS 4.8 compatibility (#8601) 2022-09-08 15:02:25 +02:00
JsCoder2022
56177998c5 add MESSAGE_CONTENT intent (v13) (#8580) 2022-09-02 17:22:59 +02:00
Jiralite
ca68fc3f6b feat(GuildBanManager): Add deleteMessageSeconds (#8575) 2022-09-02 17:22:36 +02:00
iCrawl
a507ed9590 chore(release): discord.js 13.10.3 2022-08-22 11:42:06 +02:00
iCrawl
f0c0166814 chore: deps 2022-08-22 11:38:39 +02:00
Jiralite
10b12ccea6 types: Disallow some channel types from webhook creation (#8535) 2022-08-22 09:46:17 +02:00
Jiralite
526ea74e66 types(ModalMessageModalSubmitInteraction): channelId is not nullable (v13) (#8505)
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
2022-08-17 09:47:31 +02:00
Jiralite
b6f48ec84a Specify time unit in awaitModalSubmit (v13) (#8506)
Co-authored-by: Marcus Otterström <github@otterstrom.dev>
2022-08-17 09:47:19 +02:00
GodderE2D
11d69491e0 docs: fix broken discord support link (#8485) 2022-08-15 15:53:11 +02:00
iCrawl
30e89a401d chore(discord.js): release discord.js@13.10.2 2022-08-10 20:54:17 +02:00
RedGuy12
03c59e3a83 types(Message): correct bulkDelete return type (v13) (#8469) 2022-08-10 20:37:51 +02:00
iCrawl
9ce7e5edcf chore(discord.js): release discord.js@13.10.1 2022-08-10 20:22:28 +02:00
Jiralite
2a46d9f58e fix(ThreadChannel): Handle possibly null parent (v13) (#8467) 2022-08-10 20:17:21 +02:00
iCrawl
78e494b06e chore(discord.js): release discord.js@13.10.0 2022-08-10 19:40:09 +02:00
Jiralite
ae43bca8b0 feat(Guild): Add max_video_channel_users (v13) (#8424) 2022-08-08 11:05:46 +02:00
iCrawl
7321507559 chore(discord.js): release discord.js@13.9.2 2022-07-29 10:55:59 +02:00
Almeida
d0a4199760 fix(MessageMentions): ignoreRepliedUser option in has() (v13) (#8365) 2022-07-29 10:47:13 +02:00
Jiralite
96125079a2 fix(GuildChannelManager): allow unsetting rtcRegion (v13) (#8362)
Co-authored-by: SpaceEEC <24881032+SpaceEEC@users.noreply.github.com>
2022-07-26 09:28:44 +02:00
Jiralite
7b41fb6b5a chore: disable scope-case rule for commitlint (v13) (#8363)
chore: disable scope-case rule for commitlint

Co-Authored-By: Vlad Frangu <kingdgrizzle@gmail.com>

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2022-07-25 19:40:19 +02:00
Jiralite
4f7c1e35c3 fix(ThreadChannel): Omit webhook fetching (v13) (#8352) 2022-07-24 17:26:34 +02:00
iCrawl
622c77ba7a chore(discord.js): release discord.js@13.9.1 2022-07-24 00:12:06 +02:00
pat
be35db2410 refactor(embed): deprecate addField (#8318)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Arjun Sharda <77706434+ArjunSharda@users.noreply.github.com>
Co-authored-by: Almeida <almeidx@pm.me>
2022-07-23 23:39:03 +02:00
Jiralite
e95caa7e45 refactor(Presence): Remove redundant date parsing (v13) (#8341) 2022-07-23 18:21:53 +02:00
iCrawl
5c1e558570 ci: add vercel check deploy branch script 2022-07-20 23:09:40 +02:00
Almeida
4cf05559a2 fix(ApplicationCommandManager): allow passing 0n to defaultMemberPermissions (v13) (#8312) 2022-07-20 20:12:28 +02:00
iCrawl
d9432aba71 ci: correct path to docs.json 2022-07-18 17:58:32 +02:00
iCrawl
f2a6f9fc1d ci: remove build step 2022-07-18 17:55:37 +02:00
iCrawl
da3d4873a7 ci: fix documentation deployment for v13 2022-07-18 17:53:35 +02:00
iCrawl
64928abb9e chore(discord.js): release discord.js@13.9.0 2022-07-17 19:39:23 +02:00
iCrawl
7b7cc1c6cb chore: deps 2022-07-17 19:38:43 +02:00
Cinnamon
00a705707e docs: add new HTTP Error Codes 50068 (v13) (#8273) 2022-07-17 19:10:43 +02:00
BattleEye
4d86cf4ce0 fix(PermissionOverwriteManager): mutates user (#8282)
Fix PermissionOverwriteManager changing userOrRole

Since it's mutated the original Member object won't be passed to upset and will be seen as invalid if User cache is disabled.

Functions normally even with User cache disabled after the fix.
2022-07-17 19:10:03 +02:00
Jiralite
beb3d8ec26 fix(GuildChannelManager): Access resolveId correctly (v13) (#8297) 2022-07-17 18:51:39 +02:00
muchnameless
8fe166dcfd fix(GuildChannelManager): edit lockPermissions (#8267) 2022-07-12 22:34:40 +02:00
Cinnamon
9cc336c43b docs: Add MessageActivityType (v13) (#8257) 2022-07-09 19:42:43 +02:00
MateoDeveloper
a93f4b1ba2 feat(ApplicationCommand): add min_length and max_length for string option (v13) (#8217) 2022-07-06 20:39:55 +02:00
Almeida
f457cdd2de fix(applicationcommandmanager): explicitly allow passing builders to methods (v13) (#8229) 2022-07-05 11:12:13 +02:00
Vlad Frangu
f704b261c0 fix: pass in the expected query object type for application commands (#8189) 2022-07-03 18:04:44 +02:00
Jiralite
631abee693 types(GuildMemberManager): Non-void return of edit() (v13) (#8187) 2022-07-03 18:04:35 +02:00
Superchupu
feb8e30d2e docs(MessageInteraction): update commandName description (v13) (#8220) 2022-07-03 15:43:10 +02:00
Jiralite
4063b90cef fix: Use non-global flag whilst resolving regular expressions (#8178)
fix(DataResolver): remove global flag on resolving
2022-06-30 00:39:48 +02:00
KinectTheUnknown
0e0f784447 fix(GuildStickerManager.fetchUser): Changed guildId to guild.id (#8176)
fix(GuildStickerManager.fetchUser): guildId to guild.id
2022-06-30 00:39:28 +02:00
Almeida
e8d72c7245 fix(guildmemberremove): remove member's presence for v13 (#8182)
Backports #8181
2022-06-30 00:38:08 +02:00
Almeida
4ae08ad9ef docs(constants): document missing constants (#8168) 2022-06-30 00:37:21 +02:00
Almeida
222fc9c679 feat(interaction): add appPermissions (v13) (#8195) 2022-06-30 00:36:07 +02:00
Almeida
079973f1cf types: add missing shard types (v13) (#8192) 2022-06-30 00:35:51 +02:00
Almeida
125696fc79 feat: partially backport perms v2 for v13 (#8162) 2022-06-24 00:05:11 +02:00
DD
c198e893c9 fix(WebSocketShard): backport error handler preservation on connections (#8164) 2022-06-23 21:13:33 +02:00
iCrawl
7e1904c2ad chore(release): version 2022-06-23 17:38:54 +02:00
Jiralite
c61fc8082a fix(VoiceChannel): NSFW property (v13) (#8161)
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
Co-authored-by: pat <73502164+nyapat@users.noreply.github.com>
2022-06-23 14:51:42 +02:00
Jiralite
65444f510d docs: TextBasedChannel-> TextBasedChannels typos (v13) (#8155) 2022-06-23 12:37:28 +02:00
KinectTheUnknown
70450f6873 typings(Shard#reconnecting): Backport to v13 - Fix event name (#8126) 2022-06-20 14:47:54 +02:00
Superchupu
3638b4021a refactor: deprecate $ prefix from ws.properties keys (#8095) 2022-06-17 23:26:57 +02:00
MateoDeveloper
0ab2227984 fix(ModalSubmitInteraction): add isFromMessage() missing method (#8092) 2022-06-15 01:02:03 +02:00
Voxelli
afb18b99b7 fix: destroy options during cleanup (#8082) 2022-06-13 20:03:56 +02:00
Rodry
613fd43fcf types(AutocompleteOption): backport fix and improve types (#8078) 2022-06-13 20:03:39 +02:00
Jiralite
3095f350e0 fix(AuditLog): default changes to empty array (#8076) 2022-06-13 20:03:22 +02:00
Synbulat Biishev
0d0190a6fd types(GuildChannel): fix type of .isText() method (#8061) 2022-06-13 20:03:04 +02:00
iCrawl
8f6df90035 chore(release): version 2022-06-05 19:28:12 +02:00
Almeida
876816ab2a fix(guildchannelmanager): wrong parameter in _sortedChannels call (#8011) 2022-06-05 19:17:38 +02:00
iCrawl
a8f2b2cfb4 chore: deps 2022-06-05 19:07:36 +02:00
Suneet Tipirneni
ddfe15b872 feat: backport text-in-voice support to v13 (#7999)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2022-06-05 18:30:48 +02:00
Voxelli
114bcc07a9 fix(websocketshard): deal with zombie connection caused by 4009 (#7581)
Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: Vitor <milagre.vitor@gmail.com>
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Parbez <imranbarbhuiya.fsd@gmail.com>
2022-06-05 09:38:31 +02:00
Josh Wee
76df9fdc45 fix: video quality mode data property (#7946) 2022-06-05 09:36:07 +02:00
GrapeColor
a51420f7f8 fix(ApplicationCommandOptionType): Add attachment to jsdoc (#7952)
Co-authored-by: GrapeColor <grapecolor@users.noreply.github.com>
2022-06-05 09:35:36 +02:00
iCrawl
e3cbd45e7d chore: release 2022-05-13 11:49:56 +02:00
Synbulat Biishev
ea28638a0c fix(MessageEmbed): fix a typo (#7906) 2022-05-12 10:24:54 +02:00
Almeida
43a7870b23 docs(shardingmanager): fix type of execArgv option (v13) (#7863) 2022-05-02 09:38:11 +02:00
Hyro
6dcf0bda05 docs: fix and improve localization docs (v13 backport) (#7807) 2022-04-21 19:06:28 +02:00
Almeida
816936eafb fix(GuildEditData): some fields can be null for v13 (#7633)
* fix(GuildEditData): some fields can be null for v13

* fix: make even more things nullable
2022-04-19 16:01:59 +02:00
Sasial
1d09ad4652 types: fix ModalSubmitInteraction (#7768) 2022-04-19 15:59:58 +02:00
Jiralite
5165b18b85 feat: backport (#7776) 2022-04-19 15:59:05 +02:00
Rodry
7afcd9594a types(threadchannel): fix autoArchiveDuration types (#7817) 2022-04-19 15:54:39 +02:00
Jiralite
b9802f4b6f refactor: deprecate v13 properties and methods (#7782)
* refactor: deprecate splitting

* refactor: deprecate `IntegrationApplication#summary`

https://github.com/discordjs/discord.js/pull/7729

* docs: amend store channel wording

* refactor: deprecate fetching of application assets

* docs: deprecate vip field in voice regions
2022-04-17 10:52:50 +02:00
Jiralite
1040ce0e71 docs(ApplicationCommand): Fix ApplicationCommandOptionChoice (#7798) 2022-04-17 10:47:34 +02:00
Jiralite
3eb45e30b3 feat: backport (#7787) 2022-04-14 12:48:31 +02:00
Jiralite
ab324ea6ae feat: backport (#7786) 2022-04-14 12:48:10 +02:00
Hyro
022e138b9a feat: add support for localized slash commands (v13 backport) (#7766) 2022-04-14 12:47:46 +02:00
Superchupu
9e4a900e6d feat: app authorization links and tags for v13 (#7731) 2022-04-14 12:47:11 +02:00
Jiralite
6c5613255a feat: backport (#7777) 2022-04-14 12:45:54 +02:00
Jiralite
ff49b82db7 feat: backport (#7778) 2022-04-14 12:45:35 +02:00
Jiralite
ae7f991e8d feat: backport (#7779) 2022-04-14 12:45:16 +02:00
Jiralite
cedc333940 feat: backport (#7783) 2022-04-14 12:44:24 +02:00
Jiralite
6daee1b235 feat(VoiceChannel): Support video_quality_mode (v13) (#7785) 2022-04-14 12:43:25 +02:00
Jiralite
68498a87be feat(StageInstance): add support for associated guild event (#7713) 2022-04-12 17:19:59 +02:00
Jiralite
ab6c2bad84 fix: apply v14 fix (#7756) 2022-04-12 17:11:57 +02:00
Almeida
c9e4562fd5 fix(GuildChannelManager): delete method accessing wrong id (#7771) 2022-04-12 17:08:57 +02:00
Ryan Munro
e1cdcfa9a6 feat(modals): modals, input text components and modal submits, v13 style (#7431) 2022-04-09 11:36:49 +02:00
Jiralite
5e8162a137 feat: Backport Interaction#isRepliable (#7563) 2022-04-09 11:36:15 +02:00
Rodry
9f09702854 feat: add methods to managers for v13 (#7611) 2022-04-09 11:35:17 +02:00
Jiralite
8e7d15e49d feat: Add premiumSubscriptionCount to InviteGuild (#7629) 2022-04-09 11:34:24 +02:00
Jiralite
b9c5676006 refactor: remove non-breaking stuff (#7636) 2022-04-09 11:33:44 +02:00
Almeida
dfea9c27ce fix(GuildScheduledEvent): handle missing image for v13 (#7627) 2022-03-24 20:59:19 +01:00
Jiralite
78140748ce types(InteractionCollector): Fix guild and channel types (#7624) 2022-03-10 09:00:58 +01:00
Ben
a7535a2232 feat(scheduledevents): Event cover images for v13 (#7613)
Co-authored-by: Suneet Tipirneni <77477100+suneettipirneni@users.noreply.github.com>
2022-03-07 19:26:57 +01:00
Rodry
7a52785f7d fix(messagementions): fix has method for v13 (#7591)
Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: Synbulat Biishev <syjalo.dev@gmail.com>
2022-03-06 16:26:57 +01:00
Ben
13dd82d7fa fix: check if member has admininistrator on moderatable (v13) (#7578) 2022-03-02 10:38:04 +01:00
Jiralite
93cdb2f2fa feat: Backport MessageMentions channel type fixes (#7562) 2022-03-02 10:32:57 +01:00
Jiralite
611d3a7b2f feat: Backport cache types resolving to never (#7561) 2022-03-02 10:32:46 +01:00
Jiralite
29d42ed319 feat: Backport sending message flags (#7560) 2022-03-02 10:32:36 +01:00
Jiralite
1d97dcff08 feat(ThreadChannel): Backport creation timestamp (#7559) 2022-03-02 10:32:25 +01:00
Jiralite
679b87c4f8 feat: Add custom image support to version 13 (#7557) 2022-03-02 10:32:13 +01:00
Jiralite
b231bece0e feat: Backport reason on pin and unpin (#7556) 2022-03-02 10:32:03 +01:00
Jiralite
49397c0ca4 fix(ThreadChannel): Require sendable for unarchivable (#7555) 2022-03-02 10:31:51 +01:00
Jiralite
215dfe02d5 feat(GuildPreview): Add stickers to version 13 (#7554) 2022-03-02 10:31:41 +01:00
Jiralite
69ba067a65 docs: Backport version 13 fixes (#7552)
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
2022-03-02 10:31:28 +01:00
Jiralite
5f621c1995 fix: Backport MessageReaction#me being incorrectly false (#7553) 2022-03-02 10:30:13 +01:00
Jiralite
ee1698d928 feat: Backport sweepStickers method (#7558) 2022-03-02 10:29:59 +01:00
Ben
2fcf8af421 feat(scheduledevents): add image option (v13) (#7549) 2022-02-26 11:14:48 +01:00
EhsanFox
f0960698d2 fix(typings): sweepStageInstances typo (#7521) 2022-02-23 08:39:05 +01:00
ckohen
30baff7ecb fix(MessagePayload): v13 don't set reply flags to target flags (#7515) 2022-02-23 08:37:59 +01:00
Jiralite
2b3db734df feat(thread): v13 add newlyCreated to threadCreate event (#7481) 2022-02-20 13:42:23 +01:00
Jiralite
0b54089c43 types: V13 channel create overloads fix (#7480) 2022-02-20 13:39:20 +01:00
Jiralite
77b8e01911 fix(Shard): V13 EventEmitter listener warning (#7479) 2022-02-17 17:46:06 +01:00
Parbez
bc5ddc36fa fix(MessageEmbed): set footer to undefined (#7358) 2022-02-13 12:44:16 +01:00
Ryan Munro
5bcca8b97f feat(commands): attachment options (#7441) 2022-02-13 12:41:41 +01:00
iCrawl
988a51b764 chore(release): version 2022-01-13 18:24:17 +01:00
Rodry
1f4e633ce3 docs(interaction): add locale list link (#7261) 2022-01-13 18:20:35 +01:00
Suneet Tipirneni
233084a601 feat: add Locales to Interactions (#7131)
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
2022-01-13 18:18:02 +01:00
iCrawl
ac8c122c2a chore(release): version 2022-01-07 23:57:17 +01:00
ckohen
2dabd82e26 fix(sweepers): provide default for object param (#7182) 2022-01-07 23:53:27 +01:00
1040 changed files with 41215 additions and 78577 deletions

View File

@@ -1,6 +1,5 @@
{
"name": "discord.js",
"monoRepo": true,
"packagePath": "packages/discord.js",
"packagePath": ".",
"tagTemplate": "{{new-version}}"
}

View File

@@ -1,11 +1,11 @@
{
"extends": ["@commitlint/config-angular"],
"rules": {
"type-enum": [
2,
"always",
["chore", "build", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test", "types", "typings"]
],
"scope-case": [0]
}
"extends": ["@commitlint/config-angular"],
"rules": {
"type-enum": [
2,
"always",
["chore", "build", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test", "types", "typings"]
],
"scope-case": [0]
}
}

View File

@@ -1,38 +0,0 @@
# Packages
node_modules/
# Log files
logs/
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
# Env
.env
# Dist
dist/
# Miscellaneous
.tmp/
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
.idea/
.DS_Store
.turbo
tsconfig.tsbuildinfo
# yarn
.pnp.*
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

View File

@@ -1,14 +1,200 @@
{
"root": true,
"extends": ["neon/common", "neon/node", "neon/typescript", "neon/prettier"],
"parserOptions": {
"project": "./tsconfig.eslint.json"
},
"rules": {
"@typescript-eslint/consistent-type-definitions": ["error", "interface"]
},
"ignorePatterns": ["**/dist/*"],
"env": {
"jest": true
}
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"plugins": ["import"],
"parserOptions": {
"ecmaVersion": 2021
},
"env": {
"es2021": true,
"node": true
},
"rules": {
"import/order": [
"error",
{
"groups": ["builtin", "external", "internal", "index", "sibling", "parent"],
"alphabetize": {
"order": "asc"
}
}
],
"prettier/prettier": [
2,
{
"printWidth": 120,
"singleQuote": true,
"quoteProps": "as-needed",
"trailingComma": "all",
"endOfLine": "lf",
"arrowParens": "avoid"
}
],
"strict": ["error", "global"],
"no-await-in-loop": "warn",
"no-compare-neg-zero": "error",
"no-template-curly-in-string": "error",
"no-unsafe-negation": "error",
"valid-jsdoc": [
"error",
{
"requireReturn": false,
"requireReturnDescription": false,
"prefer": {
"return": "returns",
"arg": "param"
},
"preferType": {
"String": "string",
"Number": "number",
"Boolean": "boolean",
"Symbol": "symbol",
"object": "Object",
"function": "Function",
"array": "Array",
"date": "Date",
"error": "Error",
"null": "void"
}
}
],
"accessor-pairs": "warn",
"array-callback-return": "error",
"consistent-return": "error",
"curly": ["error", "multi-line", "consistent"],
"dot-location": ["error", "property"],
"dot-notation": "error",
"eqeqeq": "error",
"no-empty-function": "error",
"no-floating-decimal": "error",
"no-implied-eval": "error",
"no-invalid-this": "error",
"no-lone-blocks": "error",
"no-multi-spaces": "error",
"no-new-func": "error",
"no-new-wrappers": "error",
"no-new": "error",
"no-octal-escape": "error",
"no-return-assign": "error",
"no-return-await": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-throw-literal": "error",
"no-unmodified-loop-condition": "error",
"no-unused-expressions": "error",
"no-useless-call": "error",
"no-useless-concat": "error",
"no-useless-escape": "error",
"no-useless-return": "error",
"no-void": "error",
"no-warning-comments": "warn",
"prefer-promise-reject-errors": "error",
"require-await": "warn",
"wrap-iife": "error",
"yoda": "error",
"no-label-var": "error",
"no-shadow": "error",
"no-undef-init": "error",
"callback-return": "error",
"getter-return": "off",
"handle-callback-err": "error",
"no-mixed-requires": "error",
"no-new-require": "error",
"no-path-concat": "error",
"array-bracket-spacing": "error",
"block-spacing": "error",
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"capitalized-comments": ["error", "always", { "ignoreConsecutiveComments": true }],
"comma-dangle": ["error", "always-multiline"],
"comma-spacing": "error",
"comma-style": "error",
"computed-property-spacing": "error",
"consistent-this": ["error", "$this"],
"eol-last": "error",
"func-names": "error",
"func-name-matching": "error",
"func-style": ["error", "declaration", { "allowArrowFunctions": true }],
"key-spacing": "error",
"keyword-spacing": "error",
"max-depth": "error",
"max-len": ["error", 120, 2],
"max-nested-callbacks": ["error", { "max": 4 }],
"max-statements-per-line": ["error", { "max": 2 }],
"new-cap": "off",
"newline-per-chained-call": ["error", { "ignoreChainWithDepth": 3 }],
"no-array-constructor": "error",
"no-inline-comments": "error",
"no-lonely-if": "error",
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1, "maxBOF": 0 }],
"no-new-object": "error",
"no-spaced-func": "error",
"no-trailing-spaces": "error",
"no-unneeded-ternary": "error",
"no-whitespace-before-property": "error",
"nonblock-statement-body-position": "error",
"object-curly-spacing": ["error", "always"],
"operator-assignment": "error",
"padded-blocks": ["error", "never"],
"quote-props": ["error", "as-needed"],
"quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
"semi-spacing": "error",
"semi": "error",
"space-before-blocks": "error",
"space-before-function-paren": [
"error",
{
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}
],
"space-in-parens": "error",
"space-infix-ops": "error",
"space-unary-ops": "error",
"spaced-comment": "error",
"template-tag-spacing": "error",
"unicode-bom": "error",
"arrow-body-style": "error",
"arrow-parens": ["error", "as-needed"],
"arrow-spacing": "error",
"no-duplicate-imports": "error",
"no-useless-computed-key": "error",
"no-useless-constructor": "error",
"prefer-arrow-callback": "error",
"prefer-numeric-literals": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"rest-spread-spacing": "error",
"template-curly-spacing": "error",
"yield-star-spacing": "error",
"no-restricted-globals": [
"error",
{
"name": "Buffer",
"message": "Import Buffer from `node:buffer` instead"
},
{
"name": "process",
"message": "Import process from `node:process` instead"
},
{
"name": "setTimeout",
"message": "Import setTimeout from `node:timers` instead"
},
{
"name": "setInterval",
"message": "Import setInterval from `node:timers` instead"
},
{
"name": "setImmediate",
"message": "Import setImmediate from `node:timers` instead"
}
]
}
}

View File

@@ -68,7 +68,7 @@ Other prefixes are up to your discretion. Suggested prefixes are `docs`, `chore`
### Scope
The scope could be anything specifying the place of the commit change. For example `GuildMember`, `Guild`, `Message`, `TextChannel` etc...
The scope could be anything specifying the place of the commit change. For example `GuildMember`, `Guild`, `Message`, `MessageEmbed` etc...
### Subject

View File

@@ -11,19 +11,7 @@ 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
4. Code your heart out!
5. Run `yarn 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))
## Adding new packages
If you'd like to create another package under the `@discordjs` organization run the following command:
```bash
yarn 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.
2. Run `npm ci`
3. Code your heart out!
4. Run `npm test` to run ESLint and ensure any JSDoc changes are valid
5. [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))

View File

@@ -1,26 +1,12 @@
name: Bug report
description: Report incorrect or unexpected behavior of a package
description: Report incorrect or unexpected behavior of discord.js
labels: [bug, need repro]
body:
- type: markdown
attributes:
value: |
Use Discord for questions: https://discord.gg/djs
- type: dropdown
id: package
attributes:
label: Which package is this bug report for?
options:
- discord.js
- builders
- collection
- rest
- proxy
- proxy-container
- voice
- ws
validations:
required: true
If you are reporting a voice issue, please post your issue at https://github.com/discordjs/voice/issues
- type: textarea
id: description
attributes:
@@ -44,16 +30,28 @@ body:
description: Include a reproducible, minimal code sample. This will be automatically formatted into code, so no need for backticks.
render: typescript
placeholder: |
Your code sample should be...
... Minimal - Use as little code as possible that still produces the same problem (and is understandable)
... Complete - Provide all parts someone else needs to reproduce your problem
... Reproducible - Test the code you're about to provide to make sure it reproduces the problem
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'ping') {
await interaction.reply('Pong!');
}
});
client.login('token');
- type: input
id: djs-version
attributes:
label: Package version
description: Which version of the package are you using? Run `npm list <package>` in your project directory and paste the output.
placeholder: We no longer support version 12 or earlier of discord.js
label: discord.js version
description: Which version of discord.js are you using? Run `npm list discord.js` in your project directory and paste the output.
placeholder: 13.x.x (we no longer support version 12 or earlier)
validations:
required: true
- type: input
@@ -63,7 +61,7 @@ body:
description: |
Which version of Node.js are you using? Run `node --version` in your project directory and paste the output.
If you are using TypeScript, please include its version (`npm list typescript`) as well.
placeholder: Node.js version 16.9+ is required for version 14.0.0+
placeholder: Node.js version 16.6+ is required for version 13.0.0+
validations:
required: true
- type: input
@@ -91,15 +89,13 @@ body:
Tip: you can select multiple items
options:
- Not applicable (subpackage bug)
- No Partials
- User
- Channel
- GuildMember
- Message
- Reaction
- GuildScheduledEvent
- ThreadMember
- USER
- CHANNEL
- GUILD_MEMBER
- MESSAGE
- REACTION
- GUILD_SCHEDULED_EVENT
multiple: true
validations:
required: true
@@ -108,29 +104,26 @@ body:
attributes:
label: Which gateway intents are you subscribing to?
description: |
Check your Client constructor options for the `intents` key.
Check your Client constructor for the `intents` key.
Tip: you can select multiple items
options:
- Not applicable (subpackage bug)
- No Intents
- Guilds
- GuildMembers
- GuildBans
- GuildEmojisAndStickers
- GuildIntegrations
- GuildWebhooks
- GuildInvites
- GuildVoiceStates
- GuildPresences
- GuildMessages
- GuildMessageReactions
- GuildMessageTyping
- DirectMessages
- DirectMessageReactions
- DirectMessageTyping
- MessageContent
- GuildScheduledEvents
- GUILDS
- GUILD_MEMBERS
- GUILD_BANS
- GUILD_EMOJIS_AND_STICKERS
- GUILD_INTEGRATIONS
- GUILD_WEBHOOKS
- GUILD_INVITES
- GUILD_VOICE_STATES
- GUILD_PRESENCES
- GUILD_MESSAGES
- GUILD_MESSAGE_REACTIONS
- GUILD_MESSAGE_TYPING
- DIRECT_MESSAGES
- DIRECT_MESSAGE_REACTIONS
- DIRECT_MESSAGE_TYPING
- GUILD_SCHEDULED_EVENTS
multiple: true
validations:
required: true
@@ -138,8 +131,8 @@ body:
id: dev-release
attributes:
label: I have tested this issue on a development release
placeholder: d23280c (commit hash)
placeholder: d23280c
description: |
The issue might already be fixed in a development release or main. This is not required, but helps us greatly.
[discord.js only] To install the latest development release run `npm i discord.js@dev` in your project directory.
The issue might already be fixed in a development release. This is not required, but helps us greatly.
To install the latest development release run `npm i discord.js@dev` in your project directory.
Run `npm list discord.js` and use the last part of the printed information (`d23280c` for `discord.js@xx.x.x-dev.1530234593.d23280c`)

View File

@@ -1,28 +1,13 @@
name: Feature request
description: Request a new feature (discord.js accepts documented features of the official Discord developer API only!)
description: Request a new feature (documented features of the official Discord developer API only!)
labels: [feature request]
body:
- type: markdown
attributes:
value: |
We can only implement features that Discord publishes, documents, and merges into the Discord API documentation.
We can only implement features that Discord publishes, documents and merges into the Discord API documentation.
We do not implement unreleased features.
Use Discord for questions: https://discord.gg/djs
- type: dropdown
id: package
attributes:
label: Which package is the feature request for?
options:
- discord.js
- builders
- collection
- rest
- proxy
- proxy-container
- voice
- ws
validations:
required: true
- type: textarea
id: description
attributes:

View File

@@ -1,5 +1,7 @@
**Please describe the changes this PR makes and why it should be merged:**
**Status and versioning classification:**
<!--

13
.github/check_deploy_branch.sh vendored Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
git diff HEAD^ HEAD --quiet .
if [[ "$VERCEL_GIT_COMMIT_REF" == "main" && $? -eq 1 ]]; then
# Proceed with the build
echo "✅ - Proceed"
exit 1;
else
# Don't build
echo "🛑 - Build cancelled"
exit 0;
fi

52
.github/labeler.yml vendored
View File

@@ -1,39 +1,15 @@
packages:builders:
- packages/builders/*
- packages/builders/**/*
packages:collection:
- packages/collection/*
- packages/collection/**/*
apps:guide:
- apps/guide/*
- apps/guide/**/*
apps:website:
- apps/website/*
- apps/website/**/*
packages:discord.js:
- packages/discord.js/*
- packages/discord.js/**/*
packages:docgen:
- packages/docgen/*
- packages/docgen/**/*
packages:guide:
- packages/guide/*
- packages/guide/**/*
packages:proxy:
- packages/proxy/*
- packages/proxy/**/*
packages:proxy-container:
- packages/proxy-container/*
- packages/proxy-container/**/*
packages:rest:
- packages/rest/*
- packages/rest/**/*
packages:util:
- packages/util/*
- packages/util/**/*
packages:voice:
- packages/voice/*
- packages/voice/**/*
packages:website:
- packages/website/*
- packages/website/**/*
packages/web-components:
- packages:web-components/*
- packages:web-components/**/*
packages:ws:
- packages/ws/*
- packages/ws/**/*
- scripts/*
- scripts/**/*
- src/*
- src/**/*
- test/*
- test/**/*
- typings/*
- typings/**/*

180
.github/labels.yml vendored
View File

@@ -1,108 +1,80 @@
- name: api changes
- name: 'api changes'
color: '5663e9'
- name: api support
- name: 'api support'
color: '5663e9'
- name: backlog
color: 7ef7ef
- name: blocked
color: fc1423
- name: bug
color: d73a4a
- name: caching
color: 80c042
- name: chore
color: ffffff
- name: ci
color: 0075ca
- name: dependencies
color: 276bd1
- name: discussion
color: b6b1f9
- name: discord
- name: 'backlog'
color: '7ef7ef'
- name: 'bug'
color: 'd73a4a'
- name: 'caching'
color: '80c042'
- name: 'chore'
color: 'ffffff'
- name: 'ci'
color: '0075ca'
- name: 'dependencies'
color: '276bd1'
- name: 'discussion'
color: 'b6b1f9'
- name: 'discord'
color: '5663e9'
- name: documentation
color: 0075ca
- name: duplicate
color: cfd3d7
- name: error handling
color: 80c042
- name: feature request
color: fcf95a
- name: gateway
color: 80c042
- name: good first issue
color: 7057ff
- name: has PR
color: 4b1f8e
- name: help wanted
- name: 'documentation'
color: '0075ca'
- name: 'duplicate'
color: 'cfd3d7'
- name: 'error handling'
color: '80c042'
- name: 'feature request'
color: 'fcf95a'
- name: 'gateway'
color: '80c042'
- name: 'good first issue'
color: '7057ff'
- name: 'has PR'
color: '4b1f8e'
- name: 'help wanted'
color: '008672'
- name: interactions
color: 80c042
- name: in progress
color: ffccd7
- name: in review
color: aed5fc
- name: invalid
color: e4e669
- name: need repro
color: c66037
- name: packages:builders
color: fbca04
- name: packages:collection
color: fbca04
- name: packages:discord.js
color: fbca04
- name: packages:docgen
color: fbca04
- name: packages:guide
color: fbca04
- name: packages:proxy
color: fbca04
- name: packages:proxy-container
color: fbca04
- name: packages:rest
color: fbca04
- name: packages:util
color: fbca04
- name: packages:voice
color: fbca04
- name: packages:website
color: fbca04
- name: packages:web-components
color: fbca04
- name: packages:ws
color: fbca04
- name: performance
color: 80c042
- name: permissions
color: 80c042
- name: priority:high
color: fc1423
- name: question (please use Discord instead)
color: d876e3
- name: ratelimits
color: 80c042
- name: refactor
color: 1d637f
- name: regression
color: ea8785
- name: REST
color: 80c042
- name: semver:major
color: c10f47
- name: semver:minor
color: e4f486
- name: semver:patch
color: e8be8b
- name: sharding
color: 80c042
- name: tests
color: f06dff
- name: threads
color: 80c042
- name: typings
color: 80c042
- name: utility
color: 80c042
- name: wontfix
color: ffffff
- name: 'interactions'
color: '80c042'
- name: 'in progress'
color: 'ffccd7'
- name: 'in review'
color: 'aed5fc'
- name: 'invalid'
color: 'e4e669'
- name: 'need repro'
color: 'c66037'
- name: 'performance'
color: '80c042'
- name: 'permissions'
color: '80c042'
- name: 'priority:high'
color: 'fc1423'
- name: 'question (please use Discord instead)'
color: 'd876e3'
- name: 'ratelimits'
color: '80c042'
- name: 'refactor'
color: '1d637f'
- name: 'regression'
color: 'ea8785'
- name: 'REST'
color: '80c042'
- name: 'semver:major'
color: 'c10f47'
- name: 'semver:minor'
color: 'e4f486'
- name: 'semver:patch'
color: 'e8be8b'
- name: 'sharding'
color: '80c042'
- name: 'tests'
color: 'f06dff'
- name: 'threads'
color: '80c042'
- name: 'typings'
color: '80c042'
- name: 'utility'
color: '80c042'
- name: 'wontfix'
color: 'ffffff'

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.2 KiB

32
.github/tsc.json vendored
View File

@@ -1,18 +1,18 @@
{
"problemMatcher": [
{
"owner": "tsc",
"pattern": [
{
"regexp": "^(?:\\s+\\d+\\>)?([^\\s].*)\\((\\d+),(\\d+)\\)\\s*:\\s+(error|warning|info)\\s+(\\w{1,2}\\d+)\\s*:\\s*(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"code": 5,
"message": 6
}
]
}
]
"problemMatcher": [
{
"owner": "tsc",
"pattern": [
{
"regexp": "^(?:\\s+\\d+\\>)?([^\\s].*)\\((\\d+),(\\d+)\\)\\s*:\\s+(error|warning|info)\\s+(\\w{1,2}\\d+)\\s*:\\s*(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"code": 5,
"message": 6
}
]
}
]
}

26
.github/workflows/auto-deprecate.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: npm auto deprecate
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * *'
jobs:
auto-deprecate:
name: npm auto deprecate
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Node v16
uses: actions/setup-node@v2
with:
node-version: 16
cache: npm
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Deprecate versions
run: 'npm exec --no npm-deprecate -- --name "*dev*" --package "discord.js"'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

View File

@@ -2,7 +2,8 @@ name: Documentation
on:
push:
branches:
- 'main'
- 'v13'
- '!docs'
tags:
- '**'
workflow_dispatch:
@@ -10,24 +11,15 @@ on:
ref:
description: 'The branch, tag or SHA to checkout'
required: true
ref_type:
type: choice
description: 'Branch or tag'
options:
- branch
- tag
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build documentation
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
if: github.repository_owner == 'discordjs'
outputs:
BRANCH_NAME: ${{ steps.env.outputs.BRANCH_NAME }}
BRANCH_OR_TAG: ${{ steps.env.outputs.BRANCH_OR_TAG }}
SHA: ${{ steps.env.outputs.SHA }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
@@ -38,43 +30,36 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install dependencies
run: yarn --immutable
- name: Build dependencies
run: yarn build
run: npm ci
- name: Build docs
run: yarn docs
run: npm run docs
- name: Upload docgen artifacts
uses: actions/upload-artifact@v3
with:
name: docgen
path: packages/*/docs/docs.json
path: docs/docs.json
- name: Upload api-extractor artifacts
uses: actions/upload-artifact@v3
with:
name: api-extractor
path: packages/*/docs/docs.api.json
- name: Set outputs for upload job
id: env
run: |
echo "::set-output name=BRANCH_NAME::${GITHUB_REF_NAME}"
echo "::set-output name=BRANCH_OR_TAG::${GITHUB_REF_TYPE}"
echo "::set-output name=SHA::${GITHUB_SHA}"
upload:
name: Upload Documentation
needs: build
strategy:
max-parallel: 1
fail-fast: false
matrix:
package: ['builders', 'collection', 'discord.js', 'proxy', 'rest', 'util', 'voice', 'ws']
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
BRANCH_NAME: ${{ github.event.inputs.ref || needs.build.outputs.BRANCH_NAME }}
BRANCH_OR_TAG: ${{ github.event.inputs.ref_type || needs.build.outputs.BRANCH_OR_TAG }}
BRANCH_OR_TAG: ${{ needs.build.outputs.BRANCH_OR_TAG }}
SHA: ${{ needs.build.outputs.SHA }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
@@ -83,13 +68,11 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install dependencies
run: yarn --immutable
- name: Build actions
run: yarn workspace @discordjs/actions build
run: npm ci
- name: Download docgen artifacts
uses: actions/download-artifact@v3
@@ -97,12 +80,6 @@ jobs:
name: docgen
path: docs
- name: Download api-extractor artifacts
uses: actions/download-artifact@v3
with:
name: api-extractor
path: docs
- name: Checkout docs repository
uses: actions/checkout@v3
with:
@@ -110,39 +87,10 @@ jobs:
token: ${{ secrets.DJS_DOCS }}
path: 'out'
- name: Extract package and semver from tag
if: ${{ env.GITHUB_REF_TYPE == 'tag' }}
id: extract-tag
uses: ./packages/actions/src/formatTag
with:
tag: ${{ env.GITHUB_REF_NAME }}
- name: Move docs to correct directory
if: ${{ env.GITHUB_REF_TYPE == 'tag' && matrix.package == steps.extract-tag.outputs.package }}
env:
PACKAGE: ${{ steps.extract-tag.outputs.package }}
SEMVER: ${{ steps.extract-tag.outputs.semver }}
run: |
mkdir -p out/${PACKAGE}
if [[ $PACKAGE == "discord.js" ]]; then
mv docs/${PACKAGE}/docs/docs.json out/${PACKAGE}/${SEMVER}.json
fi
if [[ $PACKAGE != "discord.js" ]]; then
mv docs/${PACKAGE}/docs/docs.api.json out/${PACKAGE}/${SEMVER}.api.json
fi
- name: Move docs to correct directory
if: ${{ env.GITHUB_REF_TYPE == 'branch' }}
env:
PACKAGE: ${{ matrix.package }}
run: |
mkdir -p out/${PACKAGE}
if [[ $PACKAGE == "discord.js" ]]; then
mv docs/${PACKAGE}/docs/docs.json out/${PACKAGE}/${GITHUB_REF_NAME}.json
fi
if [[ $PACKAGE != "discord.js" ]]; then
mv docs/${PACKAGE}/docs/docs.api.json out/${PACKAGE}/${GITHUB_REF_NAME}.api.json
fi
mkdir -p out/discord.js
mv docs/docs.json out/discord.js/${BRANCH_NAME}.json
- name: Commit and push
run: |
@@ -150,5 +98,5 @@ jobs:
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 commit -m "Docs build for ${BRANCH_OR_TAG} ${BRANCH_NAME}: ${SHA}" || true
git push

View File

@@ -1,4 +1,4 @@
name: Label sync
name: Label Sync
on:
schedule:
- cron: '0 0 * * *'
@@ -9,15 +9,14 @@ on:
paths:
- '.github/labels.yml'
jobs:
label-sync:
name: Label sync
labeler:
name: Labeler
runs-on: ubuntu-latest
if: github.repository_owner == 'discordjs'
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v2
- name: Label sync
uses: crazy-max/ghaction-github-labeler@v4
- name: Run Label Sync
uses: crazy-max/ghaction-github-labeler@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,27 +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 v16
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn --immutable
- name: Deprecate versions
run: 'yarn npm-deprecate --name "*dev*" --package @discordjs/builders @discordjs/collection discord.js @discordjs/proxy @discordjs/rest @discordjs/util @discordjs/voice'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

View File

@@ -14,4 +14,4 @@ jobs:
- name: Automatically assign reviewers
if: github.event.action == 'opened'
uses: kentaro-m/auto-assign-action@v1.2.1
uses: kentaro-m/auto-assign-action@v1.2.4

View File

@@ -1,25 +0,0 @@
name: Publish dev docker images
on:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
jobs:
docker-publish:
name: Docker publish
runs-on: ubuntu-latest
if: github.repository_owner == 'discordjs'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
run: echo ${{ secrets.DOCKER_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Build the image
run: docker build -t discordjs/proxy:latest -f packages/proxy-container/Dockerfile .
- name: Push image to DockerHub
run: docker push discordjs/proxy:latest

View File

@@ -1,56 +1,44 @@
name: Publish dev
on:
workflow_dispatch:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
jobs:
npm-publish:
name: npm publish
strategy:
fail-fast: false
matrix:
include:
- package: '@discordjs/builders'
folder: 'builders'
- package: '@discordjs/collection'
folder: 'collection'
- package: 'discord.js'
folder: 'discord.js'
- 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'
npm:
name: npm
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
uses: actions/checkout@v2
- name: Install node.js v16
uses: actions/setup-node@v3
- name: Install Node v16
uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/
cache: 'yarn'
cache: npm
- name: Check previous released version
id: pre-release
run: |
if [[ $(npm view discord.js@dev version | grep -e "$(jq --raw-output '.version' package.json).*.$(git rev-parse --short HEAD | cut -b1-3)") ]]; \
then echo '::set-output name=release::false'; \
else echo '::set-output name=release::true'; fi
- name: Install dependencies
run: yarn --immutable
if: steps.pre-release.outputs.release == 'true'
run: npm ci --ignore-scripts
- name: Build dependencies
run: yarn 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: Deprecate old versions
if: steps.pre-release.outputs.release == 'true'
run: npm deprecate discord.js@"~$(jq --raw-output '.version' package.json)" "no longer supported" || true
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Publish
if: steps.pre-release.outputs.release == 'true'
run: |
npm version --git-tag-version=false $(jq --raw-output '.version' package.json).$(date +%s).$(git rev-parse --short HEAD)
npm publish --tag dev || true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

View File

@@ -1,25 +0,0 @@
name: Publish docker images
on:
workflow_dispatch:
jobs:
docker-publish:
name: Docker publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
run: echo ${{ secrets.DOCKER_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Build docker image
run: docker build -t discordjs/proxy:latest -f packages/proxy-container/Dockerfile .
- name: Tag image with major
run: docker tag discordjs/proxy discordjs/proxy:$(cut -d '.' -f1 <<< $(jq --raw-output '.version' packages/proxy-container/package.json))
- name: Push image to DockerHub
run: docker push --all-tags discordjs/proxy

30
.github/workflows/publish-release.yml vendored Normal file
View File

@@ -0,0 +1,30 @@
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 v16
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
cache: npm
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Publish package (v13)
run: npm publish --tag v13-lts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

81
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,81 @@
name: Tests
on: [push, pull_request]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Node v16
uses: actions/setup-node@v2
with:
node-version: 16
cache: npm
- name: Install dependencies
run: npm ci
- name: Run Prettier and ESLint
run: npm run lint
typings:
name: TSLint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Node v16
uses: actions/setup-node@v2
with:
node-version: 16
cache: npm
- name: Install dependencies
run: npm ci
- name: Run TSLint
run: npm run lint:typings
typescript:
name: TypeScript
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Node v16
uses: actions/setup-node@v2
with:
node-version: 16
cache: npm
- name: Install dependencies
run: npm ci
- name: Register Problem Matcher
run: echo "##[add-matcher].github/tsc.json"
- name: Run Type Tests
run: npm run test:typescript
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Node v16
uses: actions/setup-node@v2
with:
node-version: 16
cache: npm
- name: Install dependencies
run: npm ci
- name: Test documentation
run: npm run docs:test

View File

@@ -1,40 +0,0 @@
name: Tests
on:
push:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
NEXT_PUBLIC_LOCAL_DEV: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install node.js v16
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Build dependencies
run: yarn build
- name: ESLint
run: yarn lint
- name: Tests
run: yarn test
- name: Upload Coverage
if: github.repository_owner == 'discordjs'
uses: ./packages/actions/src/uploadCoverage

29
.gitignore vendored
View File

@@ -13,30 +13,21 @@ pids
# Env
.env
test/auth.json
test/auth.js
docs/deploy/deploy_key
docs/deploy/deploy_key.pub
deploy/deploy_key
deploy/deploy_key.pub
# Dist
dist/
docs/docs.json
# Miscellaneous
.tmp/
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
.idea/
.DS_Store
.turbo
tsconfig.tsbuildinfo
coverage/
# yarn
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
# Cache
.prettiercache
.eslintcache
.yarn/
.turbo/
.vercel/

View File

@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn commitlint --edit $1
npx --no-install commitlint --edit $1

View File

@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn build && yarn lint-staged
npx --no-install lint-staged

View File

@@ -1,5 +1,4 @@
{
"*": "prettier --ignore-unknown --write",
"{src/**,__tests__/**}.{mjs,js,cjs,ts,tsx,astro}": "eslint --ext .mjs,.js,.cjs,.ts,.tsx,.astro --fix",
"src/**.ts": "vitest related --run --config ./vitest.config.ts"
"*.{mjs,js}": "eslint --fix --ext mjs,js,ts",
"*.{ts,json,yml,yaml}": "prettier --write"
}

5
.npmrc Normal file
View File

@@ -0,0 +1,5 @@
audit=false
fund=false
legacy-peer-deps=true
tag-version-prefix=""
message="chore(Release): %s"

View File

@@ -1,8 +1,7 @@
{
"printWidth": 120,
"useTabs": true,
"singleQuote": true,
"quoteProps": "as-needed",
"trailingComma": "all",
"endOfLine": "lf"
"singleQuote": true,
"printWidth": 120,
"trailingComma": "all",
"endOfLine": "lf",
"arrowParens": "avoid"
}

14
.tern-project Normal file
View File

@@ -0,0 +1,14 @@
{
"ecmaVersion": 7,
"libs": [],
"loadEagerly": ["./src/*.js"],
"dontLoad": ["node_modules/**"],
"plugins": {
"es_modules": {},
"node": {},
"doc_comment": {
"fullDocs": true,
"strong": true
},
}
}

View File

@@ -1,14 +0,0 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"tamasfe.even-better-toml",
"github.vscode-pull-request-github",
"codezombiech.gitignore",
"eamodio.gitlens",
"christian-kohler.npm-intellisense",
"christian-kohler.path-intellisense",
"antfu.unocss",
"astro-build.astro-vscode"
]
}

16
.vscode/settings.json vendored
View File

@@ -1,16 +0,0 @@
{
"eslint.workingDirectories": [{ "pattern": "./packages/*" }],
"eslint.validate": ["javascript", "javascriptreact", "astro", "typescript", "typescriptreact"],
"prettier.documentSelectors": ["**/*.astro"],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": false
},
"files.associations": {
"*.mdx": "markdown"
},
"unocss.root": "./packages/web-components",
"typescript.tsdk": "node_modules/typescript/lib"
}

View File

@@ -1,14 +0,0 @@
diff --git a/lib/TSDocConfigFile.js b/lib/TSDocConfigFile.js
index caf3515d60fd386c5909db5a0aa8b4180b10d602..6fa4f1984b6ba6b3a7aecd05e54477ebf141af94 100644
--- a/lib/TSDocConfigFile.js
+++ b/lib/TSDocConfigFile.js
@@ -31,8 +31,7 @@ const ajv_1 = __importDefault(require("ajv"));
const jju = __importStar(require("jju"));
const ajv = new ajv_1.default({ verbose: true });
function initializeSchemaValidator() {
- const jsonSchemaPath = resolve.sync('@microsoft/tsdoc/schemas/tsdoc.schema.json', { basedir: __dirname });
- const jsonSchemaContent = fs.readFileSync(jsonSchemaPath).toString();
+ const jsonSchemaContent = "{\"title\":\"TSDoc Configuration\",\"description\":\"Describes the TSDoc configuration for a TypeScript project\",\"type\":\"object\",\"properties\":{\"$schema\":{\"description\":\"Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.\",\"type\":\"string\"},\"extends\":{\"description\":\"Optionally specifies one or more JSON config files that will be combined with this file. This provides a way for standard settings to be shared across multiple projects. Important: The \\\"extends\\\" paths are resolved using NodeJS module resolution, so a path to a local file MUST be prefixed with \\\"./\\\".\",\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"noStandardTags\":{\"description\":\"By default, the config file loader will predefine all of the standardized TSDoc tags. To disable this and start with a completely empty configuration, set \\\"noStandardTags\\\"=true.\",\"type\":\"boolean\"},\"tagDefinitions\":{\"description\":\"Additional tags to support when parsing documentation comments with TSDoc.\",\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tsdocTagDefinition\"}},\"supportedHtmlElements\":{\"description\":\"The HTML element names that are supported in this configuration. Used in conjunction with the \\\"reportUnsupportedHtmlElements\\\" setting.\",\"type\":\"array\",\"items\":{\"type\":\"string\",\"pattern\":\"^[a-zA-Z0-9-]+$\"}},\"reportUnsupportedHtmlElements\":{\"description\":\"Whether an error should be reported when an unsupported HTML element is encountered in a doc comment. Defaults to \\\"true\\\" if the \\\"supportedHtmlElements\\\" field is present in this file, \\\"false\\\" if not.\",\"type\":\"boolean\"},\"supportForTags\":{\"description\":\"A collection of key/value pairs. The key is a TSDoc tag name (e.g. \\\"@myTag\\\") that must be defined in this configuration. The value is a boolean indicating whether the tag is supported. The TSDoc parser may report warnings when unsupported tags are encountered. If \\\"supportForTags\\\" is specified for at least one tag, then the \\\"reportUnsupportedTags\\\" validation check is enabled by default.\",\"type\":\"object\",\"patternProperties\":{\"@[a-zA-Z][a-zA-Z0-9]*$\":{\"type\":\"boolean\"}},\"additionalItems\":false}},\"required\":[\"$schema\"],\"additionalProperties\":false,\"definitions\":{\"tsdocTagDefinition\":{\"description\":\"Configuration for a custom supported TSDoc tag.\",\"type\":\"object\",\"properties\":{\"tagName\":{\"description\":\"Name of the custom tag. TSDoc tag names start with an at-sign (@) followed by ASCII letters using camelCase capitalization.\",\"type\":\"string\"},\"syntaxKind\":{\"description\":\"Syntax kind of the custom tag. \\\"inline\\\" means that this tag can appear inside other documentation sections (example: {@link}). \\\"block\\\" means that this tag starts a new documentation section (example: @remarks). \\\"modifier\\\" means that this tag's presence indicates an aspect of the associated API item (example: @internal).\",\"type\":\"string\",\"enum\":[\"inline\",\"block\",\"modifier\"]},\"allowMultiple\":{\"description\":\"If true, then this tag may appear multiple times in a doc comment. By default, a tag may only appear once.\",\"type\":\"boolean\"}},\"required\":[\"tagName\",\"syntaxKind\"],\"additionalProperties\":false}}}";
const jsonSchema = jju.parse(jsonSchemaContent, { mode: 'cjson' });
return ajv.compile(jsonSchema);
}

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,11 +0,0 @@
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"
yarnPath: .yarn/releases/yarn-3.2.4.cjs

9127
CHANGELOG.md Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -175,8 +175,8 @@
END OF TERMS AND CONDITIONS
Copyright 2021 Noel Buechler
Copyright 2015 Amish Shah
Copyright 2015 - 2021 Noel Buechler
Copyright 2015 - 2021 Amish Shah
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@@ -1,19 +1,15 @@
<div align="center">
<br />
<p>
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
</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://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>
</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>
</p>
<br />
<p>
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
</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://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>
</p>
</div>
## About
@@ -28,7 +24,7 @@ discord.js is a powerful [Node.js](https://nodejs.org) module that allows you to
## Installation
**Node.js 16.9.0 or newer is required.**
**Node.js 16.6.0 or newer is required.**
```sh-session
npm install discord.js
@@ -42,61 +38,60 @@ pnpm add discord.js
- [erlpack](https://github.com/discord/erlpack) for significantly faster WebSocket data (de)serialisation (`npm install discord/erlpack`)
- [bufferutil](https://www.npmjs.com/package/bufferutil) for a much faster WebSocket connection (`npm install bufferutil`)
- [utf-8-validate](https://www.npmjs.com/package/utf-8-validate) in combination with `bufferutil` for much faster WebSocket processing (`npm install utf-8-validate`)
- [@discordjs/voice](https://www.npmjs.com/package/@discordjs/voice) for interacting with the Discord Voice API (`npm install @discordjs/voice`)
- [@discordjs/voice](https://github.com/discordjs/voice) for interacting with the Discord Voice API (`npm install @discordjs/voice`)
## Example usage
Install discord.js:
Install all required dependencies:
```sh-session
npm install discord.js
yarn add discord.js
pnpm add discord.js
npm install discord.js @discordjs/rest discord-api-types
yarn add discord.js @discordjs/rest discord-api-types
pnpm add discord.js @discordjs/rest discord-api-types
```
Register a slash command against the Discord API:
```js
const { REST, Routes } = require('discord.js');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const commands = [
{
name: 'ping',
description: 'Replies with Pong!',
},
];
const commands = [{
name: 'ping',
description: 'Replies with Pong!'
}];
const rest = new REST({ version: '10' }).setToken('token');
const rest = new REST({ version: '9' }).setToken('token');
(async () => {
try {
console.log('Started refreshing application (/) commands.');
try {
console.log('Started refreshing application (/) commands.');
await rest.put(Routes.applicationCommands(CLIENT_ID), { body: commands });
await rest.put(
Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID),
{ body: commands },
);
console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
})();
```
Afterwards we can create a quite simple example bot:
```js
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('interactionCreate', async (interaction) => {
if (!interaction.isChatInputCommand()) return;
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'ping') {
await interaction.reply('Pong!');
}
if (interaction.commandName === 'ping') {
await interaction.reply('Pong!');
}
});
client.login('token');
@@ -104,10 +99,10 @@ client.login('token');
## Links
- [Website](https://discord.js.org/) ([source](https://github.com/discordjs/discord.js/tree/main/packages/website))
- [Documentation](https://discord.js.org/#/docs)
- [Guide](https://discordjs.guide/) ([source](https://github.com/discordjs/guide))
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v14.html), including updated and removed items in the library.
- [Website](https://discord.js.org/) ([source](https://github.com/discordjs/website))
- [Documentation](https://old.discordjs.dev/#/docs)
- [Guide](https://v13.discordjs.guide) ([source](https://github.com/discordjs/guide/tree/v13))
See also the [Update Guide](https://v13.discordjs.guide/additional-info/changes-in-v13.html), including updated and removed items in the library.
- [discord.js Discord server](https://discord.gg/djs)
- [Discord API Discord server](https://discord.gg/discord-api)
- [GitHub](https://github.com/discordjs/discord.js)
@@ -121,7 +116,7 @@ client.login('token');
## Contributing
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
[documentation](https://discord.js.org/#/docs).
[documentation](https://old.discordjs.dev/#/docs).
See [the contribution guide](https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md) if you'd like to submit a PR.
## Help

0
apps/website/.gitkeep Normal file
View File

View File

@@ -58,7 +58,7 @@ commit_parsers = [
]
filter_commits = true
tag_pattern = "[0-9]*"
skip_tags = "v[0-9]*|@discordjs*"
skip_tags = "v[0-9]*|@discordjs"
ignore_tags = ""
date_order = true
topo_order = true
sort_commits = "newest"

View File

@@ -1,26 +0,0 @@
codecov:
notify:
after_n_builds: 6
strict_yaml_branch: main
coverage:
range: '50...90'
status:
project:
default:
target: auto
threshold: 5%
informational: true
patch: off
flag_management:
default_rules:
statuses:
- type: project
target: auto
threshold: 2%
informational: true
comment:
require_changes: true
after_n_builds: 6

1
docs/README.md Normal file
View File

@@ -0,0 +1 @@
## [View the documentation here.](https://old.discordjs.dev/#/docs)

5
docs/index.yml Normal file
View File

@@ -0,0 +1,5 @@
- name: General
files:
- name: Welcome
id: welcome
path: ../../README.md

View File

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

11775
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,63 +1,90 @@
{
"name": "@discordjs/discord.js",
"version": "0.0.0",
"description": "A powerful library for interacting with the Discord API",
"private": true,
"scripts": {
"build": "turbo run build",
"test": "turbo run test --parallel",
"lint": "turbo run lint --parallel",
"format": "turbo run format --parallel",
"fmt": "turbo run format --parallel",
"postinstall": "is-ci || husky install",
"docs": "turbo run docs --parallel",
"update": "yarn upgrade-interactive",
"create-package": "node packages/scripts/src/packageScript.mjs"
},
"contributors": [
"Crawl <icrawltogo@gmail.com>",
"Amish Shah <amishshah.2k@gmail.com>",
"Vlad Frangu <kingdgrizzle@gmail.com>",
"SpaceEEC <spaceeec@yahoo.com>",
"Aura Román <kyradiscord@gmail.com>"
],
"keywords": [
"discord",
"api",
"bot",
"client",
"node",
"discordapp"
],
"repository": {
"type": "git",
"url": "https://github.com/discordjs/discord.js.git"
},
"bugs": {
"url": "https://github.com/discordjs/discord.js/issues"
},
"homepage": "https://discord.js.org",
"devDependencies": {
"@commitlint/cli": "^17.1.2",
"@commitlint/config-angular": "^17.1.0",
"@favware/cliff-jumper": "^1.8.8",
"@favware/npm-deprecate": "^1.0.5",
"conventional-changelog-cli": "^2.2.2",
"husky": "^8.0.1",
"is-ci": "^3.0.1",
"lint-staged": "^13.0.3",
"tsup": "^6.2.3",
"turbo": "^1.5.5",
"typescript": "^4.8.4"
},
"resolutions": {
"@microsoft/tsdoc-config": "patch:@microsoft/tsdoc-config@npm:0.16.1#.yarn/patches/@microsoft-tsdoc-config-npm-0.16.1-81031b1bbf.patch"
},
"engines": {
"node": ">=16.9.0"
},
"workspaces": [
"packages/*"
],
"packageManager": "yarn@3.2.4"
"name": "discord.js",
"version": "13.17.1",
"description": "A powerful library for interacting with the Discord API",
"scripts": {
"test": "npm run lint && npm run docs:test && npm run lint:typings && npm run test:typescript",
"test:typescript": "tsc --noEmit && tsd",
"lint": "prettier --check src/**/*.js typings/**/*.ts && eslint src",
"lint:fix": "npm run format && eslint src --fix",
"lint:typings": "tslint typings/index.d.ts",
"format": "prettier --write src/**/*.js typings/**/*.ts",
"prepare": "is-ci || husky install",
"docs": "docgen --source src --custom docs/index.yml --output docs/docs.json",
"docs:test": "docgen --source src --custom docs/index.yml",
"prepublishOnly": "npm run test",
"changelog": "git cliff --prepend CHANGELOG.md -u",
"release": "cliff-jumper"
},
"main": "./src/index.js",
"types": "./typings/index.d.ts",
"files": [
"src",
"typings"
],
"directories": {
"lib": "src",
"test": "test"
},
"contributors": [
"Crawl <icrawltogo@gmail.com>",
"Amish Shah <amishshah.2k@gmail.com>",
"Vlad Frangu <kingdgrizzle@gmail.com>",
"SpaceEEC <spaceeec@yahoo.com>",
"Antonio Roman <kyradiscord@gmail.com>"
],
"license": "Apache-2.0",
"keywords": [
"discord",
"api",
"bot",
"client",
"node",
"discordapp"
],
"repository": {
"type": "git",
"url": "https://github.com/discordjs/discord.js.git"
},
"bugs": {
"url": "https://github.com/discordjs/discord.js/issues"
},
"homepage": "https://discord.js.org",
"dependencies": {
"@discordjs/builders": "^0.16.0",
"@discordjs/collection": "^0.7.0",
"@sapphire/async-queue": "^1.5.0",
"@types/node-fetch": "^2.6.3",
"@types/ws": "^8.5.4",
"discord-api-types": "^0.33.5",
"form-data": "^4.0.0",
"node-fetch": "^2.6.7",
"ws": "^8.13.0"
},
"devDependencies": {
"@commitlint/cli": "^17.5.1",
"@commitlint/config-angular": "^17.4.4",
"@discordjs/docgen": "^0.11.1",
"@favware/cliff-jumper": "^2.0.0",
"@favware/npm-deprecate": "^1.0.7",
"@types/node": "^16.11.45",
"conventional-changelog-cli": "^2.2.2",
"dtslint": "^4.2.1",
"eslint": "^8.37.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.3",
"is-ci": "^3.0.1",
"jest": "^29.5.0",
"lint-staged": "^13.2.0",
"prettier": "^2.8.7",
"tsd": "^0.28.1",
"tslint": "^6.1.3",
"typescript": "^5.0.3"
},
"engines": {
"node": ">=16.6.0",
"npm": ">=7.0.0"
}
}

View File

@@ -1,3 +0,0 @@
{
"extends": "../../.eslintrc.json"
}

View File

@@ -1,29 +0,0 @@
# Packages
node_modules/
# Log files
logs/
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
# Env
.env
# Dist
dist/
typings/
docs/**/*
!docs/index.yml
!docs/README.md
!docs/examples/
!docs/examples/*.md
# Miscellaneous
.tmp/
coverage/

View File

@@ -1 +0,0 @@
module.exports = require('../../.lintstagedrc.json');

View File

@@ -1,8 +0,0 @@
# Autogenerated
CHANGELOG.md
.turbo
dist/
docs/**/*
!docs/index.yml
!docs/README.md
coverage/

View File

@@ -1 +0,0 @@
module.exports = require('../../.prettierrc.json');

View File

@@ -1,190 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Copyright 2022 Noel Buechler
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,34 +0,0 @@
<div align="center">
<br />
<p>
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
</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>
</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>
</p>
</div>
## Links
- [Website](https://discord.js.org/) ([source](https://github.com/discordjs/discord.js/tree/main/packages/website))
- [Documentation](https://discord.js.org/#/docs)
- [Guide](https://discordjs.guide/) ([source](https://github.com/discordjs/guide))
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v14.html), including updated and removed items in the library.
- [discord.js Discord server](https://discord.gg/djs)
- [Discord API Discord server](https://discord.gg/discord-api)
- [GitHub](https://github.com/discordjs/discord.js/tree/main/packages/scripts)
- [Related libraries](https://discord.com/developers/docs/topics/community-resources#libraries)
## Contributing
See [the contribution guide](https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md) if you'd like to submit a PR.
## Help
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle
nudge in the right direction, please don't hesitate to join our official [discord.js Server](https://discord.gg/djs).

View File

@@ -1,22 +0,0 @@
import { describe, test, expect } from 'vitest';
import { formatTag } from '../src/index.js';
describe('Format Tag', () => {
test('GIVEN tag with a prefix THEN format tag to not contain the prefix', () => {
expect(formatTag('@discordjs/rest@0.4.0')).toEqual({ package: 'rest', semver: '0.4.0' });
expect(formatTag('@discordjs/collection@0.6.0')).toEqual({ package: 'collection', semver: '0.6.0' });
expect(formatTag('@discordjs/proxy@0.1.0')).toEqual({ package: 'proxy', semver: '0.1.0' });
expect(formatTag('@discordjs/builders@0.13.0')).toEqual({ package: 'builders', semver: '0.13.0' });
expect(formatTag('@discordjs/voice@0.9.0')).toEqual({ package: 'voice', semver: '0.9.0' });
});
test('GIVEN tag with no prefix THEN return tag', () => {
expect(formatTag('13.5.1')).toEqual({ package: 'discord.js', semver: '13.5.1' });
expect(formatTag('13.7.0')).toEqual({ package: 'discord.js', semver: '13.7.0' });
});
test('GIVEN no or invalid tag THEN return null', () => {
expect(formatTag('')).toEqual(null);
expect(formatTag('abc')).toEqual(null);
});
});

View File

@@ -1,59 +0,0 @@
{
"name": "@discordjs/actions",
"version": "0.1.0",
"description": "A set of actions that we use for our workflows",
"private": true,
"scripts": {
"test": "vitest run",
"build": "tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts",
"format": "prettier --write . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --fix",
"fmt": "yarn format"
},
"main": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"directories": {
"lib": "src",
"test": "__tests__"
},
"files": [
"dist"
],
"contributors": [
"Crawl <icrawltogo@gmail.com>"
],
"license": "Apache-2.0",
"keywords": [
"api",
"bot",
"client",
"node",
"discordjs"
],
"repository": {
"type": "git",
"url": "https://github.com/discordjs/discord.js.git"
},
"bugs": {
"url": "https://github.com/discordjs/discord.js/issues"
},
"homepage": "https://discord.js.org",
"dependencies": {
"@actions/core": "^1.10.0",
"tslib": "^2.4.0"
},
"devDependencies": {
"@types/node": "^16.11.64",
"@vitest/coverage-c8": "^0.24.0",
"cross-env": "^7.0.3",
"eslint": "^8.24.0",
"eslint-config-neon": "^0.1.35",
"prettier": "^2.7.1",
"tsup": "^6.2.3",
"typescript": "^4.8.4",
"vitest": "^0.24.0"
},
"engines": {
"node": ">=16.9.0"
}
}

View File

@@ -1,14 +0,0 @@
name: 'Format Tag'
description: 'Formats a git tag to remove potentially prefixes'
inputs:
tag:
description: 'The input tag'
required: true
outputs:
package:
description: 'The package string that was extracted from this tag'
semver:
description: 'The semver string that was extracted from this tag'
runs:
using: node16
main: ../../dist/formatTag/index.mjs

View File

@@ -1,13 +0,0 @@
export function formatTag(tag: string) {
// eslint-disable-next-line unicorn/no-unsafe-regex, prefer-named-capture-group
const parsed = /(^@.*\/(?<package>.*)@v?)?(?<semver>\d+.\d+.\d+)-?.*/.exec(tag);
if (parsed?.groups) {
return {
package: parsed.groups.package ?? 'discord.js',
semver: parsed.groups.semver,
};
}
return null;
}

View File

@@ -1,10 +0,0 @@
import { getInput, setOutput } from '@actions/core';
import { formatTag } from './formatTag.js';
const tag = getInput('tag', { required: true });
const parsed = formatTag(tag);
if (parsed) {
setOutput('package', parsed.package);
setOutput('semver', parsed.semver);
}

View File

@@ -1 +0,0 @@
export * from './formatTag/formatTag.js';

View File

@@ -1,64 +0,0 @@
name: 'Upload Coverage'
description: 'Uploads code coverage reports to codecov with separate flags for separate packages'
runs:
using: 'composite'
steps:
- name: Upload Builders Coverage
uses: codecov/codecov-action@v3
with:
files: ./packages/builders/coverage/cobertura-coverage.xml
flags: builders
- name: Upload Collection Coverage
uses: codecov/codecov-action@v3
with:
files: ./packages/collection/coverage/cobertura-coverage.xml
flags: collection
- name: Upload Discord.js Coverage
uses: codecov/codecov-action@v3
with:
files: ./packages/discord.js/coverage/cobertura-coverage.xml
flags: discord.js
- name: Upload Proxy Coverage
uses: codecov/codecov-action@v3
with:
files: ./packages/proxy/coverage/cobertura-coverage.xml
flags: proxy
- name: Upload Rest Coverage
uses: codecov/codecov-action@v3
with:
files: ./packages/rest/coverage/cobertura-coverage.xml
flags: rest
- name: Upload Voice Coverage
uses: codecov/codecov-action@v3
with:
files: ./packages/voice/coverage/cobertura-coverage.xml
flags: voice
- name: Upload Website Coverage
uses: codecov/codecov-action@v3
with:
files: ./packages/website/coverage/cobertura-coverage.xml
flags: website
- name: Upload WS Coverage
uses: codecov/codecov-action@v3
with:
files: ./packages/ws/coverage/cobertura-coverage.xml
flags: ws
- name: Upload Util Coverage
uses: codecov/codecov-action@v3
with:
files: ./packages/util/coverage/cobertura-coverage.xml
flags: util
- name: Upload Utilities Coverage
uses: codecov/codecov-action@v3
with:
files: ./packages/actions/coverage/cobertura-coverage.xml, ./packages/scripts/coverage/cobertura-coverage.xml
flags: utilities

View File

@@ -1,20 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"allowJs": true
},
"include": [
"**/*.ts",
"**/*.tsx",
"**/*.js",
"**/*.mjs",
"**/*.jsx",
"**/*.test.ts",
"**/*.test.js",
"**/*.test.mjs",
"**/*.spec.ts",
"**/*.spec.js",
"**/*.spec.mjs"
],
"exclude": []
}

View File

@@ -1,4 +0,0 @@
{
"extends": "../../tsconfig.json",
"include": ["src/**/*.ts"]
}

View File

@@ -1,7 +0,0 @@
import { createTsupConfig } from '../../tsup.config.js';
export default createTsupConfig({
entry: ['src/index.ts', 'src/formatTag/index.ts'],
format: ['esm'],
minify: true,
});

View File

@@ -1,3 +0,0 @@
{
"extends": "../../.eslintrc.json"
}

View File

@@ -1,27 +0,0 @@
# Packages
node_modules/
# Log files
logs/
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
# Env
.env
# Dist
dist/
typings/
docs/**/*
!docs/index.json
!docs/README.md
# Miscellaneous
.tmp/
coverage/
tsconfig.tsbuildinfo

View File

@@ -1 +0,0 @@
module.exports = require('../../.lintstagedrc.json');

View File

@@ -1,8 +0,0 @@
# Autogenerated
CHANGELOG.md
.turbo
dist/
docs/**/*
!docs/index.yml
!docs/README.md
coverage/

View File

@@ -1 +0,0 @@
module.exports = require('../../.prettierrc.json');

View File

@@ -1,190 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Copyright 2022 Noel Buechler
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,34 +0,0 @@
<div align="center">
<br />
<p>
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
</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>
</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>
</p>
</div>
## Links
- [Website](https://discord.js.org/) ([source](https://github.com/discordjs/discord.js/tree/main/packages/website))
- [Documentation](https://discord.js.org/#/docs)
- [Guide](https://discordjs.guide/) ([source](https://github.com/discordjs/guide))
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v14.html), including updated and removed items in the library.
- [discord.js Discord server](https://discord.gg/djs)
- [Discord API Discord server](https://discord.gg/discord-api)
- [GitHub](https://github.com/discordjs/discord.js/tree/main/packages/scripts)
- [Related libraries](https://discord.com/developers/docs/topics/community-resources#libraries)
## Contributing
See [the contribution guide](https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md) if you'd like to submit a PR.
## Help
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle
nudge in the right direction, please don't hesitate to join our official [discord.js Server](https://discord.gg/djs).

View File

@@ -1,52 +0,0 @@
{
"name": "@discordjs/api-extractor-utils",
"version": "1.0.0",
"description": "Utilities for api-extractor",
"private": true,
"scripts": {
"build": "tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts",
"format": "prettier --write . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts --fix",
"fmt": "yarn format"
},
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"directories": {
"lib": "src"
},
"files": [
"dist"
],
"contributors": [
"Suneet Tipirneni <suneettipirneni@icloud.com>"
],
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/discordjs/discord.js.git"
},
"bugs": {
"url": "https://github.com/discordjs/discord.js/issues"
},
"homepage": "https://discord.js.org",
"dependencies": {
"@microsoft/api-extractor-model": "7.24.0",
"@microsoft/tsdoc": "0.14.1"
},
"devDependencies": {
"@types/node": "^16.11.64",
"cross-env": "^7.0.3",
"eslint": "^8.24.0",
"eslint-config-neon": "^0.1.35",
"prettier": "^2.7.1",
"tsup": "^6.2.3",
"typescript": "^4.8.4"
},
"engines": {
"node": ">=16.9.0"
},
"publishConfig": {
"access": "public"
}
}

View File

@@ -1,416 +0,0 @@
import type { ApiReturnTypeMixin } from '@microsoft/api-extractor-model';
import {
type ApiModel,
ApiDeclaredItem,
type ApiPropertyItem,
type ApiMethod,
type ApiParameterListMixin,
type ApiTypeParameterListMixin,
type ApiClass,
type ApiFunction,
ApiItemKind,
type ApiTypeAlias,
type ApiEnum,
type ApiInterface,
type ApiMethodSignature,
type ApiPropertySignature,
type ApiVariable,
type ApiItem,
type ApiConstructor,
type ApiItemContainerMixin,
} from '@microsoft/api-extractor-model';
import { generateTypeParamData } from './TypeParameterJSONEncoder.js';
import { type TokenDocumentation, resolveName, genReference, genToken, genParameter, generatePath } from './parse.js';
import type { DocBlockJSON } from './tsdoc/CommentBlock.js';
import type { AnyDocNodeJSON } from './tsdoc/CommentNode.js';
import { type DocNodeContainerJSON, nodeContainer } from './tsdoc/CommentNodeContainer.js';
import { createCommentNode } from './tsdoc/index.js';
export interface ReferenceData {
name: string;
path: string;
}
export interface InheritanceData {
parentKey: string;
parentName: string;
path: string;
}
export interface ApiInheritableJSON {
inheritanceData: InheritanceData | null;
}
export interface ApiItemJSON {
comment: AnyDocNodeJSON | null;
containerKey: string;
deprecated: DocNodeContainerJSON | null;
excerpt: string;
excerptTokens: TokenDocumentation[];
kind: string;
name: string;
path: string[];
referenceData: ReferenceData;
remarks: DocNodeContainerJSON | null;
summary: DocNodeContainerJSON | null;
}
export interface ApiPropertyItemJSON extends ApiItemJSON, ApiInheritableJSON {
optional: boolean;
propertyTypeTokens: TokenDocumentation[];
readonly: boolean;
}
export interface ApiTypeParameterListJSON {
typeParameters: ApiTypeParameterJSON[];
}
export interface ApiTypeParameterJSON {
commentBlock: DocBlockJSON | null;
constraintTokens: TokenDocumentation[];
defaultTokens: TokenDocumentation[];
name: string;
optional: boolean;
}
export interface ApiParameterListJSON {
parameters: ApiParameterJSON[];
}
export interface ApiMethodSignatureJSON
extends ApiItemJSON,
ApiTypeParameterListJSON,
ApiParameterListJSON,
ApiInheritableJSON {
mergedSiblings: ApiMethodSignatureJSON[];
optional: boolean;
overloadIndex: number;
returnTypeTokens: TokenDocumentation[];
}
export interface ApiMethodJSON extends ApiMethodSignatureJSON {
mergedSiblings: ApiMethodJSON[];
protected: boolean;
static: boolean;
}
export interface ApiParameterJSON {
isOptional: boolean;
name: string;
paramCommentBlock: DocBlockJSON | null;
tokens: TokenDocumentation[];
}
export interface ApiClassJSON extends ApiItemJSON, ApiTypeParameterListJSON {
constructor: ApiConstructorJSON | null;
extendsTokens: TokenDocumentation[];
implementsTokens: TokenDocumentation[][];
methods: ApiMethodJSON[];
properties: ApiPropertyItemJSON[];
}
export interface ApiTypeAliasJSON extends ApiItemJSON, ApiTypeParameterListJSON {
typeTokens: TokenDocumentation[];
}
export interface EnumMemberData {
initializerTokens: TokenDocumentation[];
name: string;
summary: DocNodeContainerJSON | null;
}
export interface ApiEnumJSON extends ApiItemJSON {
members: EnumMemberData[];
}
export interface ApiInterfaceJSON extends ApiItemJSON, ApiTypeParameterListJSON {
extendsTokens: TokenDocumentation[][] | null;
methods: ApiMethodSignatureJSON[];
properties: ApiPropertyItemJSON[];
}
export interface ApiVariableJSON extends ApiItemJSON {
readonly: boolean;
typeTokens: TokenDocumentation[];
}
export interface ApiFunctionJSON extends ApiItemJSON, ApiTypeParameterListJSON, ApiParameterListJSON {
mergedSiblings: ApiFunctionJSON[];
overloadIndex: number;
returnTypeTokens: TokenDocumentation[];
}
export interface ApiConstructorJSON extends ApiItemJSON, ApiParameterListJSON {
protected: boolean;
}
export type FunctionLike = ApiDeclaredItem & ApiParameterListMixin & ApiReturnTypeMixin & ApiTypeParameterListMixin;
export class ApiNodeJSONEncoder {
public static encode(model: ApiModel, node: ApiItem, version: string) {
if (!(node instanceof ApiDeclaredItem)) {
console.log(`Cannot serialize node of type ${node.kind}`);
return undefined;
}
switch (node.kind) {
case ApiItemKind.Class:
return this.encodeClass(model, node as ApiClass, version);
case ApiItemKind.Function:
return this.encodeFunction(model, node as ApiFunction, version);
case ApiItemKind.Interface:
return this.encodeInterface(model, node as ApiInterface, version);
case ApiItemKind.TypeAlias:
return this.encodeTypeAlias(model, node as ApiTypeAlias, version);
case ApiItemKind.Enum:
return this.encodeEnum(model, node as ApiEnum, version);
case ApiItemKind.Variable:
return this.encodeVariable(model, node as ApiVariable, version);
default:
// console.log(`Unknown API item kind: ${node.kind}`);
return undefined;
}
}
public static encodeItem(model: ApiModel, item: ApiDeclaredItem, version: string): ApiItemJSON {
const path = [];
for (const _item of item.getHierarchy()) {
switch (_item.kind) {
case 'None':
case 'EntryPoint':
case 'Model':
break;
default:
path.push(resolveName(_item));
}
}
return {
kind: item.kind,
name: resolveName(item),
referenceData: genReference(item, version),
excerpt: item.excerpt.text,
excerptTokens: item.excerpt.spannedTokens.map((token) => genToken(model, token, version)),
remarks: item.tsdocComment?.remarksBlock
? (createCommentNode(item.tsdocComment.remarksBlock, model, version, item.parent) as DocNodeContainerJSON)
: null,
summary: item.tsdocComment?.summarySection
? (createCommentNode(item.tsdocComment.summarySection, model, version, item.parent) as DocNodeContainerJSON)
: null,
deprecated: item.tsdocComment?.deprecatedBlock
? (createCommentNode(item.tsdocComment.deprecatedBlock, model, version, item.parent) as DocNodeContainerJSON)
: null,
path,
containerKey: item.containerKey,
comment: item.tsdocComment ? createCommentNode(item.tsdocComment, model, version, item.parent) : null,
};
}
public static encodeParameterList(
model: ApiModel,
item: ApiDeclaredItem & ApiParameterListMixin,
version: string,
): { parameters: ApiParameterJSON[] } {
return {
parameters: item.parameters.map((param) => genParameter(model, param, version)),
};
}
public static encodeTypeParameterList(
model: ApiModel,
item: ApiDeclaredItem & ApiTypeParameterListMixin,
version: string,
): ApiTypeParameterListJSON {
return {
typeParameters: item.typeParameters.map((param) => generateTypeParamData(model, param, version, item.parent)),
};
}
public static encodeProperty(
model: ApiModel,
item: ApiPropertyItem,
parent: ApiItemContainerMixin,
version: string,
): ApiPropertyItemJSON {
return {
...this.encodeItem(model, item, version),
...this.encodeInheritanceData(item, parent, version),
propertyTypeTokens: item.propertyTypeExcerpt.spannedTokens.map((token) => genToken(model, token, version)),
readonly: item.isReadonly,
optional: item.isOptional,
};
}
public static encodeInheritanceData(
item: ApiDeclaredItem,
parent: ApiItemContainerMixin,
version: string,
): ApiInheritableJSON {
return {
inheritanceData:
item.parent && item.parent.containerKey !== parent.containerKey
? {
parentKey: item.parent.containerKey,
parentName: item.parent.displayName,
path: generatePath(item.parent.getHierarchy(), version),
}
: null,
};
}
public static encodeFunctionLike(model: ApiModel, item: FunctionLike, version: string) {
return {
...this.encodeItem(model, item, version),
...this.encodeParameterList(model, item, version),
...this.encodeTypeParameterList(model, item, version),
returnTypeTokens: item.returnTypeExcerpt.spannedTokens.map((token) => genToken(model, token, version)),
overloadIndex: item.overloadIndex,
};
}
public static encodeFunction(model: ApiModel, item: FunctionLike, version: string, nested = false): ApiFunctionJSON {
return {
...this.encodeFunctionLike(model, item, version),
mergedSiblings: nested
? []
: item.getMergedSiblings().map((item) => this.encodeFunction(model, item as ApiFunction, version, true)),
};
}
public static encodeMethodSignature(
model: ApiModel,
item: ApiMethodSignature,
parent: ApiItemContainerMixin,
version: string,
nested = false,
): ApiMethodSignatureJSON {
return {
...this.encodeFunctionLike(model, item, version),
...this.encodeInheritanceData(item, parent, version),
optional: item.isOptional,
mergedSiblings: nested
? []
: item
.getMergedSiblings()
.map((item) => this.encodeMethodSignature(model, item as ApiMethodSignature, parent, version, true)),
};
}
public static encodeMethod(
model: ApiModel,
item: ApiMethod,
parent: ApiItemContainerMixin,
version: string,
nested = false,
): ApiMethodJSON {
return {
...this.encodeMethodSignature(model, item, parent, version),
static: item.isStatic,
protected: item.isProtected,
mergedSiblings: nested
? []
: item.getMergedSiblings().map((item) => this.encodeMethod(model, item as ApiMethod, parent, version, true)),
};
}
public static encodeClass(model: ApiModel, item: ApiClass, version: string): ApiClassJSON {
const extendsExcerpt = item.extendsType?.excerpt;
const methods: ApiMethodJSON[] = [];
const properties: ApiPropertyItemJSON[] = [];
let constructor: ApiConstructor | undefined;
for (const member of item.findMembersWithInheritance().items) {
switch (member.kind) {
case ApiItemKind.Method:
methods.push(this.encodeMethod(model, member as ApiMethod, item, version));
break;
case ApiItemKind.Property:
properties.push(this.encodeProperty(model, member as ApiPropertyItem, item, version));
break;
case ApiItemKind.Constructor:
constructor = member as ApiConstructor;
break;
default:
break;
}
}
return {
...this.encodeItem(model, item, version),
...this.encodeTypeParameterList(model, item, version),
constructor: constructor ? this.encodeConstructor(model, constructor, version) : null,
extendsTokens: extendsExcerpt ? extendsExcerpt.spannedTokens.map((token) => genToken(model, token, version)) : [],
implementsTokens: item.implementsTypes.map((excerpt) =>
excerpt.excerpt.spannedTokens.map((token) => genToken(model, token, version)),
),
methods,
properties,
};
}
public static encodeTypeAlias(model: ApiModel, item: ApiTypeAlias, version: string): ApiTypeAliasJSON {
return {
...this.encodeItem(model, item, version),
...this.encodeTypeParameterList(model, item, version),
typeTokens: item.typeExcerpt.spannedTokens.map((token) => genToken(model, token, version)),
};
}
public static encodeEnum(model: ApiModel, item: ApiEnum, version: string): ApiEnumJSON {
return {
...this.encodeItem(model, item, version),
members: item.members.map((member) => ({
name: member.name,
initializerTokens:
member.initializerExcerpt?.spannedTokens.map((token) => genToken(model, token, version)) ?? [],
summary: member.tsdocComment ? nodeContainer(member.tsdocComment.summarySection, model, version, member) : null,
})),
};
}
public static encodeInterface(model: ApiModel, item: ApiInterface, version: string): ApiInterfaceJSON {
const methods: ApiMethodSignatureJSON[] = [];
const properties: ApiPropertyItemJSON[] = [];
for (const member of item.findMembersWithInheritance().items) {
switch (member.kind) {
case ApiItemKind.MethodSignature:
methods.push(this.encodeMethodSignature(model, member as ApiMethodSignature, item, version));
break;
case ApiItemKind.PropertySignature:
properties.push(this.encodeProperty(model, member as ApiPropertySignature, item, version));
break;
default:
break;
}
}
return {
...this.encodeItem(model, item, version),
...this.encodeTypeParameterList(model, item, version),
extendsTokens: item.extendsTypes.map((excerpt) =>
excerpt.excerpt.spannedTokens.map((token) => genToken(model, token, version)),
),
methods,
properties,
};
}
public static encodeVariable(model: ApiModel, item: ApiVariable, version: string): ApiVariableJSON {
return {
...this.encodeItem(model, item, version),
typeTokens: item.variableTypeExcerpt.spannedTokens.map((token) => genToken(model, token, version)),
readonly: item.isReadonly,
};
}
public static encodeConstructor(model: ApiModel, item: ApiConstructor, version: string): ApiConstructorJSON {
return {
...this.encodeItem(model, item, version),
...this.encodeParameterList(model, item, version),
protected: item.isProtected,
};
}
}

View File

@@ -1,31 +0,0 @@
import type { TypeParameter, ApiModel, ApiItem } from '@microsoft/api-extractor-model';
import { type TokenDocumentation, genToken } from './parse.js';
import { type DocBlockJSON, block } from './tsdoc/CommentBlock.js';
export interface TypeParameterData {
commentBlock: DocBlockJSON | null;
constraintTokens: TokenDocumentation[];
defaultTokens: TokenDocumentation[];
name: string;
optional: boolean;
}
export function generateTypeParamData(
model: ApiModel,
typeParam: TypeParameter,
version: string,
parentItem?: ApiItem,
): TypeParameterData {
const constraintTokens = typeParam.constraintExcerpt.spannedTokens.map((token) => genToken(model, token, version));
const defaultTokens = typeParam.defaultTypeExcerpt.spannedTokens.map((token) => genToken(model, token, version));
return {
name: typeParam.name,
constraintTokens,
defaultTokens,
optional: typeParam.isOptional,
commentBlock: typeParam.tsdocTypeParamBlock
? block(typeParam.tsdocTypeParamBlock, model, version, parentItem)
: null,
};
}

View File

@@ -1,4 +0,0 @@
export * from './ApiNodeJSONEncoder.js';
export * from './parse.js';
export * from './tsdoc/index.js';
export * from './TypeParameterJSONEncoder.js';

View File

@@ -1,222 +0,0 @@
import {
type ApiModel,
type ApiPackage,
type ApiItem,
ApiItemKind,
ApiDocumentedItem,
type Excerpt,
ExcerptTokenKind,
ApiNameMixin,
type ApiPropertyItem,
type ExcerptToken,
type Parameter,
type ApiFunction,
} from '@microsoft/api-extractor-model';
import type { DocNode, DocParagraph, DocPlainText } from '@microsoft/tsdoc';
import { type Meaning, ModuleSource } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
import type { DocBlockJSON } from './tsdoc/CommentBlock.js';
import { createCommentNode } from './tsdoc/index.js';
export function findPackage(model: ApiModel, name: string): ApiPackage | undefined {
return (model.findMembersByName(name)[0] ?? model.findMembersByName(`@discordjs/${name}`)[0]) as
| ApiPackage
| undefined;
}
export function generatePath(items: readonly ApiItem[], version: string) {
let path = '/docs/packages';
for (const item of items) {
switch (item.kind) {
case ApiItemKind.Model:
case ApiItemKind.EntryPoint:
case ApiItemKind.EnumMember:
break;
case ApiItemKind.Package:
path += `/${item.displayName}`;
break;
case ApiItemKind.Function:
// eslint-disable-next-line no-case-declarations
const functionItem = item as ApiFunction;
path += `/${functionItem.displayName}${
functionItem.overloadIndex && functionItem.overloadIndex > 1 ? `:${functionItem.overloadIndex}` : ''
}:${item.kind}`;
break;
case ApiItemKind.Property:
case ApiItemKind.Method:
case ApiItemKind.MethodSignature:
case ApiItemKind.PropertySignature:
// TODO: Take overloads into account
path += `#${item.displayName}`;
break;
default:
path += `/${item.displayName}:${item.kind}`;
}
}
// eslint-disable-next-line prefer-named-capture-group, unicorn/no-unsafe-regex
return path.replace(/@discordjs\/(.*)\/(.*)?/, `$1/${version}/$2`);
}
export function resolveDocComment(item: ApiDocumentedItem) {
if (!(item instanceof ApiDocumentedItem)) {
return null;
}
const { tsdocComment } = item;
if (!tsdocComment) {
return null;
}
const { summarySection } = tsdocComment;
function recurseNodes(node: DocNode | undefined): string | null {
if (!node) {
return null;
}
switch (node.kind) {
case 'Paragraph':
return recurseNodes(node as DocParagraph);
case 'PlainText':
return (node as DocPlainText).text;
default:
return null;
}
}
return recurseNodes(summarySection);
}
export function findReferences(model: ApiModel, excerpt: Excerpt) {
const retVal: Set<ApiItem> = new Set();
for (const token of excerpt.spannedTokens) {
switch (token.kind) {
case ExcerptTokenKind.Reference: {
const item = model.resolveDeclarationReference(token.canonicalReference!, undefined).resolvedApiItem;
if (!item) {
break;
}
retVal.add(item);
break;
}
default:
break;
}
}
return retVal;
}
export function resolveName(item: ApiItem) {
if (ApiNameMixin.isBaseClassOf(item)) {
return item.name;
}
return item.displayName;
}
export function getProperties(item: ApiItem) {
const properties: ApiPropertyItem[] = [];
for (const member of item.members) {
switch (member.kind) {
case ApiItemKind.Property:
case ApiItemKind.PropertySignature:
case ApiItemKind.Method:
case ApiItemKind.MethodSignature:
properties.push(member as ApiPropertyItem);
break;
default:
break;
}
}
return properties;
}
export interface TokenDocumentation {
kind: string;
path: string | null;
text: string;
}
export interface ParameterDocumentation {
isOptional: boolean;
name: string;
paramCommentBlock: DocBlockJSON | null;
tokens: TokenDocumentation[];
}
function createDapiTypesURL(meaning: Meaning, name: string) {
const base = 'https://discord-api-types.dev/api/discord-api-types-v10';
switch (meaning) {
case 'type':
return `${base}#${name}`;
default:
return `${base}/${meaning}/${name}`;
}
}
export function genReference(item: ApiItem, version: string) {
return {
name: resolveName(item),
path: generatePath(item.getHierarchy(), version),
};
}
export function genToken(model: ApiModel, token: ExcerptToken, version: string) {
if (token.canonicalReference) {
// @ts-expect-error: Symbol is not publicly accessible
token.canonicalReference._navigation = '.';
}
if (
token.canonicalReference?.source instanceof ModuleSource &&
token.canonicalReference.symbol &&
token.canonicalReference.source.packageName === 'discord-api-types' &&
token.canonicalReference.symbol.meaning
) {
return {
kind: token.kind,
text: token.text,
path: createDapiTypesURL(token.canonicalReference.symbol.meaning, token.text),
};
}
const item = token.canonicalReference
? model.resolveDeclarationReference(token.canonicalReference, undefined).resolvedApiItem ?? null
: null;
return {
kind: token.kind,
text: token.text,
path: item ? generatePath(item.getHierarchy(), version) : null,
};
}
export function genParameter(model: ApiModel, param: Parameter, version: string): ParameterDocumentation {
return {
name: param.name,
isOptional: param.isOptional,
tokens: param.parameterTypeExcerpt.spannedTokens.map((token) => genToken(model, token, version)),
paramCommentBlock: param.tsdocParamBlock
? (createCommentNode(param.tsdocParamBlock, model, version) as DocBlockJSON)
: null,
};
}
export function getMembers(pkg: ApiPackage, version: string) {
return pkg.members[0]!.members.map((member) => ({
name: member.displayName,
kind: member.kind as string,
path: generatePath(member.getHierarchy(), version),
containerKey: member.containerKey,
overloadIndex: member.kind === 'Function' ? (member as ApiFunction).overloadIndex : null,
}));
}

View File

@@ -1,18 +0,0 @@
import type { ApiModel, ApiItem } from '@microsoft/api-extractor-model';
import type { DocBlock } from '@microsoft/tsdoc';
import { blockTag, type DocBlockTagJSON } from './CommentBlockTag.js';
import { type AnyDocNodeJSON, type DocNodeJSON, node } from './CommentNode.js';
import { createCommentNode } from '.';
export interface DocBlockJSON extends DocNodeJSON {
content: AnyDocNodeJSON[];
tag: DocBlockTagJSON;
}
export function block(block: DocBlock, model: ApiModel, version: string, parentItem?: ApiItem) {
return {
...node(block),
content: block.content.nodes.map((node) => createCommentNode(node, model, version, parentItem)),
tag: blockTag(block.blockTag),
};
}

View File

@@ -1,13 +0,0 @@
import type { DocBlockTag } from '@microsoft/tsdoc';
import { type DocNodeJSON, node } from './CommentNode.js';
export interface DocBlockTagJSON extends DocNodeJSON {
tagName: string;
}
export function blockTag(blockTag: DocBlockTag): DocBlockTagJSON {
return {
...node(blockTag),
tagName: blockTag.tagName,
};
}

View File

@@ -1,13 +0,0 @@
import type { DocCodeSpan } from '@microsoft/tsdoc';
import { type DocNodeJSON, node } from './CommentNode.js';
export interface DocCodeSpanJSON extends DocNodeJSON {
code: string;
}
export function codeSpan(codeSpan: DocCodeSpan): DocCodeSpanJSON {
return {
...node(codeSpan),
code: codeSpan.code,
};
}

View File

@@ -1,28 +0,0 @@
import type { DocNode, DocNodeKind } from '@microsoft/tsdoc';
import type { DocBlockJSON } from './CommentBlock.js';
import type { DocCodeSpanJSON } from './CommentCodeSpan.js';
import type { DocNodeContainerJSON } from './CommentNodeContainer.js';
import type { DocFencedCodeJSON } from './FencedCodeCommentNode.js';
import type { DocLinkTagJSON } from './LinkTagCommentNode.js';
import type { DocPlainTextJSON } from './PlainTextCommentNode.js';
import type { DocCommentJSON } from './RootComment.js';
export interface DocNodeJSON {
kind: DocNodeKind;
}
export type AnyDocNodeJSON =
| DocBlockJSON
| DocCodeSpanJSON
| DocCommentJSON
| DocFencedCodeJSON
| DocLinkTagJSON
| DocNodeContainerJSON
| DocNodeJSON
| DocPlainTextJSON;
export function node(node: DocNode): DocNodeJSON {
return {
kind: node.kind as DocNodeKind,
};
}

View File

@@ -1,20 +0,0 @@
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';
import type { DocNodeContainer } from '@microsoft/tsdoc';
import { type AnyDocNodeJSON, type DocNodeJSON, node } from './CommentNode.js';
import { createCommentNode } from '.';
export interface DocNodeContainerJSON extends DocNodeJSON {
nodes: AnyDocNodeJSON[];
}
export function nodeContainer(
container: DocNodeContainer,
model: ApiModel,
version: string,
parentItem?: ApiItem,
): DocNodeContainerJSON {
return {
...node(container),
nodes: container.nodes.map((node) => createCommentNode(node, model, version, parentItem)),
};
}

View File

@@ -1,15 +0,0 @@
import type { DocFencedCode } from '@microsoft/tsdoc';
import { type DocNodeJSON, node } from './CommentNode.js';
export interface DocFencedCodeJSON extends DocNodeJSON {
code: string;
language: string;
}
export function fencedCode(fencedCode: DocFencedCode) {
return {
...node(fencedCode),
language: fencedCode.language,
code: fencedCode.code,
};
}

View File

@@ -1,60 +0,0 @@
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';
import type { DocDeclarationReference, DocLinkTag } from '@microsoft/tsdoc';
import { resolveName, generatePath } from '../parse.js';
import { type DocNodeJSON, node } from './CommentNode.js';
interface LinkTagCodeLink {
kind: string;
name: string;
path: string;
}
export interface DocLinkTagJSON extends DocNodeJSON {
codeDestination: LinkTagCodeLink | null;
text: string | null;
urlDestination: string | null;
}
export function genLinkToken(
model: ApiModel,
ref: DocDeclarationReference,
context: ApiItem | null,
version: string,
): LinkTagCodeLink | null {
const item = model.resolveDeclarationReference(ref, context ?? undefined).resolvedApiItem ?? null;
if (!item) {
return null;
}
return {
name: resolveName(item),
kind: item.kind,
path: generatePath(item.getHierarchy(), version),
};
}
export function linkTagNode(
linkNode: DocLinkTag,
model: ApiModel,
version: string,
parentItem?: ApiItem,
): DocLinkTagJSON {
// If we weren't provided a parent object, fallback to the package entrypoint.
const packageEntryPoint = linkNode.codeDestination?.importPath
? model.getAssociatedPackage()?.findEntryPointsByPath(linkNode.codeDestination.importPath)[0]
: null;
const codeDestination = linkNode.codeDestination
? genLinkToken(model, linkNode.codeDestination, parentItem ?? packageEntryPoint ?? null, version)
: null;
const text = linkNode.linkText ?? null;
const urlDestination = linkNode.urlDestination ?? null;
return {
...node(linkNode),
text,
codeDestination,
urlDestination,
};
}

View File

@@ -1,19 +0,0 @@
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';
import type { DocParamBlock } from '@microsoft/tsdoc';
import { block, type DocBlockJSON } from './CommentBlock.js';
interface DocParamBlockJSON extends DocBlockJSON {
name: string;
}
export function paramBlock(
paramBlock: DocParamBlock,
model: ApiModel,
version: string,
parentItem?: ApiItem,
): DocParamBlockJSON {
return {
...block(paramBlock, model, version, parentItem),
name: paramBlock.parameterName,
};
}

View File

@@ -1,13 +0,0 @@
import type { DocPlainText } from '@microsoft/tsdoc';
import { type DocNodeJSON, node } from './CommentNode.js';
export interface DocPlainTextJSON extends DocNodeJSON {
text: string;
}
export function plainTextNode(plainTextNode: DocPlainText): DocPlainTextJSON {
return {
...node(plainTextNode),
text: plainTextNode.text,
};
}

View File

@@ -1,24 +0,0 @@
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';
import type { DocComment } from '@microsoft/tsdoc';
import { block, type DocBlockJSON } from './CommentBlock.js';
import { type DocNodeJSON, node } from './CommentNode.js';
import { createCommentNode } from '.';
export interface DocCommentJSON extends DocNodeJSON {
customBlocks: DocBlockJSON[];
deprecated: DocNodeJSON[];
remarks: DocNodeJSON[];
summary: DocNodeJSON[];
}
export function comment(comment: DocComment, model: ApiModel, version: string, parentItem?: ApiItem): DocCommentJSON {
return {
...node(comment),
summary: comment.summarySection.nodes.map((node) => createCommentNode(node, model, version, parentItem)),
remarks:
comment.remarksBlock?.content.nodes.map((node) => createCommentNode(node, model, version, parentItem)) ?? [],
deprecated:
comment.deprecatedBlock?.content.nodes.map((node) => createCommentNode(node, model, version, parentItem)) ?? [],
customBlocks: comment.customBlocks.map((_block) => block(_block, model, version, parentItem)),
};
}

View File

@@ -1,62 +0,0 @@
import type { ApiModel, ApiItem } from '@microsoft/api-extractor-model';
import {
type DocNode,
type DocPlainText,
type DocLinkTag,
type DocParagraph,
type DocFencedCode,
DocNodeKind,
type DocBlock,
type DocComment,
type DocCodeSpan,
type DocParamBlock,
} from '@microsoft/tsdoc';
import { block } from './CommentBlock.js';
import { codeSpan } from './CommentCodeSpan.js';
import { node as _node, type AnyDocNodeJSON } from './CommentNode.js';
import { nodeContainer } from './CommentNodeContainer.js';
import { fencedCode } from './FencedCodeCommentNode.js';
import { linkTagNode } from './LinkTagCommentNode.js';
import { paramBlock } from './ParamBlock.js';
import { plainTextNode } from './PlainTextCommentNode.js';
import { comment } from './RootComment.js';
export function createCommentNode(
node: DocNode,
model: ApiModel,
version: string,
parentItem?: ApiItem,
): AnyDocNodeJSON {
switch (node.kind) {
case DocNodeKind.PlainText:
return plainTextNode(node as DocPlainText);
case DocNodeKind.LinkTag:
return linkTagNode(node as DocLinkTag, model, version, parentItem);
case DocNodeKind.Paragraph:
case DocNodeKind.Section:
return nodeContainer(node as DocParagraph, model, version, parentItem);
case DocNodeKind.FencedCode:
return fencedCode(node as DocFencedCode);
case DocNodeKind.CodeSpan:
return codeSpan(node as DocCodeSpan);
case DocNodeKind.Block:
return block(node as DocBlock, model, version, parentItem);
case DocNodeKind.ParamBlock:
return paramBlock(node as DocParamBlock, model, version, parentItem);
case DocNodeKind.Comment:
return comment(node as DocComment, model, version, parentItem);
default:
return _node(node);
}
}
export * from './CommentNode.js';
export * from './CommentNodeContainer.js';
export * from './CommentBlock.js';
export * from './CommentBlockTag.js';
export * from './CommentCodeSpan.js';
export * from './FencedCodeCommentNode.js';
export * from './LinkTagCommentNode.js';
export * from './ParamBlock.js';
export * from './PlainTextCommentNode.js';
export * from './RootComment.js';

View File

@@ -1,20 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"allowJs": true
},
"include": [
"**/*.ts",
"**/*.tsx",
"**/*.js",
"**/*.mjs",
"**/*.jsx",
"**/*.test.ts",
"**/*.test.js",
"**/*.test.mjs",
"**/*.spec.ts",
"**/*.spec.js",
"**/*.spec.mjs"
],
"exclude": []
}

View File

@@ -1,8 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"skipDefaultLibCheck": true,
"skipLibCheck": true
},
"include": ["src/**/*.ts"]
}

View File

@@ -1,5 +0,0 @@
import { createTsupConfig } from '../../tsup.config.js';
export default createTsupConfig({
minify: true,
});

View File

@@ -1,5 +0,0 @@
{
"name": "builders",
"org": "discordjs",
"packagePath": "packages/builders"
}

View File

@@ -1,3 +0,0 @@
{
"extends": "../../.eslintrc.json"
}

View File

@@ -1,29 +0,0 @@
# Packages
node_modules/
# Log files
logs/
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
# Env
.env
# Dist
dist/
typings/
docs/**/*
!docs/index.json
!docs/README.md
!docs/examples/
!docs/examples/*.md
# Miscellaneous
.tmp/
coverage/

View File

@@ -1 +0,0 @@
module.exports = require('../../.lintstagedrc.json');

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