Compare commits

...

24 Commits

Author SHA1 Message Date
Advaith
bc9ab4556c refactor(Invite): rename InviteTargetUserType to InviteTargetType (#124)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

BREAKING CHANGE: `InviteTargetUserType` is renamed to `InviteTargetType`, to match the documentation.
  - Reference: https://github.com/discord/discord-api-docs/pull/2690
2021-04-18 10:34:51 +03:00
Advaith
abe05136fd fix(APIInvite): channel is not optional (#123)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-04-18 10:33:32 +03:00
Vlad Frangu
d6fb271df8 chore(release): 0.17.0 🎉 (#121) 2021-04-17 18:48:20 +03:00
Jan
3294fb15ae feat(WebhookMessage): add GET route types (#120)
- Reference: https://github.com/discord/discord-api-docs/pull/2812
2021-04-16 00:48:22 +03:00
Jan
9817623291 refactor(APISticker): remove preview_asset (#119)
BREAKING CHANGE: This removes the `preview_asset` property from sticket objects
  - Reference: https://github.com/discord/discord-api-docs/commit/b9b8db2
2021-04-15 17:59:30 +03:00
Jan
617f507427 fix(APIChannel): rtc_region is optional (#118)
BREAKING CHANGE: This corrects the fact that `rtc_region` isn't present on non-voice-like channels
2021-04-15 17:47:07 +03:00
Vlad Frangu
df09356edd chore(release): 0.16.0 🎉 (#117) 2021-04-14 20:44:47 +03:00
Vlad Frangu
21b572b7f2 feat(Guild): add nsfw property (#116) 2021-04-14 19:39:34 +03:00
Vlad Frangu
6451679c9a docs(Routes): add GET route to webhookMessage (#114) 2021-04-14 19:39:23 +03:00
Vlad Frangu
ced37d0a5e feat(RESTJSONErrorCode): add UnknownInteraction error code (#115) 2021-04-14 19:39:12 +03:00
Vlad Frangu
a95f40e5b8 fix(TypeScript): imports not working in TypeScript (#113) 2021-04-12 12:01:37 +03:00
Vlad Frangu
75f902b0f5 chore(release): 0.15.0 🎉 (#112)
* chore(release): 0.15.0 🎉

* fix(Scripts): `await` in `versions` script, log any errors from deno one

* chore(Changelog): update changelog
2021-04-11 23:29:03 +03:00
Jan
9420c3e0af fix(APIApplicationCommand): default_permission (#111)
BREAKING CHANGE: This renames the `default_permissions` property to `default_permission`, the correct spelling.
2021-04-11 23:08:13 +03:00
Vlad Frangu
24d8037c47 feat(*): Polish Week - Discord API Types Edition (#110)
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-04-11 21:45:23 +03:00
Advaith
07ba907242 feat(APIChannel): add rtc_region (#108)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-04-09 13:18:32 +03:00
Advaith
b90714f677 feat: invite reminder system message type and flag (#105)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-04-08 14:15:12 +03:00
Vlad Frangu
6cd75426c6 feat: stage channels! (#107) 2021-04-08 14:14:31 +03:00
Advaith
d8d7bccea6 feat(APIChannel): add video_quality_mode (#106)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-04-08 14:09:47 +03:00
Advaith
4462255168 feat(MessageFlags): EPHEMERAL desc and added LOADING (#109)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-04-08 14:09:01 +03:00
Vlad Frangu
679a5cfd77 chore: fix globs (#104) 2021-03-28 15:19:43 +03:00
Vlad Frangu
fc4b7e2708 chore: release 0.13.2 (#103) 2021-03-28 12:56:01 +03:00
Tiemen
15c171c558 fix(ApplicationCommandInteractionDataOptionSubCommandGroup): typo (#102)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-03-28 12:48:01 +03:00
Vlad Frangu
ebd5754242 chore: release 0.13.1 (#101) 2021-03-28 00:43:10 +02:00
Advaith
ffcd95d597 fix(APIInteractionResponse): data should not always be present (#100)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-03-28 00:40:52 +02:00
156 changed files with 5835 additions and 1536 deletions

3
.babelrc Normal file
View File

@@ -0,0 +1,3 @@
{
"plugins": ["@babel/plugin-syntax-top-level-await"]
}

59
.gitignore vendored
View File

@@ -1,24 +1,47 @@
node_modules/
out/
coverage/
.nyc_output/
debug.log
# Don't commit build outputs
globals.js
globals.*map
globals.d.ts
globals.mjs
v*/**/*.js
v*/**/*.map
v*/**/*.d.ts
v*/**/*.mjs
v*.js
v*.*map
v*.d.ts
v*.mjs
default/*.js
default/*.map
default/*.d.ts
default/*.mjs
gateway/**/*.js
gateway/**/*.map
gateway/**/*.d.ts
gateway/**/*.mjs
common/*.js
common/*.map
common/*.d.ts
common/*.mjs
payloads/**/*.js
payloads/**/*.map
payloads/**/*.d.ts
payloads/**/*.mjs
rest/**/*.js
rest/**/*.map
rest/**/*.d.ts
rest/**/*.mjs
rpc/**/*.js
rpc/**/*.map
rpc/**/*.d.ts
rpc/**/*.mjs
shortcuts/**/*.js
shortcuts/**/*.map
shortcuts/**/*.d.ts
shortcuts/**/*.mjs
utils/**/*.js
utils/**/*.map
utils/**/*.d.ts
utils/**/*.mjs
voice/**/*.js
voice/**/*.map
voice/**/*.d.ts
voice/**/*.mjs

3
.npmrc
View File

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

342
CHANGELOG.md Normal file
View File

@@ -0,0 +1,342 @@
# [0.17.0](https://github.com/discordjs/discord-api-types/compare/0.16.0...0.17.0) (2021-04-17)
### Bug Fixes
- **APIChannel:** `rtc_region` is optional ([#118](https://github.com/discordjs/discord-api-types/issues/118)) ([617f507](https://github.com/discordjs/discord-api-types/commit/617f507427fae6456de228a23809ab04c1df13f6))
### Code Refactoring
- **APISticker:** remove `preview_asset` ([#119](https://github.com/discordjs/discord-api-types/issues/119)) ([9817623](https://github.com/discordjs/discord-api-types/commit/9817623291ec852a831c3de225e90a65d83dac7f))
### Features
- **WebhookMessage:** add `GET` route types ([#120](https://github.com/discordjs/discord-api-types/issues/120)) ([3294fb1](https://github.com/discordjs/discord-api-types/commit/3294fb15ae6c259c1b53b7f2eca4ea8dca2f2372))
### BREAKING CHANGES
- **APISticker:** This removes the `preview_asset` property from sticket objects
- Reference: https://github.com/discord/discord-api-docs/commit/b9b8db2
- **APIChannel:** This corrects the fact that `rtc_region` isn't present on non-voice-like channels
# [0.16.0](https://github.com/discordjs/discord-api-types/compare/0.15.1...0.16.0) (2021-04-14)
### Features
- **Guild:** add `nsfw` property ([#116](https://github.com/discordjs/discord-api-types/issues/116)) ([21b572b](https://github.com/discordjs/discord-api-types/commit/21b572b7f25a320e40f8ca2e63d6bd8b111403aa))
- **RESTJSONErrorCode:** add `UnknownInteraction` error code ([#115](https://github.com/discordjs/discord-api-types/issues/115)) ([ced37d0](https://github.com/discordjs/discord-api-types/commit/ced37d0a5ebdc80887662529922c57e2531e1e5b))
### docs
- **Routes:** add `GET` routes to `webhookMessages` ([#114](https://github.com/discordjs/discord-api-types/issues/114)) ([6451679](https://github.com/discordjs/discord-api-types/commit/6451679c9acb9d7fde593914452577669473841d))
### BREAKING CHANGES
- **Routes:** possibly a breaking change due to the fact that the messageID is now strictly typed as a Snowflake or `@me`
- Reference: discord/discord-api-docs#2410
## [0.15.1](https://github.com/discordjs/discord-api-types/compare/0.15.0...0.15.1) (2021-04-12)
### Bug Fixes
- **TypeScript:** imports not working in TypeScript ([4738c33](https://github.com/discordjs/discord-api-types/commit/4738c33b062d359a1c2fbb35cdd2daf128ab6e5b))
# [0.15.0](https://github.com/discordjs/discord-api-types/compare/0.14.0...0.15.0) (2021-04-11)
### Bug Fixes
- **APIApplicationCommand:** default_permission ([#111](https://github.com/discordjs/discord-api-types/issues/111)) ([9420c3e](https://github.com/discordjs/discord-api-types/commit/9420c3e0af7b2486f0e49bb680ed98e0d9f5c625))
- **Scripts:** `await` in `versions` script, log any errors from deno one ([9113eb1](https://github.com/discordjs/discord-api-types/commit/9113eb133c4627445e2bcd4583c243dde74a20ee))
### BREAKING CHANGES
- **APIApplicationCommand:** This renames the `default_permissions` property to `default_permission`, the correct spelling.
# [0.14.0](https://github.com/discordjs/discord-api-types/compare/0.13.3...0.14.0) (2021-04-11)
### Bug Fixes
- **APIMessage:** correct type for `application` ([ed2cbe8](https://github.com/discordjs/discord-api-types/commit/ed2cbe82c56f872ee01a9eb6991ef70dc22d8c1f))
- **GatewayGuildMemberUpdateDispatchData:** correct types ([14f14e2](https://github.com/discordjs/discord-api-types/commit/14f14e227955af41ed2823f11c6e8d03d12549ba))
- **GatewayPresenceUpdateData:** `activities` may not be `null` ([bb3cb04](https://github.com/discordjs/discord-api-types/commit/bb3cb04e016840f66eecbe39c2e07aea8ea12bc8))
- **GatewayVoiceServerUpdateDispatchData:** `endpoint` is nullable ([e8203a1](https://github.com/discordjs/discord-api-types/commit/e8203a1112a834ce9aaae4ab95f711d3aaffc20f))
- **GuildWelcomeScreenChannel:** document missing `description` property ([238695b](https://github.com/discordjs/discord-api-types/commit/238695b44d8547d51782e3d9d9729e2db85bc444))
- **OAuth2:** `scope` can be optional / not required ([bbe56a9](https://github.com/discordjs/discord-api-types/commit/bbe56a97564ce8c317f291080327484f0d987e1c))
- **OAuth2:** remove invalid parameters from refresh token request ([1c02450](https://github.com/discordjs/discord-api-types/commit/1c024507f3f55b922565845c2bedac615ffa24d5))
- **RPC:** version `RPC` same as` rest`, export again in `shortcuts` ([67e0ba1](https://github.com/discordjs/discord-api-types/commit/67e0ba1834e6d9de9ad00bd452f5e8da59ff1cc6))
- **Utils:** correct import for deno users ([42dd75f](https://github.com/discordjs/discord-api-types/commit/42dd75f2581b2a8862e4f0446b42ff838f923de0))
### chore
- **Gateway:** remove `guild_subscriptions` ([ab8b289](https://github.com/discordjs/discord-api-types/commit/ab8b289ac8f99fe1a998ef06320ad9046aafa1d2))
- **GatewayReady:** un-document `private_channels` ([457edf4](https://github.com/discordjs/discord-api-types/commit/457edf4ed43327fb871d3b1638745b905518ef91))
- **Integrations:** remove routes that bots can no longer interact with ([577c5bd](https://github.com/discordjs/discord-api-types/commit/577c5bd040dd1dc258ca6c414cf6ac69ae84916c))
- **MessageGetReactions:** remove `before` pagination ([0ec26b7](https://github.com/discordjs/discord-api-types/commit/0ec26b731cda570f34e59e05a8c21f272b1fd64e))
- **Oauth2Scopes:** remove `rpc.api` ([7ee8511](https://github.com/discordjs/discord-api-types/commit/7ee85113ea8107106460889a2eaa42b251ee05d0))
- **Permissions:** rename `USE_APPLICATION_COMMANDS` to `USE_SLASH_COMMANDS` ([2aa7f7a](https://github.com/discordjs/discord-api-types/commit/2aa7f7a7b8da3d4d46a7743830562d996d32120b))
- **UserFlags:** un-document `SYSTEM` flag ([1774d4c](https://github.com/discordjs/discord-api-types/commit/1774d4c4749d303f24bfb3c754cf79a4ca7ef699))
### Code Refactoring
- restructure module ([81cdfc2](https://github.com/discordjs/discord-api-types/commit/81cdfc2d9c523d98edd0a69f976879e848e1167b))
### Features
- **APIApplication:** document `terms_of_service` and `privacy_policy` ([598cbfb](https://github.com/discordjs/discord-api-types/commit/598cbfb958a67d5ba61696ba877ea0bae4c4be55))
- **APIAttachment:** add `content_type` ([2d432d1](https://github.com/discordjs/discord-api-types/commit/2d432d145eb8a009b092b27b6231252d7b2f2823))
- **APIChannel:** add `rtc_region` ([#108](https://github.com/discordjs/discord-api-types/issues/108)) ([07ba907](https://github.com/discordjs/discord-api-types/commit/07ba9072429dec85a13479dc211ec1f9d8788acf))
- **APIChannel:** add `video_quality_mode` ([#106](https://github.com/discordjs/discord-api-types/issues/106)) ([d8d7bcc](https://github.com/discordjs/discord-api-types/commit/d8d7bccea617ad0d1150b9d2aed3b26ec1e4f99a))
- **APIInteraction:** add type-check utilities ([3307201](https://github.com/discordjs/discord-api-types/commit/33072011c2ea9ace8350dedc0cd1068660dc2ece))
- **Exports:** add `globals` to the exported sub-modules ([5d35f61](https://github.com/discordjs/discord-api-types/commit/5d35f61334480af983c4767373ef05e395da2e18))
- **Gateway:** add `INTEGRATION_*` events ([9c3fab0](https://github.com/discordjs/discord-api-types/commit/9c3fab052619609eb543ff400c2b813b69c6b99f))
- **GuildWelcomeScreen:** document `welcome-screen` endpoint ([169ecde](https://github.com/discordjs/discord-api-types/commit/169ecde47a6a911309630e952ab26b805ac87cf0))
- **Interactions:** add batch command create / update ([edfe70a](https://github.com/discordjs/discord-api-types/commit/edfe70a1eeec9be1104ec68a20d95e83512b3268))
- **Interactions:** add Slash Command Permissions ([f517f35](https://github.com/discordjs/discord-api-types/commit/f517f3596f458a2c2e4c4a26d5c13bbed4c4a71f))
- **Invites:** document `target_application` & correct property names ([97c8ab3](https://github.com/discordjs/discord-api-types/commit/97c8ab3f5165c6f161e9338e944cff8b296756d5))
- **MessageFlags:** `EPHEMERAL` desc and added `LOADING` ([#109](https://github.com/discordjs/discord-api-types/issues/109)) ([4462255](https://github.com/discordjs/discord-api-types/commit/4462255168af2ad66c9c7405500e80d3fa41de33))
- **PatchAPIWebhookMessage:** add `file` property ([fc2f3c5](https://github.com/discordjs/discord-api-types/commit/fc2f3c58cf5ea2a8c0a1a14a62a16f432b1776e2))
- **Webhook:** add & document `url` property ([77e5bb6](https://github.com/discordjs/discord-api-types/commit/77e5bb624d86e4bc8696c8dac4f513c27eb8aff1))
- invite reminder system message type and flag ([#105](https://github.com/discordjs/discord-api-types/issues/105)) ([b90714f](https://github.com/discordjs/discord-api-types/commit/b90714f677c67c009ddb6d00734ab8998c194350))
- stage channels! ([#107](https://github.com/discordjs/discord-api-types/issues/107)) ([6cd7542](https://github.com/discordjs/discord-api-types/commit/6cd75426c6d7da145b40a656e4c1a1d3d26bfb1f))
### BREAKING CHANGES
- **APIInteraction:** This commit removes the `guild_id` property from `APIDMInteraction`
which allows type-checks to work with the `in` operator.
Because of that, we also provide utility functions that help with those type checks.
Use them in your code by importing the `Utils` object, or by directly importing them.
Check the README for examples
- **OAuth2:** This commit removes parameters that are not expected
in the refresh token request body
Reference: https://github.com/discord/discord-api-docs/commit/eaa12cbc8f96cf7cfe8c530f88e60582c24ca5dd
- **GatewayReady:** This property has been deprecated for a while, and was
returning an empty array for bot users. This commit removes it entirely
Reference: https://github.com/discord/discord-api-docs/commit/f36156dbb641f5c4d4f4593f345bfd6e27fdee08
- **Permissions:** This commit brings consistency with the documentation,
where the permission is documented as `USE_SLASH_COMMANDS`, whereas the
client has it as `USE_APPLICATION_COMMANDS` internally
Reference: https://github.com/discord/discord-api-docs/commit/c7d25885c5cd80a49b31609a40b70603b35f9dec
- **MessageGetReactions:** This query parameter is not usable and was not respected
by the API.
Reference: https://github.com/discord/discord-api-docs/commit/f72b084773d4d3989fb19be4fb4d9cf276a1e6b3
- **OAuth2:** This removes the `scope` property from the authorization
code flow, as it is not expected there.
Reference: https://github.com/discord/discord-api-docs/commit/57965033ab4216a0bb853e85d6912531cd5a9981
- **Gateway:** This removes `guild_subscriptions`, as it has been
deprecated in favor of `intents`.
Reference: https://github.com/discord/discord-api-docs/commit/8de017436d37e56fab14cb8f68f0448a45ebc731
- **Oauth2Scopes:** This removes the `rpc.api` scope, as it has been removed
from the documentation.
Reference: https://github.com/discord/discord-api-docs/commit/2641d9808f676e7316483d152cdb37ed1168f968
- **APIMessage:** This removes the `APIMessageApplication` interface, as it has
been removed from the documentation, being replaced with the OAuth2 application.
Reference: https://github.com/discord/discord-api-docs/commit/ff0c831e424f1bc17dd3cde62da48d5c3d933e88
- **APIApplication:** This renames the `GatewayPresenceLimit` flag to
`GatewayPresenceLimited`, for consistency with `GatewayGuildMembersLimited`
and the documented name.
Reference: https://github.com/discord/discord-api-docs/commit/39b254bed1cc396c475e508a3f2bf328815605c9
- **GatewayVoiceServerUpdateDispatchData:** Any code that expects `endpoint` to never be null needs
to be updated, and the conditions specified in the documentation need
to be respected regarding that.
Reference: https://github.com/discord/discord-api-docs/commit/e887382fafd4c4417f7ba62963984f25bcb643f6
- **Invites:** This renames `target_user_type` to `target_type`,
the actual value the API expects.
Reference: https://github.com/discord/discord-api-docs/commit/1b4e363e324eb1f49a47e32cb0108fbe276c8e0e
- **GatewayPresenceUpdateData:** Clearing `activities` is done by setting them to an empty
array, not by setting them to `null`.
Reference: https://github.com/discord/discord-api-docs/commit/5bf598b864fb89262fce07137f68ce6e7e583432
- **UserFlags:** This removes a flag that bots should not use, as Discord
said this is an internal flag.
Reference: https://github.com/discord/discord-api-docs/commit/9293f0d490ac6acf9d627e429e5a8131b303b528
- **Integrations:** This removes the 3 routes that bots can no longer access.
Reference: https://github.com/discord/discord-api-docs/commit/efe4e5808b6826d40302e265a5ae9b5b65d92fe7
- **Exports:** Certain objects from this file have been moved to their
appropriate spot (such as JSON Error Codes)
- Files have been moved around in order to keep them
organized. Exports might also be missing, so please report if that is the
case.
## [0.13.3](https://github.com/discordjs/discord-api-types/compare/0.13.2...0.13.3) (2021-03-28)
## [0.13.2](https://github.com/discordjs/discord-api-types/compare/0.13.1...0.13.2) (2021-03-28)
### Bug Fixes
- **ApplicationCommandInteractionDataOptionSubCommandGroup:** typo ([#102](https://github.com/discordjs/discord-api-types/issues/102)) ([15c171c](https://github.com/discordjs/discord-api-types/commit/15c171c558a10cd6d1c4880e725af0e63dd82255))
## [0.13.1](https://github.com/discordjs/discord-api-types/compare/0.13.0...0.13.1) (2021-03-27)
### Bug Fixes
- **APIInteractionResponse:** `data` should not always be present ([#100](https://github.com/discordjs/discord-api-types/issues/100)) ([ffcd95d](https://github.com/discordjs/discord-api-types/commit/ffcd95d597a5d1c5b3ea072cd1dfb44f079de4b7))
# [0.13.0](https://github.com/discordjs/discord-api-types/compare/0.12.1...0.13.0) (2021-03-27)
### Bug Fixes
- **deno:** replace `const enum` exports in deno with normal `enum`s ([#89](https://github.com/discordjs/discord-api-types/issues/89)) ([7343fab](https://github.com/discordjs/discord-api-types/commit/7343fabe82e4321808bac784aed600afa8cf4249))
- **RESTPostAPIChannelMessageJSONBody:** mark `tts` as a full boolean ([#96](https://github.com/discordjs/discord-api-types/issues/96)) ([9d8d090](https://github.com/discordjs/discord-api-types/commit/9d8d090c9c6cd5be1f7b578b2f6a6387544f3359))
- **RESTPostAPIGuildsJSONBody:** make some fields nullable ([#91](https://github.com/discordjs/discord-api-types/issues/91)) ([ae1900d](https://github.com/discordjs/discord-api-types/commit/ae1900dc2f65065153b1bf2437348e63b63db49e))
### Features
- **APIApplication:** add ApplicationFlags ([#92](https://github.com/discordjs/discord-api-types/issues/92)) ([92f76f1](https://github.com/discordjs/discord-api-types/commit/92f76f1a3c8acf80689b994e9bfaec70d198aaa1))
- **APIApplicationCommandInteractionData:** add `resolved` ([#86](https://github.com/discordjs/discord-api-types/issues/86)) ([24155ae](https://github.com/discordjs/discord-api-types/commit/24155aeb71d46de48353ce01bfb48e197a84e59b))
- **APIBaseInteraction:** add application_id ([#98](https://github.com/discordjs/discord-api-types/issues/98)) ([0582f88](https://github.com/discordjs/discord-api-types/commit/0582f883c517e5fdc2373ac0a85717a7bfeec018))
- **APIInteraction:** DM slash commands and property descriptions ([#84](https://github.com/discordjs/discord-api-types/issues/84)) ([d0b3106](https://github.com/discordjs/discord-api-types/commit/d0b310675848f4724e47c490b06d828f7ede204c))
- **APIInteractionResponse, APIInteractionResponseType:** update for UI changes ([#90](https://github.com/discordjs/discord-api-types/issues/90)) ([eafe7ba](https://github.com/discordjs/discord-api-types/commit/eafe7ba96fc6e771579850a8a7de36adade8efdc))
- **APIMessage:** add `interaction` ([#93](https://github.com/discordjs/discord-api-types/issues/93)) ([0f29b32](https://github.com/discordjs/discord-api-types/commit/0f29b32e05abe89f70f72989024b9c63493782fa))
- **APIMessageReferenceSend:** add `fail_if_not_exists` ([#82](https://github.com/discordjs/discord-api-types/issues/82)) ([855f36d](https://github.com/discordjs/discord-api-types/commit/855f36d9309ae69f57da723648d3791e3134089e))
- **PermissionFlagsBits:** add `USE_APPLICATION_COMMANDS` ([#85](https://github.com/discordjs/discord-api-types/issues/85)) ([ceb787b](https://github.com/discordjs/discord-api-types/commit/ceb787ba36ed05f25f9acab86496d3054cb15013))
- **rest:** api base routes ([#87](https://github.com/discordjs/discord-api-types/issues/87)) ([466fa95](https://github.com/discordjs/discord-api-types/commit/466fa95b0e239b7984275959886b995a5020640a))
- add Application Command events ([#75](https://github.com/discordjs/discord-api-types/issues/75)) ([da2c2e9](https://github.com/discordjs/discord-api-types/commit/da2c2e9ada39482fce095c47339b40d6c24e683a))
- add GET single Application Command ([#76](https://github.com/discordjs/discord-api-types/issues/76)) ([5826da2](https://github.com/discordjs/discord-api-types/commit/5826da22e30839b1f9fcd73479f8bc0f213001bd))
- implement FormatPatterns ([#79](https://github.com/discordjs/discord-api-types/issues/79)) ([4e4a084](https://github.com/discordjs/discord-api-types/commit/4e4a0840036eddb89a1d49d69f59905dba206afb))
- **OAuth2:** add `/oauth2/[@me](https://github.com/me)` route ([#73](https://github.com/discordjs/discord-api-types/issues/73)) ([84759d1](https://github.com/discordjs/discord-api-types/commit/84759d19bc4cd0f33f0a94608c1af2b4d6a820c6))
- **Webhook:** add Edit Webhook Message result and error 50027 ([#71](https://github.com/discordjs/discord-api-types/issues/71)) ([4c77a5d](https://github.com/discordjs/discord-api-types/commit/4c77a5d90acf627574eff571a92a6703c6ea2d13))
## [0.12.1](https://github.com/discordjs/discord-api-types/compare/0.12.0...0.12.1) (2021-01-05)
### Bug Fixes
- run deno workflow only on branch push ([#66](https://github.com/discordjs/discord-api-types/issues/66)) ([0ef4620](https://github.com/discordjs/discord-api-types/commit/0ef46202f6c8c257e6300e634b675e7e1b6ffa90))
### Features
- add Snowflake and Permissions types ([#69](https://github.com/discordjs/discord-api-types/issues/69)) ([549a6f0](https://github.com/discordjs/discord-api-types/commit/549a6f023698f05829f1dfdf1190c027a994d6cd))
# [0.12.0](https://github.com/discordjs/discord-api-types/compare/0.11.2...0.12.0) (2021-01-01)
### Bug Fixes
- **APIApplication:** flags should be omitted in REST, not optional everywhere ([#57](https://github.com/discordjs/discord-api-types/issues/57)) ([664ad80](https://github.com/discordjs/discord-api-types/commit/664ad800ccdfb84cc1547dd151c0f6e16157e04b))
- **RESTPatchAPIChannelJSONBody:** add missing bitrate field ([#60](https://github.com/discordjs/discord-api-types/issues/60)) ([15892ec](https://github.com/discordjs/discord-api-types/commit/15892ec870ff818d7f66bd9b57969638e5f17e1f))
### Features
- **GatewayActivity:** add missing fields ([#39](https://github.com/discordjs/discord-api-types/issues/39)) ([dccdfe0](https://github.com/discordjs/discord-api-types/commit/dccdfe044fb4c02b6cfc910e2d39e469ebd9c75a))
## [0.11.2](https://github.com/discordjs/discord-api-types/compare/0.11.1...0.11.2) (2020-12-20)
## [0.11.1](https://github.com/discordjs/discord-api-types/compare/0.11.0...0.11.1) (2020-12-19)
### Bug Fixes
- **APIAuditLogEntry:** user_id is not nullable ([#52](https://github.com/discordjs/discord-api-types/issues/52)) ([2b89beb](https://github.com/discordjs/discord-api-types/commit/2b89beb52b66a4865124b75069ca6bc3d5886c48))
- **RESTPostAPIGuildsJSONBody:** system_channel_flags is optional ([#53](https://github.com/discordjs/discord-api-types/issues/53)) ([ba4c0d7](https://github.com/discordjs/discord-api-types/commit/ba4c0d78f4ba3755f524b5f63420a36580a1a08e))
# [0.11.0](https://github.com/discordjs/discord-api-types/compare/0.10.0...0.11.0) (2020-12-19)
### Bug Fixes
- **APIGuildMember:** drop nullability of `pending` prop ([#49](https://github.com/discordjs/discord-api-types/issues/49)) ([c2f0dee](https://github.com/discordjs/discord-api-types/commit/c2f0deeebd28fa3a09f795d1b263ff8fd5d9ae4d))
- **RESTPatchAPIGuildJSONBody:** multiple properties are actually nullable ([#48](https://github.com/discordjs/discord-api-types/issues/48)) ([018fc4f](https://github.com/discordjs/discord-api-types/commit/018fc4f8ea4d50f719820001822778079a055fa3))
# [0.10.0](https://github.com/discordjs/discord-api-types/compare/0.9.1...0.10.0) (2020-12-09)
### Features
- server templates ([#25](https://github.com/discordjs/discord-api-types/issues/25)) ([7d873f7](https://github.com/discordjs/discord-api-types/commit/7d873f73c7a8c64630c57d3eaf33d8c4913ed835))
## [0.9.1](https://github.com/discordjs/discord-api-types/compare/0.9.0...0.9.1) (2020-11-22)
# [0.9.0](https://github.com/discordjs/discord-api-types/compare/0.8.0...0.9.0) (2020-11-22)
### Features
- **Message:** reply updates ([#34](https://github.com/discordjs/discord-api-types/issues/34)) ([21b9ae4](https://github.com/discordjs/discord-api-types/commit/21b9ae4aaf29c276d1a6ccc4c79ace8d64a53e9d))
- **Message:** Stickers ([#32](https://github.com/discordjs/discord-api-types/issues/32)) ([39ea1f4](https://github.com/discordjs/discord-api-types/commit/39ea1f4429e5194576200635f885ab102763060b))
# [0.8.0](https://github.com/discordjs/discord-api-types/compare/0.7.0...0.8.0) (2020-11-03)
### Bug Fixes
- webhookPlatform route ([#36](https://github.com/discordjs/discord-api-types/issues/36)) ([666a0c7](https://github.com/discordjs/discord-api-types/commit/666a0c71528e385677570b5359ba266276202a95))
- **GatewayPresence:** correct type for sent activity objects ([#30](https://github.com/discordjs/discord-api-types/issues/30)) ([61db1ee](https://github.com/discordjs/discord-api-types/commit/61db1eee256037588ef27533c234cb01f1f699a4))
# [0.7.0](https://github.com/discordjs/discord-api-types/compare/0.6.0...0.7.0) (2020-10-18)
### Bug Fixes
- **GatewayHeartbeat:** d is nullable ([#26](https://github.com/discordjs/discord-api-types/issues/26)) ([0982610](https://github.com/discordjs/discord-api-types/commit/098261073163eeb4fcfc217dea3511ccea1f27c5))
- **GatewayIdentify:** use correct presence interface ([#28](https://github.com/discordjs/discord-api-types/issues/28)) ([91c63f0](https://github.com/discordjs/discord-api-types/commit/91c63f05ca1e8e92c4c1df124365405fe8d34108))
### Features
- **APIGuildWidgetMember:** add activity and use proper status type ([#24](https://github.com/discordjs/discord-api-types/issues/24)) ([f058ed6](https://github.com/discordjs/discord-api-types/commit/f058ed6aa1f7593c22e4a3f0c9dd2f4bbd0190dc))
# [0.6.0](https://github.com/discordjs/discord-api-types/compare/0.5.0...0.6.0) (2020-10-04)
### Bug Fixes
- **APIChannel:** position is optional ([#21](https://github.com/discordjs/discord-api-types/issues/21)) ([061a147](https://github.com/discordjs/discord-api-types/commit/061a147fbb381738b28ca3fb73fa1a7be0e1b108))
- **RESTPostAPIGuildsJSONBody:** use correct types ([#22](https://github.com/discordjs/discord-api-types/issues/22)) ([dcf8ddf](https://github.com/discordjs/discord-api-types/commit/dcf8ddf25b26a9c72dbb1b5712503e6d5e516ad1))
### Features
- v8 support ([#14](https://github.com/discordjs/discord-api-types/issues/14)) ([11b95c8](https://github.com/discordjs/discord-api-types/commit/11b95c86099e609128a8ca76d06d43498fae72f5))
# [0.5.0](https://github.com/discordjs/discord-api-types/compare/0.4.1...0.5.0) (2020-09-19)
### Bug Fixes
- correct typos ([#18](https://github.com/discordjs/discord-api-types/issues/18)) ([97c7b4e](https://github.com/discordjs/discord-api-types/commit/97c7b4ea24852f49b5f952e81a0e6f21ed405316))
- **APIUser:** premium_type is optional ([#19](https://github.com/discordjs/discord-api-types/issues/19)) ([8cf1ba3](https://github.com/discordjs/discord-api-types/commit/8cf1ba3f4f3c28f962afad4bfcc02f5bb897286a))
- **GatewayIdentifyProperties:** rename `device` to `$device` ([#17](https://github.com/discordjs/discord-api-types/issues/17)) ([9e5c5b5](https://github.com/discordjs/discord-api-types/commit/9e5c5b5aac30e931255f39790123b4bd3458a16f))
## [0.4.1](https://github.com/discordjs/discord-api-types/compare/0.4.0...0.4.1) (2020-09-18)
### Features
- add oauth2 types ([#16](https://github.com/discordjs/discord-api-types/issues/16)) ([10fdeba](https://github.com/discordjs/discord-api-types/commit/10fdeba1286e385e087d6c9405872f948507f183))
# [0.4.0](https://github.com/discordjs/discord-api-types/compare/0.3.0...0.4.0) (2020-09-16)
### Features
- **ActivityType:** add Competing activity type ([#11](https://github.com/discordjs/discord-api-types/issues/11)) ([94d0a16](https://github.com/discordjs/discord-api-types/commit/94d0a1680532412c8d5f9659056f87a37d1def7d))
# [0.3.0](https://github.com/discordjs/discord-api-types/compare/v0.2.0...0.3.0) (2020-09-14)
### Bug Fixes
- **APIMessage:** Correct APIMessage#mentions type ([#9](https://github.com/discordjs/discord-api-types/issues/9)) ([fe1868b](https://github.com/discordjs/discord-api-types/commit/fe1868b04f8a9f4be1c09ffba0afa60f4def8595))
# [0.2.0](https://github.com/discordjs/discord-api-types/compare/v0.1.1...v0.2.0) (2020-09-10)
### Bug Fixes
- **Readme:** add missing semicolon ([#1](https://github.com/discordjs/discord-api-types/issues/1)) ([5e3e101](https://github.com/discordjs/discord-api-types/commit/5e3e1016b5fe274d33503d36771fc276fd384ccf))
## [0.1.1](https://github.com/discordjs/discord-api-types/compare/767a833a12a8268b9f1b780f338da6f28cefa5cd...v0.1.1) (2020-08-22)
### Bug Fixes
- set target version to ES2020 ([767a833](https://github.com/discordjs/discord-api-types/commit/767a833a12a8268b9f1b780f338da6f28cefa5cd))

View File

@@ -19,23 +19,48 @@ yarn add discord-api-types
pnpm add 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
```js
const { APIUser } = require('discord-api-types/v8');
```
```ts
// TypeScript/ES Module support
import { APIUser } from 'discord-api-types/v8';
```
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 are some examples
```js
const { GatewayVersion } = require('discord-api-types/gateway/v8');
```
```ts
// TypeScript/ES Module support
import { GatewayVersion } from 'discord-api-types/gateway/v8';
```
> _**Note:** The `v*` exports (`discord-api-type/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. You have 3 ways you can import them:
1. Directly from GitHub
```ts
// Importing the default API version
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/mod.ts';
// Importing a specific API version
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/v8/mod.ts';
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/v8.ts';
```
2. From [deno.land/x](https://deno.land/x)
```ts
// Importing a specific API version
import { APIUser } from 'https://deno.land/x/discord_api_types/v8/mod.ts';
import { APIUser } from 'https://deno.land/x/discord_api_types/v8.ts';
```
3. From [skypack.dev](https://www.skypack.dev/)
@@ -67,21 +92,6 @@ The exports of each API version is split into three main parts:
- 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 `common` directory. They will still be prefixed accordingly as described above.
- 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.
**Warning**: This package documents just KNOWN (and documented) properties. Anything that isn't documented will NOT be added to this package (unless said properties are in an open Pull Request to Discord's [API Documentation repository](https://github.com/discord/discord-api-docs) or known through other means _and have received the green light to be used_). For clarification's sake, this means that properties that are only known through the process of data mining and have not yet been confirmed in a way as described will NOT be included.
## Usage
You can `require` / `import` the module directly, which will give you the latest types as of the current API version. This is considered the `default` version and will be updated according to Discord's default API version; this means it may break at any point in time.
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
```js
const { APIUser } = require('discord-api-types/v8');
```
```ts
// TypeScript/ES Module support
import { APIUser } from 'discord-api-types/v8';
```
**Warning**: This package documents just KNOWN (and documented) properties. Anything that isn't documented will NOT be added to this package (unless said properties are in an open Pull Request to Discord's [API Documentation repository](https://github.com/discord/discord-api-docs) or known through other means _and have received the green light to be used_). For clarification's sake, this means that properties that are only known through the process of data mining and have not yet been confirmed in a way as described will **NOT** be included.

View File

@@ -1,226 +0,0 @@
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#json-json-error-codes
*/
export const enum RESTJSONErrorCodes {
GeneralError,
UnknownAccount = 10001,
UnknownApplication,
UnknownChannel,
UnknownGuild,
UnknownIntegration,
UnknownInvite,
UnknownMember,
UnknownMessage,
UnknownPermissionOverwrite,
UnknownProvider,
UnknownRole,
UnknownToken,
UnknownUser,
UnknownEmoji,
UnknownWebhook,
UnknownBan = 10026,
UnknownSKU,
UnknownStoreListing,
UnknownEntitlement,
UnknownBuild,
UnknownLobby,
UnknownBranch,
UnknownRedistributable = 10036,
UnknownGuildTemplate = 10057,
UnknownApplicationCommand = 10063,
BotsCannotUseThisEndpoint = 20001,
OnlyBotsCanUseThisEndpoint,
AnnouncementEditLimitExceeded = 20022,
ChannelSendRateLimit = 20028,
MaximumNumberOfGuildsReached = 30001,
MaximumNumberOfFriendsReached,
MaximumNumberOfPinsReachedForTheChannel,
MaximumNumberOfGuildRolesReached = 30005,
MaximumNumberOfWebhooksReached = 30007,
MaximumNumberOfReactionsReached = 30010,
MaximumNumberOfGuildChannelsReached = 30013,
MaximumNumberOfAttachmentsInAMessageReached = 30015,
MaximumNumberOfInvitesReached,
GuildAlreadyHasTemplate = 30031,
Unauthorized = 40001,
VerifyYourAccount,
RequestEntityTooLarge = 40005,
FeatureTemporarilyDisabledServerSide,
UserBannedFromThisGuild,
ThisMessageWasAlreadyCrossposted = 40033,
MissingAccess = 50001,
InvalidAccountType,
CannotExecuteActionOnDMChannel,
GuildWidgetDisabled,
CannotEditMessageAuthoredByAnotherUser,
CannotSendAnEmptyMessage,
CannotSendMessagesToThisUser,
CannotSendMessagesInVoiceChannel,
ChannelVerificationLevelTooHighForYouToGainAccess,
Oauth2ApplicationDoesNotHaveBot,
Oauth2ApplicationLimitReached,
InvalidOauth2State,
MissingPermissions,
InvalidToken,
NoteWasTooLong,
ProvidedTooFewOrTooManyMessagesToDelete,
MessageCanOnlyBePinnedInTheChannelItWasSentIn = 50019,
InviteCodeInvalidOrTaken,
CannotExecuteActionOnSystemMessage,
CannotExecuteActionOnThisChannelType = 50024,
InvalidOauth2AccessToken,
InvalidWebhookToken = 50027,
InvalidRecipients = 50033,
OneOfTheMessagesProvidedWasTooOldForBulkDelete,
InvalidFormBodyOrContentType,
InviteAcceptedToGuildWithoutTheBotBeingIn,
InvalidAPIVersion = 50041,
CannotDeleteChannelRequiredForCommunityGuilds = 50074,
InvalidStickerSent = 50081,
TwoFactorAuthenticationIsRequired = 60003,
ReactionWasBlocked = 90001,
APIResourceOverloaded = 130000,
}
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-error-codes
*/
export const enum RPCErrorCodes {
UnknownError = 1000,
InvalidPayload = 4000,
InvalidCommand = 4002,
InvalidGuild,
InvalidEvent,
InvalidChannel,
InvalidPermissions,
InvalidClientID,
InvalidOrigin,
InvalidToken,
InvalidUser,
OAuth2Error = 5000,
SelectChannelTimedOut,
GetGuildTimedOut,
SelectVoiceForceRequired,
CaptureShortcutAlreadyListening,
}
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-close-event-codes
*/
export const enum RPCCloseEventCodes {
InvalidClientID = 4000,
InvalidOrigin,
RateLimited,
TokenRevoked,
InvalidVersion,
InvalidEncoding,
}
/**
* https://discord.com/developers/docs/topics/gateway#connecting-gateway-url-params
*/
export interface GatewayConnectQuery {
v: string;
encoding: 'json' | 'etf';
compress?: 'zlib-stream';
}
/**
* https://discord.com/developers/docs/reference#snowflakes
*/
export type Snowflake = `${bigint}`;
/**
* https://discord.com/developers/docs/topics/permissions
* @internal
*/
export type Permissions = `${bigint}`;
/**
* https://discord.com/developers/docs/reference#message-formatting-formats
*/
export const FormattingPatterns = {
/**
* Regular expression for matching a user mention, strictly without a nickname
*
* The `id` group property is present on the `exec` result of this expression
*/
User: /<@(?<id>\d{17,20})>/,
/**
* Regular expression for matching a user mention, strictly with a nickname
*
* The `id` group property is present on the `exec` result of this expression
*/
UserWithNickname: /<@!(?<id>\d{17,20})>/,
/**
* Regular expression for matching a user mention, with or without a nickname
*
* The `id` group property is present on the `exec` result of this expression
*/
UserWithOptionalNickname: /<@!?(?<id>\d{17,20})>/,
/**
* Regular expression for matching a channel mention
*
* The `id` group property is present on the `exec` result of this expression
*/
Channel: /<#(?<id>\d{17,20})>/,
/**
* Regular expression for matching a role mention
*
* The `id` group property is present on the `exec` result of this expression
*/
Role: /<@&(?<id>\d{17,20})>/,
/**
* Regular expression for matching a custom emoji, either static or animated
*
* The `animated`, `name` and `id` group properties are present on the `exec` result of this expression
*/
Emoji: /<(?<animated>a)?:(?<name>\w{2,32}):(?<id>\d{17,20})>/,
/**
* Regular expression for matching strictly an animated custom emoji
*
* The `animated`, `name` and `id` group properties are present on the `exec` result of this expression
*/
AnimatedEmoji: /<(?<animated>a):(?<name>\w{2,32}):(?<id>\d{17,20})>/,
/**
* Regular expression for matching strictly a static custom emoji
*
* The `name` and `id` group properties are present on the `exec` result of this expression
*/
StaticEmoji: /<:(?<name>\w{2,32}):(?<id>\d{17,20})>/,
} as const;
/**
* Freezes the formatting patterns
* @internal
*/
Object.freeze(FormattingPatterns);

View File

@@ -1,4 +0,0 @@
// This file exports all the types available in the default API version
// Thereby, things MAY break in the future
export * from '../v8/index';

342
deno/CHANGELOG.md Normal file
View File

@@ -0,0 +1,342 @@
# [0.17.0](https://github.com/discordjs/discord-api-types/compare/0.16.0...0.17.0) (2021-04-17)
### Bug Fixes
- **APIChannel:** `rtc_region` is optional ([#118](https://github.com/discordjs/discord-api-types/issues/118)) ([617f507](https://github.com/discordjs/discord-api-types/commit/617f507427fae6456de228a23809ab04c1df13f6))
### Code Refactoring
- **APISticker:** remove `preview_asset` ([#119](https://github.com/discordjs/discord-api-types/issues/119)) ([9817623](https://github.com/discordjs/discord-api-types/commit/9817623291ec852a831c3de225e90a65d83dac7f))
### Features
- **WebhookMessage:** add `GET` route types ([#120](https://github.com/discordjs/discord-api-types/issues/120)) ([3294fb1](https://github.com/discordjs/discord-api-types/commit/3294fb15ae6c259c1b53b7f2eca4ea8dca2f2372))
### BREAKING CHANGES
- **APISticker:** This removes the `preview_asset` property from sticket objects
- Reference: https://github.com/discord/discord-api-docs/commit/b9b8db2
- **APIChannel:** This corrects the fact that `rtc_region` isn't present on non-voice-like channels
# [0.16.0](https://github.com/discordjs/discord-api-types/compare/0.15.1...0.16.0) (2021-04-14)
### Features
- **Guild:** add `nsfw` property ([#116](https://github.com/discordjs/discord-api-types/issues/116)) ([21b572b](https://github.com/discordjs/discord-api-types/commit/21b572b7f25a320e40f8ca2e63d6bd8b111403aa))
- **RESTJSONErrorCode:** add `UnknownInteraction` error code ([#115](https://github.com/discordjs/discord-api-types/issues/115)) ([ced37d0](https://github.com/discordjs/discord-api-types/commit/ced37d0a5ebdc80887662529922c57e2531e1e5b))
### docs
- **Routes:** add `GET` routes to `webhookMessages` ([#114](https://github.com/discordjs/discord-api-types/issues/114)) ([6451679](https://github.com/discordjs/discord-api-types/commit/6451679c9acb9d7fde593914452577669473841d))
### BREAKING CHANGES
- **Routes:** possibly a breaking change due to the fact that the messageID is now strictly typed as a Snowflake or `@me`
- Reference: discord/discord-api-docs#2410
## [0.15.1](https://github.com/discordjs/discord-api-types/compare/0.15.0...0.15.1) (2021-04-12)
### Bug Fixes
- **TypeScript:** imports not working in TypeScript ([4738c33](https://github.com/discordjs/discord-api-types/commit/4738c33b062d359a1c2fbb35cdd2daf128ab6e5b))
# [0.15.0](https://github.com/discordjs/discord-api-types/compare/0.14.0...0.15.0) (2021-04-11)
### Bug Fixes
- **APIApplicationCommand:** default_permission ([#111](https://github.com/discordjs/discord-api-types/issues/111)) ([9420c3e](https://github.com/discordjs/discord-api-types/commit/9420c3e0af7b2486f0e49bb680ed98e0d9f5c625))
- **Scripts:** `await` in `versions` script, log any errors from deno one ([9113eb1](https://github.com/discordjs/discord-api-types/commit/9113eb133c4627445e2bcd4583c243dde74a20ee))
### BREAKING CHANGES
- **APIApplicationCommand:** This renames the `default_permissions` property to `default_permission`, the correct spelling.
# [0.14.0](https://github.com/discordjs/discord-api-types/compare/0.13.3...0.14.0) (2021-04-11)
### Bug Fixes
- **APIMessage:** correct type for `application` ([ed2cbe8](https://github.com/discordjs/discord-api-types/commit/ed2cbe82c56f872ee01a9eb6991ef70dc22d8c1f))
- **GatewayGuildMemberUpdateDispatchData:** correct types ([14f14e2](https://github.com/discordjs/discord-api-types/commit/14f14e227955af41ed2823f11c6e8d03d12549ba))
- **GatewayPresenceUpdateData:** `activities` may not be `null` ([bb3cb04](https://github.com/discordjs/discord-api-types/commit/bb3cb04e016840f66eecbe39c2e07aea8ea12bc8))
- **GatewayVoiceServerUpdateDispatchData:** `endpoint` is nullable ([e8203a1](https://github.com/discordjs/discord-api-types/commit/e8203a1112a834ce9aaae4ab95f711d3aaffc20f))
- **GuildWelcomeScreenChannel:** document missing `description` property ([238695b](https://github.com/discordjs/discord-api-types/commit/238695b44d8547d51782e3d9d9729e2db85bc444))
- **OAuth2:** `scope` can be optional / not required ([bbe56a9](https://github.com/discordjs/discord-api-types/commit/bbe56a97564ce8c317f291080327484f0d987e1c))
- **OAuth2:** remove invalid parameters from refresh token request ([1c02450](https://github.com/discordjs/discord-api-types/commit/1c024507f3f55b922565845c2bedac615ffa24d5))
- **RPC:** version `RPC` same as` rest`, export again in `shortcuts` ([67e0ba1](https://github.com/discordjs/discord-api-types/commit/67e0ba1834e6d9de9ad00bd452f5e8da59ff1cc6))
- **Utils:** correct import for deno users ([42dd75f](https://github.com/discordjs/discord-api-types/commit/42dd75f2581b2a8862e4f0446b42ff838f923de0))
### chore
- **Gateway:** remove `guild_subscriptions` ([ab8b289](https://github.com/discordjs/discord-api-types/commit/ab8b289ac8f99fe1a998ef06320ad9046aafa1d2))
- **GatewayReady:** un-document `private_channels` ([457edf4](https://github.com/discordjs/discord-api-types/commit/457edf4ed43327fb871d3b1638745b905518ef91))
- **Integrations:** remove routes that bots can no longer interact with ([577c5bd](https://github.com/discordjs/discord-api-types/commit/577c5bd040dd1dc258ca6c414cf6ac69ae84916c))
- **MessageGetReactions:** remove `before` pagination ([0ec26b7](https://github.com/discordjs/discord-api-types/commit/0ec26b731cda570f34e59e05a8c21f272b1fd64e))
- **Oauth2Scopes:** remove `rpc.api` ([7ee8511](https://github.com/discordjs/discord-api-types/commit/7ee85113ea8107106460889a2eaa42b251ee05d0))
- **Permissions:** rename `USE_APPLICATION_COMMANDS` to `USE_SLASH_COMMANDS` ([2aa7f7a](https://github.com/discordjs/discord-api-types/commit/2aa7f7a7b8da3d4d46a7743830562d996d32120b))
- **UserFlags:** un-document `SYSTEM` flag ([1774d4c](https://github.com/discordjs/discord-api-types/commit/1774d4c4749d303f24bfb3c754cf79a4ca7ef699))
### Code Refactoring
- restructure module ([81cdfc2](https://github.com/discordjs/discord-api-types/commit/81cdfc2d9c523d98edd0a69f976879e848e1167b))
### Features
- **APIApplication:** document `terms_of_service` and `privacy_policy` ([598cbfb](https://github.com/discordjs/discord-api-types/commit/598cbfb958a67d5ba61696ba877ea0bae4c4be55))
- **APIAttachment:** add `content_type` ([2d432d1](https://github.com/discordjs/discord-api-types/commit/2d432d145eb8a009b092b27b6231252d7b2f2823))
- **APIChannel:** add `rtc_region` ([#108](https://github.com/discordjs/discord-api-types/issues/108)) ([07ba907](https://github.com/discordjs/discord-api-types/commit/07ba9072429dec85a13479dc211ec1f9d8788acf))
- **APIChannel:** add `video_quality_mode` ([#106](https://github.com/discordjs/discord-api-types/issues/106)) ([d8d7bcc](https://github.com/discordjs/discord-api-types/commit/d8d7bccea617ad0d1150b9d2aed3b26ec1e4f99a))
- **APIInteraction:** add type-check utilities ([3307201](https://github.com/discordjs/discord-api-types/commit/33072011c2ea9ace8350dedc0cd1068660dc2ece))
- **Exports:** add `globals` to the exported sub-modules ([5d35f61](https://github.com/discordjs/discord-api-types/commit/5d35f61334480af983c4767373ef05e395da2e18))
- **Gateway:** add `INTEGRATION_*` events ([9c3fab0](https://github.com/discordjs/discord-api-types/commit/9c3fab052619609eb543ff400c2b813b69c6b99f))
- **GuildWelcomeScreen:** document `welcome-screen` endpoint ([169ecde](https://github.com/discordjs/discord-api-types/commit/169ecde47a6a911309630e952ab26b805ac87cf0))
- **Interactions:** add batch command create / update ([edfe70a](https://github.com/discordjs/discord-api-types/commit/edfe70a1eeec9be1104ec68a20d95e83512b3268))
- **Interactions:** add Slash Command Permissions ([f517f35](https://github.com/discordjs/discord-api-types/commit/f517f3596f458a2c2e4c4a26d5c13bbed4c4a71f))
- **Invites:** document `target_application` & correct property names ([97c8ab3](https://github.com/discordjs/discord-api-types/commit/97c8ab3f5165c6f161e9338e944cff8b296756d5))
- **MessageFlags:** `EPHEMERAL` desc and added `LOADING` ([#109](https://github.com/discordjs/discord-api-types/issues/109)) ([4462255](https://github.com/discordjs/discord-api-types/commit/4462255168af2ad66c9c7405500e80d3fa41de33))
- **PatchAPIWebhookMessage:** add `file` property ([fc2f3c5](https://github.com/discordjs/discord-api-types/commit/fc2f3c58cf5ea2a8c0a1a14a62a16f432b1776e2))
- **Webhook:** add & document `url` property ([77e5bb6](https://github.com/discordjs/discord-api-types/commit/77e5bb624d86e4bc8696c8dac4f513c27eb8aff1))
- invite reminder system message type and flag ([#105](https://github.com/discordjs/discord-api-types/issues/105)) ([b90714f](https://github.com/discordjs/discord-api-types/commit/b90714f677c67c009ddb6d00734ab8998c194350))
- stage channels! ([#107](https://github.com/discordjs/discord-api-types/issues/107)) ([6cd7542](https://github.com/discordjs/discord-api-types/commit/6cd75426c6d7da145b40a656e4c1a1d3d26bfb1f))
### BREAKING CHANGES
- **APIInteraction:** This commit removes the `guild_id` property from `APIDMInteraction`
which allows type-checks to work with the `in` operator.
Because of that, we also provide utility functions that help with those type checks.
Use them in your code by importing the `Utils` object, or by directly importing them.
Check the README for examples
- **OAuth2:** This commit removes parameters that are not expected
in the refresh token request body
Reference: https://github.com/discord/discord-api-docs/commit/eaa12cbc8f96cf7cfe8c530f88e60582c24ca5dd
- **GatewayReady:** This property has been deprecated for a while, and was
returning an empty array for bot users. This commit removes it entirely
Reference: https://github.com/discord/discord-api-docs/commit/f36156dbb641f5c4d4f4593f345bfd6e27fdee08
- **Permissions:** This commit brings consistency with the documentation,
where the permission is documented as `USE_SLASH_COMMANDS`, whereas the
client has it as `USE_APPLICATION_COMMANDS` internally
Reference: https://github.com/discord/discord-api-docs/commit/c7d25885c5cd80a49b31609a40b70603b35f9dec
- **MessageGetReactions:** This query parameter is not usable and was not respected
by the API.
Reference: https://github.com/discord/discord-api-docs/commit/f72b084773d4d3989fb19be4fb4d9cf276a1e6b3
- **OAuth2:** This removes the `scope` property from the authorization
code flow, as it is not expected there.
Reference: https://github.com/discord/discord-api-docs/commit/57965033ab4216a0bb853e85d6912531cd5a9981
- **Gateway:** This removes `guild_subscriptions`, as it has been
deprecated in favor of `intents`.
Reference: https://github.com/discord/discord-api-docs/commit/8de017436d37e56fab14cb8f68f0448a45ebc731
- **Oauth2Scopes:** This removes the `rpc.api` scope, as it has been removed
from the documentation.
Reference: https://github.com/discord/discord-api-docs/commit/2641d9808f676e7316483d152cdb37ed1168f968
- **APIMessage:** This removes the `APIMessageApplication` interface, as it has
been removed from the documentation, being replaced with the OAuth2 application.
Reference: https://github.com/discord/discord-api-docs/commit/ff0c831e424f1bc17dd3cde62da48d5c3d933e88
- **APIApplication:** This renames the `GatewayPresenceLimit` flag to
`GatewayPresenceLimited`, for consistency with `GatewayGuildMembersLimited`
and the documented name.
Reference: https://github.com/discord/discord-api-docs/commit/39b254bed1cc396c475e508a3f2bf328815605c9
- **GatewayVoiceServerUpdateDispatchData:** Any code that expects `endpoint` to never be null needs
to be updated, and the conditions specified in the documentation need
to be respected regarding that.
Reference: https://github.com/discord/discord-api-docs/commit/e887382fafd4c4417f7ba62963984f25bcb643f6
- **Invites:** This renames `target_user_type` to `target_type`,
the actual value the API expects.
Reference: https://github.com/discord/discord-api-docs/commit/1b4e363e324eb1f49a47e32cb0108fbe276c8e0e
- **GatewayPresenceUpdateData:** Clearing `activities` is done by setting them to an empty
array, not by setting them to `null`.
Reference: https://github.com/discord/discord-api-docs/commit/5bf598b864fb89262fce07137f68ce6e7e583432
- **UserFlags:** This removes a flag that bots should not use, as Discord
said this is an internal flag.
Reference: https://github.com/discord/discord-api-docs/commit/9293f0d490ac6acf9d627e429e5a8131b303b528
- **Integrations:** This removes the 3 routes that bots can no longer access.
Reference: https://github.com/discord/discord-api-docs/commit/efe4e5808b6826d40302e265a5ae9b5b65d92fe7
- **Exports:** Certain objects from this file have been moved to their
appropriate spot (such as JSON Error Codes)
- Files have been moved around in order to keep them
organized. Exports might also be missing, so please report if that is the
case.
## [0.13.3](https://github.com/discordjs/discord-api-types/compare/0.13.2...0.13.3) (2021-03-28)
## [0.13.2](https://github.com/discordjs/discord-api-types/compare/0.13.1...0.13.2) (2021-03-28)
### Bug Fixes
- **ApplicationCommandInteractionDataOptionSubCommandGroup:** typo ([#102](https://github.com/discordjs/discord-api-types/issues/102)) ([15c171c](https://github.com/discordjs/discord-api-types/commit/15c171c558a10cd6d1c4880e725af0e63dd82255))
## [0.13.1](https://github.com/discordjs/discord-api-types/compare/0.13.0...0.13.1) (2021-03-27)
### Bug Fixes
- **APIInteractionResponse:** `data` should not always be present ([#100](https://github.com/discordjs/discord-api-types/issues/100)) ([ffcd95d](https://github.com/discordjs/discord-api-types/commit/ffcd95d597a5d1c5b3ea072cd1dfb44f079de4b7))
# [0.13.0](https://github.com/discordjs/discord-api-types/compare/0.12.1...0.13.0) (2021-03-27)
### Bug Fixes
- **deno:** replace `const enum` exports in deno with normal `enum`s ([#89](https://github.com/discordjs/discord-api-types/issues/89)) ([7343fab](https://github.com/discordjs/discord-api-types/commit/7343fabe82e4321808bac784aed600afa8cf4249))
- **RESTPostAPIChannelMessageJSONBody:** mark `tts` as a full boolean ([#96](https://github.com/discordjs/discord-api-types/issues/96)) ([9d8d090](https://github.com/discordjs/discord-api-types/commit/9d8d090c9c6cd5be1f7b578b2f6a6387544f3359))
- **RESTPostAPIGuildsJSONBody:** make some fields nullable ([#91](https://github.com/discordjs/discord-api-types/issues/91)) ([ae1900d](https://github.com/discordjs/discord-api-types/commit/ae1900dc2f65065153b1bf2437348e63b63db49e))
### Features
- **APIApplication:** add ApplicationFlags ([#92](https://github.com/discordjs/discord-api-types/issues/92)) ([92f76f1](https://github.com/discordjs/discord-api-types/commit/92f76f1a3c8acf80689b994e9bfaec70d198aaa1))
- **APIApplicationCommandInteractionData:** add `resolved` ([#86](https://github.com/discordjs/discord-api-types/issues/86)) ([24155ae](https://github.com/discordjs/discord-api-types/commit/24155aeb71d46de48353ce01bfb48e197a84e59b))
- **APIBaseInteraction:** add application_id ([#98](https://github.com/discordjs/discord-api-types/issues/98)) ([0582f88](https://github.com/discordjs/discord-api-types/commit/0582f883c517e5fdc2373ac0a85717a7bfeec018))
- **APIInteraction:** DM slash commands and property descriptions ([#84](https://github.com/discordjs/discord-api-types/issues/84)) ([d0b3106](https://github.com/discordjs/discord-api-types/commit/d0b310675848f4724e47c490b06d828f7ede204c))
- **APIInteractionResponse, APIInteractionResponseType:** update for UI changes ([#90](https://github.com/discordjs/discord-api-types/issues/90)) ([eafe7ba](https://github.com/discordjs/discord-api-types/commit/eafe7ba96fc6e771579850a8a7de36adade8efdc))
- **APIMessage:** add `interaction` ([#93](https://github.com/discordjs/discord-api-types/issues/93)) ([0f29b32](https://github.com/discordjs/discord-api-types/commit/0f29b32e05abe89f70f72989024b9c63493782fa))
- **APIMessageReferenceSend:** add `fail_if_not_exists` ([#82](https://github.com/discordjs/discord-api-types/issues/82)) ([855f36d](https://github.com/discordjs/discord-api-types/commit/855f36d9309ae69f57da723648d3791e3134089e))
- **PermissionFlagsBits:** add `USE_APPLICATION_COMMANDS` ([#85](https://github.com/discordjs/discord-api-types/issues/85)) ([ceb787b](https://github.com/discordjs/discord-api-types/commit/ceb787ba36ed05f25f9acab86496d3054cb15013))
- **rest:** api base routes ([#87](https://github.com/discordjs/discord-api-types/issues/87)) ([466fa95](https://github.com/discordjs/discord-api-types/commit/466fa95b0e239b7984275959886b995a5020640a))
- add Application Command events ([#75](https://github.com/discordjs/discord-api-types/issues/75)) ([da2c2e9](https://github.com/discordjs/discord-api-types/commit/da2c2e9ada39482fce095c47339b40d6c24e683a))
- add GET single Application Command ([#76](https://github.com/discordjs/discord-api-types/issues/76)) ([5826da2](https://github.com/discordjs/discord-api-types/commit/5826da22e30839b1f9fcd73479f8bc0f213001bd))
- implement FormatPatterns ([#79](https://github.com/discordjs/discord-api-types/issues/79)) ([4e4a084](https://github.com/discordjs/discord-api-types/commit/4e4a0840036eddb89a1d49d69f59905dba206afb))
- **OAuth2:** add `/oauth2/[@me](https://github.com/me)` route ([#73](https://github.com/discordjs/discord-api-types/issues/73)) ([84759d1](https://github.com/discordjs/discord-api-types/commit/84759d19bc4cd0f33f0a94608c1af2b4d6a820c6))
- **Webhook:** add Edit Webhook Message result and error 50027 ([#71](https://github.com/discordjs/discord-api-types/issues/71)) ([4c77a5d](https://github.com/discordjs/discord-api-types/commit/4c77a5d90acf627574eff571a92a6703c6ea2d13))
## [0.12.1](https://github.com/discordjs/discord-api-types/compare/0.12.0...0.12.1) (2021-01-05)
### Bug Fixes
- run deno workflow only on branch push ([#66](https://github.com/discordjs/discord-api-types/issues/66)) ([0ef4620](https://github.com/discordjs/discord-api-types/commit/0ef46202f6c8c257e6300e634b675e7e1b6ffa90))
### Features
- add Snowflake and Permissions types ([#69](https://github.com/discordjs/discord-api-types/issues/69)) ([549a6f0](https://github.com/discordjs/discord-api-types/commit/549a6f023698f05829f1dfdf1190c027a994d6cd))
# [0.12.0](https://github.com/discordjs/discord-api-types/compare/0.11.2...0.12.0) (2021-01-01)
### Bug Fixes
- **APIApplication:** flags should be omitted in REST, not optional everywhere ([#57](https://github.com/discordjs/discord-api-types/issues/57)) ([664ad80](https://github.com/discordjs/discord-api-types/commit/664ad800ccdfb84cc1547dd151c0f6e16157e04b))
- **RESTPatchAPIChannelJSONBody:** add missing bitrate field ([#60](https://github.com/discordjs/discord-api-types/issues/60)) ([15892ec](https://github.com/discordjs/discord-api-types/commit/15892ec870ff818d7f66bd9b57969638e5f17e1f))
### Features
- **GatewayActivity:** add missing fields ([#39](https://github.com/discordjs/discord-api-types/issues/39)) ([dccdfe0](https://github.com/discordjs/discord-api-types/commit/dccdfe044fb4c02b6cfc910e2d39e469ebd9c75a))
## [0.11.2](https://github.com/discordjs/discord-api-types/compare/0.11.1...0.11.2) (2020-12-20)
## [0.11.1](https://github.com/discordjs/discord-api-types/compare/0.11.0...0.11.1) (2020-12-19)
### Bug Fixes
- **APIAuditLogEntry:** user_id is not nullable ([#52](https://github.com/discordjs/discord-api-types/issues/52)) ([2b89beb](https://github.com/discordjs/discord-api-types/commit/2b89beb52b66a4865124b75069ca6bc3d5886c48))
- **RESTPostAPIGuildsJSONBody:** system_channel_flags is optional ([#53](https://github.com/discordjs/discord-api-types/issues/53)) ([ba4c0d7](https://github.com/discordjs/discord-api-types/commit/ba4c0d78f4ba3755f524b5f63420a36580a1a08e))
# [0.11.0](https://github.com/discordjs/discord-api-types/compare/0.10.0...0.11.0) (2020-12-19)
### Bug Fixes
- **APIGuildMember:** drop nullability of `pending` prop ([#49](https://github.com/discordjs/discord-api-types/issues/49)) ([c2f0dee](https://github.com/discordjs/discord-api-types/commit/c2f0deeebd28fa3a09f795d1b263ff8fd5d9ae4d))
- **RESTPatchAPIGuildJSONBody:** multiple properties are actually nullable ([#48](https://github.com/discordjs/discord-api-types/issues/48)) ([018fc4f](https://github.com/discordjs/discord-api-types/commit/018fc4f8ea4d50f719820001822778079a055fa3))
# [0.10.0](https://github.com/discordjs/discord-api-types/compare/0.9.1...0.10.0) (2020-12-09)
### Features
- server templates ([#25](https://github.com/discordjs/discord-api-types/issues/25)) ([7d873f7](https://github.com/discordjs/discord-api-types/commit/7d873f73c7a8c64630c57d3eaf33d8c4913ed835))
## [0.9.1](https://github.com/discordjs/discord-api-types/compare/0.9.0...0.9.1) (2020-11-22)
# [0.9.0](https://github.com/discordjs/discord-api-types/compare/0.8.0...0.9.0) (2020-11-22)
### Features
- **Message:** reply updates ([#34](https://github.com/discordjs/discord-api-types/issues/34)) ([21b9ae4](https://github.com/discordjs/discord-api-types/commit/21b9ae4aaf29c276d1a6ccc4c79ace8d64a53e9d))
- **Message:** Stickers ([#32](https://github.com/discordjs/discord-api-types/issues/32)) ([39ea1f4](https://github.com/discordjs/discord-api-types/commit/39ea1f4429e5194576200635f885ab102763060b))
# [0.8.0](https://github.com/discordjs/discord-api-types/compare/0.7.0...0.8.0) (2020-11-03)
### Bug Fixes
- webhookPlatform route ([#36](https://github.com/discordjs/discord-api-types/issues/36)) ([666a0c7](https://github.com/discordjs/discord-api-types/commit/666a0c71528e385677570b5359ba266276202a95))
- **GatewayPresence:** correct type for sent activity objects ([#30](https://github.com/discordjs/discord-api-types/issues/30)) ([61db1ee](https://github.com/discordjs/discord-api-types/commit/61db1eee256037588ef27533c234cb01f1f699a4))
# [0.7.0](https://github.com/discordjs/discord-api-types/compare/0.6.0...0.7.0) (2020-10-18)
### Bug Fixes
- **GatewayHeartbeat:** d is nullable ([#26](https://github.com/discordjs/discord-api-types/issues/26)) ([0982610](https://github.com/discordjs/discord-api-types/commit/098261073163eeb4fcfc217dea3511ccea1f27c5))
- **GatewayIdentify:** use correct presence interface ([#28](https://github.com/discordjs/discord-api-types/issues/28)) ([91c63f0](https://github.com/discordjs/discord-api-types/commit/91c63f05ca1e8e92c4c1df124365405fe8d34108))
### Features
- **APIGuildWidgetMember:** add activity and use proper status type ([#24](https://github.com/discordjs/discord-api-types/issues/24)) ([f058ed6](https://github.com/discordjs/discord-api-types/commit/f058ed6aa1f7593c22e4a3f0c9dd2f4bbd0190dc))
# [0.6.0](https://github.com/discordjs/discord-api-types/compare/0.5.0...0.6.0) (2020-10-04)
### Bug Fixes
- **APIChannel:** position is optional ([#21](https://github.com/discordjs/discord-api-types/issues/21)) ([061a147](https://github.com/discordjs/discord-api-types/commit/061a147fbb381738b28ca3fb73fa1a7be0e1b108))
- **RESTPostAPIGuildsJSONBody:** use correct types ([#22](https://github.com/discordjs/discord-api-types/issues/22)) ([dcf8ddf](https://github.com/discordjs/discord-api-types/commit/dcf8ddf25b26a9c72dbb1b5712503e6d5e516ad1))
### Features
- v8 support ([#14](https://github.com/discordjs/discord-api-types/issues/14)) ([11b95c8](https://github.com/discordjs/discord-api-types/commit/11b95c86099e609128a8ca76d06d43498fae72f5))
# [0.5.0](https://github.com/discordjs/discord-api-types/compare/0.4.1...0.5.0) (2020-09-19)
### Bug Fixes
- correct typos ([#18](https://github.com/discordjs/discord-api-types/issues/18)) ([97c7b4e](https://github.com/discordjs/discord-api-types/commit/97c7b4ea24852f49b5f952e81a0e6f21ed405316))
- **APIUser:** premium_type is optional ([#19](https://github.com/discordjs/discord-api-types/issues/19)) ([8cf1ba3](https://github.com/discordjs/discord-api-types/commit/8cf1ba3f4f3c28f962afad4bfcc02f5bb897286a))
- **GatewayIdentifyProperties:** rename `device` to `$device` ([#17](https://github.com/discordjs/discord-api-types/issues/17)) ([9e5c5b5](https://github.com/discordjs/discord-api-types/commit/9e5c5b5aac30e931255f39790123b4bd3458a16f))
## [0.4.1](https://github.com/discordjs/discord-api-types/compare/0.4.0...0.4.1) (2020-09-18)
### Features
- add oauth2 types ([#16](https://github.com/discordjs/discord-api-types/issues/16)) ([10fdeba](https://github.com/discordjs/discord-api-types/commit/10fdeba1286e385e087d6c9405872f948507f183))
# [0.4.0](https://github.com/discordjs/discord-api-types/compare/0.3.0...0.4.0) (2020-09-16)
### Features
- **ActivityType:** add Competing activity type ([#11](https://github.com/discordjs/discord-api-types/issues/11)) ([94d0a16](https://github.com/discordjs/discord-api-types/commit/94d0a1680532412c8d5f9659056f87a37d1def7d))
# [0.3.0](https://github.com/discordjs/discord-api-types/compare/v0.2.0...0.3.0) (2020-09-14)
### Bug Fixes
- **APIMessage:** Correct APIMessage#mentions type ([#9](https://github.com/discordjs/discord-api-types/issues/9)) ([fe1868b](https://github.com/discordjs/discord-api-types/commit/fe1868b04f8a9f4be1c09ffba0afa60f4def8595))
# [0.2.0](https://github.com/discordjs/discord-api-types/compare/v0.1.1...v0.2.0) (2020-09-10)
### Bug Fixes
- **Readme:** add missing semicolon ([#1](https://github.com/discordjs/discord-api-types/issues/1)) ([5e3e101](https://github.com/discordjs/discord-api-types/commit/5e3e1016b5fe274d33503d36771fc276fd384ccf))
## [0.1.1](https://github.com/discordjs/discord-api-types/compare/767a833a12a8268b9f1b780f338da6f28cefa5cd...v0.1.1) (2020-08-22)
### Bug Fixes
- set target version to ES2020 ([767a833](https://github.com/discordjs/discord-api-types/commit/767a833a12a8268b9f1b780f338da6f28cefa5cd))

View File

@@ -19,23 +19,48 @@ yarn add discord-api-types
pnpm add 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
```js
const { APIUser } = require('discord-api-types/v8');
```
```ts
// TypeScript/ES Module support
import { APIUser } from 'discord-api-types/v8';
```
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 are some examples
```js
const { GatewayVersion } = require('discord-api-types/gateway/v8');
```
```ts
// TypeScript/ES Module support
import { GatewayVersion } from 'discord-api-types/gateway/v8';
```
> _**Note:** The `v*` exports (`discord-api-type/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. You have 3 ways you can import them:
1. Directly from GitHub
```ts
// Importing the default API version
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/mod.ts';
// Importing a specific API version
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/v8/mod.ts';
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/v8.ts';
```
2. From [deno.land/x](https://deno.land/x)
```ts
// Importing a specific API version
import { APIUser } from 'https://deno.land/x/discord_api_types/v8/mod.ts';
import { APIUser } from 'https://deno.land/x/discord_api_types/v8.ts';
```
3. From [skypack.dev](https://www.skypack.dev/)
@@ -67,21 +92,6 @@ The exports of each API version is split into three main parts:
- 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 `common` directory. They will still be prefixed accordingly as described above.
- 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.
**Warning**: This package documents just KNOWN (and documented) properties. Anything that isn't documented will NOT be added to this package (unless said properties are in an open Pull Request to Discord's [API Documentation repository](https://github.com/discord/discord-api-docs) or known through other means _and have received the green light to be used_). For clarification's sake, this means that properties that are only known through the process of data mining and have not yet been confirmed in a way as described will NOT be included.
## Usage
You can `require` / `import` the module directly, which will give you the latest types as of the current API version. This is considered the `default` version and will be updated according to Discord's default API version; this means it may break at any point in time.
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
```js
const { APIUser } = require('discord-api-types/v8');
```
```ts
// TypeScript/ES Module support
import { APIUser } from 'discord-api-types/v8';
```
**Warning**: This package documents just KNOWN (and documented) properties. Anything that isn't documented will NOT be added to this package (unless said properties are in an open Pull Request to Discord's [API Documentation repository](https://github.com/discord/discord-api-docs) or known through other means _and have received the green light to be used_). For clarification's sake, this means that properties that are only known through the process of data mining and have not yet been confirmed in a way as described will **NOT** be included.

View File

@@ -1,226 +0,0 @@
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#json-json-error-codes
*/
export enum RESTJSONErrorCodes {
GeneralError,
UnknownAccount = 10001,
UnknownApplication,
UnknownChannel,
UnknownGuild,
UnknownIntegration,
UnknownInvite,
UnknownMember,
UnknownMessage,
UnknownPermissionOverwrite,
UnknownProvider,
UnknownRole,
UnknownToken,
UnknownUser,
UnknownEmoji,
UnknownWebhook,
UnknownBan = 10026,
UnknownSKU,
UnknownStoreListing,
UnknownEntitlement,
UnknownBuild,
UnknownLobby,
UnknownBranch,
UnknownRedistributable = 10036,
UnknownGuildTemplate = 10057,
UnknownApplicationCommand = 10063,
BotsCannotUseThisEndpoint = 20001,
OnlyBotsCanUseThisEndpoint,
AnnouncementEditLimitExceeded = 20022,
ChannelSendRateLimit = 20028,
MaximumNumberOfGuildsReached = 30001,
MaximumNumberOfFriendsReached,
MaximumNumberOfPinsReachedForTheChannel,
MaximumNumberOfGuildRolesReached = 30005,
MaximumNumberOfWebhooksReached = 30007,
MaximumNumberOfReactionsReached = 30010,
MaximumNumberOfGuildChannelsReached = 30013,
MaximumNumberOfAttachmentsInAMessageReached = 30015,
MaximumNumberOfInvitesReached,
GuildAlreadyHasTemplate = 30031,
Unauthorized = 40001,
VerifyYourAccount,
RequestEntityTooLarge = 40005,
FeatureTemporarilyDisabledServerSide,
UserBannedFromThisGuild,
ThisMessageWasAlreadyCrossposted = 40033,
MissingAccess = 50001,
InvalidAccountType,
CannotExecuteActionOnDMChannel,
GuildWidgetDisabled,
CannotEditMessageAuthoredByAnotherUser,
CannotSendAnEmptyMessage,
CannotSendMessagesToThisUser,
CannotSendMessagesInVoiceChannel,
ChannelVerificationLevelTooHighForYouToGainAccess,
Oauth2ApplicationDoesNotHaveBot,
Oauth2ApplicationLimitReached,
InvalidOauth2State,
MissingPermissions,
InvalidToken,
NoteWasTooLong,
ProvidedTooFewOrTooManyMessagesToDelete,
MessageCanOnlyBePinnedInTheChannelItWasSentIn = 50019,
InviteCodeInvalidOrTaken,
CannotExecuteActionOnSystemMessage,
CannotExecuteActionOnThisChannelType = 50024,
InvalidOauth2AccessToken,
InvalidWebhookToken = 50027,
InvalidRecipients = 50033,
OneOfTheMessagesProvidedWasTooOldForBulkDelete,
InvalidFormBodyOrContentType,
InviteAcceptedToGuildWithoutTheBotBeingIn,
InvalidAPIVersion = 50041,
CannotDeleteChannelRequiredForCommunityGuilds = 50074,
InvalidStickerSent = 50081,
TwoFactorAuthenticationIsRequired = 60003,
ReactionWasBlocked = 90001,
APIResourceOverloaded = 130000,
}
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-error-codes
*/
export enum RPCErrorCodes {
UnknownError = 1000,
InvalidPayload = 4000,
InvalidCommand = 4002,
InvalidGuild,
InvalidEvent,
InvalidChannel,
InvalidPermissions,
InvalidClientID,
InvalidOrigin,
InvalidToken,
InvalidUser,
OAuth2Error = 5000,
SelectChannelTimedOut,
GetGuildTimedOut,
SelectVoiceForceRequired,
CaptureShortcutAlreadyListening,
}
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-close-event-codes
*/
export enum RPCCloseEventCodes {
InvalidClientID = 4000,
InvalidOrigin,
RateLimited,
TokenRevoked,
InvalidVersion,
InvalidEncoding,
}
/**
* https://discord.com/developers/docs/topics/gateway#connecting-gateway-url-params
*/
export interface GatewayConnectQuery {
v: string;
encoding: 'json' | 'etf';
compress?: 'zlib-stream';
}
/**
* https://discord.com/developers/docs/reference#snowflakes
*/
export type Snowflake = `${bigint}`;
/**
* https://discord.com/developers/docs/topics/permissions
* @internal
*/
export type Permissions = `${bigint}`;
/**
* https://discord.com/developers/docs/reference#message-formatting-formats
*/
export const FormattingPatterns = {
/**
* Regular expression for matching a user mention, strictly without a nickname
*
* The `id` group property is present on the `exec` result of this expression
*/
User: /<@(?<id>\d{17,20})>/,
/**
* Regular expression for matching a user mention, strictly with a nickname
*
* The `id` group property is present on the `exec` result of this expression
*/
UserWithNickname: /<@!(?<id>\d{17,20})>/,
/**
* Regular expression for matching a user mention, with or without a nickname
*
* The `id` group property is present on the `exec` result of this expression
*/
UserWithOptionalNickname: /<@!?(?<id>\d{17,20})>/,
/**
* Regular expression for matching a channel mention
*
* The `id` group property is present on the `exec` result of this expression
*/
Channel: /<#(?<id>\d{17,20})>/,
/**
* Regular expression for matching a role mention
*
* The `id` group property is present on the `exec` result of this expression
*/
Role: /<@&(?<id>\d{17,20})>/,
/**
* Regular expression for matching a custom emoji, either static or animated
*
* The `animated`, `name` and `id` group properties are present on the `exec` result of this expression
*/
Emoji: /<(?<animated>a)?:(?<name>\w{2,32}):(?<id>\d{17,20})>/,
/**
* Regular expression for matching strictly an animated custom emoji
*
* The `animated`, `name` and `id` group properties are present on the `exec` result of this expression
*/
AnimatedEmoji: /<(?<animated>a):(?<name>\w{2,32}):(?<id>\d{17,20})>/,
/**
* Regular expression for matching strictly a static custom emoji
*
* The `name` and `id` group properties are present on the `exec` result of this expression
*/
StaticEmoji: /<:(?<name>\w{2,32}):(?<id>\d{17,20})>/,
} as const;
/**
* Freezes the formatting patterns
* @internal
*/
Object.freeze(FormattingPatterns);

8
deno/gateway/common.ts Normal file
View File

@@ -0,0 +1,8 @@
/**
* https://discord.com/developers/docs/topics/gateway#connecting-gateway-url-params
*/
export interface GatewayURLQuery {
v: string;
encoding: 'json' | 'etf';
compress?: 'zlib-stream';
}

4
deno/gateway/mod.ts Normal file
View File

@@ -0,0 +1,4 @@
// This file exports all the types available in the recommended gateway version
// Thereby, things MAY break in the future. Try sticking to imports from a specific version
export * from './v8.ts';

View File

@@ -16,7 +16,9 @@ import type {
GatewayVoiceState,
InviteTargetUserType,
PresenceUpdateStatus,
} from '../payloads/mod.ts';
} from '../payloads/v6/mod.ts';
export * from './common.ts';
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.

View File

@@ -2,7 +2,7 @@
* Types extracted from https://discord.com/developers/docs/topics/gateway
*/
import type { Snowflake } from '../../common/mod.ts';
import type { Snowflake } from '../globals.ts';
import type {
APIApplication,
APIApplicationCommand,
@@ -10,6 +10,7 @@ import type {
APIChannel,
APIEmoji,
APIGuild,
APIGuildIntegration,
APIGuildMember,
APIMessage,
APIRole,
@@ -18,9 +19,11 @@ import type {
GatewayActivity,
GatewayPresenceUpdate as RawGatewayPresenceUpdate,
GatewayVoiceState,
InviteTargetUserType,
InviteTargetType,
PresenceUpdateStatus,
} from '../payloads/mod.ts';
} from '../payloads/v8/mod.ts';
export * from './common.ts';
export const GatewayVersion = '8';
@@ -158,114 +161,6 @@ export enum GatewayCloseCodes {
DisallowedIntents,
}
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-opcodes
*/
export enum VoiceOPCodes {
/**
* Begin a voice websocket connection
*/
Identify,
/**
* Select the voice protocol
*/
SelectProtocol,
/**
* Complete the websocket handshake
*/
Ready,
/**
* Keep the websocket connection alive
*/
Heartbeat,
/**
* Describe the session
*/
SessionDescription,
/**
* Indicate which users are speaking
*/
Speaking,
/**
* Sent to acknowledge a received client heartbeat
*/
HeartbeatAck,
/**
* Resume a connection
*/
Resume,
/**
* Time to wait between sending heartbeats in milliseconds
*/
Hello,
/**
* Acknowledge a successful session resume
*/
Resumed,
/**
* A client has connected to the voice channel
*/
ClientConnect = 12,
/**
* A client has disconnected from the voice channel
*/
ClientDisconnect,
}
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes
*/
export enum VoiceCloseCodes {
/**
* You sent an invalid opcode
*/
UnknownOpCode = 4001,
/**
* You sent a invalid payload in your identifying to the Gateway
*/
FailedToDecode,
/**
* You sent a payload before identifying with the Gateway
*/
NotAuthenticated,
/**
* The token you sent in your identify payload is incorrect
*/
AuthenticationFailed,
/**
* You sent more than one identify payload. Stahp
*/
AlreadyAuthenticated,
/**
* Your session is no longer valid
*/
SessionNoLongerValid,
/**
* Your session has timed out
*/
SessionTimeout = 4009,
/**
* We can't find the server you're trying to connect to
*/
ServerNotFound = 4011,
/**
* We didn't recognize the protocol you sent
*/
UnknownProtocol,
/**
* Either the channel was deleted or you were kicked. Should not reconnect
*/
Disconnected = 4014,
/**
* The server crashed. Our bad! Try resuming
*/
VoiceServerCrashed,
/**
* We didn't recognize your encryption
*/
UnknownEncryptionMode,
}
/**
* https://discord.com/developers/docs/topics/gateway#list-of-intents
*/
@@ -292,8 +187,8 @@ export enum GatewayIntentBits {
*/
export enum GatewayDispatchEvents {
ApplicationCommandCreate = 'APPLICATION_COMMAND_CREATE',
ApplicationCommandUpdate = 'APPLICATION_COMMAND_UPDATE',
ApplicationCommandDelete = 'APPLICATION_COMMAND_DELETE',
ApplicationCommandUpdate = 'APPLICATION_COMMAND_UPDATE',
ChannelCreate = 'CHANNEL_CREATE',
ChannelDelete = 'CHANNEL_DELETE',
ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE',
@@ -312,6 +207,9 @@ export enum GatewayDispatchEvents {
GuildRoleDelete = 'GUILD_ROLE_DELETE',
GuildRoleUpdate = 'GUILD_ROLE_UPDATE',
GuildUpdate = 'GUILD_UPDATE',
IntegrationCreate = 'INTEGRATION_CREATE',
IntegrationDelete = 'INTEGRATION_DELETE',
IntegrationUpdate = 'INTEGRATION_UPDATE',
InteractionCreate = 'INTERACTION_CREATE',
InviteCreate = 'INVITE_CREATE',
InviteDelete = 'INVITE_DELETE',
@@ -363,6 +261,9 @@ export type GatewayDispatchPayload =
| GatewayGuildModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayGuildRoleModifyDispatch
| GatewayIntegrationCreateDispatch
| GatewayIntegrationDeleteDispatch
| GatewayIntegrationUpdateDispatch
| GatewayInteractionCreateDispatch
| GatewayInviteCreateDispatch
| GatewayInviteDeleteDispatch
@@ -512,10 +413,6 @@ export interface GatewayReadyDispatchData {
* See https://discord.com/developers/docs/resources/user#user-object
*/
user: APIUser;
/**
* Empty array
*/
private_channels: [];
/**
* The guilds the user is in
*
@@ -804,12 +701,14 @@ export type GatewayGuildMemberUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-update
*/
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute'> & {
/**
* The id of the guild
*/
guild_id: Snowflake;
};
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user'> &
Partial<Pick<APIGuildMember, 'deaf' | 'mute'>> &
Required<Pick<APIGuildMember, 'user'>> & {
/**
* The id of the guild
*/
guild_id: Snowflake;
};
/**
* https://discord.com/developers/docs/topics/gateway#guild-members-chunk
@@ -927,6 +826,58 @@ export interface GatewayGuildRoleDeleteDispatchData {
role_id: Snowflake;
}
/**
* https://discord.com/developers/docs/topics/gateway#integration-create
*/
export type GatewayIntegrationCreateDispatch = DataPayload<
GatewayDispatchEvents.IntegrationCreate,
GatewayIntegrationCreateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#integration-create
*/
export type GatewayIntegrationCreateDispatchData = APIGuildIntegration & { guild_id: Snowflake };
/**
* https://discord.com/developers/docs/topics/gateway#integration-update
*/
export type GatewayIntegrationUpdateDispatch = DataPayload<
GatewayDispatchEvents.IntegrationUpdate,
GatewayIntegrationUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#integration-update
*/
export type GatewayIntegrationUpdateDispatchData = APIGuildIntegration & { guild_id: Snowflake };
/**
* https://discord.com/developers/docs/topics/gateway#integration-update
*/
export type GatewayIntegrationDeleteDispatch = DataPayload<
GatewayDispatchEvents.IntegrationDelete,
GatewayIntegrationDeleteDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#integration-delete
*/
export interface GatewayIntegrationDeleteDispatchData {
/**
* Integration id
*/
id: Snowflake;
/**
* ID of the guild
*/
guild_id: Snowflake;
/**
* ID of the bot/OAuth2 application for this Discord integration
*/
application_id?: Snowflake;
}
/**
* https://discord.com/developers/docs/topics/gateway#interaction-create
*/
@@ -985,17 +936,21 @@ export interface GatewayInviteCreateDispatchData {
*/
max_uses: number;
/**
* The target user for this invite
* The type of target for this voice channel invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-invite-target-types
*/
target_type?: InviteTargetType;
/**
* The user whose stream to display for this voice channel stream invite
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
target_user?: APIUser;
/**
* The type of user target for this invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
* The embedded application to open for this voice channel embedded application invite
*/
target_user_type?: InviteTargetUserType;
target_application?: Partial<APIApplication>;
/**
* Whether or not the invite is temporary (invited users will be kicked on disconnect unless they're assigned a role)
*/
@@ -1257,8 +1212,12 @@ export interface GatewayVoiceServerUpdateDispatchData {
guild_id: Snowflake;
/**
* The voice server host
*
* A `null` endpoint means that the voice server allocated has gone away and is trying to be reallocated.
* You should attempt to disconnect from the currently connected voice server, and not attempt to reconnect
* until a new voice server is allocated
*/
endpoint: string;
endpoint: string | null;
}
/**
@@ -1347,13 +1306,6 @@ export interface GatewayIdentifyData {
* See https://discord.com/developers/docs/topics/gateway#update-status
*/
presence?: GatewayPresenceUpdateData;
/**
* Enables dispatching of guild subscription events (presence and typing events)
*
* @default true
* @deprecated Use `intents` instead
*/
guild_subscriptions?: boolean;
/**
* The Gateway Intents you wish to receive
*
@@ -1442,6 +1394,8 @@ export interface GatewayRequestGuildMembersData {
/**
* Nonce to identify the Guild Members Chunk response
*
* Nonce can only be up to 32 bytes. If you send an invalid nonce it will be ignored and the reply member_chunk(s) will not have a `nonce` set.
*
* See https://discord.com/developers/docs/topics/gateway#guild-members-chunk
*/
nonce?: string;
@@ -1494,11 +1448,11 @@ export interface GatewayPresenceUpdateData {
*/
since: number | null;
/**
* `null`, or the user's activities
* The user's activities
*
* See https://discord.com/developers/docs/topics/gateway#activity-object
*/
activities: GatewayActivityUpdateData[] | null;
activities: GatewayActivityUpdateData[];
/**
* The user's new status
*

70
deno/globals.ts Normal file
View File

@@ -0,0 +1,70 @@
/**
* https://discord.com/developers/docs/reference#snowflakes
*/
export type Snowflake = `${bigint}`;
/**
* https://discord.com/developers/docs/topics/permissions
* @internal
*/
export type Permissions = `${bigint}`;
/**
* https://discord.com/developers/docs/reference#message-formatting-formats
*/
export const FormattingPatterns = {
/**
* Regular expression for matching a user mention, strictly without a nickname
*
* The `id` group property is present on the `exec` result of this expression
*/
User: /<@(?<id>\d{17,20})>/,
/**
* Regular expression for matching a user mention, strictly with a nickname
*
* The `id` group property is present on the `exec` result of this expression
*/
UserWithNickname: /<@!(?<id>\d{17,20})>/,
/**
* Regular expression for matching a user mention, with or without a nickname
*
* The `id` group property is present on the `exec` result of this expression
*/
UserWithOptionalNickname: /<@!?(?<id>\d{17,20})>/,
/**
* Regular expression for matching a channel mention
*
* The `id` group property is present on the `exec` result of this expression
*/
Channel: /<#(?<id>\d{17,20})>/,
/**
* Regular expression for matching a role mention
*
* The `id` group property is present on the `exec` result of this expression
*/
Role: /<@&(?<id>\d{17,20})>/,
/**
* Regular expression for matching a custom emoji, either static or animated
*
* The `animated`, `name` and `id` group properties are present on the `exec` result of this expression
*/
Emoji: /<(?<animated>a)?:(?<name>\w{2,32}):(?<id>\d{17,20})>/,
/**
* Regular expression for matching strictly an animated custom emoji
*
* The `animated`, `name` and `id` group properties are present on the `exec` result of this expression
*/
AnimatedEmoji: /<(?<animated>a):(?<name>\w{2,32}):(?<id>\d{17,20})>/,
/**
* Regular expression for matching strictly a static custom emoji
*
* The `name` and `id` group properties are present on the `exec` result of this expression
*/
StaticEmoji: /<:(?<name>\w{2,32}):(?<id>\d{17,20})>/,
} as const;
/**
* Freezes the formatting patterns
* @internal
*/
Object.freeze(FormattingPatterns);

4
deno/payloads/mod.ts Normal file
View File

@@ -0,0 +1,4 @@
// This file exports all the payloads available in the recommended API version
// Thereby, things MAY break in the future. Try sticking to imports from a specific version
export * from './v8/mod.ts';

View File

@@ -2,7 +2,7 @@
* Types extracted from https://discord.com/developers/docs/resources/audit-log
*/
import type { Snowflake } from '../../common/mod.ts';
import type { Snowflake } from '../../globals.ts';
import type { APIOverwrite, ChannelType } from './channel.ts';
import type {
APIGuildIntegration,
@@ -63,8 +63,7 @@ export interface APIAuditLogEntry {
/**
* The user who made the changes
*
* *Against all odds, this can be `null` in some cases (webhooks deleting themselves
* by using their own token, for example)*
* This can be `null` in some cases (webhooks deleting themselves by using their own token, for example)
*/
user_id: Snowflake | null;
/**

View File

@@ -2,10 +2,11 @@
* Types extracted from https://discord.com/developers/docs/resources/channel
*/
import type { Permissions, Snowflake } from '../../common/mod.ts';
import type { Permissions, Snowflake } from '../../globals.ts';
import type { APIPartialEmoji } from './emoji.ts';
import type { APIGuildMember } from './guild.ts';
import type { APIMessageInteraction } from './interactions.ts';
import { APIApplication } from './oauth2.ts';
import type { APIRole } from './permissions.ts';
import type { APIUser } from './user.ts';
@@ -34,7 +35,7 @@ export interface APIPartialChannel {
*/
export interface APIChannel extends APIPartialChannel {
/**
* The id of the guild
* The id of the guild (may be missing for some channel objects received over gateway guild dispatches)
*/
guild_id?: Snowflake;
/**
@@ -99,6 +100,18 @@ export interface APIChannel extends APIPartialChannel {
* This may be `null` in events such as `GUILD_CREATE` when a message is not pinned
*/
last_pin_timestamp?: string | null;
/**
* Voice region id for the voice or stage channel, automatic when set to `null`
*
* See https://discord.com/developers/docs/resources/voice#voice-region-object
*/
rtc_region?: string | null;
/**
* The camera video quality mode of the voice channel, `1` when not present
*
* See https://discord.com/developers/docs/resources/channel#channel-object-video-quality-modes
*/
video_quality_mode?: VideoQualityMode;
}
/**
@@ -108,7 +121,7 @@ export enum ChannelType {
/**
* A text channel within a guild
*/
GUILD_TEXT = 0,
GUILD_TEXT,
/**
* A direct message between users
*/
@@ -139,6 +152,23 @@ export enum ChannelType {
* See https://discord.com/developers/docs/game-and-server-management/special-channels
*/
GUILD_STORE,
/**
* A voice channel for hosting events with an audience
*
* See https://support.discord.com/hc/en-us/articles/1500005513722
*/
GUILD_STAGE_VOICE = 13,
}
export enum VideoQualityMode {
/**
* Discord chooses the quality for optimal performance
*/
AUTO = 1,
/**
* 720p
*/
FULL,
}
/**
@@ -242,7 +272,7 @@ export interface APIMessage {
*/
reactions?: APIReaction[];
/**
* Used for validating a message was sent
* A nonce that can be used for optimistic message sending (up to 25 characters)
*
* **You will not receive this from further fetches. This is received only once from a `MESSAGE_CREATE`
* event to ensure it got sent**
@@ -273,7 +303,7 @@ export interface APIMessage {
*
* See https://discord.com/developers/docs/resources/channel#message-object-message-application-structure
*/
application?: APIMessageApplication;
application?: Partial<APIApplication>;
/**
* Reference data sent with crossposted messages and replies
*
@@ -337,6 +367,7 @@ export enum MessageType {
GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING,
REPLY = 19,
APPLICATION_COMMAND,
GUILD_INVITE_REMINDER = 22,
}
/**
@@ -357,32 +388,6 @@ export interface APIMessageActivity {
party_id?: string;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-application-structure
*/
export interface APIMessageApplication {
/**
* ID of the application
*/
id: Snowflake;
/**
* ID of the embed's image asset
*/
cover_image?: string;
/**
* Application's description
*/
description: string;
/**
* ID of the application's icon
*/
icon: string | null;
/**
* Name of the application
*/
name: string;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
*/
@@ -435,7 +440,14 @@ export enum MessageFlags {
* This message came from the urgent message system
*/
URGENT = 1 << 4,
/**
* This message is only visible to the user who invoked the Interaction
*/
EPHEMERAL = 1 << 6,
/**
* This message is an Interaction Response and the bot is "thinking"
*/
LOADING = 1 << 7,
}
/**
@@ -466,10 +478,6 @@ export interface APISticker {
* Sticker asset hash
*/
asset: string;
/**
* Sticker preview asset hash
*/
preview_asset: string | null;
/**
* Type of sticker format
*
@@ -827,6 +835,12 @@ export interface APIAttachment {
* Name of file attached
*/
filename: string;
/**
* The attachment's media type
*
* See https://en.wikipedia.org/wiki/Media_type
*/
content_type?: string;
/**
* Size of file in bytes
*/

View File

@@ -2,7 +2,7 @@
* Types extracted from https://discord.com/developers/docs/resources/emoji
*/
import type { Snowflake } from '../../common/mod.ts';
import type { Snowflake } from '../../globals.ts';
import type { APIRole } from './permissions.ts';
import type { APIUser } from './user.ts';

View File

@@ -2,7 +2,7 @@
* Types extracted from https://discord.com/developers/docs/topics/gateway
*/
import type { Snowflake } from '../../common/mod.ts';
import type { Snowflake } from '../../globals.ts';
import type { APIEmoji } from './emoji.ts';
import type { APIUser } from './user.ts';
@@ -201,6 +201,9 @@ export interface GatewayActivity {
* See https://en.wikipedia.org/wiki/Bit_field
*/
flags?: ActivityFlags;
/**
* The custom buttons shown in the Rich Presence (max 2)
*/
buttons?: string[] | GatewayActivityButton[];
}
@@ -298,6 +301,12 @@ export enum ActivityFlags {
}
export interface GatewayActivityButton {
/**
* The text shown on the button (1-32 characters)
*/
label: string;
/**
* The url opened when clicking the button (1-512 characters)
*/
url: string;
}

View File

@@ -2,7 +2,7 @@
* Types extracted from https://discord.com/developers/docs/resources/guild
*/
import type { Permissions, Snowflake } from '../../common/mod.ts';
import type { Permissions, Snowflake } from '../../globals.ts';
import type { APIChannel } from './channel.ts';
import type { APIEmoji } from './emoji.ts';
import type { GatewayPresenceUpdate, PresenceUpdateStatus } from './gateway.ts';
@@ -114,6 +114,7 @@ export interface APIGuild extends APIPartialGuild {
* Voice region id for the guild
*
* See https://discord.com/developers/docs/resources/voice#voice-region-object
* @deprecated This field has been deprecated in favor of `rtc_region` on the channel.
*/
region: string;
/**
@@ -296,7 +297,18 @@ export interface APIGuild extends APIPartialGuild {
* **This field is only received from https://discord.com/developers/docs/resources/guild#get-guild with the `with_counts` query parameter set to `true`**
*/
approximate_presence_count?: number;
/**
* The welcome screen of a Community guild, shown to new members
*
* Returned in the invite object
*/
welcome_screen?: APIGuildWelcomeScreen;
/**
* `true` if this guild is designated as NSFW
*
* See https://support.discord.com/hc/en-us/articles/1500005389362-NSFW-Server-Designation
*/
nsfw: boolean;
}
/**
@@ -372,6 +384,10 @@ export enum GuildSystemChannelFlags {
* Suppress server boost notifications
*/
SUPPRESS_PREMIUM_SUBSCRIPTIONS = 1 << 1,
/**
* Suppress server setup tips
*/
SUPPRESS_GUILD_REMINDER_NOTIFICATIONS = 1 << 2,
}
/**
@@ -802,6 +818,10 @@ export interface APIGuildWelcomeScreenChannel {
* The channel id that is suggested
*/
channel_id: Snowflake;
/**
* The description shown for the channel
*/
description: string;
/**
* The emoji id of the emoji that is shown on the left of the channel
*/

View File

@@ -1,16 +1,37 @@
import type { Permissions, Snowflake } from '../../common/mod.ts';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../rest/mod.ts';
import type { Permissions, Snowflake } from '../../globals.ts';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../rest/v8/mod.ts';
import type { APIGuildMember, APIPartialChannel, APIRole, APIUser, MessageFlags } from './mod.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#applicationcommand
*/
export interface APIApplicationCommand {
/**
* Unique id of the command
*/
id: Snowflake;
/**
* Unique id of the parent application
*/
application_id: Snowflake;
/**
* 1-32 character name matching `^[\w-]{1,32}$`
*/
name: string;
/**
* 1-100 character description
*/
description: string;
/**
* The parameters for the command
*/
options?: APIApplicationCommandOption[];
/**
* Whether the command is enabled by default when the app is added to a guild
*
* If missing, this property should be assumed as `true`
*/
default_permission?: boolean;
}
interface APIApplicationCommandOptionBase {
@@ -114,6 +135,11 @@ export interface APIBaseInteraction {
* https://discord.com/developers/docs/interactions/slash-commands#interaction
*/
export interface APIGuildInteraction extends APIBaseInteraction {
/**
* The guild it was sent from
*
* In the case of an `APIDMInteraction`, this will not be present
*/
guild_id: Snowflake;
/**
* Guild member data for the invoking user, including permissions
@@ -126,12 +152,6 @@ export interface APIGuildInteraction extends APIBaseInteraction {
* https://discord.com/developers/docs/interactions/slash-commands#interaction
*/
export interface APIDMInteraction extends APIBaseInteraction {
/**
* The guild it was sent from
*
* In the case of an `APIDMInteraction`, this will not be present
*/
guild_id?: never;
/**
* User object for the invoking user, if invoked in a DM
*/
@@ -145,9 +165,27 @@ export interface APIDMInteraction extends APIBaseInteraction {
export type APIInteraction = APIGuildInteraction | APIDMInteraction;
/**
* Like APIInteraction, only with the `data` property always present
* Like APIGuildInteraction, only with the `data` property always present
*
* @see APIGuildInteraction
*/
export type APIApplicationCommandInteraction = Required<APIInteraction>;
export type APIApplicationCommandGuildInteraction = Required<APIGuildInteraction>;
/**
* Like APIDMInteraction, only with the `data` property always present
*
* @see APIDMInteraction
*/
export type APIApplicationCommandDMInteraction = Required<APIDMInteraction>;
/**
* Like APIInteraction, only with the `data` property always present
*
* @see APIInteraction
*/
export type APIApplicationCommandInteraction =
| APIApplicationCommandGuildInteraction
| APIApplicationCommandDMInteraction;
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-interactiontype
@@ -157,6 +195,54 @@ export enum InteractionType {
ApplicationCommand,
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#guildapplicationcommandpermissions
*/
export interface APIGuildApplicationCommandPermissions {
/**
* The id of the command
*/
id: Snowflake;
/**
* The id of the application the command belongs to
*/
application_id: Snowflake;
/**
* The id of the guild
*/
guild_id: Snowflake;
/**
* The permissions for the command in the guild
*/
permissions: APIApplicationCommandPermission[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#applicationcommandpermissions
*/
export interface APIApplicationCommandPermission {
/**
* The id of the role or user
*/
id: Snowflake;
/**
* Role or user
*/
type: ApplicationCommandPermissionType;
/**
* `true` to allow, `false`, to disallow
*/
permission: boolean;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#applicationcommandpermissiontype
*/
export enum ApplicationCommandPermissionType {
ROLE = 1,
USER,
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-applicationcommandinteractiondata
*/
@@ -188,7 +274,7 @@ export interface ApplicationCommandInteractionDataOptionSubCommand {
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SUB_COMMAND;
type: ApplicationCommandOptionType.SUB_COMMAND_GROUP;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
@@ -238,14 +324,19 @@ export type APIInteractionResponse =
| APIInteractionResponseChannelMessageWithSource
| APIInteractionResponseDeferredChannelMessageWithSource;
export type APIInteractionResponsePong = InteractionResponsePayload<InteractionResponseType.Pong>;
export interface APIInteractionResponsePong {
type: InteractionResponseType.Pong;
}
export type APIInteractionResponseChannelMessageWithSource = InteractionResponsePayload<
InteractionResponseType.ChannelMessageWithSource,
true
>;
export interface APIInteractionResponseChannelMessageWithSource {
type: InteractionResponseType.ChannelMessageWithSource;
data: APIInteractionApplicationCommandCallbackData;
}
export type APIInteractionResponseDeferredChannelMessageWithSource = InteractionResponsePayload<InteractionResponseType.DeferredChannelMessageWithSource>;
export interface APIInteractionResponseDeferredChannelMessageWithSource {
type: InteractionResponseType.DeferredChannelMessageWithSource;
data?: Pick<APIInteractionApplicationCommandCallbackData, 'flags'>;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-interactionresponsetype
@@ -295,14 +386,6 @@ export interface APIMessageInteraction {
user: APIUser;
}
/**
* @internal
*/
interface InteractionResponsePayload<T extends InteractionResponseType, D = false> {
type: T;
data: D extends true ? APIInteractionApplicationCommandCallbackData : never;
}
/**
* @internal
*/

View File

@@ -4,6 +4,7 @@
import type { APIPartialChannel } from './channel.ts';
import type { APIPartialGuild } from './guild.ts';
import type { APIApplication } from './oauth2.ts';
import type { APIUser } from './user.ts';
/**
@@ -25,7 +26,7 @@ export interface APIInvite {
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
channel?: Required<APIPartialChannel>;
channel: Required<APIPartialChannel>;
/**
* The user who created the invite
*
@@ -33,32 +34,39 @@ export interface APIInvite {
*/
inviter?: APIUser;
/**
* The target user for this invite
* The type of target for this voice channel invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
*/
target_type?: InviteTargetType;
/**
* The user whose stream to display for this voice channel stream invite
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
target_user?: APIUser;
/**
* The type of user target for this invite
* The embedded application to open for this voice channel embedded application invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
* See https://discord.com/developers/docs/topics/oauth2#application
*/
target_user_type?: InviteTargetUserType;
target_application?: Partial<APIApplication>;
/**
* Approximate count of online members (only present when `target_user` is set)
* Approximate count of online members, returned from the `GET /invites/<code>` endpoint when `with_counts` is `true`
*/
approximate_presence_count?: number;
/**
* Approximate count of total members
* Approximate count of total members, returned from the `GET /invites/<code>` endpoint when `with_counts` is `true`
*/
approximate_member_count?: number;
}
/**
* https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
* https://discord.com/developers/docs/resources/invite#invite-object-invite-target-types
*/
export enum InviteTargetUserType {
export enum InviteTargetType {
STREAM = 1,
EMBEDDED_APPLICATION,
}
/**

View File

@@ -2,7 +2,7 @@
* Types extracted from https://discord.com/developers/docs/topics/oauth2
*/
import type { Snowflake } from '../../common/mod.ts';
import type { Snowflake } from '../../globals.ts';
import type { APITeam } from './teams.ts';
import type { APIUser } from './user.ts';
@@ -38,6 +38,14 @@ export interface APIApplication {
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
*/
bot_require_code_grant: boolean;
/**
* The url of the application's terms of service
*/
terms_of_service_url?: string;
/**
* The url of the application's privacy policy
*/
privacy_policy_url?: string;
/**
* Partial user object containing info on the owner of the application
*
@@ -50,7 +58,7 @@ export interface APIApplication {
*/
summary: string;
/**
* The base64 encoded key for the GameSDK's GetTicket
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
*
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
*/
@@ -88,7 +96,7 @@ export enum ApplicationFlags {
GroupDMCreate = 1 << 4,
RPCHasConnected = 1 << 11,
GatewayPresence = 1 << 12,
GatewayPresenceLimit = 1 << 13,
GatewayPresenceLimited = 1 << 13,
GatewayGuildMembers = 1 << 14,
GatewayGuildMembersLimited = 1 << 15,
VerificationPendingGuildLimit = 1 << 16,
@@ -148,10 +156,6 @@ export enum OAuth2Scopes {
* For local rpc server access, this allows you to control a user's local Discord client - whitelist only
*/
RPC = 'rpc',
/**
* For local rpc server api access, this allows you to access the API as the local user - whitelist only
*/
RPCApi = 'rpc.api',
/**
* For local rpc server api access, this allows you to receive notifications pushed out to the user - whitelist only
*/

View File

@@ -2,7 +2,7 @@
* Types extracted from https://discord.com/developers/docs/topics/permissions
*/
import type { Permissions, Snowflake } from '../../common/mod.ts';
import type { Permissions, Snowflake } from '../../globals.ts';
/**
* https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags
@@ -43,7 +43,8 @@ export const PermissionFlagsBits = {
MANAGE_ROLES: 1n << 28n,
MANAGE_WEBHOOKS: 1n << 29n,
MANAGE_EMOJIS: 1n << 30n,
USE_APPLICATION_COMMANDS: 1n << 31n,
USE_SLASH_COMMANDS: 1n << 31n,
REQUEST_TO_SPEAK: 1n << 32n,
} as const;
/**

View File

@@ -2,7 +2,7 @@
* Types extracted from https://discord.com/developers/docs/topics/teams
*/
import type { Snowflake } from '../../common/mod.ts';
import type { Snowflake } from '../../globals.ts';
import type { APIUser } from './user.ts';
/**

View File

@@ -2,8 +2,8 @@
* Types extracted from https://discord.com/developers/docs/resources/template
*/
import type { Snowflake } from '../../common/mod.ts';
import type { RESTPostAPIGuildsJSONBody } from '../rest/mod.ts';
import type { Snowflake } from '../../globals.ts';
import type { RESTPostAPIGuildsJSONBody } from '../../rest/v8/mod.ts';
import type { APIUser } from './user.ts';
/**

View File

@@ -2,7 +2,7 @@
* Types extracted from https://discord.com/developers/docs/resources/user
*/
import type { Snowflake } from '../../common/mod.ts';
import type { Snowflake } from '../../globals.ts';
import type { APIGuildIntegration } from './guild.ts';
/**
@@ -85,7 +85,6 @@ export enum UserFlags {
HypeSquadHouseBalance = 1 << 8,
EarlySupporter = 1 << 9,
TeamUser = 1 << 10,
System = 1 << 12,
BugHunterLevel2 = 1 << 14,
VerifiedBot = 1 << 16,
EarlyVerifiedBotDeveloper = 1 << 17,

View File

@@ -2,7 +2,7 @@
* Types extracted from https://discord.com/developers/docs/resources/voice
*/
import type { Snowflake } from '../../common/mod.ts';
import type { Snowflake } from '../../globals.ts';
import type { APIGuildMember } from './guild.ts';
/**
@@ -59,6 +59,10 @@ export interface GatewayVoiceState {
* Whether this user is muted by the current user
*/
suppress: boolean;
/**
* The time at which the user requested to speak
*/
request_to_speak_timestamp: string | null;
}
/**

View File

@@ -2,7 +2,7 @@
* Types extracted from https://discord.com/developers/docs/resources/webhook
*/
import type { Snowflake } from '../../common/mod.ts';
import type { Snowflake } from '../../globals.ts';
import type { APIPartialChannel, APIPartialGuild, APIUser } from './mod.ts';
/**
@@ -49,8 +49,18 @@ export interface APIWebhook {
* The bot/OAuth2 application that created this webhook
*/
application_id: Snowflake | null;
/**
* The guild of the channel that this webhook is following (returned for Channel Follower Webhooks)
*/
source_guild?: APIPartialGuild;
/**
* The channel that this webhook is following (returned for Channel Follower Webhooks)
*/
source_channel?: APIPartialChannel;
/**
* The url used for executing the webhook (returned by the webhooks OAuth2 flow)
*/
url?: string;
}
export enum WebhookType {

113
deno/rest/common.ts Normal file
View File

@@ -0,0 +1,113 @@
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#json-json-error-codes
*/
export enum RESTJSONErrorCodes {
GeneralError,
UnknownAccount = 10001,
UnknownApplication,
UnknownChannel,
UnknownGuild,
UnknownIntegration,
UnknownInvite,
UnknownMember,
UnknownMessage,
UnknownPermissionOverwrite,
UnknownProvider,
UnknownRole,
UnknownToken,
UnknownUser,
UnknownEmoji,
UnknownWebhook,
UnknownBan = 10026,
UnknownSKU,
UnknownStoreListing,
UnknownEntitlement,
UnknownBuild,
UnknownLobby,
UnknownBranch,
UnknownRedistributable = 10036,
UnknownGuildTemplate = 10057,
UnknownInteraction = 10062,
UnknownApplicationCommand,
BotsCannotUseThisEndpoint = 20001,
OnlyBotsCanUseThisEndpoint,
AnnouncementEditLimitExceeded = 20022,
ChannelSendRateLimit = 20028,
MaximumNumberOfGuildsReached = 30001,
MaximumNumberOfFriendsReached,
MaximumNumberOfPinsReachedForTheChannel,
MaximumNumberOfGuildRolesReached = 30005,
MaximumNumberOfWebhooksReached = 30007,
MaximumNumberOfReactionsReached = 30010,
MaximumNumberOfGuildChannelsReached = 30013,
MaximumNumberOfAttachmentsInAMessageReached = 30015,
MaximumNumberOfInvitesReached,
GuildAlreadyHasTemplate = 30031,
Unauthorized = 40001,
VerifyYourAccount,
RequestEntityTooLarge = 40005,
FeatureTemporarilyDisabledServerSide,
UserBannedFromThisGuild,
ThisMessageWasAlreadyCrossposted = 40033,
MissingAccess = 50001,
InvalidAccountType,
CannotExecuteActionOnDMChannel,
GuildWidgetDisabled,
CannotEditMessageAuthoredByAnotherUser,
CannotSendAnEmptyMessage,
CannotSendMessagesToThisUser,
CannotSendMessagesInVoiceChannel,
ChannelVerificationLevelTooHighForYouToGainAccess,
Oauth2ApplicationDoesNotHaveBot,
Oauth2ApplicationLimitReached,
InvalidOauth2State,
MissingPermissions,
InvalidToken,
NoteWasTooLong,
ProvidedTooFewOrTooManyMessagesToDelete,
MessageCanOnlyBePinnedInTheChannelItWasSentIn = 50019,
InviteCodeInvalidOrTaken,
CannotExecuteActionOnSystemMessage,
CannotExecuteActionOnThisChannelType = 50024,
InvalidOauth2AccessToken,
InvalidWebhookToken = 50027,
InvalidRecipients = 50033,
OneOfTheMessagesProvidedWasTooOldForBulkDelete,
InvalidFormBodyOrContentType,
InviteAcceptedToGuildWithoutTheBotBeingIn,
InvalidAPIVersion = 50041,
CannotDeleteChannelRequiredForCommunityGuilds = 50074,
InvalidStickerSent = 50081,
TwoFactorAuthenticationIsRequired = 60003,
ReactionWasBlocked = 90001,
APIResourceOverloaded = 130000,
}

4
deno/rest/mod.ts Normal file
View File

@@ -0,0 +1,4 @@
// This file exports all the types available in the recommended API version
// Thereby, things MAY break in the future. Try sticking to imports from a specific version
export * from './v8/mod.ts';

View File

@@ -1,4 +1,4 @@
import type { APIAuditLog, AuditLogEvent } from '../payloads/auditLog';
import type { APIAuditLog, AuditLogEvent } from '../../payloads/v6/auditLog.ts';
/**
* https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log

View File

@@ -11,7 +11,7 @@ import type {
InviteTargetUserType,
MessageFlags,
OverwriteType,
} from '../payloads/mod.ts';
} from '../../payloads/v6/mod.ts';
// #region TypeDefs

View File

@@ -1,4 +1,4 @@
import type { APIEmoji } from '../payloads/index';
import type { APIEmoji } from '../../payloads/v6/mod.ts';
/**
* https://discord.com/developers/docs/resources/emoji#list-guild-emojis

View File

@@ -1,4 +1,4 @@
import type { APIGatewayBotInfo, APIGatewayInfo } from '../payloads/mod.ts';
import type { APIGatewayBotInfo, APIGatewayInfo } from '../../payloads/v6/mod.ts';
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway

View File

@@ -15,7 +15,7 @@ import type {
GuildVerificationLevel,
GuildWidgetStyle,
IntegrationExpireBehavior,
} from '../payloads/mod.ts';
} from '../../payloads/v6/mod.ts';
import type { RESTPutAPIChannelPermissionsJSONBody } from './channel.ts';
/**

View File

@@ -1,4 +1,4 @@
import type { APIInvite } from '../payloads/mod.ts';
import type { APIInvite } from '../../payloads/v6/mod.ts';
/**
* https://discord.com/developers/docs/resources/invite#get-invite

View File

@@ -1,3 +1,5 @@
export * from '../common.ts';
export * from './auditLog.ts';
export * from './channel.ts';
export * from './emoji.ts';

View File

@@ -1,4 +1,4 @@
import type { APIApplication, APIGuild, APIWebhook } from '../payloads/index';
import type { APIApplication, APIGuild, APIWebhook } from '../../payloads/v6/mod.ts';
/**
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information

View File

@@ -1,4 +1,4 @@
import type { APIChannel, APIConnection, APIUser, GuildFeature } from '../payloads/mod.ts';
import type { APIChannel, APIConnection, APIUser, GuildFeature } from '../../payloads/v6/mod.ts';
/**
* https://discord.com/developers/docs/resources/user#get-current-user

View File

@@ -1,4 +1,4 @@
import type { APIVoiceRegion } from '../payloads/mod.ts';
import type { APIVoiceRegion } from '../../payloads/v6/mod.ts';
/**
* https://discord.com/developers/docs/resources/voice#list-voice-regions

View File

@@ -1,5 +1,5 @@
import type { APIAllowedMentionsSend } from './channel.ts';
import type { APIEmbed, APIMessage, APIWebhook } from '../payloads/mod.ts';
import type { APIEmbed, APIMessage, APIWebhook } from '../../payloads/v6/mod.ts';
/**
* https://discord.com/developers/docs/resources/webhook#create-webhook

View File

@@ -1,5 +1,5 @@
import type { Snowflake } from '../../common/mod.ts';
import type { APIAuditLog, AuditLogEvent } from '../payloads/auditLog.ts';
import type { Snowflake } from '../../globals.ts';
import type { APIAuditLog, AuditLogEvent } from '../../payloads/v8/auditLog.ts';
/**
* https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log

View File

@@ -1,4 +1,4 @@
import type { Permissions, Snowflake } from '../../common/mod.ts';
import type { Permissions, Snowflake } from '../../globals.ts';
import type {
APIAllowedMentions,
APIChannel,
@@ -10,10 +10,11 @@ import type {
APIOverwrite,
APIUser,
ChannelType,
InviteTargetUserType,
InviteTargetType,
MessageFlags,
OverwriteType,
} from '../payloads/mod.ts';
VideoQualityMode,
} from '../../payloads/v8/mod.ts';
/**
* https://discord.com/developers/docs/resources/channel#get-channel
@@ -88,6 +89,18 @@ export interface RESTPatchAPIChannelJSONBody {
* Channel types: text, news, store, voice
*/
parent_id?: Snowflake | null;
/**
* Voice region id for the voice or stage channel, automatic when set to `null`
*
* See https://discord.com/developers/docs/resources/voice#voice-region-object
*/
rtc_region?: string | null;
/**
* The camera video quality mode of the voice channel
*
* See https://discord.com/developers/docs/resources/channel#channel-object-video-quality-modes
*/
video_quality_mode?: VideoQualityMode | null;
}
/**
@@ -233,10 +246,6 @@ export type RESTDeleteAPIChannelMessageUserReactionResult = never;
* https://discord.com/developers/docs/resources/channel#get-reactions
*/
export interface RESTGetAPIChannelMessageReactionUsersQuery {
/**
* Get users before this user ID
*/
before?: Snowflake;
/**
* Get users after this user ID
*/
@@ -376,13 +385,23 @@ export interface RESTPostAPIChannelInviteJSONBody {
*/
unique?: boolean;
/**
* The target user id for this invite
* The type of target for this voice channel invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-invite-target-types
*/
target_user_id?: string;
target_type?: InviteTargetType;
/**
* The type of target user for this invite
* The id of the user whose stream to display for this invite
* - Required if `target_type` is 1
* - The user must be streaming in the channel
*/
target_user_type?: InviteTargetUserType;
target_user_id?: Snowflake;
/**
* The id of the embedded application to open for this invite
* - Required if `target_type` is 2
* - The application must have the `EMBEDDED` flag
*/
target_application_id?: Snowflake;
}
/**

View File

@@ -1,5 +1,5 @@
import type { Snowflake } from '../../common/mod.ts';
import type { APIEmoji } from '../payloads/mod.ts';
import type { Snowflake } from '../../globals.ts';
import type { APIEmoji } from '../../payloads/v8/mod.ts';
/**
* https://discord.com/developers/docs/resources/emoji#list-guild-emojis

View File

@@ -1,4 +1,4 @@
import type { APIGatewayBotInfo, APIGatewayInfo } from '../payloads/mod.ts';
import type { APIGatewayBotInfo, APIGatewayInfo } from '../../payloads/v8/mod.ts';
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway

View File

@@ -1,4 +1,4 @@
import type { Permissions, Snowflake } from '../../common/mod.ts';
import type { Permissions, Snowflake } from '../../globals.ts';
import type {
APIBan,
APIChannel,
@@ -8,6 +8,7 @@ import type {
APIGuildMember,
APIGuildMembershipScreening,
APIGuildPreview,
APIGuildWelcomeScreen,
APIGuildWidget,
APIGuildWidgetSettings,
APIRole,
@@ -18,8 +19,7 @@ import type {
GuildSystemChannelFlags,
GuildVerificationLevel,
GuildWidgetStyle,
IntegrationExpireBehavior,
} from '../payloads/mod.ts';
} from '../../payloads/v8/mod.ts';
import type { RESTPutAPIChannelPermissionJSONBody } from './channel.ts';
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
@@ -330,6 +330,9 @@ export interface RESTGetAPIGuildMembersQuery {
*/
export type RESTGetAPIGuildMembersResult = APIGuildMember[];
/**
* https://discord.com/developers/docs/resources/guild#search-guild-members
*/
export interface RESTGetAPIGuildMembersSearchQuery {
/**
* Query string to match username(s) and nickname(s) against
@@ -661,51 +664,11 @@ export type RESTGetAPIGuildInvitesResult = APIExtendedInvite[];
*/
export type RESTGetAPIGuildIntegrationsResult = APIGuildIntegration[];
/**
* https://discord.com/developers/docs/resources/guild#create-guild-integration
*/
export interface RESTPostAPIGuildIntegrationJSONBody {
type: string;
id: Snowflake;
}
export type RESTPostAPIGuildIntegrationResult = never;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-integration
*/
export interface RESTPatchAPIGuildIntegrationJSONBody {
/**
* The behavior when an integration subscription lapses
*
* See https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
*/
expire_behavior?: IntegrationExpireBehavior | null;
/**
* Period (in days) where the integration will ignore lapsed subscriptions
*/
expire_grace_period?: number | null;
/**
* Whether emoticons should be synced for this integration (`twitch` only currently)
*/
enable_emoticons?: boolean | null;
}
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-integration
*/
export type RESTPatchAPIGuildIntegrationResult = never;
/**
* https://discord.com/developers/docs/resources/guild#delete-guild-integration
*/
export type RESTDeleteAPIGuildIntegrationResult = never;
/**
* https://discord.com/developers/docs/resources/guild#sync-guild-integration
*/
export type RESTPostAPIGuildIntegrationSyncResult = never;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-settings
*/
@@ -770,3 +733,48 @@ export interface RESTPatchAPIGuildMemberVerificationJSONBody {
}
export type RESTPatchAPIGuildMemberVerificationResult = APIGuildMembershipScreening;
export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
/**
* The id of the channel the user is currently in
*/
channel_id: Snowflake;
/**
* Toggles the user's suppress state
*/
suppress?: boolean;
/**
* Sets the user's request to speak
*/
request_to_speak_timestamp?: string | null;
}
export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
/**
* The id of the channel the user is currently in
*/
channel_id: Snowflake;
/**
* Toggles the user's suppress state
*/
suppress?: boolean;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen
*/
export type RESTGetAPIGuildWelcomeScreenResult = APIGuildWelcomeScreen;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen
*/
export interface RESTPatchAPIGuildWelcomeScreenJSONBody extends Nullable<Partial<APIGuildWelcomeScreen>> {
/**
* Whether the welcome screen is enabled
*/
enabled?: boolean | null;
}
type Nullable<T> = {
[P in keyof T]: T[P] | null;
};

View File

@@ -1,4 +1,9 @@
import type { APIApplicationCommand, APIInteractionResponse } from '../payloads/mod.ts';
import type {
APIApplicationCommand,
APIApplicationCommandPermission,
APIGuildApplicationCommandPermissions,
APIInteractionResponse,
} from '../../payloads/v8/mod.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-commands
@@ -30,6 +35,16 @@ export type RESTPatchAPIApplicationCommandJSONBody = Partial<RESTPostAPIApplicat
*/
export type RESTPatchAPIApplicationCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-commands
*/
@@ -60,6 +75,16 @@ export type RESTPatchAPIApplicationGuildCommandJSONBody = Partial<RESTPostAPIApp
*/
export type RESTPatchAPIApplicationGuildCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
*/
@@ -85,3 +110,38 @@ export type RESTPostAPIInteractionCallbackFormDataBody =
*/
file: unknown;
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command-permissions
*/
export type RESTGetAPIGuildApplicationCommandsPermissionsResult = APIGuildApplicationCommandPermissions[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-application-command-permissions
*/
export type RESTGetAPIApplicationCommandPermissionsResult = APIGuildApplicationCommandPermissions;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions
*/
export interface RESTPutAPIApplicationCommandPermissionsJSONBody {
permissions: APIApplicationCommandPermission[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions
*/
export type RESTPutAPIApplicationCommandPermissionsResult = APIGuildApplicationCommandPermissions;
/**
* https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions
*/
export type RESTPutAPIGuildApplicationCommandsPermissionsJSONBody = Pick<
APIGuildApplicationCommandPermissions,
'id' | 'permissions'
>[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions
*/
export type RESTPutAPIGuildApplicationCommandsPermissionsResult = APIGuildApplicationCommandPermissions[];

View File

@@ -1,4 +1,4 @@
import type { APIInvite } from '../payloads/mod.ts';
import type { APIInvite } from '../../payloads/v8/mod.ts';
/**
* https://discord.com/developers/docs/resources/invite#get-invite

View File

@@ -1,4 +1,6 @@
import type { Snowflake } from '../../common/mod.ts';
import type { Snowflake } from '../../globals.ts';
export * from '../common.ts';
export * from './auditLog.ts';
export * from './channel.ts';
@@ -14,6 +16,7 @@ export * from './voice.ts';
export * from './webhook.ts';
export const APIVersion = '8';
export const Routes = {
/**
* Route for:
@@ -332,7 +335,6 @@ export const Routes = {
/**
* Route for:
* - GET `/guilds/{guild.id}/integrations`
* - POST `/guilds/{guild.id}/integrations`
*/
guildIntegrations(guildID: Snowflake) {
return `/guilds/${guildID}/integrations` as const;
@@ -340,21 +342,12 @@ export const Routes = {
/**
* Route for:
* - PATCH `/guilds/{guild.id}/integrations/{integration.id}`
* - DELETE `/guilds/{guild.id}/integrations/{integration.id}`
*/
guildIntegration(guildID: Snowflake, integrationID: Snowflake) {
return `/guilds/${guildID}/integrations/${integrationID}` as const;
},
/**
* Route for:
* - POST `/guilds/{guild.id}/integrations/{integration.id}/sync`
*/
guildIntegrationSync(guildID: Snowflake, integrationID: Snowflake) {
return `/guilds/${guildID}/integrations/${integrationID}/sync` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget`
@@ -433,7 +426,7 @@ export const Routes = {
*
* @param [userID='@me'] The user ID, defaulted to `@me`
*/
user(userID = '@me') {
user(userID: Snowflake | '@me' = '@me') {
return `/users/${userID}` as const;
},
@@ -516,6 +509,8 @@ export const Routes = {
/**
* Route for:
* - GET `/webhooks/{webhook.id}/{webhook.token}/messages/@original`
* - GET `/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}`
* - PATCH `/webhooks/{webhook.id}/{webhook.token}/messages/@original`
* - PATCH `/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}`
* - DELETE `/webhooks/{webhook.id}/{webhook.token}/messages/@original`
@@ -527,7 +522,7 @@ export const Routes = {
*
* @param [messageID='@original'] The message ID to change, defaulted to `@original`
*/
webhookMessage(webhookID: Snowflake, webhookToken: string, messageID = '@original') {
webhookMessage(webhookID: Snowflake, webhookToken: string, messageID: Snowflake | '@original' = '@original') {
return `/webhooks/${webhookID}/${webhookToken}/messages/${messageID}` as const;
},
@@ -575,6 +570,7 @@ export const Routes = {
/**
* Route for:
* - GET `/applications/{application.id}/commands`
* - PUT `/applications/{application.id}/commands`
* - POST `/applications/{application.id}/commands`
*/
applicationCommands(applicationID: Snowflake) {
@@ -594,6 +590,7 @@ export const Routes = {
/**
* Route for:
* - GET `/applications/{application.id}/guilds/{guild.id}/commands`
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands`
* - POST `/applications/{application.id}/guilds/{guild.id}/commands`
*/
applicationGuildCommands(applicationID: Snowflake, guildID: Snowflake) {
@@ -626,6 +623,42 @@ export const Routes = {
guildMemberVerification(guildID: Snowflake) {
return `/guilds/${guildID}/member-verification` as const;
},
/**
* Route for:
* - PATCH `/guilds/{guild.id}/voice-states/@me`
* - PATCH `/guilds/{guild.id}/voice-states/{user.id}`
*/
guildVoiceState(guildID: Snowflake, userID: Snowflake | '@me' = '@me') {
return `/guilds/${guildID}/voice-states/${userID}` as const;
},
/**
* Route for:
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
*/
guildApplicationCommandsPermissions(applicationID: Snowflake, guildID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands/permissions` as const;
},
/**
* Route for:
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
*/
applicationCommandPermissions(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}/permissions` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/welcome-screen`
* - PATCH `/guilds/{guild.id}/welcome-screen`
*/
guildWelcomeScreen(guildID: Snowflake) {
return `/guilds/${guildID}/welcome-screen` as const;
},
};
export const RouteBases = {
@@ -636,10 +669,7 @@ export const RouteBases = {
gift: 'https://discord.gift',
} as const;
/**
* Freeze bases object
* @internal
*/
// Freeze bases object
Object.freeze(RouteBases);
export const OAuth2Routes = {
@@ -651,8 +681,5 @@ export const OAuth2Routes = {
tokenRevocationURL: `https://discord.com/api/v${APIVersion}/oauth2/token/revoke`,
} as const;
/**
* Freeze OAuth2 route object
* @internal
*/
// Freeze OAuth2 route object
Object.freeze(OAuth2Routes);

View File

@@ -1,5 +1,5 @@
import type { Permissions, Snowflake } from '../../common/index';
import type { APIApplication, APIGuild, APIUser, APIWebhook, OAuth2Scopes } from '../payloads/index';
import type { Permissions, Snowflake } from '../../globals.ts';
import type { APIApplication, APIGuild, APIUser, APIWebhook, OAuth2Scopes } from '../../payloads/v8/mod.ts';
/**
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information
@@ -57,7 +57,6 @@ export interface RESTPostOAuth2AccessTokenURLEncodedData {
grant_type: 'authorization_code';
code: string;
redirect_uri?: string;
scope: string;
}
/**
@@ -79,8 +78,6 @@ export interface RESTPostOAuth2RefreshTokenURLEncodedData {
client_secret: string;
grant_type: 'refresh_token';
refresh_token: string;
redirect_uri?: string;
scope: string;
}
export type RESTPostOAuth2RefreshTokenResult = RESTPostOAuth2AccessTokenResult;

View File

@@ -1,4 +1,4 @@
import type { APIGuild, APITemplate } from '../payloads/mod.ts';
import type { APIGuild, APITemplate } from '../../payloads/v8/mod.ts';
/**
* https://discord.com/developers/docs/resources/template#get-template

View File

@@ -1,5 +1,5 @@
import type { Permissions, Snowflake } from '../../common/mod.ts';
import type { APIChannel, APIConnection, APIUser, GuildFeature } from '../payloads/mod.ts';
import type { Permissions, Snowflake } from '../../globals.ts';
import type { APIChannel, APIConnection, APIUser, GuildFeature } from '../../payloads/v8/mod.ts';
/**
* https://discord.com/developers/docs/resources/user#get-current-user

View File

@@ -1,4 +1,4 @@
import type { APIVoiceRegion } from '../payloads/index';
import type { APIVoiceRegion } from '../../payloads/v8/mod.ts';
/**
* https://discord.com/developers/docs/resources/voice#list-voice-regions

View File

@@ -1,5 +1,5 @@
import type { Snowflake } from '../../common/mod.ts';
import type { APIAllowedMentions, APIEmbed, APIMessage, APIWebhook } from '../payloads/mod.ts';
import type { Snowflake } from '../../globals.ts';
import type { APIAllowedMentions, APIEmbed, APIMessage, APIWebhook } from '../../payloads/v8/mod.ts';
/**
* https://discord.com/developers/docs/resources/webhook#create-webhook
@@ -212,9 +212,26 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = Nullable<
*/
export type RESTPatchAPIWebhookWithTokenMessageFormDataBody =
| {
payload_json: string;
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| RESTPatchAPIWebhookWithTokenMessageJSONBody;
| (RESTPatchAPIWebhookWithTokenMessageJSONBody & {
/**
* The file contents
*/
file: unknown;
});
/**
* https://discord.com/developers/docs/resources/webhook#get-webhook-message
*/
export type RESTGetAPIWebhookWithTokenMessageResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message

4
deno/rpc/mod.ts Normal file
View File

@@ -0,0 +1,4 @@
// This file exports all the types available in the recommended API version
// Thereby, things MAY break in the future. Try sticking to imports from a specific version
export * from './v8.ts';

33
deno/rpc/v8.ts Normal file
View File

@@ -0,0 +1,33 @@
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-error-codes
*/
export enum RPCErrorCodes {
UnknownError = 1000,
InvalidPayload = 4000,
InvalidCommand = 4002,
InvalidGuild,
InvalidEvent,
InvalidChannel,
InvalidPermissions,
InvalidClientID,
InvalidOrigin,
InvalidToken,
InvalidUser,
OAuth2Error = 5000,
SelectChannelTimedOut,
GetGuildTimedOut,
SelectVoiceForceRequired,
CaptureShortcutAlreadyListening,
}
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-close-event-codes
*/
export enum RPCCloseEventCodes {
InvalidClientID = 4000,
InvalidOrigin,
RateLimited,
TokenRevoked,
InvalidVersion,
InvalidEncoding,
}

4
deno/utils/mod.ts Normal file
View File

@@ -0,0 +1,4 @@
// This file exports all the utility functions available in the recommended API / Gateway version
// Thereby, things MAY break in the future. Try sticking to imports from a specific version
export * from './v8.ts';

48
deno/utils/v8.ts Normal file
View File

@@ -0,0 +1,48 @@
import {
APIApplicationCommandDMInteraction,
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
APIDMInteraction,
APIGuildInteraction,
APIInteraction,
} from '../payloads/v8/mod.ts';
/**
* A type-guard check for guild interactions.
* @param interaction The interaction to check against the
* @returns A boolean that indicates if the interaction was received from a guild
*/
export function isGuildInteraction(interaction: APIInteraction): interaction is APIGuildInteraction {
return Reflect.has(interaction, 'guild_id');
}
/**
* A type-guard check for DM interactions.
* @param interaction The interaction to check against
* @returns A boolean that indicates if the interaction was received from a direct message
*/
export function isDMInteraction(interaction: APIInteraction): interaction is APIDMInteraction {
return !isGuildInteraction(interaction);
}
/**
* A type-guard check for guild application command interactions.
* @param interaction The interaction to check against
* @returns A boolean that indicates if the command interaction was received from a guild
*/
export function isApplicationCommandGuildInteraction(
interaction: APIApplicationCommandInteraction,
): interaction is APIApplicationCommandGuildInteraction {
return isGuildInteraction(interaction);
}
/**
* A type-guard check for direct message application command interactions.
* @param interaction The interaction to check against
* @returns A boolean that indicates if the command interaction was received from a direct message
*/
export function isApplicationCommandDMInteraction(
interaction: APIApplicationCommandInteraction,
): interaction is APIApplicationCommandDMInteraction {
return !isGuildInteraction(interaction);
}

4
deno/v6.ts Normal file
View File

@@ -0,0 +1,4 @@
export * from './globals.ts';
export * from './gateway/v6.ts';
export * from './payloads/v6/mod.ts';
export * from './rest/v6/mod.ts';

View File

@@ -1,4 +0,0 @@
export * from '../common/mod.ts';
export * from './gateway/mod.ts';
export * from './payloads/mod.ts';
export * from './rest/mod.ts';

6
deno/v8.ts Normal file
View File

@@ -0,0 +1,6 @@
export * from './globals.ts';
export * from './gateway/v8.ts';
export * from './payloads/v8/mod.ts';
export * from './rest/v8/mod.ts';
export * from './rpc/v8.ts';
export * as Utils from './utils/v8.ts';

View File

@@ -1,4 +0,0 @@
export * from '../common/mod.ts';
export * from './gateway/mod.ts';
export * from './payloads/mod.ts';
export * from './rest/mod.ts';

4
deno/voice/mod.ts Normal file
View File

@@ -0,0 +1,4 @@
// This file exports all the types available in the recommended voice gateway version
// Thereby, things MAY break in the future. Try sticking to imports from a specific version
export * from './v4.ts';

109
deno/voice/v4.ts Normal file
View File

@@ -0,0 +1,109 @@
export const VoiceGatewayVersion = '4';
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-opcodes
*/
export enum VoiceOPCodes {
/**
* Begin a voice websocket connection
*/
Identify,
/**
* Select the voice protocol
*/
SelectProtocol,
/**
* Complete the websocket handshake
*/
Ready,
/**
* Keep the websocket connection alive
*/
Heartbeat,
/**
* Describe the session
*/
SessionDescription,
/**
* Indicate which users are speaking
*/
Speaking,
/**
* Sent to acknowledge a received client heartbeat
*/
HeartbeatAck,
/**
* Resume a connection
*/
Resume,
/**
* Time to wait between sending heartbeats in milliseconds
*/
Hello,
/**
* Acknowledge a successful session resume
*/
Resumed,
/**
* A client has connected to the voice channel
*/
ClientConnect = 12,
/**
* A client has disconnected from the voice channel
*/
ClientDisconnect,
}
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes
*/
export enum VoiceCloseCodes {
/**
* You sent an invalid opcode
*/
UnknownOpCode = 4001,
/**
* You sent a invalid payload in your identifying to the Gateway
*/
FailedToDecode,
/**
* You sent a payload before identifying with the Gateway
*/
NotAuthenticated,
/**
* The token you sent in your identify payload is incorrect
*/
AuthenticationFailed,
/**
* You sent more than one identify payload. Stahp
*/
AlreadyAuthenticated,
/**
* Your session is no longer valid
*/
SessionNoLongerValid,
/**
* Your session has timed out
*/
SessionTimeout = 4009,
/**
* We can't find the server you're trying to connect to
*/
ServerNotFound = 4011,
/**
* We didn't recognize the protocol you sent
*/
UnknownProtocol,
/**
* Either the channel was deleted, you were kicked, or the main gateway session was dropped. Should not reconnect
*/
Disconnected = 4014,
/**
* The server crashed. Our bad! Try resuming
*/
VoiceServerCrashed,
/**
* We didn't recognize your encryption
*/
UnknownEncryptionMode,
}

8
gateway/common.ts Normal file
View File

@@ -0,0 +1,8 @@
/**
* https://discord.com/developers/docs/topics/gateway#connecting-gateway-url-params
*/
export interface GatewayURLQuery {
v: string;
encoding: 'json' | 'etf';
compress?: 'zlib-stream';
}

4
gateway/index.ts Normal file
View File

@@ -0,0 +1,4 @@
// This file exports all the types available in the recommended gateway version
// Thereby, things MAY break in the future. Try sticking to imports from a specific version
export * from './v8';

View File

@@ -16,7 +16,9 @@ import type {
GatewayVoiceState,
InviteTargetUserType,
PresenceUpdateStatus,
} from '../payloads/index';
} from '../payloads/v6/index';
export * from './common';
/**
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.

View File

@@ -2,7 +2,7 @@
* Types extracted from https://discord.com/developers/docs/topics/gateway
*/
import type { Snowflake } from '../../common/index';
import type { Snowflake } from '../globals';
import type {
APIApplication,
APIApplicationCommand,
@@ -10,6 +10,7 @@ import type {
APIChannel,
APIEmoji,
APIGuild,
APIGuildIntegration,
APIGuildMember,
APIMessage,
APIRole,
@@ -18,9 +19,11 @@ import type {
GatewayActivity,
GatewayPresenceUpdate as RawGatewayPresenceUpdate,
GatewayVoiceState,
InviteTargetUserType,
InviteTargetType,
PresenceUpdateStatus,
} from '../payloads/index';
} from '../payloads/v8/index';
export * from './common';
export const GatewayVersion = '8';
@@ -158,114 +161,6 @@ export const enum GatewayCloseCodes {
DisallowedIntents,
}
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-opcodes
*/
export const enum VoiceOPCodes {
/**
* Begin a voice websocket connection
*/
Identify,
/**
* Select the voice protocol
*/
SelectProtocol,
/**
* Complete the websocket handshake
*/
Ready,
/**
* Keep the websocket connection alive
*/
Heartbeat,
/**
* Describe the session
*/
SessionDescription,
/**
* Indicate which users are speaking
*/
Speaking,
/**
* Sent to acknowledge a received client heartbeat
*/
HeartbeatAck,
/**
* Resume a connection
*/
Resume,
/**
* Time to wait between sending heartbeats in milliseconds
*/
Hello,
/**
* Acknowledge a successful session resume
*/
Resumed,
/**
* A client has connected to the voice channel
*/
ClientConnect = 12,
/**
* A client has disconnected from the voice channel
*/
ClientDisconnect,
}
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes
*/
export const enum VoiceCloseCodes {
/**
* You sent an invalid opcode
*/
UnknownOpCode = 4001,
/**
* You sent a invalid payload in your identifying to the Gateway
*/
FailedToDecode,
/**
* You sent a payload before identifying with the Gateway
*/
NotAuthenticated,
/**
* The token you sent in your identify payload is incorrect
*/
AuthenticationFailed,
/**
* You sent more than one identify payload. Stahp
*/
AlreadyAuthenticated,
/**
* Your session is no longer valid
*/
SessionNoLongerValid,
/**
* Your session has timed out
*/
SessionTimeout = 4009,
/**
* We can't find the server you're trying to connect to
*/
ServerNotFound = 4011,
/**
* We didn't recognize the protocol you sent
*/
UnknownProtocol,
/**
* Either the channel was deleted or you were kicked. Should not reconnect
*/
Disconnected = 4014,
/**
* The server crashed. Our bad! Try resuming
*/
VoiceServerCrashed,
/**
* We didn't recognize your encryption
*/
UnknownEncryptionMode,
}
/**
* https://discord.com/developers/docs/topics/gateway#list-of-intents
*/
@@ -292,8 +187,8 @@ export const enum GatewayIntentBits {
*/
export const enum GatewayDispatchEvents {
ApplicationCommandCreate = 'APPLICATION_COMMAND_CREATE',
ApplicationCommandUpdate = 'APPLICATION_COMMAND_UPDATE',
ApplicationCommandDelete = 'APPLICATION_COMMAND_DELETE',
ApplicationCommandUpdate = 'APPLICATION_COMMAND_UPDATE',
ChannelCreate = 'CHANNEL_CREATE',
ChannelDelete = 'CHANNEL_DELETE',
ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE',
@@ -312,6 +207,9 @@ export const enum GatewayDispatchEvents {
GuildRoleDelete = 'GUILD_ROLE_DELETE',
GuildRoleUpdate = 'GUILD_ROLE_UPDATE',
GuildUpdate = 'GUILD_UPDATE',
IntegrationCreate = 'INTEGRATION_CREATE',
IntegrationDelete = 'INTEGRATION_DELETE',
IntegrationUpdate = 'INTEGRATION_UPDATE',
InteractionCreate = 'INTERACTION_CREATE',
InviteCreate = 'INVITE_CREATE',
InviteDelete = 'INVITE_DELETE',
@@ -363,6 +261,9 @@ export type GatewayDispatchPayload =
| GatewayGuildModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayGuildRoleModifyDispatch
| GatewayIntegrationCreateDispatch
| GatewayIntegrationDeleteDispatch
| GatewayIntegrationUpdateDispatch
| GatewayInteractionCreateDispatch
| GatewayInviteCreateDispatch
| GatewayInviteDeleteDispatch
@@ -512,10 +413,6 @@ export interface GatewayReadyDispatchData {
* See https://discord.com/developers/docs/resources/user#user-object
*/
user: APIUser;
/**
* Empty array
*/
private_channels: [];
/**
* The guilds the user is in
*
@@ -804,12 +701,14 @@ export type GatewayGuildMemberUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#guild-member-update
*/
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute'> & {
/**
* The id of the guild
*/
guild_id: Snowflake;
};
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user'> &
Partial<Pick<APIGuildMember, 'deaf' | 'mute'>> &
Required<Pick<APIGuildMember, 'user'>> & {
/**
* The id of the guild
*/
guild_id: Snowflake;
};
/**
* https://discord.com/developers/docs/topics/gateway#guild-members-chunk
@@ -927,6 +826,58 @@ export interface GatewayGuildRoleDeleteDispatchData {
role_id: Snowflake;
}
/**
* https://discord.com/developers/docs/topics/gateway#integration-create
*/
export type GatewayIntegrationCreateDispatch = DataPayload<
GatewayDispatchEvents.IntegrationCreate,
GatewayIntegrationCreateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#integration-create
*/
export type GatewayIntegrationCreateDispatchData = APIGuildIntegration & { guild_id: Snowflake };
/**
* https://discord.com/developers/docs/topics/gateway#integration-update
*/
export type GatewayIntegrationUpdateDispatch = DataPayload<
GatewayDispatchEvents.IntegrationUpdate,
GatewayIntegrationUpdateDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#integration-update
*/
export type GatewayIntegrationUpdateDispatchData = APIGuildIntegration & { guild_id: Snowflake };
/**
* https://discord.com/developers/docs/topics/gateway#integration-update
*/
export type GatewayIntegrationDeleteDispatch = DataPayload<
GatewayDispatchEvents.IntegrationDelete,
GatewayIntegrationDeleteDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#integration-delete
*/
export interface GatewayIntegrationDeleteDispatchData {
/**
* Integration id
*/
id: Snowflake;
/**
* ID of the guild
*/
guild_id: Snowflake;
/**
* ID of the bot/OAuth2 application for this Discord integration
*/
application_id?: Snowflake;
}
/**
* https://discord.com/developers/docs/topics/gateway#interaction-create
*/
@@ -985,17 +936,21 @@ export interface GatewayInviteCreateDispatchData {
*/
max_uses: number;
/**
* The target user for this invite
* The type of target for this voice channel invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-invite-target-types
*/
target_type?: InviteTargetType;
/**
* The user whose stream to display for this voice channel stream invite
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
target_user?: APIUser;
/**
* The type of user target for this invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
* The embedded application to open for this voice channel embedded application invite
*/
target_user_type?: InviteTargetUserType;
target_application?: Partial<APIApplication>;
/**
* Whether or not the invite is temporary (invited users will be kicked on disconnect unless they're assigned a role)
*/
@@ -1257,8 +1212,12 @@ export interface GatewayVoiceServerUpdateDispatchData {
guild_id: Snowflake;
/**
* The voice server host
*
* A `null` endpoint means that the voice server allocated has gone away and is trying to be reallocated.
* You should attempt to disconnect from the currently connected voice server, and not attempt to reconnect
* until a new voice server is allocated
*/
endpoint: string;
endpoint: string | null;
}
/**
@@ -1347,13 +1306,6 @@ export interface GatewayIdentifyData {
* See https://discord.com/developers/docs/topics/gateway#update-status
*/
presence?: GatewayPresenceUpdateData;
/**
* Enables dispatching of guild subscription events (presence and typing events)
*
* @default true
* @deprecated Use `intents` instead
*/
guild_subscriptions?: boolean;
/**
* The Gateway Intents you wish to receive
*
@@ -1442,6 +1394,8 @@ export interface GatewayRequestGuildMembersData {
/**
* Nonce to identify the Guild Members Chunk response
*
* Nonce can only be up to 32 bytes. If you send an invalid nonce it will be ignored and the reply member_chunk(s) will not have a `nonce` set.
*
* See https://discord.com/developers/docs/topics/gateway#guild-members-chunk
*/
nonce?: string;
@@ -1494,11 +1448,11 @@ export interface GatewayPresenceUpdateData {
*/
since: number | null;
/**
* `null`, or the user's activities
* The user's activities
*
* See https://discord.com/developers/docs/topics/gateway#activity-object
*/
activities: GatewayActivityUpdateData[] | null;
activities: GatewayActivityUpdateData[];
/**
* The user's new status
*

70
globals.ts Normal file
View File

@@ -0,0 +1,70 @@
/**
* https://discord.com/developers/docs/reference#snowflakes
*/
export type Snowflake = `${bigint}`;
/**
* https://discord.com/developers/docs/topics/permissions
* @internal
*/
export type Permissions = `${bigint}`;
/**
* https://discord.com/developers/docs/reference#message-formatting-formats
*/
export const FormattingPatterns = {
/**
* Regular expression for matching a user mention, strictly without a nickname
*
* The `id` group property is present on the `exec` result of this expression
*/
User: /<@(?<id>\d{17,20})>/,
/**
* Regular expression for matching a user mention, strictly with a nickname
*
* The `id` group property is present on the `exec` result of this expression
*/
UserWithNickname: /<@!(?<id>\d{17,20})>/,
/**
* Regular expression for matching a user mention, with or without a nickname
*
* The `id` group property is present on the `exec` result of this expression
*/
UserWithOptionalNickname: /<@!?(?<id>\d{17,20})>/,
/**
* Regular expression for matching a channel mention
*
* The `id` group property is present on the `exec` result of this expression
*/
Channel: /<#(?<id>\d{17,20})>/,
/**
* Regular expression for matching a role mention
*
* The `id` group property is present on the `exec` result of this expression
*/
Role: /<@&(?<id>\d{17,20})>/,
/**
* Regular expression for matching a custom emoji, either static or animated
*
* The `animated`, `name` and `id` group properties are present on the `exec` result of this expression
*/
Emoji: /<(?<animated>a)?:(?<name>\w{2,32}):(?<id>\d{17,20})>/,
/**
* Regular expression for matching strictly an animated custom emoji
*
* The `animated`, `name` and `id` group properties are present on the `exec` result of this expression
*/
AnimatedEmoji: /<(?<animated>a):(?<name>\w{2,32}):(?<id>\d{17,20})>/,
/**
* Regular expression for matching strictly a static custom emoji
*
* The `name` and `id` group properties are present on the `exec` result of this expression
*/
StaticEmoji: /<:(?<name>\w{2,32}):(?<id>\d{17,20})>/,
} as const;
/**
* Freezes the formatting patterns
* @internal
*/
Object.freeze(FormattingPatterns);

3150
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,21 +1,70 @@
{
"name": "discord-api-types",
"version": "0.13.0",
"version": "0.17.0",
"description": "Discord API typings that are kept up to date for use in bot library creation.",
"main": "./default/index.js",
"types": "./default/index.d.ts",
"main": "./v8.js",
"module": "./v8.mjs",
"types": "./v8.d.ts",
"exports": {
"./common": {
"require": "./common/index.js",
"import": "./common/index.mjs"
"./globals": {
"require": "./globals.js",
"import": "./globals.mjs"
},
"./v6": {
"require": "./v6/index.js",
"import": "./v6/index.mjs"
"require": "./v6.js",
"import": "./v6.mjs"
},
"./v8": {
"require": "./v8/index.js",
"import": "./v8/index.mjs"
"require": "./v8.js",
"import": "./v8.mjs"
},
"./gateway": {
"require": "./gateway/index.js",
"import": "./gateway/index.mjs"
},
"./gateway/v*": {
"require": "./gateway/v*.js",
"import": "./gateway/v*.mjs"
},
"./payloads": {
"require": "./payloads/index.js",
"import": "./payloads/index.mjs"
},
"./payloads/v*": {
"require": "./payloads/v*/index.js",
"import": "./payloads/v*/index.mjs"
},
"./rest": {
"require": "./rest/index.js",
"import": "./rest/index.mjs"
},
"./rest/v*": {
"require": "./rest/v*/index.js",
"import": "./rest/v*/index.mjs"
},
"./rpc": {
"require": "./rpc/index.js",
"import": "./rpc/index.mjs"
},
"./rpc/v*": {
"require": "./rpc/v*.js",
"import": "./rpc/v*.mjs"
},
"./voice": {
"require": "./voice/index.js",
"import": "./voice/index.mjs"
},
"./voice/v*": {
"require": "./voice/v*.js",
"import": "./voice/v*.mjs"
},
"./utils": {
"require": "./utils/index.js",
"import": "./utils/index.mjs"
},
"./utils/v*": {
"require": "./utils/v*.js",
"import": "./utils/v*.mjs"
}
},
"scripts": {
@@ -23,15 +72,21 @@
"build:deno": "node ./scripts/deno.mjs",
"build:node": "tsc && run-p esm:*",
"clean:deno": "rimraf deno/",
"clean:node": "rimraf {v*,default,common}/**/*.{js,mjs,d.ts,map}",
"clean:node": "rimraf {gateway,payloads,rest,rpc,voice,utils}/**/*.{js,mjs,d.ts,map} {globals,v*}.{js,mjs,d.ts,*map}",
"clean": "run-p clean:*",
"esm:common": "gen-esm-wrapper ./common/index.js ./common/index.mjs",
"esm:v6": "gen-esm-wrapper ./v6/index.js ./v6/index.mjs",
"esm:v8": "gen-esm-wrapper ./v8/index.js ./v8/index.mjs",
"lint": "eslint --fix --ext mjs,js,ts {v*,default,common}/**",
"postpublish": "run-s clean:node build:deno",
"esm:gateway": "gen-esm-wrapper ./gateway/index.js ./gateway/index.mjs",
"esm:payloads": "gen-esm-wrapper ./payloads/index.js ./payloads/index.mjs",
"esm:rest": "gen-esm-wrapper ./rest/index.js ./rest/index.mjs",
"esm:rpc": "gen-esm-wrapper ./rpc/index.js ./rpc/index.mjs",
"esm:utils": "gen-esm-wrapper ./utils/index.js ./utils/index.mjs",
"esm:voice": "gen-esm-wrapper ./voice/index.js ./voice/index.mjs",
"esm:globals": "gen-esm-wrapper ./globals.js ./globals.mjs",
"esm:versions": "node ./scripts/versions.mjs",
"lint": "eslint --fix --ext mjs,ts {gateway,payloads,rest,rpc,voice,utils}/** {globals,v*}.ts",
"test:lint": "eslint --ext mjs,ts {gateway,payloads,rest,rpc,voice,utils}/** {globals,v*}.ts",
"prepublishOnly": "run-s clean test:lint build:node",
"test:lint": "eslint --ext mjs,js,ts {v*,default,common}/**"
"postpublish": "run-s clean:node build:deno",
"version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"
},
"keywords": [
"discord",
@@ -42,22 +97,23 @@
"author": "Vlad Frangu <kingdgrizzle@gmail.com>",
"license": "MIT",
"files": [
"v*/*",
"default/*",
"common/*",
"!**/*.ts",
"**/*.d.ts",
"!deno/*"
"{gateway,payloads,rest,rpc,voice,utils}/**/*.{js,js.map,d.ts,d.ts.map,mjs}",
"{globals,v*}.{js,js.map,d.ts,d.ts.map,mjs}"
],
"engines": {
"node": ">=12"
},
"devDependencies": {
"@commitlint/cli": "^12.0.1",
"@commitlint/config-angular": "^12.0.1",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"eslint": "^7.22.0",
"@babel/core": "^7.13.15",
"@babel/eslint-parser": "^7.13.14",
"@babel/plugin-syntax-top-level-await": "^7.12.13",
"@commitlint/cli": "^12.1.1",
"@commitlint/config-angular": "^12.1.1",
"@types/node": "^14.14.37",
"@typescript-eslint/eslint-plugin": "^4.21.0",
"@typescript-eslint/parser": "^4.21.0",
"conventional-changelog-cli": "^2.1.1",
"eslint": "^7.24.0",
"eslint-config-marine": "^8.3.2",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.3.1",
@@ -68,7 +124,7 @@
"prettier": "^2.2.1",
"pretty-quick": "^3.1.0",
"rimraf": "^3.0.2",
"typescript": "^4.2.3"
"typescript": "^4.2.4"
},
"repository": {
"type": "git",
@@ -84,7 +140,19 @@
},
"rules": {
"@typescript-eslint/naming-convention": 0
}
},
"overrides": [
{
"files": [
"scripts/**/*.mjs"
],
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
}
}
]
},
"husky": {
"hooks": {
@@ -93,7 +161,8 @@
}
},
"lint-staged": {
"*.{mjs,js,ts}": "eslint --fix --ext mjs,js,ts"
"{gateway,payloads,rest,rpc,voice,shortcuts,utils}/**/*.{mjs,js,ts}": "eslint --fix --ext mjs,js,ts",
"globals.ts": "eslint --fix --ext mjs,js,ts"
},
"commitlint": {
"extends": [

4
payloads/index.ts Normal file
View File

@@ -0,0 +1,4 @@
// This file exports all the payloads available in the recommended API version
// Thereby, things MAY break in the future. Try sticking to imports from a specific version
export * from './v8/index';

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