Compare commits

..

395 Commits

Author SHA1 Message Date
iCrawl
0cf29abcf0 chore(formatters): release @discordjs/formatters@0.1.0 2022-12-17 16:54:06 +01:00
Jiralite
dd62be077d docs(GuildForumThreadManager): Fix sticker type (#8940) 2022-12-16 18:20:11 +01:00
Jiralite
83eafb6146 chore: Add backport label (#8942) 2022-12-16 18:19:44 +01:00
Almeida
18b3a19810 fix: add @discordjs/formatters to dependency list (#8939) 2022-12-16 17:56:29 +01:00
Almeida
c76e170786 fix(resolveColor): invalid colors (#8933)
Fixes https://github.com/discordjs/discord.js/issues/8932
2022-12-16 14:28:18 +01:00
Almeida
cbafd479b3 feat(ForumChannel): add defaultForumLayout (#8895)
* feat(ForumChannel): add `defaultForumLayout`

* fix: lockfile
2022-12-16 13:27:11 +00:00
iCrawl
19519ec9fc chore(core): release @discordjs/core@0.3.0 2022-12-16 14:10:45 +01:00
iCrawl
166f742d02 fix(core): instantiate/export role connections 2022-12-16 14:09:51 +01:00
iCrawl
7a61004627 chore(core): release @discordjs/core@0.2.0 2022-12-16 03:59:25 +01:00
iCrawl
82f4827ee5 chore(ws): release @discordjs/ws@0.6.0 2022-12-16 03:55:39 +01:00
iCrawl
e470e088ab chore(rest): release @discordjs/rest@1.5.0 2022-12-16 03:53:13 +01:00
Suneet Tipirneni
3d6fa248c0 feat(core): Add support for role connections (#8930) 2022-12-16 03:32:00 +01:00
Suneet Tipirneni
273ba45e27 chore: use satisfies where applicable (#8884)
* chore: use satisfies where applicable

* chore: remove unneeded eslint ignores

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-16 02:12:38 +00:00
Suneet Tipirneni
7a5134459c feat: add support for nsfw commands (#7976)
* chore: update

* fix: add edit changes

* chore: make requested changes

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-16 02:04:56 +00:00
Tristan Camejo
6540914b4a refactor(sharding): use switch statement (#8928) 2022-12-15 08:07:28 +00:00
Ben
627511d652 feat(InteractionResponse): createdTimestamp (#8917)
* feat(InteractionResponse): createdTimestamp

* feat(InteractionResponse): createdTimestamp

* Apply suggestions from code review

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

Co-authored-by: MrMythicalYT <91077061+MrMythicalYT@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-14 21:35:40 +00:00
MrMythicalYT
a7b55c1460 refactor: use consistent naming for options (#8901)
* refactor: use consistent naming for options

* chore: update param names in typings

* chore: update forgotten `data` param

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

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

Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-14 21:32:38 +00:00
Jiralite
1b151db59c refactor(CommandInteractionOptionResolver): Loosen mentionable checks (#8910)
refactor(CommandInteractionOptionResolver): loosen mentionable checks

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-14 21:29:29 +00:00
Qjuh
aa8c57dab6 fix(WebSocketShard): clear listeners on reconnect (#8927) 2022-12-14 21:23:20 +00:00
muchnameless
b14604abde fix: re-export formatters (#8909)
* fix: re-export formatters

* future-proof typings

Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-12 08:49:24 +00:00
Almeida
73300c75fa feat: add links to each routes documentation (#8898) 2022-12-07 16:32:55 +00:00
Almeida
3dede75621 fix(thread): get() route (#8897)
Co-authored-by: Aura Román <kyradiscord@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-07 14:27:01 +00:00
Almeida
3f555d5ddf feat(interactions): add messageId parameter to deleteReply() (#8896) 2022-12-07 14:23:42 +00:00
Jiralite
976b234e9d docs: Fix deprecated links (#8907)
docs: fix malformed deprecated descriptions

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-06 16:30:48 +00:00
MrMythicalYT
c48ff5e420 docs(UserFlagsBitField): make .Flags static (#8902)
Co-authored-by: Aura Román <kyradiscord@gmail.com>
2022-12-06 16:27:12 +00:00
Jiralite
6acf759f63 fix: Deprecate workflow fix (#8903)
fix: deprecate workflow fix

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-06 10:29:35 +00:00
iCrawl
fb70df817c ci: fix ref name 2022-12-03 17:05:37 +01:00
iCrawl
86959bad49 chore: update next 2022-12-03 10:43:51 +01:00
iCrawl
a0d6bc49c6 refactor: remove revalidation 2022-12-02 19:09:58 +01:00
MrMythicalYT
45faa19982 feat(Guild): add disableInvites method (#8801)
* feat(GuildInviteManager): add setDisabled method

* fix: formatting

* refactor: move helper method to `Guild`

* fix: rename method

* fix: add newline before jsdoc

* fix: remove disallowed trailing space

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

Co-authored-by: Hackerboi 69 <62872992+thehackerboi69github@users.noreply.github.com>

Co-authored-by: Hackerboi 69 <62872992+thehackerboi69github@users.noreply.github.com>
Co-authored-by: Aura Román <kyradiscord@gmail.com>
2022-12-02 13:21:59 +00:00
DD
8f552a0e17 refactor(WebSocketShard): identify throttling (#8888)
* refactor(WebSocketShard): identify throttling

* chore: add worker handling

* refactor: worker handling

* chore: update tests

* chore: use satisfies where applicable

* chore: add informative comment

* chore: apply suggestions

* refactor(SimpleContextFetchingStrategy): support multiple managers
2022-12-02 13:04:09 +00:00
Suneet Tipirneni
3fca638a84 feat: add @discordjs/formatters (#8889)
* feat: add @discordjs/formatters

* chore: make requested changes

* chore: make requested changes

* chore: fix other places

* chore: make requested changes

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-02 12:55:00 +00:00
iCrawl
4e4cbb3418 fix: revalidate on page level instead 2022-12-02 11:31:59 +01:00
iCrawl
52f56d3c2e chore: deps 2022-12-01 21:01:19 +01:00
DD
40b504a208 fix(WebSocketShard): send ratelimit handling (#8887)
* fix(WebSocketShard): send ratelimit handling

* chore: remove unnecessary else

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-01 10:58:00 +00:00
iCrawl
322cb99049 chore(discord.js): release discord.js@14.7.1 2022-12-01 11:53:40 +01:00
Jiralite
11d195d04f fix: Prevent crash on no select menu option (#8881)
* fix: no crash on no option

* refactor: consistency in ??

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-01 10:49:14 +00:00
Almeida
f13ff5c6d3 feat(createPackage): sort label files (#8892)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-01 10:02:44 +00:00
Jiralite
5e4331062b chore: Add brokers to package list and labels in issue forms (#8893)
chore: add brokers and sort list

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-01 10:00:04 +00:00
Almeida
fff3602a8a fix(createPackage): invalid label/path on labeler file (#8891)
* fix(createPackage): invalid label/path on labeler file

* fix: `packages:ui` label
2022-12-01 09:55:31 +00:00
iCrawl
72c30d1578 revert: theme fix 2022-11-30 04:41:07 +01:00
iCrawl
2cb1000a3a fix: move back to old theming 2022-11-30 04:34:47 +01:00
iCrawl
8a39c14921 fix: generate correct paths after moving catch-all 2022-11-30 04:26:40 +01:00
iCrawl
4ae029dfe2 fix: path generation 2022-11-30 04:16:27 +01:00
iCrawl
2849af0118 refactor: correctly generate routes 2022-11-30 03:55:23 +01:00
iCrawl
90d192078f fix: generate paths 2022-11-30 03:17:47 +01:00
iCrawl
b0f9b9c344 fix: next-themes 2022-11-30 02:22:00 +01:00
iCrawl
6bcebd4867 fix: including readme files 2022-11-29 01:06:02 +01:00
iCrawl
1efa95337f fix: dynamicParams bug 2022-11-29 00:36:23 +01:00
iCrawl
2f4bdf7394 fix: remove output file tracing option 2022-11-29 00:20:23 +01:00
iCrawl
4b9b62416b fix: reading readme files 2022-11-29 00:10:01 +01:00
iCrawl
208378b214 chore: fix changelog 2022-11-28 23:19:34 +01:00
iCrawl
6e65b45b31 chore(discord.js): release discord.js@14.7.0 2022-11-28 23:00:38 +01:00
iCrawl
2b260bd4bb chore: deps 2022-11-28 22:53:19 +01:00
iCrawl
cab692409d chore(voice): release @discordjs/voice@0.14.0 2022-11-28 22:51:40 +01:00
iCrawl
0fe503b516 chore(ws): release @discordjs/ws@0.5.0 2022-11-28 22:50:16 +01:00
iCrawl
999bc2069e chore(proxy): release @discordjs/proxy@1.2.1 2022-11-28 22:48:38 +01:00
iCrawl
b89bd6f67c chore(rest): release @discordjs/rest@1.4.0 2022-11-28 22:46:13 +01:00
iCrawl
5235ad5bfe chore(collection): release @discordjs/collection@1.3.0 2022-11-28 22:44:33 +01:00
iCrawl
3bd8458e09 chore(builders): release @discordjs/builders@1.4.0 2022-11-28 22:41:50 +01:00
iCrawl
44696c0a6a chore(brokers): release @discordjs/brokers@0.1.0 2022-11-28 22:39:02 +01:00
iCrawl
b5d8b69452 chore: deps 2022-11-28 22:33:21 +01:00
Almeida
7430c8e4c8 fix: remove casts when using makeURLSearchParams() (#8877) 2022-11-28 22:22:02 +01:00
Suneet Tipirneni
1a10f48bc3 feat(website): add link to discord-api-types (#8866)
fix: merge conflicts

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-28 18:18:26 +00:00
Jiralite
e592852e42 ci: Fix typo for /core labels (#8878) 2022-11-28 19:15:10 +01:00
Aura Román
8376e2dbcd refactor: update makeURLSearchParams to accept readonly non-Records (#8868) 2022-11-28 09:20:27 +01:00
Jiralite
ed68a1af5b chore: Update /core constants (#8874) 2022-11-28 09:14:16 +01:00
iCrawl
ebf9991df7 fix: readd react-use alias for astro 2022-11-28 06:13:53 +01:00
iCrawl
31e67c4316 build: smaller bundle size for websites 2022-11-28 05:55:08 +01:00
iCrawl
2f4bfedca1 chore: deps 2022-11-28 03:39:50 +01:00
Suneet Tipirneni
2127b32d26 feat: Add @discordjs/core (#8736)
* feat: add @discordjs/core

* chore: lint

* chore: add all gateway events

* chore: add the rest of the rest routes

* chore: cleanup gateway

* chore: rename gateway to client

* chore: rename gateway to client

* fix: don't spread unless we need to

* refactor: use classes and make requested changes

* chore: show shardId on emit

* chore: add interface for intrinsic props

* refactor: scope dispatch data instead of spreading

* chore: add utility for uploading files for messages and interactions

* feat: finish up form data handling

* chore: add readme

* chore: update api-extractor stuff

* chore: bump deps

* chore: make requested changes

* chore: make requested changes

* Update package.json

* chore: make requested changes

* fix: add missing interaction responses

* chore: make some requested changes

* chore: remove `return await`

* chore: use autoModeration instead of automod

* refactor: use snowflakes and -types results

* chore: sort imports, fix return type on editUserVoiceState

* chore: rename bots to users

* feat: add automod dispatch events

* refactor: move templates and members into guild

* fix: use users instead of bots in api class

* chore: imports

* chore: make requested changes

* fix: don't make files required on interaction replies

* fix: rename sendMessage to createMessage

* feat: add application command routes

* feat: add webhook.execute overloads and options to invites.get

* chore: use create prefixes

* chore: seperate interaction params

* chore: use Id

* chore: make requested changes

* chore: make requested changes

* chore: make requested changes

* chore: for -> from

* Apply suggestions from code review

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

* Update packages/core/README.md

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

* chore: make requested changes

* chore: update -types

* chore: bump vitest

* fix: sticker uploading

* fix: lockfile

* chore: make requested changes

* chore: make requested changes

* Update packages/core/src/api/applicationCommands.ts

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

* Apply suggestions from code review

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

* Update packages/core/README.md

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

* Apply suggestions from code review

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

Co-authored-by: almeidx <almeidx@pm.me>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Aura Román <kyradiscord@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-27 21:23:13 +00:00
Suneet Tipirneni
12553da135 feat(website): add app dir (#8869)
Co-authored-by: iCrawl <buechler.noel@outlook.com>
2022-11-27 16:24:34 +01:00
MrMythicalYT
decbce4010 feat(Webhook): add channel property (#8812)
* feat(Webhook): add `channel` property

* fix: allow ForumChannel type

* fix: disallow thread channel type

* fix: formatting

* Apply suggestions from code review

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

Co-authored-by: Aura Román <kyradiscord@gmail.com>
2022-11-26 13:31:05 +01:00
iCrawl
9922151266 refactor: docker image for proxy-container 2022-11-26 02:09:05 +01:00
iCrawl
f0120538bb build: better turbo config 2022-11-26 02:07:56 +01:00
Suneet Tipirneni
650f4ddfb2 feat(guide): add next and previous page buttons (#8777) 2022-11-25 21:49:36 +01:00
iCrawl
56d086022f ci: fetch all branches 2022-11-25 20:13:03 +01:00
iCrawl
909a02e2ad ci: test changes 2022-11-25 19:57:50 +01:00
iCrawl
ac0851b5b1 ci: fetch with a depth of 5 2022-11-25 19:55:45 +01:00
iCrawl
1ef42e4e7b chore: nextjs 13 changes 2022-11-25 19:33:30 +01:00
iCrawl
db346e014f ci: don't forward filter option 2022-11-25 19:19:57 +01:00
iCrawl
8f5b167483 build: only run scripts on changed content 2022-11-25 19:15:44 +01:00
MrMythicalYT
ec37f137fd types(Formatters): allow boolean in formatEmoji (#8823)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-25 17:42:48 +00:00
Almeida
f9828034cd fix(MessageMentions): add InGuild generic (#8828)
fix(MessageMentions): add InGuild generic

Co-authored-by: Noel <buechler.noel@outlook.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-25 17:35:52 +00:00
Jaworek
cb77fd02d0 docs: describe InteractionEditReplyOptions (#8840)
* docs: add 'description' to interactionreplyoptions

* Update packages/discord.js/src/structures/interfaces/InteractionResponses.js

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

Co-authored-by: Aura Román <kyradiscord@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-25 17:26:33 +00:00
Eejit
7e06f68185 fix(Activity): Fix equals() not checking for differing emoji (#8841)
* Fix presence updating

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

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

* Update Presence.js

* Better emoji checking

* Revert "Better emoji checking"

This reverts commit 44d52bfde8.

Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-25 17:17:55 +00:00
Jiralite
d2754802cc docs(AutoModerationRuleManager): Describe cache (#8848)
docs(AutoModerationRuleManager): describe cache
2022-11-25 15:24:19 +00:00
Suneet Tipirneni
7ae0c529f2 chore(scripts): cleanup create-package script (#8862)
Co-authored-by: Noel <buechler.noel@outlook.com>
2022-11-25 15:36:04 +01:00
iCrawl
7332b7bae3 chore: switch order of vite plugins 2022-11-25 14:43:30 +01:00
iCrawl
33a82b7bce chore: next 13 2022-11-25 14:29:32 +01:00
Jeroen Claassens
d0c82561b8 fix: fixed react/astro/guide/discord.js build, updated dependencies, fix crawlvatar (#8861) 2022-11-25 14:02:18 +01:00
iCrawl
256677b435 chore: deps 2022-11-23 09:34:56 +01:00
iCrawl
ee7d2fd4c8 chore: deps 2022-11-22 13:35:47 +01:00
Jiralite
65bc0adbf4 docs: Fix message action row components (#8819)
* docs: fix message action row components

* docs: remove unused external links

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-19 22:20:49 +00:00
Jiralite
fd4ba5eaba feat: Auto Moderation (#7938)
* feat: initial AutoMod commit

* types: Typo in class name

Co-authored-by: Jonathan <54381371+axisiscool@users.noreply.github.com>

* refactor: move things around

* refactor: remove undocumented property

* chore: add new intents to issue form

* feat: add initial basic manager

* feat(AutoModRule): add new properties

* feat: add events

* feat(GuildAuditLog): cache rules

* refactor: move JSDoc to where it is actually used

* refactor(AutoModRule): add `_patch()` method

* feat(AutoModRuleManager): add resolvers

* feat(Sweepers): add new manager

* types: nullify first parameter of `autoModerationRuleUpdate`

* types: add manager to `Caches`

* docs(AutoModRule): update `metadata` docstring

* feat: add execution event

* fix(AutoModActionExecution): export class

* refactor(AutoModRule): `triggerType` is not modifiable

* docs(AutoModRule): link class

* feat: add trigger metadata definitions

* docs(AutoModRule): typos

* feat(AutoModRule): action metadata

* types: Proper casing of name

Co-authored-by: MateoDeveloper <79017590+Mateo-tem@users.noreply.github.com>

* refactor: only patch data if exists

* types: `preset` is an array

* types(AutoModRuleActionMetadata): nullify all

* feat(AutoModRuleManager): add `fetch()`

* docs(AutoModRule): tweak some wording

* docs(AutoModRule): use "array" over "list"

* docs(AutoModRuleResolvable): fix union

* types: adjust some names

* feat(AutoModRuleManager): add `create()`

* feat(AutoModRuleManager): add `delete()`

* refactor: prefer full auto moderation name

* docs(AutoModerationRuleManager): fix a fetch example

* refactor(Sweepers): alphabetise methods

* chore: remove testing

* fix(AutoModerationRuleCreateOptions): add `reason`

* fix: typo for `presets`

* fix(AutoModerationRuleCreateOptions): `actions` is required

* fix(AutoModerationRuleManager): handle properties that are unrequired

* feat(AutoModerationRuleManager): add `edit()`

* feat(GuildAuditLogsEntry): add auto moderation rules

* refactor: prefer "AutoModerationActionExecutionAction"

* refactor: annotate todos and doc fixes

* feat(AutoModerationRule): add guild getter

* docs(AutoModerationRule): rule -> auto moderation rule

* docs(AutoModerationRuleEditOptions): `eventType` is optional

* feat(AutoModerationRule): add helpers

* docs: random string updates

* chore: add TODOs

* feat(AutoModerationActionExecution): add helpers

* feat: support role and channel resolvables

* chore: high priority todo to keep me in solitary

* refactor(AutoModerationActionMetadataOptions): allow resolvables

* chore: tidy up from merge

* docs(AutoModerationRule): document extension

* feat: export `AutoModerationRuleManager`

* chore(ActionsManager): add new actions

* chore: add to websocket index

* refactor(AutoModerationActionExecution): send the guild across

* docs(AutoModerationActionExecution): typo

* docs(AutoModerationRule): deduplicate a word

* docs(Guild): dot

* test: add some basic tests

* docs(AutoModerationRuleManager): fetch is optional

* docs(AutoModerationActionExecution): prefer non-links

* types: `presets` is an array of numbers

* docs(AutoModerationRuleEditOptions): `name` is optional

* docs(AutoModerationRule): fix type for `exemptChannels`

* docs(AutoModerationRuleUpdateAction): remove "object"

* feat: add `allow_list`

* fix(GuildAuditLogsEntry): pass guild

* docs(AutoModerationRuleManager): correct fetch example

* chore: prettier

* refactor: remove unneeded optional chaining operator

* feat: add mention limit

* docs(AutoModerationRuleManager): document new requirement

* refactor: conform to message content intent

* docs: document permission for event

* docs: refactor intent message

* docs: dot

* docs: remove string in link

* refactor: document upstream changes

* fix(AutoModerationRuleDelete): Correct event fire

Co-authored-by: GoldenAngel <50855202+GoldenAngel2@users.noreply.github.com>

* feat(AutoModerationRule): Add `setMentionTotalLimit()` helper method

* feat(AuditLogEntries): add new extra fields

* types: add `guild` in constructors

* types: update typings

* refactor(AutoModerationRuleManager): `&&` shorthand

* types: remove leftover type

* chore: types

* docs: update API types

* docs: Tweak guild wording

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

* feat: add regular expression matching

* docs: update `allowList` wording

* refactor: deduplicate `guildId`

Co-authored-by: Jonathan <54381371+axisiscool@users.noreply.github.com>
Co-authored-by: MateoDeveloper <79017590+Mateo-tem@users.noreply.github.com>
Co-authored-by: GoldenAngel <50855202+GoldenAngel2@users.noreply.github.com>
Co-authored-by: Aura Román <kyradiscord@gmail.com>
2022-11-19 22:06:13 +00:00
Almeida
153d2403ad chore: turbo cache coverage (#8836)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-19 21:59:06 +00:00
Jiralite
8ed5c1beb6 docs: Specify ActionRowBuilder for components (#8834)
docs: `ActionRowBuilder` for `components`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-19 21:50:04 +00:00
MrMythicalYT
09f65b724b docs: add @extends for select menu classes (#8824)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-19 21:43:00 +00:00
Synbulat Biishev
291f36cd73 feat: add Collection#subtract() (#8393)
* feat: add `Collection#missing()`

* test: add test for `Collection#missing()`

* chore: rename `missing` to `complement`

* docs: fix name

* test: fix test name

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

* chore: sort alphabetically

* fix: edit condition

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

* refactor: rename to `subtract`

* docs: fix description

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

* fix: change condition

* fix: resolved eslint formatting error

Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Aura Román <kyradiscord@gmail.com>
2022-11-19 21:34:26 +00:00
Jaworek
b2fabd130a feat(SelectMenuInteractions): add values property (#8805)
* fix: add values property

* fix: improve wording

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

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

Co-authored-by: Aura Román <kyradiscord@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-19 21:27:14 +00:00
Suneet Tipirneni
abefc4f809 docs: add section on testing local changes (#8802)
* docs: add section on testing local changes

* chore: use the root command for watching

* Update .github/CONTRIBUTING.md

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

* Update .github/CONTRIBUTING.md

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

* Update .github/CONTRIBUTING.md

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

* Update .github/CONTRIBUTING.md

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

Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-19 21:17:19 +00:00
RedGuy12
d6873b7159 fix(escapeMarkdown): fix double escaping (#8798)
* fix(escapeMarkdown): fix double escaping

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

* remove cruft

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

Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-19 21:08:33 +00:00
RedGuy12
017f9b1ed4 fix(Transfomers): call .toJSON in toSnakeCase (#8790)
* fix(Transfomers): call `.toJSON` in `toSnakeCase`

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

* fix: move it under the Date check

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

* fix(toSnakeCase): stop assuming `toJSON` returns snake_case values

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

Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-19 21:01:41 +00:00
Idris
e74aa7f6b0 feat(ThreadChannel): add a helper for pin and unpin (#8786)
* feat(ThreadChannel): add a helper for pin and unpin

* fix: remove erros

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

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

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

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

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

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

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

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

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

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

* docs(ThreadChannel): improve description

* types(ThreadChannel): fix types

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: Aura Román <kyradiscord@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-19 20:54:43 +00:00
Synbulat Biishev
ff85481d3e feat: add Message#bulkDeletable (#8760)
* feat: add `Message#bulkDeletable`

* feat: add requested changes

* fix: add check for `ManageMessages` permission

* fix: `.permissionsFor()` exist only in guild channels

* feat: apply requested changes

* types: add type

* fix: do not return `undefined`

* fix: add property to docs

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-06 03:51:34 +00:00
Jaworek
68c9cb37bc docs: make WebSocketShard.lastPingTimestamp public (#8768)
Make WebSocketShard.lastPingTimestamp public
2022-11-02 13:29:53 +00:00
DD
5152abf728 feat: new select menus (#8793)
* feat(builders): new select menus

* chore: better re-exporting of deprecated classes

* feat: new select menus

* chore: typings

* chore: add missing todo comment

* chore: finish updating tests

* chore: add runtime deprecation warnings

* chore: format deprecation warning

* feat(BaseInteraction): isAnySelectMenu

* chore: requested changes

* fix: deprecation comments

* chore: update @deprecated comments in typings

* chore: add tests for select menu type narrowing

* fix: bad auto imports

Co-authored-by: Julian Vennen <julian@aternos.org>

* fix: properly handle resolved members

* fix: collectors

* chore: suggested changes

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

* fix(typings): bad class extends

* feat(ChannelSelectMenuBuilder): validation

* chore: update todo comment

* refactor(ChannelSelectMenu): better handling of channel_types state

* chore: style nit

* chore: suggested nits

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

Co-authored-by: Julian Vennen <julian@aternos.org>
Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: Aura Román <kyradiscord@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-01 17:36:05 +00:00
MrMythicalYT
8b400ca975 feat(InteractionResponses): add message parameter (#8773) 2022-10-31 19:04:42 +01:00
Saya
88cd9d9060 feat: support resume urls (#8784)
Co-authored-by: Almeida <almeidx@pm.me>
2022-10-31 19:03:51 +01:00
ckohen
5a70057826 fix(SequentialHandler): downlevel ECONNRESET errors (#8785) 2022-10-31 19:03:38 +01:00
Almeida
0bcc18a0bd fix(brokers): publish the scripts folder (#8794) 2022-10-31 19:01:49 +01:00
Gabriel Thomé
b5213664fa feat: allow punctuation characters in context menus (#8783)
Co-authored-by: Gabriel Thomé <114624098+gabriel-thome-GVNG@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-31 12:28:29 +00:00
advaith
6e348ffd1d docs(MessageReplyOptions): remove duplicate stickers field (#8766)
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
2022-10-31 11:39:27 +00:00
DD
e7cbc1bf11 fix(BaseRedisBroker): proper import path to lua script (#8776)
* fix(BaseRedisBroker): proper import path to lua script

* chore: fix tests

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-27 19:47:00 +00:00
Almeida
53d8e87d7f fix: censor token in debug output (#8764)
Co-authored-by: Aura Román <kyradiscord@gmail.com>
2022-10-27 12:50:11 +00:00
Ryan Munro
fc10774461 feat: allow deletion of ephemeral messages (#8774)
* feat: allow deletion of ephemeral messages

* fix: restore missing key

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-27 11:22:12 +00:00
hackermon
68d5712dea fix: make ratelimit timeout require event loop to be active (#8779)
* fix issue with ratelimits not working correctly

related to #8757

The ``ref`` option doesn't require the Node.js event loop to remain active when waiting for the timeout causing the program to end if there isn't an active gateway connection.

* Update packages/rest/src/lib/handlers/SequentialHandler.ts

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

* Update packages/rest/src/lib/handlers/SequentialHandler.ts

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

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2022-10-23 10:45:02 +00:00
iCrawl
b2658ce504 chore: update eslint-config-neon 2022-10-20 03:39:38 +02:00
iCrawl
3cc50b9e95 chore: deps 2022-10-20 03:11:41 +02:00
iCrawl
c0e3629f64 ci: properly cache yarn deps 2022-10-20 02:52:59 +02:00
iCrawl
7083df7cef fix: styling and separation border for enums/interfaces 2022-10-17 23:40:34 +02:00
Synbulat Biishev
caeb1cbfdb feat(GuildChannelManager): add .addFollower() method (#8567)
* feat(GuildChannelManager): add `.addFollower()` method

* docs: dpply suggestions

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

* fix: resolve from `GuildChannelManager`

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

* types: correct channel type

* docs: update description

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

* docs: update description

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

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: A. Román <kyradiscord@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-16 16:04:30 +00:00
iCrawl
4f3c13628e fix: include brokers readme 2022-10-14 23:46:35 +02:00
iCrawl
94097d365a fix: default to main for stable selection 2022-10-14 23:38:08 +02:00
iCrawl
8af0b38b6c fix: fallback to main 2022-10-14 23:29:37 +02:00
Jiralite
66097e0cb0 chore: Bump discord-api-types (#8752) 2022-10-14 23:20:26 +02:00
DD
bf9aa1858d feat: @discordjs/brokers (#8548) 2022-10-13 22:20:36 +02:00
Jiralite
179392d6d7 docs: Remove unused imports (#8744) 2022-10-13 00:24:04 +02:00
Almeida
ea807e3eed chore: remove downlevel-dts dependency from template (#8743) 2022-10-12 18:47:51 +00:00
Jiralite
ef29b5e51f chore: Redirect voice examples to the new repository (#8737) 2022-10-12 12:27:02 +02:00
Almeida
cb3826ce6d refactor(Embed): use embedLength function from builders (#8735) 2022-10-12 11:39:28 +02:00
Almeida
d7a45a0567 chore: update api-extractor configurations (#8738) 2022-10-12 11:38:14 +02:00
Suneet Tipirneni
49b91315f7 fix: extract text from link tags for descriptions (#8739) 2022-10-12 11:37:07 +02:00
StarkRights
5ffabb119f fix: voice postbuild script (#8741) 2022-10-12 11:35:55 +02:00
iCrawl
eb46e3a5ad feat: add model description to open-graph 2022-10-11 16:12:16 +02:00
iCrawl
e8f63617a2 chore: deps 2022-10-11 16:01:45 +02:00
Suneet Tipirneni
b05be9ec08 feat(website): Add utility for resolving summaries for json items (#8734) 2022-10-11 16:01:32 +02:00
iCrawl
9d8179c6a7 fix: pin @types/node version
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/62629#issuecomment-1273892057
2022-10-11 14:32:38 +02:00
iCrawl
f92be4fb94 refactor: simplify path logic 2022-10-11 11:13:25 +02:00
iCrawl
c39faa94f6 chore: cleanup code 2022-10-11 09:36:36 +02:00
iCrawl
7b7cc6fde4 fix: localhost url for og:image 2022-10-11 08:54:07 +02:00
iCrawl
05fbe992e3 feat: og generation for models 2022-10-11 08:46:22 +02:00
iCrawl
698983b203 chore: deps 2022-10-11 04:09:02 +02:00
iCrawl
8b7ce2b61d feat: inline code highlight 2022-10-11 04:06:14 +02:00
iCrawl
e17323c15c fix: only include used fonts 2022-10-11 03:51:46 +02:00
iCrawl
f75f13d75b feat: add og image gen 2022-10-11 03:34:29 +02:00
Almeida
d587467a38 chore: use @link instead of markdown link in tsdocs (#8732)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-10 20:03:35 +00:00
iCrawl
5bfb61d5b8 ci: fix documentation workflow 2022-10-10 21:38:11 +02:00
iCrawl
c5d5840fef chore(discord.js): release discord.js@14.6.0 2022-10-10 19:20:16 +02:00
iCrawl
a4bf975f49 chore(ws): release @discordjs/ws@0.4.1 2022-10-10 19:19:21 +02:00
DD
c2b677759b fix(WebSocketShard): dispatch race condition (#8731) 2022-10-10 19:15:04 +02:00
MrMythicalYT
ac83ada306 types: fix events augmentation (#8681) 2022-10-10 19:14:49 +02:00
Almeida
02ffce8173 chore: make 'Note to developers' on version constant a regular comment (#8730)
chore: make 'Note to developers' a regular comment

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-10 14:42:03 +00:00
Almeida
caba122d20 fix: app paths (#8729) 2022-10-10 16:30:05 +02:00
RedGuy12
7b8966bca1 feat(Util): escape more markdown characters (#8701)
* feat(Util): escape more markdown characters

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

* types(EscapeMarkdownOptions): update types

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

* fix: lists bulleted with `*`

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

* tests(escapeMarkdown): add tests

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

Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-10 05:23:05 +00:00
iCrawl
3ed668e539 chore: move website and guide out of packages 2022-10-10 01:22:48 +02:00
NaeHyeok Jeong
0a9d57b011 chore: change token in readme to constant (#8688)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-09 21:27:46 +00:00
JPBM135
a31e605e09 docs(Utils): remove private from parseEmoji (#8718)
chore(Utils): remove `private` from `parseEmoji`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-09 21:19:53 +00:00
Cit The Dev
7556db243d docs: update UserContextMenuCommandInteraction documentation (#8717)
* Updated documentation for UserContextMenuCommandInteraction class

* Apply suggestions from code review

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

Co-authored-by: Noel <buechler.noel@outlook.com>
Co-authored-by: A. Román <kyradiscord@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-09 20:39:05 +00:00
Idris
4c2955a5de fix(ClientOptions): make ClientOptions#intents returns an IntentsBitField (#8617)
* fix(ClientOptions): make ClientOptions#intents returns an instance of IntentsBitField

* fix: client.options

* fix(types): Client#options

* fix(WebSocketShard): remove require for IntentsBitField

* fix(eslint): yarn format
2022-10-09 20:05:50 +00:00
iCrawl
5f72d8b645 fix: website fonts 2022-10-09 02:10:35 +02:00
iCrawl
a5d2ce2059 fix: alert component text selection 2022-10-09 01:23:54 +02:00
Ryan Munro
e548e6a10b fix: correctly construct a builder (#8727) 2022-10-09 01:07:12 +02:00
1Computer1
6fd331dd52 fix(Components): error with unknown components (#8724) 2022-10-09 01:06:37 +02:00
iCrawl
32297d4717 feat: prefetch pages for better navigation 2022-10-09 01:03:44 +02:00
Suneet Tipirneni
1b4f69b00a feat(guide): add github links for pages (#8725) 2022-10-09 00:58:28 +02:00
iCrawl
1ea7664aa3 fix: remove turbo experiment again 2022-10-09 00:19:53 +02:00
iCrawl
723c0b9b55 fix: 404 not resolving 2022-10-08 23:59:47 +02:00
iCrawl
f0dd41fc93 build: compress prod build 2022-10-08 23:27:07 +02:00
iCrawl
b6c0ab8a41 feat: implement turbo for navigation 2022-10-08 22:49:56 +02:00
iCrawl
6120971ef8 fix: height styling on toc 2022-10-08 22:34:45 +02:00
iCrawl
87ec3922a3 chore: update readmes 2022-10-08 17:55:01 +02:00
iCrawl
3f006cd33c build: fix cliff-jumper config 2022-10-08 17:32:07 +02:00
iCrawl
4bdd120e62 chore: deps 2022-10-08 16:55:34 +02:00
iCrawl
c0ea782dd4 chore(ws): release @discordjs/ws@0.4.0 2022-10-08 16:37:07 +02:00
iCrawl
ca21dc0f3b chore(voice): release @discordjs/voice@0.13.0 2022-10-08 16:36:59 +02:00
iCrawl
4a57b3947a chore(rest): release @discordjs/rest@1.3.0 2022-10-08 16:36:35 +02:00
iCrawl
41d1c2eefc chore(proxy): release @discordjs/proxy@1.2.0 2022-10-08 16:36:20 +02:00
iCrawl
60c70389a4 chore(collection): release @discordjs/collection@1.2.0 2022-10-08 16:35:58 +02:00
iCrawl
f06d12fd73 chore(builders): release @discordjs/builders@1.3.0 2022-10-08 16:34:30 +02:00
iCrawl
dc31b76465 ci: update workflow for tags 2022-10-08 16:33:37 +02:00
iCrawl
ba90f14f9b feat: auto-link headings 2022-10-08 15:44:00 +02:00
iCrawl
7b76b0b7e7 fix: proper root margin values for intersection observer 2022-10-08 14:31:26 +02:00
iCrawl
63939f8219 feat: automatic hash for anchors on scroll 2022-10-08 14:04:00 +02:00
Suneet Tipirneni
33ec49d5bf feat(guide): add outline for pages (#8722)
Co-authored-by: iCrawl <buechler.noel@outlook.com>
2022-10-08 05:15:02 +02:00
Jeroen Claassens
d923d0ab96 build: switch to esbuild-plugin-version-injector for injecting version strings (#8723) 2022-10-08 02:54:45 +02:00
iCrawl
62332c2720 chore: deps 2022-10-07 20:26:45 +02:00
Parbez
7af3c3b6f1 fix: ws package.json path (#8720) 2022-10-07 19:42:04 +02:00
iCrawl
5730866073 feat: alert & discord components 2022-10-07 17:49:03 +02:00
Parbez
9f68d73706 fix: cliff.toml styling (#8716) 2022-10-07 13:57:48 +02:00
Noel
0ac3e766bd feat: web-components (#8715) 2022-10-07 06:56:13 +02:00
iCrawl
76a7021452 chore: deps 2022-10-07 02:49:44 +02:00
iCrawl
103cb16be0 refactor: improve deprecation block 2022-10-07 02:45:04 +02:00
iCrawl
baa6c69835 refactor: improve tips/warnings 2022-10-07 02:44:28 +02:00
Suneet Tipirneni
f85022162d feat(scripts): Add script to create a @discordjs package (#8711) 2022-10-07 02:38:58 +02:00
iCrawl
35bfba0c50 fix: info and caution components 2022-10-07 01:14:49 +02:00
iCrawl
ecfe4e3f1c fix: index page 2022-10-07 00:33:41 +02:00
Noel
2628659747 feat: astro guide (#8714) 2022-10-06 23:53:35 +02:00
ckohen
01d75c8b8b fix(Client): don't auth for webhook fetches with token (#8709)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-06 19:43:00 +00:00
iCrawl
b64d657241 chore: removing building website from pre-commit 2022-10-06 12:36:26 +02:00
Almeida
7e51ea0ada chore(util): add missing cliff-jumper config file (#8707) 2022-10-06 12:11:19 +02:00
Almeida
aec44a0c93 refactor: rename Error to DiscordjsError internally (#8706)
* refactor: rename Error to DiscordjsError internally

* chore: remove globalThis usage

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-06 09:21:03 +00:00
iCrawl
e745b95677 chore: deps 2022-10-05 20:57:39 +02:00
Suneet Tipirneni
9effd82abe docs: fix AwaitMessageComponentOptions typedef (#8696)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-05 20:41:36 +02:00
SpaceEEC
628759bcff feat(GuildChannelManager): allow creating channels with a default auto archive duration (#8693) 2022-10-05 20:41:15 +02:00
muchnameless
a306219673 fix: re-export util (#8699) 2022-10-05 20:40:50 +02:00
Suneet Tipirneni
c0f7a1a89a types(Message): remove & this from #inGuild typeguard (#8704) 2022-10-05 20:40:28 +02:00
Julian
a7eab50ee3 fix(WebSocketShard): add ready data parameter to ready event (#8705) 2022-10-05 20:39:05 +02:00
Jiralite
ace974fc1f fix: Throw discord.js errors correctly (#8697)
fix: import errors correctly

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-05 16:16:07 +00:00
iCrawl
d9137c3658 chore: deps 2022-10-04 01:10:35 +02:00
iCrawl
b7fadb350a fix: sidebar menu styling 2022-10-04 01:02:37 +02:00
iCrawl
1f944b889f feat: allow search by tags 2022-10-04 00:47:15 +02:00
iCrawl
b187a18e9c feat: properly build search indicies 2022-10-04 00:46:15 +02:00
iCrawl
0b8651cf85 chore: remove building package docs with old docgen 2022-10-03 14:32:40 +02:00
iCrawl
bf92172d80 chore(util): release @discordjs/util@0.1.0 2022-10-03 14:08:03 +02:00
Suneet Tipirneni
b2ec865765 feat: add @discordjs/util (#8591)
* feat: add @discordjs/util

* fix: builders test

* refactor: make rest use lazy for ESM import

* chore: make requested changes

* Apply suggestions from code review

Co-authored-by: Parbez <imranbarbhuiya.fsd@gmail.com>
Co-authored-by: A. Román <kyradiscord@gmail.com>

* chore: make requested changes and add tests

* chore: regen lockfile

* test: add type tests

* chore: push missing files

* chore: make requested changes

* chore: update CI stuff

* chore: fix lockfile

* chore: make requested changes

Co-authored-by: Parbez <imranbarbhuiya.fsd@gmail.com>
Co-authored-by: A. Román <kyradiscord@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-02 18:00:31 +00:00
SpaceEEC
3f8656115b fix(SequentialHandler): throw http error with proper name and more useful message (#8694)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-01 14:50:18 +00:00
Almeida
883f6e9202 feat(ForumChannel): add defaultSortOrder (#8633) 2022-10-01 14:00:30 +00:00
Almeida
2ea2a85e63 types(ModalBuilder): fix constructor typings (#8690)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-01 13:53:56 +00:00
DD
f063625836 fix(proxyRequests): forward query parameters (#8691)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-01 13:46:52 +00:00
DD
6398e46043 chore(proxy-container): update README for proper request forwarding (#8692)
* chore(proxy-container): update README for proper request forwarding

* chore: remove unused import

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-01 13:40:24 +00:00
Almeida
d24dbf7d22 chore(deps): bump discord-api-types (#8685) 2022-10-01 13:30:19 +00:00
A. Román
3c231ae81a feat: add AbortSignal support (#8672)
* feat: add `AbortSignal` support

* fix: move the expect earlier

* fix: pass signal

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-25 18:44:03 +00:00
iCrawl
9f63eb977f chore(discord.js): release discord.js@14.5.0 2022-09-25 19:17:25 +02:00
iCrawl
c69f512450 chore(rest): release @discordjs/rest@1.2.0 2022-09-25 19:11:48 +02:00
iCrawl
4a07f9eaa1 chore: deps 2022-09-25 19:08:39 +02:00
Khafra
64cd53c4c2 feat(rest): use Agent with higher connect timeout (#8679)
* feat(rest): use Agent with higher connect timeout

* chore: lint

* chore: I'm an idiot

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-25 12:45:36 +00:00
MrMythicalYT
d79aa2d0d0 docs: fix duplicate typedefs (#8677)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-25 11:46:10 +00:00
Rodry
822b7f234a types(Collection): make fn return type unknown (#8676)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-25 11:40:58 +00:00
Jiralite
8ca407e089 docs(ForumChannel): Add @implements (#8678) 2022-09-25 13:27:56 +02:00
Jiralite
0126d9b810 fix(ThreadChannel): Add forum channel to parent (#8664)
fix(ThreadChannel): add forum channel to parent

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-24 14:51:11 +00:00
Jiralite
e9931229ae refactor(GuildBanManager): Add deprecation warning for deleteMessageDays (#8659)
refactor(GuildBanManager): add deprecation warning for `deleteMessageDays`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-24 14:45:30 +00:00
Jiralite
1486bc9336 types(GuildChannelManager): Handle forum channel overload (#8660)
types(GuildChannelManager): handle forum channel overload

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-24 14:40:19 +00:00
Almeida
16fcdc3687 fix(GuildChannelManager): allow creating webhooks on forums (#8661)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-24 14:34:19 +00:00
Jiralite
8622939229 fix(ForumChannel): Implement missing properties and methods (#8662)
* fix(ForumChannel): implement missing properties and methods

* refactor(ForumChannel): remove redundant default

* docs(ForumChannel): remove superfluous wording

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-24 14:28:42 +00:00
Jiralite
2487e3bf76 types(Caches): Allow GuildForumThreadManager and GuildTextThreadManager (#8665)
types: allow `GuildForumThreadManager` and `GuildTextThreadManager`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-24 14:14:43 +00:00
Maksi
578bc951bd fix: RepliableInteraction respect cached generic (#8667)
* fix: RepliableInteraction respect cached generic

* fix: prettier format

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

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

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-24 14:09:24 +00:00
Jiralite
1244854e13 fix(ThreadChannel): Allow editing flags (#8671)
fix(ThreadChannel): allow editing flags

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-24 14:02:30 +00:00
Almeida
b1e190c4f0 fix: allow adding forums to channelTypes (#8658)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-24 13:37:41 +00:00
Jaworek
fc8ed816e6 fix(GuildChannelManager): typo in flags property name when editing (#8669)
* Update GuildChannelManager.js

* Update index.d.ts

* Update GuildChannelManager.js

* Update index.d.ts
2022-09-23 20:20:46 +00:00
Almeida
abb7226af3 feat(GuildChannelManager): allow editing flags (#8637)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-21 22:00:06 +00:00
iCrawl
30ceaf7e47 chore: deps 2022-09-21 18:46:51 +02:00
iCrawl
9b40a79b3e fix: focus-ring styles 2022-09-21 15:46:44 +02:00
iCrawl
0b12d6fa10 chore(discord.js): release discord.js 14.4.0 2022-09-21 14:09:39 +02:00
Jiralite
b106956308 feat(Widget): Allow forum channels (#8645) 2022-09-21 02:57:32 +02:00
Jiralite
6f1f465a77 feat(WelcomeChannel): Add forum channel as a type (#8643) 2022-09-21 02:57:18 +02:00
Almeida
eb98372dcd chore: fix proxy-container Dockerfile (#8648) 2022-09-21 02:56:47 +02:00
Jiralite
5048a3d17a feat: Allow forum channels in webhook update event (#8646)
feat: allow forum channels in webhook update event
2022-09-20 11:51:34 +00:00
Jiralite
f0497343f1 docs: Correctly overwrite setRTCRegion method (#8642)
docs: correctly overwrite `setRTCRegion` method

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-19 21:07:58 +00:00
Jiralite
f6f15d8e87 fix: Correct applied tags type (#8641)
* fix: correct applied tags type

* types: this is never a private thread channel

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-19 21:02:36 +00:00
Jiralite
14bbc9150a types: Narrow channel type in thread managers (#8640)
types: narrow channel type in thread managers

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-19 20:00:59 +00:00
Jiralite
a7f816eeb7 fix(ThreadChannel): Make fetchStarterMessage() work in forum posts (#8638)
fix(ThreadChannel): make `fetchStarterMessage()` work in forum posts

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-19 19:55:33 +00:00
Jiralite
802b2394b0 docs(GuildTextThreadManager): Document correct @extend (#8639)
docs(GuildTextThreadManager): document correct `@extend`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-19 19:50:18 +00:00
iCrawl
c446a84570 build: trigger rebuild 2022-09-19 15:40:57 +02:00
iCrawl
9cf0a4904b chore: patch all versions of tsdoc-config 2022-09-19 15:35:29 +02:00
iCrawl
25dc146247 build: revert to using patch 2022-09-19 15:13:22 +02:00
iCrawl
a2b08aaf3b build: different import for schema 2022-09-19 14:53:57 +02:00
iCrawl
eba9cc6038 chore: deps 2022-09-19 14:41:43 +02:00
Almeida
145eb2fc5d fix: update messageCount/totalMessageSent on message events (#8635)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-19 00:38:23 +00:00
Almeida
8444576f45 docs(builders/components): document constructors (#8636) 2022-09-19 02:32:28 +02:00
iCrawl
6d43e26676 fix: border color in dark mode 2022-09-18 20:27:04 +02:00
iCrawl
2fc3d86f56 feat: searchbar 2022-09-18 20:16:50 +02:00
Suneet Tipirneni
8a8d519c9c feat: add support for guild forums (#7791)
* feat: add support for guild forums

* feat(webhook): add support for creating forum channel posts

* fix: duplicated docs

* feat: add support for message counts

* feat: add support for latest upstream changes

* fix: serialize forum channels

* types: fix channel unions

* types: fix tests

* types: fix tests (again)

* types: fix tests (again (again))

* chore: make requested changes

* chore: fix bugs and make requested changes

* types: use correct type for guild forum start messages

* chore: remove console.log

* chore: make requested changes

* chore: make requested changes

* chore: fix docs

* Update packages/discord.js/src/managers/GuildForumThreadManager.js

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

* chore: update types

* chore: make requested changes

* chore: Apply suggestions

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

* fix: import `ErrorCodes`

* fix: remove defunct code

* refactor: be consistent with channel class names

* feat(GuildChannel): add flags

* fix: rename file

* refactor: channel flags are everywhere!

* fix: import flags correctly

* chore(ThreadChannel): update message count string

* docs(Channels): correct `@param` type

* docs(Channels): ignore transformGuildDefaultReaction

* refactor: emoji object in tags

* chore: renaming consistency

* fix: document default reaction emojis in patching

* fix(GuildChannelManager): document `defaultThreadRateLimitPerUser`

* chore: semicolon

* docs(ErrorCodes): document `GuildForumMessageRequired`

* refactor: transform default reactions

* docs(APITypes): Add `ChannelFlags`

* fix: convert tags properly

* fix: pass an array of snowflakes

* refactor: handle flags better

* fix(ThreadChannel): receive tags

* fix(PartialGroupDMChannel): nullify `flags`

Apparently did not do this earlier.

* chore: misc sorting

* refactor: nullify emoji on tags if not present

* refactor(ForumChannel): modify returns

* types: protect the thread manager!

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

* chore: update `ChannelType` usage

* Update index.d.ts

* docs: Update default reaction emoji property names

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

* fix: only `name` is required when editing tags

- discord/discord-api-docs#5458

* types: add tests for `channel.flags`

* fix: allow unsetting the default reaction emoji

* refactor: remove v13 remnants

* docs: add missing closing tag

* feat: add `rateLimitPerUser`

* feat: add missing properties for create guild channel

- discord/discord-api-docs#5474

* refactor(GuildForumThreadManager): refactor message payload

* fix: handle magical `null` case

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

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Jaworek <jaworekwiadomosci@gmail.com>
Co-authored-by: Jonathan Rubenstein <jrubcop@gmail.com>
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: A. Román <kyradiscord@gmail.com>
2022-09-18 14:23:44 +00:00
Almeida
669c3cd256 refactor: replace usage of deprecated ChannelTypes (#8625)
refactor: use new non-deprecated `ChannelType`s

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-17 13:56:19 +00:00
Suneet Tipirneni
678ceaa014 feat(website): use dropdowns for overloads (#8630)
Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: iCrawl <buechler.noel@outlook.com>
2022-09-17 14:09:54 +02:00
iCrawl
0785353efe fix: footer hiding properly 2022-09-17 00:31:28 +02:00
iCrawl
8323926304 fix: overflow in cmdk menu 2022-09-17 00:30:15 +02:00
iCrawl
bccc2c8e89 refactor: light theme for cmdk 2022-09-16 23:42:01 +02:00
iCrawl
1d72663e92 fix: allow usage of ctrl key additionally to metakey 2022-09-16 23:27:44 +02:00
iCrawl
d0a2a6227d fix: prevent default for cmd+k 2022-09-16 23:17:05 +02:00
iCrawl
735e0bf52e feat: search 2022-09-16 23:04:05 +02:00
Almeida
1c5b78fd21 fix(SlashCommandBuilder): missing methods in subcommand builder (#8583) 2022-09-15 20:19:13 +02:00
Almeida
053da5bc91 types(interactions): pass Cached type to return type of methods (#8619) 2022-09-15 20:18:48 +02:00
RedGuy12
fc9653f5ae docs: fix regexps incorrectly being called global (#8624) 2022-09-15 20:15:01 +02:00
Almeida
22ac6b4660 docs: update misleading Client#guildMemberAvailable event description (#8626) 2022-09-15 20:13:55 +02:00
iCrawl
d14d47b62f chore: dep cleanup 2022-09-12 18:46:15 +02:00
Jiralite
a9f003ac9b types: Ensure events possess Client<true> (#8612)
types: ensure events possess `Client<true>`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-11 18:36:24 +00:00
RedGuy12
1d4cdee321 types(GuildChannelManager): correct fetch return type (#8549)
* types(GuildChannelManager): correct `fetch` return type

* fix(ci): fix the types tests

* fix: fix the docs

* Update packages/discord.js/src/managers/GuildChannelManager.js

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

* types: allow channels in the collection to be null

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

* style: run prettier

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

* test: fix types again

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

* style: run prettier

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

Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-11 18:29:28 +00:00
Jiralite
8e1afaebdb refactor: Split message send/edit types/documentation (#8590)
* refactor: split message send/edit types

* refactor: move `MessageEditOptions`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-11 18:22:53 +00:00
advaith
32523325c6 docs(Options): update DefaultMakeCacheSettings (#8585)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-11 18:16:34 +00:00
iCrawl
7a9e52e63a fix: tiny screen cmdk size 2022-09-09 21:55:35 +02:00
iCrawl
d11edc6397 fix: build script for website 2022-09-09 00:23:42 +02:00
iCrawl
96304d7cc8 feat: command menu 2022-09-09 00:08:59 +02:00
iCrawl
f9e9bfdedc chore: deps 2022-09-09 00:07:56 +02:00
iCrawl
ce1f5c8d47 feat: redirect to old docs for main documentation 2022-09-08 17:05:13 +02:00
advaith
03fb5b0a2f feat(GuildBanManager#create): add deleteMessageSeconds (#8326)
* feat(GuildBanManager#create): add `deleteMessageSeconds`

* Apply suggestions from code review

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

* chore: remove typeof and return undefined if neither are set

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-08 13:15:01 +00:00
RedGuy12
ce991dd1d8 test: rename incorrect test (#8596) 2022-09-08 15:08:28 +02:00
Parbez
dbca93098c chore: remove unused eslint disable comments (#8595) 2022-09-08 15:08:04 +02:00
A. Román
dd5a08944c docs: change name (#8604) 2022-09-08 01:46:41 +02:00
iCrawl
8e98ba94d2 fix: properly center badge text 2022-09-07 22:57:35 +02:00
iCrawl
74dc8c10d5 fix: hide menu on click 2022-09-07 19:19:58 +02:00
iCrawl
8d07ea9a62 fix: dark/light theme fixes 2022-09-07 18:39:02 +02:00
iCrawl
d8e774138d fix: accessibility improvements 2022-09-07 11:29:58 +02:00
Maksi
55c3ee20ae feat: add typeguard to BaseInteraction#isRepliable (#8565)
* feat: add typeguard to BaseInteraction#isRepliable

* fix: redefine RepliableInteraaction

...to exclude impossible interactions rather than specify possible ones

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

* fix: remove InteractionResponseFields

* fix: replace InteractionResponseFields with RepliableInteraction in index test

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-06 17:56:21 +00:00
Noel
c3341570d9 refactor: website components (#8600) 2022-09-06 19:48:33 +02:00
Almeida
f3ce4a75d0 docs: use remarks instead of Note in descriptions (#8597) 2022-09-05 18:14:19 +02:00
iCrawl
4ffdada4f7 chore: deps 2022-09-04 19:33:57 +02:00
Almeida
8b3d006118 feat(Integration): add scopes (#8483) 2022-09-04 08:11:27 +00:00
Almeida
d08a57cadd feat: add chatInputApplicationCommandMention formatter (#8546)
feat: add `chatInputApplicationCommandMention()` formatter

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-03 07:17:06 +00:00
iCrawl
0dc68445a1 refactor: open graph fixes 2022-09-03 05:02:16 +02:00
iCrawl
a7ad7e75ce feat: open graph 2022-09-03 04:48:33 +02:00
Suneet Tipirneni
f79ccb4971 chore(website): bump api-extractor-model (#8584) 2022-09-03 01:14:00 +02:00
iCrawl
6f2b223c8b refactor: extract create model function 2022-09-03 01:01:40 +02:00
iCrawl
a4777aa9b0 feat: add naive client-based search 2022-09-03 00:42:34 +02:00
iCrawl
f072d3d916 feat: redirect to latest version, otherwise click select version button 2022-09-02 22:42:12 +02:00
iCrawl
0238588067 build: fix website build 2022-09-02 22:07:19 +02:00
iCrawl
1d460e0434 chore: deps 2022-09-02 21:48:05 +02:00
RedGuy12
b9c62ac0f0 types(ThreadChannel): fetchStarterMessage must return a Message<true> (#8560)
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>

Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-02 18:44:39 +00:00
iCrawl
df46ab8061 build: tsup for better cjs / esm support 2022-09-02 18:08:16 +02:00
A. Román
b7eb96d456 types(interactions): fix {Slash,ContextMenu}CommandBuilder#toJSON (#8568) 2022-09-02 17:31:25 +02:00
D Trombett
f77612a55e types(webhook): avatar can be null (#8541) 2022-09-02 15:30:06 +00:00
Suneet Tipirneni
9b4116b659 chore(website): put seperators between properties (#8576) 2022-09-02 17:20:57 +02:00
Almeida
8a91d7c256 fix: docgen (#8582) 2022-09-01 22:04:58 +02:00
iCrawl
3b7ba4062e chore: fix leftover eslint exceptions 2022-09-01 21:26:09 +02:00
Suneet Tipirneni
edadb9fe5d refactor: use eslint-config-neon for packages. (#8579)
Co-authored-by: Noel <buechler.noel@outlook.com>
2022-09-01 20:50:16 +02:00
Parbez
4bdb0593ae chore: bump typescript-eslint to support ts 4.8 (#8573) 2022-08-30 22:23:00 +02:00
iCrawl
fd97da9b6c chore: missing config files 2022-08-29 21:48:12 +02:00
Suneet Tipirneni
d5dcddd350 feat: add util package for generating search indices (#8571) 2022-08-29 21:41:51 +02:00
Suneet Tipirneni
40324574eb docs: remove xml tag from collection#find (#8550) 2022-08-29 18:05:30 +02:00
A. Román
1398af66f0 chore(github): resolved typos in issue templates (#8564) 2022-08-29 18:04:37 +02:00
iCrawl
682e0e1802 fix: don't prefetch as links enter viewport 2022-08-26 12:00:25 +02:00
iCrawl
13baf75cae chore: return error 2022-08-24 06:09:39 +02:00
iCrawl
1d6b31b78d fix: revalidate on notFound 2022-08-24 05:42:43 +02:00
iCrawl
5f093dde24 chore: log errors as errors 2022-08-24 05:36:10 +02:00
iCrawl
b58e6a65ad fix: don't throw on not serializable kind 2022-08-24 05:23:03 +02:00
iCrawl
204f4dd7c4 chore: some logging 2022-08-23 22:37:19 +02:00
iCrawl
249ba0a9a6 refactor: contrast & colors 2022-08-23 21:31:38 +02:00
iCrawl
92933c2b61 refactor: memoize everything 2022-08-23 19:39:31 +02:00
iCrawl
abd3fc8ceb fix: properly 404 and revalidate 2022-08-23 18:53:38 +02:00
iCrawl
84059b6b25 fix: affix position when ToC is visible 2022-08-23 17:32:03 +02:00
iCrawl
6da405668f chore: just in case 2022-08-23 17:30:26 +02:00
iCrawl
58d2a1e6d7 chore: deps 2022-08-23 15:17:17 +02:00
iCrawl
7b5c688844 fix: mobile centering 2022-08-23 14:21:48 +02:00
iCrawl
28bc4f42c6 feat: light theme code blocks 2022-08-23 14:00:02 +02:00
iCrawl
5b4672bad3 refactor: css 2022-08-23 13:21:32 +02:00
iCrawl
a57b9ba5c4 refactor: mobile layout for badges 2022-08-23 12:54:40 +02:00
iCrawl
32da9b3868 fix: footer and sidebar mobile spacing 2022-08-23 12:06:18 +02:00
iCrawl
70806b401e style: type import 2022-08-23 12:01:48 +02:00
iCrawl
0674820723 style: spacing 2022-08-23 11:20:08 +02:00
iCrawl
2d5bce274c fix: footer on mobile 2022-08-23 11:13:39 +02:00
iCrawl
331dedcb9d refactor: front page 2022-08-23 10:57:34 +02:00
iCrawl
103e1bd843 feat: add footer links 2022-08-23 10:11:07 +02:00
iCrawl
ffafde0b6b refactor: make dark theme the default 2022-08-23 09:36:19 +02:00
iCrawl
28422eea58 fix: spacing of footer and affix 2022-08-23 09:15:33 +02:00
iCrawl
c826ad3ade feat: markdown syntax highlighting 2022-08-23 08:48:44 +02:00
iCrawl
17559becef refactor: change radius 2022-08-23 08:18:36 +02:00
iCrawl
b31a23b37c build: "no default export" 2022-08-23 08:01:09 +02:00
iCrawl
8e4f77a63b build: use module 2022-08-23 07:55:41 +02:00
iCrawl
b16ab8c69f fix: check if router is ready before using its path 2022-08-23 07:07:22 +02:00
iCrawl
cf8570c19c style: spacing on mobile 2022-08-23 07:05:48 +02:00
iCrawl
f0ab393411 fix: use correct icon on version select 2022-08-23 05:22:18 +02:00
iCrawl
11e02f1e5d refactor: include item kind into url 2022-08-23 05:13:53 +02:00
iCrawl
206523587a refactor: split out package constant 2022-08-23 04:20:41 +02:00
iCrawl
ac3bc6a2db style: spacing 2022-08-23 04:11:12 +02:00
iCrawl
af295acedc fix: wrong active item after anchor select 2022-08-23 03:59:53 +02:00
iCrawl
caa5c0332f feat: add anchor icon 2022-08-23 03:06:21 +02:00
iCrawl
434f696397 refactor: reset state and code cleanup 2022-08-23 02:38:53 +02:00
iCrawl
6062d361fb feat: more fallback cases 2022-08-23 02:13:10 +02:00
iCrawl
2ecb862e76 feat: use fallback with loading 2022-08-23 01:43:10 +02:00
iCrawl
360936140b fix: don't persist state between pages 2022-08-23 01:26:57 +02:00
iCrawl
0b56184ba7 fix: github link and light theme hover nav link 2022-08-23 01:21:28 +02:00
iCrawl
a55545850a refactor: better spacing 2022-08-23 01:02:46 +02:00
iCrawl
f16b11a91d feat: active navigation and back button 2022-08-23 00:44:09 +02:00
iCrawl
0fb2694871 refactor: switch to ssr for unbuilt pages 2022-08-23 00:13:04 +02:00
iCrawl
ee030003ec fix: markdown images and links 2022-08-22 23:58:49 +02:00
iCrawl
29c51be1f4 feat: custom 404 2022-08-22 23:58:33 +02:00
iCrawl
43a78be70b fix: return 404 if a fetch error or no data is returned 2022-08-22 23:29:23 +02:00
iCrawl
92c0c60519 feat: version picker 2022-08-22 23:08:23 +02:00
iCrawl
ba3e0ed348 fix: footer / sidebar / deprecation alert 2022-08-22 22:15:50 +02:00
iCrawl
f7ce9f8533 feat: footer 2022-08-22 21:52:17 +02:00
iCrawl
00990c93ae chore: missing vercel banner 2022-08-22 21:06:34 +02:00
iCrawl
c076b0d8cb fix: don't redirect to the first item 2022-08-22 21:02:15 +02:00
iCrawl
d297fb0b69 feat: readme if no member is selected 2022-08-22 20:51:43 +02:00
iCrawl
24c128d649 feat: experiment with spotlight 2022-08-22 19:44:56 +02:00
iCrawl
ec7c6e3d3e fix: selecting packages on the sidebar 2022-08-22 18:38:07 +02:00
iCrawl
6dfb9bbc48 feat: generate all tags 2022-08-22 18:30:46 +02:00
Suneet Tipirneni
4644e45e85 fix(website): use inter font for titles (#8542)
Co-authored-by: Noel <buechler.noel@outlook.com>
2022-08-22 18:29:26 +02:00
iCrawl
1e001601c8 refactor: change url scheme 2022-08-22 16:50:43 +02:00
iCrawl
1aec243b1d feat: packages route 2022-08-22 16:01:42 +02:00
iCrawl
191951ac28 feat: add ToC to interfaces 2022-08-22 15:38:47 +02:00
iCrawl
4fb4492b17 refactor: icons and head 2022-08-22 15:34:21 +02:00
iCrawl
abb968de81 feat: favicon 2022-08-22 14:57:51 +02:00
iCrawl
d9e53093f5 fix: properly check for properties and methods 2022-08-22 14:32:59 +02:00
iCrawl
e5678f4656 feat: list properties and method in table of content 2022-08-22 14:30:15 +02:00
iCrawl
9f18036078 fix: hydration error 2022-08-22 14:29:31 +02:00
iCrawl
474eae0afc style: change how optionals are displayed 2022-08-22 14:19:02 +02:00
iCrawl
caeb66e150 fix: overflowing content 2022-08-22 14:12:53 +02:00
iCrawl
7623fc552e ci: don't double check inputs 2022-08-22 12:11:45 +02:00
iCrawl
230c43e97d build: fix downlevel-dts 2022-08-22 11:29:57 +02:00
iCrawl
4e3fa586b5 chore(discord.js): release discord.js@14.3.0 2022-08-22 10:56:30 +02:00
Jiralite
6bb1474d20 types: Inference of guild in MessageManager (#8538)
* types: better inference of message manager

* types: alter helper methods

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-08-22 08:31:02 +00:00
iCrawl
27bbc8fe68 chore(builders): release @discordjs/builders@1.2.0 2022-08-22 10:10:19 +02:00
iCrawl
e2cde5daa0 chore(collection): release @discordjs/collection@1.1.0 2022-08-22 10:08:38 +02:00
iCrawl
0960457108 chore: update proxy and rest in proxy-container 2022-08-22 10:07:22 +02:00
iCrawl
cd6b365b17 chore: changelog 2022-08-22 10:06:49 +02:00
835 changed files with 33957 additions and 15882 deletions

View File

@@ -20,19 +20,37 @@ dist/
# Miscellaneous
.tmp/
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
.idea/
.DS_Store
.turbo
tsconfig.tsbuildinfo
coverage/
__tests__/
# yarn
.pnp.*
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
# Cache
.prettiercache
.eslintcache
# Docker specific
.cliff-jumperrc.json
api-extractor.json
.eslintrc.json
.lintstagedrc.cjs
.lintstagedrc.cjs
.prettierignore
.prettierrc.js
.prettierrc.cjs
cliff.toml
CHANGELOG.md
README.md
tsconfig.eslint.json
docs/

View File

@@ -1,9 +1,12 @@
{
"root": true,
"extends": "marine/prettier/node",
"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

View File

@@ -16,3 +16,33 @@ To get ready to work on the codebase, please do the following:
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))
## Testing changes locally
If you want to test changes you've made locally, you can do so by using `yarn link`. This will create a symlink to your local copy of the discord.js libraries.
1. Create a new directory `mkdir discordjs-test` and move into it `cd discordjs-test`
2. Initialize a new yarn 3 project `yarn init -2`
3. Disable pnp `yarn config set nodeLinker node-modules`
4. Now link the local discord.js project you cloned earlier `yarn link -A {PATH_TO_DISCORDJS_REPO}`
5. Install packages you'd like to test locally `yarn add discord.js@latest`, `yarn add @discordjs/rest@latest`, etc. **Note: Make sure you use `latest` tag or else yarn will try to install the remote package from npm**
6. Import the package in your source code and test them out!
### Working with TypeScript packages
When testing local changes, you may notice you need to manually recompile TypeScript projects on every change in order to get the latest code changes to test locally.
To avoid this you can use the `--watch` parameter in the package build script to automatically recompile the project when changes are detected.
For example, to automatically recompile the `@discordjs/rest` project when changes are detected, run `yarn turbo run build --filter=@discordjs/rest -- --watch` in the root folder of where you cloned the discord.js repo.
## 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.

View File

@@ -12,11 +12,14 @@ body:
label: Which package is this bug report for?
options:
- discord.js
- brokers
- builders
- collection
- rest
- core
- formatters
- proxy
- proxy-container
- rest
- voice
- ws
validations:
@@ -52,7 +55,7 @@ body:
id: djs-version
attributes:
label: Package version
description: Which version of are you using? Run `npm list <package>` in your project directory and paste the output.
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
validations:
required: true
@@ -131,6 +134,8 @@ body:
- DirectMessageTyping
- MessageContent
- GuildScheduledEvents
- AutoModerationConfiguration
- AutoModerationExecution
multiple: true
validations:
required: true

View File

@@ -5,7 +5,7 @@ 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
@@ -14,11 +14,14 @@ body:
label: Which package is the feature request for?
options:
- discord.js
- brokers
- builders
- collection
- rest
- core
- formatters
- proxy
- proxy-container
- rest
- voice
- ws
validations:

51
.github/labeler.yml vendored
View File

@@ -1,39 +1,48 @@
'packages:builders':
apps:guide:
- apps/guide/*
- apps/guide/**/*
apps:website:
- apps/website/*
- apps/website/**/*
packages:brokers:
- packages/brokers/*
- packages/brokers/**/*
packages:builders:
- packages/builders/*
- packages/builders/**/*
'packages:collection':
packages:collection:
- packages/collection/*
- packages/collection/**/*
'packages:discord.js':
packages:core:
- packages/core/*
- packages/core/**/*
packages:discord.js:
- packages/discord.js/*
- packages/discord.js/**/*
'packages:docgen':
packages:docgen:
- packages/docgen/*
- packages/docgen/**/*
'packages:proxy':
packages:formatters:
- packages/formatters/*
- packages/formatters/**/*
packages:proxy:
- packages/proxy/*
- packages/proxy/**/*
'packages:proxy-container':
packages:proxy-container:
- packages/proxy-container/*
- packages/proxy-container/**/*
'packages:rest':
packages:rest:
- packages/rest/*
- packages/rest/**/*
'packages:voice':
packages:ui:
- packages/ui/*
- packages/ui/**/*
packages:util:
- packages/util/*
- packages/util/**/*
packages:voice:
- packages/voice/*
- packages/voice/**/*
'packages:website':
- packages/website/*
- packages/website/**/*
'packages:ws':
packages:ws:
- packages/ws/*
- packages/ws/**/*

210
.github/labels.yml vendored
View File

@@ -1,102 +1,116 @@
- 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: apps:guide
color: fbca04
- name: apps:website
color: fbca04
- name: backlog
color: 7ef7ef
- name: backport
color: 88aabb
- 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: 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: discussion
color: b6b1f9
- 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:proxy'
color: 'fbca04'
- name: 'packages:proxy-container'
color: 'fbca04'
- name: 'packages:rest'
color: 'fbca04'
- name: 'packages:voice'
color: 'fbca04'
- name: 'packages:website'
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: in progress
color: ffccd7
- name: in review
color: aed5fc
- name: interactions
color: 80c042
- name: invalid
color: e4e669
- name: need repro
color: c66037
- name: packages:brokers
color: fbca04
- name: packages:builders
color: fbca04
- name: packages:collection
color: fbca04
- name: packages:core
color: fbca04
- name: packages:discord.js
color: fbca04
- name: packages:docgen
color: fbca04
- name: packages:formatters
color: fbca04
- name: packages:proxy
color: fbca04
- name: packages:proxy-container
color: fbca04
- name: packages:rest
color: fbca04
- name: packages:ui
color: fbca04
- name: packages:util
color: fbca04
- name: packages:voice
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

View File

@@ -27,25 +27,20 @@ jobs:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
outputs:
BRANCH_NAME: ${{ steps.env.outputs.BRANCH_NAME }}
BRANCH_OR_TAG: ${{ steps.env.outputs.BRANCH_OR_TAG }}
SHA: ${{ steps.env.outputs.SHA }}
if: github.repository_owner == 'discordjs'
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.ref || '' }}
ref: ${{ inputs.ref || '' }}
- name: Install node.js v16
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn --immutable
uses: ./packages/actions/src/yarnCache
- name: Build dependencies
run: yarn build
@@ -65,13 +60,6 @@ jobs:
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
@@ -79,14 +67,24 @@ jobs:
max-parallel: 1
fail-fast: false
matrix:
package: ['builders', 'collection', 'discord.js', 'proxy', 'rest', 'voice', 'ws']
package:
[
'brokers',
'builders',
'collection',
'core',
'discord.js',
'formatters',
'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 }}
SHA: ${{ needs.build.outputs.SHA }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
@@ -95,10 +93,9 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn --immutable
uses: ./packages/actions/src/yarnCache
- name: Build actions
run: yarn workspace @discordjs/actions build
@@ -123,33 +120,37 @@ jobs:
path: 'out'
- name: Extract package and semver from tag
if: ${{ github.event.inputs.ref_type == 'tag' || env.BRANCH_OR_TAG == 'tag' }}
if: ${{ github.ref_type == 'tag' }}
id: extract-tag
uses: ./packages/actions/src/formatTag
with:
tag: ${{ env.BRANCH_NAME }}
tag: ${{ github.ref_name }}
- name: Move docs to correct directory
if: ${{ (github.event.inputs.ref_type == 'tag' || env.BRANCH_OR_TAG == 'tag') && matrix.package == steps.extract-tag.outputs.package }}
if: ${{ 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}
mv docs/${PACKAGE}/docs/docs.json out/${PACKAGE}/${SEMVER}.json
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: ${{ github.event.inputs.ref_type == 'branch' || env.BRANCH_OR_TAG == 'branch' }}
if: ${{ github.ref_type == 'branch' }}
env:
PACKAGE: ${{ matrix.package }}
run: |
mkdir -p out/${PACKAGE}
mv docs/${PACKAGE}/docs/docs.json out/${PACKAGE}/${BRANCH_NAME}.json
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}/${BRANCH_NAME}.api.json
mv docs/${PACKAGE}/docs/docs.api.json out/${PACKAGE}/${GITHUB_REF_NAME}.api.json
fi
- name: Commit and push
@@ -158,5 +159,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 ${BRANCH_OR_TAG} ${BRANCH_NAME}: ${SHA}" || true
git commit -m "Docs build for ${GITHUB_REF_TYPE} ${GITHUB_REF_NAME}: ${GITHUB_SHA}" || true
git push

View File

@@ -16,12 +16,11 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn --immutable
uses: ./packages/actions/src/yarnCache
- name: Deprecate versions
run: 'yarn npm-deprecate --name "*dev*" --package @discordjs/builders @discordjs/collection discord.js @discordjs/proxy @discordjs/rest @discordjs/voice'
run: 'yarn npm-deprecate --name "*dev*" --package @discordjs/brokers @discordjs/builders @discordjs/collection @discordjs/core @discordjs/formatters discord.js @discordjs/proxy @discordjs/rest @discordjs/util @discordjs/voice @discordjs/ws'
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.3

View File

@@ -10,16 +10,24 @@ jobs:
fail-fast: false
matrix:
include:
- package: '@discordjs/brokers'
folder: 'brokers'
- package: '@discordjs/builders'
folder: 'builders'
- package: '@discordjs/collection'
folder: 'collection'
- package: '@discordjs/core'
folder: 'core'
- package: '@discordjs/formatters'
folder: 'formatters'
- package: 'discord.js'
folder: 'discord.js'
- package: '@discordjs/proxy'
folder: 'proxy'
- package: '@discordjs/rest'
folder: 'rest'
- package: '@discordjs/util'
folder: 'util'
- package: '@discordjs/voice'
folder: 'voice'
- package: '@discordjs/ws'
@@ -38,10 +46,9 @@ jobs:
with:
node-version: 16
registry-url: https://registry.npmjs.org/
cache: 'yarn'
- name: Install dependencies
run: yarn --immutable
uses: ./packages/actions/src/yarnCache
- name: Build dependencies
run: yarn build

View File

@@ -12,28 +12,51 @@ jobs:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
NEXT_PUBLIC_LOCAL_DEV: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install node.js v16
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
uses: ./packages/actions/src/yarnCache
- name: Build dependencies
run: yarn build
- name: Build dependencies (PR)
if: ${{ github.event_name != 'push' }}
run: yarn build --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]"
- name: ESLint
run: yarn lint
- name: Build dependencies (Push)
if: ${{ github.event_name == 'push' }}
run: yarn build --filter="...[HEAD^1]"
- name: Tests
run: yarn test
- name: ESLint (PR)
if: ${{ github.event_name != 'push' }}
run: yarn lint --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]" -- --format=compact
- name: ESLint (Push)
if: ${{ github.event_name == 'push' }}
run: yarn lint --filter="...[HEAD^1]" -- --format=compact
- name: Tests (PR)
if: ${{ github.event_name != 'push' }}
run: yarn test --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]"
- name: Tests (Push)
if: ${{ github.event_name == 'push' }}
run: yarn test --filter="...[HEAD^1]"
- name: Docs (PR)
if: ${{ github.event_name != 'push' }}
run: yarn docs --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]"
- name: Docs (Push)
if: ${{ github.event_name == 'push' }}
run: yarn docs --filter="...[HEAD^1]"
- name: Upload Coverage
if: github.repository_owner == 'discordjs'

3
.gitignore vendored
View File

@@ -27,6 +27,7 @@ dist/
.turbo
tsconfig.tsbuildinfo
coverage/
out/
# yarn
.pnp.*
@@ -39,4 +40,4 @@ coverage/
# Cache
.prettiercache
.eslintcache
.eslintcache

View File

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

View File

@@ -1,5 +1,5 @@
{
"*": "prettier --ignore-unknown --write",
"{src/**,__tests__/**}.{mjs,js,ts}": "eslint --ext mjs,js,ts --fix",
"src/**.ts": "vitest related --run"
"{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"
}

View File

@@ -8,6 +8,8 @@
"eamodio.gitlens",
"christian-kohler.npm-intellisense",
"christian-kohler.path-intellisense",
"antfu.unocss"
"antfu.unocss",
"astro-build.astro-vscode",
"unifiedjs.vscode-mdx"
]
}

12
.vscode/settings.json vendored
View File

@@ -1,11 +1,19 @@
{
"eslint.workingDirectories": [{ "pattern": "./packages/*" }],
"eslint.workingDirectories": [{ "pattern": "./apps/*" }, { "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
},
"unocss.root": "./packages/website",
"editor.trimAutoWhitespace": false,
"files.associations": {
"*.mdx": "markdown"
},
"files.insertFinalNewline": true,
"files.eol": "\n",
"npm.packageManager": "yarn",
"typescript.tsdk": "node_modules/typescript/lib"
}

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

801
.yarn/releases/yarn-3.2.4.cjs vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -8,4 +8,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
yarnPath: .yarn/releases/yarn-3.2.1.cjs
yarnPath: .yarn/releases/yarn-3.2.4.cjs

View File

@@ -66,7 +66,7 @@ const commands = [
},
];
const rest = new REST({ version: '10' }).setToken('token');
const rest = new REST({ version: '10' }).setToken(TOKEN);
(async () => {
try {
@@ -99,32 +99,47 @@ client.on('interactionCreate', async (interaction) => {
}
});
client.login('token');
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.
- [discord.js Discord server](https://discord.gg/djs)
- [Discord API Discord server](https://discord.gg/discord-api)
- [GitHub](https://github.com/discordjs/discord.js)
- [npm](https://www.npmjs.com/package/discord.js)
- [Related libraries](https://discord.com/developers/docs/topics/community-resources#libraries)
- [Website][website] ([source][website-source])
- [Documentation][documentation]
- [Guide][guide] ([source][guide-source])
See also the [Update Guide][guide-update], including updated and removed items in the library.
- [discord.js Discord server][discord]
- [Discord API Discord server][discord-api]
- [GitHub][source]
- [npm][npm]
- [Related libraries][related-libs]
### Extensions
- [RPC](https://www.npmjs.com/package/discord-rpc) ([source](https://github.com/discordjs/RPC))
- [RPC][rpc] ([source][rpc-source])
## 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).
See [the contribution guide](https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md) if you'd like to submit a PR.
[documentation][documentation].
See [the contribution guide][contributing] 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).
nudge in the right direction, please don't hesitate to join our official [discord.js Server][discord].
[website]: https://discord.js.org/
[website-source]: https://github.com/discordjs/discord.js/tree/main/apps/website
[documentation]: https://discord.js.org/#/docs
[guide]: https://discordjs.guide/
[guide-source]: https://github.com/discordjs/guide
[guide-update]: https://discordjs.guide/additional-info/changes-in-v14.html
[discord]: https://discord.gg/djs
[discord-api]: https://discord.gg/discord-api
[source]: https://github.com/discordjs/discord.js/tree/main/packages/discord.js
[npm]: https://www.npmjs.com/package/discord.js
[related-libs]: https://discord.com/developers/docs/topics/community-resources#libraries
[rpc]: https://www.npmjs.com/package/discord-rpc
[rpc-source]: https://github.com/discordjs/RPC
[contributing]: https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md

382
api-extractor.json Normal file
View File

@@ -0,0 +1,382 @@
/**
* Config file for API Extractor. For more info, please visit: https://api-extractor.com
*/
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
/**
* Optionally specifies another JSON config file that this file extends from. This provides a way for
* standard settings to be shared across multiple projects.
*
* If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains
* the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be
* resolved using NodeJS require().
*
* SUPPORTED TOKENS: none
* DEFAULT VALUE: ""
*/
// "extends": "./shared/api-extractor-base.json"
// "extends": "my-package/include/api-extractor-base.json"
/**
* Determines the "<projectFolder>" token that can be used with other config file settings. The project folder
* typically contains the tsconfig.json and package.json config files, but the path is user-defined.
*
* The path is resolved relative to the folder of the config file that contains the setting.
*
* The default value for "projectFolder" is the token "<lookup>", which means the folder is determined by traversing
* parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder
* that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error
* will be reported.
*
* SUPPORTED TOKENS: <lookup>
* DEFAULT VALUE: "<lookup>"
*/
// "projectFolder": "..",
/**
* (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor
* analyzes the symbols exported by this module.
*
* The file extension must be ".d.ts" and not ".ts".
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
*/
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts",
/**
* A list of NPM package names whose exports should be treated as part of this package.
*
* For example, suppose that Webpack is used to generate a distributed bundle for the project "library1",
* and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part
* of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly
* imports library2. To avoid this, we can specify:
*
* "bundledPackages": [ "library2" ],
*
* This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been
* local files for library1.
*/
"bundledPackages": [],
/**
* Determines how the TypeScript compiler engine will be invoked by API Extractor.
*/
"compiler": {
/**
* Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project.
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* Note: This setting will be ignored if "overrideTsconfig" is used.
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/tsconfig.json"
*/
// "tsconfigFilePath": "<projectFolder>/tsconfig.json",
/**
* Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.
* The object must conform to the TypeScript tsconfig schema:
*
* http://json.schemastore.org/tsconfig
*
* If omitted, then the tsconfig.json file will be read from the "projectFolder".
*
* DEFAULT VALUE: no overrideTsconfig section
*/
// "overrideTsconfig": {
// . . .
// }
/**
* This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended
* and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when
* dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses
* for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck.
*
* DEFAULT VALUE: false
*/
// "skipLibCheck": true,
},
/**
* Configures how the API report file (*.api.md) will be generated.
*/
"apiReport": {
/**
* (REQUIRED) Whether to generate an API report.
*/
"enabled": false
/**
* The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce
* a full file path.
*
* The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/".
*
* SUPPORTED TOKENS: <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<unscopedPackageName>.api.md"
*/
// "reportFileName": "<unscopedPackageName>.api.md",
/**
* Specifies the folder where the API report file is written. The file name portion is determined by
* the "reportFileName" setting.
*
* The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy,
* e.g. for an API review.
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/temp/"
*/
// "reportFolder": "<projectFolder>/temp/",
/**
* Specifies the folder where the temporary report file is written. The file name portion is determined by
* the "reportFileName" setting.
*
* After the temporary file is written to disk, it is compared with the file in the "reportFolder".
* If they are different, a production build will fail.
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/temp/"
*/
// "reportTempFolder": "<projectFolder>/temp/"
},
/**
* Configures how the doc model file (*.api.json) will be generated.
*/
"docModel": {
/**
* (REQUIRED) Whether to generate a doc model file.
*/
"enabled": true,
/**
* The output path for the doc model file. The file extension should be ".api.json".
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/temp/<unscopedPackageName>.api.json"
*/
"apiJsonFilePath": "<projectFolder>/docs/docs.api.json"
},
/**
* Configures how the .d.ts rollup file will be generated.
*/
"dtsRollup": {
/**
* (REQUIRED) Whether to generate the .d.ts rollup file.
*/
"enabled": false
/**
* Specifies the output path for a .d.ts rollup file to be generated without any trimming.
* This file will include all declarations that are exported by the main entry point.
*
* If the path is an empty string, then this file will not be written.
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/dist/<unscopedPackageName>.d.ts"
*/
// "untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts",
/**
* Specifies the output path for a .d.ts rollup file to be generated with trimming for an "alpha" release.
* This file will include only declarations that are marked as "@public", "@beta", or "@alpha".
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: ""
*/
// "alphaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-alpha.d.ts",
/**
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release.
* This file will include only declarations that are marked as "@public" or "@beta".
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: ""
*/
// "betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-beta.d.ts",
/**
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release.
* This file will include only declarations that are marked as "@public".
*
* If the path is an empty string, then this file will not be written.
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: ""
*/
// "publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.ts",
/**
* When a declaration is trimmed, by default it will be replaced by a code comment such as
* "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the
* declaration completely.
*
* DEFAULT VALUE: false
*/
// "omitTrimmingComments": true
},
/**
* Configures how the tsdoc-metadata.json file will be generated.
*/
"tsdocMetadata": {
/**
* Whether to generate the tsdoc-metadata.json file.
*
* DEFAULT VALUE: true
*/
// "enabled": true,
/**
* Specifies where the TSDoc metadata file should be written.
*
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
* prepend a folder token such as "<projectFolder>".
*
* The default value is "<lookup>", which causes the path to be automatically inferred from the "tsdocMetadata",
* "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup
* falls back to "tsdoc-metadata.json" in the package folder.
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<lookup>"
*/
// "tsdocMetadataFilePath": "<projectFolder>/dist/tsdoc-metadata.json"
},
/**
* Specifies what type of newlines API Extractor should use when writing output files. By default, the output files
* will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead.
* To use the OS's default newline kind, specify "os".
*
* DEFAULT VALUE: "crlf"
*/
"newlineKind": "lf",
/**
* Configures how API Extractor reports error and warning messages produced during analysis.
*
* There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages.
*/
"messages": {
/**
* Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing
* the input .d.ts files.
*
* TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551"
*
* DEFAULT VALUE: A single "default" entry with logLevel=warning.
*/
"compilerMessageReporting": {
/**
* Configures the default routing for messages that don't match an explicit rule in this table.
*/
"default": {
/**
* Specifies whether the message should be written to the the tool's output log. Note that
* the "addToApiReportFile" property may supersede this option.
*
* Possible values: "error", "warning", "none"
*
* Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail
* and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes
* the "--local" option), the warning is displayed but the build will not fail.
*
* DEFAULT VALUE: "warning"
*/
"logLevel": "warning"
/**
* When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md),
* then the message will be written inside that file; otherwise, the message is instead logged according to
* the "logLevel" option.
*
* DEFAULT VALUE: false
*/
// "addToApiReportFile": false
}
// "TS2551": {
// "logLevel": "warning",
// "addToApiReportFile": true
// },
//
// . . .
},
/**
* Configures handling of messages reported by API Extractor during its analysis.
*
* API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag"
*
* DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings
*/
"extractorMessageReporting": {
"default": {
"logLevel": "warning"
// "addToApiReportFile": false
},
// Disable the following warning:
// (ae-missing-release-tag) "x" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
"ae-missing-release-tag": {
"logLevel": "none"
}
// "ae-extra-release-tag": {
// "logLevel": "warning",
// "addToApiReportFile": true
// },
//
// . . .
},
/**
* Configures handling of messages reported by the TSDoc parser when analyzing code comments.
*
* TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text"
*
* DEFAULT VALUE: A single "default" entry with logLevel=warning.
*/
"tsdocMessageReporting": {
"default": {
"logLevel": "warning"
// "addToApiReportFile": false
}
// "tsdoc-link-tag-unescaped-text": {
// "logLevel": "warning",
// "addToApiReportFile": true
// },
//
// . . .
}
}
}

11
apps/guide/.eslintrc.json Normal file
View File

@@ -0,0 +1,11 @@
{
"extends": ["../../.eslintrc.json", "neon/react", "neon/astro", "neon/prettier"],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"react/jsx-filename-extension": [1, { "extensions": [".tsx", ".astro"] }]
}
}

View File

@@ -27,3 +27,4 @@ src/styles/unocss.css
.tmp/
coverage/
.vercel
public/searchIndex

View File

@@ -0,0 +1,8 @@
module.exports = {
...require('../../.prettierrc.json'),
plugins: [
'prettier-plugin-astro',
'prettier-plugin-tailwindcss', // MUST come last
],
pluginSearchDirs: false,
};

46
apps/guide/README.md Normal file
View File

@@ -0,0 +1,46 @@
<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][website] ([source][website-source])
- [Documentation][documentation]
- [Guide][guide] ([source][guide-source])
See also the [Update Guide][guide-update], including updated and removed items in the library.
- [discord.js Discord server][discord]
- [Discord API Discord server][discord-api]
- [GitHub][source]
- [Related libraries][related-libs]
## Contributing
See [the contribution guide][contributing] 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][discord].
[website]: https://discord.js.org/
[website-source]: https://github.com/discordjs/discord.js/tree/main/apps/website
[documentation]: https://discord.js.org/
[guide]: https://discordjs.guide/
[guide-source]: https://github.com/discordjs/guide
[guide-update]: https://discordjs.guide/additional-info/changes-in-v14.html
[discord]: https://discord.gg/djs
[discord-api]: https://discord.gg/discord-api
[source]: https://github.com/discordjs/discord.js/tree/main/apps/guide
[related-libs]: https://discord.com/developers/docs/topics/community-resources#libraries
[contributing]: https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md

117
apps/guide/astro.config.ts Normal file
View File

@@ -0,0 +1,117 @@
import { fileURLToPath, URL } from 'node:url';
import image from '@astrojs/image';
import mdx from '@astrojs/mdx';
import prefetch from '@astrojs/prefetch';
import react from '@astrojs/react';
import { remarkCodeHike } from '@code-hike/mdx';
import { defineConfig } from 'astro/config';
import compress from 'astro-compress';
import critters from 'astro-critters';
import { type Node, toString } from 'hast-util-to-string';
import { h } from 'hastscript';
import { escape } from 'html-escaper';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import rehypeSlug from 'rehype-slug';
import shikiThemeDarkPlus from 'shiki/themes/dark-plus.json' assert { type: 'json' };
import Unocss from 'unocss/astro';
const LinkIcon = h(
'svg',
{
width: '1rem',
height: '1rem',
viewBox: '0 0 24 24',
fill: 'none',
stroke: 'currentColor',
strokeWidth: '2',
strokeLinecap: 'round',
strokeLinejoin: 'round',
},
h('path', {
// eslint-disable-next-line id-length
d: 'M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71',
}),
h('path', {
// eslint-disable-next-line id-length
d: 'M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71',
}),
);
const createSROnlyLabel = (text: string) => {
const node = h('span.sr-only', `Section titled ${escape(text)}`);
node.properties!['is:raw'] = true;
return node;
};
const rootDir = new URL('../../', import.meta.url);
export default defineConfig({
integrations: [
react(),
mdx({
remarkPlugins: [[remarkCodeHike, { autoImport: false, theme: shikiThemeDarkPlus, lineNumbers: true }]],
rehypePlugins: [
rehypeSlug,
[
rehypeAutolinkHeadings,
{
properties: {
class:
'relative inline-flex w-6 h-6 place-items-center place-content-center outline-0 text-black dark:text-white ml-2',
},
behavior: 'after',
group: ({ tagName }: { tagName: string }) =>
h('div', {
class: `[&>*]:inline-block [&>h1]:m-0 [&>h2]:m-0 [&>h3]:m-0 [&>h4]:m-0 level-${tagName}`,
tabIndex: -1,
}),
content: (heading: Node) => [
h(
`span.anchor-icon`,
{
ariaHidden: 'true',
},
LinkIcon,
),
createSROnlyLabel(toString(heading)),
],
},
],
],
}),
image({
serviceEntryPoint: '@astrojs/image/sharp',
}),
prefetch({
throttle: 3,
}),
Unocss({
configFile: fileURLToPath(new URL('unocss.config.ts', rootDir)),
}),
critters(),
compress(),
],
markdown: {
extendDefaultPlugins: true,
syntaxHighlight: false,
},
vite: {
resolve: {
alias: {
'ariakit/button': fileURLToPath(new URL('node_modules/ariakit/esm/button/index.js', rootDir)),
'ariakit/disclosure': fileURLToPath(new URL('node_modules/ariakit/esm/disclosure/index.js', rootDir)),
'ariakit/separator': fileURLToPath(new URL('node_modules/ariakit/esm/separator/index.js', rootDir)),
'ariakit-utils/dom': fileURLToPath(new URL('node_modules/ariakit-utils/esm/dom.js', rootDir)),
'ariakit-utils/events': fileURLToPath(new URL('node_modules/ariakit-utils/esm/events.js', rootDir)),
'ariakit-utils/focus': fileURLToPath(new URL('node_modules/ariakit-utils/esm/focus.js', rootDir)),
'ariakit-utils/hooks': fileURLToPath(new URL('node_modules/ariakit-utils/esm/hooks.js', rootDir)),
'ariakit-utils/misc': fileURLToPath(new URL('node_modules/ariakit-utils/esm/misc.js', rootDir)),
'ariakit-utils/platform': fileURLToPath(new URL('node_modules/ariakit-utils/esm/platform.js', rootDir)),
'ariakit-utils/system': fileURLToPath(new URL('node_modules/ariakit-utils/esm/system.js', rootDir)),
'react-icons/fi': fileURLToPath(new URL('node_modules/react-icons/fi/index.esm.js', rootDir)),
'react-icons/vsc': fileURLToPath(new URL('node_modules/react-icons/vsc/index.esm.js', rootDir)),
'react-use': fileURLToPath(new URL('node_modules/react-use/esm/index.js', rootDir)),
},
},
},
});

89
apps/guide/package.json Normal file
View File

@@ -0,0 +1,89 @@
{
"name": "@discordjs/guide",
"version": "0.1.0",
"description": "Imagine a guide... that explores the many possibilities for your discord.js bot",
"private": true,
"scripts": {
"test": "vitest run",
"build:local": "yarn build:prod",
"build:prod": "yarn workspaces foreach -ptR run build && astro build",
"dev": "yarn workspaces foreach -ptR run build && astro dev",
"preview": "astro preview",
"lint": "prettier --check . && cross-env TIMING=1 eslint src --ext .mjs,.js,.cjs,.ts,.tsx,.astro --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src --ext .mjs,.js,.cjs,.ts,.tsx,.astro --fix --format=pretty",
"fmt": "yarn format"
},
"type": "module",
"contributors": [
"Crawl <icrawltogo@gmail.com>"
],
"license": "Apache-2.0",
"keywords": [
"discord",
"api",
"bot",
"client",
"node",
"discordapp",
"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": {
"@code-hike/mdx": "^0.7.4",
"@discordjs/ui": "workspace:^",
"ariakit": "^2.0.0-next.41",
"react": "^18.2.0",
"react-custom-scrollbars-2": "^4.5.0",
"react-dom": "^18.2.0",
"react-icons": "^4.7.1",
"react-use": "^17.4.0"
},
"devDependencies": {
"@astrojs/image": "^0.12.0",
"@astrojs/mdx": "^0.12.0",
"@astrojs/prefetch": "^0.1.1",
"@astrojs/react": "^1.2.2",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/node": "16.18.4",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9",
"@types/react-syntax-highlighter": "^15.5.5",
"@unocss/cli": "^0.47.5",
"@unocss/reset": "^0.47.5",
"@vitejs/plugin-react": "^2.2.0",
"@vitest/coverage-c8": "^0.25.3",
"astro": "^1.6.12",
"astro-compress": "^1.1.15",
"astro-critters": "^1.1.15",
"cross-env": "^7.0.3",
"eslint": "^8.28.0",
"eslint-config-neon": "^0.1.40",
"eslint-formatter-pretty": "^4.1.0",
"happy-dom": "^7.7.0",
"hast-util-to-string": "^2.0.0",
"hastscript": "^7.1.0",
"html-escaper": "^3.0.3",
"prettier": "^2.8.0",
"prettier-plugin-astro": "^0.7.0",
"prettier-plugin-tailwindcss": "^0.2.0",
"rehype-autolink-headings": "^6.1.1",
"rehype-slug": "^5.1.0",
"sharp": "^0.31.2",
"shiki": "^0.11.1",
"typescript": "^4.9.3",
"unocss": "^0.47.5",
"vercel": "^28.7.0",
"vitest": "^0.25.3"
},
"engines": {
"node": ">=16.9.0"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="/mstile-70x70.png"/>
<square150x150logo src="/mstile-150x150.png"/>
<square310x310logo src="/mstile-310x310.png"/>
<wide310x150logo src="/mstile-310x150.png"/>
<TileColor>#090a16</TileColor>
</tile>
</msapplication>
</browserconfig>

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="400.000000pt" height="400.000000pt" viewBox="0 0 400.000000 400.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.14, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,400.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M0 2000 l0 -2000 2000 0 2000 0 0 2000 0 2000 -2000 0 -2000 0 0
-2000z m1305 795 c219 -47 373 -197 421 -411 24 -109 16 -315 -16 -399 l-23
-61 -59 -11 c-110 -21 -182 -92 -203 -202 -11 -56 -11 -56 -68 -79 -76 -30
-201 -42 -464 -42 l-223 0 0 610 0 610 283 0 c210 0 300 -4 352 -15z m890
-585 c0 -543 -2 -601 -18 -659 -56 -198 -190 -334 -365 -370 -176 -37 -349 5
-471 115 -48 44 -111 134 -111 161 0 6 19 14 43 18 23 4 73 18 110 32 l68 24
50 -45 c56 -50 98 -66 175 -66 100 0 207 81 234 178 6 23 10 251 10 625 l0
588 138 -3 137 -3 0 -595z m930 570 c93 -29 197 -84 252 -134 l44 -41 -61 -75
c-34 -41 -67 -81 -74 -88 -10 -10 -25 -4 -78 32 -95 63 -154 81 -268 81 -79 0
-103 -4 -142 -23 -62 -31 -90 -71 -96 -137 -8 -94 28 -137 168 -202 157 -73
172 -80 240 -108 236 -97 341 -215 356 -400 16 -193 -82 -363 -258 -449 -91
-45 -187 -66 -303 -66 -191 0 -390 74 -524 195 l-40 37 80 93 80 94 73 -53
c168 -121 353 -155 491 -92 72 33 108 82 113 155 9 122 -37 162 -323 286 -258
111 -350 179 -407 300 -69 148 -37 343 75 463 61 65 195 133 300 152 79 14
222 4 302 -20z m-1367 -977 c45 -34 65 -69 70 -125 4 -61 -19 -106 -77 -145
-90 -60 -226 3 -238 111 -3 24 -3 56 1 70 8 34 54 86 91 102 40 19 120 12 153
-13z"/>
<path d="M967 2543 c-4 -3 -7 -159 -7 -346 l0 -339 128 4 c101 3 136 8 172 24
106 48 162 145 168 292 10 214 -69 334 -238 361 -73 12 -213 15 -223 4z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1,19 @@
{
"name": "discord.js guide",
"short_name": "discord.js guide",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-384x384.png",
"sizes": "384x384",
"type": "image/png"
}
],
"theme_color": "#1a1b1e",
"background_color": "#1a1b1e",
"display": "standalone"
}

View File

@@ -0,0 +1,3 @@
export function DocsLink() {
return null;
}

View File

@@ -0,0 +1,10 @@
import { FiExternalLink } from 'react-icons/fi';
export function ExternalLink({ href, title }: { href: string; title: string }) {
return (
<a className="text-blurple inline-flex place-items-center gap-2 text-sm font-semibold" href={href}>
<p>{title}</p>
<FiExternalLink size={18} />
</a>
);
}

View File

@@ -0,0 +1,70 @@
import { Button } from 'ariakit/button';
import { useState, useEffect } from 'react';
import { FiCommand } from 'react-icons/fi';
import { VscColorMode, VscGithubInverted, VscMenu, VscSearch } from 'react-icons/vsc';
import { useMedia } from 'react-use';
import { Sidebar } from './Sidebar.jsx';
import type { MDXPage } from './SidebarItems.jsx';
export function Navbar({ pages }: { pages?: MDXPage[] | undefined }) {
const matches = useMedia('(min-width: 992px)', false);
const [opened, setOpened] = useState(false);
useEffect(() => {
if (matches) {
setOpened(false);
}
}, [matches]);
return (
<>
<header className="dark:bg-dark-600 dark:border-dark-100 bg-light-600 border-light-800 fixed top-0 left-0 z-20 w-full border-b">
<div className="h-18 block px-6">
<div className="flex h-full flex-row place-content-between place-items-center">
<Button
aria-label="Menu"
className="focus:ring-width-2 focus:ring-blurple flex h-6 w-6 transform-gpu cursor-pointer select-none appearance-none place-items-center rounded border-0 bg-transparent p-0 text-sm font-semibold leading-none no-underline outline-0 focus:ring active:translate-y-px lg:hidden"
onClick={() => setOpened((open) => !open)}
>
<VscMenu size={24} />
</Button>
<div className="hidden md:flex md:flex-row">Placeholder</div>
<div className="flex flex-row place-items-center gap-4">
<Button
as="div"
className="dark:bg-dark-800 focus:ring-width-2 focus:ring-blurple rounded bg-white px-4 py-2.5 outline-0 focus:ring"
// onClick={() => dialog?.toggle()}
>
<div className="flex flex-row place-items-center gap-4">
<VscSearch size={18} />
<span className="opacity-65">Search...</span>
<div className="opacity-65 flex flex-row place-items-center gap-2">
<FiCommand size={18} /> K
</div>
</div>
</Button>
<Button
aria-label="GitHub"
as="a"
className="focus:ring-width-2 focus:ring-blurple flex h-6 w-6 transform-gpu cursor-pointer select-none appearance-none place-items-center rounded rounded-full border-0 bg-transparent p-0 text-sm font-semibold leading-none no-underline outline-0 focus:ring active:translate-y-px"
href="https://github.com/discordjs/discord.js"
rel="noopener noreferrer"
target="_blank"
>
<VscGithubInverted size={24} />
</Button>
<Button
aria-label="Toggle theme"
className="focus:ring-width-2 focus:ring-blurple flex h-6 w-6 transform-gpu cursor-pointer select-none appearance-none place-items-center rounded-full rounded border-0 bg-transparent p-0 text-sm font-semibold leading-none no-underline outline-0 focus:ring active:translate-y-px"
// onClick={() => toggleTheme()}
>
<VscColorMode size={24} />
</Button>
</div>
</div>
</div>
</header>
<Sidebar opened={opened} pages={pages} />
</>
);
}

View File

@@ -0,0 +1,72 @@
import type { MarkdownHeading } from 'astro';
import { useEffect, useMemo, useState } from 'react';
import { Scrollbars } from 'react-custom-scrollbars-2';
import { VscListSelection } from 'react-icons/vsc';
import { useLocation } from 'react-use';
const LINK_HEIGHT = 30;
const INDICATOR_SIZE = 10;
const INDICATOR_OFFSET = (LINK_HEIGHT - INDICATOR_SIZE) / 2;
export function Outline({ headings }: { headings: MarkdownHeading[] }) {
const state = useLocation();
const [active, setActive] = useState(0);
const headingItems = useMemo(
() =>
headings.map((heading, idx) => (
<a
className={`dark:border-dark-100 border-light-800 pl-6.5 focus:ring-width-2 focus:ring-blurple ml-[10px] border-l p-[5px] text-sm outline-0 focus:rounded focus:border-0 focus:ring ${
idx === active
? 'bg-blurple text-white'
: 'dark:hover:bg-dark-200 dark:active:bg-dark-100 hover:bg-light-700 active:bg-light-800'
}`}
href={`#${heading.slug}`}
key={heading.slug}
style={{ paddingLeft: `${heading.depth * 14}px` }}
title={heading.text}
>
<span className="line-clamp-1">{heading.text}</span>
</a>
)),
[headings, active],
);
useEffect(() => {
const idx = headings.findIndex((heading) => heading.slug === state.hash?.slice(1));
if (idx >= 0) {
setActive(idx);
}
}, [state, headings]);
return (
<Scrollbars
autoHide
hideTracksWhenNotNeeded
renderThumbVertical={(props) => <div {...props} className="dark:bg-dark-100 bg-light-900 z-30 rounded" />}
renderTrackVertical={(props) => (
<div {...props} className="absolute top-0.5 right-0.5 bottom-0.5 z-30 w-1.5 rounded" />
)}
universal
>
<div className="flex flex-col break-all p-3 pb-8">
<div className="mt-4 ml-2 flex flex-row gap-2">
<VscListSelection size={25} />
<span className="font-semibold">Contents</span>
</div>
<div className="mt-4 ml-2 flex flex-col gap-2">
<div className="relative flex flex-col">
<div
className="bg-blurple absolute h-[10px] w-[10px] rounded-full border-2 border-black dark:border-white"
style={{
left: INDICATOR_SIZE / 2 + 0.5,
transform: `translateY(${active * LINK_HEIGHT + INDICATOR_OFFSET}px)`,
}}
/>
{headingItems}
</div>
</div>
</div>
</Scrollbars>
);
}

View File

@@ -0,0 +1,13 @@
export function PageButton({ url, title, direction }: { direction: 'next' | 'prev'; title: string; url: string }) {
return (
<a
className="bg-light-600 hover:bg-light-700 active:bg-light-800 dark:bg-dark-600 dark:hover:bg-dark-500 dark:active:bg-dark-400 focus:ring-width-2 focus:ring-blurple flex transform-gpu cursor-pointer select-none appearance-none flex-row flex-col place-items-center gap-2 rounded py-3 px-4 leading-none no-underline outline-0 focus:ring active:translate-y-px"
href={url}
>
<h3 className="text-md font-semibold">{title}</h3>
<p className={`${direction === 'next' ? 'ml-auto' : 'mr-auto'} text-sm text-gray-600 dark:text-gray-400`}>
{direction === 'next' ? 'Next Page' : 'Previous Page'}
</p>
</a>
);
}

View File

@@ -0,0 +1,3 @@
export function ResultingCode() {
return null;
}

View File

@@ -0,0 +1,24 @@
import { Scrollbars } from 'react-custom-scrollbars-2';
import type { MDXPage } from './SidebarItems.jsx';
export function Sidebar({ pages, opened }: { opened: boolean; pages?: MDXPage[] | undefined }) {
return (
<nav
className={`h-[calc(100vh - 73px)] dark:bg-dark-600 dark:border-dark-100 border-light-800 fixed top-[73px] left-0 bottom-0 z-20 w-full border-r bg-white ${
opened ? 'block' : 'hidden'
} lg:w-76 lg:max-w-76 lg:block`}
>
<Scrollbars
autoHide
hideTracksWhenNotNeeded
renderThumbVertical={(props) => <div {...props} className="dark:bg-dark-100 bg-light-900 z-30 rounded" />}
renderTrackVertical={(props) => (
<div {...props} className="absolute top-0.5 right-0.5 bottom-0.5 z-30 w-1.5 rounded" />
)}
universal
>
{pages ?? null}
</Scrollbars>
</nav>
);
}

View File

@@ -0,0 +1,51 @@
import { Section } from '@discordjs/ui';
import type { MDXInstance } from 'astro';
import { useEffect, useMemo, useState } from 'react';
import { useLocation } from 'react-use';
export type MDXPage = MDXInstance<{ category: string; title: string }>;
export function SidebarItems({ pages }: { pages: MDXPage[] }) {
const state = useLocation();
const [active, setActive] = useState<string | undefined>('');
const categories = useMemo(
() =>
pages.reduce<Record<string, MDXPage[]>>((acc, page) => {
if (acc[page.frontmatter.category]) {
acc[page.frontmatter.category]?.push(page);
} else {
acc[page.frontmatter.category] = [page];
}
return acc;
}, {}),
[pages],
);
useEffect(() => {
setActive(state.pathname);
}, [state]);
return Object.keys(categories).map((category, idx) => (
<Section key={idx} title={category}>
{categories[category]?.map((member, index) => (
<a
className={`dark:border-dark-100 border-light-800 focus:ring-width-2 focus:ring-blurple ml-5 flex flex-col border-l p-[5px] pl-6 outline-0 focus:rounded focus:border-0 focus:ring ${
(member.url || '/') === active
? 'bg-blurple text-white'
: 'dark:hover:bg-dark-200 dark:active:bg-dark-100 hover:bg-light-700 active:bg-light-800'
}`}
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
href={member.url || '/'}
key={index}
title={member.frontmatter.title}
>
<div className="flex flex-row place-items-center gap-2 lg:text-sm">
<span className="truncate">{member.frontmatter.title}</span>
</div>
</a>
)) ?? null}
</Section>
));
}

View File

@@ -0,0 +1,180 @@
---
import { Separator } from 'ariakit/separator';
import type { MarkdownLayoutProps } from 'astro';
import { ExternalLink } from './ExternalLink.jsx';
import { Navbar } from './Navbar.jsx';
import { Outline } from './Outline.jsx';
import { PageButton } from './PageButton.jsx';
import { SidebarItems } from './SidebarItems.jsx';
import { generateGithubURL } from '~/util/url.js';
const pages = await Astro.glob<{ category: string; title: string }>('../pages/**/*.mdx');
type Props = MarkdownLayoutProps<{}>;
const { headings, url, frontmatter } = Astro.props;
const groupedPages = pages.reduce<Record<string, typeof pages>>((acc, page) => {
const { category } = page.frontmatter;
acc[category] ??= [];
acc[category]?.push(page);
return acc;
}, {});
// @ts-expect-error props is not typed
const category = frontmatter.category as string;
const curCategoryPages = groupedPages[category];
const curCategoryIndex = curCategoryPages!.findIndex((page) => page.url === url);
const pagePrev = curCategoryPages![curCategoryIndex - 1];
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
const pageNext = curCategoryPages![curCategoryIndex + 1];
---
<script>
window.addEventListener('load', () => {
const headings = document.querySelectorAll(
'div.level-h1 > h1, div.level-h2 > h2, div.level-h3 > h3, div.level-h4 > h4',
);
const headingsObserver = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
const location = window.location.toString().split('#')[0];
history.replaceState(null, '', location + '#' + entry.target.id);
}
});
},
{
root: null,
rootMargin: '-100px 0% -66%',
threshold: 1.0,
},
);
headings.forEach((heading) => headingsObserver.observe(heading));
});
</script>
<Navbar client:load>
<div class="flex flex-col gap-3 p-3 pb-32 lg:pb-12" slot="pages">
<SidebarItems client:load pages={pages} />
</div>
</Navbar>
<main class="pt-18 lg:pl-76 xl:pr-64">
<article class="dark:bg-dark-600 bg-light-600">
<div class="dark:bg-dark-800 relative z-10 min-h-[calc(100vh_-_70px)] bg-white p-6 pb-20 shadow">
<div class="prose max-w-full">
<slot />
</div>
<div
class="h-[calc(100vh - 72px)] dark:bg-dark-600 dark:border-dark-100 border-light-800 fixed top-[72px] right-0 bottom-0 z-20 hidden w-64 border-l bg-white pr-2 xl:block"
>
<Outline client:load headings={headings} />
</div>
<Separator className="my-5 border-light-800 dark:border-dark-100" />
<div class="flex flex-col space-y-5">
<div class="flex place-content-end">
<ExternalLink client:load href={generateGithubURL(url!)} title="Edit this page on github" />
</div>
<div class="flex w-full">
{
pagePrev && (
<PageButton
direction="prev"
title={pagePrev.frontmatter.title}
url={pagePrev.url === '' ? '/' : pagePrev.url!}
/>
)
}
<div class="ml-auto self-end justify-self-end">
{
pageNext && (
<PageButton
direction="next"
title={pageNext.frontmatter.title}
url={pageNext.url === '' ? '/' : pageNext.url!}
/>
)
}
</div>
</div>
</div>
</div>
<div class="h-76 md:h-52"></div>
<footer
class="dark:bg-dark-600 h-76 lg:pl-84 bg-light-600 xl:pr-76 fixed bottom-0 left-0 right-0 md:h-52 md:pl-4 md:pr-16"
>
<div class="mx-auto flex max-w-6xl flex-col place-items-center gap-12 pt-12 lg:place-content-center">
<div class="flex w-full flex-col place-content-between place-items-center gap-12 md:flex-row md:gap-0">
<a
class="focus:ring-width-2 focus:ring-blurple rounded outline-0 focus:ring"
href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"
rel="noopener noreferrer"
target="_blank"
title="Vercel"
>
<img alt="Vercel" src="/powered-by-vercel.svg" />
</a>
<div class="flex flex-row gap-6 md:gap-12">
<div class="flex flex-col gap-2">
<div class="text-lg font-semibold">Community</div>
<div class="flex flex-col gap-1">
<a
class="focus:ring-width-2 focus:ring-blurple rounded outline-0 focus:ring"
href="https://discord.gg/djs"
rel="noopener noreferrer"
target="_blank"
>
Discord
</a>
<a
class="focus:ring-width-2 focus:ring-blurple rounded outline-0 focus:ring"
href="https://github.com/discordjs/discord.js/discussions"
rel="noopener noreferrer"
target="_blank"
>
GitHub discussions
</a>
</div>
</div>
<div class="flex flex-col gap-2">
<div class="text-lg font-semibold">Project</div>
<div class="flex flex-col gap-1">
<a
class="focus:ring-width-2 focus:ring-blurple rounded outline-0 focus:ring"
href="https://github.com/discordjs/discord.js"
rel="noopener noreferrer"
target="_blank"
>
discord.js
</a>
<a
class="focus:ring-width-2 focus:ring-blurple rounded outline-0 focus:ring"
href="https://discordjs.guide"
rel="noopener noreferrer"
target="_blank"
>
discord.js guide
</a>
<a
class="focus:ring-width-2 focus:ring-blurple rounded outline-0 focus:ring"
href="https://discord-api-types.dev"
rel="noopener noreferrer"
target="_blank"
>
discord-api-types
</a>
</div>
</div>
</div>
</div>
</div>
</footer>
</article>
<div>Test</div>
</main>

View File

@@ -0,0 +1,63 @@
---
import '../styles/main.css';
import '@code-hike/mdx/styles.css';
import '../styles/ch.css';
import type { MarkdownLayoutProps } from 'astro';
import SidebarLayout from '../components/SidebarLayout.astro';
import { DESCRIPTION } from '../util/constants.js';
type Props = MarkdownLayoutProps<{}>;
const props = Astro.props;
---
<html lang="en">
<head>
<link href="/apple-touch-icon.png" rel="apple-touch-icon" sizes="180x180" />
<link href="/favicon-32x32.png" rel="icon" sizes="32x32" type="image/png" />
<link href="/favicon-16x16.png" rel="icon" sizes="16x16" type="image/png" />
<link href="/site.webmanifest" rel="manifest" />
<link color="#090a16" href="/safari-pinned-tab.svg" rel="mask-icon" />
<meta content="light dark" name="color-scheme" />
<meta content="discord.js" name="apple-mobile-web-app-title" />
<meta content="discord.js" name="application-name" />
<meta content="#090a16" name="msapplication-TileColor" />
<meta content={DESCRIPTION} name="description" />
<meta content="discord.js" property="og:site_name" />
<meta content="website" property="og:type" />
<meta content="discord.js guide" property="og:title" />
<meta content={DESCRIPTION} name="og:description" />
<meta content="https://discordjs.dev/open-graph.png" property="og:image" />
<meta content="summary_large_image" name="twitter:card" />
<meta content="@iCrawlToGo" name="twitter:creator" />
<title>discord.js</title>
<meta content="minimum-scale=1, initial-scale=1, width=device-width" name="viewport" />
<meta content="#5865f2" name="theme-color" />
</head>
<body class="dark:bg-dark-800 bg-white">
<script is:inline>
function setTheme(prefersDarkMode, persistedColorPreference) {
if (persistedColorPreference === 'dark' || (prefersDarkMode && persistedColorPreference !== 'light')) {
document.documentElement.classList.toggle('dark', true);
} else {
document.documentElement.classList.toggle('dark', false);
}
}
(() => {
const prefersDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
const persistedColorPreference = localStorage.getItem('theme') || 'auto';
setTheme(prefersDarkMode, persistedColorPreference);
const listener =
window.matchMedia &&
window
.matchMedia('(prefers-color-scheme: dark)')
.addEventListener('change', (ev) => setTheme(ev.matches, persistedColorPreference));
})();
</script>
<SidebarLayout {...props}>
<slot />
</SidebarLayout>
</body>
</html>

View File

@@ -0,0 +1,253 @@
---
layout: '../../layouts/SidebarLayout.astro'
title: Understanding async/await
category: Additional info
---
import { CH } from '@code-hike/mdx/components';
import { Alert } from '@discordjs/ui';
# Understanding async/await
If you aren't very familiar with ECMAScript 2017, you may not know about async/await. It's a useful way to handle Promises in a hoisted manner. It's also slightly faster and increases overall readability.
## How do Promises work?
Before we can get into async/await, you should know what Promises are and how they work because async/await is just a way to handle Promises. If you know what Promises are and how to deal with them, you can skip this part.
Promises are a way to handle asynchronous tasks in JavaScript; they are the newer alternative to callbacks. A Promise has many similarities to a progress bar; they represent an unfinished and ongoing process. An excellent example of this is a request to a server (e.g., discord.js sends requests to Discord's API).
A Promise can have three states; pending, resolved, and rejected
The **pending** state means that the Promise still is ongoing and neither resolved nor rejected.
The **resolved** state means that the Promise is done and executed without any errors.
The **rejected** state means that the Promise encountered an error and could not execute correctly.
One important thing to know is that a Promise can only have one state simultaneously; it can never be pending and resolved, rejected and resolved, or pending and rejected. You may be asking, "How would that look in code?". Here is a small example:
<Alert title="Tip" type="success">
This example uses ES6 code. If you do not know what that is, you should read up on that
[here](/additional-info/es6-syntax.md).
</Alert>
<CH.Code client:load>
```js
function deleteMessages(amount) {
return new Promise((resolve) => {
if (amount > 10) throw new Error("You can't delete more than 10 Messages at a time.");
setTimeout(() => resolve('Deleted 10 messages.'), 2000);
});
}
deleteMessages(5)
.then((value) => {
// `deleteMessages` is complete and has not encountered any errors
// the resolved value will be the string "Deleted 10 messages"
})
.catch((error) => {
// `deleteMessages` encountered an error
// the error will be an Error Object
});
```
</CH.Code>
In this scenario, the _`deleteMessages`_ function returns a Promise. The _`.then()`_ method will trigger if the Promise resolves, and the _`.catch()`_ method if the Promise rejects. In the _`deleteMessages`_ function, the Promise is resolved after 2 seconds with the string "Deleted 10 messages.", so the _`.catch()`_ method will never be executed. You can also pass the _`.catch()`_ function as the second parameter of _`.then()`_.
## How to implement async/await
### Theory
The following information is essential to know before working with async/await. You can only use the _`await`_ keyword inside a function declared as _`async`_ (you put the _`async`_ keyword before the _`function`_ keyword or before the parameters when using a callback function).
A simple example would be:
<CH.Code client:load>
```js
async function declaredAsAsync() {
// ...
}
```
</CH.Code>
or
<CH.Code client:load>
```js
const declaredAsAsync = async () => {
// ...
};
```
</CH.Code>
You can use that as well if you use the arrow function as an event listener.
<CH.Code client:load>
```js
client.on('event', async (first, last) => {
// ...
});
```
</CH.Code>
An important thing to know is that a function declared as _`async`_ will always return a Promise. In addition to this, if you return something, the Promise will resolve with that value, and if you throw an error, it will reject the Promise with that error.
### Execution with discord.js code
Now that you know how Promises work and what they are used for, let's look at an example that handles multiple Promises. Let's say you want to react with letters (regional indicators) in a specific order. For this example, here's a basic template for a discord.js bot with some ES6 adjustments.
<CH.Code client:load>
```js
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once('ready', () => {
console.log('I am ready!');
});
client.on('interactionCreate', (interaction) => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'react') {
// ...
}
});
client.login('your-token-goes-here');
```
</CH.Code>
If you don't know how Node.js asynchronous execution works, you would probably try something like this:
<CH.Code client:load>
```js mark=4:7
client.on('interactionCreate', (interaction) => {
// ...
if (commandName === 'react') {
const message = interaction.reply({ content: 'Reacting!', fetchReply: true });
message.react('🇦');
message.react('🇧');
message.react('🇨');
}
});
```
</CH.Code>
But since all of these methods are started at the same time, it would just be a race to which server request finished first, so there would be no guarantee that it would react at all (if the message isn't fetched) or in the order you wanted it to. In order to make sure it reacts after the message is sent and in order (a, b, c), you'd need to use the _`.then()`_ callback from the Promises that these methods return. The code would look like this:
<CH.Code client:load>
```js mark=4:12
client.on('interactionCreate', (interaction) => {
// ...
if (commandName === 'react') {
interaction.reply({ content: 'Reacting!', fetchReply: true }).then((message) => {
message
.react('🇦')
.then(() => message.react('🇧'))
.then(() => message.react('🇨'))
.catch((error) => {
// handle failure of any Promise rejection inside here
});
});
}
});
```
</CH.Code>
In this piece of code, the Promises are [chain resolved](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then#Chaining) with each other, and if one of the Promises gets rejected, the function passed to _`.catch()`_ gets called. Here's the same code but with async/await:
<CH.Code client:load>
```js mark=1,4:7
client.on('interactionCreate', async (interaction) => {
// ...
if (commandName === 'react') {
const message = await interaction.reply({ content: 'Reacting!', fetchReply: true });
await message.react('🇦');
await message.react('🇧');
await message.react('🇨');
}
});
```
</CH.Code>
It's mostly the same code, but how would you catch Promise rejections now since _`.catch()`_ isn't there anymore? That is also a useful feature with async/await; the error will be thrown if you await it so that you can wrap the awaited Promises inside a try/catch, and you're good to go.
<CH.Code client:load>
```js mark=1,4:11
client.on('interactionCreate', async (interaction) => {
if (commandName === 'react') {
try {
const message = await interaction.reply({ content: 'Reacting!', fetchReply: true });
await message.react('🇦');
await message.react('🇧');
await message.react('🇨');
} catch (error) {
// handle failure of any Promise rejection inside here
}
}
});
```
</CH.Code>
This code looks clean and is also easy to read.
So you may be asking, "How would I get the value the Promise resolved with?".
Let's look at an example where you want to delete a sent reply.
<CH.Code client:load>
```js mark=3:10
client.on('interactionCreate', (interaction) => {
// ...
if (commandName === 'delete') {
interaction
.reply({ content: 'This message will be deleted.', fetchReply: true })
.then((replyMessage) => setTimeout(() => replyMessage.delete(), 10000))
.catch((error) => {
// handle error
});
}
});
```
</CH.Code>
The return value of a _`.reply()`_ with the _`fetchReply`_ option set to _`true`_ is a Promise which resolves with the reply when it has been sent, but how would the same code with async/await look?
<CH.Code client:load>
```js mark=1,4:10
client.on('interactionCreate', async (interaction) => {
if (commandName === 'delete') {
try {
const replyMessage = await interaction.reply({ content: 'This message will be deleted.', fetchReply: true });
setTimeout(() => replyMessage.delete(), 10000);
} catch (error) {
// handle error
}
}
});
```
</CH.Code>
With async/await, you can assign the awaited function to a variable representing the returned value. Now you know how you use async/await.

View File

@@ -0,0 +1,127 @@
---
layout: '../../layouts/SidebarLayout.astro'
title: Collections
category: Additional info
---
import { CH } from '@code-hike/mdx/components';
import { Alert } from '@discordjs/ui';
# Collections
discord.js comes with a utility class known as _`Collection`_.
It extends JavaScript's native _`Map`_ class, so it has all the _`Map`_ features and more!
<Alert title="Warning" type="warning">
If you're not familiar with _`Map`_, read [MDN's page on
it](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) before continuing. You
should be familiar with _`Array`_
[methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) as well. We will
also use some ES6 features, so read up [here](/additional-info/es6-syntax.md) if you do not know what they are.
</Alert>
A _`Map`_ allows for an association between unique keys and their values.
For example, how can you transform every value or filter the entries in a _`Map`_ easily?
This is the point of the _`Collection`_ class!
## Array-like Methods
Many of the methods on _`Collection`_ correspond to their namesake in _`Array`_. One of them is _`find`_:
<CH.Code client:load>
```js
// Assume we have an array of users and a collection of the same users.
array.find((u) => u.discriminator === '1000');
collection.find((u) => u.discriminator === '1000');
```
</CH.Code>
The interface of the callback function is very similar between the two.
For arrays, callbacks usually pass the parameters _`(value, index, array)`_, where _`value`_ is the value iterated to,
_`index`_ is the current index, and _`array`_ is the array. For collections, you would have _`(value, key, collection)`_.
Here, _`value`_ is the same, but _`key`_ is the key of the value, and _`collection`_ is the collection itself instead.
Methods that follow this philosophy of staying close to the _`Array`_ interface are as follows:
- _`find`_
- _`filter`_ - Note that this returns a _`Collection`_ rather than an _`Array`_.
- _`map`_ - Yet this returns an _`Array`_ of values instead of a _`Collection`_!
- _`every`_
- _`some`_
- _`reduce`_
- _`concat`_
- _`sort`_
## Converting to Array
Since _`Collection`_ extends _`Map`_, it is an [iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols), and can be converted to an _`Array`_ through either _`Array.from()`_ or spread syntax (_`...collection`_).
<CH.Code client:load>
```js
// For values.
Array.from(collection.values());
[...collection.values()];
// For keys.
Array.from(collection.keys());
[...collection.keys()];
// For [key, value] pairs.
Array.from(collection);
[...collection];
```
</CH.Code>
<Alert title="Warning" type="warning">
Many people convert Collections to Arrays way too much! This can lead to unnecessary and confusing code. Before you
use _`Array.from()`_ or similar, ask yourself if whatever you are trying to do can't be done with the given _`Map`_ or
_`Collection`_ methods or with a for-of loop.
</Alert>
## Extra Utilities
Some methods are not from _`Array`_ and are instead entirely new to standard JavaScript.
<CH.Code client:load>
```js
// A random value.
collection.random();
// The first value.
collection.first();
// The first 5 values.
collection.first(5);
// Similar to `first`, but from the end.
collection.last();
collection.last(2);
// Removes anything that meets the condition from the collection.
// Sort of like `filter`, but in-place.
collection.sweep((user) => user.username === 'Bob');
```
</CH.Code>
A more complicated method is _`partition`_, which splits a single Collection into two new Collections based on the provided function.
You can think of it as two \_`filter`\_s, but done at the same time:
<CH.Code client:load>
```js
// `bots` is a Collection of users where their `bot` property was true.
// `humans` is a Collection where the property was false instead!
const [bots, humans] = collection.partition((u) => u.bot);
// Both return true.
bots.every((b) => b.bot);
humans.every((h) => !h.bot);
```
</CH.Code>

View File

@@ -0,0 +1,250 @@
---
layout: '../../layouts/SidebarLayout.astro'
title: Creating commands
category: Creating your bot
---
import { CH } from '@code-hike/mdx/components';
import { Alert, DiscordMessages, DiscordMessage } from '@discordjs/ui';
import { DocsLink } from '../../components/DocsLink.jsx';
import { ResultingCode } from '../../components/ResultingCode.jsx';
# Creating commands
<Alert title="Tip" type="success">
This page is a follow-up and bases its code on [the previous page](/creating-your-bot/).
</Alert>
<DiscordMessages rounded>
<DiscordMessage
interaction={{
author: {
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
},
command: 'ping',
}}
author={{
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
time: 'Today at 21:00',
}}
>
Pong!
</DiscordMessage>
</DiscordMessages>
Discord allows developers to register [slash commands](https://discord.com/developers/docs/interactions/application-commands), which provide users a first-class way of interacting directly with your application. Before being able to reply to a command, you must first register it.
## Registering commands
This section will cover only the bare minimum to get you started, but you can refer to our [in-depth page on registering slash commands](/interactions/slash-commands.md#registering-slash-commands) for further details. It covers guild commands, global commands, options, option types, and choices.
### Command deployment script
Create a _`deploy-commands.js`_ file in your project directory. This file will be used to register and update the slash commands for your bot application.
Since commands only need to be registered once, and updated when the definition (description, options etc) is changed, it's not necessary to connect a whole client to the gateway or do this on every _`ready`_ event. As such, a standalone script using the lighter REST manager is preferred.
Below is a deployment script you can use. Focus on these variables:
- _`clientId`_: Your application's client id
- _`guildId`_: Your development server's id
- _`commands`_: An array of commands to register. The [slash command builder](/popular-topics/builders.md#slash-command-builders) from _`discord.js`_ is used to build the data for your commands
<Alert title="Tip" type="success">
In order to get your application's client id, go to [Discord Developer
Portal](https://discord.com/developers/applications) and choose your application. Find the id under "Application ID"
in General Information subpage. To get guild id, open Discord and go to your settings. On the "Advanced" page, turn on
"Developer Mode". This will enable a "Copy ID" button in the context menu when you right-click on a server icon, a
user's profile, etc.
</Alert>
<CH.Code client:load>
```js deploy-commands.js mark=4,6:10
const { REST, SlashCommandBuilder, Routes } = require('discord.js');
const { clientId, guildId, token } = require('./config.json');
const commands = [
new SlashCommandBuilder().setName('ping').setDescription('Replies with pong!'),
new SlashCommandBuilder().setName('server').setDescription('Replies with server info!'),
new SlashCommandBuilder().setName('user').setDescription('Replies with user info!'),
].map((command) => command.toJSON());
const rest = new REST({ version: '10' }).setToken(token);
rest
.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands })
.then((data) => console.log(`Successfully registered ${data.length} application commands.`))
.catch(console.error);
```
---
```json config.json mark=2:3
{
"clientId": "123456789012345678",
"guildId": "876543210987654321",
"token": "your-token-goes-here"
}
```
</CH.Code>
Once you fill in these values, run _`node deploy-commands.js`_ in your project directory to register your commands to a single guild. It's also possible to [register commands globally](/interactions/slash-commands.md#global-commands).
<Alert title="Tip" type="success">
You only need to run `node deploy-commands.js` once. You should only run it again if you add or edit existing
commands.
</Alert>
## Replying to commands
Once you've registered your commands, you can listen for interactions via <DocsLink path="class/Client?scrollTo=e-interactionCreate" /> in your _`index.js`_ file.
You should first check if an interaction is a chat input command via <DocsLink path="class/Interaction?scrollTo=isChatInputCommand" type="method">_`.isChatInputCommand()`_</DocsLink>, and then check the <DocsLink path="class/CommandInteraction?scrollTo=commandName">_`.commandName`_</DocsLink> property to know which command it is. You can respond to interactions with <DocsLink path="class/CommandInteraction?scrollTo=reply">_`.reply()`_</DocsLink>.
<CH.Code client:load>
```js mark=5:16
client.once('ready', () => {
console.log('Ready!');
});
client.on('interactionCreate', async (interaction) => {
if (!interaction.isChatInputCommand()) return;
const { commandName } = interaction;
if (commandName === 'ping') {
await interaction.reply('Pong!');
} else if (commandName === 'server') {
await interaction.reply('Server info.');
} else if (commandName === 'user') {
await interaction.reply('User info.');
}
});
client.login(token);
```
</CH.Code>
### Server info command
Note that servers are referred to as "guilds" in the Discord API and discord.js library. _`interaction.guild`_ refers to the guild the interaction was sent in (a <DocsLink path="class/Guild" /> instance), which exposes properties such as _`.name`_ or _`.memberCount`_.
<CH.Code client:load>
```js focus=7
client.on('interactionCreate', async (interaction) => {
if (!interaction.isChatInputCommand()) return;
const { commandName } = interaction;
if (commandName === 'ping') {
await interaction.reply('Pong!');
} else if (commandName === 'server') {
await interaction.reply(`Server name: ${interaction.guild.name}\nTotal members: ${interaction.guild.memberCount}`);
} else if (commandName === 'user') {
await interaction.reply('User info.');
}
});
```
</CH.Code>
<DiscordMessages rounded>
<DiscordMessage
interaction={{
author: {
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
},
command: 'server',
}}
author={{
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
time: 'Today at 21:00',
}}
>
<p>Server name: discord.js Guide</p>
<p>Total members: 2</p>
</DiscordMessage>
</DiscordMessages>
You could also display the date the server was created, or the server's verification level. You would do those in the same manner use _`interaction.guild.createdAt`_ or _`interaction.guild.verificationLevel`_, respectively.
<Alert title="Tip" type="success">
Refer to the <DocsLink path="class/Guild" /> documentation for a list of all the available properties and methods!
</Alert>
### User info command
A "user" refers to a Discord user. _`interaction.user`_ refers to the user the interaction was sent by (a <DocsLink path="class/User" /> instance), which exposes properties such as _`.tag`_ or _`.id`_.
<CH.Code client:load>
```js focus=9
client.on('interactionCreate', async (interaction) => {
if (!interaction.isChatInputCommand()) return;
const { commandName } = interaction;
if (commandName === 'ping') {
await interaction.reply('Pong!');
} else if (commandName === 'server') {
await interaction.reply(`Server name: ${interaction.guild.name}\nTotal members: ${interaction.guild.memberCount}`);
} else if (commandName === 'user') {
await interaction.reply(`Your tag: ${interaction.user.tag}\nYour id: ${interaction.user.id}`);
}
});
```
</CH.Code>
<DiscordMessages rounded>
<DiscordMessage
interaction={{
author: {
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
},
command: 'user',
}}
author={{
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
time: 'Today at 21:00',
}}
>
<p>Your tag: User#0001</p>
<p>Your id: 123456789012345678</p>
</DiscordMessage>
</DiscordMessages>
<Alert title="Tip" type="success">
Refer to the <DocsLink path="class/User" /> documentation for a list of all the available properties and methods!
</Alert>
And there you have it!
## The problem with if/else if
If you don't plan on making more than a couple commands, then using an _`if`_/_`else if`_ chain is fine; however, this isn't always the case. Using a giant _`if`_/_`else if`_ chain will only hinder your development process in the long run.
Here's a small list of reasons why you shouldn't do so:
- Takes longer to find a piece of code you want;
- Easier to fall victim to [spaghetti code](https://en.wikipedia.org/wiki/Spaghetti_code);
- Difficult to maintain as it grows;
- Difficult to debug;
- Difficult to organize;
- General bad practice.
Next, we'll be diving into something called a "command handler" code that makes handling commands easier and much more efficient. This allows you to move your commands into individual files.
## Resulting code
<ResultingCode />

View File

@@ -0,0 +1,194 @@
---
layout: '../../layouts/SidebarLayout.astro'
title: Initial files
category: Creating your bot
---
import { CH } from '@code-hike/mdx/components';
import { Alert, Section } from '@discordjs/ui';
import { DocsLink } from '../../components/DocsLink.jsx';
import { ResultingCode } from '../../components/ResultingCode.jsx';
# Initial files
Once you [add your bot to a server](/preparations/adding-your-bot-to-servers.md), the next step is to start coding and get it online! Let's start by creating a config file for your client token and a main file for your bot application.
## Creating configuration files
As explained in the ["What is a token, anyway?"](/preparations/setting-up-a-bot-application.md#what-is-a-token-anyway) section, your token is essentially your bot's password, and you should protect it as best as possible. This can be done through a _`config.json`_ file or by using environment variables.
Open your application in the [Discord Developer Portal](https://discord.com/developers/applications) and go to the "Bot" page to copy your token.
### Using config.json
Storing data in a _`config.json`_ file is a common way of keeping your sensitive values safe. Create a _`config.json`_ file in your project directory and paste in your token. You can access your token inside other files by using _`require()`_.
<CH.Code client:load>
```json config.json
{
"token": "your-token-goes-here"
}
```
---
```js Usage
const { token } = require('./config.json');
console.log(token);
```
</CH.Code>
<Alert title="Caution" type="danger">
If you're using Git, you should not commit this file and should [ignore it via
_`.gitignore`_](/creating-your-bot/#git-and-gitignore).
</Alert>
### Using environment variables
Environment variables are special values for your environment (e.g., terminal session, Docker container, or environment variable file). You can pass these values into your code's scope so that you can use them.
One way to pass in environment variables is via the command line interface. When starting your app, instead of _`node index.js`_, use _`TOKEN=your-token-goes-here node index.js`_. You can repeat this pattern to expose other values as well.
You can access the set values in your code via the _`process.env`_ global variable, accessible in any file. Note that values passed this way will always be strings and that you might need to parse them to a number, if using them to do calculations.
<CH.Code client:load>
```shellscript Command line
A=123 B=456 DISCORD_TOKEN=your-token-goes-here node index.js
```
---
```js Usage
console.log(process.env.A);
console.log(process.env.B);
console.log(process.env.DISCORD_TOKEN);
```
</CH.Code>
#### Using dotenv
Another common approach is storing these values in a _`.env`_ file. This spares you from always copying your token into the command line. Each line in a _`.env`_ file should hold a _`KEY=value`_ pair.
You can use the [_`dotenv`_ package](https://www.npmjs.com/package/dotenv) for this. Once installed, require and use the package to load your _`.env`_ file and attach the variables to _`process.env`_:
<CH.Code client:load>
```shellscript npm
npm install dotenv
```
```shellscript yarn
yarn add dotenv
```
```shellscript pnpm
pnpm add dotenv
```
---
```text .env
A=123
B=456
DISCORD_TOKEN=your-token-goes-here
```
---
```js Usage
const dotenv = require('dotenv');
dotenv.config();
console.log(process.env.A);
console.log(process.env.B);
console.log(process.env.DISCORD_TOKEN);
```
</CH.Code>
<Alert title="Caution" type="danger">
If you're using Git, you should not commit this file and should [ignore it via
_`.gitignore`_](/creating-your-bot/#git-and-gitignore).
</Alert>
<Section client:load title="Online editors (Glitch, Heroku, Replit, etc.)" defaultClosed padded background gutter>
While we generally do not recommend using online editors as hosting solutions, but rather invest in a proper virtual private server, these services do offer ways to keep your credentials safe as well! Please see the respective service's documentation and help articles for more information on how to keep sensitive values safe:
- Glitch: [Storing secrets in .env](https://glitch.happyfox.com/kb/article/18)
- Heroku: [Configuration variables](https://devcenter.heroku.com/articles/config-vars)
- Replit: [Secrets and environment variables](https://docs.replit.com/repls/secrets-environment-variables)
</Section>
### Git and .gitignore
Git is a fantastic tool to keep track of your code changes and allows you to upload progress to services like [GitHub](https://github.com/), [GitLab](https://about.gitlab.com/), or [Bitbucket](https://bitbucket.org/product). While this is super useful to share code with other developers, it also bears the risk of uploading your configuration files with sensitive values!
You can specify files that Git should ignore in its versioning systems with a _`.gitignore`_ file. Create a _`.gitignore`_ file in your project directory and add the names of the files and folders you want to ignore:
<CH.Code client:load>
```
node_modules
.env
config.json
```
</CH.Code>
<Alert title="Tip" type="success">
Aside from keeping credentials safe, _`node_modules`_ should be included here. Since this directory can be restored
based on the entries in your _`package.json`_ and _`package-lock.json`_ files by running _`npm install`_, it does not
need to be included in Git. You can specify quite intricate patterns in _`.gitignore`_ files, check out the [Git
documentation on _`.gitignore`_](https://git-scm.com/docs/gitignore) for more information!
</Alert>
## Creating the main file
Open your code editor and create a new file. We suggest that you save the file as _`index.js`_, but you may name it whatever you wish.
Here's the base code to get you started:
<CH.Code client:load>
```js
// Require the necessary discord.js classes
const { Client, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
// Create a new client instance
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
// When the client is ready, run this code (only once)
client.once('ready', () => {
console.log('Ready!');
});
// Login to Discord with your client's token
client.login(token);
```
</CH.Code>
This is how you create a client instance for your Discord bot and login to Discord. The _`GatewayIntentBits.Guilds`_ intents option is necessary for your client to work properly, as it ensures that the caches for guilds, channels and roles are populated and available for internal use.
Intents also define which events Discord should send to your bot, and you may wish to enable more than just the minimum. You can read more about the other intents on the [Intents topic](/popular-topics/intents).
Open your terminal and run _`node index.js`_ to start the process. If you see "Ready!" after a few seconds, you're good to go!
<Alert title="Tip" type="success">
You can open your _`package.json`_ file and edit the _`"main": "index.js"`_ field to point to your main file. You can
then run _`node .`_ in your terminal to start the process! After closing the process with _`Ctrl + C`_, you can press
the up arrow on your keyboard to bring up the latest commands you've run. Pressing up and then enter after closing the
process is a quick way to start it up again.
</Alert>
## Resulting code
<ResultingCode path="creating-your-bot/initial-files" />

View File

@@ -0,0 +1,36 @@
---
layout: '../layouts/SidebarLayout.astro'
title: Introduction
category: Home
---
# Introduction
If you're reading this, it probably means you want to learn how to make a bot with discord.js. Awesome! You've come to the right place.
This guide will teach you things such as:
- How to get a bot [up and running](/preparations/) from scratch;
- How to properly [create](/creating-your-bot/), [organize](/creating-your-bot/command-handling.md), and expand on your commands;
- In-depth explanations and examples regarding popular topics (e.g. [reactions](/popular-topics/reactions.md), [embeds](/popular-topics/embeds.md), [canvas](/popular-topics/canvas.md));
- Working with databases (e.g. [sequelize](/sequelize/) and [keyv](/keyv/));
- Getting started with [sharding](/sharding/);
- And much more.
This guide will also cover subjects like common errors and how to solve them, keeping your code clean, setting up a proper development environment, etc.
Sounds good? Great! Let's get started, then.
## Before you begin...
Alright, making a bot is cool and all, but there are some prerequisites to it. To create a bot with discord.js, you should have a fairly decent grasp of JavaScript itself.
While you _can_ make a bot with very little JavaScript and programming knowledge, trying to do so without understanding the language first will only hinder you. You may get stuck on many uncomplicated issues, struggle with solutions to incredibly easy problems, and all-in-all end up frustrated. Sounds pretty annoying.
If you don't know JavaScript but would like to learn about it, here are a few links to help get you started:
- [Eloquent JavaScript, a free online book](http://eloquentjavascript.net/)
- [JavaScript.info, a modern javascript tutorial](https://javascript.info/)
- [Codecademy's interactive JavaScript course](https://www.codecademy.com/learn/introduction-to-javascript)
- [Nodeschool, for both JavaScript and Node.js lessons](https://nodeschool.io/)
- [MDN's JavaScript guide and full documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript)
- [Google, your best friend](https://google.com)
Take your pick, learn some JavaScript, and once you feel like you're confident enough to make a bot, come back and get started!

View File

@@ -0,0 +1,20 @@
---
layout: '../layouts/SidebarLayout.astro'
title: Requesting more content
category: Home
---
import { Alert } from '@discordjs/ui';
# Requesting more content
Since this guide is made specifically for the discord.js community, we want to be sure to provide the most relevant and up-to-date content. We will, of course, make additions to the current pages and add new ones as we see fit, but fulfilling requests is how we know we're providing content you all want the most.
Requests may be as simple as "add an example to the [frequently asked questions](/popular-topics/faq.html) page", or as elaborate as "add a page regarding [sharding](/sharding/)". We'll do our best to fulfill all requests, as long as they're reasonable.
To make a request, simply head over to [the repo's issue tracker](https://github.com/discordjs/guide/issues) and [create a new issue](https://github.com/discordjs/guide/issues/new)! Title it appropriately, and let us know exactly what you mean inside the issue description. Make sure that you've looked around the site before making a request; what you want to request might already exist!
<Alert title="Tip" type="success">
Remember that you can always [fork the repo](https://github.com/discordjs/guide) and [make a pull
request](https://github.com/discordjs/guide/pulls) if you want to add anything to the guide yourself!
</Alert>

View File

@@ -0,0 +1,102 @@
---
title: Test
category: Test
---
import { DiscordMessages, DiscordMessage, DiscordMessageEmbed } from '@discordjs/ui';
<DiscordMessages>
<DiscordMessage
reply={{
author: {
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
},
content: 'Test',
}}
author={{
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
time: 'Today at 21:00',
}}
>
1234
</DiscordMessage>
<DiscordMessage
author={{
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
time: 'Today at 21:00',
}}
followUp
time="21:02"
>
1234
</DiscordMessage>
</DiscordMessages>
<DiscordMessages>
<DiscordMessage
reply={{
author: {
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
},
content: 'Test',
}}
author={{
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
time: 'Today at 21:00',
}}
>
1234
</DiscordMessage>
</DiscordMessages>
<DiscordMessages>
<DiscordMessage
reply={{
author: {
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
},
content: 'Test',
}}
author={{
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
time: 'Today at 21:00',
}}
>
<>
<DiscordMessageEmbed
author={{
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
}}
/>
<DiscordMessageEmbed title={{ title: 'Title' }} />
<DiscordMessageEmbed footer={{ content: 'Footer' }} />
<DiscordMessageEmbed
author={{
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
}}
title={{ title: 'Title' }}
footer={{ content: 'Footer' }}
>
Test
</DiscordMessageEmbed>
</>
</DiscordMessage>
</DiscordMessages>

View File

@@ -0,0 +1,75 @@
---
layout: '../layouts/SidebarLayout.astro'
title: What's new
category: Home
---
import { CH } from '@code-hike/mdx/components';
import { DiscordMessages, DiscordMessage } from '@discordjs/ui';
# What's new
<DiscordMessages rounded>
<DiscordMessage
interaction={{
author: {
avatar:
'https://cdn.discordapp.com/guilds/222078108977594368/users/81440962496172032/avatars/c059c5d04d717ea05790f7a6447e4843.webp?size=160',
username: 'Crawl',
},
command: 'upgrade',
}}
author={{
avatar: 'https://cdn.discordapp.com/avatars/474807795183648809/7f239a0776ff928b2182906a2b3743c9.webp?size=160',
bot: true,
username: 'Guide Bot',
time: 'Today at 21:00',
}}
>
discord.js v14 has released and the guide has been updated!
<br />
This includes additions and changes made in Discord, such as slash commands and message components.
</DiscordMessage>
</DiscordMessages>
## Site
- Upgraded to [VuePress v2](https://v2.vuepress.vuejs.org/)
- New theme made to match the [discord.js documentation site](https://discord.js.org/)
- Discord message components upgraded to [@discord-message-components/vue](https://github.com/Danktuary/discord-message-components/blob/main/packages/vue/README.md)
- Many fixes in code blocks, grammar, consistency, etc.
## Pages
All content has been updated to use discord.js v14 syntax. The v13 version of the guide can be found at [https://v13.discordjs.guide/](https://v13.discordjs.guide/).
### New
- [Updating from v13 to v14](/additional-info/changes-in-v14.md): A list of the changes from discord.js v13 to v14
- [Slash commands](/interactions/slash-commands.md): Registering, replying to slash commands and permissions
- [Buttons](/interactions/buttons.md): Building, sending, and receiving buttons
- [Select menus](/interactions/select-menus.md): Building, sending, and receiving select menus
- [Threads](/popular-topics/threads.md): Creating and managing threads
- [Builders](/popular-topics/builders.md): A collection of builders to use with your bot
### Updated
- Commando: Replaced with [Sapphire](https://sapphirejs.dev/docs/Guide/getting-started/getting-started-with-sapphire)
- [Voice](/voice/): Rewritten to use the [_`@discordjs/voice`_](https://github.com/discordjs/discord.js/tree/main/packages/voice) package
- [Command handling](/creating-your-bot/command-handling.md/): Updated to use slash commands
- Obsolete sections removed
- _`client.on('message')`_ snippets updated to _`client.on('interactionCreate')`_
- [Message content will become a new privileged intent on August 31, 2022](https://support-dev.discord.com/hc/en-us/articles/4404772028055)
<DiscordMessages rounded>
<DiscordMessage
author={{
avatar: 'https://cdn.discordapp.com/avatars/474807795183648809/7f239a0776ff928b2182906a2b3743c9.webp?size=160',
bot: true,
username: 'Guide Bot',
time: 'Today at 21:00',
}}
>
Thank you to all of those that contributed to the development of discord.js and the guide!
</DiscordMessage>
</DiscordMessages>

View File

@@ -0,0 +1,3 @@
.ch-frame-buttons {
display: none;
}

View File

@@ -0,0 +1,16 @@
@import url('https://rsms.me/inter/inter.css');
:root {
font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji';
font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}
@supports (font-variation-settings: normal) {
:root {
font-family: 'Inter var', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji';
}
}

View File

@@ -0,0 +1,3 @@
export const DESCRIPTION = 'Imagine a guide... that explores the many possibilities for your discord.js bot.';
export const GITHUB_BASE_PAGES_PATH = 'https://github.com/discordjs/discord.js/tree/main/apps/guide/src/pages';

View File

@@ -0,0 +1,5 @@
import { GITHUB_BASE_PAGES_PATH } from './constants.js';
export function generateGithubURL(pageURL: string) {
return `${GITHUB_BASE_PAGES_PATH}${pageURL}.mdx`;
}

View File

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

19
apps/guide/tsconfig.json Normal file
View File

@@ -0,0 +1,19 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"isolatedModules": true,
"jsx": "preserve",
"baseUrl": ".",
"noEmit": true,
"allowJs": false,
"incremental": true,
"skipLibCheck": true,
"types": ["@astrojs/image/client"],
"paths": {
"~/*": ["./src/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.tsx", "types.d.ts"],
"exclude": ["node_modules"]
}

3
apps/guide/vercel.json Normal file
View File

@@ -0,0 +1,3 @@
{
"cleanUrls": true
}

View File

@@ -0,0 +1,12 @@
{
"extends": ["../../.eslintrc.json", "neon/react", "neon/next", "neon/edge", "neon/prettier"],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"react/react-in-jsx-scope": 0,
"react/jsx-filename-extension": [1, { "extensions": [".tsx"] }]
}
}

31
apps/website/.gitignore vendored Normal file
View File

@@ -0,0 +1,31 @@
# Packages
node_modules/
# Log files
logs/
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
# Env
.env
# Dist
dist/
typings/
.cache/
build/
src/styles/unocss.css
.next/
src/assets/readme/
# Miscellaneous
.tmp/
coverage/
.vercel
public/searchIndex
.vscode

View File

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

View File

@@ -0,0 +1,16 @@
# Autogenerated
CHANGELOG.md
.turbo
dist/
docs/**/*
!docs/index.yml
!docs/README.md
coverage/
.cache
build/
src/styles/unocss.css
api/
.next/
.vercel/
.cache/
public/searchIndex

View File

@@ -0,0 +1,7 @@
module.exports = {
...require('../../.prettierrc.json'),
plugins: [
'prettier-plugin-tailwindcss', // MUST come last
],
pluginSearchDirs: false,
};

46
apps/website/README.md Normal file
View File

@@ -0,0 +1,46 @@
<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][website] ([source][website-source])
- [Documentation][documentation]
- [Guide][guide] ([source][guide-source])
See also the [Update Guide][guide-update], including updated and removed items in the library.
- [discord.js Discord server][discord]
- [Discord API Discord server][discord-api]
- [GitHub][source]
- [Related libraries][related-libs]
## Contributing
See [the contribution guide][contributing] 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][discord].
[website]: https://discord.js.org/
[website-source]: https://github.com/discordjs/discord.js/tree/main/apps/website
[documentation]: https://discord.js.org/
[guide]: https://discordjs.guide/
[guide-source]: https://github.com/discordjs/guide
[guide-update]: https://discordjs.guide/additional-info/changes-in-v14.html
[discord]: https://discord.gg/djs
[discord-api]: https://discord.gg/discord-api
[source]: https://github.com/discordjs/discord.js/tree/main/apps/website
[related-libs]: https://discord.com/developers/docs/topics/community-resources#libraries
[contributing]: https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md

View File

@@ -0,0 +1,33 @@
/* eslint-disable tsdoc/syntax */
import { fileURLToPath } from 'node:url';
import bundleAnalyzer from '@next/bundle-analyzer';
const withBundleAnalyzer = bundleAnalyzer({
enabled: process.env.ANALYZE === 'true',
});
/**
* @type {import('next').NextConfig}
*/
export default withBundleAnalyzer({
reactStrictMode: true,
eslint: {
ignoreDuringBuilds: true,
},
// Until Next.js fixes their type issues
typescript: {
ignoreBuildErrors: true,
},
cleanDistDir: true,
outputFileTracing: true,
experimental: {
appDir: true,
serverComponentsExternalPackages: ['@microsoft/api-extractor-model', 'jju', 'shiki'],
outputFileTracingRoot: fileURLToPath(new URL('../../', import.meta.url)),
fallbackNodePolyfills: false,
},
images: {
dangerouslyAllowSVG: true,
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
},
});

103
apps/website/package.json Normal file
View File

@@ -0,0 +1,103 @@
{
"name": "@discordjs/website",
"version": "0.1.0",
"description": "Imagine a bot... the most popular way to build discord bots",
"private": true,
"scripts": {
"test": "vitest run",
"build:copy_readme": "cpy '../../packages/*/README.md' 'src/assets/readme' --rename='home-{{basename}}'",
"build:local": "yarn run --top-level docs --force && yarn build:copy_readme && cross-env-shell NEXT_PUBLIC_LOCAL_DEV=true yarn build:prod",
"build:prod": "yarn workspaces foreach -ptR run build && yarn build:copy_readme && yarn build:css && yarn build:next",
"build:next": "next build",
"build:css": "yarn generate:css",
"build:search_indicies": "yarn node scripts/generateAllIndicies.js",
"build:analyze": "yarn run --top-level docs --force && cross-env-shell ANALYZE=true NEXT_PUBLIC_LOCAL_DEV=true yarn build:prod",
"dev": "yarn run --top-level docs && concurrently 'yarn dev:css' 'yarn dev:next'",
"dev:next": "next dev",
"dev:css": "yarn generate:css --watch",
"generate:css": "unocss 'src/**/*.tsx' '../../packages/ui/src/lib/components/**/*.tsx' --out-file ./src/styles/unocss.css --config ../../unocss.config.ts",
"lint": "prettier --check . && cross-env TIMING=1 eslint src --ext .mjs,.js,.cjs,.ts,.tsx --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src --ext .mjs,.js,.cjs,.ts,.tsx --fix --format=pretty",
"fmt": "yarn format"
},
"type": "module",
"contributors": [
"Crawl <icrawltogo@gmail.com>"
],
"license": "Apache-2.0",
"keywords": [
"discord",
"api",
"bot",
"client",
"node",
"discordapp",
"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": {
"@discordjs/api-extractor-utils": "workspace:^",
"@discordjs/scripts": "workspace:^",
"@discordjs/ui": "workspace:^",
"@microsoft/api-extractor-model": "7.24.0",
"@microsoft/tsdoc": "0.14.1",
"@react-icons/all-files": "^4.1.0",
"@vercel/og": "^0.0.21",
"@vscode/codicons": "^0.0.32",
"ariakit": "^2.0.0-next.41",
"cmdk": "^0.1.20",
"meilisearch": "^0.30.0",
"next": "^13.0.7-canary.1",
"next-mdx-remote": "^4.2.0",
"next-themes": "npm:@wits/next-themes@latest",
"react": "^18.2.0",
"react-custom-scrollbars-2": "^4.5.0",
"react-dom": "^18.2.0",
"react-syntax-highlighter": "^15.5.0",
"react-use": "^17.4.0",
"rehype-ignore": "^1.0.3",
"rehype-pretty-code": "^0.5.1",
"rehype-raw": "^6.1.1",
"rehype-slug": "^5.1.0",
"remark-gfm": "^3.0.1",
"sharp": "^0.31.2",
"shiki": "^0.11.1",
"swr": "^1.3.0"
},
"devDependencies": {
"@next/bundle-analyzer": "^13.0.6",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/node": "16.18.4",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9",
"@types/react-syntax-highlighter": "^15.5.5",
"@unocss/cli": "^0.47.5",
"@unocss/reset": "^0.47.5",
"@vitejs/plugin-react": "^2.2.0",
"@vitest/coverage-c8": "^0.25.3",
"concurrently": "^7.6.0",
"cpy-cli": "^4.2.0",
"cross-env": "^7.0.3",
"eslint": "^8.28.0",
"eslint-config-neon": "^0.1.40",
"eslint-formatter-pretty": "^4.1.0",
"happy-dom": "^7.7.0",
"prettier": "^2.8.0",
"prettier-plugin-tailwindcss": "^0.2.0",
"typescript": "^4.9.3",
"unocss": "^0.47.5",
"vercel": "^28.7.0",
"vitest": "^0.25.3"
},
"engines": {
"node": ">=16.9.0"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

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