Compare commits

...

127 Commits

Author SHA1 Message Date
Vlad Frangu
21e1148f2d chore(release): 0.23.0 🎉 (#194) 2021-09-07 17:41:34 +03:00
Vlad Frangu
8b49887c7f feat(JSONErrorCodes): add 160002 (#190)
ref: https://github.com/discord/discord-api-docs/pull/3738
2021-09-07 12:57:06 +03:00
Vlad Frangu
d590caf359 chore(Gateway): remove APPLICATION_COMMAND_* events (#191)
BREAKING CHANGE: The three Application Command events have been removed
2021-09-07 12:56:43 +03:00
Vlad Frangu
ecbed18042 feat(APIApplicationCommand): add version field (#193)
ref: https://github.com/discord/discord-api-docs/pull/3524
2021-09-07 12:56:34 +03:00
Vlad Frangu
e628f0f6f0 fix(Embed): corrent certain optional types as being required (#192)
BREAKING CHANGE:
- `APIEmbedAuthor#name` is required, not optional
- `APIEmbedThumbnail#url` is required, not optional
- `APIEmbedImage#url` is required, not optional
2021-09-07 12:56:14 +03:00
Advaith
0024823d05 feat(MessageType): add ContextMenuCommand and rename ApplicationCommand to ChatInputCommand (#180) 2021-09-05 19:41:15 +03:00
Jiralite
64937e2311 fix(AuditLog): correct nickname type (#189)
* fix(auditLog): Correct nickname type

* something something deno

* chore: Apply fix to v8
2021-08-30 12:31:56 +02:00
Jiralite
f2e22869d0 chore: Update invite link (#188) 2021-08-25 07:41:30 +02:00
Advaith
b6babf2ee2 feat(threads): add invitable (#185) 2021-08-22 11:32:31 +02:00
Advaith
f2b58acbf8 chore: add missing json error codes (#184) 2021-08-22 02:33:04 +02:00
Advaith
b07b9030c1 feat(APIUser): add banner and accent_color (#183)
* feat(APIUser): add `banner` and `accent_color`

* chore: v8
2021-08-22 02:31:02 +02:00
Advaith
fdc1c1a5b4 feat(Interactions): context menu items (#166) 2021-08-14 19:58:34 +02:00
Arcoz
8fcd0f2222 fix: import causing error 404 on deno (#178) 2021-08-07 09:53:10 +02:00
Vlad Frangu
5723cc04bf chore(release): 0.22.0 🎉 (#177) 2021-08-01 00:51:03 +03:00
Vlad Frangu
f93b6be252 chore(ApplicationCommandOptionType): casing changes for subcommands (#175)
BREAKING CHANGE: This renames `SubCommand` to `Subcommand`, and `SubCommandGroup` to `SubcommandGroup`
2021-08-01 00:48:14 +03:00
Vlad Frangu
b75b05f0d5 fix(MessageComponent): correct type for emoji (#176) 2021-08-01 00:47:15 +03:00
Advaith
47100bcf2c feat: thread updates (#167)
* feat: thread updates

* feat: update Routes

BREAKING CHANGE: `Routes#channelJoinedArchivedThreads` is now spelled right (from `Routes#channelJoinedArhivedThreads`)
2021-07-31 23:54:06 +03:00
ckohen
a93235c9df fix(Gateway): thread list sync now sends an array as documented (#174)
BREAKING CHANGE: `GatewayThreadListSync#members` is now an array of APIThreadMember instead of a Record of GatewayThreadListSyncMember
2021-07-31 23:52:27 +03:00
Vlad Frangu
b1589545e9 chore(release): 0.21.0 🎉 (#173) 2021-07-31 02:14:54 +03:00
Vlad Frangu
647905e16b revert: fix: change resolved index types to string (#172)
This reverts commit d338409410.
2021-07-31 02:10:57 +03:00
Noel
f2995073e0 feat(Globals): revert template bigint type to string type (#171)
BREAKING CHANGE: The type for Snowflake and Permissions is reverted from the `${bigint}` template type back to a normal string type
2021-07-31 02:05:50 +03:00
Advaith
6f15e537df feat(ApplicationCommandOptionType): add Number (10) (#153) 2021-07-26 22:12:54 +03:00
Advaith
d338409410 fix: change resolved index types to string (#169) 2021-07-26 22:12:35 +03:00
Advaith
ef2a0aeb07 fix: export APIPingInteraction (#168) 2021-07-26 08:49:31 +03:00
Vlad Frangu
ab1951b7b9 chore(release): 0.20.2 🎉 (#165) 2021-07-21 12:57:08 +03:00
Vlad Frangu
ff75eb3f5d fix(APIInteraction): bring back Ping type (#164)
* fix(APIInteraction): bring back Ping type

* fix(APIPingInteraction): there be no data here!
2021-07-21 12:52:28 +03:00
Vlad Frangu
f0f44e6db4 chore(release): 0.20.1 🎉 (#163) 2021-07-20 14:52:22 +03:00
Advaith
f99f07f72e feat(Interactions): add interaction response and followup route (#162) 2021-07-20 14:04:09 +03:00
Vlad Frangu
b9d61aed90 chore(release): 0.20.0 🎉 (#161) 2021-07-20 10:33:35 +03:00
Advaith
d009554cae chore: Add more missing stuff (#160)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

BREAKING CHANGE: `GatewayGuildMemberUpdateDispatchData#joined_at` is properly marked as nullable now

BREAKING CHANGE: In v9, `thread_id` was incorrectly placed in `RESTPostAPIWebhookWithTokenJSONBody` and has been moved to `RESTPostAPIWebhookWithTokenQuery`
2021-07-20 10:25:51 +03:00
Advaith
8dbeca0fc9 feat(RESTJSONErrorCodes): add sticker errors (#155)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-07-20 01:46:12 +03:00
Advaith
5dccc6b2a3 feat(PermissionFlagsBits): add UseExternalStickers (1n << 37n) (#154) 2021-07-20 01:29:03 +03:00
Antonio Román
323e531a77 refactor: change xID to xId (#159)
BREAKING CHANGE: All types that contained the `ID` word in them have had it renamed to `Id` (ex: `APIButtonComponentWithCustomID` is now `APIButtonComponentWithCustomId`)
2021-07-20 01:17:39 +03:00
Advaith
634f64d4ce refactor: rename isStyledButton to isInteractionButton (#158)
BREAKING CHANGE: The `isStyledButton` util has been renamed to `isInteractionButton`
2021-07-20 00:43:48 +03:00
Vlad Frangu
ecaf52008b chore(release): 0.19.0 🎉 (#157) 2021-07-19 22:10:57 +03:00
Vlad Frangu
86e0736726 chore: Get up to date *again* (#156)
Co-authored-by: monbrey <rsm999@uowmail.edu.au>

* Added `DiscordCertifiedModerator` flag to UserFlags

* Updated types for Message Components
  * Added `disabled` to APISelectMenuCompponent
  * Cleaned up Buttons types, making them stricter based on the `style` you provide

BREAKING CHANGE: `APISelectOption` has been renamed to `APISelectMenuOption`

BREAKING CHANGE: APISelectMenuOption#default is now properly marked as optional

* Updated OAuth2 Application types

BREAKING CHANGE: `APIApplication#owner` is now marked as optional, per the docs

* Correct APIAuditLogChangeKeyNick's key

BREAKING CHANGE: This renames APIAuditLogChangeKeyNick's key from `mute` to `nick`

* Add `application_id` to APIMessage
* Correct type of `id` and `user_id` in APIThreadMember

BREAKING CHANGE: The type of `id` and `user_id` in APIThreadMember are now marked as optional; read the TSDoc for when it's actually optional

* Correctly version API route in RouteBases

BREAKING CHANGE: This changes the `RouteBases.api` to be versioned based on the API version you're importing. **Make sure to update your code to handle that**

* Added new guild features
ref: 4d36e533cf

* Cleaned up interaction types

BREAKING CHANGE: While this shouldn't be necessary, this is a warning that types for interactions HAVE changed and you may need to update your code. For the most part, the types *should* be the same, more accurate and strictly typed. You will also see that every type of interaction has a Guild/DM counterpart exported (ex: APIApplicationCommandGuildInteraction vs APIApplicationCommandInteraction, where the former has all the guild properties, while the latter has all properties that depend on context marked as optional).

* Add TSD testing support in CI
This is mostly useful for testing unions of types

* Add message property to MessageComponent interactions
2021-07-19 22:00:20 +03:00
모메MoMe
ca933ae84d fix(RESTPostAPIWebhookWithTokenJSONBody): add missing components (#152) 2021-07-18 18:51:25 +03:00
Advaith
4a836293d5 feat(Stickers): sticker packs, sticker routes, and guild stickers (#145)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-07-07 17:07:32 +03:00
Shubham Parihar
836e8fb294 feat: add stage instance related typings to audit logs (#151) 2021-07-03 20:25:45 +03:00
Vlad Frangu
c5b6091c43 chore: deprecate old @next versions (#150) 2021-07-03 17:55:04 +03:00
Shubham Parihar
5256ac7f97 feat(APIGuild): add nsfw_level (#149) 2021-07-03 16:46:45 +03:00
ckohen
f393ba520d feat(Threads): add typed thread creation (#148)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-06-24 12:30:56 +03:00
Shubham Parihar
e36ef9e1d2 feat: add typings for stage instance (#144) 2021-06-24 12:12:03 +03:00
ckohen
dd12c6ac99 fix(FormattingPatterns): fix StyledTimestamp (#147) 2021-06-24 12:09:22 +03:00
monbrey
036bb035c9 feat(Interactions): components and component interactions (#132)
Co-authored-by: nearlySplat <splatterxl@outlook.ie>
Co-authored-by: Advaith <advaithj1@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-06-19 21:18:10 +03:00
ckohen
16eae7eafe feat(FormattingPatterns): add timestamp (#146)
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-06-19 21:15:10 +03:00
ckohen
13d483ef2e feat(Channel): add embeds to post / patch (#143)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-06-16 01:51:43 +03:00
ckohen
d2b6276119 feat(Threads): add default auto archive and minor tweaks (#142) 2021-06-15 15:36:39 +03:00
Vlad Frangu
8627c9d219 fix: fix autopublish CD (#140) 2021-06-05 16:09:13 +03:00
Vlad Frangu
72043a2645 chore: add automatic npm deploys (#139) 2021-06-05 15:29:16 +03:00
ckohen
d1498c3ce2 feat: api v9 and threads (#133)
* feat: api v9 and threads

* fix: address review comments
2021-06-02 10:06:40 +03:00
Carter
7b47fc9680 feat(RESTErrors): add types for rest errors (#122)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-05-26 00:14:56 +03:00
Vlad Frangu
c4e69c9ce3 chore: don't install huskies in CI 2021-05-26 00:13:36 +03:00
Vlad Frangu
ca6612e0a4 chore(RESTErrorCodes): correct casing for OAuth
BREAKING CHANGE: This properly capitalizes certain error codes with the right OAuth capitalization
2021-05-22 16:25:41 +03:00
Vlad Frangu
63e5e8b7ab chore: update all the deps
build: deno build for 8111146265bbfe527daabfe852292d9c0803d8be
2021-05-22 13:54:42 +03:00
Vlad Frangu
8fdf8c4453 chore(Husky): update to Husky v6 (#135) 2021-05-22 13:43:52 +03:00
Vlad Frangu
f0b2766d5b fix(RESTOAuth2): correct casing of OAuth (#134)
BREAKING CHANGE: `RESTGetAPIOauth2CurrentApplicationResult` and `RESTGetAPIOauth2CurrentAuthorizationResult` have been renamed to `RESTGetAPIOAuth2CurrentApplicationResult ` and `RESTGetAPIOAuth2CurrentAuthorizationResult`, to correct the casing of `OAuth`

build: deno build for 03c88f5a49ba74ea87a35efb27cb75c2e4d0aa44

chore: fix Actions

build: deno build for d5a7b8d8ceee1530f941da7c1e2d6281cf1ea3ba
2021-05-22 13:07:24 +03:00
Jan
aa5e26d92b refactor(Enums): make property casing consistent (#131)
BREAKING CHANGE: Enum keys have been normalized, and they are all PascalCased now (for API v8 and above). API v6 did not receive these changes.
2021-05-11 23:58:27 +03:00
Vlad Frangu
557b969f35 chore(release): 0.18.1 🎉 (#130) 2021-05-03 23:34:40 +03:00
Jan
bd638b97e5 feat: add new interfaces for interaction-related structures (#129) 2021-05-03 23:19:17 +03:00
Advaith
44b956ad85 fix(APIInvite): expires_at is nullable (#128) 2021-04-30 19:58:16 +03:00
Advaith
82ca0ce5c4 feat(APIInvite): add expires_at field and with_expiration param (#127) 2021-04-30 19:32:24 +03:00
Advaith
91afb0bb49 feat(ApplicationCommandOptionType): add MENTIONABLE (9) (#126) 2021-04-28 20:42:22 +03:00
Vlad Frangu
653b9ff17f chore(release): 0.18.0 🎉 (#125) 2021-04-18 11:03:16 +03:00
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
Vlad Frangu
2636bd0949 chore: release 0.13.0 (#99) 2021-03-27 18:15:41 +02:00
Advaith
ceb787ba36 feat(PermissionFlagsBits): add USE_APPLICATION_COMMANDS (#85)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-03-27 18:09:47 +02:00
Ben Richeson
ca61396577 chore(APIApplicationCommandInteractionDataOption): add types and their values (#72)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-03-27 18:06:35 +02:00
Advaith
0582f883c5 feat(APIBaseInteraction): add application_id (#98)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-03-27 17:40:14 +02:00
didinele
9d8d090c9c fix(RESTPostAPIChannelMessageJSONBody): mark tts as a full boolean (#96) 2021-03-17 10:02:14 +02:00
Vlad Frangu
eb3f8e1dea chore: add missing GitHub mds (#95) 2021-03-17 01:04:10 +02:00
Advaith
24155aeb71 feat(APIApplicationCommandInteractionData): add resolved (#86)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-03-16 01:05:44 +02:00
Advaith
76651acd49 chore(APIInteractionResponse, APIInteractionResponseType): remove old response types (#94)
Because they're out :3

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-03-16 01:03:32 +02:00
Advaith
92f76f1a3c feat(APIApplication): add ApplicationFlags (#92)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-03-16 01:01:30 +02:00
Advaith
0f29b32e05 feat(APIMessage): add interaction (#93)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-03-16 01:00:04 +02:00
Apacheopteryx
7343fabe82 fix(deno): replace const enum exports in deno with normal enums (#89)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-03-16 00:56:02 +02:00
Advaith
d0b3106758 feat(APIInteraction): DM slash commands and property descriptions (#84)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-03-16 00:50:46 +02:00
Advaith
eafe7ba96f feat(APIInteractionResponse, APIInteractionResponseType): update for UI changes (#90) 2021-03-08 00:06:12 +02:00
Vlad Frangu
ff761755a6 chore: miscellaneous tasks (#77)
Co-authored-by: Noel <buechler.noel@outlook.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-02-18 19:20:46 +01:00
cherryblossom000
ae1900dc2f fix(RESTPostAPIGuildsJSONBody): make some fields nullable (#91) 2021-02-17 12:46:46 +02:00
didinele
466fa95b0e feat(rest): api base routes (#87)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-02-13 01:05:13 +02:00
aetheryx
70bfe9f4aa chore(Gateway): clarify Heartbeat OP as bidirectional (#83) 2021-02-06 19:01:58 +02:00
Vlad Frangu
63096d807d chore: add missing audit log keys (#81)
ref: https://github.com/discord/discord-api-docs/pull/2570
2021-02-05 22:29:00 +02:00
Advaith
855f36d930 feat(APIMessageReferenceSend): add fail_if_not_exists (#82) 2021-02-04 21:44:11 +02:00
Vlad Frangu
3bf9738a72 chore: shorten regular expression group properties (#80)
They are now strictly `id`, `name`, or `animated`.
2021-02-03 00:47:20 +02:00
Carter
4e4a084003 feat: implement FormatPatterns (#79)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-02-03 00:25:59 +02:00
TTtie
75ed123018 chore(APIGuildMember): make premium_since not optional (#78) 2021-01-29 23:28:35 +02:00
Vlad Frangu
5826da22e3 feat: add GET single Application Command (#76) 2021-01-26 23:47:37 +02:00
Vlad Frangu
da2c2e9ada feat: add Application Command events (#75) 2021-01-26 23:47:24 +02:00
Advaith
4c77a5d90a feat(Webhook): add Edit Webhook Message result and error 50027 (#71) 2021-01-26 21:59:23 +02:00
Advaith
84759d19bc feat(OAuth2): add /oauth2/@me route (#73) 2021-01-21 22:02:59 +02:00
Vlad Frangu
999b3594d8 chore: release 0.12.1 (#70)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-01-05 10:41:23 +02:00
Advaith
549a6f0236 feat: add Snowflake and Permissions types (#69)
Nice.
2021-01-05 02:54:11 +02:00
Vlad Frangu
35bd1f7dcd chore: move deno path from .deno to deno; update readme (#67) 2021-01-04 15:54:37 +02:00
Vlad Frangu
0ef46202f6 fix: run deno workflow only on branch push (#66) 2021-01-02 00:09:14 +02:00
Vlad Frangu
6464fe9932 chore(chores): All the chores! And release 0.12.0 (#62)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: cherryblossom000 <31467609+cherryblossom000@users.noreply.github.com>
2021-01-01 23:33:43 +02:00
Jan
664ad800cc fix(APIApplication): flags should be omitted in REST, not optional everywhere (#57) 2020-12-26 19:22:41 +02:00
didinele
15892ec870 fix(RESTPatchAPIChannelJSONBody): add missing bitrate field (#60) 2020-12-25 21:53:41 +02:00
Advaith
dccdfe044f feat(GatewayActivity): add missing fields (#39)
Co-authored-by: Jan <66554238+Vaporox@users.noreply.github.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2020-12-24 15:29:33 +02:00
Advaith
70b427bbb3 chore(interactions): add permissions property to received member (#56) 2020-12-24 15:29:05 +02:00
didinele
c28ef6c3d9 chore: RESTPatchAPIGuildJSONBody system_channel_flags is optional; release 0.11.2 (#55) 2020-12-20 18:48:52 +02:00
Vlad Frangu
8c43eae001 chore: release 0.11.1 (#54) 2020-12-19 17:51:44 +02:00
didinele
ba4c0d78f4 fix(RESTPostAPIGuildsJSONBody): system_channel_flags is optional (#53) 2020-12-19 16:29:52 +02:00
didinele
2b89beb52b fix(APIAuditLogEntry): user_id is not nullable (#52) 2020-12-19 16:00:08 +02:00
298 changed files with 54841 additions and 4268 deletions

3
.babelrc Normal file
View File

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

76
.github/CODE_OF_CONDUCT.md vendored Normal file
View File

@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at https://discord.gg/djs. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

91
.github/COMMIT_CONVENTION.md vendored Normal file
View File

@@ -0,0 +1,91 @@
## Git Commit Message Convention
> This is adapted from [Angular's commit convention](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular).
#### TL;DR:
Messages must be matched by the following regex:
```js
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|types|wip)(\(.+\))?: .{1,72}/;
```
#### Examples
Appears under "Features" header, `GuildMember` subheader:
```
feat(GuildMember): add 'tag' method
```
Appears under "Bug Fixes" header, `Guild` subheader, with a link to issue #28:
```
fix(Guild): handle events correctly
close #28
```
Appears under "Performance Improvements" header, and under "Breaking Changes" with the breaking change explanation:
```
perf(core): improve patching by removing 'bar' option
BREAKING CHANGE: The 'bar' option has been removed.
```
The following commit and commit `667ecc1` do not appear in the changelog if they are under the same release. If not, the revert commit appears under the "Reverts" header.
```
revert: feat(Managers): add Managers
This reverts commit 667ecc1654a317a13331b17617d973392f415f02.
```
### Full Message Format
A commit message consists of a **header**, **body** and **footer**. The header has a **type**, **scope** and **subject**:
```
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
```
The **header** is mandatory and the **scope** of the header is optional.
### Revert
If the commit reverts a previous commit, it should begin with `revert:`, followed by the header of the reverted commit. In the body, it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
### Type
If the prefix is `feat`, `fix` or `perf`, it will appear in the changelog. However, if there is any [BREAKING CHANGE](#footer), the commit will always appear in the changelog.
Other prefixes are up to your discretion. Suggested prefixes are `docs`, `chore`, `style`, `refactor`, and `test` for non-changelog related tasks.
### Scope
The scope could be anything specifying the place of the commit change. For example `GuildMember`, `Guild`, `Message`, `MessageEmbed` etc...
### Subject
The subject contains a succinct description of the change:
- use the imperative, present tense: "change" not "changed" nor "changes"
- don't capitalize the first letter
- no dot (.) at the end
### Body
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
The body should include the motivation for the change and contrast this with previous behavior.
### Footer
The footer should contain any information about **Breaking Changes** and is also the place to
reference GitHub issues that this commit **Closes**.
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.

53
.github/CONTRIBUTING.md vendored Normal file
View File

@@ -0,0 +1,53 @@
# discord-api-types Contributing Guide
**The issue tracker is only for bug reports and enhancement suggestions. If you have a question, please ask it in the [Discord server](https://discord.gg/djs) instead of opening an issue, or on [GitHub Discussions](https://github.com/discordjs/discord-api-types/discussions) you will get redirected there anyway.**
- [Code of Conduct](https://github.com/discordjs/discord-api-types/blob/main/.github/CODE_OF_CONDUCT.md)
- [Pull Request Guidelines](#pull-request-guidelines)
- [Development Setup](#development-setup)
- [Project Structure](#project-structure)
- [Contributing Tests](#contributing-tests)
## Pull Request Guidelines
- Checkout a topic branch from a base branch, e.g. `main`, and merge back against that branch.
- If adding a new feature:
- Provide a convincing reason to add this feature. Ideally, you should open a suggestion issue first and have it approved before working on it.
- If fixing a bug:
- If you are resolving a special issue, add `fix/close #xxxx[,#xxxx]` (#xxxx is the issue id) in your PR body for a better release log, e.g.
```
fix(Guild): handle events correctly
close #28
```
- Provide a detailed description of the bug in the PR. Live demo preferred.
- It's OK to have multiple small commits as you work on the PR - GitHub can automatically squash them before merging.
- Make sure tests pass!
- Commit messages must follow the [commit message convention](./COMMIT_CONVENTION.md) so that changelogs can be automatically generated. Commit messages are automatically validated before commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [husky](https://github.com/typicode/husky)).
- No need to worry about code style as long as you have installed the dev dependencies - modified files are automatically formatted with Prettier on commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [husky](https://github.com/typicode/husky)).
## Development Setup
You will need [Node.js](http://nodejs.org) **version 12+**, and [npm](https://www.npmjs.com/).
After cloning the repo, run:
```bash
$ npm i # install the dependencies of the project
```
A high level overview of tools used:
- [TypeScript](https://www.typescriptlang.org/) as the development language
- [ESLint](https://eslint.org/) for code-style
- [Prettier](https://prettier.io/) for code formatting

25
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,25 @@
---
name: Bug report
about: Report incorrect or unexpected behavior of discord-api-types
title: ''
labels: 'bug'
assignees: ''
---
<!-- Use Discord for questions: https://discord.gg/djs -->
**Please describe the problem you are having in as much detail as possible:**
**Include a reproducible code sample here, if possible:**
```ts
// Place your code here
```
**Further details:**
- Runtime:
<!-- Complete whichever is applicable -->
- Node.js version:
- deno version:
- Priority this issue should have please be realistic and elaborate if possible:

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Discord server
url: https://discord.gg/djs
about: Please visit our Discord server for questions and support requests.

View File

@@ -0,0 +1,21 @@
---
name: Feature request
about: Request a feature for the discord-api-types library
title: ''
labels: 'discussion'
assignees: ''
---
<!-- Use Discord for questions: https://discord.gg/djs -->
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Eg. I'm always frustrated when [...]
**Describe the ideal solution**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

3
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,3 @@
**Please describe the changes this PR makes and why it should be merged:**
**Reference Discord API Docs PRs or commits:**

8
.github/SUPPORT.md vendored Normal file
View File

@@ -0,0 +1,8 @@
# Seeking support?
We only use this issue tracker for bug reports and feature request. We are not able to provide general support or answer questions in the form of GitHub issues.
For general questions about discord-api-types installation and use please ask in [GitHub Discussions](https://github.com/discordjs/discord-api-types/discussions),
or in the dedicated support channels in our Discord server: https://discord.gg/djs
Any issues that don't directly involve a bug or a feature request will likely be closed and redirected.

85
.github/workflows/cicd.yml vendored Normal file
View File

@@ -0,0 +1,85 @@
name: Continuous Integration / Deployment
on:
push:
branches:
- '**'
pull_request:
jobs:
testing:
name: ESLint and TypeScript compilation
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Use Node.js v16
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install Dependencies
run: npm ci
- name: Run ESLint
run: npm run test:lint
- name: Run TSC
run: npm run build:ci
deno:
name: Generate Deno compatible code
runs-on: ubuntu-latest
needs: testing
# Run workflow only if testing passes
if: needs.testing.result == 'success'
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Use Node.js v16
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install Dependencies
run: npm ci
- name: Build Files
run: npm run build:deno
- name: Set Git User and Email
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Commit and Push New Code
run: |
git add --all .
git commit -m "build: deno build for ${GITHUB_SHA}" || true
git push || true
tsd:
name: TSD checks
runs-on: ubuntu-latest
needs: testing
if: needs.testing.result == 'success'
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Use Node.js v16
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install Dependencies
run: npm ci
- name: Run TSD
run: npm run test:types

View File

@@ -1,42 +0,0 @@
name: Code Quality
on:
push:
branches:
- master
- main
- stable
pull_request:
jobs:
ESLint:
name: ESLint
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v1
- name: Use Node.js 14
uses: actions/setup-node@v1
with:
node-version: 14
- name: Install Dependencies
run: npm ci
- name: Run ESLint
uses: icrawl/action-eslint@v1
with:
custom-glob: '{v*,default,common}/**'
TypeScript:
name: TypeScript
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v1
- name: Use Node.js 14
uses: actions/setup-node@v1
with:
node-version: 14
- name: Install Dependencies
run: npm ci
- name: Run TSC
uses: icrawl/action-tsc@v1

42
.github/workflows/publish-next.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Publish next
on:
workflow_dispatch:
schedule:
- cron: '0 */12 * * *'
jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install Node v16
uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Bump version
run: npx standard-version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Deprecate old versions
run: npm deprecate discord-api-types@"~$(jq --raw-output '.version' package.json)-next" "No longer supported. Install the latest @next release" || true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Publish new version
run: |
npm version --git-tag-version=false $(jq --raw-output '.version' package.json)-next.$(git rev-parse --short HEAD).$(date +%s)
npm publish --tag next || true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

56
.gitignore vendored
View File

@@ -1,21 +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*.js
v*.*map
v*.d.ts
v*.mjs
default/*.js
default/*.map
default/*.d.ts
gateway/**/*.js
gateway/**/*.map
gateway/**/*.d.ts
gateway/**/*.mjs
common/*.js
common/*.map
common/*.d.ts
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

1
.husky/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
_

4
.husky/commit-msg Normal file
View File

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

4
.husky/pre-commit Normal file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install pretty-quick --staged && npx --no-install lint-staged && npm run build:deno && git add deno

5
.npmrc Normal file
View File

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

8
.prettierrc.json Normal file
View File

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

4
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,4 @@
{
"files.eol": "\n",
"typescript.tsdk": "node_modules/typescript/lib"
}

537
CHANGELOG.md Normal file
View File

@@ -0,0 +1,537 @@
# [0.23.0](https://github.com/discordjs/discord-api-types/compare/0.22.0...0.23.0) (2021-09-07)
### Bug Fixes
- **AuditLog:** correct `nickname` type ([#189](https://github.com/discordjs/discord-api-types/issues/189)) ([64937e2](https://github.com/discordjs/discord-api-types/commit/64937e2311bf5e688f6789d9e66827e980e4e01c))
- **Embed:** correct certain optional types as being required ([#192](https://github.com/discordjs/discord-api-types/issues/192)) ([e628f0f](https://github.com/discordjs/discord-api-types/commit/e628f0f6f089a0840b9d69bea930dd3ad7fa7462))
- import causing error 404 on deno ([#178](https://github.com/discordjs/discord-api-types/issues/178)) ([8fcd0f2](https://github.com/discordjs/discord-api-types/commit/8fcd0f2222a77a1a0b19888d699e98d450268cc8))
### chore
- **Gateway:** remove `APPLICATION_COMMAND_*` events ([#191](https://github.com/discordjs/discord-api-types/issues/191)) ([d590caf](https://github.com/discordjs/discord-api-types/commit/d590caf359b61aa77780385437929f443cbf4a26))
### Features
- **APIApplicationCommand:** add `version` field ([#193](https://github.com/discordjs/discord-api-types/issues/193)) ([ecbed18](https://github.com/discordjs/discord-api-types/commit/ecbed180424c0975c52208f0f803b08f105df04a))
- **APIUser:** add `banner` and `accent_color` ([#183](https://github.com/discordjs/discord-api-types/issues/183)) ([b07b903](https://github.com/discordjs/discord-api-types/commit/b07b9030c134fdaf53f500d319c88067c1a8a175))
- **Interactions:** context menu items ([#166](https://github.com/discordjs/discord-api-types/issues/166)) ([fdc1c1a](https://github.com/discordjs/discord-api-types/commit/fdc1c1a5b411d8ef3d635ad90bd97c2b1bf77cf1))
- **JSONErrorCodes:** add `160002` ([#190](https://github.com/discordjs/discord-api-types/issues/190)) ([8b49887](https://github.com/discordjs/discord-api-types/commit/8b49887c7f732fe88cadb1e6ca17e0dc12db25f9))
- **MessageType:** add ContextMenuCommand and rename ApplicationCommand to ChatInputCommand ([#180](https://github.com/discordjs/discord-api-types/issues/180)) ([0024823](https://github.com/discordjs/discord-api-types/commit/0024823d053c15491011eb6d11c314e299689ba5))
- **Threads:** add `invitable` ([#185](https://github.com/discordjs/discord-api-types/issues/185)) ([b6babf2](https://github.com/discordjs/discord-api-types/commit/b6babf2ee2c66817ac99752d14feed2d574ecb14))
### BREAKING CHANGES
- **Gateway:** The three Application Command events have been removed
- **Embed:**
- `APIEmbedAuthor#name` is required, not optional
- `APIEmbedThumbnail#url` is required, not optional
- `APIEmbedImage#url` is required, not optional
# [0.22.0](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.22.0) (2021-07-31)
### Bug Fixes
- **Gateway:** thread list sync now sends an array as documented ([#174](https://github.com/discordjs/discord-api-types/issues/174)) ([a93235c](https://github.com/discordjs/discord-api-types/commit/a93235c9df2bc36a337c03e8ba08986e6e377483))
- **MessageComponent:** correct type for emoji ([#176](https://github.com/discordjs/discord-api-types/issues/176)) ([b75b05f](https://github.com/discordjs/discord-api-types/commit/b75b05f0d50014335fefc8bb8969d519ed0076d3))
### chore
- **ApplicationCommandOptionType:** casing changes for subcommands ([#175](https://github.com/discordjs/discord-api-types/issues/175)) ([f93b6be](https://github.com/discordjs/discord-api-types/commit/f93b6be2528c80f8dc038282a7d6ddb3c4685c2f))
### Features
- thread updates ([#167](https://github.com/discordjs/discord-api-types/issues/167)) ([47100bc](https://github.com/discordjs/discord-api-types/commit/47100bcf2c154146baecb359e1c00ecca9939ffa))
### BREAKING CHANGES
- **ApplicationCommandOptionType:** This renames `SubCommand` to `Subcommand`, and `SubCommandGroup` to `SubcommandGroup`
- `Routes#channelJoinedArchivedThreads` is now spelled right (from `Routes#channelJoinedArhivedThreads`)
- **Gateway:** `GatewayThreadListSync#members` is now an array of APIThreadMember instead of a Record of GatewayThreadListSyncMember
# [0.21.0](https://github.com/discordjs/discord-api-types/compare/0.20.1...0.21.0) (2021-07-30)
### Bug Fixes
- change resolved index types to string ([#169](https://github.com/discordjs/discord-api-types/issues/169)) ([d338409](https://github.com/discordjs/discord-api-types/commit/d338409410854cc1f97f9903fdc2565e1f45e778))
- export APIPingInteraction ([#168](https://github.com/discordjs/discord-api-types/issues/168)) ([ef2a0ae](https://github.com/discordjs/discord-api-types/commit/ef2a0aeb07cdd04b47e6cb0d40dd8a1b2a77b491))
- **APIInteraction:** bring back Ping type ([#164](https://github.com/discordjs/discord-api-types/issues/164)) ([ff75eb3](https://github.com/discordjs/discord-api-types/commit/ff75eb3f5dfd7597968c26133d125cfe40ee5838))
### Features
- **ApplicationCommandOptionType:** add Number (10) ([#153](https://github.com/discordjs/discord-api-types/issues/153)) ([6f15e53](https://github.com/discordjs/discord-api-types/commit/6f15e537dfee5bda383572cd725c05246c97ca62))
- **Globals:** revert template bigint type to string type ([#171](https://github.com/discordjs/discord-api-types/issues/171)) ([f299507](https://github.com/discordjs/discord-api-types/commit/f2995073e033b050ab459c42b480e626f3f6ae8e))
### Reverts
- fix: change resolved index types to string ([#172](https://github.com/discordjs/discord-api-types/issues/172)) ([647905e](https://github.com/discordjs/discord-api-types/commit/647905e16bfeb689e644695657ac5f05920c0c4c))
### BREAKING CHANGES
- **Globals:** The type for Snowflake and Permissions is reverted from the `${bigint}` template type back to a normal string type
## [0.20.2](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.20.2) (2021-07-21)
### Bug Fixes
- **APIInteraction:** bring back Ping type ([#164](https://github.com/discordjs/discord-api-types/issues/164)) ([ff75eb3](https://github.com/discordjs/discord-api-types/commit/ff75eb3f5dfd7597968c26133d125cfe40ee5838))
## [0.20.1](https://github.com/discordjs/discord-api-types/compare/0.20.0...0.20.1) (2021-07-20)
### Features
- **Interactions:** add interaction response and followup route ([#162](https://github.com/discordjs/discord-api-types/issues/162)) ([f99f07f](https://github.com/discordjs/discord-api-types/commit/f99f07f72e95a9537a955eb942b52e345c1067d6))
# [0.20.0](https://github.com/discordjs/discord-api-types/compare/0.19.0...0.20.0) (2021-07-20)
### chore
- Add more missing stuff ([#160](https://github.com/discordjs/discord-api-types/issues/160)) ([d009554](https://github.com/discordjs/discord-api-types/commit/d009554caed6c738c4a801f00806ab7cc4ac7e16))
### Code Refactoring
- change `xID` to `xId` ([#159](https://github.com/discordjs/discord-api-types/issues/159)) ([323e531](https://github.com/discordjs/discord-api-types/commit/323e531a77aa75397ee1ce59f0db35b08b80b606))
- rename `isStyledButton` to `isInteractionButton` ([#158](https://github.com/discordjs/discord-api-types/issues/158)) ([634f64d](https://github.com/discordjs/discord-api-types/commit/634f64d4ce143bd0a6b9ccf0ffb1241c21550958))
### Features
- **PermissionFlagsBits:** add `UseExternalStickers` (1n << 37n) ([#154](https://github.com/discordjs/discord-api-types/issues/154)) ([5dccc6b](https://github.com/discordjs/discord-api-types/commit/5dccc6b2a3711e14d499ee9a2122403a80da99fe))
- **RESTJSONErrorCodes:** add sticker errors ([#155](https://github.com/discordjs/discord-api-types/issues/155)) ([8dbeca0](https://github.com/discordjs/discord-api-types/commit/8dbeca0fc91cafef59eb8ee30bcfee9ab14a422c))
### BREAKING CHANGES
- `GatewayGuildMemberUpdateDispatchData#joined_at` is properly marked as nullable now
- In v9, `thread_id` was incorrectly placed in `RESTPostAPIWebhookWithTokenJSONBody` and has been moved to `RESTPostAPIWebhookWithTokenQuery`
- All types that contained the `ID` word in them have had it renamed to `Id` (ex: `APIButtonComponentWithCustomID` is now `APIButtonComponentWithCustomId`)
- The `isStyledButton` util has been renamed to `isInteractionButton`
# [0.19.0](https://github.com/discordjs/discord-api-types/compare/0.18.1...0.19.0) (2021-07-19)
### Bug Fixes
- **FormattingPatterns:** fix StyledTimestamp ([#147](https://github.com/discordjs/discord-api-types/issues/147)) ([dd12c6a](https://github.com/discordjs/discord-api-types/commit/dd12c6ac9902d1b300a167f0acd9fba5192aaa91))
- **RESTOAuth2:** correct casing of `OAuth` ([#134](https://github.com/discordjs/discord-api-types/issues/134)) ([f0b2766](https://github.com/discordjs/discord-api-types/commit/f0b2766d5b55bd9b8b8ba9c506a868dafcdca568))
- **RESTPostAPIWebhookWithTokenJSONBody:** add missing components ([#152](https://github.com/discordjs/discord-api-types/issues/152)) ([ca933ae](https://github.com/discordjs/discord-api-types/commit/ca933ae84d54456f0a443e5e8bd10b7613271f62))
- fix autopublish CD ([#140](https://github.com/discordjs/discord-api-types/issues/140)) ([8627c9d](https://github.com/discordjs/discord-api-types/commit/8627c9d2195aaa0a97de2fdf9f64ba0c0ff6db02))
### chore
- Get up to date _again_ ([#156](https://github.com/discordjs/discord-api-types/issues/156)) ([86e0736](https://github.com/discordjs/discord-api-types/commit/86e0736726fb4ef13736510fa6d69f20383d5ea5))
- **RESTErrorCodes:** correct casing for OAuth ([ca6612e](https://github.com/discordjs/discord-api-types/commit/ca6612e0a4f313731009a37a81c3a0834e6a0cd8))
### Code Refactoring
- **Enums:** make property casing consistent ([#131](https://github.com/discordjs/discord-api-types/issues/131)) ([aa5e26d](https://github.com/discordjs/discord-api-types/commit/aa5e26d92b587bf9b4fc33e038a6d3c8586597c2))
### Features
- **Stickers:** sticker packs, sticker routes, and guild stickers ([#145](https://github.com/discordjs/discord-api-types/issues/145)) ([4a83629](https://github.com/discordjs/discord-api-types/commit/4a836293d5224a6cad19c50bc074a9ef9b0f0af4))
- add stage instance related typings to audit logs ([#151](https://github.com/discordjs/discord-api-types/issues/151)) ([836e8fb](https://github.com/discordjs/discord-api-types/commit/836e8fb29491f8df72c0caf2eb5c05ed2bda3191))
- **APIGuild:** add `nsfw_level` ([#149](https://github.com/discordjs/discord-api-types/issues/149)) ([5256ac7](https://github.com/discordjs/discord-api-types/commit/5256ac7f97d35200f1676721a80ad0f57d05cab7))
- **Channel:** add embeds to post / patch ([#143](https://github.com/discordjs/discord-api-types/issues/143)) ([13d483e](https://github.com/discordjs/discord-api-types/commit/13d483ef2e53373438e8b03fed681232626b2670))
- **FormattingPatterns:** add timestamp ([#146](https://github.com/discordjs/discord-api-types/issues/146)) ([16eae7e](https://github.com/discordjs/discord-api-types/commit/16eae7eafe9ef6001f664a30c0f78d6982d2e54c))
- **RESTErrors:** add types for rest errors ([#122](https://github.com/discordjs/discord-api-types/issues/122)) ([7b47fc9](https://github.com/discordjs/discord-api-types/commit/7b47fc96809aed2b28e15064f308651b08a5b74d))
- **Threads:** add typed thread creation ([#148](https://github.com/discordjs/discord-api-types/issues/148)) ([f393ba5](https://github.com/discordjs/discord-api-types/commit/f393ba520d7d6d2aacaca7b3ca5d355fab614f6e))
- add typings for stage instance ([#144](https://github.com/discordjs/discord-api-types/issues/144)) ([e36ef9e](https://github.com/discordjs/discord-api-types/commit/e36ef9e1d225d8e8c849c3198e628202eedbd20b))
- **Interactions:** components and component interactions ([#132](https://github.com/discordjs/discord-api-types/issues/132)) ([036bb03](https://github.com/discordjs/discord-api-types/commit/036bb035c9d6ddf780bab5af4884861d08f04d24))
- **Threads:** add default auto archive and minor tweaks ([#142](https://github.com/discordjs/discord-api-types/issues/142)) ([d2b6276](https://github.com/discordjs/discord-api-types/commit/d2b62761194064b38e38045a72ee8b38c920ada6))
- api v9 and threads ([#133](https://github.com/discordjs/discord-api-types/issues/133)) ([d1498c3](https://github.com/discordjs/discord-api-types/commit/d1498c3ce2eaea11c9946726ef758f7de489253b))
### BREAKING CHANGES
- `APISelectOption` has been renamed to `APISelectMenuOption`
- APISelectMenuOption#default is now properly marked as optional
- Updated OAuth2 Application types
- `APIApplication#owner` is now marked as optional, per the docs
- Correct APIAuditLogChangeKeyNick's key
- This renames APIAuditLogChangeKeyNick's key from `mute` to `nick`
- Add `application_id` to APIMessage
- Correct type of `id` and `user_id` in APIThreadMember
- The type of `id` and `user_id` in APIThreadMember are now marked as optional; read the TSDoc for when it's actually optional
- Correctly version API route in RouteBases
- This changes the `RouteBases.api` to be versioned based on the API version you're importing. **Make sure to update your code to handle that**
- Added new guild features
ref: https://github.com/discordjs/discord-api-types/pull/156/commits/4d36e533cffecbcce13e968a7803e5a68e021106
- Cleaned up interaction types
- While this shouldn't be necessary, this is a warning that types for interactions HAVE changed and you may need to update your code. For the most part, the types _should_ be the same, more accurate and strictly typed. You will also see that every type of interaction has a Guild/DM counterpart exported (ex: APIApplicationCommandGuildInteraction vs APIApplicationCommandInteraction, where the former has all the guild properties, while the latter has all properties that depend on context marked as optional).
- Add message property to MessageComponent interactions
- **RESTErrorCodes:** This properly capitalizes certain error codes with the right OAuth capitalization
- **RESTOAuth2:** `RESTGetAPIOauth2CurrentApplicationResult` and `RESTGetAPIOauth2CurrentAuthorizationResult` have been renamed to `RESTGetAPIOAuth2CurrentApplicationResult ` and `RESTGetAPIOAuth2CurrentAuthorizationResult`, to correct the casing of `OAuth`
- **Enums:** Enum keys have been normalized, and they are all PascalCased now (for API v8 and above). API v6 did not receive these changes.
## [0.18.1](https://github.com/discordjs/discord-api-types/compare/0.18.0...0.18.1) (2021-05-03)
### Bug Fixes
- **APIInvite:** `expires_at` is nullable ([#128](https://github.com/discordjs/discord-api-types/issues/128)) ([44b956a](https://github.com/discordjs/discord-api-types/commit/44b956ad858a457e7671ced38529b433b02efbde))
### Features
- add new interfaces for interaction-related structures ([#129](https://github.com/discordjs/discord-api-types/issues/129)) ([bd638b9](https://github.com/discordjs/discord-api-types/commit/bd638b97e5d26abd8a4f1edbd0f56ddc7d3a30a0))
- **APIInvite:** add `expires_at` field and `with_expiration` param ([#127](https://github.com/discordjs/discord-api-types/issues/127)) ([82ca0ce](https://github.com/discordjs/discord-api-types/commit/82ca0ce5c44ad2e93b3c4875baa82720ea8dd221))
- **ApplicationCommandOptionType:** add `MENTIONABLE` (9) ([#126](https://github.com/discordjs/discord-api-types/issues/126)) ([91afb0b](https://github.com/discordjs/discord-api-types/commit/91afb0bb49015c02b6000c27d07e703011dc540d))
# [0.18.0](https://github.com/discordjs/discord-api-types/compare/0.16.0...0.18.0) (2021-04-18)
### Bug Fixes
- **APIInvite:** `channel` is not optional ([#123](https://github.com/discordjs/discord-api-types/issues/123)) ([abe0513](https://github.com/discordjs/discord-api-types/commit/abe05136fd169f483fe09a213259b4cbd526497b))
### Code Refactoring
- **Invite:** rename `InviteTargetUserType` to `InviteTargetType` ([#124](https://github.com/discordjs/discord-api-types/issues/124)) ([bc9ab45](https://github.com/discordjs/discord-api-types/commit/bc9ab4556ca8a7c8e4c7942c87fa322c91b733dc))
### BREAKING CHANGES
- **Invite:** `InviteTargetUserType` is renamed to `InviteTargetType`, to match the documentation.
- Reference: https://github.com/discord/discord-api-docs/pull/2690
# [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

@@ -1,9 +1,11 @@
<div style="text-align:center;"><h1>Discord API Types</h1></div>
# Discord API Types
[![GitHub](https://img.shields.io/github/license/discordjs/discord-api-types)](https://github.com/discordjs/discord-api-types/blob/main/LICENSE.md)
[![npm](https://img.shields.io/npm/v/discord-api-types?color=crimson&logo=npm)](https://www.npmjs.com/package/discord-api-types)
[![deno](https://img.shields.io/npm/v/discord-api-types?color=blue&label=deno&logo=deno)](https://deno.land/x/discord_api_types)
[![Patreon Donate](https://img.shields.io/badge/patreon-donate-brightgreen.svg?label=Donate%20with%20Patreon&logo=patreon&colorB=F96854&link=https://www.patreon.com/vladfrangu)](https://www.patreon.com/vladfrangu)
[![Ko-fi Donate](https://img.shields.io/badge/kofi-donate-brightgreen.svg?label=Donate%20with%20Ko-fi&logo=ko-fi&colorB=F16061&link=https://ko-fi.com/wolfgalvlad&logoColor=FFFFFF)](https://ko-fi.com/wolfgalvlad)
[![GitHub Sponsors](https://img.shields.io/badge/patreon-donate-brightgreen.svg?label=Sponsor%20through%20GitHub&logo=github&colorB=F96854&link=https://github.com/sponsors/vladfrangu)](https://github.com/sponsors/vladfrangu)
Simple type definitions for the [Discord API](https://discord.com/developers/docs/intro).
@@ -17,11 +19,62 @@ 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/v9');
```
```ts
// TypeScript/ES Module support
import { APIUser } from 'discord-api-types/v9';
```
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/v9');
```
```ts
// TypeScript/ES Module support
import { GatewayVersion } from 'discord-api-types/gateway/v9';
```
> _**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 a specific API version
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/v9.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/v9.ts';
```
3. From [skypack.dev](https://www.skypack.dev/)
```ts
// Importing a specific API version
import { APIUser } from 'https://cdn.skypack.dev/discord-api-types/v9?dts';
```
## Project Structure
The exports of each API version is split into three main parts:
- Everything exported with the `API` prefix represents a payload you may get from the REST API *or* the Gateway.
- Everything exported with the `API` prefix represents a payload you may get from the REST API _or_ the Gateway.
- Everything exported with the `Gateway` prefix represents data that ONLY comes from or is directly related to the Gateway.
@@ -39,32 +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 datamining 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.
> We **strongly recommend** you use a version when importing this module! This will prevent breaking changes when updating the module.
```js
const { APIUser } = require('discord-api-types');
```
```ts
// TypeScript/ES Module support
import { APIUser } from 'discord-api-types';
```
You should instead consider adding the API version you want to target by appending `/v*`, where the `*` represents the API version.
```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,152 +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,
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,
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';
}

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';

537
deno/CHANGELOG.md Normal file
View File

@@ -0,0 +1,537 @@
# [0.23.0](https://github.com/discordjs/discord-api-types/compare/0.22.0...0.23.0) (2021-09-07)
### Bug Fixes
- **AuditLog:** correct `nickname` type ([#189](https://github.com/discordjs/discord-api-types/issues/189)) ([64937e2](https://github.com/discordjs/discord-api-types/commit/64937e2311bf5e688f6789d9e66827e980e4e01c))
- **Embed:** correct certain optional types as being required ([#192](https://github.com/discordjs/discord-api-types/issues/192)) ([e628f0f](https://github.com/discordjs/discord-api-types/commit/e628f0f6f089a0840b9d69bea930dd3ad7fa7462))
- import causing error 404 on deno ([#178](https://github.com/discordjs/discord-api-types/issues/178)) ([8fcd0f2](https://github.com/discordjs/discord-api-types/commit/8fcd0f2222a77a1a0b19888d699e98d450268cc8))
### chore
- **Gateway:** remove `APPLICATION_COMMAND_*` events ([#191](https://github.com/discordjs/discord-api-types/issues/191)) ([d590caf](https://github.com/discordjs/discord-api-types/commit/d590caf359b61aa77780385437929f443cbf4a26))
### Features
- **APIApplicationCommand:** add `version` field ([#193](https://github.com/discordjs/discord-api-types/issues/193)) ([ecbed18](https://github.com/discordjs/discord-api-types/commit/ecbed180424c0975c52208f0f803b08f105df04a))
- **APIUser:** add `banner` and `accent_color` ([#183](https://github.com/discordjs/discord-api-types/issues/183)) ([b07b903](https://github.com/discordjs/discord-api-types/commit/b07b9030c134fdaf53f500d319c88067c1a8a175))
- **Interactions:** context menu items ([#166](https://github.com/discordjs/discord-api-types/issues/166)) ([fdc1c1a](https://github.com/discordjs/discord-api-types/commit/fdc1c1a5b411d8ef3d635ad90bd97c2b1bf77cf1))
- **JSONErrorCodes:** add `160002` ([#190](https://github.com/discordjs/discord-api-types/issues/190)) ([8b49887](https://github.com/discordjs/discord-api-types/commit/8b49887c7f732fe88cadb1e6ca17e0dc12db25f9))
- **MessageType:** add ContextMenuCommand and rename ApplicationCommand to ChatInputCommand ([#180](https://github.com/discordjs/discord-api-types/issues/180)) ([0024823](https://github.com/discordjs/discord-api-types/commit/0024823d053c15491011eb6d11c314e299689ba5))
- **Threads:** add `invitable` ([#185](https://github.com/discordjs/discord-api-types/issues/185)) ([b6babf2](https://github.com/discordjs/discord-api-types/commit/b6babf2ee2c66817ac99752d14feed2d574ecb14))
### BREAKING CHANGES
- **Gateway:** The three Application Command events have been removed
- **Embed:**
- `APIEmbedAuthor#name` is required, not optional
- `APIEmbedThumbnail#url` is required, not optional
- `APIEmbedImage#url` is required, not optional
# [0.22.0](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.22.0) (2021-07-31)
### Bug Fixes
- **Gateway:** thread list sync now sends an array as documented ([#174](https://github.com/discordjs/discord-api-types/issues/174)) ([a93235c](https://github.com/discordjs/discord-api-types/commit/a93235c9df2bc36a337c03e8ba08986e6e377483))
- **MessageComponent:** correct type for emoji ([#176](https://github.com/discordjs/discord-api-types/issues/176)) ([b75b05f](https://github.com/discordjs/discord-api-types/commit/b75b05f0d50014335fefc8bb8969d519ed0076d3))
### chore
- **ApplicationCommandOptionType:** casing changes for subcommands ([#175](https://github.com/discordjs/discord-api-types/issues/175)) ([f93b6be](https://github.com/discordjs/discord-api-types/commit/f93b6be2528c80f8dc038282a7d6ddb3c4685c2f))
### Features
- thread updates ([#167](https://github.com/discordjs/discord-api-types/issues/167)) ([47100bc](https://github.com/discordjs/discord-api-types/commit/47100bcf2c154146baecb359e1c00ecca9939ffa))
### BREAKING CHANGES
- **ApplicationCommandOptionType:** This renames `SubCommand` to `Subcommand`, and `SubCommandGroup` to `SubcommandGroup`
- `Routes#channelJoinedArchivedThreads` is now spelled right (from `Routes#channelJoinedArhivedThreads`)
- **Gateway:** `GatewayThreadListSync#members` is now an array of APIThreadMember instead of a Record of GatewayThreadListSyncMember
# [0.21.0](https://github.com/discordjs/discord-api-types/compare/0.20.1...0.21.0) (2021-07-30)
### Bug Fixes
- change resolved index types to string ([#169](https://github.com/discordjs/discord-api-types/issues/169)) ([d338409](https://github.com/discordjs/discord-api-types/commit/d338409410854cc1f97f9903fdc2565e1f45e778))
- export APIPingInteraction ([#168](https://github.com/discordjs/discord-api-types/issues/168)) ([ef2a0ae](https://github.com/discordjs/discord-api-types/commit/ef2a0aeb07cdd04b47e6cb0d40dd8a1b2a77b491))
- **APIInteraction:** bring back Ping type ([#164](https://github.com/discordjs/discord-api-types/issues/164)) ([ff75eb3](https://github.com/discordjs/discord-api-types/commit/ff75eb3f5dfd7597968c26133d125cfe40ee5838))
### Features
- **ApplicationCommandOptionType:** add Number (10) ([#153](https://github.com/discordjs/discord-api-types/issues/153)) ([6f15e53](https://github.com/discordjs/discord-api-types/commit/6f15e537dfee5bda383572cd725c05246c97ca62))
- **Globals:** revert template bigint type to string type ([#171](https://github.com/discordjs/discord-api-types/issues/171)) ([f299507](https://github.com/discordjs/discord-api-types/commit/f2995073e033b050ab459c42b480e626f3f6ae8e))
### Reverts
- fix: change resolved index types to string ([#172](https://github.com/discordjs/discord-api-types/issues/172)) ([647905e](https://github.com/discordjs/discord-api-types/commit/647905e16bfeb689e644695657ac5f05920c0c4c))
### BREAKING CHANGES
- **Globals:** The type for Snowflake and Permissions is reverted from the `${bigint}` template type back to a normal string type
## [0.20.2](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.20.2) (2021-07-21)
### Bug Fixes
- **APIInteraction:** bring back Ping type ([#164](https://github.com/discordjs/discord-api-types/issues/164)) ([ff75eb3](https://github.com/discordjs/discord-api-types/commit/ff75eb3f5dfd7597968c26133d125cfe40ee5838))
## [0.20.1](https://github.com/discordjs/discord-api-types/compare/0.20.0...0.20.1) (2021-07-20)
### Features
- **Interactions:** add interaction response and followup route ([#162](https://github.com/discordjs/discord-api-types/issues/162)) ([f99f07f](https://github.com/discordjs/discord-api-types/commit/f99f07f72e95a9537a955eb942b52e345c1067d6))
# [0.20.0](https://github.com/discordjs/discord-api-types/compare/0.19.0...0.20.0) (2021-07-20)
### chore
- Add more missing stuff ([#160](https://github.com/discordjs/discord-api-types/issues/160)) ([d009554](https://github.com/discordjs/discord-api-types/commit/d009554caed6c738c4a801f00806ab7cc4ac7e16))
### Code Refactoring
- change `xID` to `xId` ([#159](https://github.com/discordjs/discord-api-types/issues/159)) ([323e531](https://github.com/discordjs/discord-api-types/commit/323e531a77aa75397ee1ce59f0db35b08b80b606))
- rename `isStyledButton` to `isInteractionButton` ([#158](https://github.com/discordjs/discord-api-types/issues/158)) ([634f64d](https://github.com/discordjs/discord-api-types/commit/634f64d4ce143bd0a6b9ccf0ffb1241c21550958))
### Features
- **PermissionFlagsBits:** add `UseExternalStickers` (1n << 37n) ([#154](https://github.com/discordjs/discord-api-types/issues/154)) ([5dccc6b](https://github.com/discordjs/discord-api-types/commit/5dccc6b2a3711e14d499ee9a2122403a80da99fe))
- **RESTJSONErrorCodes:** add sticker errors ([#155](https://github.com/discordjs/discord-api-types/issues/155)) ([8dbeca0](https://github.com/discordjs/discord-api-types/commit/8dbeca0fc91cafef59eb8ee30bcfee9ab14a422c))
### BREAKING CHANGES
- `GatewayGuildMemberUpdateDispatchData#joined_at` is properly marked as nullable now
- In v9, `thread_id` was incorrectly placed in `RESTPostAPIWebhookWithTokenJSONBody` and has been moved to `RESTPostAPIWebhookWithTokenQuery`
- All types that contained the `ID` word in them have had it renamed to `Id` (ex: `APIButtonComponentWithCustomID` is now `APIButtonComponentWithCustomId`)
- The `isStyledButton` util has been renamed to `isInteractionButton`
# [0.19.0](https://github.com/discordjs/discord-api-types/compare/0.18.1...0.19.0) (2021-07-19)
### Bug Fixes
- **FormattingPatterns:** fix StyledTimestamp ([#147](https://github.com/discordjs/discord-api-types/issues/147)) ([dd12c6a](https://github.com/discordjs/discord-api-types/commit/dd12c6ac9902d1b300a167f0acd9fba5192aaa91))
- **RESTOAuth2:** correct casing of `OAuth` ([#134](https://github.com/discordjs/discord-api-types/issues/134)) ([f0b2766](https://github.com/discordjs/discord-api-types/commit/f0b2766d5b55bd9b8b8ba9c506a868dafcdca568))
- **RESTPostAPIWebhookWithTokenJSONBody:** add missing components ([#152](https://github.com/discordjs/discord-api-types/issues/152)) ([ca933ae](https://github.com/discordjs/discord-api-types/commit/ca933ae84d54456f0a443e5e8bd10b7613271f62))
- fix autopublish CD ([#140](https://github.com/discordjs/discord-api-types/issues/140)) ([8627c9d](https://github.com/discordjs/discord-api-types/commit/8627c9d2195aaa0a97de2fdf9f64ba0c0ff6db02))
### chore
- Get up to date _again_ ([#156](https://github.com/discordjs/discord-api-types/issues/156)) ([86e0736](https://github.com/discordjs/discord-api-types/commit/86e0736726fb4ef13736510fa6d69f20383d5ea5))
- **RESTErrorCodes:** correct casing for OAuth ([ca6612e](https://github.com/discordjs/discord-api-types/commit/ca6612e0a4f313731009a37a81c3a0834e6a0cd8))
### Code Refactoring
- **Enums:** make property casing consistent ([#131](https://github.com/discordjs/discord-api-types/issues/131)) ([aa5e26d](https://github.com/discordjs/discord-api-types/commit/aa5e26d92b587bf9b4fc33e038a6d3c8586597c2))
### Features
- **Stickers:** sticker packs, sticker routes, and guild stickers ([#145](https://github.com/discordjs/discord-api-types/issues/145)) ([4a83629](https://github.com/discordjs/discord-api-types/commit/4a836293d5224a6cad19c50bc074a9ef9b0f0af4))
- add stage instance related typings to audit logs ([#151](https://github.com/discordjs/discord-api-types/issues/151)) ([836e8fb](https://github.com/discordjs/discord-api-types/commit/836e8fb29491f8df72c0caf2eb5c05ed2bda3191))
- **APIGuild:** add `nsfw_level` ([#149](https://github.com/discordjs/discord-api-types/issues/149)) ([5256ac7](https://github.com/discordjs/discord-api-types/commit/5256ac7f97d35200f1676721a80ad0f57d05cab7))
- **Channel:** add embeds to post / patch ([#143](https://github.com/discordjs/discord-api-types/issues/143)) ([13d483e](https://github.com/discordjs/discord-api-types/commit/13d483ef2e53373438e8b03fed681232626b2670))
- **FormattingPatterns:** add timestamp ([#146](https://github.com/discordjs/discord-api-types/issues/146)) ([16eae7e](https://github.com/discordjs/discord-api-types/commit/16eae7eafe9ef6001f664a30c0f78d6982d2e54c))
- **RESTErrors:** add types for rest errors ([#122](https://github.com/discordjs/discord-api-types/issues/122)) ([7b47fc9](https://github.com/discordjs/discord-api-types/commit/7b47fc96809aed2b28e15064f308651b08a5b74d))
- **Threads:** add typed thread creation ([#148](https://github.com/discordjs/discord-api-types/issues/148)) ([f393ba5](https://github.com/discordjs/discord-api-types/commit/f393ba520d7d6d2aacaca7b3ca5d355fab614f6e))
- add typings for stage instance ([#144](https://github.com/discordjs/discord-api-types/issues/144)) ([e36ef9e](https://github.com/discordjs/discord-api-types/commit/e36ef9e1d225d8e8c849c3198e628202eedbd20b))
- **Interactions:** components and component interactions ([#132](https://github.com/discordjs/discord-api-types/issues/132)) ([036bb03](https://github.com/discordjs/discord-api-types/commit/036bb035c9d6ddf780bab5af4884861d08f04d24))
- **Threads:** add default auto archive and minor tweaks ([#142](https://github.com/discordjs/discord-api-types/issues/142)) ([d2b6276](https://github.com/discordjs/discord-api-types/commit/d2b62761194064b38e38045a72ee8b38c920ada6))
- api v9 and threads ([#133](https://github.com/discordjs/discord-api-types/issues/133)) ([d1498c3](https://github.com/discordjs/discord-api-types/commit/d1498c3ce2eaea11c9946726ef758f7de489253b))
### BREAKING CHANGES
- `APISelectOption` has been renamed to `APISelectMenuOption`
- APISelectMenuOption#default is now properly marked as optional
- Updated OAuth2 Application types
- `APIApplication#owner` is now marked as optional, per the docs
- Correct APIAuditLogChangeKeyNick's key
- This renames APIAuditLogChangeKeyNick's key from `mute` to `nick`
- Add `application_id` to APIMessage
- Correct type of `id` and `user_id` in APIThreadMember
- The type of `id` and `user_id` in APIThreadMember are now marked as optional; read the TSDoc for when it's actually optional
- Correctly version API route in RouteBases
- This changes the `RouteBases.api` to be versioned based on the API version you're importing. **Make sure to update your code to handle that**
- Added new guild features
ref: https://github.com/discordjs/discord-api-types/pull/156/commits/4d36e533cffecbcce13e968a7803e5a68e021106
- Cleaned up interaction types
- While this shouldn't be necessary, this is a warning that types for interactions HAVE changed and you may need to update your code. For the most part, the types _should_ be the same, more accurate and strictly typed. You will also see that every type of interaction has a Guild/DM counterpart exported (ex: APIApplicationCommandGuildInteraction vs APIApplicationCommandInteraction, where the former has all the guild properties, while the latter has all properties that depend on context marked as optional).
- Add message property to MessageComponent interactions
- **RESTErrorCodes:** This properly capitalizes certain error codes with the right OAuth capitalization
- **RESTOAuth2:** `RESTGetAPIOauth2CurrentApplicationResult` and `RESTGetAPIOauth2CurrentAuthorizationResult` have been renamed to `RESTGetAPIOAuth2CurrentApplicationResult ` and `RESTGetAPIOAuth2CurrentAuthorizationResult`, to correct the casing of `OAuth`
- **Enums:** Enum keys have been normalized, and they are all PascalCased now (for API v8 and above). API v6 did not receive these changes.
## [0.18.1](https://github.com/discordjs/discord-api-types/compare/0.18.0...0.18.1) (2021-05-03)
### Bug Fixes
- **APIInvite:** `expires_at` is nullable ([#128](https://github.com/discordjs/discord-api-types/issues/128)) ([44b956a](https://github.com/discordjs/discord-api-types/commit/44b956ad858a457e7671ced38529b433b02efbde))
### Features
- add new interfaces for interaction-related structures ([#129](https://github.com/discordjs/discord-api-types/issues/129)) ([bd638b9](https://github.com/discordjs/discord-api-types/commit/bd638b97e5d26abd8a4f1edbd0f56ddc7d3a30a0))
- **APIInvite:** add `expires_at` field and `with_expiration` param ([#127](https://github.com/discordjs/discord-api-types/issues/127)) ([82ca0ce](https://github.com/discordjs/discord-api-types/commit/82ca0ce5c44ad2e93b3c4875baa82720ea8dd221))
- **ApplicationCommandOptionType:** add `MENTIONABLE` (9) ([#126](https://github.com/discordjs/discord-api-types/issues/126)) ([91afb0b](https://github.com/discordjs/discord-api-types/commit/91afb0bb49015c02b6000c27d07e703011dc540d))
# [0.18.0](https://github.com/discordjs/discord-api-types/compare/0.16.0...0.18.0) (2021-04-18)
### Bug Fixes
- **APIInvite:** `channel` is not optional ([#123](https://github.com/discordjs/discord-api-types/issues/123)) ([abe0513](https://github.com/discordjs/discord-api-types/commit/abe05136fd169f483fe09a213259b4cbd526497b))
### Code Refactoring
- **Invite:** rename `InviteTargetUserType` to `InviteTargetType` ([#124](https://github.com/discordjs/discord-api-types/issues/124)) ([bc9ab45](https://github.com/discordjs/discord-api-types/commit/bc9ab4556ca8a7c8e4c7942c87fa322c91b733dc))
### BREAKING CHANGES
- **Invite:** `InviteTargetUserType` is renamed to `InviteTargetType`, to match the documentation.
- Reference: https://github.com/discord/discord-api-docs/pull/2690
# [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))

21
deno/LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 vladfrangu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

97
deno/README.md Normal file
View File

@@ -0,0 +1,97 @@
# Discord API Types
[![GitHub](https://img.shields.io/github/license/discordjs/discord-api-types)](https://github.com/discordjs/discord-api-types/blob/main/LICENSE.md)
[![npm](https://img.shields.io/npm/v/discord-api-types?color=crimson&logo=npm)](https://www.npmjs.com/package/discord-api-types)
[![deno](https://img.shields.io/npm/v/discord-api-types?color=blue&label=deno&logo=deno)](https://deno.land/x/discord_api_types)
[![Patreon Donate](https://img.shields.io/badge/patreon-donate-brightgreen.svg?label=Donate%20with%20Patreon&logo=patreon&colorB=F96854&link=https://www.patreon.com/vladfrangu)](https://www.patreon.com/vladfrangu)
[![Ko-fi Donate](https://img.shields.io/badge/kofi-donate-brightgreen.svg?label=Donate%20with%20Ko-fi&logo=ko-fi&colorB=F16061&link=https://ko-fi.com/wolfgalvlad&logoColor=FFFFFF)](https://ko-fi.com/wolfgalvlad)
[![GitHub Sponsors](https://img.shields.io/badge/patreon-donate-brightgreen.svg?label=Sponsor%20through%20GitHub&logo=github&colorB=F96854&link=https://github.com/sponsors/vladfrangu)](https://github.com/sponsors/vladfrangu)
Simple type definitions for the [Discord API](https://discord.com/developers/docs/intro).
## Installation
Install with [npm](https://www.npmjs.com/) / [yarn](https://yarnpkg.com) / [pnpm](https://pnpm.js.org/):
```sh
npm install discord-api-types
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/v9');
```
```ts
// TypeScript/ES Module support
import { APIUser } from 'discord-api-types/v9';
```
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/v9');
```
```ts
// TypeScript/ES Module support
import { GatewayVersion } from 'discord-api-types/gateway/v9';
```
> _**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 a specific API version
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/v9.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/v9.ts';
```
3. From [skypack.dev](https://www.skypack.dev/)
```ts
// Importing a specific API version
import { APIUser } from 'https://cdn.skypack.dev/discord-api-types/v9?dts';
```
## Project Structure
The exports of each API version is split into three main parts:
- Everything exported with the `API` prefix represents a payload you may get from the REST API _or_ the Gateway.
- Everything exported with the `Gateway` prefix represents data that ONLY comes from or is directly related to the Gateway.
- Everything exported with the `REST` prefix represents data that ONLY comes from or is directly related to the REST API.
- For endpoint options, they will follow the following structure: `REST<HTTP Method><Type><Query|(JSON|FormData)Body|Result>` where the type represents what it will return.
- For example, `RESTPostAPIChannelMessageJSONBody` or `RESTGetAPIGatewayBotInfoResult`.
- Some exported types (specifically OAuth2 related ones) may not respect this entire structure due to the nature of the fields. They will start with either `RESTOAuth2` or with something similar to `REST<HTTP Method>OAuth2`
- If a type ends with `Result`, then it represents the expected result by calling its accompanying route.
- Types that are exported as `never` usually mean the result will be a `204 No Content`, so you can safely ignore it. This does **not** account for errors.
- Anything else that is miscellaneous will be exported based on what it represents (for example the `REST` route object).
- There may be types exported that are identical for all versions. These will be exported as is and can be found in the `globals` file. They will still be prefixed accordingly as described above.
**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.

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 './v9.ts';

File diff suppressed because it is too large Load Diff

1575
deno/gateway/v8.ts Normal file

File diff suppressed because it is too large Load Diff

1664
deno/gateway/v9.ts Normal file

File diff suppressed because it is too large Load Diff

88
deno/globals.ts Normal file
View File

@@ -0,0 +1,88 @@
/**
* https://discord.com/developers/docs/reference#snowflakes
*/
export type Snowflake = string;
/**
* https://discord.com/developers/docs/topics/permissions
* @internal
*/
export type Permissions = string;
/**
* 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})>/,
/**
* Regular expression for matching a timestamp, either default or custom styled
*
* The `timestamp` and `style` group properties are present on the `exec` result of this expression
*/
Timestamp: /<t:(?<timestamp>-?\d{1,13})(:(?<style>[tTdDfFR]))?>/,
/**
* Regular expression for matching strictly default styled timestamps
*
* The `timestamp` group property is present on the `exec` result of this expression
*/
DefaultStyledTimestamp: /<t:(?<timestamp>-?\d{1,13})>/,
/**
* Regular expression for matching strictly custom styled timestamps
*
* The `timestamp` and `style` group properties are present on the `exec` result of this expression
*/
StyledTimestamp: /<t:(?<timestamp>-?\d{1,13}):(?<style>[tTdDfFR])>/,
} 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 './v9/mod.ts';

View File

@@ -2,7 +2,7 @@
* Types extracted from https://discord.com/developers/docs/resources/audit-log
*/
import type { APIOverwrite, ChannelType } from './channel';
import type { APIOverwrite, ChannelType } from './channel.ts';
import type {
APIGuildIntegration,
GuildDefaultMessageNotifications,
@@ -10,13 +10,14 @@ import type {
GuildMFALevel,
GuildVerificationLevel,
IntegrationExpireBehavior,
} from './guild';
import type { APIRole } from './permissions';
import type { APIUser } from './user';
import type { APIWebhook } from './webhook';
} from './guild.ts';
import type { APIRole } from './permissions.ts';
import type { APIUser } from './user.ts';
import type { APIWebhook } from './webhook.ts';
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIAuditLog {
webhooks: APIWebhook[];
@@ -27,6 +28,7 @@ export interface APIAuditLog {
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIAuditLogEntry {
target_id: string | null;
@@ -40,8 +42,9 @@ export interface APIAuditLogEntry {
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum AuditLogEvent {
export enum AuditLogEvent {
GUILD_UPDATE = 1,
CHANNEL_CREATE = 10,
@@ -89,6 +92,7 @@ export const enum AuditLogEvent {
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIAuditLogOptions {
/**
@@ -154,13 +158,17 @@ export interface APIAuditLogOptions {
role_name?: string;
}
export const enum AuditLogOptionsType {
Role = '0',
Member = '1',
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum AuditLogOptionsType {
Member = 'member',
Role = 'role',
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChange =
| APIAuditLogChangeKeyName
@@ -189,11 +197,14 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyApplicationID
| APIAuditLogChangeKeyRateLimitPerUser
| APIAuditLogChangeKeyPermissions
| APIAuditLogChangeKeyPermissionsNew
| APIAuditLogChangeKeyColor
| APIAuditLogChangeKeyHoist
| APIAuditLogChangeKeyMentionable
| APIAuditLogChangeKeyAllow
| APIAuditLogChangeKeyAllowNew
| APIAuditLogChangeKeyDeny
| APIAuditLogChangeKeyDenyNew
| APIAuditLogChangeKeyCode
| APIAuditLogChangeKeyChannelID
| APIAuditLogChangeKeyInviterID
@@ -213,51 +224,61 @@ export type APIAuditLogChange =
/**
* Returned when a guild's name is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyName = AuditLogChangeData<'name', string>;
/**
* Returned when a guild's icon is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyIconHash = AuditLogChangeData<'icon_hash', string>;
/**
* Returned when a guild's splash is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeySplashHash = AuditLogChangeData<'splash_hash', string>;
/**
* Returned when a guild's owner ID is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyOwnerID = AuditLogChangeData<'owner_id', string>;
/**
* Returned when a guild's region is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyRegion = AuditLogChangeData<'region', string>;
/**
* Returned when a guild's afk_channel_id is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyAFKChannelID = AuditLogChangeData<'afk_channel_id', string>;
/**
* Returned when a guild's afk_timeout is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyAFKTimeout = AuditLogChangeData<'afk_timeout', number>;
/**
* Returned when a guild's mfa_level is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyMFALevel = AuditLogChangeData<'mfa_level', GuildMFALevel>;
/**
* Returned when a guild's verification_level is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyVerificationLevel = AuditLogChangeData<'verification_level', GuildVerificationLevel>;
/**
* Returned when a guild's explicit_content_filter is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyExplicitContentFilter = AuditLogChangeData<
'explicit_content_filter',
@@ -266,6 +287,7 @@ export type APIAuditLogChangeKeyExplicitContentFilter = AuditLogChangeData<
/**
* Returned when a guild's default_message_notifications is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyDefaultMessageNotifications = AuditLogChangeData<
'default_message_notifications',
@@ -274,162 +296,215 @@ export type APIAuditLogChangeKeyDefaultMessageNotifications = AuditLogChangeData
/**
* Returned when a guild's vanity_url_code is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyVanityURLCode = AuditLogChangeData<'vanity_url_code', string>;
/**
* Returned when new role(s) are added
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKey$Add = AuditLogChangeData<'$add', APIRole[]>;
/**
* Returned when role(s) are removed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKey$Remove = AuditLogChangeData<'$remove', APIRole[]>;
/**
* Returned when there is a change in number of days after which inactive and role-unassigned members are kicked
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyPruneDeleteDays = AuditLogChangeData<'prune_delete_days', number>;
/**
* Returned when a guild's widget is enabled
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyWidgetEnabled = AuditLogChangeData<'widget_enabled', boolean>;
/**
* Returned when a guild's widget_channel_id is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyWidgetChannelID = AuditLogChangeData<'widget_channel_id', string>;
/**
* Returned when a guild's system_channel_id is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeySystemChannelID = AuditLogChangeData<'system_channel_id', string>;
/**
* Returned when a channel's position is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyPosition = AuditLogChangeData<'position', number>;
/**
* Returned when a channel's topic is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyTopic = AuditLogChangeData<'topic', string>;
/**
* Returned when a voice channel's bitrate is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyBitrate = AuditLogChangeData<'bitrate', number>;
/**
* Returned when a channel's permission overwrites is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyPermissionOverwrites = AuditLogChangeData<'permission_overwrites', APIOverwrite[]>;
/**
* Returned when a channel's NSFW restriction is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyNSFW = AuditLogChangeData<'nsfw', boolean>;
/**
* The application ID of the added or removed Webhook or Bot
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyApplicationID = AuditLogChangeData<'application_id', string>;
/**
* Returned when a channel's amount of seconds a user has to wait before sending another message
* is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyRateLimitPerUser = AuditLogChangeData<'rate_limit_per_user', number>;
/**
* Returned when a permission bitfield is changed
* @deprecated Use `permissions_new` instead
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyPermissions = AuditLogChangeData<'permissions', string>;
export type APIAuditLogChangeKeyPermissions = AuditLogChangeData<'permissions', number>;
/**
* Returned when a permission bitfield is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyPermissionsNew = AuditLogChangeData<'permissions_new', string>;
/**
* Returned when a role's color is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyColor = AuditLogChangeData<'color', number>;
/**
* Returned when a role's hoist status is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyHoist = AuditLogChangeData<'hoist', boolean>;
/**
* Returned when a role's mentionable status is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyMentionable = AuditLogChangeData<'mentionable', boolean>;
/**
* Returned when an overwrite's allowed permissions bitfield is changed
* @deprecated Use `allow_new` instead
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyAllow = AuditLogChangeData<'allow', string>;
export type APIAuditLogChangeKeyAllow = AuditLogChangeData<'allow', number>;
/**
* Returned when an overwrite's allowed permissions bitfield is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyAllowNew = AuditLogChangeData<'allow_new', string>;
/**
* Returned when an overwrite's denied permissions bitfield is changed
* @deprecated Use `deny_new` instead
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyDeny = AuditLogChangeData<'deny', string>;
export type APIAuditLogChangeKeyDeny = AuditLogChangeData<'deny', number>;
/**
* Returned when an overwrite's denied permissions bitfield is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyDenyNew = AuditLogChangeData<'deny_new', string>;
/**
* Returned when an invite's code is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyCode = AuditLogChangeData<'code', string>;
/**
* Returned when an invite's channel_id is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyChannelID = AuditLogChangeData<'channel_id', string>;
/**
* Returned when an invite's inviter_id is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyInviterID = AuditLogChangeData<'inviter_id', string>;
/**
* Returned when an invite's max_uses is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyMaxUses = AuditLogChangeData<'max_uses', number>;
/**
* Returned when an invite's uses is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyUses = AuditLogChangeData<'uses', number>;
/**
* Returned when an invite's max_age is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyMaxAge = AuditLogChangeData<'max_age', number>;
/**
* Returned when an invite's temporary status is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyTemporary = AuditLogChangeData<'temporary', boolean>;
/**
* Returned when a user's deaf status is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyDeaf = AuditLogChangeData<'deaf', boolean>;
/**
* Returned when a user's mute status is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyMute = AuditLogChangeData<'mute', boolean>;
/**
* Returned when a user's nick is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'mute', boolean>;
/**
* Returned when a user's avatar_hash is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyAvatarHash = AuditLogChangeData<'avatar_hash', string>;
/**
* The ID of the changed entity - sometimes used in conjunction with other keys
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIAuditLogChangeKeyID {
key: 'id';
@@ -439,26 +514,31 @@ export interface APIAuditLogChangeKeyID {
/**
* The type of entity created
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyType = AuditLogChangeData<'type', ChannelType | string>;
/**
* Returned when an integration's enable_emoticons is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyEnableEmoticons = AuditLogChangeData<'enable_emoticons', boolean>;
/**
* Returned when an integration's expire_behavior is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyExpireBehavior = AuditLogChangeData<'expire_behavior', IntegrationExpireBehavior>;
/**
* Returned when an integration's expire_grace_period is changed
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIAuditLogChangeKeyExpireGracePeriod = AuditLogChangeData<'expire_grace_period', number>;
/**
* @internal
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
interface AuditLogChangeData<K extends string, D extends unknown> {
key: K;

View File

@@ -2,12 +2,13 @@
* Types extracted from https://discord.com/developers/docs/resources/channel
*/
import type { APIPartialEmoji } from './emoji';
import type { APIGuildMember } from './guild';
import type { APIUser } from './user';
import type { APIPartialEmoji } from './emoji.ts';
import type { APIGuildMember } from './guild.ts';
import type { APIUser } from './user.ts';
/**
* Not documented, but partial only includes id, name, and type
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIPartialChannel {
id: string;
@@ -17,6 +18,7 @@ export interface APIPartialChannel {
/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIChannel extends APIPartialChannel {
guild_id?: string;
@@ -39,8 +41,9 @@ export interface APIChannel extends APIPartialChannel {
/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum ChannelType {
export enum ChannelType {
GUILD_TEXT = 0,
DM,
GUILD_VOICE,
@@ -52,6 +55,7 @@ export const enum ChannelType {
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIMessage {
id: string;
@@ -79,13 +83,13 @@ export interface APIMessage {
message_reference?: APIMessageReference;
flags?: MessageFlags;
referenced_message?: APIMessage | null;
stickers?: APISticker[];
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum MessageType {
export enum MessageType {
DEFAULT,
RECIPIENT_ADD,
RECIPIENT_REMOVE,
@@ -103,11 +107,11 @@ export const enum MessageType {
GUILD_DISCOVERY_REQUALIFIED,
GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING,
GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING,
REPLY = 19,
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIMessageActivity {
type: MessageActivityType;
@@ -116,6 +120,7 @@ export interface APIMessageActivity {
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-application-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIMessageApplication {
id: string;
@@ -127,17 +132,19 @@ export interface APIMessageApplication {
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIMessageReference {
message_id?: string;
channel_id?: string;
channel_id: string;
guild_id?: string;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-activity-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum MessageActivityType {
export enum MessageActivityType {
JOIN = 1,
SPECTATE,
LISTEN,
@@ -146,41 +153,19 @@ export const enum MessageActivityType {
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-flags
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum MessageFlags {
export enum MessageFlags {
CROSSPOSTED = 1 << 0,
IS_CROSSPOST = 1 << 1,
SUPPRESS_EMBEDS = 1 << 2,
SOURCE_MESSAGE_DELETED = 1 << 3,
URGENT = 1 << 4,
EPHEMERAL = 1 << 6,
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure
*/
export interface APISticker {
id: string;
pack_id: string;
name: string;
description: string;
tags?: string;
asset: string;
preview_asset: string | null;
format_type: StickerFormatType;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types
*/
export const enum StickerFormatType {
PNG = 1,
APNG,
LOTTIE,
}
/**
* https://discord.com/developers/docs/resources/channel#reaction-object-reaction-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIReaction {
count: number;
@@ -190,21 +175,34 @@ export interface APIReaction {
/**
* https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIOverwrite {
id: string;
type: OverwriteType;
allow: string;
deny: string;
/**
* @deprecated Use `allow_new` instead
*/
allow: number;
allow_new: string;
/**
* @deprecated Use `deny_new` instead
*/
deny: number;
deny_new: string;
}
export const enum OverwriteType {
Role,
Member,
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum OverwriteType {
Member = 'member',
Role = 'role',
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbed {
title?: string;
@@ -228,8 +226,9 @@ export interface APIEmbed {
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-types
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum EmbedType {
export enum EmbedType {
Rich = 'rich',
Image = 'image',
Video = 'video',
@@ -240,6 +239,7 @@ export const enum EmbedType {
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedThumbnail {
url?: string;
@@ -250,6 +250,7 @@ export interface APIEmbedThumbnail {
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedVideo {
url?: string;
@@ -259,6 +260,7 @@ export interface APIEmbedVideo {
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedImage {
url?: string;
@@ -269,6 +271,7 @@ export interface APIEmbedImage {
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedProvider {
name?: string;
@@ -277,6 +280,7 @@ export interface APIEmbedProvider {
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedAuthor {
name?: string;
@@ -287,6 +291,7 @@ export interface APIEmbedAuthor {
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedFooter {
text: string;
@@ -296,6 +301,7 @@ export interface APIEmbedFooter {
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedField {
name: string;
@@ -305,6 +311,7 @@ export interface APIEmbedField {
/**
* https://discord.com/developers/docs/resources/channel#attachment-object-attachment-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIAttachment {
id: string;
@@ -318,6 +325,7 @@ export interface APIAttachment {
/**
* https://discord.com/developers/docs/resources/channel#channel-mention-object-channel-mention-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIChannelMention {
id: string;
@@ -326,6 +334,9 @@ export interface APIChannelMention {
name: string;
}
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIFollowedChannel {
channel_id: string;
webhook_id: string;

View File

@@ -2,10 +2,11 @@
* Types extracted from https://discord.com/developers/docs/resources/emoji
*/
import type { APIUser } from './user';
import type { APIUser } from './user.ts';
/**
* Not documented but mentioned
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIPartialEmoji {
id: string | null;
@@ -15,6 +16,7 @@ export interface APIPartialEmoji {
/**
* https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmoji extends APIPartialEmoji {
roles?: string[];

View File

@@ -2,11 +2,12 @@
* Types extracted from https://discord.com/developers/docs/topics/gateway
*/
import type { APIEmoji } from './emoji';
import type { APIUser } from './user';
import type { APIEmoji } from './emoji.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGatewayInfo {
url: string;
@@ -14,6 +15,7 @@ export interface APIGatewayInfo {
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway-bot
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGatewayBotInfo extends APIGatewayInfo {
shards: number;
@@ -22,6 +24,7 @@ export interface APIGatewayBotInfo extends APIGatewayInfo {
/**
* https://discord.com/developers/docs/topics/gateway#session-start-limit-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGatewaySessionStartLimit {
total: number;
@@ -31,18 +34,26 @@ export interface APIGatewaySessionStartLimit {
/**
* https://discord.com/developers/docs/topics/gateway#presence-update-presence-update-event-fields
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayPresenceUpdate {
user: Partial<APIUser> & {
id: string;
};
roles?: string[];
game?: GatewayActivity | null;
guild_id?: string;
status?: PresenceUpdateStatus;
activities?: GatewayActivity[];
client_status?: GatewayPresenceClientStatus;
premium_since?: string | null;
nick?: string | null;
}
export const enum PresenceUpdateStatus {
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export enum PresenceUpdateStatus {
DoNotDisturb = 'dnd',
Idle = 'idle',
Invisible = 'invisible',
@@ -52,11 +63,13 @@ export const enum PresenceUpdateStatus {
/**
* https://discord.com/developers/docs/topics/gateway#client-status-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayPresenceClientStatus = Partial<Record<'desktop' | 'mobile' | 'web', PresenceUpdateStatus>>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-structure
* https://discord.com/developers/docs/topics/gateway#activity-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayActivity {
name: string;
@@ -77,8 +90,9 @@ export interface GatewayActivity {
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum ActivityType {
export enum ActivityType {
Game,
Streaming,
Listening,
@@ -89,6 +103,7 @@ export const enum ActivityType {
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-timestamps
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayActivityTimestamps {
start?: number;
@@ -97,20 +112,23 @@ export interface GatewayActivityTimestamps {
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-emoji
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayActivityEmoji = Partial<Pick<APIEmoji, 'name' | 'animated'>> & Pick<APIEmoji, 'id'>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-party
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayActivityParty {
id?: string;
// eslint-disable-next-line prettier/prettier
size?: [currentSize: number, maxSize: number];
size?: [currentSize: number, maxSize: number];
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-assets
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayActivityAssets = Partial<
Record<'large_image' | 'large_text' | 'small_image' | 'small_text', string>
@@ -118,13 +136,15 @@ export type GatewayActivityAssets = Partial<
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-secrets
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type GatewayActivitySecrets = Partial<Record<'join' | 'spectate' | 'match', string>>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-flags
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum ActivityFlags {
export enum ActivityFlags {
INSTANCE = 1 << 0,
JOIN = 1 << 1,
SPECTATE = 1 << 2,

View File

@@ -2,15 +2,16 @@
* Types extracted from https://discord.com/developers/docs/resources/guild
*/
import type { APIChannel } from './channel';
import type { APIEmoji } from './emoji';
import type { GatewayPresenceUpdate, PresenceUpdateStatus } from './gateway';
import type { APIRole } from './permissions';
import type { APIUser } from './user';
import type { GatewayVoiceState } from './voice';
import type { APIChannel } from './channel.ts';
import type { APIEmoji } from './emoji.ts';
import type { GatewayPresenceUpdate } from './gateway.ts';
import type { APIRole } from './permissions.ts';
import type { APIUser } from './user.ts';
import type { GatewayVoiceState } from './voice.ts';
/**
* https://discord.com/developers/docs/resources/guild#unavailable-guild-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIUnavailableGuild {
id: string;
@@ -18,7 +19,7 @@ export interface APIUnavailableGuild {
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIPartialGuild extends Omit<APIUnavailableGuild, 'unavailable'>, Pick<APIGuild, 'welcome_screen'> {
name: string;
@@ -33,19 +34,28 @@ export interface APIPartialGuild extends Omit<APIUnavailableGuild, 'unavailable'
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuild extends APIPartialGuild {
icon_hash?: string | null;
discovery_splash: string | null;
owner?: boolean;
owner_id: string;
permissions?: string;
/**
* @deprecated Use `permissions_new` instead
*/
permissions?: number;
permissions_new?: string;
region: string;
afk_channel_id: string | null;
afk_timeout: number;
widget_enabled?: boolean;
widget_channel_id?: string | null;
/**
* @deprecated Use `widget_enabled` instead
*/
embed_enabled?: boolean;
/**
* @deprecated Use `widget_channel_id` instead
*/
embed_channel_id?: string | null;
verification_level: GuildVerificationLevel;
default_message_notifications: GuildDefaultMessageNotifications;
explicit_content_filter: GuildExplicitContentFilter;
@@ -54,6 +64,8 @@ export interface APIGuild extends APIPartialGuild {
features: GuildFeature[];
mfa_level: GuildMFALevel;
application_id: string | null;
widget_enabled?: boolean;
widget_channel_id?: string | null;
system_channel_id: string | null;
system_channel_flags: GuildSystemChannelFlags;
rules_channel_id: string | null;
@@ -87,16 +99,18 @@ export interface APIGuild extends APIPartialGuild {
/**
* https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum GuildDefaultMessageNotifications {
export enum GuildDefaultMessageNotifications {
ALL_MESSAGES,
ONLY_MENTIONS,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum GuildExplicitContentFilter {
export enum GuildExplicitContentFilter {
DISABLED,
MEMBERS_WITHOUT_ROLES,
ALL_MEMBERS,
@@ -104,16 +118,18 @@ export const enum GuildExplicitContentFilter {
/**
* https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum GuildMFALevel {
export enum GuildMFALevel {
NONE,
ELEVATED,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-verification-level
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum GuildVerificationLevel {
export enum GuildVerificationLevel {
NONE,
LOW,
MEDIUM,
@@ -123,8 +139,9 @@ export const enum GuildVerificationLevel {
/**
* https://discord.com/developers/docs/resources/guild#guild-object-premium-tier
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum GuildPremiumTier {
export enum GuildPremiumTier {
NONE,
TIER_1,
TIER_2,
@@ -133,16 +150,18 @@ export const enum GuildPremiumTier {
/**
* https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum GuildSystemChannelFlags {
export enum GuildSystemChannelFlags {
SUPPRESS_JOIN_NOTIFICATIONS = 1 << 0,
SUPPRESS_PREMIUM_SUBSCRIPTIONS = 1 << 1,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-features
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum GuildFeature {
export enum GuildFeature {
ANIMATED_ICON = 'ANIMATED_ICON',
BANNER = 'BANNER',
COMMERCE = 'COMMERCE',
@@ -161,6 +180,7 @@ export const enum GuildFeature {
/**
* https://discord.com/developers/docs/resources/guild#guild-preview-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildPreview {
id: string;
@@ -174,50 +194,24 @@ export interface APIGuildPreview {
approximate_presence_count: number;
}
/**
* @deprecated Use `APIGuildWidgetSettings` instead
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export type APIGuildWidget = APIGuildWidgetSettings;
/**
* https://discord.com/developers/docs/resources/guild#guild-widget-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildWidgetSettings {
enabled: boolean;
channel_id: string | null;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
*/
export interface APIGuildWidget {
id: string;
name: string;
instant_invite: string | null;
channels: APIGuildWidgetChannel[];
members: APIGuildWidgetMember[];
presence_count: number;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
*/
export interface APIGuildWidgetChannel {
id: string;
name: string;
position: number;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
*/
export interface APIGuildWidgetMember {
id: string;
username: string;
discriminator: string;
avatar: string | null;
status: PresenceUpdateStatus;
activity?: { name: string };
avatar_url: string;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildMember {
user?: APIUser;
@@ -227,40 +221,42 @@ export interface APIGuildMember {
premium_since?: string | null;
deaf: boolean;
mute: boolean;
pending?: boolean;
}
/**
* https://discord.com/developers/docs/resources/guild#integration-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildIntegration {
id: string;
name: string;
type: string;
enabled: boolean;
syncing?: boolean;
role_id?: string;
syncing: boolean;
role_id: string;
enable_emoticons?: boolean;
expire_behavior?: IntegrationExpireBehavior;
expire_grace_period?: number;
expire_behavior: IntegrationExpireBehavior;
expire_grace_period: number;
user?: APIUser;
account: APIIntegrationAccount;
synced_at?: string;
subscriber_count?: number;
revoked?: boolean;
synced_at: string;
subscriber_count: number;
revoked: boolean;
application?: APIGuildIntegrationApplication;
}
/**
* https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum IntegrationExpireBehavior {
export enum IntegrationExpireBehavior {
RemoveRole,
Kick,
}
/**
* https://discord.com/developers/docs/resources/guild#integration-account-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIIntegrationAccount {
id: string;
@@ -269,6 +265,7 @@ export interface APIIntegrationAccount {
/**
* https://discord.com/developers/docs/resources/guild#integration-application-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildIntegrationApplication {
id: string;
@@ -281,6 +278,7 @@ export interface APIGuildIntegrationApplication {
/**
* https://discord.com/developers/docs/resources/guild#ban-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIBan {
reason: string | null;
@@ -289,8 +287,9 @@ export interface APIBan {
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-image-widget-style-options
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum GuildWidgetStyle {
export enum GuildWidgetStyle {
Banner1 = 'banner1',
Banner2 = 'banner2',
Banner3 = 'banner3',
@@ -298,11 +297,17 @@ export const enum GuildWidgetStyle {
Shield = 'shield',
}
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildWelcomeScreen {
description: string | null;
welcome_channels: APIGuildWelcomeScreenChannel[];
}
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIGuildWelcomeScreenChannel {
channel_id: string;
emoji_id: string | null;

View File

@@ -2,12 +2,13 @@
* Types extracted from https://discord.com/developers/docs/resources/invite
*/
import type { APIPartialChannel } from './channel';
import type { APIPartialGuild } from './guild';
import type { APIUser } from './user';
import type { APIPartialChannel } from './channel.ts';
import type { APIPartialGuild } from './guild.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/resources/invite#invite-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIInvite {
code: string;
@@ -22,13 +23,15 @@ export interface APIInvite {
/**
* https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum InviteTargetUserType {
export enum InviteTargetUserType {
STREAM = 1,
}
/**
* https://discord.com/developers/docs/resources/invite#invite-metadata-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIExtendedInvite extends APIInvite {
uses: number;

12
deno/payloads/v6/mod.ts Normal file
View File

@@ -0,0 +1,12 @@
export * from './auditLog.ts';
export * from './channel.ts';
export * from './emoji.ts';
export * from './gateway.ts';
export * from './guild.ts';
export * from './invite.ts';
export * from './oauth2.ts';
export * from './permissions.ts';
export * from './teams.ts';
export * from './user.ts';
export * from './voice.ts';
export * from './webhook.ts';

View File

@@ -2,11 +2,12 @@
* Types extracted from https://discord.com/developers/docs/topics/oauth2
*/
import type { APITeam } from './teams';
import type { APIUser } from './user';
import type { APITeam } from './teams.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information-response-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIApplication {
id: string;
@@ -24,5 +25,4 @@ export interface APIApplication {
primary_sku_id?: string;
slug?: string;
cover_image?: string;
flags?: number;
}

View File

@@ -2,10 +2,11 @@
* Types extracted from https://discord.com/developers/docs/topics/teams
*/
import type { APIUser } from './user';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/topics/teams#data-models-team-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APITeam {
id: string;
@@ -16,6 +17,7 @@ export interface APITeam {
/**
* https://discord.com/developers/docs/topics/teams#data-models-team-members-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APITeamMember {
membership_state: TeamMemberMembershipState;
@@ -26,8 +28,9 @@ export interface APITeamMember {
/**
* https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum TeamMemberMembershipState {
export enum TeamMemberMembershipState {
INVITED = 1,
ACCEPTED,
}

View File

@@ -2,10 +2,11 @@
* Types extracted from https://discord.com/developers/docs/resources/user
*/
import type { APIGuildIntegration } from './guild';
import type { APIGuildIntegration } from './guild.ts';
/**
* https://discord.com/developers/docs/resources/user#user-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIUser {
id: string;
@@ -25,8 +26,9 @@ export interface APIUser {
/**
* https://discord.com/developers/docs/resources/user#user-object-user-flags
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum UserFlags {
export enum UserFlags {
None = 0,
DiscordEmployee = 1 << 0,
PartneredServerOwner = 1 << 1,
@@ -45,8 +47,9 @@ export const enum UserFlags {
/**
* https://discord.com/developers/docs/resources/user#user-object-premium-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export const enum UserPremiumType {
export enum UserPremiumType {
None,
NitroClassic,
Nitro,
@@ -54,6 +57,7 @@ export const enum UserPremiumType {
/**
* https://discord.com/developers/docs/resources/user#connection-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIConnection {
id: string;
@@ -67,7 +71,10 @@ export interface APIConnection {
visibility: ConnectionVisibility;
}
export const enum ConnectionVisibility {
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum ConnectionVisibility {
None,
Everyone,
}

View File

@@ -2,10 +2,11 @@
* Types extracted from https://discord.com/developers/docs/resources/voice
*/
import type { APIGuildMember } from './guild';
import type { APIGuildMember } from './guild.ts';
/**
* https://discord.com/developers/docs/resources/voice#voice-state-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface GatewayVoiceState {
guild_id?: string;
@@ -24,6 +25,7 @@ export interface GatewayVoiceState {
/**
* https://discord.com/developers/docs/resources/voice#voice-region-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIVoiceRegion {
id: string;

View File

@@ -2,12 +2,13 @@
* Types extracted from https://discord.com/developers/docs/resources/webhook
*/
import type { APIPartialChannel } from './channel';
import type { APIPartialGuild } from './guild';
import type { APIUser } from './user';
import type { APIPartialChannel } from './channel.ts';
import type { APIPartialGuild } from './guild.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/resources/webhook#webhook-object
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIWebhook {
id: string;
@@ -23,7 +24,10 @@ export interface APIWebhook {
application_id: string | null;
}
export const enum WebhookType {
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum WebhookType {
Incoming = 1,
ChannelFollower,
}

View File

@@ -0,0 +1,192 @@
import type { APIRole, APIUser } from '../../mod.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands.ts';
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Channel
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
description: string;
default?: boolean;
required?: boolean;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandOption =
| APIApplicationCommandArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandOptionBase;
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
*/
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
options?: APIApplicationCommandOption[];
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
* but they can have a `choices` one
*/
export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type:
| ApplicationCommandOptionType.String
| ApplicationCommandOptionType.Integer
| ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export enum ApplicationCommandOptionType {
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
Number,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
value: string | number;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
| ApplicationCommandInteractionDataOptionSubCommandGroup
| APIApplicationCommandInteractionDataOptionWithValues;
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.Subcommand;
options: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubcommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionString
| ApplicationCommandInteractionDataOptionRole
| ApplicationCommandInteractionDataOptionChannel
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| ApplicationCommandInteractionDataOptionNumber
| ApplicationCommandInteractionDataOptionBoolean;
export type ApplicationCommandInteractionDataOptionString = InteractionDataOptionBase<
ApplicationCommandOptionType.String,
string
>;
export type ApplicationCommandInteractionDataOptionRole = InteractionDataOptionBase<
ApplicationCommandOptionType.Role,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionChannel = InteractionDataOptionBase<
ApplicationCommandOptionType.Channel,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionUser = InteractionDataOptionBase<
ApplicationCommandOptionType.User,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionMentionable = InteractionDataOptionBase<
ApplicationCommandOptionType.Mentionable,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionInteger = InteractionDataOptionBase<
ApplicationCommandOptionType.Integer,
number
>;
export type ApplicationCommandInteractionDataOptionNumber = InteractionDataOptionBase<
ApplicationCommandOptionType.Number,
number
>;
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
name: string;
type: T;
value: D;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export interface APIChatInputApplicationCommandInteractionData
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.ChatInput> {
options?: APIApplicationCommandInteractionDataOption[];
resolved?: APIChatInputApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
*/
export interface APIChatInputApplicationCommandInteractionDataResolved {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandInteraction =
APIApplicationCommandInteractionWrapper<APIChatInputApplicationCommandInteractionData>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandDMInteraction =
APIDMInteractionWrapper<APIChatInputApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandGuildInteraction =
APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;

View File

@@ -0,0 +1,104 @@
import type { APIUser } from '../../user.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIMessage } from '../../channel.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands.ts';
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export interface APIUserApplicationCommandInteractionData
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.User> {
target_id: Snowflake;
resolved: APIUserApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
*/
export interface APIUserApplicationCommandInteractionDataResolved {
users: Record<Snowflake, APIUser>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export interface APIMessageApplicationCommandInteractionData
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.Message> {
target_id: Snowflake;
resolved: APIMessageApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
*/
export interface APIMessageApplicationCommandInteractionDataResolved {
messages: Record<Snowflake, APIMessage>;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export type APIContextMenuInteractionData =
| APIUserApplicationCommandInteractionData
| APIMessageApplicationCommandInteractionData;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIUserApplicationCommandInteraction =
APIApplicationCommandInteractionWrapper<APIUserApplicationCommandInteractionData>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIUserApplicationCommandDMInteraction = APIDMInteractionWrapper<APIUserApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIUserApplicationCommandGuildInteraction =
APIGuildInteractionWrapper<APIUserApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIMessageApplicationCommandInteraction =
APIApplicationCommandInteractionWrapper<APIMessageApplicationCommandInteractionData>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIMessageApplicationCommandDMInteraction =
APIDMInteractionWrapper<APIMessageApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIMessageApplicationCommandGuildInteraction =
APIGuildInteractionWrapper<APIMessageApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIContextMenuInteraction = APIUserApplicationCommandInteraction | APIMessageApplicationCommandInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIContextMenuDMInteraction =
| APIUserApplicationCommandDMInteraction
| APIMessageApplicationCommandDMInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIContextMenuGuildInteraction =
| APIUserApplicationCommandGuildInteraction
| APIMessageApplicationCommandGuildInteraction;

View File

@@ -0,0 +1,8 @@
import type { Snowflake } from '../../../../globals.ts';
import type { ApplicationCommandType } from '../applicationCommands.ts';
export interface APIBaseApplicationCommandInteractionData<Type extends ApplicationCommandType> {
id: Snowflake;
type: Type;
name: string;
}

View File

@@ -0,0 +1,49 @@
import type { Snowflake } from '../../../../globals.ts';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure
*/
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/application-commands#application-command-permissions-object-application-command-permissions-structure
*/
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/application-commands#application-command-permissions-object-application-command-permission-type
*/
export enum ApplicationCommandPermissionType {
Role = 1,
User,
}

View File

@@ -0,0 +1,122 @@
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { APIPartialChannel } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIBaseInteraction } from './base.ts';
import type { InteractionType } from './responses.ts';
import type {
APIApplicationCommandOption,
APIChatInputApplicationCommandDMInteraction,
APIChatInputApplicationCommandGuildInteraction,
APIChatInputApplicationCommandInteraction,
APIChatInputApplicationCommandInteractionData,
} from './_applicationCommands/chatInput.ts';
import type {
APIContextMenuDMInteraction,
APIContextMenuGuildInteraction,
APIContextMenuInteraction,
APIContextMenuInteractionData,
} from './_applicationCommands/contextMenu.ts';
export * from './_applicationCommands/chatInput.ts';
export * from './_applicationCommands/contextMenu.ts';
export * from './_applicationCommands/permissions.ts';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
*/
export interface APIApplicationCommand {
/**
* Unique id of the command
*/
id: Snowflake;
/**
* Type of the command
*/
type: ApplicationCommandType;
/**
* Unique id of the parent application
*/
application_id: Snowflake;
/**
* Guild id of the command, if not global
*/
guild_id?: Snowflake;
/**
* 1-32 character name; `CHAT_INPUT` command names must be all lowercase matching `^[\w-]{1,32}$`
*/
name: string;
/**
* 1-100 character description for `CHAT_INPUT` commands, empty string for `USER` and `MESSAGE` commands
*/
description: string;
/**
* The parameters for the `CHAT_INPUT` command, max 25
*/
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;
/**
* Autoincrementing version identifier updated during substantial record changes
*/
version: Snowflake;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types
*/
export enum ApplicationCommandType {
ChatInput = 1,
User,
Message,
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export type APIApplicationCommandInteractionData =
| APIChatInputApplicationCommandInteractionData
| APIContextMenuInteractionData;
/**
* https://discord.com/developers/docs/resources/channel#channel-object
*/
export interface APIInteractionDataResolvedChannel extends Required<APIPartialChannel> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIInteractionDataResolvedGuildMember extends Omit<APIGuildMember, 'user' | 'deaf' | 'mute'> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationCommandInteractionData> =
APIBaseInteraction<InteractionType.ApplicationCommand, Data> &
Required<Pick<APIBaseInteraction<InteractionType.ApplicationCommand, Data>, 'channel_id' | 'data'>>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandDMInteraction =
| APIChatInputApplicationCommandDMInteraction
| APIContextMenuDMInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandGuildInteraction =
| APIChatInputApplicationCommandGuildInteraction
| APIContextMenuGuildInteraction;

View File

@@ -0,0 +1,101 @@
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { InteractionType } from './responses.ts';
import type { APIMessage } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIUser } from '../user.ts';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object
*/
export interface APIMessageInteraction {
/**
* ID of the interaction
*/
id: Snowflake;
/**
* The type of interaction
*/
type: InteractionType;
/**
* The name of the ApplicationCommand
*/
name: string;
/**
* The user who invoked the interaction
*/
user: APIUser;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIInteractionGuildMember extends APIGuildMember {
permissions: Permissions;
user: APIUser;
}
// INTERACTIONS RECEIVED
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
/**
* ID of the interaction
*/
id: Snowflake;
/**
* ID of the application this interaction is for
*/
application_id: Snowflake;
/**
* The type of interaction
*/
type: Type;
/**
* The command data payload
*/
data?: Data;
/**
* The guild it was sent from
*/
guild_id?: Snowflake;
/**
* The channel it was sent from
*/
channel_id?: Snowflake;
/**
* Guild member data for the invoking user, including permissions
*
* **This is only sent when an interaction is invoked in a guild**
*/
member?: APIInteractionGuildMember;
/**
* User object for the invoking user, if invoked in a DM
*/
user?: APIUser;
/**
* A continuation token for responding to the interaction
*/
token: string;
/**
* Read-only property, always `1`
*/
version: 1;
/**
* For components, the message they were attached to
*/
message?: APIMessage;
}
export type APIDMInteractionWrapper<Original extends APIBaseInteraction<InteractionType, unknown>> = Omit<
Original,
'member' | 'guild_id'
> &
Required<Pick<Original, 'user'>>;
export type APIGuildInteractionWrapper<Original extends APIBaseInteraction<InteractionType, unknown>> = Omit<
Original,
'user'
> &
Required<Pick<Original, 'member' | 'guild_id'>>;

View File

@@ -0,0 +1,38 @@
import type { ComponentType } from '../channel.ts';
import type { APIBaseInteraction, InteractionType } from '../interactions.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
export type APIMessageComponentInteraction = APIBaseInteraction<
InteractionType.MessageComponent,
APIMessageComponentInteractionData
> &
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageComponentInteractionData>,
'channel_id' | 'data' | 'message'
>
>;
export type APIMessageComponentInteractionData = APIMessageButtonInteractionData | APIMessageSelectMenuInteractionData;
export interface APIMessageComponentBaseInteractionData<CType extends ComponentType> {
/**
* The `custom_id` of the component
*/
custom_id: string;
/**
* The type of the component
*/
component_type: CType;
}
export type APIMessageButtonInteractionData = APIMessageComponentBaseInteractionData<ComponentType.Button>;
export interface APIMessageSelectMenuInteractionData
extends APIMessageComponentBaseInteractionData<ComponentType.SelectMenu> {
values: string[];
}
export type APIMessageComponentDMInteraction = APIDMInteractionWrapper<APIMessageComponentInteraction>;
export type APIMessageComponentGuildInteraction = APIGuildInteractionWrapper<APIMessageComponentInteraction>;

View File

@@ -0,0 +1,4 @@
import type { APIBaseInteraction } from './base.ts';
import type { InteractionType } from './responses.ts';
export type APIPingInteraction = APIBaseInteraction<InteractionType.Ping, never>;

View File

@@ -0,0 +1,78 @@
import type { MessageFlags } from '../mod.ts';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8.ts';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
*/
export enum InteractionType {
Ping = 1,
ApplicationCommand,
MessageComponent,
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object
*/
export type APIInteractionResponse =
| APIInteractionResponsePong
| APIInteractionResponseChannelMessageWithSource
| APIInteractionResponseDeferredChannelMessageWithSource
| APIInteractionResponseDeferredMessageUpdate
| APIInteractionResponseUpdateMessage;
export interface APIInteractionResponsePong {
type: InteractionResponseType.Pong;
}
export interface APIInteractionResponseChannelMessageWithSource {
type: InteractionResponseType.ChannelMessageWithSource;
data: APIInteractionResponseCallbackData;
}
export interface APIInteractionResponseDeferredChannelMessageWithSource {
type: InteractionResponseType.DeferredChannelMessageWithSource;
data?: Pick<APIInteractionResponseCallbackData, 'flags'>;
}
export interface APIInteractionResponseDeferredMessageUpdate {
type: InteractionResponseType.DeferredMessageUpdate;
}
export interface APIInteractionResponseUpdateMessage {
type: InteractionResponseType.UpdateMessage;
data?: APIInteractionResponseCallbackData;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
*/
export enum InteractionResponseType {
/**
* ACK a `Ping`
*/
Pong = 1,
/**
* Respond to an interaction with a message
*/
ChannelMessageWithSource = 4,
/**
* ACK an interaction and edit to a response later, the user sees a loading state
*/
DeferredChannelMessageWithSource,
/**
* ACK a button interaction and update it to a loading state
*/
DeferredMessageUpdate,
/**
* ACK a button interaction and edit the message to which the button was attached
*/
UpdateMessage,
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure
*/
export type APIInteractionResponseCallbackData = Omit<
RESTPostAPIWebhookWithTokenJSONBody,
'username' | 'avatar_url'
> & { flags?: MessageFlags };

View File

@@ -0,0 +1,109 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/application
*/
import type { Snowflake } from '../../globals.ts';
import type { APITeam } from './teams.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/resources/application#application-object
*/
export interface APIApplication {
/**
* The id of the app
*/
id: Snowflake;
/**
* The name of the app
*/
name: string;
/**
* The icon hash of the app
*/
icon: string | null;
/**
* The description of the app
*/
description: string;
/**
* An array of rpc origin urls, if rpc is enabled
*/
rpc_origins?: string[];
/**
* When `false` only app owner can join the app's bot to guilds
*/
bot_public: boolean;
/**
* 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
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
owner?: APIUser;
/**
* If this application is a game sold on Discord, this field will be the summary field for the store page
* of its primary sku
*/
summary: string;
/**
* 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
*/
verify_key: string;
/**
* The team this application belongs to
*
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
*/
team: APITeam | null;
/**
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
*/
guild_id?: Snowflake;
/**
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
*/
primary_sku_id?: Snowflake;
/**
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
*/
slug?: string;
/**
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
*/
cover_image?: string;
/**
* The application's public flags
*
* See https://discord.com/developers/docs/resources/application#application-object-application-flags
*/
flags: ApplicationFlags;
}
/**
* https://discord.com/developers/docs/resources/application#application-object-application-flags
*/
export enum ApplicationFlags {
ManagedEmoji = 1 << 2,
GroupDMCreate = 1 << 4,
RPCHasConnected = 1 << 11,
GatewayPresence = 1 << 12,
GatewayPresenceLimited = 1 << 13,
GatewayGuildMembers = 1 << 14,
GatewayGuildMembersLimited = 1 << 15,
VerificationPendingGuildLimit = 1 << 16,
Embedded = 1 << 17,
}

View File

@@ -0,0 +1,624 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/audit-log
*/
import type { Snowflake } from '../../globals.ts';
import type { APIOverwrite } from './channel.ts';
import type {
APIGuildIntegration,
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
GuildMFALevel,
GuildVerificationLevel,
IntegrationExpireBehavior,
} from './guild.ts';
import type { APIRole } from './permissions.ts';
import type { StickerFormatType } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { APIWebhook } from './webhook.ts';
import type { StageInstancePrivacyLevel } from './stageInstance.ts';
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
*/
export interface APIAuditLog {
/**
* Webhooks found in the audit log
*
* See https://discord.com/developers/docs/resources/webhook#webhook-object
*/
webhooks: APIWebhook[];
/**
* Users found in the audit log
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
users: APIUser[];
/**
* Audit log entries
*
* See https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object
*/
audit_log_entries: APIAuditLogEntry[];
/**
* Partial integration objects
*
* See https://discord.com/developers/docs/resources/guild#integration-object
*/
integrations: APIGuildIntegration[];
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure
*/
export interface APIAuditLogEntry {
/**
* ID of the affected entity (webhook, user, role, etc.)
*/
target_id: string | null;
/**
* Changes made to the `target_id`
*
* See https://discord.com/developers/docs/resources/audit-log#audit-log-change-object
*/
changes?: APIAuditLogChange[];
/**
* The user who made the changes
*
* This can be `null` in some cases (webhooks deleting themselves by using their own token, for example)
*/
user_id: Snowflake | null;
/**
* ID of the entry
*/
id: Snowflake;
/**
* Type of action that occurred
*
* See https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events
*/
action_type: AuditLogEvent;
/**
* Additional info for certain action types
*
* See https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
*/
options?: APIAuditLogOptions;
/**
* The reason for the change (0-512 characters)
*/
reason?: string;
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events
*/
export enum AuditLogEvent {
GuildUpdate = 1,
ChannelCreate = 10,
ChannelUpdate,
ChannelDelete,
ChannelOverwriteCreate,
ChannelOverwriteUpdate,
ChannelOverwriteDelete,
MemberKick = 20,
MemberPrune,
MemberBanAdd,
MemberBanRemove,
MemberUpdate,
MemberRoleUpdate,
MemberMove,
MemberDisconnect,
BotAdd,
RoleCreate = 30,
RoleUpdate,
RoleDelete,
InviteCreate = 40,
InviteUpdate,
InviteDelete,
WebhookCreate = 50,
WebhookUpdate,
WebhookDelete,
EmojiCreate = 60,
EmojiUpdate,
EmojiDelete,
MessageDelete = 72,
MessageBulkDelete,
MessagePin,
MessageUnpin,
IntegrationCreate = 80,
IntegrationUpdate,
IntegrationDelete,
StageInstanceCreate,
StageInstanceUpdate,
StageInstanceDelete,
StickerCreate = 90,
StickerUpdate,
StickerDelete,
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
*/
export interface APIAuditLogOptions {
/**
* Number of days after which inactive members were kicked
*
* Present from:
* - MEMBER_PRUNE
*/
delete_member_days?: string;
/**
* Number of members removed by the prune
*
* Present from:
* - MEMBER_PRUNE
*/
members_removed?: string;
/**
* Channel in which the entities were targeted
*
* Present from:
* - MEMBER_MOVE
* - MESSAGE_PIN
* - MESSAGE_UNPIN
* - MESSAGE_DELETE
* - STAGE_INSTANCE_CREATE
* - STAGE_INSTANCE_UPDATE
* - STAGE_INSTANCE_DELETE
*/
channel_id?: Snowflake;
/**
* ID of the message that was targeted
*
* Present from:
* - MESSAGE_PIN
* - MESSAGE_UNPIN
*/
message_id?: Snowflake;
/**
* Number of entities that were targeted
*
* Present from:
* - MESSAGE_DELETE
* - MESSAGE_BULK_DELETE
* - MEMBER_DISCONNECT
* - MEMBER_MOVE
*/
count?: string;
/**
* ID of the overwritten entity
*
* Present from:
* - CHANNEL_OVERWRITE_CREATE
* - CHANNEL_OVERWRITE_UPDATE
* - CHANNEL_OVERWRITE_DELETE
*/
id?: Snowflake;
/**
* Type of overwritten entity - "0" for "role" or "1" for "member"
*
* Present from:
* - CHANNEL_OVERWRITE_CREATE
* - CHANNEL_OVERWRITE_UPDATE
* - CHANNEL_OVERWRITE_DELETE
*
* {@link AuditLogOptionsType}
*/
type?: AuditLogOptionsType;
/**
* Name of the role
*
* Present from:
* - CHANNEL_OVERWRITE_CREATE
* - CHANNEL_OVERWRITE_UPDATE
* - CHANNEL_OVERWRITE_DELETE
*
* **Present only if the {@link APIAuditLogOptions#type entry type} is "0"**
*/
role_name?: string;
}
export enum AuditLogOptionsType {
Role = '0',
Member = '1',
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure
*/
export type APIAuditLogChange =
| APIAuditLogChangeKeyName
| APIAuditLogChangeKeyDescription
| APIAuditLogChangeKeyIconHash
| APIAuditLogChangeKeySplashHash
| APIAuditLogChangeKeyDiscoverySplashHash
| APIAuditLogChangeKeyBannerHash
| APIAuditLogChangeKeyOwnerId
| APIAuditLogChangeKeyRegion
| APIAuditLogChangeKeyPreferredLocale
| APIAuditLogChangeKeyAFKChannelId
| APIAuditLogChangeKeyAFKTimeout
| APIAuditLogChangeKeyRulesChannelId
| APIAuditLogChangeKeyPublicUpdatesChannelId
| APIAuditLogChangeKeyMFALevel
| APIAuditLogChangeKeyVerificationLevel
| APIAuditLogChangeKeyExplicitContentFilter
| APIAuditLogChangeKeyDefaultMessageNotifications
| APIAuditLogChangeKeyVanityURLCode
| APIAuditLogChangeKey$Add
| APIAuditLogChangeKey$Remove
| APIAuditLogChangeKeyPruneDeleteDays
| APIAuditLogChangeKeyWidgetEnabled
| APIAuditLogChangeKeyWidgetChannelId
| APIAuditLogChangeKeySystemChannelId
| APIAuditLogChangeKeyPosition
| APIAuditLogChangeKeyTopic
| APIAuditLogChangeKeyBitrate
| APIAuditLogChangeKeyPermissionOverwrites
| APIAuditLogChangeKeyNSFW
| APIAuditLogChangeKeyApplicationId
| APIAuditLogChangeKeyRateLimitPerUser
| APIAuditLogChangeKeyPermissions
| APIAuditLogChangeKeyColor
| APIAuditLogChangeKeyHoist
| APIAuditLogChangeKeyMentionable
| APIAuditLogChangeKeyAllow
| APIAuditLogChangeKeyDeny
| APIAuditLogChangeKeyCode
| APIAuditLogChangeKeyChannelId
| APIAuditLogChangeKeyInviterId
| APIAuditLogChangeKeyMaxUses
| APIAuditLogChangeKeyUses
| APIAuditLogChangeKeyMaxAge
| APIAuditLogChangeKeyTemporary
| APIAuditLogChangeKeyDeaf
| APIAuditLogChangeKeyMute
| APIAuditLogChangeKeyNick
| APIAuditLogChangeKeyAvatarHash
| APIAuditLogChangeKeyId
| APIAuditLogChangeKeyType
| APIAuditLogChangeKeyEnableEmoticons
| APIAuditLogChangeKeyExpireBehavior
| APIAuditLogChangeKeyExpireGracePeriod
| APIAuditLogChangeKeyUserLimit
| APIAuditLogChangeKeyPrivacyLevel
| APIAuditLogChangeKeyTags
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildId;
/**
* Returned when an entity's name is changed
*/
export type APIAuditLogChangeKeyName = AuditLogChangeData<'name', string>;
/**
* Returned when a guild's or sticker's description is changed
*/
export type APIAuditLogChangeKeyDescription = AuditLogChangeData<'description', string>;
/**
* Returned when a guild's icon is changed
*/
export type APIAuditLogChangeKeyIconHash = AuditLogChangeData<'icon_hash', string>;
/**
* Returned when a guild's splash is changed
*/
export type APIAuditLogChangeKeySplashHash = AuditLogChangeData<'splash_hash', string>;
/**
* Returned when a guild's discovery splash is changed
*/
export type APIAuditLogChangeKeyDiscoverySplashHash = AuditLogChangeData<'discovery_splash_hash', string>;
/**
* Returned when a guild's banner hash is changed
*/
export type APIAuditLogChangeKeyBannerHash = AuditLogChangeData<'banner_hash', string>;
/**
* Returned when a guild's owner_id is changed
*/
export type APIAuditLogChangeKeyOwnerId = AuditLogChangeData<'owner_id', Snowflake>;
/**
* Returned when a guild's region is changed
*/
export type APIAuditLogChangeKeyRegion = AuditLogChangeData<'region', string>;
/**
* Returned when a guild's preferred_locale is changed
*/
export type APIAuditLogChangeKeyPreferredLocale = AuditLogChangeData<'preferred_locale', string>;
/**
* Returned when a guild's afk_channel_id is changed
*/
export type APIAuditLogChangeKeyAFKChannelId = AuditLogChangeData<'afk_channel_id', Snowflake>;
/**
* Returned when a guild's afk_timeout is changed
*/
export type APIAuditLogChangeKeyAFKTimeout = AuditLogChangeData<'afk_timeout', number>;
/**
* Returned when a guild's rules_channel_id is changed
*/
export type APIAuditLogChangeKeyRulesChannelId = AuditLogChangeData<'rules_channel_id', string>;
/**
* Returned when a guild's public_updates_channel_id is changed
*/
export type APIAuditLogChangeKeyPublicUpdatesChannelId = AuditLogChangeData<'public_updates_channel_id', string>;
/**
* Returned when a guild's mfa_level is changed
*/
export type APIAuditLogChangeKeyMFALevel = AuditLogChangeData<'mfa_level', GuildMFALevel>;
/**
* Returned when a guild's verification_level is changed
*/
export type APIAuditLogChangeKeyVerificationLevel = AuditLogChangeData<'verification_level', GuildVerificationLevel>;
/**
* Returned when a guild's explicit_content_filter is changed
*/
export type APIAuditLogChangeKeyExplicitContentFilter = AuditLogChangeData<
'explicit_content_filter',
GuildExplicitContentFilter
>;
/**
* Returned when a guild's default_message_notifications is changed
*/
export type APIAuditLogChangeKeyDefaultMessageNotifications = AuditLogChangeData<
'default_message_notifications',
GuildDefaultMessageNotifications
>;
/**
* Returned when a guild's vanity_url_code is changed
*/
export type APIAuditLogChangeKeyVanityURLCode = AuditLogChangeData<'vanity_url_code', string>;
/**
* Returned when new role(s) are added
*/
export type APIAuditLogChangeKey$Add = AuditLogChangeData<'$add', APIRole[]>;
/**
* Returned when role(s) are removed
*/
export type APIAuditLogChangeKey$Remove = AuditLogChangeData<'$remove', APIRole[]>;
/**
* Returned when there is a change in number of days after which inactive and role-unassigned members are kicked
*/
export type APIAuditLogChangeKeyPruneDeleteDays = AuditLogChangeData<'prune_delete_days', number>;
/**
* Returned when a guild's widget is enabled
*/
export type APIAuditLogChangeKeyWidgetEnabled = AuditLogChangeData<'widget_enabled', boolean>;
/**
* Returned when a guild's widget_channel_id is changed
*/
export type APIAuditLogChangeKeyWidgetChannelId = AuditLogChangeData<'widget_channel_id', Snowflake>;
/**
* Returned when a guild's system_channel_id is changed
*/
export type APIAuditLogChangeKeySystemChannelId = AuditLogChangeData<'system_channel_id', Snowflake>;
/**
* Returned when a channel's position is changed
*/
export type APIAuditLogChangeKeyPosition = AuditLogChangeData<'position', number>;
/**
* Returned when a channel's topic is changed
*/
export type APIAuditLogChangeKeyTopic = AuditLogChangeData<'topic', string>;
/**
* Returned when a voice channel's bitrate is changed
*/
export type APIAuditLogChangeKeyBitrate = AuditLogChangeData<'bitrate', number>;
/**
* Returned when a channel's permission overwrites is changed
*/
export type APIAuditLogChangeKeyPermissionOverwrites = AuditLogChangeData<'permission_overwrites', APIOverwrite[]>;
/**
* Returned when a channel's NSFW restriction is changed
*/
export type APIAuditLogChangeKeyNSFW = AuditLogChangeData<'nsfw', boolean>;
/**
* The application ID of the added or removed Webhook or Bot
*/
export type APIAuditLogChangeKeyApplicationId = AuditLogChangeData<'application_id', Snowflake>;
/**
* Returned when a channel's amount of seconds a user has to wait before sending another message
* is changed
*/
export type APIAuditLogChangeKeyRateLimitPerUser = AuditLogChangeData<'rate_limit_per_user', number>;
/**
* Returned when a permission bitfield is changed
*/
export type APIAuditLogChangeKeyPermissions = AuditLogChangeData<'permissions', string>;
/**
* Returned when a role's color is changed
*/
export type APIAuditLogChangeKeyColor = AuditLogChangeData<'color', number>;
/**
* Returned when a role's hoist status is changed
*/
export type APIAuditLogChangeKeyHoist = AuditLogChangeData<'hoist', boolean>;
/**
* Returned when a role's mentionable status is changed
*/
export type APIAuditLogChangeKeyMentionable = AuditLogChangeData<'mentionable', boolean>;
/**
* Returned when an overwrite's allowed permissions bitfield is changed
*/
export type APIAuditLogChangeKeyAllow = AuditLogChangeData<'allow', string>;
/**
* Returned when an overwrite's denied permissions bitfield is changed
*/
export type APIAuditLogChangeKeyDeny = AuditLogChangeData<'deny', string>;
/**
* Returned when an invite's code is changed
*/
export type APIAuditLogChangeKeyCode = AuditLogChangeData<'code', string>;
/**
* Returned when an invite's channel_id is changed
*/
export type APIAuditLogChangeKeyChannelId = AuditLogChangeData<'channel_id', Snowflake>;
/**
* Returned when an invite's inviter_id is changed
*/
export type APIAuditLogChangeKeyInviterId = AuditLogChangeData<'inviter_id', Snowflake>;
/**
* Returned when an invite's max_uses is changed
*/
export type APIAuditLogChangeKeyMaxUses = AuditLogChangeData<'max_uses', number>;
/**
* Returned when an invite's uses is changed
*/
export type APIAuditLogChangeKeyUses = AuditLogChangeData<'uses', number>;
/**
* Returned when an invite's max_age is changed
*/
export type APIAuditLogChangeKeyMaxAge = AuditLogChangeData<'max_age', number>;
/**
* Returned when an invite's temporary status is changed
*/
export type APIAuditLogChangeKeyTemporary = AuditLogChangeData<'temporary', boolean>;
/**
* Returned when a user's deaf status is changed
*/
export type APIAuditLogChangeKeyDeaf = AuditLogChangeData<'deaf', boolean>;
/**
* Returned when a user's mute status is changed
*/
export type APIAuditLogChangeKeyMute = AuditLogChangeData<'mute', boolean>;
/**
* Returned when a user's nick is changed
*/
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', string>;
/**
* Returned when a user's avatar_hash is changed
*/
export type APIAuditLogChangeKeyAvatarHash = AuditLogChangeData<'avatar_hash', string>;
/**
* The ID of the changed entity - sometimes used in conjunction with other keys
*/
export type APIAuditLogChangeKeyId = AuditLogChangeData<'id', Snowflake>;
/**
* The type of entity created
*/
export type APIAuditLogChangeKeyType = AuditLogChangeData<'type', number | string>;
/**
* Returned when an integration's enable_emoticons is changed
*/
export type APIAuditLogChangeKeyEnableEmoticons = AuditLogChangeData<'enable_emoticons', boolean>;
/**
* Returned when an integration's expire_behavior is changed
*/
export type APIAuditLogChangeKeyExpireBehavior = AuditLogChangeData<'expire_behavior', IntegrationExpireBehavior>;
/**
* Returned when an integration's expire_grace_period is changed
*/
export type APIAuditLogChangeKeyExpireGracePeriod = AuditLogChangeData<'expire_grace_period', number>;
/**
* Returned when a voice channel's user_limit is changed
*/
export type APIAuditLogChangeKeyUserLimit = AuditLogChangeData<'user_limit', number>;
/**
* Returned when privacy level of a stage instance is changed
*/
export type APIAuditLogChangeKeyPrivacyLevel = AuditLogChangeData<'privacy_level', StageInstancePrivacyLevel>;
/**
* Returned when a sticker's related emoji is changed
*/
export type APIAuditLogChangeKeyTags = AuditLogChangeData<'tags', string>;
/**
* Returned when a sticker's format_type is changed
*/
export type APIAuditLogChangeKeyFormatType = AuditLogChangeData<'format_type', StickerFormatType>;
/**
* Empty string
*/
export type APIAuditLogChangeKeyAsset = AuditLogChangeData<'asset', ''>;
/**
* Returned when a sticker's availability is changed
*/
export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', boolean>;
/**
* Returned when a sticker's guild_id is changed
*/
export type APIAuditLogChangeKeyGuildId = AuditLogChangeData<'guild_id', Snowflake>;
interface AuditLogChangeData<K extends string, D extends unknown> {
key: K;
/**
* The new value
*
* If `new_value` is not present in the change object, while `old_value` is,
* that means the property that was changed has been reset, or set to `null`
*/
new_value?: D;
old_value?: D;
}

1076
deno/payloads/v8/channel.ts Normal file

File diff suppressed because it is too large Load Diff

51
deno/payloads/v8/emoji.ts Normal file
View File

@@ -0,0 +1,51 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/emoji
*/
import type { Snowflake } from '../../globals.ts';
import type { APIRole } from './permissions.ts';
import type { APIUser } from './user.ts';
/**
* Not documented but mentioned
*/
export interface APIPartialEmoji {
/**
* Emoji id
*/
id: Snowflake | null;
/**
* Emoji name (can be null only in reaction emoji objects)
*/
name: string | null;
/**
* Whether this emoji is animated
*/
animated?: boolean;
}
/**
* https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure
*/
export interface APIEmoji extends APIPartialEmoji {
/**
* Roles this emoji is whitelisted to
*/
roles?: APIRole['id'][];
/**
* User that created this emoji
*/
user?: APIUser;
/**
* Whether this emoji must be wrapped in colons
*/
require_colons?: boolean;
/**
* Whether this emoji is managed
*/
managed?: boolean;
/**
* Whether this emoji can be used, may be false due to loss of Server Boosts
*/
available?: boolean;
}

312
deno/payloads/v8/gateway.ts Normal file
View File

@@ -0,0 +1,312 @@
/**
* Types extracted from https://discord.com/developers/docs/topics/gateway
*/
import type { Snowflake } from '../../globals.ts';
import type { APIEmoji } from './emoji.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway
*/
export interface APIGatewayInfo {
/**
* The WSS URL that can be used for connecting to the gateway
*/
url: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway-bot
*/
export interface APIGatewayBotInfo extends APIGatewayInfo {
/**
* The recommended number of shards to use when connecting
*
* See https://discord.com/developers/docs/topics/gateway#sharding
*/
shards: number;
/**
* Information on the current session start limit
*
* See https://discord.com/developers/docs/topics/gateway#session-start-limit-object
*/
session_start_limit: APIGatewaySessionStartLimit;
}
/**
* https://discord.com/developers/docs/topics/gateway#session-start-limit-object
*/
export interface APIGatewaySessionStartLimit {
/**
* The total number of session starts the current user is allowed
*/
total: number;
/**
* The remaining number of session starts the current user is allowed
*/
remaining: number;
/**
* The number of milliseconds after which the limit resets
*/
reset_after: number;
/**
* The number of identify requests allowed per 5 seconds
*/
max_concurrency: number;
}
/**
* https://discord.com/developers/docs/topics/gateway#presence-update-presence-update-event-fields
*/
export interface GatewayPresenceUpdate {
/**
* The user presence is being updated for
*
* **The user object within this event can be partial, the only field which must be sent is the `id` field,
* everything else is optional.**
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
user: Partial<APIUser> & Pick<APIUser, 'id'>;
/**
* ID of the guild
*/
guild_id: Snowflake;
/**
* Either "idle", "dnd", "online", or "offline"
*/
status?: PresenceUpdateStatus;
/**
* User's current activities
*
* See https://discord.com/developers/docs/topics/gateway#activity-object
*/
activities?: GatewayActivity[];
/**
* User's platform-dependent status
*
* See https://discord.com/developers/docs/topics/gateway#client-status-object
*/
client_status?: GatewayPresenceClientStatus;
}
export enum PresenceUpdateStatus {
Online = 'online',
DoNotDisturb = 'dnd',
Idle = 'idle',
/**
* Invisible and shown as offline
*/
Invisible = 'invisible',
Offline = 'offline',
}
/**
* https://discord.com/developers/docs/topics/gateway#client-status-object
*/
export interface GatewayPresenceClientStatus {
/**
* The user's status set for an active desktop (Windows, Linux, Mac) application session
*/
desktop?: PresenceUpdateStatus;
/**
* The user's status set for an active mobile (iOS, Android) application session
*/
mobile?: PresenceUpdateStatus;
/**
* The user's status set for an active web (browser, bot account) application session
*/
web?: PresenceUpdateStatus;
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-structure
*/
export interface GatewayActivity {
/**
* The activity's id
*/
id: string;
/**
* The activity's name
*/
name: string;
/**
* Activity type
*
* See https://discord.com/developers/docs/topics/gateway#activity-object-activity-types
*/
type: ActivityType;
/**
* Stream url, is validated when type is `1`
*/
url?: string | null;
/**
* Unix timestamp of when the activity was added to the user's session
*/
created_at: number;
/**
* Unix timestamps for start and/or end of the game
*/
timestamps?: GatewayActivityTimestamps;
sync_id?: string;
platform?: ActivityPlatform;
/**
* Application id for the game
*/
application_id?: Snowflake;
/**
* What the player is currently doing
*/
details?: string | null;
/**
* The user's current party status
*/
state?: string | null;
/**
* The emoji used for a custom status
*
* See https://discord.com/developers/docs/topics/gateway#activity-object-activity-emoji
*/
emoji?: GatewayActivityEmoji;
session_id?: string;
/**
* Information for the current party of the player
*
* See https://discord.com/developers/docs/topics/gateway#activity-object-activity-party
*/
party?: GatewayActivityParty;
/**
* Images for the presence and their hover texts
*
* See https://discord.com/developers/docs/topics/gateway#activity-object-activity-assets
*/
assets?: GatewayActivityAssets;
/**
* Secrets for Rich Presence joining and spectating
*
* See https://discord.com/developers/docs/topics/gateway#activity-object-activity-secrets
*/
secrets?: GatewayActivitySecrets;
/**
* Whether or not the activity is an instanced game session
*/
instance?: boolean;
/**
* Activity flags `OR`d together, describes what the payload includes
*
* See https://discord.com/developers/docs/topics/gateway#activity-object-activity-flags
*
* See https://en.wikipedia.org/wiki/Bit_field
*/
flags?: ActivityFlags;
/**
* The custom buttons shown in the Rich Presence (max 2)
*/
buttons?: string[] | GatewayActivityButton[];
}
export enum ActivityPlatform {
Desktop = 'desktop',
Samsung = 'samsung',
Xbox = 'xbox',
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-types
*/
export enum ActivityType {
/**
* Playing {game}
*/
Game,
/**
* Streaming {details}
*/
Streaming,
/**
* Listening to {name}
*/
Listening,
/**
* Watching {details}
*/
Watching,
/**
* {emoji} {details}
*/
Custom,
/**
* Competing in {name}
*/
Competing,
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-timestamps
*/
export interface GatewayActivityTimestamps {
/**
* Unix time (in milliseconds) of when the activity started
*/
start?: number;
/**
* Unix time (in milliseconds) of when the activity ends
*/
end?: number;
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-emoji
*/
export type GatewayActivityEmoji = Partial<Pick<APIEmoji, 'id' | 'animated'>> & Pick<APIEmoji, 'name'>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-party
*/
export interface GatewayActivityParty {
/**
* The id of the party
*/
id?: string;
/**
* Used to show the party's current and maximum size
*/
size?: [current_size: number, max_size: number];
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-assets
*/
export type GatewayActivityAssets = Partial<
Record<'large_image' | 'large_text' | 'small_image' | 'small_text', string>
>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-secrets
*/
export type GatewayActivitySecrets = Partial<Record<'join' | 'spectate' | 'match', string>>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-flags
*/
export enum ActivityFlags {
Instance = 1 << 0,
Join = 1 << 1,
Spectate = 1 << 2,
JoinRequest = 1 << 3,
Sync = 1 << 4,
Play = 1 << 5,
}
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;
}

926
deno/payloads/v8/guild.ts Normal file
View File

@@ -0,0 +1,926 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/guild
*/
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';
import type { APIRole } from './permissions.ts';
import type { APIStageInstance } from './stageInstance.ts';
import type { APISticker } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { GatewayVoiceState } from './voice.ts';
/**
* https://discord.com/developers/docs/resources/guild#unavailable-guild-object
*/
export interface APIUnavailableGuild {
/**
* Guild id
*/
id: Snowflake;
/**
* `true` if this guild is unavailable due to an outage
*/
unavailable: boolean;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
*/
export interface APIPartialGuild extends Omit<APIUnavailableGuild, 'unavailable'>, Pick<APIGuild, 'welcome_screen'> {
/**
* Guild name (2-100 characters, excluding trailing and leading whitespace)
*/
name: string;
/**
* Icon hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
icon: string | null;
/**
* Splash hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
splash: string | null;
/**
* Banner hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
banner?: string | null;
/**
* The description for the guild, if the guild is discoverable
*/
description?: string | null;
/**
* Enabled guild features
*
* See https://discord.com/developers/docs/resources/guild#guild-object-guild-features
*/
features?: GuildFeature[];
/**
* Verification level required for the guild
*
* See https://discord.com/developers/docs/resources/guild#guild-object-verification-level
*/
verification_level?: GuildVerificationLevel;
/**
* The vanity url code for the guild
*/
vanity_url_code?: string | null;
/**
* `true` if this guild is unavailable due to an outage
*/
unavailable?: boolean;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
*/
export interface APIGuild extends APIPartialGuild {
/**
* Icon hash, returned when in the template object
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
icon_hash?: string | null;
/**
* Discovery splash hash; only present for guilds with the "DISCOVERABLE" feature
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
discovery_splash: string | null;
/**
* `true` if the user is the owner of the guild
*
* **This field is only received from https://discord.com/developers/docs/resources/user#get-current-user-guilds**
*/
owner?: boolean;
/**
* ID of owner
*/
owner_id: Snowflake;
/**
* Total permissions for the user in the guild (excludes overrides)
*
* **This field is only received from https://discord.com/developers/docs/resources/user#get-current-user-guilds**
*
* See https://en.wikipedia.org/wiki/Bit_field
*/
permissions?: Permissions;
/**
* 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;
/**
* ID of afk channel
*/
afk_channel_id: Snowflake | null;
/**
* afk timeout in seconds
*/
afk_timeout: number;
/**
* `true` if the guild widget is enabled
*/
widget_enabled?: boolean;
/**
* The channel id that the widget will generate an invite to, or `null` if set to no invite
*/
widget_channel_id?: Snowflake | null;
/**
* Verification level required for the guild
*
* See https://discord.com/developers/docs/resources/guild#guild-object-verification-level
*/
verification_level: GuildVerificationLevel;
/**
* Default message notifications level
*
* See https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
*/
default_message_notifications: GuildDefaultMessageNotifications;
/**
* Explicit content filter level
*
* See https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
*/
explicit_content_filter: GuildExplicitContentFilter;
/**
* Roles in the guild
*
* See https://discord.com/developers/docs/topics/permissions#role-object
*/
roles: APIRole[];
/**
* Custom guild emojis
*
* See https://discord.com/developers/docs/resources/emoji#emoji-object
*/
emojis: APIEmoji[];
/**
* Enabled guild features
*
* See https://discord.com/developers/docs/resources/guild#guild-object-guild-features
*/
features: GuildFeature[];
/**
* Required MFA level for the guild
*
* See https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
*/
mfa_level: GuildMFALevel;
/**
* Application id of the guild creator if it is bot-created
*/
application_id: Snowflake | null;
/**
* The id of the channel where guild notices such as welcome messages and boost events are posted
*/
system_channel_id: Snowflake | null;
/**
* System channel flags
*
* See https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
*/
system_channel_flags: GuildSystemChannelFlags;
/**
* The id of the channel where Community guilds can display rules and/or guidelines
*/
rules_channel_id: Snowflake | null;
/**
* When this guild was joined at
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*/
joined_at?: string;
/**
* `true` if this is considered a large guild
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*/
large?: boolean;
/**
* Total number of members in this guild
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*/
member_count?: number;
/**
* States of members currently in voice channels; lacks the `guild_id` key
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*
* See https://discord.com/developers/docs/resources/voice#voice-state-object
*/
voice_states?: Omit<GatewayVoiceState, 'guild_id'>[];
/**
* Users in the guild
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
members?: APIGuildMember[];
/**
* Channels in the guild
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
channels?: APIChannel[];
/**
* Presences of the members in the guild, will only include non-offline members if the size is greater than `large_threshold`
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*
* See https://discord.com/developers/docs/topics/gateway#presence-update
*/
presences?: GatewayPresenceUpdate[];
/**
* The maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds)
*/
max_presences?: number | null;
/**
* The maximum number of members for the guild
*/
max_members?: number;
/**
* The vanity url code for the guild
*/
vanity_url_code: string | null;
/**
* The description for the guild, if the guild is discoverable
*/
description: string | null;
/**
* Banner hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
banner: string | null;
/**
* Premium tier (Server Boost level)
*
* See https://discord.com/developers/docs/resources/guild#guild-object-premium-tier
*/
premium_tier: GuildPremiumTier;
/**
* The number of boosts this guild currently has
*/
premium_subscription_count?: number;
/**
* The preferred locale of a Community guild; used in guild discovery and notices from Discord; defaults to "en-US"
*
* @default "en-US"
*/
preferred_locale: string;
/**
* The id of the channel where admins and moderators of Community guilds receive notices from Discord
*/
public_updates_channel_id: Snowflake | null;
/**
* The maximum amount of users in a video channel
*/
max_video_channel_users?: number;
/**
* **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_member_count?: number;
/**
* **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;
/**
* The nsfw level of the guild
*
* See https://discord.com/developers/docs/resources/guild#guild-object-guild-nsfw-level
*/
nsfw_level: GuildNSFWLevel;
/**
* The stage instances in the guild
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*
* See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure
*/
stage_instances?: APIStageInstance[];
/**
* Custom guild stickers
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
stickers: APISticker[];
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
*/
export enum GuildDefaultMessageNotifications {
AllMessages,
OnlyMentions,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
*/
export enum GuildExplicitContentFilter {
Disabled,
MembersWithoutRoles,
AllMembers,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
*/
export enum GuildMFALevel {
None,
Elevated,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-nsfw-level
*/
export enum GuildNSFWLevel {
Default,
Explicit,
Safe,
AgeRestricted,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-verification-level
*/
export enum GuildVerificationLevel {
/**
* Unrestricted
*/
None,
/**
* Must have verified email on account
*/
Low,
/**
* Must be registered on Discord for longer than 5 minutes
*/
Medium,
/**
* Must be a member of the guild for longer than 10 minutes
*/
High,
/**
* Must have a verified phone number
*/
VeryHigh,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-premium-tier
*/
export enum GuildPremiumTier {
None,
Tier1,
Tier2,
Tier3,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
*/
export enum GuildSystemChannelFlags {
/**
* Suppress member join notifications
*/
SuppressJoinNotifications = 1 << 0,
/**
* Suppress server boost notifications
*/
SuppressPremiumSubscriptions = 1 << 1,
/**
* Suppress server setup tips
*/
SuppressGuildReminderNotifications = 1 << 2,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-features
*/
export enum GuildFeature {
/**
* Guild has access to set an animated guild icon
*/
AnimatedIcon = 'ANIMATED_ICON',
/**
* Guild has access to set a guild banner image
*/
Banner = 'BANNER',
/**
* Guild has access to use commerce features (i.e. create store channels)
*/
Commerce = 'COMMERCE',
/**
* Guild can enable welcome screen, Membership Screening and discovery, and receives community updates
*/
Community = 'COMMUNITY',
/**
* Guild is able to be discovered in the directory
*/
Discoverable = 'DISCOVERABLE',
/**
* Guild is able to be featured in the directory
*/
Featurable = 'FEATURABLE',
/**
* Guild has access to set an invite splash background
*/
InviteSplash = 'INVITE_SPLASH',
/**
* Guild has access to create news channels
*/
News = 'NEWS',
/**
* Guild is partnered
*/
Partnered = 'PARTNERED',
RelayEnabled = 'RELAY_ENABLED',
/**
* Guild has access to set a vanity URL
*/
VanityURL = 'VANITY_URL',
/**
* Guild is verified
*/
Verified = 'VERIFIED',
/**
* Guild has access to set 384kbps bitrate in voice (previously VIP voice servers)
*/
VIPRegions = 'VIP_REGIONS',
/**
* Guild has enabled the welcome screen
*/
WelcomeScreenEnabled = 'WELCOME_SCREEN_ENABLED',
/**
* Guild has enabled Membership Screening
*/
MemberVerificationGateEnabled = 'MEMBER_VERIFICATION_GATE_ENABLED',
/**
* Guild can be previewed before joining via Membership Screening or the directory
*/
PreviewEnabled = 'PREVIEW_ENABLED',
/**
* Guild has enabled ticketed events
*/
TicketedEventsEnabled = 'TICKETED_EVENTS_ENABLED',
/**
* Guild has enabled monetization
*/
MonetizationEnabled = 'MONETIZATION_ENABLED',
/**
* Guild has increased custom sticker slots
*/
MoreStickers = 'MORE_STICKERS',
/**
* Guild has access to the three day archive time for threads
*/
ThreeDayThreadArchive = 'THREE_DAY_THREAD_ARCHIVE',
/**
* Guild has access to the seven day archive time for threads
*/
SevenDayThreadArchive = 'SEVEN_DAY_THREAD_ARCHIVE',
/**
* Guild has access to create private threads
*/
PrivateThreads = 'PRIVATE_THREADS',
}
/**
* https://discord.com/developers/docs/resources/guild#guild-preview-object
*/
export interface APIGuildPreview {
/**
* Guild id
*/
id: Snowflake;
/**
* Guild name (2-100 characters)
*/
name: string;
/**
* Icon hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
icon: string | null;
/**
* Splash hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
splash: string | null;
/**
* Discovery splash hash; only present for guilds with the "DISCOVERABLE" feature
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
discovery_splash: string | null;
/**
* Custom guild emojis
*
* See https://discord.com/developers/docs/resources/emoji#emoji-object
*/
emojis: APIEmoji[];
/**
* Enabled guild features
*
* See https://discord.com/developers/docs/resources/guild#guild-object-guild-features
*/
features: GuildFeature[];
/**
* Approximate number of members in this guild
*/
approximate_member_count: number;
/**
* Approximate number of online members in this guild
*/
approximate_presence_count: number;
/**
* The description for the guild
*/
description: string;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-widget-object
*/
export interface APIGuildWidgetSettings {
/**
* Whether the widget is enabled
*/
enabled: boolean;
/**
* The widget channel id
*/
channel_id: Snowflake | null;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIGuildMember {
/**
* The user this guild member represents
*
* **This field won't be included in the member object attached to `MESSAGE_CREATE` and `MESSAGE_UPDATE` gateway events.**
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
user?: APIUser;
/**
* This users guild nickname
*/
nick?: string | null;
/**
* Array of role object ids
*
* See https://discord.com/developers/docs/topics/permissions#role-object
*/
roles: Snowflake[];
/**
* When the user joined the guild
*/
joined_at: string;
/**
* When the user started boosting the guild
*
* See https://support.discord.com/hc/en-us/articles/360028038352-Server-Boosting-
*/
premium_since?: string | null;
/**
* Whether the user is deafened in voice channels
*/
deaf: boolean;
/**
* Whether the user is muted in voice channels
*/
mute: boolean;
/**
* Whether the user has not yet passed the guild's Membership Screening requirements
*
* *If this field is not present, it can be assumed as `false`.*
*/
pending?: boolean;
}
/**
* https://discord.com/developers/docs/resources/guild#integration-object
*/
export interface APIGuildIntegration {
/**
* Integration id
*/
id: Snowflake;
/**
* Integration name
*/
name: string;
/**
* Integration type
*/
type: APIGuildInteractionType;
/**
* Is this integration enabled
*/
enabled: boolean;
/**
* Is this integration syncing
*
* **This field is not provided for `discord` bot integrations.**
*/
syncing?: boolean;
/**
* ID that this integration uses for "subscribers"
*
* **This field is not provided for `discord` bot integrations.**
*/
role_id?: Snowflake;
/**
* Whether emoticons should be synced for this integration (`twitch` only currently)
*
* **This field is not provided for `discord` bot integrations.**
*/
enable_emoticons?: boolean;
/**
* The behavior of expiring subscribers
*
* **This field is not provided for `discord` bot integrations.**
*
* See https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
*/
expire_behavior?: IntegrationExpireBehavior;
/**
* The grace period (in days) before expiring subscribers
*
* **This field is not provided for `discord` bot integrations.**
*/
expire_grace_period?: number;
/**
* User for this integration
*
* **This field is not provided for `discord` bot integrations.**
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
user?: APIUser;
/**
* Integration account information
*
* See https://discord.com/developers/docs/resources/guild#integration-account-object
*/
account: APIIntegrationAccount;
/**
* When this integration was last synced
*
* **This field is not provided for `discord` bot integrations.**
*/
synced_at?: string;
/**
* How many subscribers this integration has
*
* **This field is not provided for `discord` bot integrations.**
*/
subscriber_count?: number;
/**
* Has this integration been revoked
*
* **This field is not provided for `discord` bot integrations.**
*/
revoked?: boolean;
/**
* The bot/OAuth2 application for discord integrations
*
* See https://discord.com/developers/docs/resources/guild#integration-application-object
*
* **This field is not provided for `discord` bot integrations.**
*/
application?: APIGuildIntegrationApplication;
}
export type APIGuildInteractionType = 'twitch' | 'youtube' | 'discord';
/**
* https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
*/
export enum IntegrationExpireBehavior {
RemoveRole,
Kick,
}
/**
* https://discord.com/developers/docs/resources/guild#integration-account-object
*/
export interface APIIntegrationAccount {
/**
* ID of the account
*/
id: string;
/**
* Name of the account
*/
name: string;
}
/**
* https://discord.com/developers/docs/resources/guild#integration-application-object
*/
export interface APIGuildIntegrationApplication {
/**
* The id of the app
*/
id: Snowflake;
/**
* The name of the app
*/
name: string;
/**
* The icon hash of the app
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
icon: string | null;
/**
* The description of the app
*/
description: string;
/**
* The summary of the app
*/
summary: string;
/**
* The bot associated with this application
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
bot?: APIUser;
}
/**
* https://discord.com/developers/docs/resources/guild#ban-object
*/
export interface APIBan {
/**
* The reason for the ban
*/
reason: string | null;
/**
* The banned user
*/
user: APIUser;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
*/
export interface APIGuildWidget {
id: Snowflake;
name: string;
instant_invite: string | null;
channels: APIGuildWidgetChannel[];
members: APIGuildWidgetMember[];
presence_count: number;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
*/
export interface APIGuildWidgetChannel {
id: Snowflake;
name: string;
position: number;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
*/
export interface APIGuildWidgetMember {
id: string;
username: string;
discriminator: string;
avatar: string | null;
status: PresenceUpdateStatus;
activity?: { name: string };
avatar_url: string;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-image-widget-style-options
*/
export enum GuildWidgetStyle {
/**
* Shield style widget with Discord icon and guild members online count
*/
Shield = 'shield',
/**
* Large image with guild icon, name and online count. "POWERED BY DISCORD" as the footer of the widget
*/
Banner1 = 'banner1',
/**
* Smaller widget style with guild icon, name and online count. Split on the right with Discord logo
*/
Banner2 = 'banner2',
/**
* Large image with guild icon, name and online count. In the footer, Discord logo on the left and "Chat Now" on the right
*/
Banner3 = 'banner3',
/**
* Large Discord logo at the top of the widget. Guild icon, name and online count in the middle portion of the widget
* and a "JOIN MY SERVER" button at the bottom
*/
Banner4 = 'banner4',
}
export interface APIGuildWelcomeScreen {
/**
* The welcome screen short message
*/
description: string | null;
/**
* Array of suggested channels
*/
welcome_channels: APIGuildWelcomeScreenChannel[];
}
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
*/
emoji_id: Snowflake | null;
/**
* The emoji name of the emoji that is shown on the left of the channel
*/
emoji_name: string | null;
}
export interface APIGuildMembershipScreening {
/**
* When the fields were last updated
*/
version: string;
/**
* The steps in the screening form
*/
form_fields: APIGuildMembershipScreeningField[];
/**
* The server description shown in the screening form
*/
description: string | null;
}
// TODO: make this a union based on the type in the future, when new types are added
export interface APIGuildMembershipScreeningField {
/**
* The type of field
*/
field_type: MembershipScreeningFieldType;
/**
* The title of the field
*/
label: string;
/**
* The list of rules
*/
values?: string[];
/**
* Whether the user has to fill out this field
*/
required: boolean;
}
export enum MembershipScreeningFieldType {
/**
* Server Rules
*/
Terms = 'TERMS',
}

View File

@@ -0,0 +1,32 @@
import type {
APIMessageComponentDMInteraction,
APIMessageComponentGuildInteraction,
APIMessageComponentInteraction,
} from './_interactions/messageComponents.ts';
import type { APIPingInteraction } from './_interactions/ping.ts';
import type {
APIApplicationCommandDMInteraction,
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
} from './_interactions/applicationCommands.ts';
export * from './_interactions/base.ts';
export * from './_interactions/messageComponents.ts';
export * from './_interactions/ping.ts';
export * from './_interactions/responses.ts';
export * from './_interactions/applicationCommands.ts';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIInteraction = APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;

105
deno/payloads/v8/invite.ts Normal file
View File

@@ -0,0 +1,105 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/invite
*/
import type { APIPartialChannel } from './channel.ts';
import type { APIPartialGuild } from './guild.ts';
import type { APIApplication } from './application.ts';
import type { APIInviteStageInstance } from './stageInstance.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/resources/invite#invite-object
*/
export interface APIInvite {
/**
* The invite code (unique ID)
*/
code: string;
/**
* The guild this invite is for
*
* See https://discord.com/developers/docs/resources/guild#guild-object
*/
guild?: APIPartialGuild;
/**
* The channel this invite is for
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
channel: Required<APIPartialChannel>;
/**
* The user who created the invite
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
inviter?: APIUser;
/**
* 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 embedded application to open for this voice channel embedded application invite
*
* See https://discord.com/developers/docs/topics/oauth2#application
*/
target_application?: Partial<APIApplication>;
/**
* 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, returned from the `GET /invites/<code>` endpoint when `with_counts` is `true`
*/
approximate_member_count?: number;
/**
* The expiration date of this invite, returned from the `GET /invites/<code>` endpoint when `with_expiration` is `true`
*/
expires_at?: string | null;
/**
* The stage instance data if there is a public stage instance in the stage channel this invite is for
*/
stage_instance?: APIInviteStageInstance;
}
/**
* https://discord.com/developers/docs/resources/invite#invite-object-invite-target-types
*/
export enum InviteTargetType {
Stream = 1,
EmbeddedApplication,
}
/**
* https://discord.com/developers/docs/resources/invite#invite-metadata-object
*/
export interface APIExtendedInvite extends APIInvite {
/**
* Number of times this invite has been used
*/
uses: number;
/**
* Max number of times this invite can be used
*/
max_uses: number;
/**
* Duration (in seconds) after which the invite expires
*/
max_age: number;
/**
* Whether this invite only grants temporary membership
*/
temporary: boolean;
/**
* When this invite was created
*/
created_at: string;
}

17
deno/payloads/v8/mod.ts Normal file
View File

@@ -0,0 +1,17 @@
export * from './application.ts';
export * from './auditLog.ts';
export * from './channel.ts';
export * from './emoji.ts';
export * from './gateway.ts';
export * from './guild.ts';
export * from './interactions.ts';
export * from './invite.ts';
export * from './oauth2.ts';
export * from './permissions.ts';
export * from './stageInstance.ts';
export * from './sticker.ts';
export * from './teams.ts';
export * from './template.ts';
export * from './user.ts';
export * from './voice.ts';
export * from './webhook.ts';

108
deno/payloads/v8/oauth2.ts Normal file
View File

@@ -0,0 +1,108 @@
/**
* Types extracted from https://discord.com/developers/docs/topics/oauth2
*/
export enum OAuth2Scopes {
/**
* For oauth2 bots, this puts the bot in the user's selected guild by default
*/
Bot = 'bot',
/**
* Allows [/users/@me/connections](https://discord.com/developers/docs/resources/user#get-user-connections)
* to return linked third-party accounts
*
* See https://discord.com/developers/docs/resources/user#get-user-connections
*/
Connections = 'connections',
/**
* Enables [/users/@me](https://discord.com/developers/docs/resources/user#get-current-user) to return an `email`
*
* See https://discord.com/developers/docs/resources/user#get-current-user
*/
Email = 'email',
/**
* Allows [/users/@me](https://discord.com/developers/docs/resources/user#get-current-user) without `email`
*
* See https://discord.com/developers/docs/resources/user#get-current-user
*/
Identify = 'identify',
/**
* Allows [/users/@me/guilds](https://discord.com/developers/docs/resources/user#get-current-user-guilds)
* to return basic information about all of a user's guilds
*
* See https://discord.com/developers/docs/resources/user#get-current-user-guilds
*/
Guilds = 'guilds',
/**
* Allows [/guilds/{guild.id}/members/{user.id}](https://discord.com/developers/docs/resources/guild#add-guild-member)
* to be used for joining users to a guild
*
* See https://discord.com/developers/docs/resources/guild#add-guild-member
*/
GuildsJoin = 'guilds.join',
/**
* Allows your app to join users to a group dm
*
* See https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
*/
GroupDMJoins = 'gdm.join',
/**
* For local rpc server api access, this allows you to read messages from all client channels
* (otherwise restricted to channels/guilds your app creates)
*/
MessagesRead = 'messages.read',
/**
* For local rpc server access, this allows you to control a user's local Discord client - requires Discord approval
*/
RPC = 'rpc',
/**
* For local rpc server api access, this allows you to receive notifications pushed out to the user - requires Discord approval
*/
RPCNotificationsRead = 'rpc.notifications.read',
/**
* This generates a webhook that is returned in the oauth token response for authorization code grants
*/
WebhookIncoming = 'webhook.incoming',
/**
* Allows your app to upload/update builds for a user's applications - requires Discord approval
*/
ApplicationsBuildsUpload = 'applications.builds.upload',
/**
* Allows your app to read build data for a user's applications
*/
ApplicationsBuildsRead = 'applications.builds.read',
/**
* Allows your app to read and update store data (SKUs, store listings, achievements, etc.) for a user's applications
*/
ApplicationsStoreUpdate = 'applications.store.update',
/**
* Allows your app to read entitlements for a user's applications
*/
ApplicationsEntitlements = 'applications.entitlements',
/**
* Allows your app to know a user's friends and implicit relationships - requires Discord approval
*/
RelationshipsRead = 'relationships.read',
/**
* Allows your app to fetch data from a user's "Now Playing/Recently Played" list - requires Discord approval
*/
ActivitiesRead = 'activities.read',
/**
* Allows your app to update a user's activity - requires Discord approval (NOT REQUIRED FOR GAMESDK ACTIVITY MANAGER)
*
* See https://discord.com/developers/docs/game-sdk/activities
*/
ActivitiesWrite = 'activities.write',
/**
* Allows your app to use Application Commands in a guild
*
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommands = 'applications.commands',
/**
* Allows your app to update its Application Commands via this bearer token - client credentials grant only
*
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommandsUpdate = 'applications.commands.update',
}

View File

@@ -0,0 +1,117 @@
/**
* Types extracted from https://discord.com/developers/docs/topics/permissions
*/
import type { Permissions, Snowflake } from '../../globals.ts';
/**
* https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags
*
* These flags are exported as `BigInt`s and NOT numbers. Wrapping them in `Number()`
* may cause issues, try to use BigInts as much as possible or modules that can
* replicate them in some way
*/
export const PermissionFlagsBits = {
CreateInstantInvite: 1n << 0n,
KickMembers: 1n << 1n,
BanMembers: 1n << 2n,
Administrator: 1n << 3n,
ManageChannels: 1n << 4n,
ManageGuild: 1n << 5n,
AddReactions: 1n << 6n,
ViewAuditLog: 1n << 7n,
PrioritySpeaker: 1n << 8n,
Stream: 1n << 9n,
ViewChannel: 1n << 10n,
SendMessages: 1n << 11n,
SendTTSMessages: 1n << 12n,
ManageMessages: 1n << 13n,
EmbedLinks: 1n << 14n,
AttachFiles: 1n << 15n,
ReadMessageHistory: 1n << 16n,
MentionEveryone: 1n << 17n,
UseExternalEmojis: 1n << 18n,
ViewGuildInsights: 1n << 19n,
Connect: 1n << 20n,
Speak: 1n << 21n,
MuteMembers: 1n << 22n,
DeafenMembers: 1n << 23n,
MoveMembers: 1n << 24n,
UseVAD: 1n << 25n,
ChangeNickname: 1n << 26n,
ManageNicknames: 1n << 27n,
ManageRoles: 1n << 28n,
ManageWebhooks: 1n << 29n,
ManageEmojisAndStickers: 1n << 30n,
UseApplicationCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
UseExternalStickers: 1n << 37n,
} as const;
/**
* Freeze the object of bits, preventing any modifications to it
* @internal
*/
Object.freeze(PermissionFlagsBits);
/**
* https://discord.com/developers/docs/topics/permissions#role-object
*/
export interface APIRole {
/**
* Role id
*/
id: Snowflake;
/**
* Role name
*/
name: string;
/**
* Integer representation of hexadecimal color code
*/
color: number;
/**
* If this role is pinned in the user listing
*/
hoist: boolean;
/**
* Position of this role
*/
position: number;
/**
* Permission bit set
*
* See https://en.wikipedia.org/wiki/Bit_field
*/
permissions: Permissions;
/**
* Whether this role is managed by an integration
*/
managed: boolean;
/**
* Whether this role is mentionable
*/
mentionable: boolean;
/**
* The tags this role has
*/
tags?: APIRoleTags;
}
/**
* https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure
*/
export interface APIRoleTags {
/**
* The id of the bot this role belongs to
*/
bot_id?: Snowflake;
/**
* Whether this is the guild's premium subscriber role
*/
premium_subscriber?: null;
/**
* The id of the integration this role belongs to
*/
integration_id?: Snowflake;
}

View File

@@ -0,0 +1,72 @@
import type { Snowflake } from '../../globals.ts';
import type { APIGuildMember } from './guild.ts';
/**
* https://discord.com/developers/docs/resources/stage-instance#stage-instance-object
*/
export interface APIStageInstance {
/**
* The id of the stage instance
*/
id: Snowflake;
/**
* The guild id of the associated stage channel
*/
guild_id: Snowflake;
/**
* The id of the associated stage channel
*/
channel_id: Snowflake;
/**
* The topic of the stage instance (1-120 characters)
*/
topic: string;
/**
* The privacy level of the stage instance
*
* See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level
*/
privacy_level: StageInstancePrivacyLevel;
/**
* Whether or not stage discovery is disabled
*/
discoverable_disabled: boolean;
}
/**
* https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level
*/
export enum StageInstancePrivacyLevel {
/**
* The stage instance is visible publicly, such as on stage discovery
*/
Public = 1,
/**
* The stage instance is visible to only guild members
*/
GuildOnly,
}
/**
* https://discord.com/developers/docs/resources/invite#invite-stage-instance-object-invite-stage-instance-structure
*/
export interface APIInviteStageInstance {
/**
* The topic of the stage instance (1-120 characters)
*/
topic: string;
/**
* The number of users in the stage
*/
participant_count: number;
/**
* The number of users speaking in the stage
*/
speaker_count: number;
/**
* The members speaking in the stage
*
* See https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure
*/
members: APIGuildMember[];
}

127
deno/payloads/v8/sticker.ts Normal file
View File

@@ -0,0 +1,127 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/sticker
*/
import type { Snowflake } from '../../globals.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
*/
export interface APISticker {
/**
* ID of the sticker
*/
id: Snowflake;
/**
* For standard stickers, ID of the pack the sticker is from
*/
pack_id?: Snowflake;
/**
* Name of the sticker
*/
name: string;
/**
* Description of the sticker
*/
description: string | null;
/**
* For guild stickers, the Discord name of a unicode emoji representing the sticker's expression. for standard stickers, a comma-separated list of related expressions.
*/
tags: string;
/**
* Previously the sticker asset hash, now an empty string
* @deprecated
*/
asset: '';
/**
* Type of sticker
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
*/
type: StickerType;
/**
* Type of sticker format
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types
*/
format_type: StickerFormatType;
/**
* Whether this guild sticker can be used, may be false due to loss of Server Boosts
*/
available?: boolean;
/**
* ID of the guild that owns this sticker
*/
guild_id?: Snowflake;
/**
* The user that uploaded the guild sticker
*/
user?: APIUser;
/**
* The standard sticker's sort order within its pack
*/
sort_value?: number;
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
*/
export enum StickerType {
/**
* An official sticker in a pack, part of Nitro or in a removed purchasable pack
*/
Standard = 1,
/**
* A sticker uploaded to a Boosted guild for the guild's members
*/
Guild,
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types
*/
export enum StickerFormatType {
PNG = 1,
APNG,
Lottie,
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-item-object
*/
export type APIStickerItem = Pick<APISticker, 'id' | 'name' | 'format_type'>;
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
*/
export interface APIStickerPack {
/**
* ID of the sticker pack
*/
id: Snowflake;
/**
* The stickers in the pack
*/
stickers: APISticker[];
/**
* Name of the sticker pack
*/
name: string;
/**
* ID of the pack's SKU
*/
sku_id: Snowflake;
/**
* ID of a sticker in the pack which is shown as the pack's icon
*/
cover_sticker_id?: Snowflake;
/**
* Description of the sticker pack
*/
description: string;
/**
* ID of the sticker pack's banner image
*/
banner_asset_id: Snowflake;
}

66
deno/payloads/v8/teams.ts Normal file
View File

@@ -0,0 +1,66 @@
/**
* Types extracted from https://discord.com/developers/docs/topics/teams
*/
import type { Snowflake } from '../../globals.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/topics/teams#data-models-team-object
*/
export interface APITeam {
/**
* A hash of the image of the team's icon
*/
icon: string | null;
/**
* The unique id of the team
*/
id: Snowflake;
/**
* The members of the team
*/
members: APITeamMember[];
/**
* The name of the team
*/
name: string;
/**
* The user id of the current team owner
*/
owner_user_id: Snowflake;
}
/**
* https://discord.com/developers/docs/topics/teams#data-models-team-members-object
*/
export interface APITeamMember {
/**
* The user's membership state on the team
*
* See https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum
*/
membership_state: TeamMemberMembershipState;
/**
* Will always be `["*"]`
*/
permissions: ['*'];
/**
* The id of the parent team of which they are a member
*/
team_id: Snowflake;
/**
* The avatar, discriminator, id, and username of the user
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
user: APIUser;
}
/**
* https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum
*/
export enum TeamMemberMembershipState {
Invited = 1,
Accepted,
}

View File

@@ -0,0 +1,65 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/template
*/
import type { Snowflake } from '../../globals.ts';
import type { RESTPostAPIGuildsJSONBody } from '../../rest/v8/mod.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/resources/template#template-object
*/
export interface APITemplate {
/**
* The template code (unique ID)
*/
code: string;
/**
* Template name
*/
name: string;
/**
* The description for the template
*/
description: string | null;
/**
* Number of times this template has been used
*/
usage_count: number;
/**
* The ID of the user who created the template
*/
creator_id: Snowflake;
/**
* The user who created the template
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
creator: APIUser;
/**
* When this template was created
*/
created_at: string;
/**
* When this template was last synced to the source guild
*/
updated_at: string;
/**
* The ID of the guild this template is based on
*/
source_guild_id: Snowflake;
/**
* The guild snapshot this template contains
*/
serialized_source_guild: APITemplateSerializedSourceGuild;
/**
* Whether the template has unsynced changes
*/
is_dirty: boolean | null;
}
export interface APITemplateSerializedSourceGuild extends Omit<RESTPostAPIGuildsJSONBody, 'icon'> {
description: string | null;
preferred_locale: string;
icon_hash: string | null;
}

168
deno/payloads/v8/user.ts Normal file
View File

@@ -0,0 +1,168 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/user
*/
import type { Snowflake } from '../../globals.ts';
import type { APIGuildIntegration } from './guild.ts';
/**
* https://discord.com/developers/docs/resources/user#user-object
*/
export interface APIUser {
/**
* The user's id
*/
id: Snowflake;
/**
* The user's username, not unique across the platform
*/
username: string;
/**
* The user's 4-digit discord-tag
*/
discriminator: string;
/**
* The user's avatar hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
avatar: string | null;
/**
* Whether the user belongs to an OAuth2 application
*/
bot?: boolean;
/**
* Whether the user is an Official Discord System user (part of the urgent message system)
*/
system?: boolean;
/**
* Whether the user has two factor enabled on their account
*/
mfa_enabled?: boolean;
/**
* The user's banner hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
banner?: string | null;
/**
* The user's banner color encoded as an integer representation of hexadecimal color code
*/
accent_color?: number | null;
/**
* The user's chosen language option
*/
locale?: string;
/**
* Whether the email on this account has been verified
*/
verified?: boolean;
/**
* The user's email
*/
email?: string | null;
/**
* The flags on a user's account
*
* See https://discord.com/developers/docs/resources/user#user-object-user-flags
*/
flags?: UserFlags;
/**
* The type of Nitro subscription on a user's account
*
* See https://discord.com/developers/docs/resources/user#user-object-premium-types
*/
premium_type?: UserPremiumType;
/**
* The public flags on a user's account
*
* See https://discord.com/developers/docs/resources/user#user-object-user-flags
*/
public_flags?: UserFlags;
}
/**
* https://discord.com/developers/docs/resources/user#user-object-user-flags
*/
export enum UserFlags {
None = 0,
DiscordEmployee = 1 << 0,
PartneredServerOwner = 1 << 1,
DiscordHypeSquadEvents = 1 << 2,
BugHunterLevel1 = 1 << 3,
HypeSquadHouseBravery = 1 << 6,
HypeSquadHouseBrilliance = 1 << 7,
HypeSquadHouseBalance = 1 << 8,
EarlySupporter = 1 << 9,
TeamUser = 1 << 10,
BugHunterLevel2 = 1 << 14,
VerifiedBot = 1 << 16,
EarlyVerifiedBotDeveloper = 1 << 17,
DiscordCertifiedModerator = 1 << 18,
}
/**
* https://discord.com/developers/docs/resources/user#user-object-premium-types
*/
export enum UserPremiumType {
None,
NitroClassic,
Nitro,
}
/**
* https://discord.com/developers/docs/resources/user#connection-object
*/
export interface APIConnection {
/**
* ID of the connection account
*/
id: string;
/**
* The username of the connection account
*/
name: string;
/**
* The service of the connection
*/
type: string;
/**
* Whether the connection is revoked
*/
revoked?: boolean;
/**
* An array of partial server integrations
*
* See https://discord.com/developers/docs/resources/guild#integration-object
*/
integrations?: Partial<APIGuildIntegration>[];
/**
* Whether the connection is verified
*/
verified: boolean;
/**
* Whether friend sync is enabled for this connection
*/
friend_sync: boolean;
/**
* Whether activities related to this connection will be shown in presence updates
*/
show_activity: boolean;
/**
* Visibility of this connection
*
* See https://discord.com/developers/docs/resources/user#connection-object-visibility-types
*/
visibility: ConnectionVisibility;
}
export enum ConnectionVisibility {
/**
* Invisible to everyone except the user themselves
*/
None,
/**
* Visible to everyone
*/
Everyone,
}

96
deno/payloads/v8/voice.ts Normal file
View File

@@ -0,0 +1,96 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/voice
*/
import type { Snowflake } from '../../globals.ts';
import type { APIGuildMember } from './guild.ts';
/**
* https://discord.com/developers/docs/resources/voice#voice-state-object
*/
export interface GatewayVoiceState {
/**
* The guild id this voice state is for
*/
guild_id?: Snowflake;
/**
* The channel id this user is connected to
*/
channel_id: Snowflake | null;
/**
* The user id this voice state is for
*/
user_id: Snowflake;
/**
* The guild member this voice state is for
*
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
member?: APIGuildMember;
/**
* The session id for this voice state
*/
session_id: string;
/**
* Whether this user is deafened by the server
*/
deaf: boolean;
/**
* Whether this user is muted by the server
*/
mute: boolean;
/**
* Whether this user is locally deafened
*/
self_deaf: boolean;
/**
* Whether this user is locally muted
*/
self_mute: boolean;
/**
* Whether this user is streaming using "Go Live"
*/
self_stream?: boolean;
/**
* Whether this user's camera is enabled
*/
self_video: boolean;
/**
* 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;
}
/**
* https://discord.com/developers/docs/resources/voice#voice-region-object
*/
export interface APIVoiceRegion {
/**
* Unique ID for the region
*/
id: string;
/**
* Name of the region
*/
name: string;
/**
* `true` if this is a vip-only server
*/
vip: boolean;
/**
* `true` for a single server that is closest to the current user's client
*/
optimal: boolean;
/**
* Whether this is a deprecated voice region (avoid switching to these)
*/
deprecated: boolean;
/**
* Whether this is a custom voice region (used for events/etc)
*/
custom: boolean;
}

View File

@@ -0,0 +1,79 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/webhook
*/
import type { Snowflake } from '../../globals.ts';
import type { APIPartialChannel, APIPartialGuild, APIUser } from './mod.ts';
/**
* https://discord.com/developers/docs/resources/webhook#webhook-object
*/
export interface APIWebhook {
/**
* The id of the webhook
*/
id: Snowflake;
/**
* The type of the webhook
*
* See https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types
*/
type: WebhookType;
/**
* The guild id this webhook is for
*/
guild_id?: Snowflake;
/**
* The channel id this webhook is for
*/
channel_id: Snowflake;
/**
* The user this webhook was created by (not returned when getting a webhook with its token)
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
user?: APIUser;
/**
* The default name of the webhook
*/
name: string | null;
/**
* The default avatar of the webhook
*/
avatar: string | null;
/**
* The secure token of the webhook (returned for Incoming Webhooks)
*/
token?: string;
/**
* 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 {
/**
* Incoming Webhooks can post messages to channels with a generated token
*/
Incoming = 1,
/**
* Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels
*/
ChannelFollower,
/**
* Application webhooks are webhooks used with Interactions
*/
Application,
}

View File

@@ -0,0 +1,192 @@
import type { APIRole, APIUser } from '../../mod.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands.ts';
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Channel
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
description: string;
default?: boolean;
required?: boolean;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandOption =
| APIApplicationCommandArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandOptionBase;
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
*/
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
options?: APIApplicationCommandOption[];
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
* but they can have a `choices` one
*/
export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type:
| ApplicationCommandOptionType.String
| ApplicationCommandOptionType.Integer
| ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export enum ApplicationCommandOptionType {
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
Number,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
value: string | number;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
| ApplicationCommandInteractionDataOptionSubCommandGroup
| APIApplicationCommandInteractionDataOptionWithValues;
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.Subcommand;
options: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubcommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionString
| ApplicationCommandInteractionDataOptionRole
| ApplicationCommandInteractionDataOptionChannel
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| ApplicationCommandInteractionDataOptionNumber
| ApplicationCommandInteractionDataOptionBoolean;
export type ApplicationCommandInteractionDataOptionString = InteractionDataOptionBase<
ApplicationCommandOptionType.String,
string
>;
export type ApplicationCommandInteractionDataOptionRole = InteractionDataOptionBase<
ApplicationCommandOptionType.Role,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionChannel = InteractionDataOptionBase<
ApplicationCommandOptionType.Channel,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionUser = InteractionDataOptionBase<
ApplicationCommandOptionType.User,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionMentionable = InteractionDataOptionBase<
ApplicationCommandOptionType.Mentionable,
Snowflake
>;
export type ApplicationCommandInteractionDataOptionInteger = InteractionDataOptionBase<
ApplicationCommandOptionType.Integer,
number
>;
export type ApplicationCommandInteractionDataOptionNumber = InteractionDataOptionBase<
ApplicationCommandOptionType.Number,
number
>;
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
name: string;
type: T;
value: D;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export interface APIChatInputApplicationCommandInteractionData
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.ChatInput> {
options?: APIApplicationCommandInteractionDataOption[];
resolved?: APIChatInputApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
*/
export interface APIChatInputApplicationCommandInteractionDataResolved {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandInteraction =
APIApplicationCommandInteractionWrapper<APIChatInputApplicationCommandInteractionData>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandDMInteraction =
APIDMInteractionWrapper<APIChatInputApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandGuildInteraction =
APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;

View File

@@ -0,0 +1,104 @@
import type { APIUser } from '../../user.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIMessage } from '../../channel.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands.ts';
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export interface APIUserApplicationCommandInteractionData
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.User> {
target_id: Snowflake;
resolved: APIUserApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
*/
export interface APIUserApplicationCommandInteractionDataResolved {
users: Record<Snowflake, APIUser>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export interface APIMessageApplicationCommandInteractionData
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.Message> {
target_id: Snowflake;
resolved: APIMessageApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
*/
export interface APIMessageApplicationCommandInteractionDataResolved {
messages: Record<Snowflake, APIMessage>;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export type APIContextMenuInteractionData =
| APIUserApplicationCommandInteractionData
| APIMessageApplicationCommandInteractionData;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIUserApplicationCommandInteraction =
APIApplicationCommandInteractionWrapper<APIUserApplicationCommandInteractionData>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIUserApplicationCommandDMInteraction = APIDMInteractionWrapper<APIUserApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIUserApplicationCommandGuildInteraction =
APIGuildInteractionWrapper<APIUserApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIMessageApplicationCommandInteraction =
APIApplicationCommandInteractionWrapper<APIMessageApplicationCommandInteractionData>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIMessageApplicationCommandDMInteraction =
APIDMInteractionWrapper<APIMessageApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIMessageApplicationCommandGuildInteraction =
APIGuildInteractionWrapper<APIMessageApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIContextMenuInteraction = APIUserApplicationCommandInteraction | APIMessageApplicationCommandInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIContextMenuDMInteraction =
| APIUserApplicationCommandDMInteraction
| APIMessageApplicationCommandDMInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIContextMenuGuildInteraction =
| APIUserApplicationCommandGuildInteraction
| APIMessageApplicationCommandGuildInteraction;

View File

@@ -0,0 +1,8 @@
import type { Snowflake } from '../../../../globals.ts';
import type { ApplicationCommandType } from '../applicationCommands.ts';
export interface APIBaseApplicationCommandInteractionData<Type extends ApplicationCommandType> {
id: Snowflake;
type: Type;
name: string;
}

View File

@@ -0,0 +1,49 @@
import type { Snowflake } from '../../../../globals.ts';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure
*/
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/application-commands#application-command-permissions-object-application-command-permissions-structure
*/
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/application-commands#application-command-permissions-object-application-command-permission-type
*/
export enum ApplicationCommandPermissionType {
Role = 1,
User,
}

View File

@@ -0,0 +1,122 @@
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { APIPartialChannel } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIBaseInteraction } from './base.ts';
import type { InteractionType } from './responses.ts';
import type {
APIApplicationCommandOption,
APIChatInputApplicationCommandDMInteraction,
APIChatInputApplicationCommandGuildInteraction,
APIChatInputApplicationCommandInteraction,
APIChatInputApplicationCommandInteractionData,
} from './_applicationCommands/chatInput.ts';
import type {
APIContextMenuDMInteraction,
APIContextMenuGuildInteraction,
APIContextMenuInteraction,
APIContextMenuInteractionData,
} from './_applicationCommands/contextMenu.ts';
export * from './_applicationCommands/chatInput.ts';
export * from './_applicationCommands/contextMenu.ts';
export * from './_applicationCommands/permissions.ts';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
*/
export interface APIApplicationCommand {
/**
* Unique id of the command
*/
id: Snowflake;
/**
* Type of the command
*/
type: ApplicationCommandType;
/**
* Unique id of the parent application
*/
application_id: Snowflake;
/**
* Guild id of the command, if not global
*/
guild_id?: Snowflake;
/**
* 1-32 character name; `CHAT_INPUT` command names must be all lowercase matching `^[\w-]{1,32}$`
*/
name: string;
/**
* 1-100 character description for `CHAT_INPUT` commands, empty string for `USER` and `MESSAGE` commands
*/
description: string;
/**
* The parameters for the `CHAT_INPUT` command, max 25
*/
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;
/**
* Autoincrementing version identifier updated during substantial record changes
*/
version: Snowflake;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types
*/
export enum ApplicationCommandType {
ChatInput = 1,
User,
Message,
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export type APIApplicationCommandInteractionData =
| APIChatInputApplicationCommandInteractionData
| APIContextMenuInteractionData;
/**
* https://discord.com/developers/docs/resources/channel#channel-object
*/
export interface APIInteractionDataResolvedChannel extends Required<APIPartialChannel> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIInteractionDataResolvedGuildMember extends Omit<APIGuildMember, 'user' | 'deaf' | 'mute'> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationCommandInteractionData> =
APIBaseInteraction<InteractionType.ApplicationCommand, Data> &
Required<Pick<APIBaseInteraction<InteractionType.ApplicationCommand, Data>, 'channel_id' | 'data'>>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandDMInteraction =
| APIChatInputApplicationCommandDMInteraction
| APIContextMenuDMInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIApplicationCommandGuildInteraction =
| APIChatInputApplicationCommandGuildInteraction
| APIContextMenuGuildInteraction;

View File

@@ -0,0 +1,101 @@
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { InteractionType } from './responses.ts';
import type { APIMessage } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIUser } from '../user.ts';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object
*/
export interface APIMessageInteraction {
/**
* ID of the interaction
*/
id: Snowflake;
/**
* The type of interaction
*/
type: InteractionType;
/**
* The name of the ApplicationCommand
*/
name: string;
/**
* The user who invoked the interaction
*/
user: APIUser;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIInteractionGuildMember extends APIGuildMember {
permissions: Permissions;
user: APIUser;
}
// INTERACTIONS RECEIVED
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
/**
* ID of the interaction
*/
id: Snowflake;
/**
* ID of the application this interaction is for
*/
application_id: Snowflake;
/**
* The type of interaction
*/
type: Type;
/**
* The command data payload
*/
data?: Data;
/**
* The guild it was sent from
*/
guild_id?: Snowflake;
/**
* The channel it was sent from
*/
channel_id?: Snowflake;
/**
* Guild member data for the invoking user, including permissions
*
* **This is only sent when an interaction is invoked in a guild**
*/
member?: APIInteractionGuildMember;
/**
* User object for the invoking user, if invoked in a DM
*/
user?: APIUser;
/**
* A continuation token for responding to the interaction
*/
token: string;
/**
* Read-only property, always `1`
*/
version: 1;
/**
* For components, the message they were attached to
*/
message?: APIMessage;
}
export type APIDMInteractionWrapper<Original extends APIBaseInteraction<InteractionType, unknown>> = Omit<
Original,
'member' | 'guild_id'
> &
Required<Pick<Original, 'user'>>;
export type APIGuildInteractionWrapper<Original extends APIBaseInteraction<InteractionType, unknown>> = Omit<
Original,
'user'
> &
Required<Pick<Original, 'member' | 'guild_id'>>;

View File

@@ -0,0 +1,38 @@
import type { ComponentType } from '../channel.ts';
import type { APIBaseInteraction, InteractionType } from '../interactions.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
export type APIMessageComponentInteraction = APIBaseInteraction<
InteractionType.MessageComponent,
APIMessageComponentInteractionData
> &
Required<
Pick<
APIBaseInteraction<InteractionType.MessageComponent, APIMessageComponentInteractionData>,
'channel_id' | 'data' | 'message'
>
>;
export type APIMessageComponentInteractionData = APIMessageButtonInteractionData | APIMessageSelectMenuInteractionData;
export interface APIMessageComponentBaseInteractionData<CType extends ComponentType> {
/**
* The `custom_id` of the component
*/
custom_id: string;
/**
* The type of the component
*/
component_type: CType;
}
export type APIMessageButtonInteractionData = APIMessageComponentBaseInteractionData<ComponentType.Button>;
export interface APIMessageSelectMenuInteractionData
extends APIMessageComponentBaseInteractionData<ComponentType.SelectMenu> {
values: string[];
}
export type APIMessageComponentDMInteraction = APIDMInteractionWrapper<APIMessageComponentInteraction>;
export type APIMessageComponentGuildInteraction = APIGuildInteractionWrapper<APIMessageComponentInteraction>;

View File

@@ -0,0 +1,4 @@
import type { APIBaseInteraction } from './base.ts';
import type { InteractionType } from './responses.ts';
export type APIPingInteraction = APIBaseInteraction<InteractionType.Ping, never>;

View File

@@ -0,0 +1,78 @@
import type { MessageFlags } from '../mod.ts';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9.ts';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
*/
export enum InteractionType {
Ping = 1,
ApplicationCommand,
MessageComponent,
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object
*/
export type APIInteractionResponse =
| APIInteractionResponsePong
| APIInteractionResponseChannelMessageWithSource
| APIInteractionResponseDeferredChannelMessageWithSource
| APIInteractionResponseDeferredMessageUpdate
| APIInteractionResponseUpdateMessage;
export interface APIInteractionResponsePong {
type: InteractionResponseType.Pong;
}
export interface APIInteractionResponseChannelMessageWithSource {
type: InteractionResponseType.ChannelMessageWithSource;
data: APIInteractionResponseCallbackData;
}
export interface APIInteractionResponseDeferredChannelMessageWithSource {
type: InteractionResponseType.DeferredChannelMessageWithSource;
data?: Pick<APIInteractionResponseCallbackData, 'flags'>;
}
export interface APIInteractionResponseDeferredMessageUpdate {
type: InteractionResponseType.DeferredMessageUpdate;
}
export interface APIInteractionResponseUpdateMessage {
type: InteractionResponseType.UpdateMessage;
data?: APIInteractionResponseCallbackData;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
*/
export enum InteractionResponseType {
/**
* ACK a `Ping`
*/
Pong = 1,
/**
* Respond to an interaction with a message
*/
ChannelMessageWithSource = 4,
/**
* ACK an interaction and edit to a response later, the user sees a loading state
*/
DeferredChannelMessageWithSource,
/**
* ACK a button interaction and update it to a loading state
*/
DeferredMessageUpdate,
/**
* ACK a button interaction and edit the message to which the button was attached
*/
UpdateMessage,
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure
*/
export type APIInteractionResponseCallbackData = Omit<
RESTPostAPIWebhookWithTokenJSONBody,
'username' | 'avatar_url'
> & { flags?: MessageFlags };

View File

@@ -0,0 +1,109 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/application
*/
import type { Snowflake } from '../../globals.ts';
import type { APITeam } from './teams.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/resources/application#application-object
*/
export interface APIApplication {
/**
* The id of the app
*/
id: Snowflake;
/**
* The name of the app
*/
name: string;
/**
* The icon hash of the app
*/
icon: string | null;
/**
* The description of the app
*/
description: string;
/**
* An array of rpc origin urls, if rpc is enabled
*/
rpc_origins?: string[];
/**
* When `false` only app owner can join the app's bot to guilds
*/
bot_public: boolean;
/**
* 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
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
owner?: APIUser;
/**
* If this application is a game sold on Discord, this field will be the summary field for the store page
* of its primary sku
*/
summary: string;
/**
* 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
*/
verify_key: string;
/**
* The team this application belongs to
*
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
*/
team: APITeam | null;
/**
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
*/
guild_id?: Snowflake;
/**
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
*/
primary_sku_id?: Snowflake;
/**
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
*/
slug?: string;
/**
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
*/
cover_image?: string;
/**
* The application's public flags
*
* See https://discord.com/developers/docs/resources/application#application-object-application-flags
*/
flags: ApplicationFlags;
}
/**
* https://discord.com/developers/docs/resources/application#application-object-application-flags
*/
export enum ApplicationFlags {
ManagedEmoji = 1 << 2,
GroupDMCreate = 1 << 4,
RPCHasConnected = 1 << 11,
GatewayPresence = 1 << 12,
GatewayPresenceLimited = 1 << 13,
GatewayGuildMembers = 1 << 14,
GatewayGuildMembersLimited = 1 << 15,
VerificationPendingGuildLimit = 1 << 16,
Embedded = 1 << 17,
}

View File

@@ -0,0 +1,663 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/audit-log
*/
import type { Snowflake } from '../../globals.ts';
import type { APIChannel, APIOverwrite } from './channel.ts';
import type {
APIGuildIntegration,
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
GuildMFALevel,
GuildVerificationLevel,
IntegrationExpireBehavior,
} from './guild.ts';
import type { APIRole } from './permissions.ts';
import type { StickerFormatType } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { APIWebhook } from './webhook.ts';
import type { StageInstancePrivacyLevel } from './stageInstance.ts';
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
*/
export interface APIAuditLog {
/**
* Webhooks found in the audit log
*
* See https://discord.com/developers/docs/resources/webhook#webhook-object
*/
webhooks: APIWebhook[];
/**
* Users found in the audit log
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
users: APIUser[];
/**
* Audit log entries
*
* See https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object
*/
audit_log_entries: APIAuditLogEntry[];
/**
* Partial integration objects
*
* See https://discord.com/developers/docs/resources/guild#integration-object
*/
integrations: APIGuildIntegration[];
/**
* Threads found in the audit log
*
* Threads referenced in THREAD_CREATE and THREAD_UPDATE events are included in the threads map, since archived threads might not be kept in memory by clients.
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
threads: APIChannel[];
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure
*/
export interface APIAuditLogEntry {
/**
* ID of the affected entity (webhook, user, role, etc.)
*/
target_id: string | null;
/**
* Changes made to the `target_id`
*
* See https://discord.com/developers/docs/resources/audit-log#audit-log-change-object
*/
changes?: APIAuditLogChange[];
/**
* The user who made the changes
*
* This can be `null` in some cases (webhooks deleting themselves by using their own token, for example)
*/
user_id: Snowflake | null;
/**
* ID of the entry
*/
id: Snowflake;
/**
* Type of action that occurred
*
* See https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events
*/
action_type: AuditLogEvent;
/**
* Additional info for certain action types
*
* See https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
*/
options?: APIAuditLogOptions;
/**
* The reason for the change (0-512 characters)
*/
reason?: string;
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events
*/
export enum AuditLogEvent {
GuildUpdate = 1,
ChannelCreate = 10,
ChannelUpdate,
ChannelDelete,
ChannelOverwriteCreate,
ChannelOverwriteUpdate,
ChannelOverwriteDelete,
MemberKick = 20,
MemberPrune,
MemberBanAdd,
MemberBanRemove,
MemberUpdate,
MemberRoleUpdate,
MemberMove,
MemberDisconnect,
BotAdd,
RoleCreate = 30,
RoleUpdate,
RoleDelete,
InviteCreate = 40,
InviteUpdate,
InviteDelete,
WebhookCreate = 50,
WebhookUpdate,
WebhookDelete,
EmojiCreate = 60,
EmojiUpdate,
EmojiDelete,
MessageDelete = 72,
MessageBulkDelete,
MessagePin,
MessageUnpin,
IntegrationCreate = 80,
IntegrationUpdate,
IntegrationDelete,
StageInstanceCreate,
StageInstanceUpdate,
StageInstanceDelete,
StickerCreate = 90,
StickerUpdate,
StickerDelete,
ThreadCreate = 110,
ThreadUpdate,
ThreadDelete,
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info
*/
export interface APIAuditLogOptions {
/**
* Number of days after which inactive members were kicked
*
* Present from:
* - MEMBER_PRUNE
*/
delete_member_days?: string;
/**
* Number of members removed by the prune
*
* Present from:
* - MEMBER_PRUNE
*/
members_removed?: string;
/**
* Channel in which the entities were targeted
*
* Present from:
* - MEMBER_MOVE
* - MESSAGE_PIN
* - MESSAGE_UNPIN
* - MESSAGE_DELETE
* - STAGE_INSTANCE_CREATE
* - STAGE_INSTANCE_UPDATE
* - STAGE_INSTANCE_DELETE
*/
channel_id?: Snowflake;
/**
* ID of the message that was targeted
*
* Present from:
* - MESSAGE_PIN
* - MESSAGE_UNPIN
*/
message_id?: Snowflake;
/**
* Number of entities that were targeted
*
* Present from:
* - MESSAGE_DELETE
* - MESSAGE_BULK_DELETE
* - MEMBER_DISCONNECT
* - MEMBER_MOVE
*/
count?: string;
/**
* ID of the overwritten entity
*
* Present from:
* - CHANNEL_OVERWRITE_CREATE
* - CHANNEL_OVERWRITE_UPDATE
* - CHANNEL_OVERWRITE_DELETE
*/
id?: Snowflake;
/**
* Type of overwritten entity - "0" for "role" or "1" for "member"
*
* Present from:
* - CHANNEL_OVERWRITE_CREATE
* - CHANNEL_OVERWRITE_UPDATE
* - CHANNEL_OVERWRITE_DELETE
*
* {@link AuditLogOptionsType}
*/
type?: AuditLogOptionsType;
/**
* Name of the role
*
* Present from:
* - CHANNEL_OVERWRITE_CREATE
* - CHANNEL_OVERWRITE_UPDATE
* - CHANNEL_OVERWRITE_DELETE
*
* **Present only if the {@link APIAuditLogOptions#type entry type} is "0"**
*/
role_name?: string;
}
export enum AuditLogOptionsType {
Role = '0',
Member = '1',
}
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure
*/
export type APIAuditLogChange =
| APIAuditLogChangeKeyName
| APIAuditLogChangeKeyDescription
| APIAuditLogChangeKeyIconHash
| APIAuditLogChangeKeySplashHash
| APIAuditLogChangeKeyDiscoverySplashHash
| APIAuditLogChangeKeyBannerHash
| APIAuditLogChangeKeyOwnerId
| APIAuditLogChangeKeyRegion
| APIAuditLogChangeKeyPreferredLocale
| APIAuditLogChangeKeyAFKChannelId
| APIAuditLogChangeKeyAFKTimeout
| APIAuditLogChangeKeyRulesChannelId
| APIAuditLogChangeKeyPublicUpdatesChannelId
| APIAuditLogChangeKeyMFALevel
| APIAuditLogChangeKeyVerificationLevel
| APIAuditLogChangeKeyExplicitContentFilter
| APIAuditLogChangeKeyDefaultMessageNotifications
| APIAuditLogChangeKeyVanityURLCode
| APIAuditLogChangeKey$Add
| APIAuditLogChangeKey$Remove
| APIAuditLogChangeKeyPruneDeleteDays
| APIAuditLogChangeKeyWidgetEnabled
| APIAuditLogChangeKeyWidgetChannelId
| APIAuditLogChangeKeySystemChannelId
| APIAuditLogChangeKeyPosition
| APIAuditLogChangeKeyTopic
| APIAuditLogChangeKeyBitrate
| APIAuditLogChangeKeyPermissionOverwrites
| APIAuditLogChangeKeyNSFW
| APIAuditLogChangeKeyApplicationId
| APIAuditLogChangeKeyRateLimitPerUser
| APIAuditLogChangeKeyPermissions
| APIAuditLogChangeKeyColor
| APIAuditLogChangeKeyHoist
| APIAuditLogChangeKeyMentionable
| APIAuditLogChangeKeyAllow
| APIAuditLogChangeKeyDeny
| APIAuditLogChangeKeyCode
| APIAuditLogChangeKeyChannelId
| APIAuditLogChangeKeyInviterId
| APIAuditLogChangeKeyMaxUses
| APIAuditLogChangeKeyUses
| APIAuditLogChangeKeyMaxAge
| APIAuditLogChangeKeyTemporary
| APIAuditLogChangeKeyDeaf
| APIAuditLogChangeKeyMute
| APIAuditLogChangeKeyNick
| APIAuditLogChangeKeyAvatarHash
| APIAuditLogChangeKeyId
| APIAuditLogChangeKeyType
| APIAuditLogChangeKeyEnableEmoticons
| APIAuditLogChangeKeyExpireBehavior
| APIAuditLogChangeKeyExpireGracePeriod
| APIAuditLogChangeKeyUserLimit
| APIAuditLogChangeKeyPrivacyLevel
| APIAuditLogChangeKeyTags
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildId
| APIAuditLogChangeKeyArchived
| APIAuditLogChangeKeyLocked
| APIAuditLogChangeKeyAutoArchiveDuration
| APIAuditLogChangeKeyDefaultAutoArchiveDuration;
/**
* Returned when an entity's name is changed
*/
export type APIAuditLogChangeKeyName = AuditLogChangeData<'name', string>;
/**
* Returned when a guild's or sticker's description is changed
*/
export type APIAuditLogChangeKeyDescription = AuditLogChangeData<'description', string>;
/**
* Returned when a guild's icon is changed
*/
export type APIAuditLogChangeKeyIconHash = AuditLogChangeData<'icon_hash', string>;
/**
* Returned when a guild's splash is changed
*/
export type APIAuditLogChangeKeySplashHash = AuditLogChangeData<'splash_hash', string>;
/**
* Returned when a guild's discovery splash is changed
*/
export type APIAuditLogChangeKeyDiscoverySplashHash = AuditLogChangeData<'discovery_splash_hash', string>;
/**
* Returned when a guild's banner hash is changed
*/
export type APIAuditLogChangeKeyBannerHash = AuditLogChangeData<'banner_hash', string>;
/**
* Returned when a guild's owner_id is changed
*/
export type APIAuditLogChangeKeyOwnerId = AuditLogChangeData<'owner_id', Snowflake>;
/**
* Returned when a guild's region is changed
*/
export type APIAuditLogChangeKeyRegion = AuditLogChangeData<'region', string>;
/**
* Returned when a guild's preferred_locale is changed
*/
export type APIAuditLogChangeKeyPreferredLocale = AuditLogChangeData<'preferred_locale', string>;
/**
* Returned when a guild's afk_channel_id is changed
*/
export type APIAuditLogChangeKeyAFKChannelId = AuditLogChangeData<'afk_channel_id', Snowflake>;
/**
* Returned when a guild's afk_timeout is changed
*/
export type APIAuditLogChangeKeyAFKTimeout = AuditLogChangeData<'afk_timeout', number>;
/**
* Returned when a guild's rules_channel_id is changed
*/
export type APIAuditLogChangeKeyRulesChannelId = AuditLogChangeData<'rules_channel_id', string>;
/**
* Returned when a guild's public_updates_channel_id is changed
*/
export type APIAuditLogChangeKeyPublicUpdatesChannelId = AuditLogChangeData<'public_updates_channel_id', string>;
/**
* Returned when a guild's mfa_level is changed
*/
export type APIAuditLogChangeKeyMFALevel = AuditLogChangeData<'mfa_level', GuildMFALevel>;
/**
* Returned when a guild's verification_level is changed
*/
export type APIAuditLogChangeKeyVerificationLevel = AuditLogChangeData<'verification_level', GuildVerificationLevel>;
/**
* Returned when a guild's explicit_content_filter is changed
*/
export type APIAuditLogChangeKeyExplicitContentFilter = AuditLogChangeData<
'explicit_content_filter',
GuildExplicitContentFilter
>;
/**
* Returned when a guild's default_message_notifications is changed
*/
export type APIAuditLogChangeKeyDefaultMessageNotifications = AuditLogChangeData<
'default_message_notifications',
GuildDefaultMessageNotifications
>;
/**
* Returned when a guild's vanity_url_code is changed
*/
export type APIAuditLogChangeKeyVanityURLCode = AuditLogChangeData<'vanity_url_code', string>;
/**
* Returned when new role(s) are added
*/
export type APIAuditLogChangeKey$Add = AuditLogChangeData<'$add', APIRole[]>;
/**
* Returned when role(s) are removed
*/
export type APIAuditLogChangeKey$Remove = AuditLogChangeData<'$remove', APIRole[]>;
/**
* Returned when there is a change in number of days after which inactive and role-unassigned members are kicked
*/
export type APIAuditLogChangeKeyPruneDeleteDays = AuditLogChangeData<'prune_delete_days', number>;
/**
* Returned when a guild's widget is enabled
*/
export type APIAuditLogChangeKeyWidgetEnabled = AuditLogChangeData<'widget_enabled', boolean>;
/**
* Returned when a guild's widget_channel_id is changed
*/
export type APIAuditLogChangeKeyWidgetChannelId = AuditLogChangeData<'widget_channel_id', Snowflake>;
/**
* Returned when a guild's system_channel_id is changed
*/
export type APIAuditLogChangeKeySystemChannelId = AuditLogChangeData<'system_channel_id', Snowflake>;
/**
* Returned when a channel's position is changed
*/
export type APIAuditLogChangeKeyPosition = AuditLogChangeData<'position', number>;
/**
* Returned when a channel's topic is changed
*/
export type APIAuditLogChangeKeyTopic = AuditLogChangeData<'topic', string>;
/**
* Returned when a voice channel's bitrate is changed
*/
export type APIAuditLogChangeKeyBitrate = AuditLogChangeData<'bitrate', number>;
/**
* Returned when a channel's permission overwrites is changed
*/
export type APIAuditLogChangeKeyPermissionOverwrites = AuditLogChangeData<'permission_overwrites', APIOverwrite[]>;
/**
* Returned when a channel's NSFW restriction is changed
*/
export type APIAuditLogChangeKeyNSFW = AuditLogChangeData<'nsfw', boolean>;
/**
* The application ID of the added or removed Webhook or Bot
*/
export type APIAuditLogChangeKeyApplicationId = AuditLogChangeData<'application_id', Snowflake>;
/**
* Returned when a channel's amount of seconds a user has to wait before sending another message
* is changed
*/
export type APIAuditLogChangeKeyRateLimitPerUser = AuditLogChangeData<'rate_limit_per_user', number>;
/**
* Returned when a permission bitfield is changed
*/
export type APIAuditLogChangeKeyPermissions = AuditLogChangeData<'permissions', string>;
/**
* Returned when a role's color is changed
*/
export type APIAuditLogChangeKeyColor = AuditLogChangeData<'color', number>;
/**
* Returned when a role's hoist status is changed
*/
export type APIAuditLogChangeKeyHoist = AuditLogChangeData<'hoist', boolean>;
/**
* Returned when a role's mentionable status is changed
*/
export type APIAuditLogChangeKeyMentionable = AuditLogChangeData<'mentionable', boolean>;
/**
* Returned when an overwrite's allowed permissions bitfield is changed
*/
export type APIAuditLogChangeKeyAllow = AuditLogChangeData<'allow', string>;
/**
* Returned when an overwrite's denied permissions bitfield is changed
*/
export type APIAuditLogChangeKeyDeny = AuditLogChangeData<'deny', string>;
/**
* Returned when an invite's code is changed
*/
export type APIAuditLogChangeKeyCode = AuditLogChangeData<'code', string>;
/**
* Returned when an invite's channel_id is changed
*/
export type APIAuditLogChangeKeyChannelId = AuditLogChangeData<'channel_id', Snowflake>;
/**
* Returned when an invite's inviter_id is changed
*/
export type APIAuditLogChangeKeyInviterId = AuditLogChangeData<'inviter_id', Snowflake>;
/**
* Returned when an invite's max_uses is changed
*/
export type APIAuditLogChangeKeyMaxUses = AuditLogChangeData<'max_uses', number>;
/**
* Returned when an invite's uses is changed
*/
export type APIAuditLogChangeKeyUses = AuditLogChangeData<'uses', number>;
/**
* Returned when an invite's max_age is changed
*/
export type APIAuditLogChangeKeyMaxAge = AuditLogChangeData<'max_age', number>;
/**
* Returned when an invite's temporary status is changed
*/
export type APIAuditLogChangeKeyTemporary = AuditLogChangeData<'temporary', boolean>;
/**
* Returned when a user's deaf status is changed
*/
export type APIAuditLogChangeKeyDeaf = AuditLogChangeData<'deaf', boolean>;
/**
* Returned when a user's mute status is changed
*/
export type APIAuditLogChangeKeyMute = AuditLogChangeData<'mute', boolean>;
/**
* Returned when a user's nick is changed
*/
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', string>;
/**
* Returned when a user's avatar_hash is changed
*/
export type APIAuditLogChangeKeyAvatarHash = AuditLogChangeData<'avatar_hash', string>;
/**
* The ID of the changed entity - sometimes used in conjunction with other keys
*/
export type APIAuditLogChangeKeyId = AuditLogChangeData<'id', Snowflake>;
/**
* The type of entity created
*/
export type APIAuditLogChangeKeyType = AuditLogChangeData<'type', number | string>;
/**
* Returned when an integration's enable_emoticons is changed
*/
export type APIAuditLogChangeKeyEnableEmoticons = AuditLogChangeData<'enable_emoticons', boolean>;
/**
* Returned when an integration's expire_behavior is changed
*/
export type APIAuditLogChangeKeyExpireBehavior = AuditLogChangeData<'expire_behavior', IntegrationExpireBehavior>;
/**
* Returned when an integration's expire_grace_period is changed
*/
export type APIAuditLogChangeKeyExpireGracePeriod = AuditLogChangeData<'expire_grace_period', number>;
/**
* Returned when a voice channel's user_limit is changed
*/
export type APIAuditLogChangeKeyUserLimit = AuditLogChangeData<'user_limit', number>;
/**
* Returned when privacy level of a stage instance is changed
*/
export type APIAuditLogChangeKeyPrivacyLevel = AuditLogChangeData<'privacy_level', StageInstancePrivacyLevel>;
/**
* Returned when a sticker's related emoji is changed
*/
export type APIAuditLogChangeKeyTags = AuditLogChangeData<'tags', string>;
/**
* Returned when a sticker's format_type is changed
*/
export type APIAuditLogChangeKeyFormatType = AuditLogChangeData<'format_type', StickerFormatType>;
/**
* Empty string
*/
export type APIAuditLogChangeKeyAsset = AuditLogChangeData<'asset', ''>;
/**
* Returned when a sticker's availability is changed
*/
export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', boolean>;
/**
* Returned when a sticker's guild_id is changed
*/
export type APIAuditLogChangeKeyGuildId = AuditLogChangeData<'guild_id', Snowflake>;
/*
* Returned when a thread's archive status is changed
*/
export type APIAuditLogChangeKeyArchived = AuditLogChangeData<'archived', boolean>;
/*
* Returned when a thread's lock status is changed
*/
export type APIAuditLogChangeKeyLocked = AuditLogChangeData<'locked', boolean>;
/*
* Returned when a thread's auto archive duration is changed
*/
export type APIAuditLogChangeKeyAutoArchiveDuration = AuditLogChangeData<'auto_archive_duration', number>;
/*
* Returned when a channel's default auto archive duration for newly created threads is changed
*/
export type APIAuditLogChangeKeyDefaultAutoArchiveDuration = AuditLogChangeData<
'default_auto_archive_duration',
number
>;
interface AuditLogChangeData<K extends string, D extends unknown> {
key: K;
/**
* The new value
*
* If `new_value` is not present in the change object, while `old_value` is,
* that means the property that was changed has been reset, or set to `null`
*/
new_value?: D;
old_value?: D;
}

1205
deno/payloads/v9/channel.ts Normal file

File diff suppressed because it is too large Load Diff

51
deno/payloads/v9/emoji.ts Normal file
View File

@@ -0,0 +1,51 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/emoji
*/
import type { Snowflake } from '../../globals.ts';
import type { APIRole } from './permissions.ts';
import type { APIUser } from './user.ts';
/**
* Not documented but mentioned
*/
export interface APIPartialEmoji {
/**
* Emoji id
*/
id: Snowflake | null;
/**
* Emoji name (can be null only in reaction emoji objects)
*/
name: string | null;
/**
* Whether this emoji is animated
*/
animated?: boolean;
}
/**
* https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure
*/
export interface APIEmoji extends APIPartialEmoji {
/**
* Roles this emoji is whitelisted to
*/
roles?: APIRole['id'][];
/**
* User that created this emoji
*/
user?: APIUser;
/**
* Whether this emoji must be wrapped in colons
*/
require_colons?: boolean;
/**
* Whether this emoji is managed
*/
managed?: boolean;
/**
* Whether this emoji can be used, may be false due to loss of Server Boosts
*/
available?: boolean;
}

361
deno/payloads/v9/gateway.ts Normal file
View File

@@ -0,0 +1,361 @@
/**
* Types extracted from https://discord.com/developers/docs/topics/gateway
*/
import type { Snowflake } from '../../globals.ts';
import type { APIChannel, APIThreadMember } from './channel.ts';
import type { APIEmoji } from './emoji.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway
*/
export interface APIGatewayInfo {
/**
* The WSS URL that can be used for connecting to the gateway
*/
url: string;
}
/**
* https://discord.com/developers/docs/topics/gateway#get-gateway-bot
*/
export interface APIGatewayBotInfo extends APIGatewayInfo {
/**
* The recommended number of shards to use when connecting
*
* See https://discord.com/developers/docs/topics/gateway#sharding
*/
shards: number;
/**
* Information on the current session start limit
*
* See https://discord.com/developers/docs/topics/gateway#session-start-limit-object
*/
session_start_limit: APIGatewaySessionStartLimit;
}
/**
* https://discord.com/developers/docs/topics/gateway#session-start-limit-object
*/
export interface APIGatewaySessionStartLimit {
/**
* The total number of session starts the current user is allowed
*/
total: number;
/**
* The remaining number of session starts the current user is allowed
*/
remaining: number;
/**
* The number of milliseconds after which the limit resets
*/
reset_after: number;
/**
* The number of identify requests allowed per 5 seconds
*/
max_concurrency: number;
}
/**
* https://discord.com/developers/docs/topics/gateway#presence-update-presence-update-event-fields
*/
export interface GatewayPresenceUpdate {
/**
* The user presence is being updated for
*
* **The user object within this event can be partial, the only field which must be sent is the `id` field,
* everything else is optional.**
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
user: Partial<APIUser> & Pick<APIUser, 'id'>;
/**
* ID of the guild
*/
guild_id: Snowflake;
/**
* Either "idle", "dnd", "online", or "offline"
*/
status?: PresenceUpdateStatus;
/**
* User's current activities
*
* See https://discord.com/developers/docs/topics/gateway#activity-object
*/
activities?: GatewayActivity[];
/**
* User's platform-dependent status
*
* See https://discord.com/developers/docs/topics/gateway#client-status-object
*/
client_status?: GatewayPresenceClientStatus;
}
export enum PresenceUpdateStatus {
Online = 'online',
DoNotDisturb = 'dnd',
Idle = 'idle',
/**
* Invisible and shown as offline
*/
Invisible = 'invisible',
Offline = 'offline',
}
/**
* https://discord.com/developers/docs/topics/gateway#client-status-object
*/
export interface GatewayPresenceClientStatus {
/**
* The user's status set for an active desktop (Windows, Linux, Mac) application session
*/
desktop?: PresenceUpdateStatus;
/**
* The user's status set for an active mobile (iOS, Android) application session
*/
mobile?: PresenceUpdateStatus;
/**
* The user's status set for an active web (browser, bot account) application session
*/
web?: PresenceUpdateStatus;
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-structure
*/
export interface GatewayActivity {
/**
* The activity's id
*/
id: string;
/**
* The activity's name
*/
name: string;
/**
* Activity type
*
* See https://discord.com/developers/docs/topics/gateway#activity-object-activity-types
*/
type: ActivityType;
/**
* Stream url, is validated when type is `1`
*/
url?: string | null;
/**
* Unix timestamp of when the activity was added to the user's session
*/
created_at: number;
/**
* Unix timestamps for start and/or end of the game
*/
timestamps?: GatewayActivityTimestamps;
sync_id?: string;
platform?: ActivityPlatform;
/**
* Application id for the game
*/
application_id?: Snowflake;
/**
* What the player is currently doing
*/
details?: string | null;
/**
* The user's current party status
*/
state?: string | null;
/**
* The emoji used for a custom status
*
* See https://discord.com/developers/docs/topics/gateway#activity-object-activity-emoji
*/
emoji?: GatewayActivityEmoji;
session_id?: string;
/**
* Information for the current party of the player
*
* See https://discord.com/developers/docs/topics/gateway#activity-object-activity-party
*/
party?: GatewayActivityParty;
/**
* Images for the presence and their hover texts
*
* See https://discord.com/developers/docs/topics/gateway#activity-object-activity-assets
*/
assets?: GatewayActivityAssets;
/**
* Secrets for Rich Presence joining and spectating
*
* See https://discord.com/developers/docs/topics/gateway#activity-object-activity-secrets
*/
secrets?: GatewayActivitySecrets;
/**
* Whether or not the activity is an instanced game session
*/
instance?: boolean;
/**
* Activity flags `OR`d together, describes what the payload includes
*
* See https://discord.com/developers/docs/topics/gateway#activity-object-activity-flags
*
* See https://en.wikipedia.org/wiki/Bit_field
*/
flags?: ActivityFlags;
/**
* The custom buttons shown in the Rich Presence (max 2)
*/
buttons?: string[] | GatewayActivityButton[];
}
export enum ActivityPlatform {
Desktop = 'desktop',
Samsung = 'samsung',
Xbox = 'xbox',
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-types
*/
export enum ActivityType {
/**
* Playing {game}
*/
Game,
/**
* Streaming {details}
*/
Streaming,
/**
* Listening to {name}
*/
Listening,
/**
* Watching {details}
*/
Watching,
/**
* {emoji} {details}
*/
Custom,
/**
* Competing in {name}
*/
Competing,
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-timestamps
*/
export interface GatewayActivityTimestamps {
/**
* Unix time (in milliseconds) of when the activity started
*/
start?: number;
/**
* Unix time (in milliseconds) of when the activity ends
*/
end?: number;
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-emoji
*/
export type GatewayActivityEmoji = Partial<Pick<APIEmoji, 'id' | 'animated'>> & Pick<APIEmoji, 'name'>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-party
*/
export interface GatewayActivityParty {
/**
* The id of the party
*/
id?: string;
/**
* Used to show the party's current and maximum size
*/
size?: [current_size: number, max_size: number];
}
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-assets
*/
export type GatewayActivityAssets = Partial<
Record<'large_image' | 'large_text' | 'small_image' | 'small_text', string>
>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-secrets
*/
export type GatewayActivitySecrets = Partial<Record<'join' | 'spectate' | 'match', string>>;
/**
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-flags
*/
export enum ActivityFlags {
Instance = 1 << 0,
Join = 1 << 1,
Spectate = 1 << 2,
JoinRequest = 1 << 3,
Sync = 1 << 4,
Play = 1 << 5,
}
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;
}
/**
* https://discord.com/developers/docs/topics/gateway#thread-list-sync-thread-list-sync-event-fields
*/
export interface GatewayThreadListSync {
/**
* ID of the guild
*/
guild_id: Snowflake;
/**
* The ids of all the parent channels whose threads are being synced, otherwise the entire guild
*/
channel_ids?: Snowflake[];
/**
* Array of the synced threads
*/
threads: APIChannel[];
/**
* The member objects for the client user in each joined thread that was synced
*/
members: APIThreadMember[];
}
/**
* https://discord.com/developers/docs/topics/gateway#thread-members-update-thread-members-update-event-fields
*/
export interface GatewayThreadMembersUpdate {
/**
* The id of the thread for which members are being synced
*/
id: Snowflake;
/**
* The id of the guild that the thread is in
*/
guild_id: Snowflake;
/**
* The approximate member count of the thread, does not count above 50 even if there are more members
*/
member_count: number;
/**
* The members that were added to the thread
*/
added_members?: APIThreadMember[];
/**
* The ids of the members that were removed from the thread
*/
removed_member_ids?: Snowflake[];
}

934
deno/payloads/v9/guild.ts Normal file
View File

@@ -0,0 +1,934 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/guild
*/
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';
import type { APIRole } from './permissions.ts';
import type { APIStageInstance } from './stageInstance.ts';
import type { APISticker } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { GatewayVoiceState } from './voice.ts';
/**
* https://discord.com/developers/docs/resources/guild#unavailable-guild-object
*/
export interface APIUnavailableGuild {
/**
* Guild id
*/
id: Snowflake;
/**
* `true` if this guild is unavailable due to an outage
*/
unavailable: boolean;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
*/
export interface APIPartialGuild extends Omit<APIUnavailableGuild, 'unavailable'>, Pick<APIGuild, 'welcome_screen'> {
/**
* Guild name (2-100 characters, excluding trailing and leading whitespace)
*/
name: string;
/**
* Icon hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
icon: string | null;
/**
* Splash hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
splash: string | null;
/**
* Banner hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
banner?: string | null;
/**
* The description for the guild, if the guild is discoverable
*/
description?: string | null;
/**
* Enabled guild features
*
* See https://discord.com/developers/docs/resources/guild#guild-object-guild-features
*/
features?: GuildFeature[];
/**
* Verification level required for the guild
*
* See https://discord.com/developers/docs/resources/guild#guild-object-verification-level
*/
verification_level?: GuildVerificationLevel;
/**
* The vanity url code for the guild
*/
vanity_url_code?: string | null;
/**
* `true` if this guild is unavailable due to an outage
*/
unavailable?: boolean;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
*/
export interface APIGuild extends APIPartialGuild {
/**
* Icon hash, returned when in the template object
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
icon_hash?: string | null;
/**
* Discovery splash hash; only present for guilds with the "DISCOVERABLE" feature
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
discovery_splash: string | null;
/**
* `true` if the user is the owner of the guild
*
* **This field is only received from https://discord.com/developers/docs/resources/user#get-current-user-guilds**
*/
owner?: boolean;
/**
* ID of owner
*/
owner_id: Snowflake;
/**
* Total permissions for the user in the guild (excludes overrides)
*
* **This field is only received from https://discord.com/developers/docs/resources/user#get-current-user-guilds**
*
* See https://en.wikipedia.org/wiki/Bit_field
*/
permissions?: Permissions;
/**
* 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;
/**
* ID of afk channel
*/
afk_channel_id: Snowflake | null;
/**
* afk timeout in seconds
*/
afk_timeout: number;
/**
* `true` if the guild widget is enabled
*/
widget_enabled?: boolean;
/**
* The channel id that the widget will generate an invite to, or `null` if set to no invite
*/
widget_channel_id?: Snowflake | null;
/**
* Verification level required for the guild
*
* See https://discord.com/developers/docs/resources/guild#guild-object-verification-level
*/
verification_level: GuildVerificationLevel;
/**
* Default message notifications level
*
* See https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
*/
default_message_notifications: GuildDefaultMessageNotifications;
/**
* Explicit content filter level
*
* See https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
*/
explicit_content_filter: GuildExplicitContentFilter;
/**
* Roles in the guild
*
* See https://discord.com/developers/docs/topics/permissions#role-object
*/
roles: APIRole[];
/**
* Custom guild emojis
*
* See https://discord.com/developers/docs/resources/emoji#emoji-object
*/
emojis: APIEmoji[];
/**
* Enabled guild features
*
* See https://discord.com/developers/docs/resources/guild#guild-object-guild-features
*/
features: GuildFeature[];
/**
* Required MFA level for the guild
*
* See https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
*/
mfa_level: GuildMFALevel;
/**
* Application id of the guild creator if it is bot-created
*/
application_id: Snowflake | null;
/**
* The id of the channel where guild notices such as welcome messages and boost events are posted
*/
system_channel_id: Snowflake | null;
/**
* System channel flags
*
* See https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
*/
system_channel_flags: GuildSystemChannelFlags;
/**
* The id of the channel where Community guilds can display rules and/or guidelines
*/
rules_channel_id: Snowflake | null;
/**
* When this guild was joined at
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*/
joined_at?: string;
/**
* `true` if this is considered a large guild
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*/
large?: boolean;
/**
* Total number of members in this guild
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*/
member_count?: number;
/**
* States of members currently in voice channels; lacks the `guild_id` key
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*
* See https://discord.com/developers/docs/resources/voice#voice-state-object
*/
voice_states?: Omit<GatewayVoiceState, 'guild_id'>[];
/**
* Users in the guild
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
members?: APIGuildMember[];
/**
* Channels in the guild
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
channels?: APIChannel[];
/**
* Threads in the guild
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
threads?: APIChannel[];
/**
* Presences of the members in the guild, will only include non-offline members if the size is greater than `large_threshold`
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*
* See https://discord.com/developers/docs/topics/gateway#presence-update
*/
presences?: GatewayPresenceUpdate[];
/**
* The maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds)
*/
max_presences?: number | null;
/**
* The maximum number of members for the guild
*/
max_members?: number;
/**
* The vanity url code for the guild
*/
vanity_url_code: string | null;
/**
* The description for the guild, if the guild is discoverable
*/
description: string | null;
/**
* Banner hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
banner: string | null;
/**
* Premium tier (Server Boost level)
*
* See https://discord.com/developers/docs/resources/guild#guild-object-premium-tier
*/
premium_tier: GuildPremiumTier;
/**
* The number of boosts this guild currently has
*/
premium_subscription_count?: number;
/**
* The preferred locale of a Community guild; used in guild discovery and notices from Discord; defaults to "en-US"
*
* @default "en-US"
*/
preferred_locale: string;
/**
* The id of the channel where admins and moderators of Community guilds receive notices from Discord
*/
public_updates_channel_id: Snowflake | null;
/**
* The maximum amount of users in a video channel
*/
max_video_channel_users?: number;
/**
* **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_member_count?: number;
/**
* **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;
/**
* The nsfw level of the guild
*
* See https://discord.com/developers/docs/resources/guild#guild-object-guild-nsfw-level
*/
nsfw_level: GuildNSFWLevel;
/**
* The stage instances in the guild
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*
* See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure
*/
stage_instances?: APIStageInstance[];
/**
* Custom guild stickers
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
stickers: APISticker[];
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
*/
export enum GuildDefaultMessageNotifications {
AllMessages,
OnlyMentions,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
*/
export enum GuildExplicitContentFilter {
Disabled,
MembersWithoutRoles,
AllMembers,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
*/
export enum GuildMFALevel {
None,
Elevated,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-nsfw-level
*/
export enum GuildNSFWLevel {
Default,
Explicit,
Safe,
AgeRestricted,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-verification-level
*/
export enum GuildVerificationLevel {
/**
* Unrestricted
*/
None,
/**
* Must have verified email on account
*/
Low,
/**
* Must be registered on Discord for longer than 5 minutes
*/
Medium,
/**
* Must be a member of the guild for longer than 10 minutes
*/
High,
/**
* Must have a verified phone number
*/
VeryHigh,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-premium-tier
*/
export enum GuildPremiumTier {
None,
Tier1,
Tier2,
Tier3,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
*/
export enum GuildSystemChannelFlags {
/**
* Suppress member join notifications
*/
SuppressJoinNotifications = 1 << 0,
/**
* Suppress server boost notifications
*/
SuppressPremiumSubscriptions = 1 << 1,
/**
* Suppress server setup tips
*/
SuppressGuildReminderNotifications = 1 << 2,
}
/**
* https://discord.com/developers/docs/resources/guild#guild-object-guild-features
*/
export enum GuildFeature {
/**
* Guild has access to set an animated guild icon
*/
AnimatedIcon = 'ANIMATED_ICON',
/**
* Guild has access to set a guild banner image
*/
Banner = 'BANNER',
/**
* Guild has access to use commerce features (i.e. create store channels)
*/
Commerce = 'COMMERCE',
/**
* Guild can enable welcome screen, Membership Screening and discovery, and receives community updates
*/
Community = 'COMMUNITY',
/**
* Guild is able to be discovered in the directory
*/
Discoverable = 'DISCOVERABLE',
/**
* Guild is able to be featured in the directory
*/
Featurable = 'FEATURABLE',
/**
* Guild has access to set an invite splash background
*/
InviteSplash = 'INVITE_SPLASH',
/**
* Guild has access to create news channels
*/
News = 'NEWS',
/**
* Guild is partnered
*/
Partnered = 'PARTNERED',
RelayEnabled = 'RELAY_ENABLED',
/**
* Guild has access to set a vanity URL
*/
VanityURL = 'VANITY_URL',
/**
* Guild is verified
*/
Verified = 'VERIFIED',
/**
* Guild has access to set 384kbps bitrate in voice (previously VIP voice servers)
*/
VIPRegions = 'VIP_REGIONS',
/**
* Guild has enabled the welcome screen
*/
WelcomeScreenEnabled = 'WELCOME_SCREEN_ENABLED',
/**
* Guild has enabled Membership Screening
*/
MemberVerificationGateEnabled = 'MEMBER_VERIFICATION_GATE_ENABLED',
/**
* Guild can be previewed before joining via Membership Screening or the directory
*/
PreviewEnabled = 'PREVIEW_ENABLED',
/**
* Guild has enabled ticketed events
*/
TicketedEventsEnabled = 'TICKETED_EVENTS_ENABLED',
/**
* Guild has enabled monetization
*/
MonetizationEnabled = 'MONETIZATION_ENABLED',
/**
* Guild has increased custom sticker slots
*/
MoreStickers = 'MORE_STICKERS',
/**
* Guild has access to the three day archive time for threads
*/
ThreeDayThreadArchive = 'THREE_DAY_THREAD_ARCHIVE',
/**
* Guild has access to the seven day archive time for threads
*/
SevenDayThreadArchive = 'SEVEN_DAY_THREAD_ARCHIVE',
/**
* Guild has access to create private threads
*/
PrivateThreads = 'PRIVATE_THREADS',
}
/**
* https://discord.com/developers/docs/resources/guild#guild-preview-object
*/
export interface APIGuildPreview {
/**
* Guild id
*/
id: Snowflake;
/**
* Guild name (2-100 characters)
*/
name: string;
/**
* Icon hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
icon: string | null;
/**
* Splash hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
splash: string | null;
/**
* Discovery splash hash; only present for guilds with the "DISCOVERABLE" feature
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
discovery_splash: string | null;
/**
* Custom guild emojis
*
* See https://discord.com/developers/docs/resources/emoji#emoji-object
*/
emojis: APIEmoji[];
/**
* Enabled guild features
*
* See https://discord.com/developers/docs/resources/guild#guild-object-guild-features
*/
features: GuildFeature[];
/**
* Approximate number of members in this guild
*/
approximate_member_count: number;
/**
* Approximate number of online members in this guild
*/
approximate_presence_count: number;
/**
* The description for the guild
*/
description: string;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-widget-object
*/
export interface APIGuildWidgetSettings {
/**
* Whether the widget is enabled
*/
enabled: boolean;
/**
* The widget channel id
*/
channel_id: Snowflake | null;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIGuildMember {
/**
* The user this guild member represents
*
* **This field won't be included in the member object attached to `MESSAGE_CREATE` and `MESSAGE_UPDATE` gateway events.**
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
user?: APIUser;
/**
* This users guild nickname
*/
nick?: string | null;
/**
* Array of role object ids
*
* See https://discord.com/developers/docs/topics/permissions#role-object
*/
roles: Snowflake[];
/**
* When the user joined the guild
*/
joined_at: string;
/**
* When the user started boosting the guild
*
* See https://support.discord.com/hc/en-us/articles/360028038352-Server-Boosting-
*/
premium_since?: string | null;
/**
* Whether the user is deafened in voice channels
*/
deaf: boolean;
/**
* Whether the user is muted in voice channels
*/
mute: boolean;
/**
* Whether the user has not yet passed the guild's Membership Screening requirements
*
* *If this field is not present, it can be assumed as `false`.*
*/
pending?: boolean;
}
/**
* https://discord.com/developers/docs/resources/guild#integration-object
*/
export interface APIGuildIntegration {
/**
* Integration id
*/
id: Snowflake;
/**
* Integration name
*/
name: string;
/**
* Integration type
*/
type: APIGuildInteractionType;
/**
* Is this integration enabled
*/
enabled: boolean;
/**
* Is this integration syncing
*
* **This field is not provided for `discord` bot integrations.**
*/
syncing?: boolean;
/**
* ID that this integration uses for "subscribers"
*
* **This field is not provided for `discord` bot integrations.**
*/
role_id?: Snowflake;
/**
* Whether emoticons should be synced for this integration (`twitch` only currently)
*
* **This field is not provided for `discord` bot integrations.**
*/
enable_emoticons?: boolean;
/**
* The behavior of expiring subscribers
*
* **This field is not provided for `discord` bot integrations.**
*
* See https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
*/
expire_behavior?: IntegrationExpireBehavior;
/**
* The grace period (in days) before expiring subscribers
*
* **This field is not provided for `discord` bot integrations.**
*/
expire_grace_period?: number;
/**
* User for this integration
*
* **This field is not provided for `discord` bot integrations.**
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
user?: APIUser;
/**
* Integration account information
*
* See https://discord.com/developers/docs/resources/guild#integration-account-object
*/
account: APIIntegrationAccount;
/**
* When this integration was last synced
*
* **This field is not provided for `discord` bot integrations.**
*/
synced_at?: string;
/**
* How many subscribers this integration has
*
* **This field is not provided for `discord` bot integrations.**
*/
subscriber_count?: number;
/**
* Has this integration been revoked
*
* **This field is not provided for `discord` bot integrations.**
*/
revoked?: boolean;
/**
* The bot/OAuth2 application for discord integrations
*
* See https://discord.com/developers/docs/resources/guild#integration-application-object
*
* **This field is not provided for `discord` bot integrations.**
*/
application?: APIGuildIntegrationApplication;
}
export type APIGuildInteractionType = 'twitch' | 'youtube' | 'discord';
/**
* https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
*/
export enum IntegrationExpireBehavior {
RemoveRole,
Kick,
}
/**
* https://discord.com/developers/docs/resources/guild#integration-account-object
*/
export interface APIIntegrationAccount {
/**
* ID of the account
*/
id: string;
/**
* Name of the account
*/
name: string;
}
/**
* https://discord.com/developers/docs/resources/guild#integration-application-object
*/
export interface APIGuildIntegrationApplication {
/**
* The id of the app
*/
id: Snowflake;
/**
* The name of the app
*/
name: string;
/**
* The icon hash of the app
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
icon: string | null;
/**
* The description of the app
*/
description: string;
/**
* The summary of the app
*/
summary: string;
/**
* The bot associated with this application
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
bot?: APIUser;
}
/**
* https://discord.com/developers/docs/resources/guild#ban-object
*/
export interface APIBan {
/**
* The reason for the ban
*/
reason: string | null;
/**
* The banned user
*/
user: APIUser;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
*/
export interface APIGuildWidget {
id: Snowflake;
name: string;
instant_invite: string | null;
channels: APIGuildWidgetChannel[];
members: APIGuildWidgetMember[];
presence_count: number;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
*/
export interface APIGuildWidgetChannel {
id: Snowflake;
name: string;
position: number;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-example-get-guild-widget
*/
export interface APIGuildWidgetMember {
id: string;
username: string;
discriminator: string;
avatar: string | null;
status: PresenceUpdateStatus;
activity?: { name: string };
avatar_url: string;
}
/**
* https://discord.com/developers/docs/resources/guild#get-guild-widget-image-widget-style-options
*/
export enum GuildWidgetStyle {
/**
* Shield style widget with Discord icon and guild members online count
*/
Shield = 'shield',
/**
* Large image with guild icon, name and online count. "POWERED BY DISCORD" as the footer of the widget
*/
Banner1 = 'banner1',
/**
* Smaller widget style with guild icon, name and online count. Split on the right with Discord logo
*/
Banner2 = 'banner2',
/**
* Large image with guild icon, name and online count. In the footer, Discord logo on the left and "Chat Now" on the right
*/
Banner3 = 'banner3',
/**
* Large Discord logo at the top of the widget. Guild icon, name and online count in the middle portion of the widget
* and a "JOIN MY SERVER" button at the bottom
*/
Banner4 = 'banner4',
}
export interface APIGuildWelcomeScreen {
/**
* The welcome screen short message
*/
description: string | null;
/**
* Array of suggested channels
*/
welcome_channels: APIGuildWelcomeScreenChannel[];
}
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
*/
emoji_id: Snowflake | null;
/**
* The emoji name of the emoji that is shown on the left of the channel
*/
emoji_name: string | null;
}
export interface APIGuildMembershipScreening {
/**
* When the fields were last updated
*/
version: string;
/**
* The steps in the screening form
*/
form_fields: APIGuildMembershipScreeningField[];
/**
* The server description shown in the screening form
*/
description: string | null;
}
// TODO: make this a union based on the type in the future, when new types are added
export interface APIGuildMembershipScreeningField {
/**
* The type of field
*/
field_type: MembershipScreeningFieldType;
/**
* The title of the field
*/
label: string;
/**
* The list of rules
*/
values?: string[];
/**
* Whether the user has to fill out this field
*/
required: boolean;
}
export enum MembershipScreeningFieldType {
/**
* Server Rules
*/
Terms = 'TERMS',
}

View File

@@ -0,0 +1,32 @@
import type {
APIMessageComponentDMInteraction,
APIMessageComponentGuildInteraction,
APIMessageComponentInteraction,
} from './_interactions/messageComponents.ts';
import type { APIPingInteraction } from './_interactions/ping.ts';
import type {
APIApplicationCommandDMInteraction,
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
} from './_interactions/applicationCommands.ts';
export * from './_interactions/base.ts';
export * from './_interactions/messageComponents.ts';
export * from './_interactions/ping.ts';
export * from './_interactions/responses.ts';
export * from './_interactions/applicationCommands.ts';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIInteraction = APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;

105
deno/payloads/v9/invite.ts Normal file
View File

@@ -0,0 +1,105 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/invite
*/
import type { APIPartialChannel } from './channel.ts';
import type { APIPartialGuild } from './guild.ts';
import type { APIApplication } from './application.ts';
import type { APIInviteStageInstance } from './stageInstance.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/resources/invite#invite-object
*/
export interface APIInvite {
/**
* The invite code (unique ID)
*/
code: string;
/**
* The guild this invite is for
*
* See https://discord.com/developers/docs/resources/guild#guild-object
*/
guild?: APIPartialGuild;
/**
* The channel this invite is for
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
channel: Required<APIPartialChannel>;
/**
* The user who created the invite
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
inviter?: APIUser;
/**
* 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 embedded application to open for this voice channel embedded application invite
*
* See https://discord.com/developers/docs/topics/oauth2#application
*/
target_application?: Partial<APIApplication>;
/**
* 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, returned from the `GET /invites/<code>` endpoint when `with_counts` is `true`
*/
approximate_member_count?: number;
/**
* The expiration date of this invite, returned from the `GET /invites/<code>` endpoint when `with_expiration` is `true`
*/
expires_at?: string | null;
/**
* The stage instance data if there is a public stage instance in the stage channel this invite is for
*/
stage_instance?: APIInviteStageInstance;
}
/**
* https://discord.com/developers/docs/resources/invite#invite-object-invite-target-types
*/
export enum InviteTargetType {
Stream = 1,
EmbeddedApplication,
}
/**
* https://discord.com/developers/docs/resources/invite#invite-metadata-object
*/
export interface APIExtendedInvite extends APIInvite {
/**
* Number of times this invite has been used
*/
uses: number;
/**
* Max number of times this invite can be used
*/
max_uses: number;
/**
* Duration (in seconds) after which the invite expires
*/
max_age: number;
/**
* Whether this invite only grants temporary membership
*/
temporary: boolean;
/**
* When this invite was created
*/
created_at: string;
}

17
deno/payloads/v9/mod.ts Normal file
View File

@@ -0,0 +1,17 @@
export * from './application.ts';
export * from './auditLog.ts';
export * from './channel.ts';
export * from './emoji.ts';
export * from './gateway.ts';
export * from './guild.ts';
export * from './interactions.ts';
export * from './invite.ts';
export * from './oauth2.ts';
export * from './permissions.ts';
export * from './stageInstance.ts';
export * from './sticker.ts';
export * from './teams.ts';
export * from './template.ts';
export * from './user.ts';
export * from './voice.ts';
export * from './webhook.ts';

108
deno/payloads/v9/oauth2.ts Normal file
View File

@@ -0,0 +1,108 @@
/**
* Types extracted from https://discord.com/developers/docs/topics/oauth2
*/
export enum OAuth2Scopes {
/**
* For oauth2 bots, this puts the bot in the user's selected guild by default
*/
Bot = 'bot',
/**
* Allows [/users/@me/connections](https://discord.com/developers/docs/resources/user#get-user-connections)
* to return linked third-party accounts
*
* See https://discord.com/developers/docs/resources/user#get-user-connections
*/
Connections = 'connections',
/**
* Enables [/users/@me](https://discord.com/developers/docs/resources/user#get-current-user) to return an `email`
*
* See https://discord.com/developers/docs/resources/user#get-current-user
*/
Email = 'email',
/**
* Allows [/users/@me](https://discord.com/developers/docs/resources/user#get-current-user) without `email`
*
* See https://discord.com/developers/docs/resources/user#get-current-user
*/
Identify = 'identify',
/**
* Allows [/users/@me/guilds](https://discord.com/developers/docs/resources/user#get-current-user-guilds)
* to return basic information about all of a user's guilds
*
* See https://discord.com/developers/docs/resources/user#get-current-user-guilds
*/
Guilds = 'guilds',
/**
* Allows [/guilds/{guild.id}/members/{user.id}](https://discord.com/developers/docs/resources/guild#add-guild-member)
* to be used for joining users to a guild
*
* See https://discord.com/developers/docs/resources/guild#add-guild-member
*/
GuildsJoin = 'guilds.join',
/**
* Allows your app to join users to a group dm
*
* See https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
*/
GroupDMJoins = 'gdm.join',
/**
* For local rpc server api access, this allows you to read messages from all client channels
* (otherwise restricted to channels/guilds your app creates)
*/
MessagesRead = 'messages.read',
/**
* For local rpc server access, this allows you to control a user's local Discord client - requires Discord approval
*/
RPC = 'rpc',
/**
* For local rpc server api access, this allows you to receive notifications pushed out to the user - requires Discord approval
*/
RPCNotificationsRead = 'rpc.notifications.read',
/**
* This generates a webhook that is returned in the oauth token response for authorization code grants
*/
WebhookIncoming = 'webhook.incoming',
/**
* Allows your app to upload/update builds for a user's applications - requires Discord approval
*/
ApplicationsBuildsUpload = 'applications.builds.upload',
/**
* Allows your app to read build data for a user's applications
*/
ApplicationsBuildsRead = 'applications.builds.read',
/**
* Allows your app to read and update store data (SKUs, store listings, achievements, etc.) for a user's applications
*/
ApplicationsStoreUpdate = 'applications.store.update',
/**
* Allows your app to read entitlements for a user's applications
*/
ApplicationsEntitlements = 'applications.entitlements',
/**
* Allows your app to know a user's friends and implicit relationships - requires Discord approval
*/
RelationshipsRead = 'relationships.read',
/**
* Allows your app to fetch data from a user's "Now Playing/Recently Played" list - requires Discord approval
*/
ActivitiesRead = 'activities.read',
/**
* Allows your app to update a user's activity - requires Discord approval (NOT REQUIRED FOR GAMESDK ACTIVITY MANAGER)
*
* See https://discord.com/developers/docs/game-sdk/activities
*/
ActivitiesWrite = 'activities.write',
/**
* Allows your app to use Application Commands in a guild
*
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommands = 'applications.commands',
/**
* Allows your app to update its Application Commands via this bearer token - client credentials grant only
*
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommandsUpdate = 'applications.commands.update',
}

View File

@@ -0,0 +1,120 @@
/**
* Types extracted from https://discord.com/developers/docs/topics/permissions
*/
import type { Permissions, Snowflake } from '../../globals.ts';
/**
* https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags
*
* These flags are exported as `BigInt`s and NOT numbers. Wrapping them in `Number()`
* may cause issues, try to use BigInts as much as possible or modules that can
* replicate them in some way
*/
export const PermissionFlagsBits = {
CreateInstantInvite: 1n << 0n,
KickMembers: 1n << 1n,
BanMembers: 1n << 2n,
Administrator: 1n << 3n,
ManageChannels: 1n << 4n,
ManageGuild: 1n << 5n,
AddReactions: 1n << 6n,
ViewAuditLog: 1n << 7n,
PrioritySpeaker: 1n << 8n,
Stream: 1n << 9n,
ViewChannel: 1n << 10n,
SendMessages: 1n << 11n,
SendTTSMessages: 1n << 12n,
ManageMessages: 1n << 13n,
EmbedLinks: 1n << 14n,
AttachFiles: 1n << 15n,
ReadMessageHistory: 1n << 16n,
MentionEveryone: 1n << 17n,
UseExternalEmojis: 1n << 18n,
ViewGuildInsights: 1n << 19n,
Connect: 1n << 20n,
Speak: 1n << 21n,
MuteMembers: 1n << 22n,
DeafenMembers: 1n << 23n,
MoveMembers: 1n << 24n,
UseVAD: 1n << 25n,
ChangeNickname: 1n << 26n,
ManageNicknames: 1n << 27n,
ManageRoles: 1n << 28n,
ManageWebhooks: 1n << 29n,
ManageEmojisAndStickers: 1n << 30n,
UseApplicationCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
ManageThreads: 1n << 34n,
UsePublicThreads: 1n << 35n,
UsePrivateThreads: 1n << 36n,
UseExternalStickers: 1n << 37n,
} as const;
/**
* Freeze the object of bits, preventing any modifications to it
* @internal
*/
Object.freeze(PermissionFlagsBits);
/**
* https://discord.com/developers/docs/topics/permissions#role-object
*/
export interface APIRole {
/**
* Role id
*/
id: Snowflake;
/**
* Role name
*/
name: string;
/**
* Integer representation of hexadecimal color code
*/
color: number;
/**
* If this role is pinned in the user listing
*/
hoist: boolean;
/**
* Position of this role
*/
position: number;
/**
* Permission bit set
*
* See https://en.wikipedia.org/wiki/Bit_field
*/
permissions: Permissions;
/**
* Whether this role is managed by an integration
*/
managed: boolean;
/**
* Whether this role is mentionable
*/
mentionable: boolean;
/**
* The tags this role has
*/
tags?: APIRoleTags;
}
/**
* https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure
*/
export interface APIRoleTags {
/**
* The id of the bot this role belongs to
*/
bot_id?: Snowflake;
/**
* Whether this is the guild's premium subscriber role
*/
premium_subscriber?: null;
/**
* The id of the integration this role belongs to
*/
integration_id?: Snowflake;
}

View File

@@ -0,0 +1,72 @@
import type { Snowflake } from '../../globals.ts';
import type { APIGuildMember } from './guild.ts';
/**
* https://discord.com/developers/docs/resources/stage-instance#stage-instance-object
*/
export interface APIStageInstance {
/**
* The id of the stage instance
*/
id: Snowflake;
/**
* The guild id of the associated stage channel
*/
guild_id: Snowflake;
/**
* The id of the associated stage channel
*/
channel_id: Snowflake;
/**
* The topic of the stage instance (1-120 characters)
*/
topic: string;
/**
* The privacy level of the stage instance
*
* See https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level
*/
privacy_level: StageInstancePrivacyLevel;
/**
* Whether or not stage discovery is disabled
*/
discoverable_disabled: boolean;
}
/**
* https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level
*/
export enum StageInstancePrivacyLevel {
/**
* The stage instance is visible publicly, such as on stage discovery
*/
Public = 1,
/**
* The stage instance is visible to only guild members
*/
GuildOnly,
}
/**
* https://discord.com/developers/docs/resources/invite#invite-stage-instance-object-invite-stage-instance-structure
*/
export interface APIInviteStageInstance {
/**
* The topic of the stage instance (1-120 characters)
*/
topic: string;
/**
* The number of users in the stage
*/
participant_count: number;
/**
* The number of users speaking in the stage
*/
speaker_count: number;
/**
* The members speaking in the stage
*
* See https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure
*/
members: APIGuildMember[];
}

127
deno/payloads/v9/sticker.ts Normal file
View File

@@ -0,0 +1,127 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/sticker
*/
import type { Snowflake } from '../../globals.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
*/
export interface APISticker {
/**
* ID of the sticker
*/
id: Snowflake;
/**
* For standard stickers, ID of the pack the sticker is from
*/
pack_id?: Snowflake;
/**
* Name of the sticker
*/
name: string;
/**
* Description of the sticker
*/
description: string | null;
/**
* For guild stickers, the Discord name of a unicode emoji representing the sticker's expression. for standard stickers, a comma-separated list of related expressions.
*/
tags: string;
/**
* Previously the sticker asset hash, now an empty string
* @deprecated
*/
asset: '';
/**
* Type of sticker
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
*/
type: StickerType;
/**
* Type of sticker format
*
* See https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types
*/
format_type: StickerFormatType;
/**
* Whether this guild sticker can be used, may be false due to loss of Server Boosts
*/
available?: boolean;
/**
* ID of the guild that owns this sticker
*/
guild_id?: Snowflake;
/**
* The user that uploaded the guild sticker
*/
user?: APIUser;
/**
* The standard sticker's sort order within its pack
*/
sort_value?: number;
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
*/
export enum StickerType {
/**
* An official sticker in a pack, part of Nitro or in a removed purchasable pack
*/
Standard = 1,
/**
* A sticker uploaded to a Boosted guild for the guild's members
*/
Guild,
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types
*/
export enum StickerFormatType {
PNG = 1,
APNG,
Lottie,
}
/**
* https://discord.com/developers/docs/resources/sticker#sticker-item-object
*/
export type APIStickerItem = Pick<APISticker, 'id' | 'name' | 'format_type'>;
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
*/
export interface APIStickerPack {
/**
* ID of the sticker pack
*/
id: Snowflake;
/**
* The stickers in the pack
*/
stickers: APISticker[];
/**
* Name of the sticker pack
*/
name: string;
/**
* ID of the pack's SKU
*/
sku_id: Snowflake;
/**
* ID of a sticker in the pack which is shown as the pack's icon
*/
cover_sticker_id?: Snowflake;
/**
* Description of the sticker pack
*/
description: string;
/**
* ID of the sticker pack's banner image
*/
banner_asset_id: Snowflake;
}

66
deno/payloads/v9/teams.ts Normal file
View File

@@ -0,0 +1,66 @@
/**
* Types extracted from https://discord.com/developers/docs/topics/teams
*/
import type { Snowflake } from '../../globals.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/topics/teams#data-models-team-object
*/
export interface APITeam {
/**
* A hash of the image of the team's icon
*/
icon: string | null;
/**
* The unique id of the team
*/
id: Snowflake;
/**
* The members of the team
*/
members: APITeamMember[];
/**
* The name of the team
*/
name: string;
/**
* The user id of the current team owner
*/
owner_user_id: Snowflake;
}
/**
* https://discord.com/developers/docs/topics/teams#data-models-team-members-object
*/
export interface APITeamMember {
/**
* The user's membership state on the team
*
* See https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum
*/
membership_state: TeamMemberMembershipState;
/**
* Will always be `["*"]`
*/
permissions: ['*'];
/**
* The id of the parent team of which they are a member
*/
team_id: Snowflake;
/**
* The avatar, discriminator, id, and username of the user
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
user: APIUser;
}
/**
* https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum
*/
export enum TeamMemberMembershipState {
Invited = 1,
Accepted,
}

View File

@@ -0,0 +1,65 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/template
*/
import type { Snowflake } from '../../globals.ts';
import type { RESTPostAPIGuildsJSONBody } from '../../rest/v9/mod.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/resources/template#template-object
*/
export interface APITemplate {
/**
* The template code (unique ID)
*/
code: string;
/**
* Template name
*/
name: string;
/**
* The description for the template
*/
description: string | null;
/**
* Number of times this template has been used
*/
usage_count: number;
/**
* The ID of the user who created the template
*/
creator_id: Snowflake;
/**
* The user who created the template
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
creator: APIUser;
/**
* When this template was created
*/
created_at: string;
/**
* When this template was last synced to the source guild
*/
updated_at: string;
/**
* The ID of the guild this template is based on
*/
source_guild_id: Snowflake;
/**
* The guild snapshot this template contains
*/
serialized_source_guild: APITemplateSerializedSourceGuild;
/**
* Whether the template has unsynced changes
*/
is_dirty: boolean | null;
}
export interface APITemplateSerializedSourceGuild extends Omit<RESTPostAPIGuildsJSONBody, 'icon'> {
description: string | null;
preferred_locale: string;
icon_hash: string | null;
}

168
deno/payloads/v9/user.ts Normal file
View File

@@ -0,0 +1,168 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/user
*/
import type { Snowflake } from '../../globals.ts';
import type { APIGuildIntegration } from './guild.ts';
/**
* https://discord.com/developers/docs/resources/user#user-object
*/
export interface APIUser {
/**
* The user's id
*/
id: Snowflake;
/**
* The user's username, not unique across the platform
*/
username: string;
/**
* The user's 4-digit discord-tag
*/
discriminator: string;
/**
* The user's avatar hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
avatar: string | null;
/**
* Whether the user belongs to an OAuth2 application
*/
bot?: boolean;
/**
* Whether the user is an Official Discord System user (part of the urgent message system)
*/
system?: boolean;
/**
* Whether the user has two factor enabled on their account
*/
mfa_enabled?: boolean;
/**
* The user's banner hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
banner?: string | null;
/**
* The user's banner color encoded as an integer representation of hexadecimal color code
*/
accent_color?: number | null;
/**
* The user's chosen language option
*/
locale?: string;
/**
* Whether the email on this account has been verified
*/
verified?: boolean;
/**
* The user's email
*/
email?: string | null;
/**
* The flags on a user's account
*
* See https://discord.com/developers/docs/resources/user#user-object-user-flags
*/
flags?: UserFlags;
/**
* The type of Nitro subscription on a user's account
*
* See https://discord.com/developers/docs/resources/user#user-object-premium-types
*/
premium_type?: UserPremiumType;
/**
* The public flags on a user's account
*
* See https://discord.com/developers/docs/resources/user#user-object-user-flags
*/
public_flags?: UserFlags;
}
/**
* https://discord.com/developers/docs/resources/user#user-object-user-flags
*/
export enum UserFlags {
None = 0,
DiscordEmployee = 1 << 0,
PartneredServerOwner = 1 << 1,
DiscordHypeSquadEvents = 1 << 2,
BugHunterLevel1 = 1 << 3,
HypeSquadHouseBravery = 1 << 6,
HypeSquadHouseBrilliance = 1 << 7,
HypeSquadHouseBalance = 1 << 8,
EarlySupporter = 1 << 9,
TeamUser = 1 << 10,
BugHunterLevel2 = 1 << 14,
VerifiedBot = 1 << 16,
EarlyVerifiedBotDeveloper = 1 << 17,
DiscordCertifiedModerator = 1 << 18,
}
/**
* https://discord.com/developers/docs/resources/user#user-object-premium-types
*/
export enum UserPremiumType {
None,
NitroClassic,
Nitro,
}
/**
* https://discord.com/developers/docs/resources/user#connection-object
*/
export interface APIConnection {
/**
* ID of the connection account
*/
id: string;
/**
* The username of the connection account
*/
name: string;
/**
* The service of the connection
*/
type: string;
/**
* Whether the connection is revoked
*/
revoked?: boolean;
/**
* An array of partial server integrations
*
* See https://discord.com/developers/docs/resources/guild#integration-object
*/
integrations?: Partial<APIGuildIntegration>[];
/**
* Whether the connection is verified
*/
verified: boolean;
/**
* Whether friend sync is enabled for this connection
*/
friend_sync: boolean;
/**
* Whether activities related to this connection will be shown in presence updates
*/
show_activity: boolean;
/**
* Visibility of this connection
*
* See https://discord.com/developers/docs/resources/user#connection-object-visibility-types
*/
visibility: ConnectionVisibility;
}
export enum ConnectionVisibility {
/**
* Invisible to everyone except the user themselves
*/
None,
/**
* Visible to everyone
*/
Everyone,
}

96
deno/payloads/v9/voice.ts Normal file
View File

@@ -0,0 +1,96 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/voice
*/
import type { Snowflake } from '../../globals.ts';
import type { APIGuildMember } from './guild.ts';
/**
* https://discord.com/developers/docs/resources/voice#voice-state-object
*/
export interface GatewayVoiceState {
/**
* The guild id this voice state is for
*/
guild_id?: Snowflake;
/**
* The channel id this user is connected to
*/
channel_id: Snowflake | null;
/**
* The user id this voice state is for
*/
user_id: Snowflake;
/**
* The guild member this voice state is for
*
* See https://discord.com/developers/docs/resources/guild#guild-member-object
*/
member?: APIGuildMember;
/**
* The session id for this voice state
*/
session_id: string;
/**
* Whether this user is deafened by the server
*/
deaf: boolean;
/**
* Whether this user is muted by the server
*/
mute: boolean;
/**
* Whether this user is locally deafened
*/
self_deaf: boolean;
/**
* Whether this user is locally muted
*/
self_mute: boolean;
/**
* Whether this user is streaming using "Go Live"
*/
self_stream?: boolean;
/**
* Whether this user's camera is enabled
*/
self_video: boolean;
/**
* 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;
}
/**
* https://discord.com/developers/docs/resources/voice#voice-region-object
*/
export interface APIVoiceRegion {
/**
* Unique ID for the region
*/
id: string;
/**
* Name of the region
*/
name: string;
/**
* `true` if this is a vip-only server
*/
vip: boolean;
/**
* `true` for a single server that is closest to the current user's client
*/
optimal: boolean;
/**
* Whether this is a deprecated voice region (avoid switching to these)
*/
deprecated: boolean;
/**
* Whether this is a custom voice region (used for events/etc)
*/
custom: boolean;
}

View File

@@ -0,0 +1,79 @@
/**
* Types extracted from https://discord.com/developers/docs/resources/webhook
*/
import type { Snowflake } from '../../globals.ts';
import type { APIPartialChannel, APIPartialGuild, APIUser } from './mod.ts';
/**
* https://discord.com/developers/docs/resources/webhook#webhook-object
*/
export interface APIWebhook {
/**
* The id of the webhook
*/
id: Snowflake;
/**
* The type of the webhook
*
* See https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types
*/
type: WebhookType;
/**
* The guild id this webhook is for
*/
guild_id?: Snowflake;
/**
* The channel id this webhook is for
*/
channel_id: Snowflake;
/**
* The user this webhook was created by (not returned when getting a webhook with its token)
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
user?: APIUser;
/**
* The default name of the webhook
*/
name: string | null;
/**
* The default avatar of the webhook
*/
avatar: string | null;
/**
* The secure token of the webhook (returned for Incoming Webhooks)
*/
token?: string;
/**
* 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 {
/**
* Incoming Webhooks can post messages to channels with a generated token
*/
Incoming = 1,
/**
* Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels
*/
ChannelFollower,
/**
* Application webhooks are webhooks used with Interactions
*/
Application,
}

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