Compare commits

...

42 Commits

Author SHA1 Message Date
github-actions[bot]
3644b70e2e chore(release): 0.36.2 🎉 (#528)
Build ran for 4af2ea9141

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-07-14 15:32:42 +03:00
Vitor
4af2ea9141 feat(RESTPutAPIApplicationGuildCommandsJSONBody): add missing id (#522) 2022-07-13 23:42:14 +03:00
Almeida
f2c3451c2a feat(RESTJSONErrorCodes): add error 30032 (#521) 2022-07-13 20:52:11 +03:00
Parbez
d503c71252 docs: mark the maximum allowed length for string option types (#514) 2022-07-07 19:31:20 +03:00
Superchupu
e253a4ac87 chore: resolve ci error (#518) 2022-07-05 22:33:13 +03:00
Superchupu
84226e402a docs: update discord channel name (#517) 2022-07-05 18:16:44 +03:00
github-actions[bot]
2e84efb9b8 chore(release): 0.36.1 🎉 (#516)
Build ran for df1527c4bb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-07-04 16:15:13 +03:00
MateoDeveloper
df1527c4bb docs(APIApplicationCommandOption): number and integer typos in max_value field description (#515) 2022-07-03 22:16:10 +00:00
MateoDeveloper
2cade98ed0 feat(APIApplicationCommandStringOption): add min_length and max_length (#513) 2022-07-02 13:54:15 +03:00
Vitor
d3535d6db1 docs(APIMessageInteraction): name now includes more info (#511) 2022-07-02 02:40:00 +03:00
github-actions[bot]
2f2d4ae3fa chore(release): 0.36.0 🎉 (#510)
Build ran for 0c65d40af0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-06-30 15:26:23 +03:00
Vitor
0c65d40af0 feat(APIBaseInteraction): add app_permissions (#509) 2022-06-29 21:17:57 +03:00
advaith
12072b70a0 feat(MessageType): update names (#498)
BREAKING CHANGE: The following message types have been renamed:
- `GuildMemberJoin` -> `UserJoin`
- `UserPremiumGuildSubscription` -> `GuildBoost`
- `UserPremiumGuildSubscriptionTier1` -> `GuildBoostTier1`
- `UserPremiumGuildSubscriptionTier2` -> `GuildBoostTier2`
- `UserPremiumGuildSubscriptionTier3` -> `GuildBoostTier3`
2022-06-27 23:55:04 +03:00
Suneet Tipirneni
34908aa4ce feat(RESTJSONErrorCodes): add error 20024 (#480) 2022-06-27 23:36:00 +03:00
github-actions[bot]
b2eeb3f27b chore(release): 0.35.0 🎉 (#503)
Build ran for fc3aa1c911

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-06-23 21:16:21 +03:00
MateoDeveloper
fc3aa1c911 feat(UserFlags): add Quarantined flag (#495)
* feat(UserFlags): add Quarantined flag

* fix: change to Math.pow()

* chore: add @unstable

* fix: improvements to @unstable

* fix: description errors
2022-06-21 13:33:33 +03:00
Vitor
06098869d5 feat(REST): add CDNRoutes (#502) 2022-06-21 01:48:46 +03:00
MateoDeveloper
a2d76fc7ca chore(UserFlags): add @unstable to Spammer flag (#500) 2022-06-21 01:46:38 +03:00
n1ck_pro
56d491fa68 feat(APIEmbedVideo): add missing proxy_url property (#496) 2022-06-18 21:46:11 +03:00
Almeida
3b10c60faa refactor(GatewayIdentifyProperties): remove $ prefix from keys (#493)
BREAKING CHANGE: The fields for identify no longer use the `$` prefix for the values.
2022-06-17 22:41:12 +03:00
github-actions[bot]
c6e320bd22 chore(release): 0.34.0 🎉 (#492)
Build ran for f49546c780

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-06-13 16:15:34 +02:00
Vlad Frangu
f49546c780 chore: more website fixes (#490) 2022-06-13 10:16:01 +03:00
Vlad Frangu
63959ef2aa chore: fix ci for publishing new versions (#488) 2022-06-12 15:07:15 +03:00
Vlad Frangu
f72fbc93f6 docs: lazy load JetBrains mono font (#486) 2022-06-10 21:43:17 +03:00
Vlad Frangu
d83dadca17 docs: fix some grammar mistakes (#485) 2022-06-10 21:43:05 +03:00
Vitor
0bb2204b5d refactor: separate MESSAGE_CREATE fields from APIMessage object (#434)
BREAKING CHANGE: Certain fields that come only through the gateway are now correctly typed as such
2022-06-08 22:24:24 +03:00
Almeida
292c6b58ee feat: add guild mfa endpoint and error 50017 (#476) 2022-06-08 22:18:18 +03:00
Vitor
63ca86afbd docs(RESTPatchAPIChannelJSONBody): voice channels can be set as nsfw (#474) 2022-06-08 21:54:54 +03:00
Vitor
20653b3481 feat(RESTJSONErrorCodes): add 220003 error (#466) 2022-06-08 21:44:07 +03:00
Vlad Frangu
7bef64df76 chore: update vercel links (#484) 2022-06-08 20:36:09 +02:00
Vlad Frangu
6477c1e5d8 chore: showcase website in package.json (#482) 2022-06-08 01:44:23 +03:00
github-actions[bot]
e957695400 chore(release): 0.33.5 🎉 (#481)
Build ran for d8543177cd

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-06-07 12:42:27 +02:00
Almeida
d8543177cd feat(RESTJSONErrorCodes): add error 30052 (#469) 2022-06-07 01:55:57 +03:00
Vlad Frangu
cb663096a5 chore: make website build again -.- (#478)
Thanks Docusaurus!!
2022-06-06 18:57:02 +03:00
A. Román
eff8892b03 fix(RESTPostAPIWebhookWithTokenJSONBody): thread_name should be optional (#479) 2022-06-06 18:56:48 +03:00
DD
d268e0bff7 fix(GatewayGuildCreateDispatch): add missing GatewayGuildCreateDispatch (#477) 2022-06-06 17:04:20 +03:00
github-actions[bot]
7b1e5a70e5 chore(release): 0.33.4 🎉 (#475)
Build ran for 8e5f07e2ee

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-06-06 14:38:21 +02:00
Vitor
8e5f07e2ee feat(RESTPostAPIWebhookWithTokenJSONBody): add thread_name (#463)
* feat(RESTPostAPIWebhookWithTokenJSONBody): add `thread_name`

* docs: update from upstream

* docs: make it clear
2022-06-04 17:52:22 +03:00
github-actions[bot]
1c6ea86110 chore(release): 0.33.3 🎉 (#472)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-06-04 15:22:11 +02:00
DD
43c372d817 fix(AddUndefinedToPossiblyUndefinedProperties): recurse down objects (#471) 2022-06-04 16:14:01 +03:00
Vlad Frangu
9f386cb874 docs: fix typo (#468) 2022-06-03 12:30:37 +03:00
Vlad Frangu
019b9de1e8 docs: fix line highlighting for contributing guide (#467) 2022-06-03 11:54:19 +03:00
107 changed files with 6090 additions and 1485 deletions

View File

@@ -5,5 +5,6 @@
"source.organizeImports": false,
"source.fixAll": true,
"source.fixAll.eslint": true
}
},
"cSpell.enableFiletypes": ["mdx"]
}

View File

@@ -1,3 +1,88 @@
## [0.36.2](https://github.com/discordjs/discord-api-types/compare/0.36.1...0.36.2) (2022-07-14)
### Features
- **RESTJSONErrorCodes:** add error `30032` ([#521](https://github.com/discordjs/discord-api-types/issues/521)) ([f2c3451](https://github.com/discordjs/discord-api-types/commit/f2c3451c2a8bc91bcca65372d2944a07a3c34a9a))
- **RESTPutAPIApplicationGuildCommandsJSONBody:** add missing `id` ([#522](https://github.com/discordjs/discord-api-types/issues/522)) ([4af2ea9](https://github.com/discordjs/discord-api-types/commit/4af2ea91415a5662171d342379c4bd33bfa5a6d5))
## [0.36.1](https://github.com/discordjs/discord-api-types/compare/0.36.0...0.36.1) (2022-07-04)
### Features
- **APIApplicationCommandStringOption:** add `min_length` and `max_length` ([#513](https://github.com/discordjs/discord-api-types/issues/513)) ([2cade98](https://github.com/discordjs/discord-api-types/commit/2cade98ed0a0a074254fbc1580fc56d0e0b3dc9c))
# [0.36.0](https://github.com/discordjs/discord-api-types/compare/0.35.0...0.36.0) (2022-06-30)
### Features
- **APIBaseInteraction:** add `app_permissions` ([#509](https://github.com/discordjs/discord-api-types/issues/509)) ([0c65d40](https://github.com/discordjs/discord-api-types/commit/0c65d40af00499233830ce272a2a274bcd5b9e8c))
- **MessageType:** update names ([#498](https://github.com/discordjs/discord-api-types/issues/498)) ([12072b7](https://github.com/discordjs/discord-api-types/commit/12072b70a0c70e1e1f9de920789e26829268de12))
- **RESTJSONErrorCodes:** add error 20024 ([#480](https://github.com/discordjs/discord-api-types/issues/480)) ([34908aa](https://github.com/discordjs/discord-api-types/commit/34908aa4ceeca4b58276cc207f5bdb77cef04296))
### BREAKING CHANGES
- **MessageType:** The following message types have been renamed:
* `GuildMemberJoin` -> `UserJoin`
* `UserPremiumGuildSubscription` -> `GuildBoost`
* `UserPremiumGuildSubscriptionTier1` -> `GuildBoostTier1`
* `UserPremiumGuildSubscriptionTier2` -> `GuildBoostTier2`
* `UserPremiumGuildSubscriptionTier3` -> `GuildBoostTier3`
# [0.35.0](https://github.com/discordjs/discord-api-types/compare/0.34.0...0.35.0) (2022-06-23)
### Code Refactoring
- **GatewayIdentifyProperties:** remove `$` prefix from keys ([#493](https://github.com/discordjs/discord-api-types/issues/493)) ([3b10c60](https://github.com/discordjs/discord-api-types/commit/3b10c60faa5943501ab1f7cfa0d5f3c5317cdbbd))
### Features
- **APIEmbedVideo:** add missing `proxy_url` property ([#496](https://github.com/discordjs/discord-api-types/issues/496)) ([56d491f](https://github.com/discordjs/discord-api-types/commit/56d491fa6808d9a8762bff606ca8feb5e11f13a4))
- **REST:** add `CDNRoutes` ([#502](https://github.com/discordjs/discord-api-types/issues/502)) ([0609886](https://github.com/discordjs/discord-api-types/commit/06098869d552139fadcc204b5ce4e1a7e5352b68))
- **UserFlags:** add `Quarantined` flag ([#495](https://github.com/discordjs/discord-api-types/issues/495)) ([fc3aa1c](https://github.com/discordjs/discord-api-types/commit/fc3aa1c9110e4730c6b8ba3e36815ecd2da66c68))
### BREAKING CHANGES
- **GatewayIdentifyProperties:** The fields for identify no longer use the `$` prefix for the values.
# [0.34.0](https://github.com/discordjs/discord-api-types/compare/0.33.5...0.34.0) (2022-06-13)
### Code Refactoring
- separate `MESSAGE_CREATE` fields from `APIMessage` object ([#434](https://github.com/discordjs/discord-api-types/issues/434)) ([0bb2204](https://github.com/discordjs/discord-api-types/commit/0bb2204b5ddd32b791641a33d52669bc739bc208))
### Features
- add guild mfa endpoint and error `50017` ([#476](https://github.com/discordjs/discord-api-types/issues/476)) ([292c6b5](https://github.com/discordjs/discord-api-types/commit/292c6b58ee9384db2ce06addb80d2ea2bcd32de2))
- **RESTJSONErrorCodes:** add 220003 error ([#466](https://github.com/discordjs/discord-api-types/issues/466)) ([20653b3](https://github.com/discordjs/discord-api-types/commit/20653b34819f6adf8116bef2a1e5edc3233c4117))
### BREAKING CHANGES
- Certain fields that come only through the gateway are now correctly typed as such
## [0.33.5](https://github.com/discordjs/discord-api-types/compare/0.33.4...0.33.5) (2022-06-07)
### Bug Fixes
- **GatewayGuildCreateDispatch:** add missing `GatewayGuildCreateDispatch` ([#477](https://github.com/discordjs/discord-api-types/issues/477)) ([d268e0b](https://github.com/discordjs/discord-api-types/commit/d268e0bff7429e1cde43174fdf6d2342569860d5))
- **RESTPostAPIWebhookWithTokenJSONBody:** `thread_name` should be optional ([#479](https://github.com/discordjs/discord-api-types/issues/479)) ([eff8892](https://github.com/discordjs/discord-api-types/commit/eff8892b03656cfc2b709c6c30edb98e38bf2a1e))
### Features
- **RESTJSONErrorCodes:** add error `30052` ([#469](https://github.com/discordjs/discord-api-types/issues/469)) ([d854317](https://github.com/discordjs/discord-api-types/commit/d8543177cd978a19daa32fbb183892b6f8c24772))
## [0.33.4](https://github.com/discordjs/discord-api-types/compare/0.33.3...0.33.4) (2022-06-06)
### Features
- **RESTPostAPIWebhookWithTokenJSONBody:** add `thread_name` ([#463](https://github.com/discordjs/discord-api-types/issues/463)) ([8e5f07e](https://github.com/discordjs/discord-api-types/commit/8e5f07e2eebc14e5777dbfb932ef54f252165524))
## [0.33.3](https://github.com/discordjs/discord-api-types/compare/0.33.2...0.33.3) (2022-06-04)
### Bug Fixes
- **AddUndefinedToPossiblyUndefinedProperties:** recurse down objects ([#471](https://github.com/discordjs/discord-api-types/issues/471)) ([43c372d](https://github.com/discordjs/discord-api-types/commit/43c372d81722e48b105d5121a2cfdf614f1e7704))
## [0.33.2](https://github.com/discordjs/discord-api-types/compare/0.33.1...0.33.2) (2022-06-01)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
# Discord API Types
[![discord-api-types](./website/static/svgs/logo_long_blurple.svg)](https://github.com/discordjs/discord-api-types)
[![discord-api-types](https://raw.githubusercontent.com/discordjs/discord-api-types/main/website/static/svgs/logo_long_blurple.svg)](https://github.com/discordjs/discord-api-types)
[![GitHub](https://img.shields.io/github/license/discordjs/discord-api-types)](https://github.com/discordjs/discord-api-types/blob/main/LICENSE.md)
[![npm](https://img.shields.io/npm/v/discord-api-types?color=crimson&logo=npm)](https://www.npmjs.com/package/discord-api-types)
@@ -8,6 +8,7 @@
[![Patreon Donate](https://img.shields.io/badge/patreon-donate-brightgreen.svg?label=Donate%20with%20Patreon&logo=patreon&colorB=F96854&link=https://www.patreon.com/vladfrangu)](https://www.patreon.com/vladfrangu)
[![Ko-fi Donate](https://img.shields.io/badge/kofi-donate-brightgreen.svg?label=Donate%20with%20Ko-fi&logo=ko-fi&colorB=F16061&link=https://ko-fi.com/wolfgalvlad&logoColor=FFFFFF)](https://ko-fi.com/wolfgalvlad)
[![GitHub Sponsors](https://img.shields.io/badge/patreon-donate-brightgreen.svg?label=Sponsor%20through%20GitHub&logo=github&colorB=F96854&link=https://github.com/sponsors/vladfrangu)](https://github.com/sponsors/vladfrangu)
[![Powered by Vercel](https://raw.githubusercontent.com/discordjs/discord-api-types/main/website/static/powered-by-vercel.svg)](https://vercel.com?utm_source=discordjs&utm_campaign=oss)
Simple type definitions for the [Discord API](https://discord.com/developers/docs/intro).

View File

@@ -1,3 +1,88 @@
## [0.36.2](https://github.com/discordjs/discord-api-types/compare/0.36.1...0.36.2) (2022-07-14)
### Features
- **RESTJSONErrorCodes:** add error `30032` ([#521](https://github.com/discordjs/discord-api-types/issues/521)) ([f2c3451](https://github.com/discordjs/discord-api-types/commit/f2c3451c2a8bc91bcca65372d2944a07a3c34a9a))
- **RESTPutAPIApplicationGuildCommandsJSONBody:** add missing `id` ([#522](https://github.com/discordjs/discord-api-types/issues/522)) ([4af2ea9](https://github.com/discordjs/discord-api-types/commit/4af2ea91415a5662171d342379c4bd33bfa5a6d5))
## [0.36.1](https://github.com/discordjs/discord-api-types/compare/0.36.0...0.36.1) (2022-07-04)
### Features
- **APIApplicationCommandStringOption:** add `min_length` and `max_length` ([#513](https://github.com/discordjs/discord-api-types/issues/513)) ([2cade98](https://github.com/discordjs/discord-api-types/commit/2cade98ed0a0a074254fbc1580fc56d0e0b3dc9c))
# [0.36.0](https://github.com/discordjs/discord-api-types/compare/0.35.0...0.36.0) (2022-06-30)
### Features
- **APIBaseInteraction:** add `app_permissions` ([#509](https://github.com/discordjs/discord-api-types/issues/509)) ([0c65d40](https://github.com/discordjs/discord-api-types/commit/0c65d40af00499233830ce272a2a274bcd5b9e8c))
- **MessageType:** update names ([#498](https://github.com/discordjs/discord-api-types/issues/498)) ([12072b7](https://github.com/discordjs/discord-api-types/commit/12072b70a0c70e1e1f9de920789e26829268de12))
- **RESTJSONErrorCodes:** add error 20024 ([#480](https://github.com/discordjs/discord-api-types/issues/480)) ([34908aa](https://github.com/discordjs/discord-api-types/commit/34908aa4ceeca4b58276cc207f5bdb77cef04296))
### BREAKING CHANGES
- **MessageType:** The following message types have been renamed:
* `GuildMemberJoin` -> `UserJoin`
* `UserPremiumGuildSubscription` -> `GuildBoost`
* `UserPremiumGuildSubscriptionTier1` -> `GuildBoostTier1`
* `UserPremiumGuildSubscriptionTier2` -> `GuildBoostTier2`
* `UserPremiumGuildSubscriptionTier3` -> `GuildBoostTier3`
# [0.35.0](https://github.com/discordjs/discord-api-types/compare/0.34.0...0.35.0) (2022-06-23)
### Code Refactoring
- **GatewayIdentifyProperties:** remove `$` prefix from keys ([#493](https://github.com/discordjs/discord-api-types/issues/493)) ([3b10c60](https://github.com/discordjs/discord-api-types/commit/3b10c60faa5943501ab1f7cfa0d5f3c5317cdbbd))
### Features
- **APIEmbedVideo:** add missing `proxy_url` property ([#496](https://github.com/discordjs/discord-api-types/issues/496)) ([56d491f](https://github.com/discordjs/discord-api-types/commit/56d491fa6808d9a8762bff606ca8feb5e11f13a4))
- **REST:** add `CDNRoutes` ([#502](https://github.com/discordjs/discord-api-types/issues/502)) ([0609886](https://github.com/discordjs/discord-api-types/commit/06098869d552139fadcc204b5ce4e1a7e5352b68))
- **UserFlags:** add `Quarantined` flag ([#495](https://github.com/discordjs/discord-api-types/issues/495)) ([fc3aa1c](https://github.com/discordjs/discord-api-types/commit/fc3aa1c9110e4730c6b8ba3e36815ecd2da66c68))
### BREAKING CHANGES
- **GatewayIdentifyProperties:** The fields for identify no longer use the `$` prefix for the values.
# [0.34.0](https://github.com/discordjs/discord-api-types/compare/0.33.5...0.34.0) (2022-06-13)
### Code Refactoring
- separate `MESSAGE_CREATE` fields from `APIMessage` object ([#434](https://github.com/discordjs/discord-api-types/issues/434)) ([0bb2204](https://github.com/discordjs/discord-api-types/commit/0bb2204b5ddd32b791641a33d52669bc739bc208))
### Features
- add guild mfa endpoint and error `50017` ([#476](https://github.com/discordjs/discord-api-types/issues/476)) ([292c6b5](https://github.com/discordjs/discord-api-types/commit/292c6b58ee9384db2ce06addb80d2ea2bcd32de2))
- **RESTJSONErrorCodes:** add 220003 error ([#466](https://github.com/discordjs/discord-api-types/issues/466)) ([20653b3](https://github.com/discordjs/discord-api-types/commit/20653b34819f6adf8116bef2a1e5edc3233c4117))
### BREAKING CHANGES
- Certain fields that come only through the gateway are now correctly typed as such
## [0.33.5](https://github.com/discordjs/discord-api-types/compare/0.33.4...0.33.5) (2022-06-07)
### Bug Fixes
- **GatewayGuildCreateDispatch:** add missing `GatewayGuildCreateDispatch` ([#477](https://github.com/discordjs/discord-api-types/issues/477)) ([d268e0b](https://github.com/discordjs/discord-api-types/commit/d268e0bff7429e1cde43174fdf6d2342569860d5))
- **RESTPostAPIWebhookWithTokenJSONBody:** `thread_name` should be optional ([#479](https://github.com/discordjs/discord-api-types/issues/479)) ([eff8892](https://github.com/discordjs/discord-api-types/commit/eff8892b03656cfc2b709c6c30edb98e38bf2a1e))
### Features
- **RESTJSONErrorCodes:** add error `30052` ([#469](https://github.com/discordjs/discord-api-types/issues/469)) ([d854317](https://github.com/discordjs/discord-api-types/commit/d8543177cd978a19daa32fbb183892b6f8c24772))
## [0.33.4](https://github.com/discordjs/discord-api-types/compare/0.33.3...0.33.4) (2022-06-06)
### Features
- **RESTPostAPIWebhookWithTokenJSONBody:** add `thread_name` ([#463](https://github.com/discordjs/discord-api-types/issues/463)) ([8e5f07e](https://github.com/discordjs/discord-api-types/commit/8e5f07e2eebc14e5777dbfb932ef54f252165524))
## [0.33.3](https://github.com/discordjs/discord-api-types/compare/0.33.2...0.33.3) (2022-06-04)
### Bug Fixes
- **AddUndefinedToPossiblyUndefinedProperties:** recurse down objects ([#471](https://github.com/discordjs/discord-api-types/issues/471)) ([43c372d](https://github.com/discordjs/discord-api-types/commit/43c372d81722e48b105d5121a2cfdf614f1e7704))
## [0.33.2](https://github.com/discordjs/discord-api-types/compare/0.33.1...0.33.2) (2022-06-01)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
# Discord API Types
[![discord-api-types](./website/static/svgs/logo_long_blurple.svg)](https://github.com/discordjs/discord-api-types)
[![discord-api-types](https://raw.githubusercontent.com/discordjs/discord-api-types/main/website/static/svgs/logo_long_blurple.svg)](https://github.com/discordjs/discord-api-types)
[![GitHub](https://img.shields.io/github/license/discordjs/discord-api-types)](https://github.com/discordjs/discord-api-types/blob/main/LICENSE.md)
[![npm](https://img.shields.io/npm/v/discord-api-types?color=crimson&logo=npm)](https://www.npmjs.com/package/discord-api-types)
@@ -8,6 +8,7 @@
[![Patreon Donate](https://img.shields.io/badge/patreon-donate-brightgreen.svg?label=Donate%20with%20Patreon&logo=patreon&colorB=F96854&link=https://www.patreon.com/vladfrangu)](https://www.patreon.com/vladfrangu)
[![Ko-fi Donate](https://img.shields.io/badge/kofi-donate-brightgreen.svg?label=Donate%20with%20Ko-fi&logo=ko-fi&colorB=F16061&link=https://ko-fi.com/wolfgalvlad&logoColor=FFFFFF)](https://ko-fi.com/wolfgalvlad)
[![GitHub Sponsors](https://img.shields.io/badge/patreon-donate-brightgreen.svg?label=Sponsor%20through%20GitHub&logo=github&colorB=F96854&link=https://github.com/sponsors/vladfrangu)](https://github.com/sponsors/vladfrangu)
[![Powered by Vercel](https://raw.githubusercontent.com/discordjs/discord-api-types/main/website/static/powered-by-vercel.svg)](https://vercel.com?utm_source=discordjs&utm_campaign=oss)
Simple type definitions for the [Discord API](https://discord.com/developers/docs/intro).

View File

@@ -274,6 +274,7 @@ export type GatewayDispatchPayload =
| GatewayChannelModifyDispatch
| GatewayChannelPinsUpdateDispatch
| GatewayGuildBanModifyDispatch
| GatewayGuildCreateDispatch
| GatewayGuildDeleteDispatch
| GatewayGuildEmojisUpdateDispatch
| GatewayGuildIntegrationsUpdateDispatch
@@ -1124,7 +1125,7 @@ export type GatewayMessageCreateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#message-create
*/
export type GatewayMessageCreateDispatchData = APIMessage;
export type GatewayMessageCreateDispatchData = Omit<APIMessage, 'mentions'> & GatewayMessageEventExtraFields;
/**
* https://discord.com/developers/docs/topics/gateway#message-update
@@ -1137,10 +1138,43 @@ export type GatewayMessageUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#message-update
*/
export type GatewayMessageUpdateDispatchData = {
id: Snowflake;
channel_id: Snowflake;
} & Partial<APIMessage>;
export type GatewayMessageUpdateDispatchData = Omit<Partial<APIMessage>, 'mentions'> &
GatewayMessageEventExtraFields & {
/**
* ID of the message
*/
id: Snowflake;
/**
* ID of the channel the message was sent in
*/
channel_id: Snowflake;
};
export interface GatewayMessageEventExtraFields {
/**
* ID of the guild the message was sent in
*/
guild_id?: Snowflake;
/**
* Member properties for this message's author
*
* The member object exists in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events
* from text-based guild channels
*
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
member?: APIGuildMember;
/**
* Users specifically mentioned in the message
*
* The `member` field is only present in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events
* from text-based guild channels
*
* See https://discord.com/developers/docs/resources/user#user-object
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
mentions: (APIUser & { member?: Omit<APIGuildMember, 'user'> })[];
}
/**
* https://discord.com/developers/docs/topics/gateway#message-delete
@@ -1568,15 +1602,15 @@ export interface GatewayIdentifyProperties {
/**
* Your operating system
*/
$os: string;
os: string;
/**
* Your library name
*/
$browser: string;
browser: string;
/**
* Your library name
*/
$device: string;
device: string;
}
/**

View File

@@ -273,6 +273,7 @@ export type GatewayDispatchPayload =
| GatewayChannelModifyDispatch
| GatewayChannelPinsUpdateDispatch
| GatewayGuildBanModifyDispatch
| GatewayGuildCreateDispatch
| GatewayGuildDeleteDispatch
| GatewayGuildEmojisUpdateDispatch
| GatewayGuildIntegrationsUpdateDispatch
@@ -1123,7 +1124,7 @@ export type GatewayMessageCreateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#message-create
*/
export type GatewayMessageCreateDispatchData = APIMessage;
export type GatewayMessageCreateDispatchData = Omit<APIMessage, 'mentions'> & GatewayMessageEventExtraFields;
/**
* https://discord.com/developers/docs/topics/gateway#message-update
@@ -1136,10 +1137,43 @@ export type GatewayMessageUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#message-update
*/
export type GatewayMessageUpdateDispatchData = {
id: Snowflake;
channel_id: Snowflake;
} & Partial<APIMessage>;
export type GatewayMessageUpdateDispatchData = Omit<Partial<APIMessage>, 'mentions'> &
GatewayMessageEventExtraFields & {
/**
* ID of the message
*/
id: Snowflake;
/**
* ID of the channel the message was sent in
*/
channel_id: Snowflake;
};
export interface GatewayMessageEventExtraFields {
/**
* ID of the guild the message was sent in
*/
guild_id?: Snowflake;
/**
* Member properties for this message's author
*
* The member object exists in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events
* from text-based guild channels
*
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
member?: APIGuildMember;
/**
* Users specifically mentioned in the message
*
* The `member` field is only present in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events
* from text-based guild channels
*
* See https://discord.com/developers/docs/resources/user#user-object
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
mentions: (APIUser & { member?: Omit<APIGuildMember, 'user'> })[];
}
/**
* https://discord.com/developers/docs/topics/gateway#message-delete
@@ -1567,15 +1601,15 @@ export interface GatewayIdentifyProperties {
/**
* Your operating system
*/
$os: string;
os: string;
/**
* Your library name
*/
$browser: string;
browser: string;
/**
* Your library name
*/
$device: string;
device: string;
}
/**

View File

@@ -12,7 +12,7 @@ interface APIApplicationCommandIntegerOptionBase
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
* If the option is an `INTEGER` or `NUMBER` type, the maximum value permitted.
*/
max_value?: number;
}

View File

@@ -12,7 +12,7 @@ interface APIApplicationCommandNumberOptionBase
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
* If the option is an `INTEGER` or `NUMBER` type, the maximum value permitted.
*/
max_value?: number;
}

View File

@@ -5,8 +5,20 @@ import type {
} from './base.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
interface APIApplicationCommandStringOptionBase
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.String> {
/**
* For option type `STRING`, the minimum allowed length (minimum of `0`, maximum of `6000`).
*/
min_length?: number;
/**
* For option type `STRING`, the maximum allowed length (minimum of `1`, maximum of `6000`).
*/
max_length?: number;
}
export type APIApplicationCommandStringOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandOptionBase<ApplicationCommandOptionType.String>,
APIApplicationCommandStringOptionBase,
APIApplicationCommandOptionChoice<string>
>;

View File

@@ -31,7 +31,7 @@ export interface APIMessageInteraction {
*/
type: InteractionType;
/**
* The name of the ApplicationCommand
* The name of the application command, including subcommands and subcommand groups
*/
name: string;
/**
@@ -104,6 +104,10 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
* For components, the message they were attached to
*/
message?: APIMessage;
/**
* Bitwise set of permissions the app or bot has within the channel the interaction was sent from
*/
app_permissions?: Permissions;
/**
* The selected language of the invoking user
*/

View File

@@ -4,7 +4,6 @@
import type { APIApplication } from './application.ts';
import type { APIPartialEmoji } from './emoji.ts';
import type { APIGuildMember } from './guild.ts';
import type { APIMessageInteraction } from './interactions.ts';
import type { APIRole } from './permissions.ts';
import type { APISticker, APIStickerItem } from './sticker.ts';
@@ -326,10 +325,6 @@ export interface APIMessage {
* ID of the channel the message was sent in
*/
channel_id: Snowflake;
/**
* ID of the guild the message was sent in
*/
guild_id?: Snowflake;
/**
* The author of this message (only a valid user in the case where the message is generated by a user or bot user)
*
@@ -339,15 +334,6 @@ export interface APIMessage {
* See https://discord.com/developers/docs/resources/user#user-object
*/
author: APIUser;
/**
* Member properties for this message's author
*
* The member object exists in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events
* from text-based guild channels
*
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
member?: APIGuildMember;
/**
* Contents of the message
*/
@@ -377,7 +363,7 @@ export interface APIMessage {
* See https://discord.com/developers/docs/resources/user#user-object
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
mentions: (APIUser & { member?: Omit<APIGuildMember, 'user'> })[];
mentions: APIUser[];
/**
* Roles specifically mentioned in this message
*
@@ -517,11 +503,11 @@ export enum MessageType {
ChannelNameChange,
ChannelIconChange,
ChannelPinnedMessage,
GuildMemberJoin,
UserPremiumGuildSubscription,
UserPremiumGuildSubscriptionTier1,
UserPremiumGuildSubscriptionTier2,
UserPremiumGuildSubscriptionTier3,
UserJoin,
GuildBoost,
GuildBoostTier1,
GuildBoostTier2,
GuildBoostTier3,
ChannelFollowAdd,
GuildDiscoveryDisqualified = 14,
GuildDiscoveryRequalified,
@@ -917,6 +903,10 @@ export interface APIEmbedVideo {
* Source url of video
*/
url?: string;
/**
* A proxied url of the video
*/
proxy_url?: string;
/**
* Height of video
*/

View File

@@ -143,8 +143,16 @@ export enum UserFlags {
BotHTTPInteractions = 1 << 19,
/**
* User has been identified as spammer
*
* @unstable This user flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
Spammer = 1 << 20,
/**
* User's account has been quarantined based on recent activity
*
* @unstable This user flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
Quarantined = Math.pow(2, 44),
}
/**

View File

@@ -15,7 +15,7 @@ interface APIApplicationCommandIntegerOptionBase
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
* If the option is an `INTEGER` or `NUMBER` type, the maximum value permitted.
*/
max_value?: number;
}

View File

@@ -15,7 +15,7 @@ interface APIApplicationCommandNumberOptionBase
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
* If the option is an `INTEGER` or `NUMBER` type, the maximum value permitted.
*/
max_value?: number;
}

View File

@@ -145,8 +145,16 @@ export enum UserFlags {
BotHTTPInteractions = 1 << 19,
/**
* User has been identified as spammer
*
* @unstable This user flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
Spammer = 1 << 20,
/**
* User's account has been quarantined based on recent activity
*
* @unstable This user flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
Quarantined = Math.pow(2, 44),
}
/**

View File

@@ -12,7 +12,7 @@ interface APIApplicationCommandIntegerOptionBase
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
* If the option is an `INTEGER` or `NUMBER` type, the maximum value permitted.
*/
max_value?: number;
}

View File

@@ -12,7 +12,7 @@ interface APIApplicationCommandNumberOptionBase
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
* If the option is an `INTEGER` or `NUMBER` type, the maximum value permitted.
*/
max_value?: number;
}

View File

@@ -5,8 +5,20 @@ import type {
} from './base.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
interface APIApplicationCommandStringOptionBase
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.String> {
/**
* For option type `STRING`, the minimum allowed length (minimum of `0`, maximum of `6000`).
*/
min_length?: number;
/**
* For option type `STRING`, the maximum allowed length (minimum of `1`, maximum of `6000`).
*/
max_length?: number;
}
export type APIApplicationCommandStringOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandOptionBase<ApplicationCommandOptionType.String>,
APIApplicationCommandStringOptionBase,
APIApplicationCommandOptionChoice<string>
>;

View File

@@ -31,7 +31,7 @@ export interface APIMessageInteraction {
*/
type: InteractionType;
/**
* The name of the ApplicationCommand
* The name of the application command, including subcommands and subcommand groups
*/
name: string;
/**
@@ -104,6 +104,10 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
* For components, the message they were attached to
*/
message?: APIMessage;
/**
* Bitwise set of permissions the app or bot has within the channel the interaction was sent from
*/
app_permissions?: Permissions;
/**
* The selected language of the invoking user
*/

View File

@@ -4,7 +4,6 @@
import type { APIApplication } from './application.ts';
import type { APIPartialEmoji } from './emoji.ts';
import type { APIGuildMember } from './guild.ts';
import type { APIMessageInteraction } from './interactions.ts';
import type { APIRole } from './permissions.ts';
import type { APISticker, APIStickerItem } from './sticker.ts';
@@ -326,10 +325,6 @@ export interface APIMessage {
* ID of the channel the message was sent in
*/
channel_id: Snowflake;
/**
* ID of the guild the message was sent in
*/
guild_id?: Snowflake;
/**
* The author of this message (only a valid user in the case where the message is generated by a user or bot user)
*
@@ -339,15 +334,6 @@ export interface APIMessage {
* See https://discord.com/developers/docs/resources/user#user-object
*/
author: APIUser;
/**
* Member properties for this message's author
*
* The member object exists in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events
* from text-based guild channels
*
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
member?: APIGuildMember;
/**
* Contents of the message
*/
@@ -377,7 +363,7 @@ export interface APIMessage {
* See https://discord.com/developers/docs/resources/user#user-object
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
mentions: (APIUser & { member?: Omit<APIGuildMember, 'user'> })[];
mentions: APIUser[];
/**
* Roles specifically mentioned in this message
*
@@ -517,11 +503,11 @@ export enum MessageType {
ChannelNameChange,
ChannelIconChange,
ChannelPinnedMessage,
GuildMemberJoin,
UserPremiumGuildSubscription,
UserPremiumGuildSubscriptionTier1,
UserPremiumGuildSubscriptionTier2,
UserPremiumGuildSubscriptionTier3,
UserJoin,
GuildBoost,
GuildBoostTier1,
GuildBoostTier2,
GuildBoostTier3,
ChannelFollowAdd,
GuildDiscoveryDisqualified = 14,
GuildDiscoveryRequalified,
@@ -921,6 +907,10 @@ export interface APIEmbedVideo {
* Source url of video
*/
url?: string;
/**
* A proxied url of the video
*/
proxy_url?: string;
/**
* Height of video
*/

View File

@@ -143,8 +143,16 @@ export enum UserFlags {
BotHTTPInteractions = 1 << 19,
/**
* User has been identified as spammer
*
* @unstable This user flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
Spammer = 1 << 20,
/**
* User's account has been quarantined based on recent activity
*
* @unstable This user flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
Quarantined = Math.pow(2, 44),
}
/**

View File

@@ -70,6 +70,8 @@ export enum RESTJSONErrorCodes {
AnnouncementEditLimitExceeded = 20022,
UnderMinimumAge = 20024,
ChannelSendRateLimit = 20028,
ServerSendRateLimit,
@@ -99,8 +101,8 @@ export enum RESTJSONErrorCodes {
MaximumNumberOfServerCategoriesReached = 30030,
GuildAlreadyHasTemplate = 30031,
MaximumThreadParticipants = 30033,
MaximumNumberOfApplicationCommandsReached,
MaximumThreadParticipants,
MaximumNumberOfNonGuildMemberBansHasBeenExceeded = 30035,
@@ -116,6 +118,8 @@ export enum RESTJSONErrorCodes {
MaximumNumberOfPinnedThreadsInForumHasBeenReached,
MaximumNumberOfTagsInForumHasBeenReached,
BitrateIsTooHighForChannelOfThisType = 30052,
Unauthorized = 40001,
VerifyYourAccount,
OpeningDirectMessagesTooFast,
@@ -148,6 +152,7 @@ export enum RESTJSONErrorCodes {
InvalidToken,
NoteWasTooLong,
ProvidedTooFewOrTooManyMessagesToDelete,
InvalidMFALevel,
MessageCanOnlyBePinnedInTheChannelItWasSentIn = 50019,
InviteCodeInvalidOrTaken,
@@ -225,6 +230,8 @@ export enum RESTJSONErrorCodes {
CannotUpdateAFinishedEvent = 180000,
FailedToCreateStageNeededForStageEvent = 180002,
WebhooksCanOnlyCreateThreadsInForumChannels = 220003,
}
/**

View File

@@ -64,7 +64,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
/**
* Whether the channel is nsfw
*
* Channel types: text, news
* Channel types: text, voice, news
*/
nsfw?: boolean | null;
/**
@@ -96,7 +96,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
/**
* ID of the new parent category for a channel
*
* Channel types: text, news, voice
* Channel types: text, voice, news
*/
parent_id?: Snowflake | null;
/**

View File

@@ -20,6 +20,7 @@ import type {
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
GuildFeature,
GuildMFALevel,
GuildSystemChannelFlags,
GuildVerificationLevel,
GuildWidgetStyle,
@@ -158,6 +159,23 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
export type RESTPostAPIGuildsResult = APIGuild;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export interface RESTPostAPIGuildsMFAJSONBody {
/**
* MFA level
*
* See https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
*/
level: GuildMFALevel;
}
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export type RESTPostAPIGuildsMFAResult = RESTPostAPIGuildsMFAJSONBody;
/**
* https://discord.com/developers/docs/resources/guild#get-guild
*/

View File

@@ -129,8 +129,10 @@ export type RESTPatchAPIApplicationGuildCommandResult = Omit<APIApplicationComma
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsJSONBody = (
| Omit<RESTPostAPIChatInputApplicationCommandsJSONBody, 'dm_permission'>
| Omit<RESTPostAPIContextMenuApplicationCommandsJSONBody, 'dm_permission'>
| (Omit<RESTPostAPIChatInputApplicationCommandsJSONBody, 'dm_permission'> &
Pick<Partial<APIApplicationCommand>, 'id'>)
| (Omit<RESTPostAPIContextMenuApplicationCommandsJSONBody, 'dm_permission'> &
Pick<Partial<APIApplicationCommand>, 'id'>)
)[];
/**

View File

@@ -274,6 +274,14 @@ export const Routes = {
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}` as const;
},
/**
* Route for:
* - POST `/guilds/{guild.id}/mfa`
*/
guildMFA(guildId: Snowflake) {
return `/guilds/${guildId}/mfa` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/bans`
@@ -836,6 +844,262 @@ export const Routes = {
},
};
export const StickerPackApplicationId = '710982414301790216';
export const CDNRoutes = {
/**
* Route for:
* - GET `/emojis/{emoji.id}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
emoji(emojiId: Snowflake, format: EmojiFormat) {
return `/emojis/${emojiId}.${format}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/icons/{guild.id}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildIcon(guildId: Snowflake, guildIcon: string, format: GuildIconFormat) {
return `icons/${guildId}/${guildIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/splashes/{guild.id}/{guild.splash}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildSplash(guildId: Snowflake, guildSplash: string, format: GuildSplashFormat) {
return `/splashes/${guildId}/${guildSplash}.${format}` as const;
},
/**
* Route for:
* - GET `/discovery-splashes/{guild.id}/{guild.discovery_splash}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildDiscoverySplash(guildId: Snowflake, guildDiscoverySplash: string, format: GuildDiscoverySplashFormat) {
return `/discovery-splashes/${guildId}/${guildDiscoverySplash}.${format}` as const;
},
/**
* Route for:
* - GET `/banners/{guild.id}/{guild.banner}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildBanner(guildId: Snowflake, guildBanner: string, format: GuildBannerFormat) {
return `/banners/${guildId}/${guildBanner}.${format}` as const;
},
/**
* Route for:
* - GET `/banners/{user.id}/{user.banner}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
userBanner(userId: Snowflake, userBanner: string, format: UserBannerFormat) {
return `/banners/${userId}/${userBanner}.${format}` as const;
},
/**
* Route for:
* - GET `/embed/avatars/{user.discriminator % 5}.png`
*
* The `userDiscriminator` parameter should be the user discriminator modulo 5 (e.g. 1337 % 5 = 2)
*
* This route supports the extension: PNG
*/
defaultUserAvatar(userDiscriminator: DefaultUserAvatarAssets) {
return `/embed/avatars/${userDiscriminator}.png` as const;
},
/**
* Route for:
* - GET `/avatars/{user.id}/{user.avatar}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
userAvatar(userId: Snowflake, userAvatar: string, format: UserAvatarFormat) {
return `/avatars/${userId}/${userAvatar}.${format}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/users/{user.id}/{guild_member.avatar}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildMemberAvatar(guildId: Snowflake, userId: Snowflake, memberAvatar: string, format: GuildMemberAvatarFormat) {
return `/guilds/${guildId}/users/${userId}/avatars/${memberAvatar}.${format}` as const;
},
/**
* Route for:
* - GET `/app-icons/{application.id}/{application.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
applicationIcon(applicationId: Snowflake, applicationIcon: string, format: ApplicationIconFormat) {
return `/app-icons/${applicationId}/${applicationIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/app-icons/{application.id}/{application.cover_image}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
applicationCover(applicationId: Snowflake, applicationCoverImage: string, format: ApplicationCoverFormat) {
return `/app-icons/${applicationId}/${applicationCoverImage}.${format}` as const;
},
/**
* Route for:
* - GET `/app-icons/{application.id}/{application.asset_id}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
applicationAsset(applicationId: Snowflake, applicationAssetId: string, format: ApplicationAssetFormat) {
return `/app-icons/${applicationId}/${applicationAssetId}.${format}` as const;
},
/**
* Route for:
* - GET `/app-assets/{application.id}/achievements/{achievement.id}/icons/{achievement.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
achievementIcon(
applicationId: Snowflake,
achievementId: Snowflake,
achievementIconHash: string,
format: AchievementIconFormat,
) {
return `/app-assets/${applicationId}/achievements/${achievementId}/icons/${achievementIconHash}.${format}` as const;
},
/**
* Route for:
* - GET `/app-assets/710982414301790216/store/{sticker_pack.banner.asset_id}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
stickerPackBanner(stickerPackBannerAssetId: Snowflake, format: StickerPackBannerFormat) {
return `/app-assets/${StickerPackApplicationId}/store/${stickerPackBannerAssetId}.${format}` as const;
},
/**
* Route for:
* - GET `team-icons/{team.id}/{team.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
teamIcon(teamId: Snowflake, teamIcon: string, format: TeamIconFormat) {
return `/team-icons/${teamId}/${teamIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/stickers/{sticker.id}.{png|json}`
*
* This route supports the extensions: PNG, Lottie
*/
sticker(stickerId: Snowflake, format: StickerFormat) {
return `/stickers/${stickerId}.${format}` as const;
},
/**
* Route for:
* - GET `/role-icons/{role.id}/{role.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
roleIcon(roleId: Snowflake, roleIcon: string, format: RoleIconFormat) {
return `/role-icons/${roleId}/${roleIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/guild-events/{guild_scheduled_event.id}/{guild_scheduled_event.image}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildScheduledEventCover(
guildScheduledEventId: Snowflake,
guildScheduledEventCoverImage: string,
format: GuildScheduledEventCoverFormat,
) {
return `/guild-events/${guildScheduledEventId}/${guildScheduledEventCoverImage}.${format}` as const;
},
/**
* Route for:
* - GET `/guilds/${guild.id}/users/${user.id}/banners/${guild_member.banner}.{png|jpeg|webp|gif}`
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildMemberBanner(guildId: Snowflake, userId: Snowflake, guildMemberBanner: string, format: GuildMemberBannerFormat) {
return `/guilds/${guildId}/users/${userId}/banners/${guildMemberBanner}.${format}` as const;
},
};
export type DefaultUserAvatarAssets = 0 | 1 | 2 | 3 | 4 | 5;
export type EmojiFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type GuildIconFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type GuildSplashFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildDiscoverySplashFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type UserBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type DefaultUserAvatar = Extract<ImageFormat, ImageFormat.PNG>;
export type UserAvatarFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type GuildMemberAvatarFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type ApplicationIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type ApplicationCoverFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type ApplicationAssetFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type AchievementIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type StickerPackBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type TeamIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type StickerFormat = Extract<ImageFormat, ImageFormat.PNG | ImageFormat.Lottie>;
export type RoleIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildScheduledEventCoverFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildMemberBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export enum ImageFormat {
JPEG = 'jpeg',
PNG = 'png',
WebP = 'webp',
GIF = 'gif',
Lottie = 'json',
}
export interface CDNQuery {
/**
* The returned image can have the size changed by using this query parameter
*
* Image size can be any power of two between 16 and 4096
*/
size?: number;
}
export const RouteBases = {
api: `https://discord.com/api/v${APIVersion}`,
cdn: 'https://cdn.discordapp.com',

View File

@@ -144,6 +144,12 @@ export type RESTPostAPIWebhookWithTokenJSONBody = AddUndefinedToPossiblyUndefine
* Message flags combined as a bitfield
*/
flags?: MessageFlags;
/**
* Name of thread to create
*
* Available only if the webhook is in a forum channel and a thread is not specified in {@link RESTPostAPIWebhookWithTokenQuery.thread_id} query parameter
*/
thread_name?: string;
}>;
/**
@@ -171,6 +177,8 @@ export interface RESTPostAPIWebhookWithTokenQuery {
wait?: boolean;
/**
* Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived.
*
* Available only if the {@link RESTPostAPIWebhookWithTokenJSONBody.thread_name} JSON body property is not specified
*/
thread_id?: Snowflake;
}

View File

@@ -64,7 +64,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
/**
* Whether the channel is nsfw
*
* Channel types: text, news
* Channel types: text, voice, news
*/
nsfw?: boolean | null;
/**
@@ -96,7 +96,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
/**
* ID of the new parent category for a channel
*
* Channel types: text, news, voice
* Channel types: text, voice, news
*/
parent_id?: Snowflake | null;
/**

View File

@@ -18,6 +18,7 @@ import type {
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
GuildFeature,
GuildMFALevel,
GuildSystemChannelFlags,
GuildVerificationLevel,
GuildWidgetStyle,
@@ -158,6 +159,23 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
export type RESTPostAPIGuildsResult = APIGuild;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export interface RESTPostAPIGuildsMFAJSONBody {
/**
* MFA level
*
* See https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
*/
level: GuildMFALevel;
}
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export type RESTPostAPIGuildsMFAResult = RESTPostAPIGuildsMFAJSONBody;
/**
* https://discord.com/developers/docs/resources/guild#get-guild
*/

View File

@@ -129,8 +129,10 @@ export type RESTPatchAPIApplicationGuildCommandResult = Omit<APIApplicationComma
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsJSONBody = (
| Omit<RESTPostAPIChatInputApplicationCommandsJSONBody, 'dm_permission'>
| Omit<RESTPostAPIContextMenuApplicationCommandsJSONBody, 'dm_permission'>
| (Omit<RESTPostAPIChatInputApplicationCommandsJSONBody, 'dm_permission'> &
Pick<Partial<APIApplicationCommand>, 'id'>)
| (Omit<RESTPostAPIContextMenuApplicationCommandsJSONBody, 'dm_permission'> &
Pick<Partial<APIApplicationCommand>, 'id'>)
)[];
/**

View File

@@ -274,6 +274,14 @@ export const Routes = {
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}` as const;
},
/**
* Route for:
* - POST `/guilds/{guild.id}/mfa`
*/
guildMFA(guildId: Snowflake) {
return `/guilds/${guildId}/mfa` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/bans`
@@ -845,6 +853,262 @@ export const Routes = {
},
};
export const StickerPackApplicationId = '710982414301790216';
export const CDNRoutes = {
/**
* Route for:
* - GET `/emojis/{emoji.id}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
emoji(emojiId: Snowflake, format: EmojiFormat) {
return `/emojis/${emojiId}.${format}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/icons/{guild.id}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildIcon(guildId: Snowflake, guildIcon: string, format: GuildIconFormat) {
return `icons/${guildId}/${guildIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/splashes/{guild.id}/{guild.splash}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildSplash(guildId: Snowflake, guildSplash: string, format: GuildSplashFormat) {
return `/splashes/${guildId}/${guildSplash}.${format}` as const;
},
/**
* Route for:
* - GET `/discovery-splashes/{guild.id}/{guild.discovery_splash}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildDiscoverySplash(guildId: Snowflake, guildDiscoverySplash: string, format: GuildDiscoverySplashFormat) {
return `/discovery-splashes/${guildId}/${guildDiscoverySplash}.${format}` as const;
},
/**
* Route for:
* - GET `/banners/{guild.id}/{guild.banner}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildBanner(guildId: Snowflake, guildBanner: string, format: GuildBannerFormat) {
return `/banners/${guildId}/${guildBanner}.${format}` as const;
},
/**
* Route for:
* - GET `/banners/{user.id}/{user.banner}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
userBanner(userId: Snowflake, userBanner: string, format: UserBannerFormat) {
return `/banners/${userId}/${userBanner}.${format}` as const;
},
/**
* Route for:
* - GET `/embed/avatars/{user.discriminator % 5}.png`
*
* The `userDiscriminator` parameter should be the user discriminator modulo 5 (e.g. 1337 % 5 = 2)
*
* This route supports the extension: PNG
*/
defaultUserAvatar(userDiscriminator: DefaultUserAvatarAssets) {
return `/embed/avatars/${userDiscriminator}.png` as const;
},
/**
* Route for:
* - GET `/avatars/{user.id}/{user.avatar}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
userAvatar(userId: Snowflake, userAvatar: string, format: UserAvatarFormat) {
return `/avatars/${userId}/${userAvatar}.${format}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/users/{user.id}/{guild_member.avatar}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildMemberAvatar(guildId: Snowflake, userId: Snowflake, memberAvatar: string, format: GuildMemberAvatarFormat) {
return `/guilds/${guildId}/users/${userId}/avatars/${memberAvatar}.${format}` as const;
},
/**
* Route for:
* - GET `/app-icons/{application.id}/{application.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
applicationIcon(applicationId: Snowflake, applicationIcon: string, format: ApplicationIconFormat) {
return `/app-icons/${applicationId}/${applicationIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/app-icons/{application.id}/{application.cover_image}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
applicationCover(applicationId: Snowflake, applicationCoverImage: string, format: ApplicationCoverFormat) {
return `/app-icons/${applicationId}/${applicationCoverImage}.${format}` as const;
},
/**
* Route for:
* - GET `/app-icons/{application.id}/{application.asset_id}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
applicationAsset(applicationId: Snowflake, applicationAssetId: string, format: ApplicationAssetFormat) {
return `/app-icons/${applicationId}/${applicationAssetId}.${format}` as const;
},
/**
* Route for:
* - GET `/app-assets/{application.id}/achievements/{achievement.id}/icons/{achievement.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
achievementIcon(
applicationId: Snowflake,
achievementId: Snowflake,
achievementIconHash: string,
format: AchievementIconFormat,
) {
return `/app-assets/${applicationId}/achievements/${achievementId}/icons/${achievementIconHash}.${format}` as const;
},
/**
* Route for:
* - GET `/app-assets/710982414301790216/store/{sticker_pack.banner.asset_id}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
stickerPackBanner(stickerPackBannerAssetId: Snowflake, format: StickerPackBannerFormat) {
return `/app-assets/${StickerPackApplicationId}/store/${stickerPackBannerAssetId}.${format}` as const;
},
/**
* Route for:
* - GET `team-icons/{team.id}/{team.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
teamIcon(teamId: Snowflake, teamIcon: string, format: TeamIconFormat) {
return `/team-icons/${teamId}/${teamIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/stickers/{sticker.id}.{png|json}`
*
* This route supports the extensions: PNG, Lottie
*/
sticker(stickerId: Snowflake, format: StickerFormat) {
return `/stickers/${stickerId}.${format}` as const;
},
/**
* Route for:
* - GET `/role-icons/{role.id}/{role.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
roleIcon(roleId: Snowflake, roleIcon: string, format: RoleIconFormat) {
return `/role-icons/${roleId}/${roleIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/guild-events/{guild_scheduled_event.id}/{guild_scheduled_event.image}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildScheduledEventCover(
guildScheduledEventId: Snowflake,
guildScheduledEventCoverImage: string,
format: GuildScheduledEventCoverFormat,
) {
return `/guild-events/${guildScheduledEventId}/${guildScheduledEventCoverImage}.${format}` as const;
},
/**
* Route for:
* - GET `/guilds/${guild.id}/users/${user.id}/banners/${guild_member.banner}.{png|jpeg|webp|gif}`
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildMemberBanner(guildId: Snowflake, userId: Snowflake, guildMemberBanner: string, format: GuildMemberBannerFormat) {
return `/guilds/${guildId}/users/${userId}/banners/${guildMemberBanner}.${format}` as const;
},
};
export type DefaultUserAvatarAssets = 0 | 1 | 2 | 3 | 4 | 5;
export type EmojiFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type GuildIconFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type GuildSplashFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildDiscoverySplashFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type UserBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type DefaultUserAvatar = Extract<ImageFormat, ImageFormat.PNG>;
export type UserAvatarFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type GuildMemberAvatarFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type ApplicationIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type ApplicationCoverFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type ApplicationAssetFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type AchievementIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type StickerPackBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type TeamIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type StickerFormat = Extract<ImageFormat, ImageFormat.PNG | ImageFormat.Lottie>;
export type RoleIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildScheduledEventCoverFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildMemberBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export enum ImageFormat {
JPEG = 'jpeg',
PNG = 'png',
WebP = 'webp',
GIF = 'gif',
Lottie = 'json',
}
export interface CDNQuery {
/**
* The returned image can have the size changed by using this query parameter
*
* Image size can be any power of two between 16 and 4096
*/
size?: number;
}
export const RouteBases = {
api: `https://discord.com/api/v${APIVersion}`,
cdn: 'https://cdn.discordapp.com',

View File

@@ -144,6 +144,12 @@ export type RESTPostAPIWebhookWithTokenJSONBody = AddUndefinedToPossiblyUndefine
* Message flags combined as a bitfield
*/
flags?: MessageFlags;
/**
* Name of thread to create
*
* Available only if the webhook is in a forum channel and a thread is not specified in {@link RESTPostAPIWebhookWithTokenQuery.thread_id} query parameter
*/
thread_name?: string;
}>;
/**
@@ -171,6 +177,8 @@ export interface RESTPostAPIWebhookWithTokenQuery {
wait?: boolean;
/**
* Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived.
*
* Available only if the {@link RESTPostAPIWebhookWithTokenJSONBody.thread_name} JSON body property is not specified
*/
thread_id?: Snowflake;
}

View File

@@ -7,7 +7,9 @@ export type Nullable<T> = {
* (since JSON.stringify ignores undefined properties)
*/
export type AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Base> = {
[K in keyof Base]: Base[K] extends Exclude<Base[K], undefined> ? Base[K] : Base[K] | undefined;
[K in keyof Base]: Base[K] extends Exclude<Base[K], undefined>
? AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Base[K]>
: AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Base[K]> | undefined;
};
export type StrictPartial<Base> = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Partial<Base>>;

View File

@@ -274,6 +274,7 @@ export type GatewayDispatchPayload =
| GatewayChannelModifyDispatch
| GatewayChannelPinsUpdateDispatch
| GatewayGuildBanModifyDispatch
| GatewayGuildCreateDispatch
| GatewayGuildDeleteDispatch
| GatewayGuildEmojisUpdateDispatch
| GatewayGuildIntegrationsUpdateDispatch
@@ -1124,7 +1125,7 @@ export type GatewayMessageCreateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#message-create
*/
export type GatewayMessageCreateDispatchData = APIMessage;
export type GatewayMessageCreateDispatchData = Omit<APIMessage, 'mentions'> & GatewayMessageEventExtraFields;
/**
* https://discord.com/developers/docs/topics/gateway#message-update
@@ -1137,10 +1138,43 @@ export type GatewayMessageUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#message-update
*/
export type GatewayMessageUpdateDispatchData = {
id: Snowflake;
channel_id: Snowflake;
} & Partial<APIMessage>;
export type GatewayMessageUpdateDispatchData = Omit<Partial<APIMessage>, 'mentions'> &
GatewayMessageEventExtraFields & {
/**
* ID of the message
*/
id: Snowflake;
/**
* ID of the channel the message was sent in
*/
channel_id: Snowflake;
};
export interface GatewayMessageEventExtraFields {
/**
* ID of the guild the message was sent in
*/
guild_id?: Snowflake;
/**
* Member properties for this message's author
*
* The member object exists in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events
* from text-based guild channels
*
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
member?: APIGuildMember;
/**
* Users specifically mentioned in the message
*
* The `member` field is only present in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events
* from text-based guild channels
*
* See https://discord.com/developers/docs/resources/user#user-object
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
mentions: (APIUser & { member?: Omit<APIGuildMember, 'user'> })[];
}
/**
* https://discord.com/developers/docs/topics/gateway#message-delete
@@ -1568,15 +1602,15 @@ export interface GatewayIdentifyProperties {
/**
* Your operating system
*/
$os: string;
os: string;
/**
* Your library name
*/
$browser: string;
browser: string;
/**
* Your library name
*/
$device: string;
device: string;
}
/**

View File

@@ -273,6 +273,7 @@ export type GatewayDispatchPayload =
| GatewayChannelModifyDispatch
| GatewayChannelPinsUpdateDispatch
| GatewayGuildBanModifyDispatch
| GatewayGuildCreateDispatch
| GatewayGuildDeleteDispatch
| GatewayGuildEmojisUpdateDispatch
| GatewayGuildIntegrationsUpdateDispatch
@@ -1123,7 +1124,7 @@ export type GatewayMessageCreateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#message-create
*/
export type GatewayMessageCreateDispatchData = APIMessage;
export type GatewayMessageCreateDispatchData = Omit<APIMessage, 'mentions'> & GatewayMessageEventExtraFields;
/**
* https://discord.com/developers/docs/topics/gateway#message-update
@@ -1136,10 +1137,43 @@ export type GatewayMessageUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#message-update
*/
export type GatewayMessageUpdateDispatchData = {
id: Snowflake;
channel_id: Snowflake;
} & Partial<APIMessage>;
export type GatewayMessageUpdateDispatchData = Omit<Partial<APIMessage>, 'mentions'> &
GatewayMessageEventExtraFields & {
/**
* ID of the message
*/
id: Snowflake;
/**
* ID of the channel the message was sent in
*/
channel_id: Snowflake;
};
export interface GatewayMessageEventExtraFields {
/**
* ID of the guild the message was sent in
*/
guild_id?: Snowflake;
/**
* Member properties for this message's author
*
* The member object exists in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events
* from text-based guild channels
*
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
member?: APIGuildMember;
/**
* Users specifically mentioned in the message
*
* The `member` field is only present in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events
* from text-based guild channels
*
* See https://discord.com/developers/docs/resources/user#user-object
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
mentions: (APIUser & { member?: Omit<APIGuildMember, 'user'> })[];
}
/**
* https://discord.com/developers/docs/topics/gateway#message-delete
@@ -1567,15 +1601,15 @@ export interface GatewayIdentifyProperties {
/**
* Your operating system
*/
$os: string;
os: string;
/**
* Your library name
*/
$browser: string;
browser: string;
/**
* Your library name
*/
$device: string;
device: string;
}
/**

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "discord-api-types",
"version": "0.33.2",
"version": "0.36.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "discord-api-types",
"version": "0.33.2",
"version": "0.36.2",
"license": "MIT",
"devDependencies": {
"@babel/runtime-corejs3": "^7.18.0",

View File

@@ -1,7 +1,8 @@
{
"name": "discord-api-types",
"version": "0.33.2",
"version": "0.36.2",
"description": "Discord API typings that are kept up to date for use in bot library creation.",
"homepage": "https://discord-api-types.dev",
"exports": {
"./globals": {
"require": "./globals.js",

View File

@@ -12,7 +12,7 @@ interface APIApplicationCommandIntegerOptionBase
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
* If the option is an `INTEGER` or `NUMBER` type, the maximum value permitted.
*/
max_value?: number;
}

View File

@@ -12,7 +12,7 @@ interface APIApplicationCommandNumberOptionBase
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
* If the option is an `INTEGER` or `NUMBER` type, the maximum value permitted.
*/
max_value?: number;
}

View File

@@ -5,8 +5,20 @@ import type {
} from './base';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared';
interface APIApplicationCommandStringOptionBase
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.String> {
/**
* For option type `STRING`, the minimum allowed length (minimum of `0`, maximum of `6000`).
*/
min_length?: number;
/**
* For option type `STRING`, the maximum allowed length (minimum of `1`, maximum of `6000`).
*/
max_length?: number;
}
export type APIApplicationCommandStringOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandOptionBase<ApplicationCommandOptionType.String>,
APIApplicationCommandStringOptionBase,
APIApplicationCommandOptionChoice<string>
>;

View File

@@ -31,7 +31,7 @@ export interface APIMessageInteraction {
*/
type: InteractionType;
/**
* The name of the ApplicationCommand
* The name of the application command, including subcommands and subcommand groups
*/
name: string;
/**
@@ -104,6 +104,10 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
* For components, the message they were attached to
*/
message?: APIMessage;
/**
* Bitwise set of permissions the app or bot has within the channel the interaction was sent from
*/
app_permissions?: Permissions;
/**
* The selected language of the invoking user
*/

View File

@@ -4,7 +4,6 @@
import type { APIApplication } from './application';
import type { APIPartialEmoji } from './emoji';
import type { APIGuildMember } from './guild';
import type { APIMessageInteraction } from './interactions';
import type { APIRole } from './permissions';
import type { APISticker, APIStickerItem } from './sticker';
@@ -326,10 +325,6 @@ export interface APIMessage {
* ID of the channel the message was sent in
*/
channel_id: Snowflake;
/**
* ID of the guild the message was sent in
*/
guild_id?: Snowflake;
/**
* The author of this message (only a valid user in the case where the message is generated by a user or bot user)
*
@@ -339,15 +334,6 @@ export interface APIMessage {
* See https://discord.com/developers/docs/resources/user#user-object
*/
author: APIUser;
/**
* Member properties for this message's author
*
* The member object exists in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events
* from text-based guild channels
*
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
member?: APIGuildMember;
/**
* Contents of the message
*/
@@ -377,7 +363,7 @@ export interface APIMessage {
* See https://discord.com/developers/docs/resources/user#user-object
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
mentions: (APIUser & { member?: Omit<APIGuildMember, 'user'> })[];
mentions: APIUser[];
/**
* Roles specifically mentioned in this message
*
@@ -517,11 +503,11 @@ export enum MessageType {
ChannelNameChange,
ChannelIconChange,
ChannelPinnedMessage,
GuildMemberJoin,
UserPremiumGuildSubscription,
UserPremiumGuildSubscriptionTier1,
UserPremiumGuildSubscriptionTier2,
UserPremiumGuildSubscriptionTier3,
UserJoin,
GuildBoost,
GuildBoostTier1,
GuildBoostTier2,
GuildBoostTier3,
ChannelFollowAdd,
GuildDiscoveryDisqualified = 14,
GuildDiscoveryRequalified,
@@ -917,6 +903,10 @@ export interface APIEmbedVideo {
* Source url of video
*/
url?: string;
/**
* A proxied url of the video
*/
proxy_url?: string;
/**
* Height of video
*/

View File

@@ -143,8 +143,16 @@ export enum UserFlags {
BotHTTPInteractions = 1 << 19,
/**
* User has been identified as spammer
*
* @unstable This user flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
Spammer = 1 << 20,
/**
* User's account has been quarantined based on recent activity
*
* @unstable This user flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
Quarantined = Math.pow(2, 44),
}
/**

View File

@@ -15,7 +15,7 @@ interface APIApplicationCommandIntegerOptionBase
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
* If the option is an `INTEGER` or `NUMBER` type, the maximum value permitted.
*/
max_value?: number;
}

View File

@@ -15,7 +15,7 @@ interface APIApplicationCommandNumberOptionBase
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
* If the option is an `INTEGER` or `NUMBER` type, the maximum value permitted.
*/
max_value?: number;
}

View File

@@ -145,8 +145,16 @@ export enum UserFlags {
BotHTTPInteractions = 1 << 19,
/**
* User has been identified as spammer
*
* @unstable This user flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
Spammer = 1 << 20,
/**
* User's account has been quarantined based on recent activity
*
* @unstable This user flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
Quarantined = Math.pow(2, 44),
}
/**

View File

@@ -12,7 +12,7 @@ interface APIApplicationCommandIntegerOptionBase
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
* If the option is an `INTEGER` or `NUMBER` type, the maximum value permitted.
*/
max_value?: number;
}

View File

@@ -12,7 +12,7 @@ interface APIApplicationCommandNumberOptionBase
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
* If the option is an `INTEGER` or `NUMBER` type, the maximum value permitted.
*/
max_value?: number;
}

View File

@@ -5,8 +5,20 @@ import type {
} from './base';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared';
interface APIApplicationCommandStringOptionBase
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.String> {
/**
* For option type `STRING`, the minimum allowed length (minimum of `0`, maximum of `6000`).
*/
min_length?: number;
/**
* For option type `STRING`, the maximum allowed length (minimum of `1`, maximum of `6000`).
*/
max_length?: number;
}
export type APIApplicationCommandStringOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandOptionBase<ApplicationCommandOptionType.String>,
APIApplicationCommandStringOptionBase,
APIApplicationCommandOptionChoice<string>
>;

View File

@@ -31,7 +31,7 @@ export interface APIMessageInteraction {
*/
type: InteractionType;
/**
* The name of the ApplicationCommand
* The name of the application command, including subcommands and subcommand groups
*/
name: string;
/**
@@ -104,6 +104,10 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
* For components, the message they were attached to
*/
message?: APIMessage;
/**
* Bitwise set of permissions the app or bot has within the channel the interaction was sent from
*/
app_permissions?: Permissions;
/**
* The selected language of the invoking user
*/

View File

@@ -4,7 +4,6 @@
import type { APIApplication } from './application';
import type { APIPartialEmoji } from './emoji';
import type { APIGuildMember } from './guild';
import type { APIMessageInteraction } from './interactions';
import type { APIRole } from './permissions';
import type { APISticker, APIStickerItem } from './sticker';
@@ -326,10 +325,6 @@ export interface APIMessage {
* ID of the channel the message was sent in
*/
channel_id: Snowflake;
/**
* ID of the guild the message was sent in
*/
guild_id?: Snowflake;
/**
* The author of this message (only a valid user in the case where the message is generated by a user or bot user)
*
@@ -339,15 +334,6 @@ export interface APIMessage {
* See https://discord.com/developers/docs/resources/user#user-object
*/
author: APIUser;
/**
* Member properties for this message's author
*
* The member object exists in `MESSAGE_CREATE` and `MESSAGE_UPDATE` events
* from text-based guild channels
*
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
member?: APIGuildMember;
/**
* Contents of the message
*/
@@ -377,7 +363,7 @@ export interface APIMessage {
* See https://discord.com/developers/docs/resources/user#user-object
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
mentions: (APIUser & { member?: Omit<APIGuildMember, 'user'> })[];
mentions: APIUser[];
/**
* Roles specifically mentioned in this message
*
@@ -517,11 +503,11 @@ export enum MessageType {
ChannelNameChange,
ChannelIconChange,
ChannelPinnedMessage,
GuildMemberJoin,
UserPremiumGuildSubscription,
UserPremiumGuildSubscriptionTier1,
UserPremiumGuildSubscriptionTier2,
UserPremiumGuildSubscriptionTier3,
UserJoin,
GuildBoost,
GuildBoostTier1,
GuildBoostTier2,
GuildBoostTier3,
ChannelFollowAdd,
GuildDiscoveryDisqualified = 14,
GuildDiscoveryRequalified,
@@ -921,6 +907,10 @@ export interface APIEmbedVideo {
* Source url of video
*/
url?: string;
/**
* A proxied url of the video
*/
proxy_url?: string;
/**
* Height of video
*/

View File

@@ -143,8 +143,16 @@ export enum UserFlags {
BotHTTPInteractions = 1 << 19,
/**
* User has been identified as spammer
*
* @unstable This user flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
Spammer = 1 << 20,
/**
* User's account has been quarantined based on recent activity
*
* @unstable This user flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
Quarantined = Math.pow(2, 44),
}
/**

View File

@@ -70,6 +70,8 @@ export enum RESTJSONErrorCodes {
AnnouncementEditLimitExceeded = 20022,
UnderMinimumAge = 20024,
ChannelSendRateLimit = 20028,
ServerSendRateLimit,
@@ -99,8 +101,8 @@ export enum RESTJSONErrorCodes {
MaximumNumberOfServerCategoriesReached = 30030,
GuildAlreadyHasTemplate = 30031,
MaximumThreadParticipants = 30033,
MaximumNumberOfApplicationCommandsReached,
MaximumThreadParticipants,
MaximumNumberOfNonGuildMemberBansHasBeenExceeded = 30035,
@@ -116,6 +118,8 @@ export enum RESTJSONErrorCodes {
MaximumNumberOfPinnedThreadsInForumHasBeenReached,
MaximumNumberOfTagsInForumHasBeenReached,
BitrateIsTooHighForChannelOfThisType = 30052,
Unauthorized = 40001,
VerifyYourAccount,
OpeningDirectMessagesTooFast,
@@ -148,6 +152,7 @@ export enum RESTJSONErrorCodes {
InvalidToken,
NoteWasTooLong,
ProvidedTooFewOrTooManyMessagesToDelete,
InvalidMFALevel,
MessageCanOnlyBePinnedInTheChannelItWasSentIn = 50019,
InviteCodeInvalidOrTaken,
@@ -225,6 +230,8 @@ export enum RESTJSONErrorCodes {
CannotUpdateAFinishedEvent = 180000,
FailedToCreateStageNeededForStageEvent = 180002,
WebhooksCanOnlyCreateThreadsInForumChannels = 220003,
}
/**

View File

@@ -64,7 +64,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
/**
* Whether the channel is nsfw
*
* Channel types: text, news
* Channel types: text, voice, news
*/
nsfw?: boolean | null;
/**
@@ -96,7 +96,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
/**
* ID of the new parent category for a channel
*
* Channel types: text, news, voice
* Channel types: text, voice, news
*/
parent_id?: Snowflake | null;
/**

View File

@@ -20,6 +20,7 @@ import type {
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
GuildFeature,
GuildMFALevel,
GuildSystemChannelFlags,
GuildVerificationLevel,
GuildWidgetStyle,
@@ -158,6 +159,23 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
export type RESTPostAPIGuildsResult = APIGuild;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export interface RESTPostAPIGuildsMFAJSONBody {
/**
* MFA level
*
* See https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
*/
level: GuildMFALevel;
}
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export type RESTPostAPIGuildsMFAResult = RESTPostAPIGuildsMFAJSONBody;
/**
* https://discord.com/developers/docs/resources/guild#get-guild
*/

View File

@@ -274,6 +274,14 @@ export const Routes = {
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}` as const;
},
/**
* Route for:
* - POST `/guilds/{guild.id}/mfa`
*/
guildMFA(guildId: Snowflake) {
return `/guilds/${guildId}/mfa` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/bans`
@@ -836,6 +844,262 @@ export const Routes = {
},
};
export const StickerPackApplicationId = '710982414301790216';
export const CDNRoutes = {
/**
* Route for:
* - GET `/emojis/{emoji.id}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
emoji(emojiId: Snowflake, format: EmojiFormat) {
return `/emojis/${emojiId}.${format}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/icons/{guild.id}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildIcon(guildId: Snowflake, guildIcon: string, format: GuildIconFormat) {
return `icons/${guildId}/${guildIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/splashes/{guild.id}/{guild.splash}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildSplash(guildId: Snowflake, guildSplash: string, format: GuildSplashFormat) {
return `/splashes/${guildId}/${guildSplash}.${format}` as const;
},
/**
* Route for:
* - GET `/discovery-splashes/{guild.id}/{guild.discovery_splash}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildDiscoverySplash(guildId: Snowflake, guildDiscoverySplash: string, format: GuildDiscoverySplashFormat) {
return `/discovery-splashes/${guildId}/${guildDiscoverySplash}.${format}` as const;
},
/**
* Route for:
* - GET `/banners/{guild.id}/{guild.banner}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildBanner(guildId: Snowflake, guildBanner: string, format: GuildBannerFormat) {
return `/banners/${guildId}/${guildBanner}.${format}` as const;
},
/**
* Route for:
* - GET `/banners/{user.id}/{user.banner}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
userBanner(userId: Snowflake, userBanner: string, format: UserBannerFormat) {
return `/banners/${userId}/${userBanner}.${format}` as const;
},
/**
* Route for:
* - GET `/embed/avatars/{user.discriminator % 5}.png`
*
* The `userDiscriminator` parameter should be the user discriminator modulo 5 (e.g. 1337 % 5 = 2)
*
* This route supports the extension: PNG
*/
defaultUserAvatar(userDiscriminator: DefaultUserAvatarAssets) {
return `/embed/avatars/${userDiscriminator}.png` as const;
},
/**
* Route for:
* - GET `/avatars/{user.id}/{user.avatar}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
userAvatar(userId: Snowflake, userAvatar: string, format: UserAvatarFormat) {
return `/avatars/${userId}/${userAvatar}.${format}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/users/{user.id}/{guild_member.avatar}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildMemberAvatar(guildId: Snowflake, userId: Snowflake, memberAvatar: string, format: GuildMemberAvatarFormat) {
return `/guilds/${guildId}/users/${userId}/avatars/${memberAvatar}.${format}` as const;
},
/**
* Route for:
* - GET `/app-icons/{application.id}/{application.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
applicationIcon(applicationId: Snowflake, applicationIcon: string, format: ApplicationIconFormat) {
return `/app-icons/${applicationId}/${applicationIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/app-icons/{application.id}/{application.cover_image}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
applicationCover(applicationId: Snowflake, applicationCoverImage: string, format: ApplicationCoverFormat) {
return `/app-icons/${applicationId}/${applicationCoverImage}.${format}` as const;
},
/**
* Route for:
* - GET `/app-icons/{application.id}/{application.asset_id}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
applicationAsset(applicationId: Snowflake, applicationAssetId: string, format: ApplicationAssetFormat) {
return `/app-icons/${applicationId}/${applicationAssetId}.${format}` as const;
},
/**
* Route for:
* - GET `/app-assets/{application.id}/achievements/{achievement.id}/icons/{achievement.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
achievementIcon(
applicationId: Snowflake,
achievementId: Snowflake,
achievementIconHash: string,
format: AchievementIconFormat,
) {
return `/app-assets/${applicationId}/achievements/${achievementId}/icons/${achievementIconHash}.${format}` as const;
},
/**
* Route for:
* - GET `/app-assets/710982414301790216/store/{sticker_pack.banner.asset_id}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
stickerPackBanner(stickerPackBannerAssetId: Snowflake, format: StickerPackBannerFormat) {
return `/app-assets/${StickerPackApplicationId}/store/${stickerPackBannerAssetId}.${format}` as const;
},
/**
* Route for:
* - GET `team-icons/{team.id}/{team.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
teamIcon(teamId: Snowflake, teamIcon: string, format: TeamIconFormat) {
return `/team-icons/${teamId}/${teamIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/stickers/{sticker.id}.{png|json}`
*
* This route supports the extensions: PNG, Lottie
*/
sticker(stickerId: Snowflake, format: StickerFormat) {
return `/stickers/${stickerId}.${format}` as const;
},
/**
* Route for:
* - GET `/role-icons/{role.id}/{role.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
roleIcon(roleId: Snowflake, roleIcon: string, format: RoleIconFormat) {
return `/role-icons/${roleId}/${roleIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/guild-events/{guild_scheduled_event.id}/{guild_scheduled_event.image}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildScheduledEventCover(
guildScheduledEventId: Snowflake,
guildScheduledEventCoverImage: string,
format: GuildScheduledEventCoverFormat,
) {
return `/guild-events/${guildScheduledEventId}/${guildScheduledEventCoverImage}.${format}` as const;
},
/**
* Route for:
* - GET `/guilds/${guild.id}/users/${user.id}/banners/${guild_member.banner}.{png|jpeg|webp|gif}`
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildMemberBanner(guildId: Snowflake, userId: Snowflake, guildMemberBanner: string, format: GuildMemberBannerFormat) {
return `/guilds/${guildId}/users/${userId}/banners/${guildMemberBanner}.${format}` as const;
},
};
export type DefaultUserAvatarAssets = 0 | 1 | 2 | 3 | 4 | 5;
export type EmojiFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type GuildIconFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type GuildSplashFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildDiscoverySplashFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type UserBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type DefaultUserAvatar = Extract<ImageFormat, ImageFormat.PNG>;
export type UserAvatarFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type GuildMemberAvatarFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type ApplicationIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type ApplicationCoverFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type ApplicationAssetFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type AchievementIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type StickerPackBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type TeamIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type StickerFormat = Extract<ImageFormat, ImageFormat.PNG | ImageFormat.Lottie>;
export type RoleIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildScheduledEventCoverFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildMemberBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export enum ImageFormat {
JPEG = 'jpeg',
PNG = 'png',
WebP = 'webp',
GIF = 'gif',
Lottie = 'json',
}
export interface CDNQuery {
/**
* The returned image can have the size changed by using this query parameter
*
* Image size can be any power of two between 16 and 4096
*/
size?: number;
}
export const RouteBases = {
api: `https://discord.com/api/v${APIVersion}`,
cdn: 'https://cdn.discordapp.com',

View File

@@ -129,8 +129,10 @@ export type RESTPatchAPIApplicationGuildCommandResult = Omit<APIApplicationComma
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsJSONBody = (
| Omit<RESTPostAPIChatInputApplicationCommandsJSONBody, 'dm_permission'>
| Omit<RESTPostAPIContextMenuApplicationCommandsJSONBody, 'dm_permission'>
| (Omit<RESTPostAPIChatInputApplicationCommandsJSONBody, 'dm_permission'> &
Pick<Partial<APIApplicationCommand>, 'id'>)
| (Omit<RESTPostAPIContextMenuApplicationCommandsJSONBody, 'dm_permission'> &
Pick<Partial<APIApplicationCommand>, 'id'>)
)[];
/**

View File

@@ -144,6 +144,12 @@ export type RESTPostAPIWebhookWithTokenJSONBody = AddUndefinedToPossiblyUndefine
* Message flags combined as a bitfield
*/
flags?: MessageFlags;
/**
* Name of thread to create
*
* Available only if the webhook is in a forum channel and a thread is not specified in {@link RESTPostAPIWebhookWithTokenQuery.thread_id} query parameter
*/
thread_name?: string;
}>;
/**
@@ -171,6 +177,8 @@ export interface RESTPostAPIWebhookWithTokenQuery {
wait?: boolean;
/**
* Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived.
*
* Available only if the {@link RESTPostAPIWebhookWithTokenJSONBody.thread_name} JSON body property is not specified
*/
thread_id?: Snowflake;
}

View File

@@ -64,7 +64,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
/**
* Whether the channel is nsfw
*
* Channel types: text, news
* Channel types: text, voice, news
*/
nsfw?: boolean | null;
/**
@@ -96,7 +96,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
/**
* ID of the new parent category for a channel
*
* Channel types: text, news, voice
* Channel types: text, voice, news
*/
parent_id?: Snowflake | null;
/**

View File

@@ -18,6 +18,7 @@ import type {
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
GuildFeature,
GuildMFALevel,
GuildSystemChannelFlags,
GuildVerificationLevel,
GuildWidgetStyle,
@@ -158,6 +159,23 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
export type RESTPostAPIGuildsResult = APIGuild;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export interface RESTPostAPIGuildsMFAJSONBody {
/**
* MFA level
*
* See https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
*/
level: GuildMFALevel;
}
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export type RESTPostAPIGuildsMFAResult = RESTPostAPIGuildsMFAJSONBody;
/**
* https://discord.com/developers/docs/resources/guild#get-guild
*/

View File

@@ -274,6 +274,14 @@ export const Routes = {
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}` as const;
},
/**
* Route for:
* - POST `/guilds/{guild.id}/mfa`
*/
guildMFA(guildId: Snowflake) {
return `/guilds/${guildId}/mfa` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/bans`
@@ -845,6 +853,262 @@ export const Routes = {
},
};
export const StickerPackApplicationId = '710982414301790216';
export const CDNRoutes = {
/**
* Route for:
* - GET `/emojis/{emoji.id}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
emoji(emojiId: Snowflake, format: EmojiFormat) {
return `/emojis/${emojiId}.${format}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/icons/{guild.id}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildIcon(guildId: Snowflake, guildIcon: string, format: GuildIconFormat) {
return `icons/${guildId}/${guildIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/splashes/{guild.id}/{guild.splash}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildSplash(guildId: Snowflake, guildSplash: string, format: GuildSplashFormat) {
return `/splashes/${guildId}/${guildSplash}.${format}` as const;
},
/**
* Route for:
* - GET `/discovery-splashes/{guild.id}/{guild.discovery_splash}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildDiscoverySplash(guildId: Snowflake, guildDiscoverySplash: string, format: GuildDiscoverySplashFormat) {
return `/discovery-splashes/${guildId}/${guildDiscoverySplash}.${format}` as const;
},
/**
* Route for:
* - GET `/banners/{guild.id}/{guild.banner}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildBanner(guildId: Snowflake, guildBanner: string, format: GuildBannerFormat) {
return `/banners/${guildId}/${guildBanner}.${format}` as const;
},
/**
* Route for:
* - GET `/banners/{user.id}/{user.banner}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
userBanner(userId: Snowflake, userBanner: string, format: UserBannerFormat) {
return `/banners/${userId}/${userBanner}.${format}` as const;
},
/**
* Route for:
* - GET `/embed/avatars/{user.discriminator % 5}.png`
*
* The `userDiscriminator` parameter should be the user discriminator modulo 5 (e.g. 1337 % 5 = 2)
*
* This route supports the extension: PNG
*/
defaultUserAvatar(userDiscriminator: DefaultUserAvatarAssets) {
return `/embed/avatars/${userDiscriminator}.png` as const;
},
/**
* Route for:
* - GET `/avatars/{user.id}/{user.avatar}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
userAvatar(userId: Snowflake, userAvatar: string, format: UserAvatarFormat) {
return `/avatars/${userId}/${userAvatar}.${format}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/users/{user.id}/{guild_member.avatar}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildMemberAvatar(guildId: Snowflake, userId: Snowflake, memberAvatar: string, format: GuildMemberAvatarFormat) {
return `/guilds/${guildId}/users/${userId}/avatars/${memberAvatar}.${format}` as const;
},
/**
* Route for:
* - GET `/app-icons/{application.id}/{application.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
applicationIcon(applicationId: Snowflake, applicationIcon: string, format: ApplicationIconFormat) {
return `/app-icons/${applicationId}/${applicationIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/app-icons/{application.id}/{application.cover_image}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
applicationCover(applicationId: Snowflake, applicationCoverImage: string, format: ApplicationCoverFormat) {
return `/app-icons/${applicationId}/${applicationCoverImage}.${format}` as const;
},
/**
* Route for:
* - GET `/app-icons/{application.id}/{application.asset_id}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
applicationAsset(applicationId: Snowflake, applicationAssetId: string, format: ApplicationAssetFormat) {
return `/app-icons/${applicationId}/${applicationAssetId}.${format}` as const;
},
/**
* Route for:
* - GET `/app-assets/{application.id}/achievements/{achievement.id}/icons/{achievement.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
achievementIcon(
applicationId: Snowflake,
achievementId: Snowflake,
achievementIconHash: string,
format: AchievementIconFormat,
) {
return `/app-assets/${applicationId}/achievements/${achievementId}/icons/${achievementIconHash}.${format}` as const;
},
/**
* Route for:
* - GET `/app-assets/710982414301790216/store/{sticker_pack.banner.asset_id}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
stickerPackBanner(stickerPackBannerAssetId: Snowflake, format: StickerPackBannerFormat) {
return `/app-assets/${StickerPackApplicationId}/store/${stickerPackBannerAssetId}.${format}` as const;
},
/**
* Route for:
* - GET `team-icons/{team.id}/{team.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
teamIcon(teamId: Snowflake, teamIcon: string, format: TeamIconFormat) {
return `/team-icons/${teamId}/${teamIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/stickers/{sticker.id}.{png|json}`
*
* This route supports the extensions: PNG, Lottie
*/
sticker(stickerId: Snowflake, format: StickerFormat) {
return `/stickers/${stickerId}.${format}` as const;
},
/**
* Route for:
* - GET `/role-icons/{role.id}/{role.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
roleIcon(roleId: Snowflake, roleIcon: string, format: RoleIconFormat) {
return `/role-icons/${roleId}/${roleIcon}.${format}` as const;
},
/**
* Route for:
* - GET `/guild-events/{guild_scheduled_event.id}/{guild_scheduled_event.image}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildScheduledEventCover(
guildScheduledEventId: Snowflake,
guildScheduledEventCoverImage: string,
format: GuildScheduledEventCoverFormat,
) {
return `/guild-events/${guildScheduledEventId}/${guildScheduledEventCoverImage}.${format}` as const;
},
/**
* Route for:
* - GET `/guilds/${guild.id}/users/${user.id}/banners/${guild_member.banner}.{png|jpeg|webp|gif}`
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildMemberBanner(guildId: Snowflake, userId: Snowflake, guildMemberBanner: string, format: GuildMemberBannerFormat) {
return `/guilds/${guildId}/users/${userId}/banners/${guildMemberBanner}.${format}` as const;
},
};
export type DefaultUserAvatarAssets = 0 | 1 | 2 | 3 | 4 | 5;
export type EmojiFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type GuildIconFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type GuildSplashFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildDiscoverySplashFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type UserBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type DefaultUserAvatar = Extract<ImageFormat, ImageFormat.PNG>;
export type UserAvatarFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type GuildMemberAvatarFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export type ApplicationIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type ApplicationCoverFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type ApplicationAssetFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type AchievementIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type StickerPackBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type TeamIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type StickerFormat = Extract<ImageFormat, ImageFormat.PNG | ImageFormat.Lottie>;
export type RoleIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildScheduledEventCoverFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildMemberBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export enum ImageFormat {
JPEG = 'jpeg',
PNG = 'png',
WebP = 'webp',
GIF = 'gif',
Lottie = 'json',
}
export interface CDNQuery {
/**
* The returned image can have the size changed by using this query parameter
*
* Image size can be any power of two between 16 and 4096
*/
size?: number;
}
export const RouteBases = {
api: `https://discord.com/api/v${APIVersion}`,
cdn: 'https://cdn.discordapp.com',

View File

@@ -129,8 +129,10 @@ export type RESTPatchAPIApplicationGuildCommandResult = Omit<APIApplicationComma
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsJSONBody = (
| Omit<RESTPostAPIChatInputApplicationCommandsJSONBody, 'dm_permission'>
| Omit<RESTPostAPIContextMenuApplicationCommandsJSONBody, 'dm_permission'>
| (Omit<RESTPostAPIChatInputApplicationCommandsJSONBody, 'dm_permission'> &
Pick<Partial<APIApplicationCommand>, 'id'>)
| (Omit<RESTPostAPIContextMenuApplicationCommandsJSONBody, 'dm_permission'> &
Pick<Partial<APIApplicationCommand>, 'id'>)
)[];
/**

View File

@@ -144,6 +144,12 @@ export type RESTPostAPIWebhookWithTokenJSONBody = AddUndefinedToPossiblyUndefine
* Message flags combined as a bitfield
*/
flags?: MessageFlags;
/**
* Name of thread to create
*
* Available only if the webhook is in a forum channel and a thread is not specified in {@link RESTPostAPIWebhookWithTokenQuery.thread_id} query parameter
*/
thread_name?: string;
}>;
/**
@@ -171,6 +177,8 @@ export interface RESTPostAPIWebhookWithTokenQuery {
wait?: boolean;
/**
* Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived.
*
* Available only if the {@link RESTPostAPIWebhookWithTokenJSONBody.thread_name} JSON body property is not specified
*/
thread_id?: Snowflake;
}

View File

@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */
import { execSync } from 'node:child_process';
import { readFile, writeFile } from 'node:fs/promises';
import { readFile, rm, writeFile } from 'node:fs/promises';
const cwd = new URL('../website/', import.meta.url);
const json = JSON.parse(await readFile(new URL('../package.json', import.meta.url), { encoding: 'utf8' }));
@@ -16,4 +16,21 @@ const parsed = JSON.parse(await readFile(bigJsonPath, { encoding: 'utf8' }));
await writeFile(bigJsonPath, JSON.stringify(parsed));
console.log(` Done! Website version created for ${json.version}`);
console.log(`✅ Website version created for ${json.version}`);
const versionsJsonPath = new URL('./versions.json', cwd);
/** @type {string[]} */
const allVersions = JSON.parse(await readFile(versionsJsonPath, 'utf8'));
const versionToDelete = allVersions.pop();
await writeFile(versionsJsonPath, JSON.stringify(allVersions, null, 2));
await rm(new URL(`./versioned_docs/version-${versionToDelete}`, cwd), { force: true, recursive: true });
await rm(new URL(`./versioned_sidebars/version-${versionToDelete}-sidebars.json`, cwd), {
force: true,
recursive: true,
});
console.log(`♻️ Removed old website version ${versionToDelete}`);

View File

@@ -7,7 +7,9 @@ export type Nullable<T> = {
* (since JSON.stringify ignores undefined properties)
*/
export type AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Base> = {
[K in keyof Base]: Base[K] extends Exclude<Base[K], undefined> ? Base[K] : Base[K] | undefined;
[K in keyof Base]: Base[K] extends Exclude<Base[K], undefined>
? AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Base[K]>
: AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Base[K]> | undefined;
};
export type StrictPartial<Base> = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Partial<Base>>;

2
website/.npmrc Normal file
View File

@@ -0,0 +1,2 @@
# REMOVE ME ONCE NEXT BETA OF DOCUSAURUS IS OUT
force=true

View File

@@ -6,7 +6,7 @@
_Code is forked from the Sapphire Community's Website under the MIT license_
[![GitHub](https://img.shields.io/github/license/sapphiredev/website)](https://github.com/discordjs/discord-api-types/blob/main/website/LICENSE.md)
[![GitHub](https://img.shields.io/github/license/discordjs/discord-api-types)](https://github.com/discordjs/discord-api-types/blob/main/website/LICENSE.md)
</div>
@@ -24,4 +24,4 @@ version of the documentation, as well as being able to preview builds internally
[![Vercel](./static/powered-by-vercel.svg)][vercel]
[vercel]: https://vercel.com?utm_source=sapphiredev&utm_campaign=oss
[vercel]: https://vercel.com?utm_source=discordjs&utm_campaign=oss

View File

@@ -18,8 +18,8 @@ We recommend you contribute either through locally editing the files on your des
:::info Still can't figure it out?
No problem! We await you with open hands in our [`Discord Server`](https://discord.gg/djs) in the `#discord-api-types`
channel (under the `Miscellaneous` category)
No problem! We await you with open hands in our [`Discord Server`](https://discord.gg/djs) in the
`#discord-api-types-help` channel (under the `Miscellaneous` category)
:::
@@ -83,10 +83,10 @@ The file structure might seem confusing at first, especially if it's your first
guide you through it.
When you clone the repository for the first time, you'll see a folder structure like this (we've not mentioned some
tooling specific files like `.eslintrc.json` to keep the structure clean). We've highlighted the important folders you
need to keep in mind when contributing.
tooling specific files like `.eslintrc.json` to keep the structure clean). We've highlighted the important folders and
files you need to keep in mind when contributing.
```bash {5,7-9,12-13,15-19}
```bash {2,4-6,9-10,12-16}
├── deno
├── gateway
├── node_modules (once you ran `npm ci`)
@@ -162,7 +162,7 @@ normal name (for instance `UserFlags`).
#### `rest`
This folder holds all the types that are related to Discord's REST API. Just like [`payloads`](#payloads), it is split
into folders that have an `index.ts` file. from the structure in [`Discord's API Documentation`](https://discord.dev),
into folders that have an `index.ts` file, from the structure in [`Discord's API Documentation`](https://discord.dev),
under the `Resources` category.
:::info
@@ -170,7 +170,7 @@ under the `Resources` category.
Types created here must start with the `REST` prefix (for instance `RESTGetAPIUserResult`) unless they are objects or
enums (for instance `Routes`).
They must also follow the following structure: `REST{http_method}{type_name}{Query|(JSON|FormData)|Result}`, where:
They must also follow the following structure: `REST{http_method}{type_name}{Query|(JSON|FormData)Body|Result}`, where:
- `http_method` is the PascalCase HTTP method name (for instance `Get`, `Post`, and so on)
- `type_name` is the actual name of the type it returns (for instance `APIUser`)
@@ -205,7 +205,7 @@ miscellaneous scripts we might need. There's really not much to say about these
#### `tests`
This folder holds tests for certain complex types that the mdule might have, and is especially useful for validating
This folder holds tests for certain complex types that the module might have, and is especially useful for validating
unions.
:::info

View File

@@ -102,7 +102,8 @@ const config = {
customCss: [
require.resolve('./src/css/custom.scss'),
require.resolve('./src/css/tippy-discord.css'),
require.resolve('./src/css/discordjs.scss')
require.resolve('./src/css/discordjs.scss'),
require.resolve('./src/css/font.scss')
]
}
})
@@ -166,6 +167,9 @@ const config = {
{ property: 'og:url', content: BaseUrl }
],
navbar: {
logo: {
src: '/svgs/mini_logo.svg'
},
items: [
{
to: '/',
@@ -207,7 +211,7 @@ const config = {
logo: {
alt: 'Powered By Vercel',
src: '/powered-by-vercel.svg',
href: 'https://vercel.com/?utm_source=sapphiredev&utm_campaign=oss'
href: 'https://vercel.com/?utm_source=discordjs&utm_campaign=oss'
},
links: [
{

5004
website/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@
"scripts": {
"docusaurus": "docusaurus",
"start": "npm run clean && docusaurus start",
"build": "npm run clean && docusaurus build",
"build": "npm run clean && cross-env DOCUSAURUS_SSR_CONCURRENCY=2 NODE_OPTIONS=\"--max_old_space_size=7500\" docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
@@ -27,10 +27,10 @@
"vercel-build": "npm run build"
},
"dependencies": {
"@docusaurus/core": "2.0.0-beta.20",
"@docusaurus/plugin-pwa": "2.0.0-beta.20",
"@docusaurus/preset-classic": "2.0.0-beta.20",
"@docusaurus/theme-search-algolia": "2.0.0-beta.20",
"@docusaurus/core": "canary",
"@docusaurus/plugin-pwa": "canary",
"@docusaurus/preset-classic": "canary",
"@docusaurus/theme-search-algolia": "canary",
"@heroicons/react": "^1.0.6",
"@mdx-js/react": "^1.6.22",
"@sapphire/docusaurus-plugin-npm2yarn2pnpm": "^1.1.0",
@@ -39,28 +39,28 @@
"@tippyjs/react": "^4.2.6",
"clsx": "^1.1.1",
"docusaurus-plugin-sass": "^0.2.2",
"docusaurus-plugin-typedoc-api": "^1.11.0",
"docusaurus-plugin-typedoc-api": "^2.0.1",
"prism-react-renderer": "^1.3.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"sass": "^1.52.1",
"sass": "^1.52.3",
"swr": "^1.3.0"
},
"devDependencies": {
"@commitlint/cli": "^17.0.1",
"@commitlint/config-conventional": "^17.0.0",
"@docusaurus/module-type-aliases": "2.0.0-beta.20",
"@commitlint/cli": "^17.0.2",
"@commitlint/config-conventional": "^17.0.2",
"@docusaurus/module-type-aliases": "canary",
"@sapphire/prettier-config": "^1.4.3",
"@sapphire/ts-config": "^3.3.4",
"@types/node": "^17.0.36",
"@types/react": "^18.0.9",
"@types/node": "^17.0.42",
"@types/react": "^18.0.12",
"@types/react-dom": "^18.0.5",
"@typescript-eslint/eslint-plugin": "^5.27.0",
"@typescript-eslint/parser": "^5.27.0",
"@typescript-eslint/eslint-plugin": "^5.27.1",
"@typescript-eslint/parser": "^5.27.1",
"cross-env": "^7.0.3",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.16.0",
"lint-staged": "^12.4.3",
"eslint": "^8.17.0",
"lint-staged": "^13.0.1",
"markdownlint": "^0.25.1",
"markdownlint-cli2": "^0.4.0",
"npm-run-all": "^4.1.5",
@@ -68,11 +68,11 @@
"pretty-quick": "^3.1.3",
"replace-in-file": "^6.3.5",
"rimraf": "^3.0.2",
"typedoc": "^0.22.16",
"typedoc": "^0.22.17",
"typedoc-plugin-djs-links": "^1.0.4",
"typedoc-plugin-markdown": "^3.12.1",
"typedoc-plugin-mdn-links": "^1.0.6",
"typescript": "^4.7.2"
"typescript": "^4.7.3"
},
"browserslist": {
"production": [

View File

@@ -12,7 +12,6 @@ const HeadTags: FC = () => (
<link rel="canonical" href="https://discord-api-types.dev" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="192x192" href="/android-chrome-192x192.png" />
<link rel="icon" type="image/png" sizes="194x194" href="/android-chrome-194x194.png" />

View File

@@ -12,9 +12,8 @@
}
.logo {
margin-top: -4rem;
margin-bottom: -4rem;
max-height: 24rem;
margin-bottom: 2rem;
max-height: 12rem;
}
.fontSemiTitle {
@@ -22,11 +21,6 @@
}
@media screen and (max-width: 966px) {
.logo {
padding-top: 4rem;
padding-bottom: 4rem;
}
.fontSemiTitle {
font-size: 1.5rem;
}

View File

@@ -74,15 +74,13 @@ footer > .container {
}
.markdown__logo {
margin-top: -8rem;
margin-bottom: -8rem;
max-height: 12rem;
margin-top: 1rem;
margin-bottom: 2rem;
}
@media screen and (max-width: 966px) {
.markdown__logo {
padding-top: 6rem;
padding-bottom: 6rem;
}
.navbar__logo {
margin: 0;
}
.navbar__logo > img {
@@ -114,7 +112,8 @@ footer > .container {
padding-left: 1rem;
}
.navbar__item {
.navbar__item,
.navbar__brand {
margin-right: 2rem;
font-size: 14px;
height: 100%;
@@ -122,7 +121,8 @@ footer > .container {
border-radius: 0.375rem;
}
.navbar__item:hover {
.navbar__item:hover,
.navbar__brand:hover {
background-color: rgba($color: #000000, $alpha: 0.3);
border-radius: 0.375rem;
}

View File

@@ -0,0 +1 @@
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap');

View File

@@ -1,22 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg preserveAspectRatio="none" version="1.1" viewBox="0 0 1920 1080" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg viewBox="0 0 1920 597.07" xmlns="http://www.w3.org/2000/svg">
<defs>
<g id="b">
<path d="m480.5 705.45q-1.6311 0-3.3 0l2.75 8.05h38.8l-2.75-7.4q-19.595-0.65-35.5-0.65m-89.95 3.25q-11.477 0.60508-21.05 1.05l-1.35 3.75h37.8l1.95-5.7q-7.7967 0.40176-17.35 0.9m646.35 2.6v2.2h37.5v-3.15q-5.3625 0.25078-9.85 0.4-14.625 0.50117-27.65 0.55m148.05 2.2v-7.95q-14.067 0.25117-30.45 0.9-2.9479 0.13125-7.05 0.3v6.75h37.5m-645.35-6.4v6.4h37.5v-4.45q-3.5939-0.14824-7.4-0.35-18.275-0.97793-30.1-1.6m140.05 3.65v2.75h85.15v-8.2q-4.752 0.4373-9.65 0.85-41.466 3.449-75.5 4.6m232.9-22.95-17.95 3.7v22h37.5v-15.25q-0.72969-0.28496-1.45-0.6-8.8-3.85-18.1-9.85m486.7 22.95q-10.691 0.35586-20.65 0.5-20.25 0.35-45-0.5-14.999-0.49688-39.55-1.8v4.55h105.2v-2.75m34.7-1.7q6.7342 2.2277 14 3.95 13.35 3.15 31.45 3.15 31.25 0 49.5-13.4 1.6762-1.2422 3.2-2.55-7.0754 0.90332-15.95 1.9-19.45 2.15-42 4.05-21.063 1.752-40.2 2.9z" fill="#B75CFF"/>
<path d="m479.6 667.45q-20.4 0-44.45 1.35-19.1 1.15-44.75 3.35-3.727 0.34277-7.25 0.65l-13.65 36.95q9.5734-0.44492 21.05-1.05 9.5533-0.49824 17.35-0.9l8.2-23.7h53.8l7.3 21.35q1.6689 0 3.3 0 15.905 0 35.5 0.65l-14.15-38.3q-11.712-0.35-22.25-0.35m594.8 7.9q-5.5447 0.51113-9.85 0.9-15.263 1.385-27.65 2.35v32.7q13.025-0.048828 27.65-0.55 4.4875-0.14922 9.85-0.4v-35m79.75-6.55q-3.2549 0.1959-6.7 0.4v37.55q4.1021-0.16875 7.05-0.3 16.383-0.64883 30.45-0.9v-37.95q-14.569 0.28887-30.8 1.2m-577.05 3.55q-3.5742-0.25527-7.45-0.55-17.071-1.2781-30.05-2.1v37.4q11.825 0.62207 30.1 1.6 3.8061 0.20176 7.4 0.35v-36.7m187.7 15.35h-23.8v-12.15q-19.473 1.1309-37.5 1.55v10.6h-23.85v23.05q34.034-1.151 75.5-4.6 4.898-0.4127 9.65-0.85v-17.6m129.8 3.8 17.95-3.7q9.3 6 18.1 9.85 0.72031 0.31504 1.45 0.6v-14.3q-16.538 0.35859-37.5 0.45v7.1m436.75-6.1v-10.45q-10.69-0.725-37.3-2.75v36.75q24.551 1.3031 39.55 1.8 24.75 0.85 45 0.5 9.9592-0.14414 20.65-0.5v-25.35h-67.9m121.55-1.1q-8.7391-3.0238-16.45-7.6-6.9395 0.26035-13.7 0.4v27.8q5.4029 2.2627 11.2 4.15 19.137-1.148 40.2-2.9 22.55-1.9 42-4.05 8.8746-0.99668 15.95-1.9 14.666-12.64 14.95-31.65l-18.05 1.7q-12.182 1.098-20.8 1.85 0.3 1.1719 0.3 2.45 0 5.15-2.75 7.8-2.85 2.65-7.15 4.4-3.5 1.35-9.05 1.95t-9 0.6q-13.25 0-27.65-5z" fill="#5C6CFF"/>
<path d="m480.05 632q-13.122-0.32324-28.05-0.2l8.8 25.65h-35.7l8.65-25.35q-14.53 0.3834-36 1.25l-14.6 39.45q3.523-0.30723 7.25-0.65 25.65-2.2 44.75-3.35 24.05-1.35 44.45-1.35 10.538 0 22.25 0.35l-13.15-35.55q-4.4373-0.14277-8.65-0.25m608 2.55q-17.831 0.80098-23.8 1-22.786 0.80742-40.9 0.9l13.55 22.55v19.6q12.387-0.96504 27.65-2.35 4.3053-0.38887 9.85-0.9v-18.1l13.65-22.7m155.9-0.3q-11.678-0.80938-22.15-1.35-4.1928 3.458-10.3 4.6-6.25 1.2-15.8 1.2h-10.75v-6.9q-14.45-0.098828-30.8 0.3-3.1779 0.073242-6.7 0.15v36.95q3.4451-0.2041 6.7-0.4 16.231-0.91113 30.8-1.2v-1.45h23.35q15.9 0 26.65-4.4 10.65-4.4 19.35-13 5.4572-5.4572 8.7-13.05-13.125-1.0348-19.05-1.45m-666.85 4.45v-0.4q-3.4807-0.26133-7.15-0.55-18.672-1.4971-30.35-2.4v34.35q12.979 0.82188 30.05 2.1 3.8758 0.29473 7.45 0.55v-6.2h23.35q15.9 0 26.65-4.4 10.65-4.4 19.35-13 2.94-2.94 5.25-6.5-16.979-0.21445-36.8-1.3-13.083-0.76953-32.65-2.25h-5.15m163.9 36.85v-37.7q-19.464 1.9551-37.5 3.05v36.2q18.027-0.41914 37.5-1.55m153.6-45.6v54.45q20.962-0.091406 37.5-0.45v-50.9q-16.524-1.1613-37.5-3.1m499.75 12.15q-7.9324 0.2-15.55 0.2-20.25 0-44.9-1.35-15.42-0.90703-39.85-2.8v34.05q26.61 2.025 37.3 2.75v-25.5h63v-7.35m152.7 26.45q0-0.37871 0-0.75 0-15.05-7.9-24.4-6.6695-7.9201-19.4-13.05-10.941 1.5998-18.8 2.65-18.8 2.55-36 4.35-15.593 1.6352-30.3 2.7 8.1209 7.9295 23.45 12.9 8 2.65 17.2 4.4 9.05 1.65 17.25 3.6 7.85 1.85 11.95 5.4 2.935 2.4947 3.7 5.75 8.6184-0.75195 20.8-1.85l18.05-1.7m-124.3 8.55q6.7605-0.13965 13.7-0.4-5.0154-2.9941-9.6-6.65h-4.1v7.05z" fill="#5CFF9D"/>
<path d="m452 631.8q14.928-0.12324 28.05 0.2 4.2127 0.10723 8.65 0.25l-13.5-36.6q-17.532 0.74121-39.7 2.3-3.6041 0.25234-25.4 1.85l-12.35 33.55q21.47-0.8666 36-1.25l9.2-26.7 9.05 26.4m615.25-27.65-10.8 20-10.65-19q-13.906 0.5-26.25 0.5-7.2121 0-14.7-0.15l18.5 30.95q18.114-0.092578 40.9-0.9 5.9693-0.19902 23.8-1l19.95-33.15q-24.181 1.8703-40.75 2.75m117.7 27.65v-35.75q-13.935 0.73887-30.45 1.9-1.6414 0.11484-7.05 0.5v33.8q3.5221-0.076758 6.7-0.15 16.35-0.39883 30.8-0.3m78.05 3.9q0.57207-1.2494 1.05-2.55 3.4-9.4 3.4-19.15 0-10.493-3.15-18.5-31.993-1.0613-61.7-0.15 1.999 0.04043 3.65 0.1 5.55 0.3 11.4 2.6 4.4 1.8 7.75 6.15 3.3 4.5 3.3 10.65t-1.55 10.55q-1.65 4.3-5.3 7.45-0.029297 0.024414-0.05 0.05 10.472 0.54062 22.15 1.35 5.9248 0.41523 19.05 1.45m-685.9-38.65q-3.723-0.24395-7.4-0.45-15.299-0.84727-30.1-1.3v40.05q11.678 0.90293 30.35 2.4 3.6693 0.28867 7.15 0.55v-41.25m74.6 45.2q2.6742-4.1328 4.5-9.1 3.4-9.4 3.4-19.15 0-5.0014-0.75-9.45-23.657-2.7859-45.9-4.8 2.5158 1.7438 4.6 4.45 3.3 4.5 3.3 10.65t-1.55 10.55q-1.65 4.3-5.3 7.45-4.2 3.5-10.35 4.65-6.25 1.2-15.8 1.2h-5.6q19.567 1.4805 32.65 2.25 19.821 1.0855 36.8 1.3m89.3-4.4v-21.9q-19.551-3.025-37.5-5.6v30.55q18.036-1.0949 37.5-3.05m191.1-4.8v-32.15q-16.711-1.5816-35.1-3.85-1.1498-0.14297-2.4-0.3v33.2q20.976 1.9387 37.5 3.1m-62.95-39.6-19.95-2.8v5.55h41.05q-8.6447-1.1057-21.1-2.75m509.65 48.85q7.6176 0 15.55-0.2v-20.8h-63v-21.6q-19.199-1.6912-37.3-2.8v41.25q24.43 1.893 39.85 2.8 24.65 1.35 44.9 1.35m44.8-31.75q0 0.44531 0 0.9 0 15.15 8.15 25.4 1.317 1.6709 2.9 3.2 14.707-1.0648 30.3-2.7 17.2-1.8 36-4.35 7.859-1.0502 18.8-2.65-2.5227-0.99355-5.3-1.9-8.5-2.75-15.85-4.3-7.4-1.55-15.4-3.25-7.0574-1.4461-11.5-3.1-3.4629-0.52734-6.8-1.05-21.603-3.4086-41.3-6.2z" fill="#FFDB5C"/>
<path d="m440.9 568.1q-2.6684 0.4123-5.4 0.85-6.1498 1.0309-14.9 2.55l-10.5 28.3q21.796-1.5977 25.4-1.85 22.168-1.5588 39.7-2.3l-10.2-27.55h-24.1m683.5 6q-11.322 1.9865-14.85 2.6-16.611 2.8254-29.95 4.65l-12.35 22.8q16.569-0.87969 40.75-2.75l16.4-27.3m-89.45 11.65q-7.9471 0.4-15.4 0.4-12.998 0-26.95-1.1l12.25 20.45q7.4879 0.15 14.7 0.15 12.344 0 26.25-0.5l-10.85-19.4m124.95-17.65q-2.6684 0.4123-5.4 0.85-3.1773 0.53262-7.05 1.2v28.3q5.4086-0.38516 7.05-0.5 16.515-1.1611 30.45-1.9v-0.8h6.45q6.5334 0 11.2 0.1 29.707-0.91133 61.7 0.15-0.63906-1.5949-1.4-3.1-4.7-9-13.5-14.75-7.3-4.75-16.8-7.1-9.55-2.45-23.45-2.45h-49.25m-501.05 36.45q-1.0561-6.7223-3.8-12.15-4.7-9-13.5-14.75-7.3-4.75-16.8-7.1-9.55-2.45-23.45-2.45h-61.7v27.2q14.801 0.45273 30.1 1.3 3.677 0.20605 7.4 0.45v-1.8h6.45q9.3 0 14.85 0.2 5.55 0.3 11.4 2.6 1.6627 0.68008 3.15 1.7 22.243 2.0141 45.9 4.8m20.8-36.45v25.75h23.85v16.5q17.949 2.575 37.5 5.6v-22.1h23.8v-25.35q-10.102-0.082617-18.9-0.2-6.4582-0.088672-12.75-0.2h-53.5m169.55 0v22.55l19.95 2.8q12.455 1.6443 21.1 2.75h4.35v0.55q1.2502 0.15703 2.4 0.3 18.389 2.2684 35.1 3.85v-4.7h45.4v-12.65q-21.084-2.4463-44.2-7.25-16.633-3.3945-35.15-8.2h-48.95m482.15 31.6v-3.5h67.9v-28.1h-105.2v28.8q18.101 1.1088 37.3 2.8m149.1-6.8q4.6-0.7 9.3-0.7 13.25 0 26.05 4.8 12.7 4.7 21.5 11.7h4v-33.5q-9.6096-3.9375-22.5-6.55-31.253-0.048047-53.9-0.35-0.39258-0.0054688-0.8 0-12.565 3.2018-22.2 10.05-17.89 12.513-18.3 32.2 19.697 2.7914 41.3 6.2 3.3371 0.52266 6.8 1.05-3.2453-1.1643-5.1-2.45-4.4-3.1-4.4-8.9 0-3.8 2.75-6.7 2.7-3.05 6.55-4.5 4.25-1.75 8.95-2.35z" fill="#F79454"/>
<path d="m435.5 568.95q2.7316-0.4377 5.4-0.85h-19.05l-1.25 3.4q8.7502-1.5191 14.9-2.55m651.3-0.85-7.2 13.25q13.339-1.8246 29.95-4.65 3.5275-0.61348 14.85-2.6l3.65-6h-41.25m-104.35 0 10.15 16.95q13.952 1.1 26.95 1.1 7.4529 0 15.4-0.4l-9.85-17.65h-42.65m172.05 0.85q2.7316-0.4377 5.4-0.85h-12.45v2.05q3.8727-0.66738 7.05-1.2m-408.6-0.65q8.7982 0.11738 18.9 0.2v-0.4h-31.65q6.2918 0.11133 12.75 0.2m152.25-0.2q18.517 4.8055 35.15 8.2 23.116 4.8037 44.2 7.25v-15.45h-79.35m565.95 0.2q0.40742-0.0054688 0.8 0 22.647 0.30195 53.9 0.35-0.82832-0.18125-1.7-0.35-14.1-2.85-28.45-2.85-13.417 0-24.55 2.85z" fill="#FF5C5C"/>
</g>
<style>.cls-1{fill:#5c6cff;}.cls-2{fill:#5b4fd8;}.cls-3{isolation:isolate;}.cls-4{fill:#b75cff;}.cls-5{fill:#ff5c5c;}.cls-6{fill:#f79454;}.cls-7{fill:#5cff9d;}.cls-8{fill:#ffdb5c;}</style>
</defs>
<g transform="translate(192.95 301)">
<clipPath id="a">
<rect x="237.7" y="-2" width="1058.7" height="247.05" fill="#fff"/>
</clipPath>
<text clip-path="url(#a)" writing-mode="lr"><tspan x="239.8" y="201.05" baseline-shift="0%" fill="#5865F2" font-family="Verdana" font-size="200" font-weight="bold" xml:space="preserve">DISCORD</tspan></text>
<g class="cls-3">
<path class="cls-2" d="m312.28 130.87c0 23.36-5.34 44.27-16 62.74-10.67 18.47-24.14 32.65-40.42 42.53-12.24 7.41-25.66 12.58-40.26 15.5s-31.89 4.38-51.88 4.38h-88.43v-250.8h90.96c20.44 0 38.07 1.71 52.89 5.14s27.29 8.28 37.39 14.57c17.29 10.56 30.91 24.79 40.85 42.7s14.91 38.99 14.91 63.25zm-66.87-0.5c0-16.51-3.01-30.63-9.01-42.36-6.01-11.73-15.53-20.91-28.55-27.54-6.63-3.26-13.39-5.47-20.3-6.65s-17.32-1.77-31.25-1.77h-16.34v156.98h16.34c15.38 0 26.67-0.7 33.86-2.11 7.18-1.4 14.2-3.96 21.05-7.66 11.79-6.74 20.44-15.75 25.94-27.03 5.5-11.29 8.25-25.24 8.25-41.86z"/>
<path class="cls-2" d="M497.22,256.02h-146.88v-44.47h41.1V49.69h-41.1V5.22h146.88V49.69h-41.1V211.56h41.1v44.47Z"/>
<path class="cls-2" d="m750.72 177.19c0 24.7-10.47 44.78-31.41 60.22s-49.38 23.16-85.31 23.16c-20.78 0-38.88-1.83-54.32-5.47-15.44-3.65-29.9-8.28-43.37-13.9v-60.13h7.07c13.36 10.67 28.32 18.86 44.89 24.59 16.56 5.73 32.48 8.59 47.75 8.59 3.93 0 9.1-0.34 15.5-1.01s11.62-1.79 15.66-3.37c4.94-2.02 9.01-4.55 12.21-7.58s4.8-7.52 4.8-13.48c0-5.5-2.33-10.25-6.99-14.23s-11.48-7.04-20.46-9.18c-9.43-2.24-19.4-4.35-29.9-6.32-10.5-1.96-20.35-4.46-29.56-7.5-21.11-6.85-36.3-16.14-45.56-27.88-9.26-11.73-13.9-26.3-13.9-43.71 0-23.36 10.47-42.42 31.41-57.18s47.86-22.15 80.77-22.15c16.51 0 32.82 1.6 48.93 4.8s30.07 7.22 41.86 12.04v57.77h-6.91c-10.11-8.09-22.49-14.85-37.14-20.3-14.65-5.44-29.62-8.17-44.89-8.17-5.39 0-10.75 0.37-16.09 1.1-5.33 0.73-10.47 2.1-15.41 4.13-4.38 1.68-8.14 4.24-11.29 7.66-3.15 3.43-4.72 7.33-4.72 11.71 0 6.63 2.53 11.71 7.58 15.24s14.6 6.77 28.63 9.69c9.21 1.91 18.05 3.76 26.53 5.56s17.6 4.27 27.37 7.41c19.2 6.29 33.38 14.85 42.53 25.69s13.73 24.9 13.73 42.19z"/>
<path class="cls-2" d="m908.37 260.91c-18.64 0-35.85-2.75-51.62-8.25-15.78-5.5-29.34-13.7-40.68-24.59s-20.13-24.48-26.36-40.76-9.35-35.09-9.35-56.43c0-19.88 2.97-37.9 8.93-54.07 5.95-16.17 14.6-30.04 25.94-41.6 10.89-11.12 24.39-19.71 40.51-25.77 16.11-6.06 33.71-9.1 52.8-9.1 10.55 0 20.07 0.59 28.55 1.77s16.31 2.72 23.5 4.63c7.52 2.13 14.34 4.52 20.46 7.16s11.48 5.08 16.09 7.33v60.81h-7.41c-3.15-2.68-7.1-5.86-11.87-9.55s-10.19-7.32-16.25-10.9c-6.18-3.57-12.86-6.59-20.04-9.05-7.19-2.46-14.88-3.69-23.08-3.69-9.1 0-17.74 1.43-25.94 4.29s-15.78 7.59-22.74 14.2c-6.63 6.39-11.99 14.85-16.09 25.38s-6.15 23.31-6.15 38.32 2.22 28.8 6.65 39.33c4.44 10.54 10.02 18.83 16.76 24.88 6.85 6.16 14.49 10.56 22.91 13.2 8.42 2.63 16.73 3.95 24.93 3.95s15.64-1.17 23.33-3.52 14.79-5.53 21.31-9.55c5.5-3.24 10.61-6.7 15.33-10.39s8.59-6.87 11.62-9.55h6.74v59.96c-6.29 2.81-12.3 5.45-18.02 7.92-5.73 2.47-11.74 4.61-18.02 6.4-8.2 2.36-15.89 4.15-23.08 5.39-7.19 1.23-17.07 1.85-29.64 1.85z"/>
<path class="cls-2" d="m1288.5 130.71c0 39.98-11.45 71.73-34.36 95.25-22.91 23.53-54.57 35.29-95 35.29s-71.92-11.76-94.83-35.29c-22.91-23.52-34.36-55.27-34.36-95.25s11.45-72.18 34.36-95.59 54.52-35.12 94.83-35.12 71.81 11.71 94.83 35.12 34.53 55.28 34.53 95.59zm-85.73 63.5c6.29-7.64 10.95-16.65 13.98-27.03s4.55-22.6 4.55-36.63c0-15.05-1.74-27.85-5.22-38.4s-8.03-19.09-13.64-25.6c-5.73-6.74-12.32-11.62-19.79-14.65s-15.24-4.55-23.33-4.55-15.92 1.46-23.16 4.38-13.9 7.75-19.96 14.49c-5.62 6.29-10.19 14.96-13.73 26.02s-5.31 23.89-5.31 38.49 1.71 27.65 5.14 38.15c3.42 10.5 7.94 19.06 13.56 25.69 5.61 6.63 12.18 11.51 19.71 14.65 7.52 3.14 15.44 4.72 23.75 4.72s16.22-1.6 23.75-4.8c7.52-3.2 14.09-8.17 19.71-14.91z"/>
<path class="cls-2" d="m1579.4 256.02h-79l-68.23-91.97h-29.97v91.97h-64.34v-250.8h108.47c14.82 0 27.56 0.84 38.23 2.53 10.67 1.68 20.66 5.33 29.98 10.95 9.43 5.62 16.93 12.89 22.49 21.81 5.56 8.93 8.34 20.13 8.34 33.6 0 18.53-4.3 33.63-12.89 45.31s-20.86 21.39-36.8 29.14l83.71 107.46zm-100.89-173.99c0-6.29-1.29-11.68-3.87-16.17s-7.02-8.03-13.31-10.61c-4.38-1.79-9.49-2.89-15.33-3.28s-12.63-0.59-20.38-0.59h-23.41v67.54h19.87c10.33 0 18.98-0.5 25.94-1.52 6.96-1.01 12.8-3.31 17.52-6.91 4.49-3.48 7.78-7.33 9.85-11.54 2.08-4.21 3.12-9.85 3.12-16.93z"/>
<path class="cls-2" d="m1844.7 130.87c0 23.36-5.33 44.27-16 62.74s-24.14 32.65-40.42 42.53c-12.24 7.41-25.66 12.58-40.26 15.5s-31.89 4.38-51.88 4.38h-88.43v-250.8h90.96c20.44 0 38.07 1.71 52.89 5.14s27.29 8.28 37.39 14.57c17.29 10.56 30.91 24.79 40.84 42.7 9.94 17.91 14.91 38.99 14.91 63.25zm-66.87-0.5c0-16.51-3.01-30.63-9.01-42.36-6.01-11.73-15.52-20.91-28.55-27.54-6.63-3.26-13.39-5.47-20.3-6.65s-17.32-1.77-31.24-1.77h-16.34v156.98h16.34c15.38 0 26.67-0.7 33.86-2.11 7.18-1.4 14.2-3.96 21.05-7.66 11.79-6.74 20.44-15.75 25.94-27.03 5.5-11.29 8.25-25.24 8.25-41.86z"/>
</g>
<g>
<use xlink:href="#b"/>
<path class="cls-4" d="M182.98,579.64h-5.37l4.48,13.11h63.19l-4.48-12.05c-21.28-.71-40.55-1.06-57.82-1.06m-146.5,5.29c-12.46,.66-23.89,1.23-34.28,1.71l-2.2,6.11H61.56l3.18-9.28c-8.47,.44-17.88,.92-28.26,1.47m1052.67,4.23v3.58h61.07v-5.13c-5.82,.27-11.17,.49-16.04,.65-15.88,.54-30.89,.84-45.03,.9m241.12,3.58v-12.95c-15.27,.27-31.8,.76-49.59,1.47-3.2,.14-7.03,.31-11.48,.49v10.99h61.07m-1051.04-10.42v10.42h61.07v-7.25c-3.9-.16-7.92-.35-12.05-.57-19.84-1.06-36.18-1.93-49.02-2.61m228.09,5.94v4.48h138.68v-13.35c-5.16,.47-10.4,.94-15.72,1.38-45.02,3.74-86.01,6.24-122.96,7.49m379.31-37.38l-29.23,6.03v35.83h61.07v-24.84c-.79-.31-1.58-.64-2.36-.98-9.55-4.18-19.38-9.53-29.48-16.04m792.66,37.38c-11.61,.39-22.82,.66-33.63,.81-21.99,.38-46.42,.11-73.29-.81-16.29-.54-37.76-1.52-64.41-2.93v7.41h171.33v-4.48m56.51-2.77c7.31,2.42,14.91,4.56,22.8,6.43,14.49,3.42,31.57,5.13,51.22,5.13,33.93,0,60.8-7.27,80.62-21.82,1.82-1.35,3.56-2.73,5.21-4.15-7.68,.98-16.34,2.01-25.98,3.09-21.12,2.33-43.92,4.53-68.4,6.6-22.87,1.9-44.69,3.48-65.47,4.72Z"/>
<path class="cls-1" d="M181.51,517.75c-22.15,0-46.28,.73-72.39,2.2-20.74,1.25-45.03,3.07-72.88,5.46-4.05,.37-7.98,.73-11.81,1.06l-22.23,60.18c10.39-.48,21.82-1.05,34.28-1.71,10.37-.54,19.79-1.03,28.26-1.47l13.35-38.6h87.62l11.89,34.77h5.37c17.27,0,36.54,.35,57.82,1.06l-23.05-62.38c-12.72-.38-24.79-.57-36.24-.57m968.71,12.87c-6.02,.55-11.37,1.04-16.04,1.47-16.57,1.5-31.58,2.78-45.03,3.83v53.26c14.14-.05,29.15-.35,45.03-.9,4.87-.16,10.22-.38,16.04-.65v-57m129.88-10.67c-3.53,.21-7.17,.43-10.91,.65v61.16c4.45-.18,8.28-.35,11.48-.49,17.79-.7,34.32-1.19,49.59-1.47v-61.81c-15.82,.31-32.54,.97-50.16,1.95m-939.8,5.78c-3.88-.28-7.93-.58-12.13-.9-18.54-1.39-34.85-2.53-48.94-3.42v60.91c12.84,.68,29.18,1.54,49.02,2.61,4.13,.22,8.15,.41,12.05,.57v-59.77m305.7,25h-38.76v-19.79c-21.14,1.23-41.5,2.07-61.07,2.52v17.26h-38.84v37.54c36.95-1.25,77.94-3.75,122.96-7.49,5.32-.45,10.56-.91,15.72-1.38v-28.66m211.4,6.19l29.23-6.03c10.1,6.51,19.92,11.86,29.48,16.04,.78,.34,1.57,.67,2.36,.98v-23.29c-17.96,.39-38.31,.63-61.07,.73v11.56m711.31-9.93v-17.02c-11.61-.79-31.86-2.28-60.75-4.48v59.85c26.66,1.41,48.13,2.39,64.41,2.93,26.87,.92,51.3,1.19,73.29,.81,10.81-.16,22.02-.43,33.63-.81v-41.29h-110.58m197.96-1.79c-9.49-3.28-18.42-7.41-26.79-12.38-7.53,.28-14.97,.5-22.31,.65v45.28c5.87,2.46,11.95,4.71,18.24,6.76,20.78-1.25,42.6-2.82,65.47-4.72,24.48-2.06,47.28-4.26,68.4-6.6,9.64-1.08,18.29-2.11,25.98-3.09,15.92-13.72,24.04-30.91,24.35-51.55l-29.4,2.77c-13.23,1.19-24.52,2.2-33.88,3.01,.33,1.27,.49,2.6,.49,3.99,0,5.59-1.49,9.83-4.48,12.7-3.09,2.88-6.98,5.27-11.64,7.17-3.8,1.47-8.71,2.52-14.74,3.18-6.03,.65-10.91,.98-14.66,.98-14.39,0-29.4-2.71-45.03-8.14Z"/>
<path class="cls-7" d="M182.24,460.02c-14.25-.35-29.48-.46-45.68-.33l14.33,41.77h-58.14l14.09-41.29c-15.78,.42-35.32,1.09-58.63,2.04l-23.78,64.25c3.83-.33,7.76-.69,11.81-1.06,27.85-2.39,52.14-4.21,72.88-5.46,26.11-1.47,50.24-2.2,72.39-2.2,11.44,0,23.52,.19,36.24,.57l-21.42-57.9c-4.82-.15-9.51-.29-14.09-.41m990.21,4.15c-19.36,.87-32.28,1.41-38.76,1.63-24.74,.88-46.94,1.37-66.61,1.47l22.07,36.73v31.92c13.45-1.05,28.46-2.32,45.03-3.83,4.67-.42,10.02-.91,16.04-1.47v-29.48l22.23-36.97m253.9-.49c-12.68-.88-24.7-1.61-36.07-2.2-4.55,3.75-10.14,6.25-16.78,7.49-6.79,1.3-15.36,1.95-25.73,1.95h-17.51v-11.24c-15.69-.11-32.41,.06-50.16,.49-3.45,.08-7.09,.16-10.91,.24v60.18c3.74-.22,7.38-.44,10.91-.65,17.62-.99,34.34-1.64,50.16-1.95v-2.36h38.03c17.26,0,31.73-2.39,43.4-7.17,11.56-4.78,22.07-11.83,31.51-21.17,5.93-5.93,10.65-13.01,14.17-21.25-14.25-1.12-24.59-1.91-31.03-2.36m-1086.06,7.25v-.65c-3.78-.28-7.66-.58-11.64-.9-20.27-1.63-36.75-2.93-49.43-3.91v55.94c14.09,.89,30.41,2.03,48.94,3.42,4.21,.32,8.25,.62,12.13,.9v-10.1h38.03c17.26,0,31.73-2.39,43.4-7.17,11.56-4.78,22.07-11.83,31.51-21.17,3.19-3.19,6.04-6.72,8.55-10.59-18.43-.23-38.41-.94-59.93-2.12-14.2-.84-31.93-2.06-53.18-3.66h-8.39m266.93,60.02v-61.4c-21.13,2.12-41.49,3.78-61.07,4.97v58.96c19.57-.46,39.93-1.3,61.07-2.52m250.16-74.27v88.68c22.76-.1,43.12-.34,61.07-.73v-82.9c-17.94-1.26-38.3-2.94-61.07-5.05m813.91,19.79c-8.61,.22-17.05,.33-25.33,.33-21.99,0-46.36-.73-73.13-2.2-16.74-.98-38.38-2.5-64.9-4.56v55.46c28.89,2.2,49.14,3.69,60.75,4.48v-41.53h102.6v-11.97m248.69,43.08c0-.41,0-.82,0-1.22,0-16.34-4.29-29.59-12.87-39.74-7.24-8.6-17.77-15.68-31.6-21.25-11.88,1.74-22.09,3.18-30.62,4.32-20.41,2.77-39.96,5.13-58.63,7.08-16.93,1.78-33.38,3.24-49.35,4.4,8.82,8.61,21.55,15.61,38.19,21.01,8.69,2.88,18.02,5.27,28.01,7.17,9.83,1.79,19.19,3.75,28.09,5.86,8.52,2.01,15.01,4.94,19.46,8.79,3.19,2.71,5.2,5.83,6.03,9.36,9.36-.82,20.65-1.82,33.88-3.01l29.4-2.77m-202.44,13.92c7.34-.15,14.78-.37,22.31-.65-5.45-3.25-10.66-6.86-15.63-10.83h-6.68v11.48Z"/>
<path class="cls-8" d="M136.56,459.69c16.21-.13,31.44-.03,45.68,.33,4.57,.12,9.27,.25,14.09,.41l-21.99-59.61c-19.04,.8-40.59,2.05-64.66,3.75-3.91,.27-17.7,1.28-41.37,3.01l-20.11,54.64c23.31-.94,42.85-1.62,58.63-2.04l14.98-43.48,14.74,43m1002.02-45.03l-17.59,32.57-17.34-30.94c-15.1,.54-29.35,.81-42.75,.81-7.83,0-15.81-.08-23.94-.24l30.13,50.41c19.67-.1,41.87-.59,66.61-1.47,6.48-.22,19.4-.76,38.76-1.63l32.49-53.99c-26.26,2.03-48.38,3.52-66.37,4.48m191.69,45.03v-58.22c-15.13,.8-31.66,1.83-49.59,3.09-1.78,.12-5.61,.4-11.48,.81v55.05c3.82-.08,7.46-.16,10.91-.24,17.75-.43,34.47-.6,50.16-.49m127.12,6.35c.62-1.36,1.19-2.74,1.71-4.15,3.69-10.21,5.54-20.6,5.54-31.19,0-11.39-1.71-21.44-5.13-30.13-34.74-1.15-68.23-1.23-100.49-.24,2.17,.04,4.15,.1,5.94,.16,6.03,.33,12.21,1.74,18.57,4.23,4.78,1.95,8.98,5.29,12.62,10.02,3.58,4.89,5.37,10.67,5.37,17.34s-.84,12.4-2.52,17.18c-1.79,4.67-4.67,8.71-8.63,12.13-.03,.03-.06,.05-.08,.08,11.37,.59,23.39,1.32,36.07,2.2,6.43,.45,16.77,1.24,31.03,2.36m-1117.08-62.95c-4.04-.26-8.06-.51-12.05-.73-16.61-.92-32.95-1.63-49.02-2.12v65.23c12.68,.98,29.16,2.28,49.43,3.91,3.98,.31,7.87,.61,11.64,.9v-67.18m121.5,73.61c2.9-4.49,5.35-9.43,7.33-14.82,3.69-10.21,5.54-20.6,5.54-31.19,0-5.43-.41-10.56-1.22-15.39-25.69-3.02-50.6-5.63-74.75-7.82,2.73,1.89,5.23,4.31,7.49,7.25,3.58,4.89,5.37,10.67,5.37,17.34s-.84,12.4-2.52,17.18c-1.79,4.67-4.67,8.71-8.63,12.13-4.56,3.8-10.18,6.32-16.86,7.57-6.79,1.3-15.36,1.95-25.73,1.95h-9.12c21.25,1.61,38.97,2.83,53.18,3.66,21.52,1.18,41.5,1.88,59.93,2.12m145.44-7.17v-35.67c-21.23-3.28-41.59-6.32-61.07-9.12v49.75c19.58-1.19,39.94-2.84,61.07-4.97m311.23-7.82v-52.36c-18.14-1.72-37.2-3.81-57.17-6.27-1.25-.16-2.55-.32-3.91-.49v54.07c22.77,2.1,43.13,3.79,61.07,5.05m-102.52-64.49l-32.49-4.56v9.04h66.86c-9.39-1.2-20.84-2.69-34.36-4.48m830.03,79.56c8.27,0,16.71-.11,25.33-.33v-33.88h-102.6v-35.18c-20.85-1.84-41.09-3.36-60.75-4.56v67.18c26.52,2.06,48.16,3.58,64.9,4.56,26.76,1.47,51.14,2.2,73.13,2.2m72.96-51.71v1.47c0,16.45,4.42,30.24,13.27,41.37,1.43,1.81,3,3.55,4.72,5.21,15.97-1.16,32.42-2.62,49.35-4.4,18.68-1.95,38.22-4.32,58.63-7.08,8.53-1.14,18.74-2.58,30.62-4.32-2.74-1.08-5.62-2.11-8.63-3.09-9.23-2.99-17.83-5.32-25.81-7-8.03-1.68-16.4-3.45-25.08-5.29-7.66-1.57-13.91-3.25-18.73-5.05-3.76-.57-7.45-1.14-11.07-1.71-23.46-3.7-45.88-7.07-67.26-10.1Z"/>
<path class="cls-6" d="M118.48,355.95c-2.9,.45-5.83,.91-8.79,1.38-6.68,1.12-14.77,2.5-24.27,4.15l-17.1,46.09c23.67-1.73,37.45-2.74,41.37-3.01,24.07-1.69,45.62-2.94,64.66-3.75l-16.61-44.87h-39.25m1113.17,9.77c-12.29,2.16-20.36,3.57-24.19,4.23-18.04,3.07-34.29,5.59-48.78,7.57l-20.11,37.13c17.99-.96,40.11-2.45,66.37-4.48l26.71-44.46m-145.68,18.97c-8.63,.43-16.99,.65-25.08,.65-14.11,0-28.74-.6-43.89-1.79l19.95,33.31c8.13,.16,16.11,.24,23.94,.24,13.4,0,27.65-.27,42.75-.81l-17.67-31.6m203.5-28.75c-2.9,.45-5.83,.91-8.79,1.38-3.45,.58-7.28,1.23-11.48,1.95v46.09c5.87-.42,9.7-.69,11.48-.81,17.93-1.26,34.46-2.29,49.59-3.09v-1.3h10.5c7.09,0,13.17,.05,18.24,.16,32.25-.99,65.75-.91,100.49,.24-.69-1.73-1.45-3.41-2.28-5.05-5.1-9.77-12.43-17.78-21.99-24.02-7.93-5.16-17.05-9.01-27.36-11.56-10.37-2.66-23.1-3.99-38.19-3.99h-80.21m-816.03,59.36c-1.15-7.3-3.21-13.89-6.19-19.79-5.1-9.77-12.43-17.78-21.99-24.02-7.93-5.16-17.05-9.01-27.36-11.56-10.37-2.66-23.1-3.99-38.19-3.99h-100.49v44.3c16.07,.49,32.41,1.2,49.02,2.12,3.99,.22,8.01,.47,12.05,.73v-2.93h10.5c10.1,0,18.16,.11,24.19,.33,6.03,.33,12.21,1.74,18.57,4.23,1.81,.74,3.52,1.66,5.13,2.77,24.15,2.19,49.07,4.79,74.75,7.82m33.88-59.36v41.94h38.84v26.87c19.49,2.8,39.85,5.84,61.07,9.12v-35.99h38.76v-41.29c-10.97-.09-21.23-.2-30.78-.33-7.01-.1-13.93-.2-20.77-.33h-87.13m276.14,0v36.73l32.49,4.56c13.52,1.79,24.98,3.28,34.36,4.48h7.08v.9c1.36,.17,2.66,.33,3.91,.49,19.97,2.46,39.02,4.55,57.17,6.27v-7.65h73.94v-20.6c-22.89-2.66-46.89-6.59-71.99-11.81-18.06-3.69-37.14-8.14-57.25-13.35h-79.72m785.25,51.46v-5.7h110.58v-45.76h-171.33v46.9c19.65,1.2,39.9,2.72,60.75,4.56m242.83-11.07c4.99-.76,10.04-1.14,15.15-1.14,14.39,0,28.53,2.61,42.43,7.82,13.79,5.1,25.46,11.45,35.02,19.06h6.51v-54.56c-10.43-4.28-22.65-7.83-36.64-10.67-33.93-.05-63.19-.24-87.78-.57-.43,0-.86,0-1.3,0-13.64,3.48-25.69,8.93-36.16,16.37-19.42,13.59-29.36,31.07-29.8,52.44,21.39,3.03,43.81,6.4,67.26,10.1,3.62,.57,7.31,1.14,11.07,1.71-3.52-1.26-6.29-2.59-8.31-3.99-4.78-3.37-7.17-8.2-7.17-14.49,0-4.13,1.49-7.76,4.48-10.91,2.93-3.31,6.49-5.75,10.67-7.33,4.61-1.9,9.47-3.18,14.58-3.83Z"/>
<path class="cls-5" d="M109.69,357.33c2.97-.48,5.9-.94,8.79-1.38h-31.03l-2.04,5.54c9.5-1.65,17.59-3.03,24.27-4.15m1060.73-1.38l-11.73,21.58c14.48-1.98,30.74-4.51,48.78-7.57,3.83-.67,11.89-2.08,24.19-4.23l5.94-9.77h-67.18m-169.95,0l16.53,27.61c15.15,1.19,29.78,1.79,43.89,1.79,8.09,0,16.45-.22,25.08-.65l-16.04-28.75h-69.46m280.21,1.38c2.97-.48,5.9-.94,8.79-1.38h-20.28v3.34c4.2-.72,8.03-1.38,11.48-1.95m-665.46-1.06c9.55,.13,19.81,.24,30.78,.33v-.65h-51.55c6.83,.12,13.75,.23,20.77,.33m247.96-.33c20.11,5.22,39.19,9.67,57.25,13.35,25.1,5.22,49.09,9.15,71.99,11.81v-25.16h-129.23m921.73,.33c.44,0,.88,0,1.3,0,24.59,.33,53.85,.52,87.78,.57-.9-.2-1.82-.39-2.77-.57-15.31-3.09-30.75-4.64-46.33-4.64-14.57,0-27.9,1.55-39.98,4.64Z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg preserveAspectRatio="none" version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<g id="a">
<path d="m561.3 552.35v-40l-132.75 65.15v31.95l132.75 65.15v-40l-85.2-41 85.2-41.25m-168.35-166.65q-16.9-10.55-41.75-16.15-24.8-5.85-59-5.85h-101.55v279.95h98.75q33.4 0 57.9-4.9 24.45-4.9 44.9-17.3 12.3-7.45 22.7-17.85v-34.4l31.95-15.65q8.35-22.95 8.35-49.65 0-40.6-16.5-70.45-16.75-30.1-45.75-47.75m-130.1 30.25h18.2q23.35 0 35 2.05 11.5 1.9 22.55 7.35 21.85 11.05 31.95 30.8 10.05 19.6 10.05 47.2 0 27.85-9.25 46.85-9.2 18.8-28.95 30.05-11.5 6.25-23.55 8.65-12 2.25-37.8 2.25h-18.2v-175.2m407.5-1.45h116.95v-54.15h-306.1v54.15h116.9v304.9h72.25v-304.9m36.8 97.85v39.95l85.1 41.1-85.1 41.1v40.05l132.7-65.15v-31.95l-132.7-65.1z" fill="#fff" fill-opacity=".99608"/>
</g>
<g id="b">
<path d="m534.4 621.65q-0.8418 0.21426-1.65 0.4-21.2 4.85-35.35 7.35-10.226 1.9352-21.2 3.45l85.1 41.75v-40l-26.9-12.95m209.8-1.9q-1.9207-0.31816-4.8-0.85l-32.25 15.6v40.05l103.05-50.6q-16.063 0.80801-30.65-0.05-15.45-0.9-35.35-4.15m-73.85 61.55v-74.4q-17.584-2.2-32.25-2.2-16.05 0-34.95 2.7-2.4557 0.35195-5.05 0.75v74.1q3.1031-0.35684 5.35-0.6 19.85-2.05 35.35-2.05 13.963 0 31.55 1.7z" fill="#5C6CFF"/>
<path d="m561.3 538.75q-22.562 2.4229-28.8 2.95-19.542 1.7631-34.7 1.8l-69.25 34v31.95l47.65 23.4q10.974-1.5148 21.2-3.45 14.15-2.5 35.35-7.35 0.8082-0.18574 1.65-0.4l-58.3-28.05 85.2-41.25v-13.6m147.8 7.3q-0.9873-0.19785-1.95-0.4v6.65l85.1 41.1-52.85 25.5q2.8793 0.53184 4.8 0.85 19.9 3.25 35.35 4.15 14.587 0.85801 30.65 0.05l29.65-14.55v-31.95l-46.5-22.85q-6.9828 0.5-13.65 0.5-15.9 0-35.3-2.75-13.35-1.9-35.3-6.3m-38.75 60.85v-68.35q-17.786-2.9322-31.9-3.8-15.95-0.95-35.3 0.15-2.3988 0.14121-5.05 0.3v72.95q2.5943-0.39805 5.05-0.75 18.9-2.7 34.95-2.7 14.666 0 32.25 2.2z" fill="#5CFF9D"/>
<path d="m532.5 541.7q6.2377-0.52715 28.8-2.95v-26.4l-63.5 31.15q15.158-0.036914 34.7-1.8m174.65 3.95q0.9627 0.20215 1.95 0.4 21.95 4.4 35.3 6.3 19.4 2.75 35.3 2.75 6.6672 0 13.65-0.5l-86.2-42.25v33.3m-36.8-7.1v-76.85q-16.172-0.37012-31.55 0.95-15.25 1.3-35.35 4.85-1.2656 0.22422-5.35 1v66.7q2.6512-0.15879 5.05-0.3 19.35-1.1 35.3-0.15 14.114 0.86777 31.9 3.8z" fill="#FFDB5C"/>
<path d="m670.35 719.4v-38.1q-17.587-1.7-31.55-1.7-15.5 0-35.35 2.05-2.2469 0.24316-5.35 0.6v37.15h72.25z" fill="#B75CFF"/>
<path d="m708.9 395q-19.35-1.75-35.15-1.15-18.6 0.7-34.95 4.7-15 3.55-35.35 11.85-4.1125 1.6934-9.7 4.1h4.35v54q4.0844-0.77578 5.35-1 20.1-3.55 35.35-4.85 15.378-1.3201 31.55-0.95v-47.2h116.95v-9.5q-3.9258-0.39453-7.75-0.85-8-0.95-35.35-4.85-21.9-3.1-35.3-4.3z" fill="#F79454"/>
<path d="m673.75 393.85q15.8-0.6 35.15 1.15 13.4 1.2 35.3 4.3 27.35 3.9 35.35 4.85 3.8242 0.45547 7.75 0.85v-44.65h-306.1v54.15h112.55q5.5875-2.4066 9.7-4.1 20.35-8.3 35.35-11.85 16.35-4 34.95-4.7z" fill="#FF5C5C"/>
</g>
</defs>
<g>
<use xlink:href="#a"/>
</g>
<g>
<use xlink:href="#b"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -83,10 +83,10 @@ The file structure might seem confusing at first, especially if it's your first
guide you through it.
When you clone the repository for the first time, you'll see a folder structure like this (we've not mentioned some
tooling specific files like `.eslintrc.json` to keep the structure clean). We've highlighted the important folders you
need to keep in mind when contributing.
tooling specific files like `.eslintrc.json` to keep the structure clean). We've highlighted the important folders and
files you need to keep in mind when contributing.
```bash {5,7-9,12-13,15-19}
```bash {2,4-6,9-10,12-16}
├── deno
├── gateway
├── node_modules (once you ran `npm ci`)
@@ -162,7 +162,7 @@ normal name (for instance `UserFlags`).
#### `rest`
This folder holds all the types that are related to Discord's REST API. Just like [`payloads`](#payloads), it is split
into folders that have an `index.ts` file. from the structure in [`Discord's API Documentation`](https://discord.dev),
into folders that have an `index.ts` file, from the structure in [`Discord's API Documentation`](https://discord.dev),
under the `Resources` category.
:::info
@@ -170,7 +170,7 @@ under the `Resources` category.
Types created here must start with the `REST` prefix (for instance `RESTGetAPIUserResult`) unless they are objects or
enums (for instance `Routes`).
They must also follow the following structure: `REST{http_method}{type_name}{Query|(JSON|FormData)|Result}`, where:
They must also follow the following structure: `REST{http_method}{type_name}{Query|(JSON|FormData)Body|Result}`, where:
- `http_method` is the PascalCase HTTP method name (for instance `Get`, `Post`, and so on)
- `type_name` is the actual name of the type it returns (for instance `APIUser`)
@@ -205,7 +205,7 @@ miscellaneous scripts we might need. There's really not much to say about these
#### `tests`
This folder holds tests for certain complex types that the mdule might have, and is especially useful for validating
This folder holds tests for certain complex types that the module might have, and is especially useful for validating
unions.
:::info

View File

@@ -1 +1 @@
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.33.0"}]
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.35.0"}]

File diff suppressed because one or more lines are too long

View File

@@ -83,10 +83,10 @@ The file structure might seem confusing at first, especially if it's your first
guide you through it.
When you clone the repository for the first time, you'll see a folder structure like this (we've not mentioned some
tooling specific files like `.eslintrc.json` to keep the structure clean). We've highlighted the important folders you
need to keep in mind when contributing.
tooling specific files like `.eslintrc.json` to keep the structure clean). We've highlighted the important folders and
files you need to keep in mind when contributing.
```bash {5,7-9,12-13,15-19}
```bash {2,4-6,9-10,12-16}
├── deno
├── gateway
├── node_modules (once you ran `npm ci`)
@@ -162,7 +162,7 @@ normal name (for instance `UserFlags`).
#### `rest`
This folder holds all the types that are related to Discord's REST API. Just like [`payloads`](#payloads), it is split
into folders that have an `index.ts` file. from the structure in [`Discord's API Documentation`](https://discord.dev),
into folders that have an `index.ts` file, from the structure in [`Discord's API Documentation`](https://discord.dev),
under the `Resources` category.
:::info
@@ -170,7 +170,7 @@ under the `Resources` category.
Types created here must start with the `REST` prefix (for instance `RESTGetAPIUserResult`) unless they are objects or
enums (for instance `Routes`).
They must also follow the following structure: `REST{http_method}{type_name}{Query|(JSON|FormData)|Result}`, where:
They must also follow the following structure: `REST{http_method}{type_name}{Query|(JSON|FormData)Body|Result}`, where:
- `http_method` is the PascalCase HTTP method name (for instance `Get`, `Post`, and so on)
- `type_name` is the actual name of the type it returns (for instance `APIUser`)
@@ -205,7 +205,7 @@ miscellaneous scripts we might need. There's really not much to say about these
#### `tests`
This folder holds tests for certain complex types that the mdule might have, and is especially useful for validating
This folder holds tests for certain complex types that the module might have, and is especially useful for validating
unions.
:::info

View File

@@ -0,0 +1 @@
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.36.0"}]

File diff suppressed because one or more lines are too long

View File

@@ -83,10 +83,10 @@ The file structure might seem confusing at first, especially if it's your first
guide you through it.
When you clone the repository for the first time, you'll see a folder structure like this (we've not mentioned some
tooling specific files like `.eslintrc.json` to keep the structure clean). We've highlighted the important folders you
need to keep in mind when contributing.
tooling specific files like `.eslintrc.json` to keep the structure clean). We've highlighted the important folders and
files you need to keep in mind when contributing.
```bash {5,7-9,12-13,15-19}
```bash {2,4-6,9-10,12-16}
├── deno
├── gateway
├── node_modules (once you ran `npm ci`)
@@ -162,7 +162,7 @@ normal name (for instance `UserFlags`).
#### `rest`
This folder holds all the types that are related to Discord's REST API. Just like [`payloads`](#payloads), it is split
into folders that have an `index.ts` file. from the structure in [`Discord's API Documentation`](https://discord.dev),
into folders that have an `index.ts` file, from the structure in [`Discord's API Documentation`](https://discord.dev),
under the `Resources` category.
:::info
@@ -170,7 +170,7 @@ under the `Resources` category.
Types created here must start with the `REST` prefix (for instance `RESTGetAPIUserResult`) unless they are objects or
enums (for instance `Routes`).
They must also follow the following structure: `REST{http_method}{type_name}{Query|(JSON|FormData)|Result}`, where:
They must also follow the following structure: `REST{http_method}{type_name}{Query|(JSON|FormData)Body|Result}`, where:
- `http_method` is the PascalCase HTTP method name (for instance `Get`, `Post`, and so on)
- `type_name` is the actual name of the type it returns (for instance `APIUser`)
@@ -205,7 +205,7 @@ miscellaneous scripts we might need. There's really not much to say about these
#### `tests`
This folder holds tests for certain complex types that the mdule might have, and is especially useful for validating
This folder holds tests for certain complex types that the module might have, and is especially useful for validating
unions.
:::info

View File

@@ -1 +1 @@
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.33.1"}]
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.36.1"}]

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,263 @@
---
id: contributing_to_discord-api-types
title: How to Contribute
sidebar_position: 1
---
So, you'd like to contribute to `discord-api-types` but don't know where to start or what to do? Here are some of the
things you need to keep in mind before opening a pull request!
:::tip Before you begin
We recommend you contribute either through locally editing the files on your desktop (which means also installing
[`npm`](https://www.npmjs.com/) dependencies as this will ensure not only a consistent code style, but also that the
`deno` types stay in sync automatically) or through a service like
[`GitHub Codespaces`](https://github.com/features/codespaces).
:::
:::info Still can't figure it out?
No problem! We await you with open hands in our [`Discord Server`](https://discord.gg/djs) in the
`#discord-api-types-help` channel (under the `Miscellaneous` category)
:::
### Install npm dependencies first
One of the most crucial steps is installing [`npm`](https://www.npmjs.com/) dependencies via `npm ci`. This ensures that
linting can be done, and it also sets up the `git` hooks for building the `deno` types and automatically
formatting/linting the code when you commit it.
If you forget to install [`npm`](https://www.npmjs.com/) dependencies, or are doing the contributions through other
means (like directly from GitHub web), you might see a comment like this one being sent as a review to your pull
request:
![An image showing the style of comment the automatic deno checker reports](./images/deno_types_out_of_sync.png)
The easiest way to solve this is to run the `build:deno` script (`npm run build:deno`) and pushing the results.
### Figure out if the update you want to contribute respects our rules about documentation
:::danger
We will not document client-only / client related types. If you plan on contributing, make sure the types you want to
document can be used by bots and are _intended_ for usage by bots. This is a hard rule that will never change.
:::
Not every single update to the API is valid to be documented here. Our main stance for documentation is that properties
must be known and documented on [`Discord's API Documentation repository`](https://github.com/discord/discord-api-docs),
must be mentioned in an open pull request or must have received the green light to be used.
With that aside, there are times where documentation for certain types is not approved/merged by Discord on the grounds
that `it isn't helpful for bots` (or similar), but it would actually benefit bot developers to have it documented (one
good example is the UserFlags `SPAMMER` flag). As such, if you think your update should still be merged, please propose
it and we will be handled on a case by case basis. If approved, your update will be documented with an `@unstable` tag.
It will also not be subject to the same versioning rules as the rest of the types.
### Figure out what API versions need to receive the update
`discord-api-types` has multiple API versions in the repository, some of which may be considered `deprecated` or
`discontinued` as we keep them till the version is completely dead before removing them. This is a good time to figure
out which API versions need to be updated, and you can use the table below to guide you.
You can also check [`Discord's API versioning table`](https://discord.com/developers/docs/reference#api-versioning) if
you want to be 1000% sure.
| **API Version** | **Should receive updates** |
| :-------------: | :------------------------: |
| 10 | Yes |
| 9 | Yes |
| 8 | No |
| 7 | No |
| 6 | No |
If the version you want to contribute to is not listed above (for instance if a new API version rolls out) or if the
version you want to contribute to is for a different part of the API (for instance `voice`), feel free to submit it and
we will review it accordingly.
### Figure out where exactly are the files you need to modify to make the update
The file structure might seem confusing at first, especially if it's your first time contributing, but we're here to
guide you through it.
When you clone the repository for the first time, you'll see a folder structure like this (we've not mentioned some
tooling specific files like `.eslintrc.json` to keep the structure clean). We've highlighted the important folders and
files you need to keep in mind when contributing.
```bash {2,4-6,9-10,12-16}
├── deno
├── gateway
├── node_modules (once you ran `npm ci`)
├── payloads
├── rest
├── rpc
├── scripts
├── tests
├── utils
├── voice
├── website
├── globals.ts
├── v6.ts
├── v8.ts
├── v9.ts
├── v10.ts
└── package.json
```
#### `deno`
This folder stores the [`deno`](https://deno.land/) compatible typings for Discord's API.
:::danger
This folder should not be manually modified. Any manual changes will be overwritten by the `build:deno` script.
Any changes that need to be done to this folder need to be done through the `scripts/deno.mjs` file.
:::
#### `gateway`
This folder holds types that are strictly received from
[`Discord's gateway`](https://discord.com/developers/docs/topics/gateway). It stores the gateway version the types are
for, the intents and opcodes, and any data that can be received/sent through the gateway.
Each file in the folder represents a gateway version. It references types from the versioned [`payloads`](#payloads)
folder unless the payloads come _only_ through the gateway. There is also a `common.ts` file which represents shared
types across all versions, as well as an `index.ts` file that exports the recommended gateway version's types.
:::info
Types created here must start with the `Gateway` prefix (for instance `GatewayGuildCreateDispatchData` which is an
extension of the `APIGuild` type with extra fields received only through the gateway).
:::
#### `payloads`
This folder holds the bulk of type definitions for Discord's APIs. Each API version receives its own folder. Inside of
each folder there is always an `index.ts` file that exports every type available in that version, as well as the common
types that can be found in `payloads/common.ts`. At the root of the `payloads` folder is also an `index.ts` file which
exports the recommended API version's types.
Inside of each versioned folder, the files are defined from the structure in
[`Discord's API Documentation`](https://discord.dev), under the `Resources` category. Depending on the complexity of the
resource, you may opt for splitting it up into multiple files. If you want to do so, please create a folder named
`_{resource_name}` where the `resource_name` is the same name as the resource you're splitting up (a good example is the
`_interactions` folder which stores all the types for interactions in a neater structure), and create a
`{resource_name}.ts` file which exports everything from that folder). If you feel like you need to split it up even
more, just repeat the same structure of creating an `_{file_name}` folder and exporting everything from it in the
`{file_name}.ts` file (you can see an example
[here](https://github.com/discordjs/discord-api-types/tree/85802f1/payloads/v10/_interactions)).
:::info
Types created here must start with the `API` prefix (for instance `APIUser`), **except** for enums, which should have a
normal name (for instance `UserFlags`).
:::
#### `rest`
This folder holds all the types that are related to Discord's REST API. Just like [`payloads`](#payloads), it is split
into folders that have an `index.ts` file, from the structure in [`Discord's API Documentation`](https://discord.dev),
under the `Resources` category.
:::info
Types created here must start with the `REST` prefix (for instance `RESTGetAPIUserResult`) unless they are objects or
enums (for instance `Routes`).
They must also follow the following structure: `REST{http_method}{type_name}{Query|(JSON|FormData)Body|Result}`, where:
- `http_method` is the PascalCase HTTP method name (for instance `Get`, `Post`, and so on)
- `type_name` is the actual name of the type it returns (for instance `APIUser`)
- `Query|(JSON|FormData)Body|Result` should be used depending on what the route takes or returns
- If a route doesn't take in any parameters, be it query, JSON or FormData, it shouldn't define any of those types
- A route should always define a `Result` type, and should reference an `API*` type unless the data returned is only
received through a REST call
- If a route returns a `204 No Content` response, it should define a `Result` type with `never` as its value (this
does not account for errors)
This structure should be followed whenever possible, however that might not always be doable. Specifically, types for
OAuth2 may not follow the structure exactly, but should aim to follow it as much as possible.
:::
#### `rpc`
This folder holds types that are strictly related to
[`Discord's RPC API`](https://discord.com/developers/docs/topics/rpc). Just like [`gateway`](#gateway), each RPC API
version receives its own file.
:::info
Types created here must start with the `RPC` prefix (for instance `RPCErrorCodes`).
:::
#### `scripts`
This folder holds the module's scripts that empower our Continuous Integration / Deployment pipelines, as well as other
miscellaneous scripts we might need. There's really not much to say about these really...
#### `tests`
This folder holds tests for certain complex types that the module might have, and is especially useful for validating
unions.
:::info
Files created here **must** end in `.test-d.ts`, as otherwise they will not be picked up by
[`tsd`](https://www.npmjs.com/package/tsd).
:::
#### `utils`
This folder holds certain utility functions which can be used while working with some complicated types (for instance
for more complicated unions). Each API version gets its own file with utility functions, but a folder can be created if
a lot of methods are created.
:::info
The `internals.ts` file stores types that are strictly used inside the module to help build out our strict types. These
types should never be exported from the module.
:::
#### `voice`
This folder holds types that are strictly related to
[`Discord's Voice API`](https://discord.com/developers/docs/topics/voice-connections). It follows the same folder
structure as [`gateway`](#gateway).
:::info
Types in this folder must start with the `Voice` prefix (for instance `VoiceOpcodes`).
:::
#### `website`
This folder holds...well...this very site you are reading this page from! For the most part, you do not need to alter
its contents, except if you're contributing a new API version to the module.
To add the new version to this very website, edit the `docusaurus.config.js` file, and in the `plugins` array, for the
`docusaurus-plugin-typedoc-api` plugin, you need to add an entry similar to the ones already present.
#### `globals.ts`
This file stores types that are present regardless of the API version you use.
#### `v*.ts`
These files export everything from the previously mentioned folders that match the version the file is named after. It
serves as the entry point for importing types from the module (for example by importing `discord-api-types/v10`).
#### `package.json`
This is the entry point of the package for [`npm`](https://www.npmjs.com/). You won't need to edit this file unless
you're adding a new API version, in which case you should follow the same structure as seen in the `exports` field.

View File

@@ -0,0 +1,167 @@
---
id: introduction_to_discord-api-types
title: Introduction
sidebar_position: 0
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<div align="center">
<img src="/svgs/logo_long_blurple.svg" className="markdown__logo" />
[![Discord server](https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white)](https://discord-api-types.dev/discord)
[![Patreon Donate](https://img.shields.io/badge/patreon-donate-brightgreen.svg?label=Donate%20with%20Patreon&logo=patreon&colorB=F96854&link=https://www.patreon.com/vladfrangu)](https://www.patreon.com/vladfrangu)
[![Ko-fi Donate](https://img.shields.io/badge/kofi-donate-brightgreen.svg?label=Donate%20with%20Ko-fi&logo=ko-fi&colorB=F16061&link=https://ko-fi.com/wolfgalvlad&logoColor=FFFFFF)](https://ko-fi.com/wolfgalvlad)
[![GitHub Sponsors](https://img.shields.io/badge/patreon-donate-brightgreen.svg?label=Sponsor%20through%20GitHub&logo=github&colorB=F96854&link=https://github.com/sponsors/vladfrangu)](https://github.com/sponsors/vladfrangu)
[![npm version](https://img.shields.io/npm/v/discord-api-types?color=crimson&label=NPM%20Version&logo=npm)](https://www.npmjs.com/package/discord-api-types)
[![npm downloads](https://img.shields.io/npm/dt/discord-api-types.svg?label=NPM%20Downloads&logo=npm)](https://www.npmjs.com/package/discord-api-types)
[![deno](https://img.shields.io/npm/v/discord-api-types?color=blue&label=deno&logo=deno)](https://deno.land/x/discord_api_types)
</div>
## About
Discord API Types is a community-maintained project that brings API types for Discord's REST, Gateway and Voice APIs.
## Installation
Install with [`npm`](https://www.npmjs.com/) / [`yarn`](https://yarnpkg.com) / [`pnpm`](https://pnpm.js.org/):
```bash npm2yarn2pnpm
npm install discord-api-types
```
### Usage
You can only import this module by specifying the API version you want to target. Append `/v*` to the import path, where
the `*` represents the API version. Below are some examples
<Tabs groupId="ts2esm2cjs">
<TabItem value="javascript" label="JavaScript">
```typescript showLineNumbers
/**
* @type {import('discord-api-types/v10').APIUser}
*/
```
</TabItem>
<TabItem value="esm" label="ESM">
```typescript showLineNumbers
/**
* @type {import('discord-api-types/v10').APIUser}
*/
```
</TabItem>
<TabItem value="typescript" label="TypeScript">
```typescript showLineNumbers
import { type APIUser } from 'discord-api-types/v10';
```
</TabItem>
</Tabs>
:::info
You may also import just certain parts of the module that you need. The possible values are: `globals`, `gateway`,
`gateway/v*`, `payloads`, `payloads/v*`, `rest`, `rest/v*`, `rpc`, `rpc/v*`, `utils`, `utils/v*`, `voice`, and
`voice/v*`. Below is an example of importing directly from the gateway submodule
```typescript ts2esm2cjs
import { GatewayVersion } from 'discord-api-types/gateway/v10';
console.log(`Let's connect to wss://gateway.discord.gg/?v=${GatewayVersion}`);
```
> _**Note:** The `v*` exports (`discord-api-types/v*`) include the appropriate version of `gateway`, `payloads`, `rest`,
> `rpc`, and `utils` you specified, alongside the `globals` exports_
:::
### Deno
We also provide typings compatible with the [deno](https://deno.land/) runtime. Here are 3 examples of how you can
import them:
<Tabs>
<TabItem value="github" label="From GitHub">
```typescript showLineNumbers
// Importing a specific API version
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/v10.ts';
```
</TabItem>
<TabItem value="deno" label="From deno.land/x" default>
```typescript showLineNumbers
// Importing a specific API version
import { APIUser } from 'https://deno.land/x/discord_api_types/v10.ts';
```
</TabItem>
<TabItem value="skypack" label="From skypack.dev">
```typescript showLineNumbers
// Importing a specific API version
import { APIUser } from 'https://cdn.skypack.dev/discord-api-types/v10?dts';
```
</TabItem>
</Tabs>
## Project Structure
The exports of each API version is split into three main parts:
- Everything exported with the `API` prefix represents a payload you may get from the REST API _or_ the Gateway.
- Everything exported with the `Gateway` prefix represents data that ONLY comes from or is directly related to the
Gateway.
- Everything exported with the `REST` prefix represents data that ONLY comes from or is directly related to the REST
API.
- For endpoint options, they will follow the following structure:
`REST<HTTP Method><Type><Query|(JSON|FormData)Body|Result>` where the type represents what it will return.
- For example, `RESTPostAPIChannelMessageJSONBody` or `RESTGetAPIGatewayBotInfoResult`.
- Some exported types (specifically OAuth2 related ones) may not respect this entire structure due to the nature of
the fields. They will start with either `RESTOAuth2` or with something similar to `REST<HTTP Method>OAuth2`
- If a type ends with `Result`, then it represents the expected result by calling its accompanying route.
- Types that are exported as `never` usually mean the result will be a `204 No Content`, so you can safely ignore
it. This does **not** account for errors.
- Anything else that is miscellaneous will be exported based on what it represents (for example the `REST` route
object).
- There may be types exported that are identical for all versions. These will be exported as is and can be found in the
`globals` file. They will still be prefixed accordingly as described above.
:::danger A note about how types are documented
This package will add types only for known and documented properties that are present in Discord's
[API Documentation repository](https://github.com/discord/discord-api-docs), that are mentioned in an open pull request,
or known through other means _and have received the green light to be used_. Anything else will not be documented (for
example client only types).
With that aside, we may allow certain types that are not documented in the
[API Documentation repository](https://github.com/discord/discord-api-docs) on a case by case basis. They will be
documented with an `@unstable` tag and are not subject with the same versioning rules.
:::

View File

@@ -1 +1 @@
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.33.2"}]
[{"entryPoints":{"globals":{"path":"globals.ts","label":"Global Types"},"gateway/common":{"path":"gateway/common.ts","label":"Gateway - Common Types"},"payloads/common":{"path":"payloads/common.ts","label":"Payloads - Common Types"},"rest/common":{"path":"rest/common.ts","label":"REST - Common Types"},"rpc/common":{"path":"rpc/common.ts","label":"RPC - Common Types"},"v6":{"path":"v6.ts","label":"API v6 - Deprecated"},"v8":{"path":"v8.ts","label":"API v8 - Deprecated"},"v9":{"path":"v9.ts","label":"API v9"},"v10":{"path":"v10.ts","label":"API v10"},"rpc/v8":{"path":"rpc/v8.ts","label":"RPC v8"},"rpc/v9":{"path":"rpc/v9.ts","label":"RPC v9"},"rpc/v10":{"path":"rpc/v10.ts","label":"RPC v10"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"utils/v8":{"path":"utils/v8.ts","label":"Utils v8"},"utils/v9":{"path":"utils/v9.ts","label":"Utils v9"},"utils/v10":{"path":"utils/v10.ts","label":"Utils v10"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.36.2"}]

File diff suppressed because one or more lines are too long

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