Compare commits

...

53 Commits

Author SHA1 Message Date
Vlad Frangu
cd580fa2c6 chore(release): 0.26.0 🎉 (#276) 2021-12-24 17:31:30 +02:00
Vlad Frangu
c20e5ae2a9 chore: bring in support for TS 4.5's exactOptionalPropertyTypes (#275)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-12-24 17:08:58 +02:00
Vlad Frangu
7fe78cec25 chore: cleanup chat input options (#274) 2021-12-24 15:37:08 +02:00
Jiralite
bfc5e46f53 feat: Add API error code 50109 (#268)
* feat: add API error

* refactor: elongate error name
2021-12-23 10:44:42 +02:00
Suneet Tipirneni
8bbb81942b types: make application command option union easier to use (#250) 2021-12-22 20:19:45 +02:00
Bryce Roethel
46db72da2f fix(GatewayStageInstance): Stage Instance dispatches not included in GatewayDispatchPayload (#267) 2021-12-21 14:37:35 +02:00
Suneet Tipirneni
0bbc9721f6 feat(APIGuildMember): add guild timeouts (#235) 2021-12-21 14:32:54 +02:00
Jiralite
7eee39d86c fix(StickerPack): Optional banner_asset_id (#270)
BREAKING CHANGE: `banner_asset_id` is now optional. Reference PR: https://github.com/discord/discord-api-docs/pull/4245
2021-12-16 20:20:20 +02:00
Suneet Tipirneni
2c72242a03 feat(GatewayThreadMemberUpdateDispatchData): add guild_id extra field (#266) 2021-12-14 21:26:46 +02:00
Cynthia
7ab780b3ae fix: only a partial object is needed when updating attachments (#263) 2021-12-13 11:08:39 +02:00
Marvin Witt
315ce35849 fix(NonDispatchPayload): t & s fields are always null on non-dispatch payloads (#259) 2021-12-08 15:16:31 +02:00
Advaith
c67d426e3d fix(APIInvite): channel can be null (#182)
BREAKING CHANGE: this marks the channel property of invites as possibly null
2021-12-07 22:57:28 +02:00
Suneet Tipirneni
e9d02a19fc feat: add support for user guild member read oauth2 scope and route (#254) 2021-12-07 22:25:50 +02:00
Suneet Tipirneni
9e619fc460 feat(RESTJSONErrorCodes): add error 20029 (#257) 2021-12-07 19:26:01 +02:00
Jiralite
b01716bf22 feat: Add API error code 50055 (#256) 2021-12-07 01:29:36 +02:00
Suneet Tipirneni
c7efcd5505 feat(APIAuditLog): add guild_scheduled_events prop (#251) 2021-12-01 10:17:08 +02:00
Vlad Frangu
52c91f8f73 chore(release): 0.25.2 🎉 (#249) 2021-11-30 22:28:16 +02:00
Suneet Tipirneni
47382b6183 feat(Guild): boost progress bars (#227)
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
2021-11-30 21:12:26 +02:00
PikaDude
51dee6e0e5 fix(APISelectMenuComponent): options property is required (#248) 2021-11-30 20:11:44 +02:00
Vlad Frangu
3ff85eede4 chore(release): 0.25.1 🎉 (#246) 2021-11-30 13:15:45 +02:00
Kot
44c0f05cb2 fix(deno): faulty import paths for guild scheduled events (#245) 2021-11-30 12:11:41 +02:00
Vlad Frangu
68d5c08c93 chore(release): 0.25.0 🎉 (#244) 2021-11-29 12:50:19 +02:00
Shubham Parihar
d333962715 feat: add guild scheduled event (#186)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-11-25 15:15:05 +02:00
Almeida
f2d62e3cdf refactor(UserFlags): update flag names (#229)
BREAKING CHANGE: All user flags now follow the internal name, with descriptions added for what they represent. This means you'll have to do some minor renaming in your code if you check for flags.
2021-11-24 16:59:51 +02:00
Suneet Tipirneni
faa8bf494b fix(APIApplicationCommandOption): remove default property (#242)
BREAKING CHANGE: If you were using the `default` property for ApplicationCommandOptions, it has been removed, as Discord wasn't even taking it into account anymore.
2021-11-22 21:20:24 +02:00
GC
7379a345e8 fix: make subcommand options optional (#241) 2021-11-19 19:19:28 +02:00
GC
fa54b9de55 fix: correct types for REST attachments (#238) 2021-11-17 18:38:43 +02:00
Suneet Tipirneni
1e52e0ceab feat(RESTPostAPIChannelThreadsJSONBody): add rate_limit_per_user (#237) 2021-11-15 21:46:04 +02:00
Suneet Tipirneni
691abb581f fix: correct types for autocomplete interaction data (#234)
BREAKING CHANGE: The types for autocomplete interactions have been corrected.
2021-11-09 22:40:26 +02:00
Jupith
7a15c97863 feat: add maze api error (#228)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-11-06 01:52:50 +02:00
Suneet Tipirneni
bc1d03e527 feat: add max/min option for number-based options (#221) 2021-11-02 17:12:18 +02:00
Almeida
0f51d8e83f feat(ActivityFlags): add new flags (#207)
ref: https://github.com/discord/discord-api-docs/pull/3877
2021-11-02 14:57:48 +02:00
Almeida
4021dae44b feat(GuildSystemChannelFlags): add suppress member join sticker replies flag (#222) 2021-11-02 14:56:34 +02:00
Advaith
d189e36c49 feat(ApplicationFlags): add message content intent flags (#226) 2021-11-02 14:54:14 +02:00
Almeida
a015f96fcb feat(UserFlags): add BOT_HTTP_INTERACTIONS flag (#212) 2021-11-02 14:53:14 +02:00
Suneet Tipirneni
3b9320dbf2 feat(Interactions): add autocomplete api types (#205) 2021-10-29 16:02:42 +03:00
Advaith
fdf133ef45 feat(Attachments): multi uploads and alt text (#223) 2021-10-29 11:59:07 +03:00
Suneet Tipirneni
7c36a6cdf3 docs: update docs for thread members route (#225) 2021-10-29 11:56:30 +03:00
Vlad Frangu
a507765bba chore(release): 0.24.0 🎉 (#220) 2021-10-17 00:06:25 +03:00
Matt (IPv4) Cowley
9dd3446b64 feat(Routes): add missing OAuth2 routes (#218) 2021-10-10 01:55:18 +03:00
Advaith
24f658de38 chore(GuildFeature): sort guild features (#216) 2021-10-07 13:49:09 +03:00
Shubham Parihar
329451c6c9 chore(APIRole): make icon and unicode_emoji nullable (#217) 2021-10-06 22:01:41 +03:00
Almeida
7db69531d8 refactor(APIVoiceRegion): removed vip property (#214)
BREAKING CHANGE: The `vip` property has been removed.
2021-10-05 11:29:17 +03:00
Suneet Tipirneni
77396b557c feat(APIApplicationCommand): add channel_types field to channel options (#198) 2021-10-03 16:18:45 +03:00
Suneet Tipirneni
0331518c49 feat(APIGuildMember): add per guild avatars (#208)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-10-03 16:15:19 +03:00
Suneet Tipirneni
64e4e5246c feat(InteractionResolvedChannels): add parent_id and thread_metadata fields to resolved channels (#210) 2021-10-02 14:30:02 +02:00
Suneet Tipirneni
b453d75e4d feat(RESTJSONErrorCodes): add error 50101 (#202) 2021-10-02 14:26:31 +02:00
Suneet Tipirneni
1076822b90 feat(APIRole): add role icons (#204)
* feat: add role icons

* Apply suggestions from code review

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

* fix: make requested changes

* chore: update descriptions

Co-authored-by: Antonio Román <kyradiscord@gmail.com>
2021-10-01 08:29:47 +02:00
Shubham Parihar
0c592a0950 fix(APISelectMenuComponenet): make options field optional (#209) 2021-09-29 18:20:56 +02:00
Advaith
68d97aed14 feat(PermissionFlagBits): update thread permissions (#181) 2021-09-21 16:14:43 +03:00
Suneet Tipirneni
a787426082 chore: make git hooks executable (#203) 2021-09-20 19:33:12 +03:00
Shubham Parihar
2aee879600 feat(APIAttachment): add ephemeral field (#199) 2021-09-17 17:21:08 +03:00
Advaith
4bbe1eaa86 feat(PermissionFlagsBits): add StartEmbeddedActivities (#197) 2021-09-15 09:57:47 +03:00
189 changed files with 9247 additions and 5083 deletions

0
.husky/commit-msg Normal file → Executable file
View File

0
.husky/pre-commit Normal file → Executable file
View File

View File

@@ -1,3 +1,113 @@
# [0.26.0](https://github.com/discordjs/discord-api-types/compare/0.25.2...0.26.0) (2021-12-24)
### Bug Fixes
- **APIInvite:** channel can be null ([#182](https://github.com/discordjs/discord-api-types/issues/182)) ([c67d426](https://github.com/discordjs/discord-api-types/commit/c67d426e3d3634eb0756f07029b9176cfc5873ce))
- **GatewayStageInstance:** Stage Instance dispatches not included in `GatewayDispatchPayload` ([#267](https://github.com/discordjs/discord-api-types/issues/267)) ([46db72d](https://github.com/discordjs/discord-api-types/commit/46db72da2fd14a51047b4e66e934738785e72d96))
- **NonDispatchPayload:** `t` & `s` fields are always null on non-dispatch payloads ([#259](https://github.com/discordjs/discord-api-types/issues/259)) ([315ce35](https://github.com/discordjs/discord-api-types/commit/315ce3584917635b93a26123470f37a10bd8d846))
- only a partial object is needed when updating attachments ([#263](https://github.com/discordjs/discord-api-types/issues/263)) ([7ab780b](https://github.com/discordjs/discord-api-types/commit/7ab780b3aefb3c8c34a8114db3ace6c4e6ae3206))
- **StickerPack:** Optional `banner_asset_id` ([#270](https://github.com/discordjs/discord-api-types/issues/270)) ([7eee39d](https://github.com/discordjs/discord-api-types/commit/7eee39d86c0d40857d0bf6fc0d4d1e31cda1895c))
### Features
- Add API error code `50055` ([#256](https://github.com/discordjs/discord-api-types/issues/256)) ([b01716b](https://github.com/discordjs/discord-api-types/commit/b01716bf22fba617c0a09084ff607127366432b6))
- Add API error code 50109 ([#268](https://github.com/discordjs/discord-api-types/issues/268)) ([bfc5e46](https://github.com/discordjs/discord-api-types/commit/bfc5e46f5374289997219c35aa0b992dfaa4ec40))
- add support for user guild member read oauth2 scope and route ([#254](https://github.com/discordjs/discord-api-types/issues/254)) ([e9d02a1](https://github.com/discordjs/discord-api-types/commit/e9d02a19fc3b4fad2f488b0db3b63d6301878730))
- **APIAuditLog:** add `guild_scheduled_events` prop ([#251](https://github.com/discordjs/discord-api-types/issues/251)) ([c7efcd5](https://github.com/discordjs/discord-api-types/commit/c7efcd55059673ab9fc8e6ef9711050700274057))
- **APIGuildMember:** add guild timeouts ([#235](https://github.com/discordjs/discord-api-types/issues/235)) ([0bbc972](https://github.com/discordjs/discord-api-types/commit/0bbc9721f6e18eb559c40e207f60218e7862d4ea))
- **GatewayThreadMemberUpdateDispatchData:** add `guild_id` extra field ([#266](https://github.com/discordjs/discord-api-types/issues/266)) ([2c72242](https://github.com/discordjs/discord-api-types/commit/2c72242a03bd5adfd0fc145bf5645d1bad59254e))
- **RESTJSONErrorCodes:** add error 20029 ([#257](https://github.com/discordjs/discord-api-types/issues/257)) ([9e619fc](https://github.com/discordjs/discord-api-types/commit/9e619fc460337d53c85fc3977c89489c14bd8254))
- bring in support for TS 4.5's `exactOptionalPropertyTypes` ([#275](https://github.com/discordjs/discord-api-types/issues/275)) ([c20e5ae](https://github.com/discordjs/discord-api-types/commit/c20e5ae2a9edcca529e233a4deb634bc760076d2))
### Cleanups
- Make application command option union easier to use ([#250](https://github.com/discordjs/discord-api-types/issues/250)) ([8bbb819](https://github.com/discordjs/discord-api-types/commit/8bbb81942b3f87e46273bb75a12e2db4ef7ee797))
- **ChatInputCommandOptions:** cleanup chat input options ([#274](https://github.com/discordjs/discord-api-types/issues/274)) ([7fe78ce](https://github.com/discordjs/discord-api-types/commit/7fe78cec25a07dcd5d7ba2af3a5d773620c2d3cf))
### BREAKING CHANGES
- **StickerPack:** `banner_asset_id` is now optional. Reference PR: https://github.com/discord/discord-api-docs/pull/4245
- **APIInvite:** this marks the channel property of invites as possibly null
- **ChatInputCommandOptions:** A lot of the options were renamed and split up to clean up internal code.
All option interfaces that ended in a plural (`*Options`) have had their pluralization removed (`*Option` now).
`APIApplicationCommandInteractionDataOptionWithValues` has been renamed to `APIApplicationCommandInteractionDataBasicOption`,
and every `*InteractionDataOptions{Type}` interfaces have been renamed to `*InteractionData{Type}Option`
(i.e.: `ApplicationCommandInteractionDataOptionString` -> `APIApplicationCommandInteractionDataStringOption`).
## [0.25.2](https://github.com/discordjs/discord-api-types/compare/0.25.1...0.25.2) (2021-11-30)
### Bug Fixes
- **APISelectMenuComponent:** `options` property is required ([#248](https://github.com/discordjs/discord-api-types/issues/248)) ([51dee6e](https://github.com/discordjs/discord-api-types/commit/51dee6e0e5bb4d749b9f0436e7ec9d4793e56567))
### Features
- **Guild:** boost progress bars ([#227](https://github.com/discordjs/discord-api-types/issues/227)) ([47382b6](https://github.com/discordjs/discord-api-types/commit/47382b6183a1d232053fef23691d423f8af88f88))
## [0.25.1](https://github.com/discordjs/discord-api-types/compare/0.25.0...0.25.1) (2021-11-30)
### Bug Fixes
- **deno:** faulty import paths for guild scheduled events ([#245](https://github.com/discordjs/discord-api-types/issues/245)) ([44c0f05](https://github.com/discordjs/discord-api-types/commit/44c0f05cb2fc2b9ea50745530ae94a669a839594))
# [0.25.0](https://github.com/discordjs/discord-api-types/compare/0.24.0...0.25.0) (2021-11-29)
### Bug Fixes
- **APIApplicationCommandOption:** remove `default` property ([#242](https://github.com/discordjs/discord-api-types/issues/242)) ([faa8bf4](https://github.com/discordjs/discord-api-types/commit/faa8bf494bc79b844ce73e1892461e8440dc7abc))
- correct types for autocomplete interaction data ([#234](https://github.com/discordjs/discord-api-types/issues/234)) ([691abb5](https://github.com/discordjs/discord-api-types/commit/691abb581fb17093b5fa139f3ff53cbc0ad0b2a1))
- correct types for REST attachments ([#238](https://github.com/discordjs/discord-api-types/issues/238)) ([fa54b9d](https://github.com/discordjs/discord-api-types/commit/fa54b9de5522b9fa9d5367650950f8b0e44f6e14))
- make subcommand options optional ([#241](https://github.com/discordjs/discord-api-types/issues/241)) ([7379a34](https://github.com/discordjs/discord-api-types/commit/7379a345e820703a59a2d754c8ee7c0f0c710e09))
### Code Refactoring
- **UserFlags:** update flag names ([#229](https://github.com/discordjs/discord-api-types/issues/229)) ([f2d62e3](https://github.com/discordjs/discord-api-types/commit/f2d62e3cdf6128357f65e946fe1926cf915a6395))
### Features
- add guild scheduled event ([#186](https://github.com/discordjs/discord-api-types/issues/186)) ([d333962](https://github.com/discordjs/discord-api-types/commit/d333962715a58bd5ac14ad80e900b43b02777794))
- **RESTPostAPIChannelThreadsJSONBody:** add `rate_limit_per_user` ([#237](https://github.com/discordjs/discord-api-types/issues/237)) ([1e52e0c](https://github.com/discordjs/discord-api-types/commit/1e52e0ceab31465c7bbd820e332ef219ad715916))
- add max/min option for number-based options ([#221](https://github.com/discordjs/discord-api-types/issues/221)) ([bc1d03e](https://github.com/discordjs/discord-api-types/commit/bc1d03e527b9d37fac6d76cfbb51f4eeb8238e7b))
- add maze api error ([#228](https://github.com/discordjs/discord-api-types/issues/228)) ([7a15c97](https://github.com/discordjs/discord-api-types/commit/7a15c9786333fb6f2259f42536cfbf2cf0e43db8))
- **ActivityFlags:** add new flags ([#207](https://github.com/discordjs/discord-api-types/issues/207)) ([0f51d8e](https://github.com/discordjs/discord-api-types/commit/0f51d8e83f8aa53efde5c01849aaf09b91d15cbd))
- **ApplicationFlags:** add message content intent flags ([#226](https://github.com/discordjs/discord-api-types/issues/226)) ([d189e36](https://github.com/discordjs/discord-api-types/commit/d189e36c49cd230f98798ff57b668a6fe56df11b))
- **Attachments:** multi uploads and alt text ([#223](https://github.com/discordjs/discord-api-types/issues/223)) ([fdf133e](https://github.com/discordjs/discord-api-types/commit/fdf133ef45d3871defb46e47079c2acdd65e69d7))
- **GuildSystemChannelFlags:** add suppress member join sticker replies flag ([#222](https://github.com/discordjs/discord-api-types/issues/222)) ([4021dae](https://github.com/discordjs/discord-api-types/commit/4021dae44b331198d164a7c93dbc1242184efdf7))
- **Interactions:** add autocomplete api types ([#205](https://github.com/discordjs/discord-api-types/issues/205)) ([3b9320d](https://github.com/discordjs/discord-api-types/commit/3b9320dbf2cbbae7db44f00e8deaf336ab052e8b))
- **UserFlags:** add `BOT_HTTP_INTERACTIONS` flag ([#212](https://github.com/discordjs/discord-api-types/issues/212)) ([a015f96](https://github.com/discordjs/discord-api-types/commit/a015f96fcb4a74866f884db87732876095788111))
### BREAKING CHANGES
- **UserFlags:** All user flags now follow the internal name, with descriptions added for what they represent. This means you'll have to do some minor renaming in your code if you check for flags.
- **APIApplicationCommandOption:** If you were using the `default` property for ApplicationCommandOptions, it has been removed, as Discord wasn't even taking it into account anymore.
- The types for autocomplete interactions have been corrected.
# [0.24.0](https://github.com/discordjs/discord-api-types/compare/0.23.1...0.24.0) (2021-10-16)
### Bug Fixes
- **APISelectMenuComponent:** make options field optional ([#209](https://github.com/discordjs/discord-api-types/issues/209)) ([0c592a0](https://github.com/discordjs/discord-api-types/commit/0c592a0950431f43143bf1c32589bce2dd842b44))
### Code Refactoring
- **APIVoiceRegion:** removed `vip` property ([#214](https://github.com/discordjs/discord-api-types/issues/214)) ([7db6953](https://github.com/discordjs/discord-api-types/commit/7db69531d86fe5bdd462747b1e1287ee6b2dc496))
### Features
- **APIApplicationCommand:** add `channel_types` field to channel options ([#198](https://github.com/discordjs/discord-api-types/issues/198)) ([77396b5](https://github.com/discordjs/discord-api-types/commit/77396b557c6f3d4f85cfc4cd3b253638bc5b449d))
- **APIAttachment:** add ephemeral field ([#199](https://github.com/discordjs/discord-api-types/issues/199)) ([2aee879](https://github.com/discordjs/discord-api-types/commit/2aee87960070cb56979d3ced453c8cd64e81f150))
- **APIGuildMember:** add per guild avatars ([#208](https://github.com/discordjs/discord-api-types/issues/208)) ([0331518](https://github.com/discordjs/discord-api-types/commit/0331518c49c4761f900bacd8ca8a92e38b36b6e9))
- **APIRole:** add role icons ([#204](https://github.com/discordjs/discord-api-types/issues/204)) ([1076822](https://github.com/discordjs/discord-api-types/commit/1076822b90a1b6facf74aa3f2a6750566b3feb53))
- **InteractionResolvedChannels:** add `parent_id` and `thread_metadata` fields to resolved channels ([#210](https://github.com/discordjs/discord-api-types/issues/210)) ([64e4e52](https://github.com/discordjs/discord-api-types/commit/64e4e5246cd61eadf35591b8afdf4c5922fd4086))
- **PermissionFlagBits:** update thread permissions ([#181](https://github.com/discordjs/discord-api-types/issues/181)) ([68d97ae](https://github.com/discordjs/discord-api-types/commit/68d97aed1425002677acdf1d5444b36d3cfcc322))
- **PermissionFlagsBits:** add `StartEmbeddedActivities` ([#197](https://github.com/discordjs/discord-api-types/issues/197)) ([4bbe1ea](https://github.com/discordjs/discord-api-types/commit/4bbe1eaa867da810a1d039b21c3fc78208a50801))
- **RESTJSONErrorCodes:** add error 50101 ([#202](https://github.com/discordjs/discord-api-types/issues/202)) ([b453d75](https://github.com/discordjs/discord-api-types/commit/b453d75e4d13d34836247929be56c042cbc4b762))
- **Routes:** add missing OAuth2 routes ([#218](https://github.com/discordjs/discord-api-types/issues/218)) ([9dd3446](https://github.com/discordjs/discord-api-types/commit/9dd3446b64f31ae0831944f5c608095d650142d7))
### BREAKING CHANGES
- **APIVoiceRegion:** The `vip` property has been removed.
## [0.23.1](https://github.com/discordjs/discord-api-types/compare/0.23.0...0.23.1) (2021-09-08)
### Bug Fixes

View File

@@ -1,3 +1,113 @@
# [0.26.0](https://github.com/discordjs/discord-api-types/compare/0.25.2...0.26.0) (2021-12-24)
### Bug Fixes
- **APIInvite:** channel can be null ([#182](https://github.com/discordjs/discord-api-types/issues/182)) ([c67d426](https://github.com/discordjs/discord-api-types/commit/c67d426e3d3634eb0756f07029b9176cfc5873ce))
- **GatewayStageInstance:** Stage Instance dispatches not included in `GatewayDispatchPayload` ([#267](https://github.com/discordjs/discord-api-types/issues/267)) ([46db72d](https://github.com/discordjs/discord-api-types/commit/46db72da2fd14a51047b4e66e934738785e72d96))
- **NonDispatchPayload:** `t` & `s` fields are always null on non-dispatch payloads ([#259](https://github.com/discordjs/discord-api-types/issues/259)) ([315ce35](https://github.com/discordjs/discord-api-types/commit/315ce3584917635b93a26123470f37a10bd8d846))
- only a partial object is needed when updating attachments ([#263](https://github.com/discordjs/discord-api-types/issues/263)) ([7ab780b](https://github.com/discordjs/discord-api-types/commit/7ab780b3aefb3c8c34a8114db3ace6c4e6ae3206))
- **StickerPack:** Optional `banner_asset_id` ([#270](https://github.com/discordjs/discord-api-types/issues/270)) ([7eee39d](https://github.com/discordjs/discord-api-types/commit/7eee39d86c0d40857d0bf6fc0d4d1e31cda1895c))
### Features
- Add API error code `50055` ([#256](https://github.com/discordjs/discord-api-types/issues/256)) ([b01716b](https://github.com/discordjs/discord-api-types/commit/b01716bf22fba617c0a09084ff607127366432b6))
- Add API error code 50109 ([#268](https://github.com/discordjs/discord-api-types/issues/268)) ([bfc5e46](https://github.com/discordjs/discord-api-types/commit/bfc5e46f5374289997219c35aa0b992dfaa4ec40))
- add support for user guild member read oauth2 scope and route ([#254](https://github.com/discordjs/discord-api-types/issues/254)) ([e9d02a1](https://github.com/discordjs/discord-api-types/commit/e9d02a19fc3b4fad2f488b0db3b63d6301878730))
- **APIAuditLog:** add `guild_scheduled_events` prop ([#251](https://github.com/discordjs/discord-api-types/issues/251)) ([c7efcd5](https://github.com/discordjs/discord-api-types/commit/c7efcd55059673ab9fc8e6ef9711050700274057))
- **APIGuildMember:** add guild timeouts ([#235](https://github.com/discordjs/discord-api-types/issues/235)) ([0bbc972](https://github.com/discordjs/discord-api-types/commit/0bbc9721f6e18eb559c40e207f60218e7862d4ea))
- **GatewayThreadMemberUpdateDispatchData:** add `guild_id` extra field ([#266](https://github.com/discordjs/discord-api-types/issues/266)) ([2c72242](https://github.com/discordjs/discord-api-types/commit/2c72242a03bd5adfd0fc145bf5645d1bad59254e))
- **RESTJSONErrorCodes:** add error 20029 ([#257](https://github.com/discordjs/discord-api-types/issues/257)) ([9e619fc](https://github.com/discordjs/discord-api-types/commit/9e619fc460337d53c85fc3977c89489c14bd8254))
- bring in support for TS 4.5's `exactOptionalPropertyTypes` ([#275](https://github.com/discordjs/discord-api-types/issues/275)) ([c20e5ae](https://github.com/discordjs/discord-api-types/commit/c20e5ae2a9edcca529e233a4deb634bc760076d2))
### Cleanups
- Make application command option union easier to use ([#250](https://github.com/discordjs/discord-api-types/issues/250)) ([8bbb819](https://github.com/discordjs/discord-api-types/commit/8bbb81942b3f87e46273bb75a12e2db4ef7ee797))
- **ChatInputCommandOptions:** cleanup chat input options ([#274](https://github.com/discordjs/discord-api-types/issues/274)) ([7fe78ce](https://github.com/discordjs/discord-api-types/commit/7fe78cec25a07dcd5d7ba2af3a5d773620c2d3cf))
### BREAKING CHANGES
- **StickerPack:** `banner_asset_id` is now optional. Reference PR: https://github.com/discord/discord-api-docs/pull/4245
- **APIInvite:** this marks the channel property of invites as possibly null
- **ChatInputCommandOptions:** A lot of the options were renamed and split up to clean up internal code.
All option interfaces that ended in a plural (`*Options`) have had their pluralization removed (`*Option` now).
`APIApplicationCommandInteractionDataOptionWithValues` has been renamed to `APIApplicationCommandInteractionDataBasicOption`,
and every `*InteractionDataOptions{Type}` interfaces have been renamed to `*InteractionData{Type}Option`
(i.e.: `ApplicationCommandInteractionDataOptionString` -> `APIApplicationCommandInteractionDataStringOption`).
## [0.25.2](https://github.com/discordjs/discord-api-types/compare/0.25.1...0.25.2) (2021-11-30)
### Bug Fixes
- **APISelectMenuComponent:** `options` property is required ([#248](https://github.com/discordjs/discord-api-types/issues/248)) ([51dee6e](https://github.com/discordjs/discord-api-types/commit/51dee6e0e5bb4d749b9f0436e7ec9d4793e56567))
### Features
- **Guild:** boost progress bars ([#227](https://github.com/discordjs/discord-api-types/issues/227)) ([47382b6](https://github.com/discordjs/discord-api-types/commit/47382b6183a1d232053fef23691d423f8af88f88))
## [0.25.1](https://github.com/discordjs/discord-api-types/compare/0.25.0...0.25.1) (2021-11-30)
### Bug Fixes
- **deno:** faulty import paths for guild scheduled events ([#245](https://github.com/discordjs/discord-api-types/issues/245)) ([44c0f05](https://github.com/discordjs/discord-api-types/commit/44c0f05cb2fc2b9ea50745530ae94a669a839594))
# [0.25.0](https://github.com/discordjs/discord-api-types/compare/0.24.0...0.25.0) (2021-11-29)
### Bug Fixes
- **APIApplicationCommandOption:** remove `default` property ([#242](https://github.com/discordjs/discord-api-types/issues/242)) ([faa8bf4](https://github.com/discordjs/discord-api-types/commit/faa8bf494bc79b844ce73e1892461e8440dc7abc))
- correct types for autocomplete interaction data ([#234](https://github.com/discordjs/discord-api-types/issues/234)) ([691abb5](https://github.com/discordjs/discord-api-types/commit/691abb581fb17093b5fa139f3ff53cbc0ad0b2a1))
- correct types for REST attachments ([#238](https://github.com/discordjs/discord-api-types/issues/238)) ([fa54b9d](https://github.com/discordjs/discord-api-types/commit/fa54b9de5522b9fa9d5367650950f8b0e44f6e14))
- make subcommand options optional ([#241](https://github.com/discordjs/discord-api-types/issues/241)) ([7379a34](https://github.com/discordjs/discord-api-types/commit/7379a345e820703a59a2d754c8ee7c0f0c710e09))
### Code Refactoring
- **UserFlags:** update flag names ([#229](https://github.com/discordjs/discord-api-types/issues/229)) ([f2d62e3](https://github.com/discordjs/discord-api-types/commit/f2d62e3cdf6128357f65e946fe1926cf915a6395))
### Features
- add guild scheduled event ([#186](https://github.com/discordjs/discord-api-types/issues/186)) ([d333962](https://github.com/discordjs/discord-api-types/commit/d333962715a58bd5ac14ad80e900b43b02777794))
- **RESTPostAPIChannelThreadsJSONBody:** add `rate_limit_per_user` ([#237](https://github.com/discordjs/discord-api-types/issues/237)) ([1e52e0c](https://github.com/discordjs/discord-api-types/commit/1e52e0ceab31465c7bbd820e332ef219ad715916))
- add max/min option for number-based options ([#221](https://github.com/discordjs/discord-api-types/issues/221)) ([bc1d03e](https://github.com/discordjs/discord-api-types/commit/bc1d03e527b9d37fac6d76cfbb51f4eeb8238e7b))
- add maze api error ([#228](https://github.com/discordjs/discord-api-types/issues/228)) ([7a15c97](https://github.com/discordjs/discord-api-types/commit/7a15c9786333fb6f2259f42536cfbf2cf0e43db8))
- **ActivityFlags:** add new flags ([#207](https://github.com/discordjs/discord-api-types/issues/207)) ([0f51d8e](https://github.com/discordjs/discord-api-types/commit/0f51d8e83f8aa53efde5c01849aaf09b91d15cbd))
- **ApplicationFlags:** add message content intent flags ([#226](https://github.com/discordjs/discord-api-types/issues/226)) ([d189e36](https://github.com/discordjs/discord-api-types/commit/d189e36c49cd230f98798ff57b668a6fe56df11b))
- **Attachments:** multi uploads and alt text ([#223](https://github.com/discordjs/discord-api-types/issues/223)) ([fdf133e](https://github.com/discordjs/discord-api-types/commit/fdf133ef45d3871defb46e47079c2acdd65e69d7))
- **GuildSystemChannelFlags:** add suppress member join sticker replies flag ([#222](https://github.com/discordjs/discord-api-types/issues/222)) ([4021dae](https://github.com/discordjs/discord-api-types/commit/4021dae44b331198d164a7c93dbc1242184efdf7))
- **Interactions:** add autocomplete api types ([#205](https://github.com/discordjs/discord-api-types/issues/205)) ([3b9320d](https://github.com/discordjs/discord-api-types/commit/3b9320dbf2cbbae7db44f00e8deaf336ab052e8b))
- **UserFlags:** add `BOT_HTTP_INTERACTIONS` flag ([#212](https://github.com/discordjs/discord-api-types/issues/212)) ([a015f96](https://github.com/discordjs/discord-api-types/commit/a015f96fcb4a74866f884db87732876095788111))
### BREAKING CHANGES
- **UserFlags:** All user flags now follow the internal name, with descriptions added for what they represent. This means you'll have to do some minor renaming in your code if you check for flags.
- **APIApplicationCommandOption:** If you were using the `default` property for ApplicationCommandOptions, it has been removed, as Discord wasn't even taking it into account anymore.
- The types for autocomplete interactions have been corrected.
# [0.24.0](https://github.com/discordjs/discord-api-types/compare/0.23.1...0.24.0) (2021-10-16)
### Bug Fixes
- **APISelectMenuComponent:** make options field optional ([#209](https://github.com/discordjs/discord-api-types/issues/209)) ([0c592a0](https://github.com/discordjs/discord-api-types/commit/0c592a0950431f43143bf1c32589bce2dd842b44))
### Code Refactoring
- **APIVoiceRegion:** removed `vip` property ([#214](https://github.com/discordjs/discord-api-types/issues/214)) ([7db6953](https://github.com/discordjs/discord-api-types/commit/7db69531d86fe5bdd462747b1e1287ee6b2dc496))
### Features
- **APIApplicationCommand:** add `channel_types` field to channel options ([#198](https://github.com/discordjs/discord-api-types/issues/198)) ([77396b5](https://github.com/discordjs/discord-api-types/commit/77396b557c6f3d4f85cfc4cd3b253638bc5b449d))
- **APIAttachment:** add ephemeral field ([#199](https://github.com/discordjs/discord-api-types/issues/199)) ([2aee879](https://github.com/discordjs/discord-api-types/commit/2aee87960070cb56979d3ced453c8cd64e81f150))
- **APIGuildMember:** add per guild avatars ([#208](https://github.com/discordjs/discord-api-types/issues/208)) ([0331518](https://github.com/discordjs/discord-api-types/commit/0331518c49c4761f900bacd8ca8a92e38b36b6e9))
- **APIRole:** add role icons ([#204](https://github.com/discordjs/discord-api-types/issues/204)) ([1076822](https://github.com/discordjs/discord-api-types/commit/1076822b90a1b6facf74aa3f2a6750566b3feb53))
- **InteractionResolvedChannels:** add `parent_id` and `thread_metadata` fields to resolved channels ([#210](https://github.com/discordjs/discord-api-types/issues/210)) ([64e4e52](https://github.com/discordjs/discord-api-types/commit/64e4e5246cd61eadf35591b8afdf4c5922fd4086))
- **PermissionFlagBits:** update thread permissions ([#181](https://github.com/discordjs/discord-api-types/issues/181)) ([68d97ae](https://github.com/discordjs/discord-api-types/commit/68d97aed1425002677acdf1d5444b36d3cfcc322))
- **PermissionFlagsBits:** add `StartEmbeddedActivities` ([#197](https://github.com/discordjs/discord-api-types/issues/197)) ([4bbe1ea](https://github.com/discordjs/discord-api-types/commit/4bbe1eaa867da810a1d039b21c3fc78208a50801))
- **RESTJSONErrorCodes:** add error 50101 ([#202](https://github.com/discordjs/discord-api-types/issues/202)) ([b453d75](https://github.com/discordjs/discord-api-types/commit/b453d75e4d13d34836247929be56c042cbc4b762))
- **Routes:** add missing OAuth2 routes ([#218](https://github.com/discordjs/discord-api-types/issues/218)) ([9dd3446](https://github.com/discordjs/discord-api-types/commit/9dd3446b64f31ae0831944f5c608095d650142d7))
### BREAKING CHANGES
- **APIVoiceRegion:** The `vip` property has been removed.
## [0.23.1](https://github.com/discordjs/discord-api-types/compare/0.23.0...0.23.1) (2021-09-08)
### Bug Fixes

View File

@@ -9,6 +9,7 @@ import type {
APIChannel,
APIEmoji,
APIGuild,
APIGuildScheduledEvent,
APIGuildIntegration,
APIGuildMember,
APIMessage,
@@ -183,6 +184,7 @@ export enum GatewayIntentBits {
DirectMessages = 1 << 12,
DirectMessageReactions = 1 << 13,
DirectMessageTyping = 1 << 14,
GuildScheduledEvents = 1 << 16,
}
/**
@@ -233,6 +235,11 @@ export enum GatewayDispatchEvents {
VoiceServerUpdate = 'VOICE_SERVER_UPDATE',
VoiceStateUpdate = 'VOICE_STATE_UPDATE',
WebhooksUpdate = 'WEBHOOKS_UPDATE',
GuildScheduledEventCreate = 'GUILD_SCHEDULED_EVENT_CREATE',
GuildScheduledEventUpdate = 'GUILD_SCHEDULED_EVENT_UPDATE',
GuildScheduledEventDelete = 'GUILD_SCHEDULED_EVENT_DELETE',
GuildScheduledEventUserAdd = 'GUILD_SCHEDULED_EVENT_USER_ADD',
GuildScheduledEventUserRemove = 'GUILD_SCHEDULED_EVENT_USER_REMOVE',
}
export type GatewaySendPayload =
@@ -265,6 +272,11 @@ export type GatewayDispatchPayload =
| GatewayGuildModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayGuildRoleModifyDispatch
| GatewayGuildScheduledEventCreateDispatch
| GatewayGuildScheduledEventUpdateDispatch
| GatewayGuildScheduledEventDeleteDispatch
| GatewayGuildScheduledEventUserAddDispatch
| GatewayGuildScheduledEventUserRemoveDispatch
| GatewayGuildStickersUpdateDispatch
| GatewayIntegrationCreateDispatch
| GatewayIntegrationDeleteDispatch
@@ -808,6 +820,49 @@ export interface GatewayGuildRoleDeleteDispatchData {
role_id: Snowflake;
}
export type GatewayGuildScheduledEventCreateDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventCreate,
GatewayGuildScheduledEventCreateDispatchData
>;
export type GatewayGuildScheduledEventCreateDispatchData = APIGuildScheduledEvent;
export type GatewayGuildScheduledEventUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventUpdate,
GatewayGuildScheduledEventUpdateDispatchData
>;
export type GatewayGuildScheduledEventUpdateDispatchData = APIGuildScheduledEvent;
export type GatewayGuildScheduledEventDeleteDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventDelete,
GatewayGuildScheduledEventDeleteDispatchData
>;
export type GatewayGuildScheduledEventDeleteDispatchData = APIGuildScheduledEvent;
export type GatewayGuildScheduledEventUserAddDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventUserAdd,
GatewayGuildScheduledEventUserAddDispatchData
>;
export interface GatewayGuildScheduledEventUserAddDispatchData {
guild_scheduled_event_id: Snowflake;
user_id: Snowflake;
guild_id: Snowflake;
}
export type GatewayGuildScheduledEventUserRemoveDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventUserRemove,
GatewayGuildScheduledEventUserAddDispatchData
>;
export interface GatewayGuildScheduledEventUserRemoveDispatchData {
guild_scheduled_event_id: Snowflake;
user_id: Snowflake;
guild_id: Snowflake;
}
/**
* https://discord.com/developers/docs/topics/gateway#integration-create
*/
@@ -1513,7 +1568,10 @@ interface BasePayload {
t?: string;
}
type NonDispatchPayload = Omit<BasePayload, 't'>;
type NonDispatchPayload = Omit<BasePayload, 't' | 's'> & {
t: null;
s: null;
};
interface DataPayload<Event extends GatewayDispatchEvents, D = unknown> extends BasePayload {
op: GatewayOpcodes.Dispatch;

View File

@@ -9,6 +9,7 @@ import type {
APIChannel,
APIEmoji,
APIGuild,
APIGuildScheduledEvent,
APIGuildIntegration,
APIGuildMember,
APIMessage,
@@ -186,6 +187,7 @@ export enum GatewayIntentBits {
DirectMessages = 1 << 12,
DirectMessageReactions = 1 << 13,
DirectMessageTyping = 1 << 14,
GuildScheduledEvents = 1 << 16,
}
/**
@@ -242,6 +244,11 @@ export enum GatewayDispatchEvents {
VoiceServerUpdate = 'VOICE_SERVER_UPDATE',
VoiceStateUpdate = 'VOICE_STATE_UPDATE',
WebhooksUpdate = 'WEBHOOKS_UPDATE',
GuildScheduledEventCreate = 'GUILD_SCHEDULED_EVENT_CREATE',
GuildScheduledEventUpdate = 'GUILD_SCHEDULED_EVENT_UPDATE',
GuildScheduledEventDelete = 'GUILD_SCHEDULED_EVENT_DELETE',
GuildScheduledEventUserAdd = 'GUILD_SCHEDULED_EVENT_USER_ADD',
GuildScheduledEventUserRemove = 'GUILD_SCHEDULED_EVENT_USER_REMOVE',
}
export type GatewaySendPayload =
@@ -274,6 +281,11 @@ export type GatewayDispatchPayload =
| GatewayGuildModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayGuildRoleModifyDispatch
| GatewayGuildScheduledEventCreateDispatch
| GatewayGuildScheduledEventUpdateDispatch
| GatewayGuildScheduledEventDeleteDispatch
| GatewayGuildScheduledEventUserAddDispatch
| GatewayGuildScheduledEventUserRemoveDispatch
| GatewayGuildStickersUpdateDispatch
| GatewayIntegrationCreateDispatch
| GatewayIntegrationDeleteDispatch
@@ -290,6 +302,9 @@ export type GatewayDispatchPayload =
| GatewayMessageReactionRemoveEmojiDispatch
| GatewayMessageUpdateDispatch
| GatewayPresenceUpdateDispatch
| GatewayStageInstanceCreateDispatch
| GatewayStageInstanceDeleteDispatch
| GatewayStageInstanceUpdateDispatch
| GatewayReadyDispatch
| GatewayResumedDispatch
| GatewayThreadListSyncDispatch
@@ -818,6 +833,49 @@ export interface GatewayGuildRoleDeleteDispatchData {
role_id: Snowflake;
}
export type GatewayGuildScheduledEventCreateDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventCreate,
GatewayGuildScheduledEventCreateDispatchData
>;
export type GatewayGuildScheduledEventCreateDispatchData = APIGuildScheduledEvent;
export type GatewayGuildScheduledEventUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventUpdate,
GatewayGuildScheduledEventUpdateDispatchData
>;
export type GatewayGuildScheduledEventUpdateDispatchData = APIGuildScheduledEvent;
export type GatewayGuildScheduledEventDeleteDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventDelete,
GatewayGuildScheduledEventDeleteDispatchData
>;
export type GatewayGuildScheduledEventDeleteDispatchData = APIGuildScheduledEvent;
export type GatewayGuildScheduledEventUserAddDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventUserAdd,
GatewayGuildScheduledEventUserAddDispatchData
>;
export interface GatewayGuildScheduledEventUserAddDispatchData {
guild_scheduled_event_id: Snowflake;
user_id: Snowflake;
guild_id: Snowflake;
}
export type GatewayGuildScheduledEventUserRemoveDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventUserRemove,
GatewayGuildScheduledEventUserAddDispatchData
>;
export interface GatewayGuildScheduledEventUserRemoveDispatchData {
guild_scheduled_event_id: Snowflake;
user_id: Snowflake;
guild_id: Snowflake;
}
/**
* https://discord.com/developers/docs/topics/gateway#integration-create
*/
@@ -1202,7 +1260,7 @@ export type GatewayThreadMemberUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#thread-member-update
*/
export type GatewayThreadMemberUpdateDispatchData = APIThreadMember;
export type GatewayThreadMemberUpdateDispatchData = APIThreadMember & { guild_id: Snowflake };
/**
* https://discord.com/developers/docs/topics/gateway#thread-create
@@ -1602,7 +1660,10 @@ interface BasePayload {
t?: string;
}
type NonDispatchPayload = Omit<BasePayload, 't'>;
type NonDispatchPayload = Omit<BasePayload, 't' | 's'> & {
t: null;
s: null;
};
interface DataPayload<Event extends GatewayDispatchEvents, D = unknown> extends BasePayload {
op: GatewayOpcodes.Dispatch;

View File

@@ -540,7 +540,7 @@ export type APIAuditLogChangeKeyExpireGracePeriod = AuditLogChangeData<'expire_g
* @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> {
interface AuditLogChangeData<K extends string, D> {
key: K;
new_value?: D;
old_value?: D;

View File

@@ -0,0 +1,26 @@
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandOptionBase<Type extends ApplicationCommandOptionType> {
type: Type;
name: string;
description: string;
required?: boolean;
}
export interface APIInteractionDataOptionBase<T extends ApplicationCommandOptionType, D> {
name: string;
type: T;
value: D;
}
export type APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
Base extends APIApplicationCommandOptionBase<ApplicationCommandOptionType>,
ChoiceType extends APIApplicationCommandOptionChoice,
> =
| (Base & {
autocomplete: true;
})
| (Base & {
autocomplete?: false;
choices?: ChoiceType[];
});

View File

@@ -0,0 +1,9 @@
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandBooleanOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.Boolean>;
export type APIApplicationCommandInteractionDataBooleanOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;

View File

@@ -0,0 +1,14 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { ChannelType } from '../../../channel.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandChannelOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Channel> {
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}
export type APIApplicationCommandInteractionDataChannelOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Channel,
Snowflake
>;

View File

@@ -0,0 +1,28 @@
import type {
APIApplicationCommandOptionBase,
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
APIInteractionDataOptionBase,
} from './base.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandIntegerOptionBase
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Integer> {
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
max_value?: number;
}
export type APIApplicationCommandIntegerOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandIntegerOptionBase,
APIApplicationCommandOptionChoice<number>
>;
export interface APIApplicationCommandInteractionDataIntegerOption
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
focused?: boolean;
}

View File

@@ -0,0 +1,11 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandMentionableOption =
APIApplicationCommandOptionBase<ApplicationCommandOptionType.Mentionable>;
export type APIApplicationCommandInteractionDataMentionableOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Mentionable,
Snowflake
>;

View File

@@ -0,0 +1,28 @@
import type {
APIApplicationCommandOptionBase,
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
APIInteractionDataOptionBase,
} from './base.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandNumberOptionBase
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Number> {
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
max_value?: number;
}
export type APIApplicationCommandNumberOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandNumberOptionBase,
APIApplicationCommandOptionChoice<number>
>;
export interface APIApplicationCommandInteractionDataNumberOption
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
focused?: boolean;
}

View File

@@ -0,0 +1,10 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandRoleOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.Role>;
export type APIApplicationCommandInteractionDataRoleOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Role,
Snowflake
>;

View File

@@ -0,0 +1,23 @@
/**
* 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<ValueType = string | number> {
name: string;
value: ValueType;
}

View File

@@ -0,0 +1,16 @@
import type {
APIApplicationCommandOptionBase,
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
APIInteractionDataOptionBase,
} from './base.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandStringOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandOptionBase<ApplicationCommandOptionType.String>,
APIApplicationCommandOptionChoice<string>
>;
export interface APIApplicationCommandInteractionDataStringOption
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
focused?: boolean;
}

View File

@@ -0,0 +1,14 @@
import type { APIApplicationCommandBasicOption, APIApplicationCommandInteractionDataBasicOption } from '../chatInput.ts';
import type { APIApplicationCommandOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandSubcommandOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Subcommand> {
options?: APIApplicationCommandBasicOption[];
}
export interface APIApplicationCommandInteractionDataSubcommandOption {
name: string;
type: ApplicationCommandOptionType.Subcommand;
options?: APIApplicationCommandInteractionDataBasicOption[];
}

View File

@@ -0,0 +1,17 @@
import type { APIApplicationCommandOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
import type {
APIApplicationCommandInteractionDataSubcommandOption,
APIApplicationCommandSubcommandOption,
} from './subcommand.ts';
export interface APIApplicationCommandSubcommandGroupOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.SubcommandGroup> {
options?: APIApplicationCommandSubcommandOption[];
}
export interface APIApplicationCommandInteractionDataSubcommandGroupOption {
name: string;
type: ApplicationCommandOptionType.SubcommandGroup;
options: APIApplicationCommandInteractionDataSubcommandOption[];
}

View File

@@ -0,0 +1,10 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandUserOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.User>;
export type APIApplicationCommandInteractionDataUserOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.User,
Snowflake
>;

View File

@@ -1,158 +1,105 @@
import type { APIRole, APIUser } from '../../mod.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type { APIRole, APIUser } from '../../mod.ts';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.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;
}
import type {
APIApplicationCommandStringOption,
APIApplicationCommandInteractionDataStringOption,
} from './_chatInput/string.ts';
import type {
APIApplicationCommandIntegerOptionBase,
APIApplicationCommandInteractionDataIntegerOption,
} from './_chatInput/integer.ts';
import type {
APIApplicationCommandBooleanOption,
APIApplicationCommandInteractionDataBooleanOption,
} from './_chatInput/boolean.ts';
import type {
APIApplicationCommandUserOption,
APIApplicationCommandInteractionDataUserOption,
} from './_chatInput/user.ts';
import type {
APIApplicationCommandChannelOption,
APIApplicationCommandInteractionDataChannelOption,
} from './_chatInput/channel.ts';
import type {
APIApplicationCommandRoleOption,
APIApplicationCommandInteractionDataRoleOption,
} from './_chatInput/role.ts';
import type {
APIApplicationCommandMentionableOption,
APIApplicationCommandInteractionDataMentionableOption,
} from './_chatInput/mentionable.ts';
import type {
APIApplicationCommandNumberOptionBase,
APIApplicationCommandInteractionDataNumberOption,
} from './_chatInput/number.ts';
import type {
APIApplicationCommandSubcommandOption,
APIApplicationCommandInteractionDataSubcommandOption,
} from './_chatInput/subcommand.ts';
import type {
APIApplicationCommandSubcommandGroupOption,
APIApplicationCommandInteractionDataSubcommandGroupOption,
} from './_chatInput/subcommandGroup.ts';
export * from './_chatInput/string.ts';
export * from './_chatInput/integer.ts';
export * from './_chatInput/boolean.ts';
export * from './_chatInput/user.ts';
export * from './_chatInput/channel.ts';
export * from './_chatInput/role.ts';
export * from './_chatInput/mentionable.ts';
export * from './_chatInput/number.ts';
export * from './_chatInput/subcommand.ts';
export * from './_chatInput/subcommandGroup.ts';
export * from './_chatInput/shared.ts';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandBasicOption =
| APIApplicationCommandStringOption
| APIApplicationCommandIntegerOptionBase
| APIApplicationCommandBooleanOption
| APIApplicationCommandUserOption
| APIApplicationCommandChannelOption
| APIApplicationCommandRoleOption
| APIApplicationCommandMentionableOption
| APIApplicationCommandNumberOptionBase;
/**
* 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;
}
| APIApplicationCommandSubcommandOption
| APIApplicationCommandSubcommandGroupOption
| APIApplicationCommandBasicOption;
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
| ApplicationCommandInteractionDataOptionSubCommandGroup
| APIApplicationCommandInteractionDataOptionWithValues;
| APIApplicationCommandInteractionDataSubcommandOption
| APIApplicationCommandInteractionDataSubcommandGroupOption
| APIApplicationCommandInteractionDataBasicOption;
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;
}
export type APIApplicationCommandInteractionDataBasicOption =
| APIApplicationCommandInteractionDataStringOption
| APIApplicationCommandInteractionDataIntegerOption
| APIApplicationCommandInteractionDataBooleanOption
| APIApplicationCommandInteractionDataUserOption
| APIApplicationCommandInteractionDataChannelOption
| APIApplicationCommandInteractionDataRoleOption
| APIApplicationCommandInteractionDataMentionableOption
| APIApplicationCommandInteractionDataNumberOption;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure

View File

@@ -0,0 +1,6 @@
import type { APIBaseInteraction, APIChatInputApplicationCommandInteractionData, InteractionType } from '../mod.ts';
export type APIApplicationCommandAutocompleteInteraction = APIBaseInteraction<
InteractionType.ApplicationCommandAutocomplete,
APIChatInputApplicationCommandInteractionData
>;

View File

@@ -39,7 +39,7 @@ export interface APIInteractionGuildMember extends APIGuildMember {
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
export interface APIBaseInteraction<Type extends InteractionType, Data> {
/**
* ID of the interaction
*/

View File

@@ -1,5 +1,6 @@
import type { MessageFlags } from '../mod.ts';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8.ts';
import type { APIApplicationCommandOptionChoice } from './applicationCommands.ts';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
@@ -8,6 +9,7 @@ export enum InteractionType {
Ping = 1,
ApplicationCommand,
MessageComponent,
ApplicationCommandAutocomplete,
}
/**
@@ -18,12 +20,18 @@ export type APIInteractionResponse =
| APIInteractionResponseChannelMessageWithSource
| APIInteractionResponseDeferredChannelMessageWithSource
| APIInteractionResponseDeferredMessageUpdate
| APIInteractionResponseUpdateMessage;
| APIInteractionResponseUpdateMessage
| APIApplicationCommandAutocompleteResponse;
export interface APIInteractionResponsePong {
type: InteractionResponseType.Pong;
}
export interface APIApplicationCommandAutocompleteResponse {
type: InteractionResponseType.ApplicationCommandAutocompleteResult;
data: APICommandAutocompleteInteractionResponseCallbackData;
}
export interface APIInteractionResponseChannelMessageWithSource {
type: InteractionResponseType.ChannelMessageWithSource;
data: APIInteractionResponseCallbackData;
@@ -67,6 +75,10 @@ export enum InteractionResponseType {
* ACK a button interaction and edit the message to which the button was attached
*/
UpdateMessage,
/**
* For autocomplete interactions
*/
ApplicationCommandAutocompleteResult,
}
/**
@@ -76,3 +88,7 @@ export type APIInteractionResponseCallbackData = Omit<
RESTPostAPIWebhookWithTokenJSONBody,
'username' | 'avatar_url'
> & { flags?: MessageFlags };
export interface APICommandAutocompleteInteractionResponseCallbackData {
choices?: APIApplicationCommandOptionChoice[];
}

View File

@@ -106,4 +106,6 @@ export enum ApplicationFlags {
GatewayGuildMembersLimited = 1 << 15,
VerificationPendingGuildLimit = 1 << 16,
Embedded = 1 << 17,
GatewayMessageContent = 1 << 18,
GatewayMessageContentLimited = 1 << 19,
}

View File

@@ -17,6 +17,11 @@ import type { StickerFormatType } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { APIWebhook } from './webhook.ts';
import type { StageInstancePrivacyLevel } from './stageInstance.ts';
import type {
APIGuildScheduledEvent,
GuildScheduledEventEntityType,
GuildScheduledEventStatus,
} from './guildScheduledEvent.ts';
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
@@ -46,6 +51,12 @@ export interface APIAuditLog {
* See https://discord.com/developers/docs/resources/guild#integration-object
*/
integrations: APIGuildIntegration[];
/**
* The guild scheduled events in the audit log
*
* See https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object
*/
guild_scheduled_events: APIGuildScheduledEvent[];
}
/**
@@ -144,6 +155,10 @@ export enum AuditLogEvent {
StickerCreate = 90,
StickerUpdate,
StickerDelete,
GuildScheduledEventCreate = 100,
GuildScheduledEventUpdate,
GuildScheduledEventDelete,
}
/**
@@ -302,7 +317,10 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildId;
| APIAuditLogChangeKeyGuildId
| APIAuditLogChangeKeyEntityType
| APIAuditLogChangeKeyStatus
| APIAuditLogChangeKeyLocation;
/**
* Returned when an entity's name is changed
@@ -310,7 +328,7 @@ export type APIAuditLogChange =
export type APIAuditLogChangeKeyName = AuditLogChangeData<'name', string>;
/**
* Returned when a guild's or sticker's description is changed
* Returned when a guild's or sticker's or guild scheduled event's description is changed
*/
export type APIAuditLogChangeKeyDescription = AuditLogChangeData<'description', string>;
@@ -502,7 +520,7 @@ export type APIAuditLogChangeKeyDeny = AuditLogChangeData<'deny', string>;
export type APIAuditLogChangeKeyCode = AuditLogChangeData<'code', string>;
/**
* Returned when an invite's channel_id is changed
* Returned when an invite's or guild scheduled event's channel_id is changed
*/
export type APIAuditLogChangeKeyChannelId = AuditLogChangeData<'channel_id', Snowflake>;
@@ -582,7 +600,7 @@ export type APIAuditLogChangeKeyExpireGracePeriod = AuditLogChangeData<'expire_g
export type APIAuditLogChangeKeyUserLimit = AuditLogChangeData<'user_limit', number>;
/**
* Returned when privacy level of a stage instance is changed
* Returned when privacy level of a stage instance or guild scheduled event is changed
*/
export type APIAuditLogChangeKeyPrivacyLevel = AuditLogChangeData<'privacy_level', StageInstancePrivacyLevel>;
@@ -611,7 +629,22 @@ export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', bool
*/
export type APIAuditLogChangeKeyGuildId = AuditLogChangeData<'guild_id', Snowflake>;
interface AuditLogChangeData<K extends string, D extends unknown> {
/**
* Returned when entity type of a guild scheduled event is changed
*/
export type APIAuditLogChangeKeyEntityType = AuditLogChangeData<'entity_type', GuildScheduledEventEntityType>;
/**
* Returned when status of a guild scheduled event is changed
*/
export type APIAuditLogChangeKeyStatus = AuditLogChangeData<'status', GuildScheduledEventStatus>;
/**
* Returned when location of a guild scheduled event is changed
*/
export type APIAuditLogChangeKeyLocation = AuditLogChangeData<'location', string>;
interface AuditLogChangeData<K extends string, D> {
key: K;
/**
* The new value

View File

@@ -807,6 +807,10 @@ export interface APIAttachment {
* Name of file attached
*/
filename: string;
/**
* Description for the file
*/
description?: string;
/**
* The attachment's media type
*
@@ -833,6 +837,10 @@ export interface APIAttachment {
* Width of file (if image)
*/
width?: number | null;
/**
* Whether this attachment is ephemeral
*/
ephemeral?: boolean;
}
/**

View File

@@ -298,6 +298,9 @@ export enum ActivityFlags {
JoinRequest = 1 << 3,
Sync = 1 << 4,
Play = 1 << 5,
PartyPrivacyFriends = 1 << 6,
PartyPrivacyVoiceChannel = 1 << 7,
Embedded = 1 << 8,
}
export interface GatewayActivityButton {

View File

@@ -11,6 +11,7 @@ import type { APIStageInstance } from './stageInstance.ts';
import type { APISticker } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { GatewayVoiceState } from './voice.ts';
import type { APIGuildScheduledEvent } from './guildScheduledEvent.ts';
/**
* https://discord.com/developers/docs/resources/guild#unavailable-guild-object
@@ -325,6 +326,18 @@ export interface APIGuild extends APIPartialGuild {
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
stickers: APISticker[];
/**
* Whether the guild has the boost progress bar enabled.
*/
premium_progress_bar_enabled: boolean;
/**
* The scheduled events in the guild
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object
*/
guild_scheduled_events?: APIGuildScheduledEvent[];
}
/**
@@ -414,6 +427,10 @@ export enum GuildSystemChannelFlags {
* Suppress server setup tips
*/
SuppressGuildReminderNotifications = 1 << 2,
/**
* Hide member join sticker reply buttons
*/
SuppressJoinNotificationReplies = 1 << 3,
}
/**
@@ -448,6 +465,18 @@ export enum GuildFeature {
* Guild has access to set an invite splash background
*/
InviteSplash = 'INVITE_SPLASH',
/**
* Guild has enabled Membership Screening
*/
MemberVerificationGateEnabled = 'MEMBER_VERIFICATION_GATE_ENABLED',
/**
* Guild has enabled monetization
*/
MonetizationEnabled = 'MONETIZATION_ENABLED',
/**
* Guild has increased custom sticker slots
*/
MoreStickers = 'MORE_STICKERS',
/**
* Guild has access to create news channels
*/
@@ -456,7 +485,31 @@ export enum GuildFeature {
* Guild is partnered
*/
Partnered = 'PARTNERED',
/**
* Guild can be previewed before joining via Membership Screening or the directory
*/
PreviewEnabled = 'PREVIEW_ENABLED',
/**
* Guild has access to create private threads
*/
PrivateThreads = 'PRIVATE_THREADS',
RelayEnabled = 'RELAY_ENABLED',
/**
* Guild is able to set role icons
*/
RoleIcons = 'ROLE_ICONS',
/**
* Guild has access to the seven day archive time for threads
*/
SevenDayThreadArchive = 'SEVEN_DAY_THREAD_ARCHIVE',
/**
* Guild has access to the three day archive time for threads
*/
ThreeDayThreadArchive = 'THREE_DAY_THREAD_ARCHIVE',
/**
* Guild has enabled ticketed events
*/
TicketedEventsEnabled = 'TICKETED_EVENTS_ENABLED',
/**
* Guild has access to set a vanity URL
*/
@@ -473,38 +526,6 @@ export enum GuildFeature {
* 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',
}
/**
@@ -593,6 +614,10 @@ export interface APIGuildMember {
* This users guild nickname
*/
nick?: string | null;
/**
* The member's guild avatar hash
*/
avatar?: string | null;
/**
* Array of role object ids
*
@@ -623,6 +648,10 @@ export interface APIGuildMember {
* *If this field is not present, it can be assumed as `false`.*
*/
pending?: boolean;
/**
* Timestamp of when the time out will be removed; until then, they cannot interact with the guild
*/
communication_disabled_until?: string | null;
}
/**

View File

@@ -0,0 +1,123 @@
import type { APIUser } from './user.ts';
import type { APIGuildMember } from './guild.ts';
import type { Snowflake } from '../../globals.ts';
export interface APIGuildScheduledEvent {
/**
* The id of the guild event
*/
id: Snowflake;
/**
* The guild id which the scheduled event belongs to
*/
guild_id: Snowflake;
/**
* The channel id in which the scheduled event will be hosted, or `null` if entity type is `EXTERNAL`
*/
channel_id: Snowflake | null;
/**
* The id of the user that created the scheduled event
*/
creator_id: Snowflake | null;
/**
* The name of the scheduled event
*/
name: string;
/**
* The description of the scheduled event
*/
description?: string;
/**
* The time the scheduled event will start
*/
scheduled_start_time: string;
/**
* The time at which the guild event will end, or `null` if the event does not have a scheduled time to end
*/
scheduled_end_time: string | null;
/**
* The privacy level of the scheduled event
*/
privacy_level: GuildScheduledEventPrivacyLevel;
/**
* The status of the scheduled event
*/
status: GuildScheduledEventStatus;
/**
* The type of hosting entity associated with the scheduled event
*/
entity_type: GuildScheduledEventEntityType;
/**
* The id of the hosting entity associated with the scheduled event
*/
entity_id: Snowflake | null;
/**
* The entity metadata for the scheduled event
*/
entity_metadata: APIGuildScheduledEventEntityMetadata;
/**
* The user that created the scheduled event
*/
creator?: APIUser;
/**
* The number of users subscribed to the scheduled event
*/
user_count?: number;
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata
*/
export interface APIGuildScheduledEventEntityMetadata {
/**
* The location of the scheduled event
*/
location?: string;
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types
*/
export enum GuildScheduledEventEntityType {
StageInstance = 1,
Voice,
External,
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status
*/
export enum GuildScheduledEventStatus {
Scheduled = 1,
Active,
Completed,
Canceled,
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level
*/
export enum GuildScheduledEventPrivacyLevel {
/**
* The scheduled event is only accessible to guild members
*/
GuildOnly = 2,
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object-guild-scheduled-event-user-structure
*/
export interface APIGuildScheduledEventUser {
/**
* The scheduled event id which the user subscribed to
*/
guild_scheduled_event_id: Snowflake;
/**
* The user which subscribed to the event
*/
user: APIUser;
/**
* The guild member data for this user for the guild which this event belongs to, if any
*/
member?: APIGuildMember;
}

View File

@@ -9,6 +9,7 @@ import type {
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
} from './_interactions/applicationCommands.ts';
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete.ts';
export * from './_interactions/base.ts';
export * from './_interactions/messageComponents.ts';
@@ -19,7 +20,11 @@ export * from './_interactions/applicationCommands.ts';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIInteraction = APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
export type APIInteraction =
| APIPingInteraction
| APIApplicationCommandInteraction
| APIMessageComponentInteraction
| APIApplicationCommandAutocompleteInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object

View File

@@ -7,6 +7,7 @@ import type { APIPartialGuild } from './guild.ts';
import type { APIApplication } from './application.ts';
import type { APIInviteStageInstance } from './stageInstance.ts';
import type { APIUser } from './user.ts';
import type { APIGuildScheduledEvent } from './guildScheduledEvent.ts';
/**
* https://discord.com/developers/docs/resources/invite#invite-object
@@ -27,7 +28,7 @@ export interface APIInvite {
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
channel: Required<APIPartialChannel>;
channel: Required<APIPartialChannel> | null;
/**
* The user who created the invite
*
@@ -68,6 +69,10 @@ export interface APIInvite {
* The stage instance data if there is a public stage instance in the stage channel this invite is for
*/
stage_instance?: APIInviteStageInstance;
/**
* The guild scheduled event data, returned from the `GET /invites/<code>` endpoint when `guild_scheduled_event_id` is a valid guild scheduled event id
*/
guild_scheduled_event?: APIGuildScheduledEvent;
}
/**

View File

@@ -4,6 +4,7 @@ export * from './channel.ts';
export * from './emoji.ts';
export * from './gateway.ts';
export * from './guild.ts';
export * from './guildScheduledEvent.ts';
export * from './interactions.ts';
export * from './invite.ts';
export * from './oauth2.ts';

View File

@@ -40,6 +40,12 @@ export enum OAuth2Scopes {
* See https://discord.com/developers/docs/resources/guild#add-guild-member
*/
GuildsJoin = 'guilds.join',
/**
* Allows /users/@me/guilds/{guild.id}/member to return a user's member information in a guild
*
* See https://discord.com/developers/docs/resources/guild#get-current-user-guild-member
*/
GuildsMembersRead = 'guilds.members.read',
/**
* Allows your app to join users to a group dm
*

View File

@@ -45,7 +45,10 @@ export const PermissionFlagsBits = {
ManageEmojisAndStickers: 1n << 30n,
UseApplicationCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
ManageEvents: 1n << 33n,
UseExternalStickers: 1n << 37n,
StartEmbeddedActivities: 1n << 39n,
ModerateMembers: 1n << 40n,
} as const;
/**
@@ -74,6 +77,14 @@ export interface APIRole {
* If this role is pinned in the user listing
*/
hoist: boolean;
/**
* The role icon hash
*/
icon?: string | null;
/**
* The role unicode emoji as a standard emoji
*/
unicode_emoji?: string | null;
/**
* Position of this role
*/

View File

@@ -93,7 +93,7 @@ export enum StickerFormatType {
export type APIStickerItem = Pick<APISticker, 'id' | 'name' | 'format_type'>;
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
* https://discord.com/developers/docs/resources/sticker#sticker-pack-object
*/
export interface APIStickerPack {
/**
@@ -123,5 +123,5 @@ export interface APIStickerPack {
/**
* ID of the sticker pack's banner image
*/
banner_asset_id: Snowflake;
banner_asset_id?: Snowflake;
}

View File

@@ -85,20 +85,66 @@ export interface APIUser {
* https://discord.com/developers/docs/resources/user#user-object-user-flags
*/
export enum UserFlags {
/**
* None
*/
None = 0,
DiscordEmployee = 1 << 0,
PartneredServerOwner = 1 << 1,
DiscordHypeSquadEvents = 1 << 2,
/**
* Discord Employee
*/
Staff = 1 << 0,
/**
* Partnered Server Owner
*/
Partner = 1 << 1,
/**
* HypeSquad Events Coordinator
*/
Hypesquad = 1 << 2,
/**
* Bug Hunter Level 1
*/
BugHunterLevel1 = 1 << 3,
HypeSquadHouseBravery = 1 << 6,
HypeSquadHouseBrilliance = 1 << 7,
HypeSquadHouseBalance = 1 << 8,
EarlySupporter = 1 << 9,
TeamUser = 1 << 10,
/**
* House Bravery Member
*/
HypeSquadOnlineHouse1 = 1 << 6,
/**
* House Brilliance Member
*/
HypeSquadOnlineHouse2 = 1 << 7,
/**
* House Balance Member
*/
HypeSquadOnlineHouse3 = 1 << 8,
/**
* Early Nitro Supporter
*/
PremiumEarlySupporter = 1 << 9,
/**
* User is a [team](https://discord.com/developers/docs/topics/teams)
*/
TeamPseudoUser = 1 << 10,
/**
* Bug Hunter Level 2
*/
BugHunterLevel2 = 1 << 14,
/**
* Verified Bot
*/
VerifiedBot = 1 << 16,
EarlyVerifiedBotDeveloper = 1 << 17,
DiscordCertifiedModerator = 1 << 18,
/**
* Early Verified Bot Developer
*/
VerifiedDeveloper = 1 << 17,
/**
* Discord Certified Moderator
*/
CertifiedModerator = 1 << 18,
/**
* Bot uses only [HTTP interactions](https://discord.com/developers/docs/interactions/receiving-and-responding#receiving-an-interaction) and is shown in the online member list
*/
BotHTTPInteractions = 1 << 19,
}
/**

View File

@@ -77,10 +77,6 @@ export interface APIVoiceRegion {
* 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
*/

View File

@@ -0,0 +1,26 @@
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandOptionBase<Type extends ApplicationCommandOptionType> {
type: Type;
name: string;
description: string;
required?: boolean;
}
export interface APIInteractionDataOptionBase<T extends ApplicationCommandOptionType, D> {
name: string;
type: T;
value: D;
}
export type APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
Base extends APIApplicationCommandOptionBase<ApplicationCommandOptionType>,
ChoiceType extends APIApplicationCommandOptionChoice,
> =
| (Base & {
autocomplete: true;
})
| (Base & {
autocomplete?: false;
choices?: ChoiceType[];
});

View File

@@ -0,0 +1,9 @@
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandBooleanOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.Boolean>;
export type APIApplicationCommandInteractionDataBooleanOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;

View File

@@ -0,0 +1,14 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { ChannelType } from '../../../channel.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandChannelOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Channel> {
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}
export type APIApplicationCommandInteractionDataChannelOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Channel,
Snowflake
>;

View File

@@ -0,0 +1,28 @@
import type {
APIApplicationCommandOptionBase,
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
APIInteractionDataOptionBase,
} from './base.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandIntegerOptionBase
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Integer> {
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
max_value?: number;
}
export type APIApplicationCommandIntegerOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandIntegerOptionBase,
APIApplicationCommandOptionChoice<number>
>;
export interface APIApplicationCommandInteractionDataIntegerOption
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
focused?: boolean;
}

View File

@@ -0,0 +1,11 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandMentionableOption =
APIApplicationCommandOptionBase<ApplicationCommandOptionType.Mentionable>;
export type APIApplicationCommandInteractionDataMentionableOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Mentionable,
Snowflake
>;

View File

@@ -0,0 +1,28 @@
import type {
APIApplicationCommandOptionBase,
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
APIInteractionDataOptionBase,
} from './base.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandNumberOptionBase
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Number> {
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
min_value?: number;
/**
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
*/
max_value?: number;
}
export type APIApplicationCommandNumberOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandNumberOptionBase,
APIApplicationCommandOptionChoice<number>
>;
export interface APIApplicationCommandInteractionDataNumberOption
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
focused?: boolean;
}

View File

@@ -0,0 +1,10 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandRoleOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.Role>;
export type APIApplicationCommandInteractionDataRoleOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Role,
Snowflake
>;

View File

@@ -0,0 +1,23 @@
/**
* 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<ValueType = string | number> {
name: string;
value: ValueType;
}

View File

@@ -0,0 +1,16 @@
import type {
APIApplicationCommandOptionBase,
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
APIInteractionDataOptionBase,
} from './base.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandStringOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
APIApplicationCommandOptionBase<ApplicationCommandOptionType.String>,
APIApplicationCommandOptionChoice<string>
>;
export interface APIApplicationCommandInteractionDataStringOption
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
focused?: boolean;
}

View File

@@ -0,0 +1,14 @@
import type { APIApplicationCommandBasicOption, APIApplicationCommandInteractionDataBasicOption } from '../chatInput.ts';
import type { APIApplicationCommandOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export interface APIApplicationCommandSubcommandOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Subcommand> {
options?: APIApplicationCommandBasicOption[];
}
export interface APIApplicationCommandInteractionDataSubcommandOption {
name: string;
type: ApplicationCommandOptionType.Subcommand;
options?: APIApplicationCommandInteractionDataBasicOption[];
}

View File

@@ -0,0 +1,17 @@
import type { APIApplicationCommandOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
import type {
APIApplicationCommandInteractionDataSubcommandOption,
APIApplicationCommandSubcommandOption,
} from './subcommand.ts';
export interface APIApplicationCommandSubcommandGroupOption
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.SubcommandGroup> {
options?: APIApplicationCommandSubcommandOption[];
}
export interface APIApplicationCommandInteractionDataSubcommandGroupOption {
name: string;
type: ApplicationCommandOptionType.SubcommandGroup;
options: APIApplicationCommandInteractionDataSubcommandOption[];
}

View File

@@ -0,0 +1,10 @@
import type { Snowflake } from '../../../../../globals.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandUserOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.User>;
export type APIApplicationCommandInteractionDataUserOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.User,
Snowflake
>;

View File

@@ -1,158 +1,105 @@
import type { APIRole, APIUser } from '../../mod.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type { APIRole, APIUser } from '../../mod.ts';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.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;
}
import type {
APIApplicationCommandStringOption,
APIApplicationCommandInteractionDataStringOption,
} from './_chatInput/string.ts';
import type {
APIApplicationCommandIntegerOptionBase,
APIApplicationCommandInteractionDataIntegerOption,
} from './_chatInput/integer.ts';
import type {
APIApplicationCommandBooleanOption,
APIApplicationCommandInteractionDataBooleanOption,
} from './_chatInput/boolean.ts';
import type {
APIApplicationCommandUserOption,
APIApplicationCommandInteractionDataUserOption,
} from './_chatInput/user.ts';
import type {
APIApplicationCommandChannelOption,
APIApplicationCommandInteractionDataChannelOption,
} from './_chatInput/channel.ts';
import type {
APIApplicationCommandRoleOption,
APIApplicationCommandInteractionDataRoleOption,
} from './_chatInput/role.ts';
import type {
APIApplicationCommandMentionableOption,
APIApplicationCommandInteractionDataMentionableOption,
} from './_chatInput/mentionable.ts';
import type {
APIApplicationCommandNumberOptionBase,
APIApplicationCommandInteractionDataNumberOption,
} from './_chatInput/number.ts';
import type {
APIApplicationCommandSubcommandOption,
APIApplicationCommandInteractionDataSubcommandOption,
} from './_chatInput/subcommand.ts';
import type {
APIApplicationCommandSubcommandGroupOption,
APIApplicationCommandInteractionDataSubcommandGroupOption,
} from './_chatInput/subcommandGroup.ts';
export * from './_chatInput/string.ts';
export * from './_chatInput/integer.ts';
export * from './_chatInput/boolean.ts';
export * from './_chatInput/user.ts';
export * from './_chatInput/channel.ts';
export * from './_chatInput/role.ts';
export * from './_chatInput/mentionable.ts';
export * from './_chatInput/number.ts';
export * from './_chatInput/subcommand.ts';
export * from './_chatInput/subcommandGroup.ts';
export * from './_chatInput/shared.ts';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandBasicOption =
| APIApplicationCommandStringOption
| APIApplicationCommandIntegerOptionBase
| APIApplicationCommandBooleanOption
| APIApplicationCommandUserOption
| APIApplicationCommandChannelOption
| APIApplicationCommandRoleOption
| APIApplicationCommandMentionableOption
| APIApplicationCommandNumberOptionBase;
/**
* 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;
}
| APIApplicationCommandSubcommandOption
| APIApplicationCommandSubcommandGroupOption
| APIApplicationCommandBasicOption;
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
| ApplicationCommandInteractionDataOptionSubCommandGroup
| APIApplicationCommandInteractionDataOptionWithValues;
| APIApplicationCommandInteractionDataSubcommandOption
| APIApplicationCommandInteractionDataSubcommandGroupOption
| APIApplicationCommandInteractionDataBasicOption;
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;
}
export type APIApplicationCommandInteractionDataBasicOption =
| APIApplicationCommandInteractionDataStringOption
| APIApplicationCommandInteractionDataIntegerOption
| APIApplicationCommandInteractionDataBooleanOption
| APIApplicationCommandInteractionDataUserOption
| APIApplicationCommandInteractionDataChannelOption
| APIApplicationCommandInteractionDataRoleOption
| APIApplicationCommandInteractionDataMentionableOption
| APIApplicationCommandInteractionDataNumberOption;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure

View File

@@ -1,5 +1,5 @@
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { APIPartialChannel } from '../channel.ts';
import type { APIPartialChannel, APIThreadMetadata } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIBaseInteraction } from './base.ts';
import type { InteractionType } from './responses.ts';
@@ -85,7 +85,9 @@ export type APIApplicationCommandInteractionData =
* https://discord.com/developers/docs/resources/channel#channel-object
*/
export interface APIInteractionDataResolvedChannel extends Required<APIPartialChannel> {
thread_metadata?: APIThreadMetadata | null;
permissions: Permissions;
parent_id?: string | null;
}
/**

View File

@@ -0,0 +1,6 @@
import type { APIBaseInteraction, APIChatInputApplicationCommandInteractionData, InteractionType } from '../mod.ts';
export type APIApplicationCommandAutocompleteInteraction = APIBaseInteraction<
InteractionType.ApplicationCommandAutocomplete,
APIChatInputApplicationCommandInteractionData
>;

View File

@@ -39,7 +39,7 @@ export interface APIInteractionGuildMember extends APIGuildMember {
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
export interface APIBaseInteraction<Type extends InteractionType, Data> {
/**
* ID of the interaction
*/

View File

@@ -1,5 +1,6 @@
import type { MessageFlags } from '../mod.ts';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9.ts';
import type { APIApplicationCommandOptionChoice } from './applicationCommands.ts';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
@@ -8,6 +9,7 @@ export enum InteractionType {
Ping = 1,
ApplicationCommand,
MessageComponent,
ApplicationCommandAutocomplete,
}
/**
@@ -18,12 +20,18 @@ export type APIInteractionResponse =
| APIInteractionResponseChannelMessageWithSource
| APIInteractionResponseDeferredChannelMessageWithSource
| APIInteractionResponseDeferredMessageUpdate
| APIInteractionResponseUpdateMessage;
| APIInteractionResponseUpdateMessage
| APIApplicationCommandAutocompleteResponse;
export interface APIInteractionResponsePong {
type: InteractionResponseType.Pong;
}
export interface APIApplicationCommandAutocompleteResponse {
type: InteractionResponseType.ApplicationCommandAutocompleteResult;
data: APICommandAutocompleteInteractionResponseCallbackData;
}
export interface APIInteractionResponseChannelMessageWithSource {
type: InteractionResponseType.ChannelMessageWithSource;
data: APIInteractionResponseCallbackData;
@@ -67,6 +75,10 @@ export enum InteractionResponseType {
* ACK a button interaction and edit the message to which the button was attached
*/
UpdateMessage,
/**
* For autocomplete interactions
*/
ApplicationCommandAutocompleteResult,
}
/**
@@ -76,3 +88,7 @@ export type APIInteractionResponseCallbackData = Omit<
RESTPostAPIWebhookWithTokenJSONBody,
'username' | 'avatar_url'
> & { flags?: MessageFlags };
export interface APICommandAutocompleteInteractionResponseCallbackData {
choices?: APIApplicationCommandOptionChoice[];
}

View File

@@ -106,4 +106,6 @@ export enum ApplicationFlags {
GatewayGuildMembersLimited = 1 << 15,
VerificationPendingGuildLimit = 1 << 16,
Embedded = 1 << 17,
GatewayMessageContent = 1 << 18,
GatewayMessageContentLimited = 1 << 19,
}

View File

@@ -17,6 +17,11 @@ import type { StickerFormatType } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { APIWebhook } from './webhook.ts';
import type { StageInstancePrivacyLevel } from './stageInstance.ts';
import type {
APIGuildScheduledEvent,
GuildScheduledEventEntityType,
GuildScheduledEventStatus,
} from './guildScheduledEvent.ts';
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
@@ -54,6 +59,12 @@ export interface APIAuditLog {
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
threads: APIChannel[];
/**
* The guild scheduled events in the audit log
*
* See https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object
*/
guild_scheduled_events: APIGuildScheduledEvent[];
}
/**
@@ -153,6 +164,10 @@ export enum AuditLogEvent {
StickerUpdate,
StickerDelete,
GuildScheduledEventCreate = 100,
GuildScheduledEventUpdate,
GuildScheduledEventDelete,
ThreadCreate = 110,
ThreadUpdate,
ThreadDelete,
@@ -318,7 +333,10 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyArchived
| APIAuditLogChangeKeyLocked
| APIAuditLogChangeKeyAutoArchiveDuration
| APIAuditLogChangeKeyDefaultAutoArchiveDuration;
| APIAuditLogChangeKeyDefaultAutoArchiveDuration
| APIAuditLogChangeKeyEntityType
| APIAuditLogChangeKeyStatus
| APIAuditLogChangeKeyLocation;
/**
* Returned when an entity's name is changed
@@ -326,7 +344,7 @@ export type APIAuditLogChange =
export type APIAuditLogChangeKeyName = AuditLogChangeData<'name', string>;
/**
* Returned when a guild's or sticker's description is changed
* Returned when a guild's or sticker's or guild scheduled event's description is changed
*/
export type APIAuditLogChangeKeyDescription = AuditLogChangeData<'description', string>;
@@ -518,7 +536,7 @@ export type APIAuditLogChangeKeyDeny = AuditLogChangeData<'deny', string>;
export type APIAuditLogChangeKeyCode = AuditLogChangeData<'code', string>;
/**
* Returned when an invite's channel_id is changed
* Returned when an invite's or guild scheduled event's channel_id is changed
*/
export type APIAuditLogChangeKeyChannelId = AuditLogChangeData<'channel_id', Snowflake>;
@@ -598,7 +616,7 @@ export type APIAuditLogChangeKeyExpireGracePeriod = AuditLogChangeData<'expire_g
export type APIAuditLogChangeKeyUserLimit = AuditLogChangeData<'user_limit', number>;
/**
* Returned when privacy level of a stage instance is changed
* Returned when privacy level of a stage instance or guild scheduled event is changed
*/
export type APIAuditLogChangeKeyPrivacyLevel = AuditLogChangeData<'privacy_level', StageInstancePrivacyLevel>;
@@ -650,7 +668,22 @@ export type APIAuditLogChangeKeyDefaultAutoArchiveDuration = AuditLogChangeData<
number
>;
interface AuditLogChangeData<K extends string, D extends unknown> {
/**
* Returned when entity type of a guild scheduled event is changed
*/
export type APIAuditLogChangeKeyEntityType = AuditLogChangeData<'entity_type', GuildScheduledEventEntityType>;
/**
* Returned when status of a guild scheduled event is changed
*/
export type APIAuditLogChangeKeyStatus = AuditLogChangeData<'status', GuildScheduledEventStatus>;
/**
* Returned when location of a guild scheduled event is changed
*/
export type APIAuditLogChangeKeyLocation = AuditLogChangeData<'location', string>;
interface AuditLogChangeData<K extends string, D> {
key: K;
/**
* The new value

View File

@@ -936,6 +936,10 @@ export interface APIAttachment {
* Name of file attached
*/
filename: string;
/**
* Description for the file
*/
description?: string;
/**
* The attachment's media type
*
@@ -962,6 +966,10 @@ export interface APIAttachment {
* Width of file (if image)
*/
width?: number | null;
/**
* Whether this attachment is ephemeral
*/
ephemeral?: boolean;
}
/**

View File

@@ -299,6 +299,9 @@ export enum ActivityFlags {
JoinRequest = 1 << 3,
Sync = 1 << 4,
Play = 1 << 5,
PartyPrivacyFriends = 1 << 6,
PartyPrivacyVoiceChannel = 1 << 7,
Embedded = 1 << 8,
}
export interface GatewayActivityButton {

View File

@@ -11,6 +11,7 @@ import type { APIStageInstance } from './stageInstance.ts';
import type { APISticker } from './sticker.ts';
import type { APIUser } from './user.ts';
import type { GatewayVoiceState } from './voice.ts';
import type { APIGuildScheduledEvent } from './guildScheduledEvent.ts';
/**
* https://discord.com/developers/docs/resources/guild#unavailable-guild-object
@@ -333,6 +334,18 @@ export interface APIGuild extends APIPartialGuild {
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
stickers: APISticker[];
/**
* Whether the guild has the boost progress bar enabled.
*/
premium_progress_bar_enabled: boolean;
/**
* The scheduled events in the guild
*
* **This field is only sent within the [GUILD_CREATE](https://discord.com/developers/docs/topics/gateway#guild-create) event**
*
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object
*/
guild_scheduled_events?: APIGuildScheduledEvent[];
}
/**
@@ -422,6 +435,10 @@ export enum GuildSystemChannelFlags {
* Suppress server setup tips
*/
SuppressGuildReminderNotifications = 1 << 2,
/**
* Hide member join sticker reply buttons
*/
SuppressJoinNotificationReplies = 1 << 3,
}
/**
@@ -456,6 +473,18 @@ export enum GuildFeature {
* Guild has access to set an invite splash background
*/
InviteSplash = 'INVITE_SPLASH',
/**
* Guild has enabled Membership Screening
*/
MemberVerificationGateEnabled = 'MEMBER_VERIFICATION_GATE_ENABLED',
/**
* Guild has enabled monetization
*/
MonetizationEnabled = 'MONETIZATION_ENABLED',
/**
* Guild has increased custom sticker slots
*/
MoreStickers = 'MORE_STICKERS',
/**
* Guild has access to create news channels
*/
@@ -464,7 +493,31 @@ export enum GuildFeature {
* Guild is partnered
*/
Partnered = 'PARTNERED',
/**
* Guild can be previewed before joining via Membership Screening or the directory
*/
PreviewEnabled = 'PREVIEW_ENABLED',
/**
* Guild has access to create private threads
*/
PrivateThreads = 'PRIVATE_THREADS',
RelayEnabled = 'RELAY_ENABLED',
/**
* Guild is able to set role icons
*/
RoleIcons = 'ROLE_ICONS',
/**
* Guild has access to the seven day archive time for threads
*/
SevenDayThreadArchive = 'SEVEN_DAY_THREAD_ARCHIVE',
/**
* Guild has access to the three day archive time for threads
*/
ThreeDayThreadArchive = 'THREE_DAY_THREAD_ARCHIVE',
/**
* Guild has enabled ticketed events
*/
TicketedEventsEnabled = 'TICKETED_EVENTS_ENABLED',
/**
* Guild has access to set a vanity URL
*/
@@ -481,38 +534,6 @@ export enum GuildFeature {
* 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',
}
/**
@@ -601,6 +622,10 @@ export interface APIGuildMember {
* This users guild nickname
*/
nick?: string | null;
/**
* The member's guild avatar hash
*/
avatar?: string | null;
/**
* Array of role object ids
*
@@ -631,6 +656,10 @@ export interface APIGuildMember {
* *If this field is not present, it can be assumed as `false`.*
*/
pending?: boolean;
/**
* Timestamp of when the time out will be removed; until then, they cannot interact with the guild
*/
communication_disabled_until?: string | null;
}
/**

View File

@@ -0,0 +1,123 @@
import type { APIUser } from './user.ts';
import type { APIGuildMember } from './guild.ts';
import type { Snowflake } from '../../globals.ts';
export interface APIGuildScheduledEvent {
/**
* The id of the guild event
*/
id: Snowflake;
/**
* The guild id which the scheduled event belongs to
*/
guild_id: Snowflake;
/**
* The channel id in which the scheduled event will be hosted, or `null` if entity type is `EXTERNAL`
*/
channel_id: Snowflake | null;
/**
* The id of the user that created the scheduled event
*/
creator_id: Snowflake | null;
/**
* The name of the scheduled event
*/
name: string;
/**
* The description of the scheduled event
*/
description?: string;
/**
* The time the scheduled event will start
*/
scheduled_start_time: string;
/**
* The time at which the guild event will end, or `null` if the event does not have a scheduled time to end
*/
scheduled_end_time: string | null;
/**
* The privacy level of the scheduled event
*/
privacy_level: GuildScheduledEventPrivacyLevel;
/**
* The status of the scheduled event
*/
status: GuildScheduledEventStatus;
/**
* The type of hosting entity associated with the scheduled event
*/
entity_type: GuildScheduledEventEntityType;
/**
* The id of the hosting entity associated with the scheduled event
*/
entity_id: Snowflake | null;
/**
* The entity metadata for the scheduled event
*/
entity_metadata: APIGuildScheduledEventEntityMetadata;
/**
* The user that created the scheduled event
*/
creator?: APIUser;
/**
* The number of users subscribed to the scheduled event
*/
user_count?: number;
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata
*/
export interface APIGuildScheduledEventEntityMetadata {
/**
* The location of the scheduled event
*/
location?: string;
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types
*/
export enum GuildScheduledEventEntityType {
StageInstance = 1,
Voice,
External,
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status
*/
export enum GuildScheduledEventStatus {
Scheduled = 1,
Active,
Completed,
Canceled,
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level
*/
export enum GuildScheduledEventPrivacyLevel {
/**
* The scheduled event is only accessible to guild members
*/
GuildOnly = 2,
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object-guild-scheduled-event-user-structure
*/
export interface APIGuildScheduledEventUser {
/**
* The scheduled event id which the user subscribed to
*/
guild_scheduled_event_id: Snowflake;
/**
* The user which subscribed to the event
*/
user: APIUser;
/**
* The guild member data for this user for the guild which this event belongs to, if any
*/
member?: APIGuildMember;
}

View File

@@ -9,6 +9,7 @@ import type {
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
} from './_interactions/applicationCommands.ts';
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete.ts';
export * from './_interactions/base.ts';
export * from './_interactions/messageComponents.ts';
@@ -19,7 +20,11 @@ export * from './_interactions/applicationCommands.ts';
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIInteraction = APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
export type APIInteraction =
| APIPingInteraction
| APIApplicationCommandInteraction
| APIMessageComponentInteraction
| APIApplicationCommandAutocompleteInteraction;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object

View File

@@ -7,6 +7,7 @@ import type { APIPartialGuild } from './guild.ts';
import type { APIApplication } from './application.ts';
import type { APIInviteStageInstance } from './stageInstance.ts';
import type { APIUser } from './user.ts';
import type { APIGuildScheduledEvent } from './guildScheduledEvent.ts';
/**
* https://discord.com/developers/docs/resources/invite#invite-object
@@ -27,7 +28,7 @@ export interface APIInvite {
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
channel: Required<APIPartialChannel>;
channel: Required<APIPartialChannel> | null;
/**
* The user who created the invite
*
@@ -68,6 +69,10 @@ export interface APIInvite {
* The stage instance data if there is a public stage instance in the stage channel this invite is for
*/
stage_instance?: APIInviteStageInstance;
/**
* The guild scheduled event data, returned from the `GET /invites/<code>` endpoint when `guild_scheduled_event_id` is a valid guild scheduled event id
*/
guild_scheduled_event?: APIGuildScheduledEvent;
}
/**

View File

@@ -4,6 +4,7 @@ export * from './channel.ts';
export * from './emoji.ts';
export * from './gateway.ts';
export * from './guild.ts';
export * from './guildScheduledEvent.ts';
export * from './interactions.ts';
export * from './invite.ts';
export * from './oauth2.ts';

View File

@@ -40,6 +40,12 @@ export enum OAuth2Scopes {
* See https://discord.com/developers/docs/resources/guild#add-guild-member
*/
GuildsJoin = 'guilds.join',
/**
* Allows /users/@me/guilds/{guild.id}/member to return a user's member information in a guild
*
* See https://discord.com/developers/docs/resources/guild#get-current-user-guild-member
*/
GuildsMembersRead = 'guilds.members.read',
/**
* Allows your app to join users to a group dm
*

View File

@@ -45,10 +45,14 @@ export const PermissionFlagsBits = {
ManageEmojisAndStickers: 1n << 30n,
UseApplicationCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
ManageEvents: 1n << 33n,
ManageThreads: 1n << 34n,
UsePublicThreads: 1n << 35n,
UsePrivateThreads: 1n << 36n,
CreatePublicThreads: 1n << 35n,
CreatePrivateThreads: 1n << 36n,
UseExternalStickers: 1n << 37n,
SendMessagesInThreads: 1n << 38n,
StartEmbeddedActivities: 1n << 39n,
ModerateMembers: 1n << 40n,
} as const;
/**
@@ -77,6 +81,14 @@ export interface APIRole {
* If this role is pinned in the user listing
*/
hoist: boolean;
/**
* The role icon hash
*/
icon?: string | null;
/**
* The role unicode emoji as a standard emoji
*/
unicode_emoji?: string | null;
/**
* Position of this role
*/

View File

@@ -93,7 +93,7 @@ export enum StickerFormatType {
export type APIStickerItem = Pick<APISticker, 'id' | 'name' | 'format_type'>;
/**
* https://discord.com/developers/docs/resources/sticker#sticker-object
* https://discord.com/developers/docs/resources/sticker#sticker-pack-object
*/
export interface APIStickerPack {
/**
@@ -123,5 +123,5 @@ export interface APIStickerPack {
/**
* ID of the sticker pack's banner image
*/
banner_asset_id: Snowflake;
banner_asset_id?: Snowflake;
}

View File

@@ -85,20 +85,66 @@ export interface APIUser {
* https://discord.com/developers/docs/resources/user#user-object-user-flags
*/
export enum UserFlags {
/**
* None
*/
None = 0,
DiscordEmployee = 1 << 0,
PartneredServerOwner = 1 << 1,
DiscordHypeSquadEvents = 1 << 2,
/**
* Discord Employee
*/
Staff = 1 << 0,
/**
* Partnered Server Owner
*/
Partner = 1 << 1,
/**
* HypeSquad Events Coordinator
*/
Hypesquad = 1 << 2,
/**
* Bug Hunter Level 1
*/
BugHunterLevel1 = 1 << 3,
HypeSquadHouseBravery = 1 << 6,
HypeSquadHouseBrilliance = 1 << 7,
HypeSquadHouseBalance = 1 << 8,
EarlySupporter = 1 << 9,
TeamUser = 1 << 10,
/**
* House Bravery Member
*/
HypeSquadOnlineHouse1 = 1 << 6,
/**
* House Brilliance Member
*/
HypeSquadOnlineHouse2 = 1 << 7,
/**
* House Balance Member
*/
HypeSquadOnlineHouse3 = 1 << 8,
/**
* Early Nitro Supporter
*/
PremiumEarlySupporter = 1 << 9,
/**
* User is a [team](https://discord.com/developers/docs/topics/teams)
*/
TeamPseudoUser = 1 << 10,
/**
* Bug Hunter Level 2
*/
BugHunterLevel2 = 1 << 14,
/**
* Verified Bot
*/
VerifiedBot = 1 << 16,
EarlyVerifiedBotDeveloper = 1 << 17,
DiscordCertifiedModerator = 1 << 18,
/**
* Early Verified Bot Developer
*/
VerifiedDeveloper = 1 << 17,
/**
* Discord Certified Moderator
*/
CertifiedModerator = 1 << 18,
/**
* Bot uses only [HTTP interactions](https://discord.com/developers/docs/interactions/receiving-and-responding#receiving-an-interaction) and is shown in the online member list
*/
BotHTTPInteractions = 1 << 19,
}
/**

View File

@@ -77,10 +77,6 @@ export interface APIVoiceRegion {
* 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
*/

View File

@@ -62,12 +62,13 @@ export enum RESTJSONErrorCodes {
NotAuthorizedToPerformThisActionOnThisApplication = 20012,
ActionCannotBePerformedDueToSlowmodeRateLimit = 20016,
OnlyTheOwnerOfThisAccountCanPerformThisAction = 20018,
TheMazeIsntMeantForYou,
OnlyTheOwnerOfThisAccountCanPerformThisAction,
AnnouncementEditLimitExceeded = 20022,
ChannelSendRateLimit = 20028,
ServerSendRateLimit,
StageTopicServerNameServerDescriptionOrChannelNamesContainDisallowedWords = 20031,
@@ -101,6 +102,7 @@ export enum RESTJSONErrorCodes {
MaximumNumberOfNonGuildMemberBansHasBeenExceeded = 30035,
MaximumNumberOfBanFetchesHasBeenReached = 30037,
MaximumNumberOfUncompletedGuildScheduledEventsReached,
MaximumNumberOfStickersReached = 30039,
MaximumNumberOfPruneRequestsHasBeenReached,
@@ -157,6 +159,7 @@ export enum RESTJSONErrorCodes {
InvalidFileUploaded,
CannotSelfRedeemThisGift = 50054,
InvalidGuild,
PaymentSourceRequiredToRedeemGift = 50070,
@@ -172,6 +175,10 @@ export enum RESTJSONErrorCodes {
ServerNeedsMonetizationEnabledToPerformThisAction = 50097,
ServerNeedsMoreBoostsToPerformThisAction = 50101,
RequestBodyContainsInvalidJSON = 50109,
TwoFactorAuthenticationIsRequired = 60003,
NoUsersWithDiscordTagExist = 80004,
@@ -196,4 +203,8 @@ export enum RESTJSONErrorCodes {
LottieAnimationMaximumDimensionsExceeded,
StickerFramerateIsTooSmallOrTooLarge,
StickerAnimationDurationExceedsMaximumOf5Seconds,
CannotUpdateAFinishedEvent = 180000,
FailedToCreateStageNeededForStageEvent = 180002,
}

View File

@@ -17,6 +17,7 @@ import type {
OverwriteType,
VideoQualityMode,
} from '../../payloads/v8/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/channel#get-channel
@@ -26,7 +27,7 @@ export type RESTGetAPIChannelResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/channel#modify-channel
*/
export interface RESTPatchAPIChannelJSONBody {
export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* 1-100 character channel name
*
@@ -103,7 +104,7 @@ export interface RESTPatchAPIChannelJSONBody {
* See https://discord.com/developers/docs/resources/channel#channel-object-video-quality-modes
*/
video_quality_mode?: VideoQualityMode | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#modify-channel
@@ -152,20 +153,21 @@ export type RESTGetAPIChannelMessageResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
*/
export type APIMessageReferenceSend = Partial<APIMessageReference> &
Required<Pick<APIMessageReference, 'message_id'>> & {
export type APIMessageReferenceSend = StrictPartial<APIMessageReference> &
Required<Pick<APIMessageReference, 'message_id'>> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message
*
* @default true
*/
fail_if_not_exists?: boolean;
};
}>;
/**
* https://discord.com/developers/docs/resources/channel#create-message
*/
export interface RESTPostAPIChannelMessageJSONBody {
export type RESTPostAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The message contents (up to 2000 characters)
*/
@@ -188,6 +190,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
* Embedded `rich` content
*
* See https://discord.com/developers/docs/resources/channel#embed-object
* @deprecated Use `embeds` instead
*/
embed?: APIEmbed;
/**
@@ -214,28 +217,23 @@ export interface RESTPostAPIChannelMessageJSONBody {
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
sticker_ids?: [Snowflake] | [Snowflake, Snowflake] | [Snowflake, Snowflake, Snowflake];
}
/**
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[];
}>;
/**
* https://discord.com/developers/docs/resources/channel#create-message
*/
export type RESTPostAPIChannelMessageFormDataBody =
| {
| ({
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPostAPIChannelMessageJSONBody & {
/**
* The file contents
*/
file: unknown;
});
} & Record<`files[${bigint}]`, unknown>)
| (RESTPostAPIChannelMessageJSONBody & Record<`files[${bigint}]`, unknown>);
/**
* https://discord.com/developers/docs/resources/channel#create-message
@@ -296,7 +294,7 @@ export type RESTDeleteAPIChannelMessageReactionResult = never;
/**
* https://discord.com/developers/docs/resources/channel#edit-message
*/
export interface RESTPatchAPIChannelMessageJSONBody {
export type RESTPatchAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The new message contents (up to 2000 characters)
*/
@@ -332,37 +330,31 @@ export interface RESTPatchAPIChannelMessageJSONBody {
/**
* Attached files to keep
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: APIAttachment[] | null;
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[];
/**
* The components to include with the message
*
* See https://discord.com/developers/docs/interactions/message-components#component-object
*/
components?: APIActionRowComponent[] | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#edit-message
*/
export type RESTPatchAPIChannelMessageFormDataBody =
| {
| ({
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPatchAPIChannelMessageJSONBody & {
/**
* The file contents
*/
file: unknown;
});
} & Record<`files[${bigint}]`, unknown>)
| (RESTPatchAPIChannelMessageJSONBody & Record<`files[${bigint}]`, unknown>);
/**
* https://discord.com/developers/docs/resources/channel#edit-message
*/
@@ -423,7 +415,7 @@ export type RESTGetAPIChannelInvitesResult = APIExtendedInvite[];
/**
* https://discord.com/developers/docs/resources/channel#create-channel-invite
*/
export interface RESTPostAPIChannelInviteJSONBody {
export type RESTPostAPIChannelInviteJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Duration of invite in seconds before expiry, or 0 for never
*
@@ -467,7 +459,7 @@ export interface RESTPostAPIChannelInviteJSONBody {
* - The application must have the `EMBEDDED` flag
*/
target_application_id?: Snowflake;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#create-channel-invite
@@ -517,7 +509,7 @@ export type RESTDeleteAPIChannelPinResult = never;
/**
* https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
*/
export interface RESTPutAPIChannelRecipientJSONBody {
export type RESTPutAPIChannelRecipientJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Access token of a user that has granted your app the `gdm.join` scope
*/
@@ -526,7 +518,7 @@ export interface RESTPutAPIChannelRecipientJSONBody {
* Nickname of the user being added
*/
nick?: string;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#group-dm-add-recipient

View File

@@ -1,5 +1,6 @@
import type { Snowflake } from '../../globals.ts';
import type { APIEmoji } from '../../payloads/v8/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/emoji#list-guild-emojis
@@ -14,7 +15,7 @@ export type RESTGetAPIGuildEmojiResult = APIEmoji;
/**
* https://discord.com/developers/docs/resources/emoji#create-guild-emoji-json-params
*/
export interface RESTPostAPIGuildEmojiJSONBody {
export type RESTPostAPIGuildEmojiJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the emoji
*/
@@ -29,7 +30,7 @@ export interface RESTPostAPIGuildEmojiJSONBody {
* Roles for which this emoji will be whitelisted
*/
roles?: Snowflake[];
}
}>;
/**
* https://discord.com/developers/docs/resources/emoji#create-guild-emoji
@@ -39,7 +40,7 @@ export type RESTPostAPIGuildEmojiResult = APIEmoji;
/**
* https://discord.com/developers/docs/resources/emoji#modify-guild-emoji
*/
export interface RESTPatchAPIGuildEmojiJSONBody {
export type RESTPatchAPIGuildEmojiJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the emoji
*/
@@ -48,7 +49,7 @@ export interface RESTPatchAPIGuildEmojiJSONBody {
* Roles for which this emoji will be whitelisted
*/
roles?: Snowflake[] | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/emoji#modify-guild-emoji

View File

@@ -20,21 +20,27 @@ import type {
GuildVerificationLevel,
GuildWidgetStyle,
} from '../../payloads/v8/mod.ts';
import type { Nullable } from '../../utils/internals.ts';
import type {
AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
Nullable,
StrictPartial,
StrictRequired,
} from '../../utils/internals.ts';
import type { RESTPutAPIChannelPermissionJSONBody } from './channel.ts';
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
id: number | string;
}
export type APIGuildCreatePartialChannel = Partial<
export type APIGuildCreatePartialChannel = StrictPartial<
Pick<APIChannel, 'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'>
> & {
name: string;
id?: number | string;
parent_id?: number | string | null;
permission_overwrites?: APIGuildCreateOverwrite[];
};
> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
name: string;
id?: number | string;
parent_id?: number | string | null;
permission_overwrites?: APIGuildCreateOverwrite[];
}>;
export interface APIGuildCreateRole extends RESTPostAPIGuildRoleJSONBody {
id: number | string;
@@ -43,7 +49,7 @@ export interface APIGuildCreateRole extends RESTPostAPIGuildRoleJSONBody {
/**
* https://discord.com/developers/docs/resources/guild#create-guild
*/
export interface RESTPostAPIGuildsJSONBody {
export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the guild (2-100 characters)
*/
@@ -122,7 +128,11 @@ export interface RESTPostAPIGuildsJSONBody {
* See https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
*/
system_channel_flags?: GuildSystemChannelFlags;
}
/**
* Whether the boosts progress bar should be enabled.
*/
premium_progress_bar_enabled?: boolean;
}>;
/**
* https://discord.com/developers/docs/resources/guild#create-guild
@@ -154,7 +164,7 @@ export type RESTGetAPIGuildPreviewResult = APIGuildPreview;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild
*/
export interface RESTPatchAPIGuildJSONBody {
export type RESTPatchAPIGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* New name for the guild (2-100 characters)
*/
@@ -249,7 +259,11 @@ export interface RESTPatchAPIGuildJSONBody {
* The description for the guild, if the guild is discoverable
*/
description?: string | null;
}
/**
* Whether the boosts progress bar should be enabled.
*/
premium_progress_bar_enabled?: boolean;
}>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild
@@ -279,24 +293,26 @@ export type RESTPostAPIGuildChannelResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
*/
export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<{
/**
* Channel id
*/
id: Snowflake;
/**
* Sorting position of the channel
*/
position: number;
/**
* Sync channel overwrites with the new parent, when moving to a new `parent_id`
*/
lock_permissions?: boolean;
/**
* The new parent id of this channel
*/
parent_id?: Snowflake | null;
}>;
export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Channel id
*/
id: Snowflake;
/**
* Sorting position of the channel
*/
position: number;
/**
* Sync channel overwrites with the new parent, when moving to a new `parent_id`
*/
lock_permissions?: boolean;
/**
* The new parent id of this channel
*/
parent_id?: Snowflake | null;
}>
>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
@@ -352,7 +368,7 @@ export type RESTGetAPIGuildMembersSearchResult = APIGuildMember[];
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member
*/
export interface RESTPutAPIGuildMemberJSONBody {
export type RESTPutAPIGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* An oauth2 access token granted with the `guilds.join` to the bot's application for the user you want to add to the guild
*/
@@ -381,14 +397,14 @@ export interface RESTPutAPIGuildMemberJSONBody {
* Requires `DEAFEN_MEMBERS` permission
*/
deaf?: boolean;
}
}>;
export type RESTPutAPIGuildMemberResult = APIGuildMember | undefined;
export type RESTPutAPIGuildMemberResult = APIGuildMember | never;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-member
*/
export interface RESTPatchAPIGuildMemberJSONBody {
export type RESTPatchAPIGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Value to set users nickname to
*
@@ -419,7 +435,7 @@ export interface RESTPatchAPIGuildMemberJSONBody {
* Requires `MOVE_MEMBERS` permission
*/
channel_id?: Snowflake | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member
@@ -429,19 +445,20 @@ export type RESTPatchAPIGuildMemberResult = APIGuildMember;
/**
* https://discord.com/developers/docs/resources/guild#modify-current-user-nick
*/
export interface RESTPatchAPICurrentGuildMemberNicknameJSONBody {
export type RESTPatchAPICurrentGuildMemberNicknameJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Value to set users nickname to
*
* Requires `CHANGE_NICKNAME` permission
*/
nick?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#modify-current-user-nick
*/
export type RESTPatchAPICurrentGuildMemberNicknameResult = Required<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
export type RESTPatchAPICurrentGuildMemberNicknameResult =
StrictRequired<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member-role
@@ -471,7 +488,7 @@ export type RESTGetAPIGuildBanResult = APIBan;
/**
* https://discord.com/developers/docs/resources/guild#create-guild-ban
*/
export interface RESTPutAPIGuildBanJSONBody {
export type RESTPutAPIGuildBanJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Number of days to delete messages for (0-7)
*/
@@ -480,7 +497,7 @@ export interface RESTPutAPIGuildBanJSONBody {
* Reason for the ban
*/
reason?: string;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#create-guild-ban
@@ -500,7 +517,7 @@ export type RESTGetAPIGuildRolesResult = APIRole[];
/**
* https://discord.com/developers/docs/resources/guild#create-guild-role
*/
export interface RESTPostAPIGuildRoleJSONBody {
export type RESTPostAPIGuildRoleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the role
*
@@ -510,7 +527,7 @@ export interface RESTPostAPIGuildRoleJSONBody {
/**
* Bitwise value of the enabled/disabled permissions
*
* @default "default role permissions in guild"
* @default "default role permissions in guild"
*/
permissions?: Permissions | null;
/**
@@ -525,13 +542,21 @@ export interface RESTPostAPIGuildRoleJSONBody {
* @default false
*/
hoist?: boolean | null;
/**
* The role's icon image (if the guild has the `ROLE_ICONS` feature)
*/
icon?: string | null;
/**
* The role's unicode emoji as a standard emoji (if the guild has the `ROLE_ICONS` feature)
*/
unicode_emoji?: string | null;
/**
* Whether the role should be mentionable
*
* @default false
*/
mentionable?: boolean | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#create-guild-role
@@ -541,16 +566,18 @@ export type RESTPostAPIGuildRoleResult = APIRole;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
*/
export type RESTPatchAPIGuildRolePositionsJSONBody = Array<{
/**
* Role id
*/
id: Snowflake;
/**
* Sorting position of the role
*/
position?: number;
}>;
export type RESTPatchAPIGuildRolePositionsJSONBody = Array<
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Role id
*/
id: Snowflake;
/**
* Sorting position of the role
*/
position?: number;
}>
>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
@@ -560,7 +587,7 @@ export type RESTPatchAPIGuildRolePositionsResult = APIRole[];
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role
*/
export interface RESTPatchAPIGuildRoleJSONBody {
export type RESTPatchAPIGuildRoleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the role
*/
@@ -577,11 +604,19 @@ export interface RESTPatchAPIGuildRoleJSONBody {
* Whether the role should be displayed separately in the sidebar
*/
hoist?: boolean | null;
/**
* The role's icon image (if the guild has the `ROLE_ICONS` feature)
*/
icon?: string | null;
/**
* The role's unicode emoji as a standard emoji (if the guild has the `ROLE_ICONS` feature)
*/
unicode_emoji?: string | null;
/**
* Whether the role should be mentionable
*/
mentionable?: boolean | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role
@@ -624,7 +659,7 @@ export interface RESTGetAPIGuildPruneCountResult {
/**
* https://discord.com/developers/docs/resources/guild#begin-guild-prune
*/
export interface RESTPostAPIGuildPruneJSONBody {
export type RESTPostAPIGuildPruneJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Number of days to count prune for (1 or more)
*
@@ -641,7 +676,7 @@ export interface RESTPostAPIGuildPruneJSONBody {
* Role(s) to include
*/
include_roles?: Snowflake[];
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#begin-guild-prune
@@ -678,7 +713,7 @@ export type RESTGetAPIGuildWidgetSettingsResult = APIGuildWidgetSettings;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-widget
*/
export type RESTPatchAPIGuildWidgetSettingsJSONBody = Partial<APIGuildWidgetSettings>;
export type RESTPatchAPIGuildWidgetSettingsJSONBody = StrictPartial<APIGuildWidgetSettings>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-widget
@@ -718,7 +753,7 @@ export type RESTGetAPIGuildWidgetImageResult = ArrayBuffer;
export type RESTGetAPIGuildMemberVerificationResult = APIGuildMembershipScreening;
export interface RESTPatchAPIGuildMemberVerificationJSONBody {
export type RESTPatchAPIGuildMemberVerificationJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Whether Membership Screening is enabled
*/
@@ -731,11 +766,11 @@ export interface RESTPatchAPIGuildMemberVerificationJSONBody {
* The server description to show in the screening form
*/
description?: string | null;
}
}>;
export type RESTPatchAPIGuildMemberVerificationResult = APIGuildMembershipScreening;
export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
export type RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The id of the channel the user is currently in
*/
@@ -748,9 +783,9 @@ export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
* Sets the user's request to speak
*/
request_to_speak_timestamp?: string | null;
}
}>;
export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
export type RESTPatchAPIGuildVoiceStateUserJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The id of the channel the user is currently in
*/
@@ -759,7 +794,7 @@ export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
* Toggles the user's suppress state
*/
suppress?: boolean;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen
@@ -769,9 +804,10 @@ export type RESTGetAPIGuildWelcomeScreenResult = APIGuildWelcomeScreen;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen
*/
export interface RESTPatchAPIGuildWelcomeScreenJSONBody extends Nullable<Partial<APIGuildWelcomeScreen>> {
/**
* Whether the welcome screen is enabled
*/
enabled?: boolean | null;
}
export type RESTPatchAPIGuildWelcomeScreenJSONBody = Nullable<StrictPartial<APIGuildWelcomeScreen>> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Whether the welcome screen is enabled
*/
enabled?: boolean | null;
}>;

View File

@@ -0,0 +1,133 @@
import type { Snowflake } from '../../globals.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
import type {
APIGuildScheduledEvent,
GuildScheduledEventEntityType,
GuildScheduledEventPrivacyLevel,
APIGuildScheduledEventEntityMetadata,
GuildScheduledEventStatus,
APIGuildScheduledEventUser,
} from '../../v8.ts';
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild
*/
export interface RESTGetAPIGuildScheduledEventsQuery {
/**
* Whether to include number of users subscribed to each event
*/
with_user_count?: boolean;
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild
*/
export type RESTGetAPIGuildScheduledEventsResult = APIGuildScheduledEvent[];
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
*/
export type RESTPostAPIGuildScheduledEventJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The stage channel id of the guild event
*/
channel_id?: Snowflake;
/**
* The name of the guild event
*/
name: string;
/**
* The privacy level of the guild event
*/
privacy_level: GuildScheduledEventPrivacyLevel;
/**
* The time to schedule the guild event at
*/
scheduled_start_time: string;
/**
* The time when the scheduled event is scheduled to end
*/
scheduled_end_time?: string;
/**
* The description of the guild event
*/
description?: string;
/**
* The scheduled entity type of the guild event
*/
entity_type?: GuildScheduledEventEntityType;
/**
* The entity metadata of the scheduled event
*/
entity_metadata?: APIGuildScheduledEventEntityMetadata;
}>;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
*/
export type RESTPostAPIGuildScheduledEventResult = APIGuildScheduledEvent;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event
*/
export interface RESTGetAPIGuildScheduledEventQuery {
/**
* Whether to include number of users subscribed to this event
*/
with_user_count?: boolean;
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event
*/
export type RESTGetAPIGuildScheduledEventResult = APIGuildScheduledEvent;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event
*/
export type RESTPatchAPIGuildScheduledEventJSONBody = StrictPartial<RESTPostAPIGuildScheduledEventJSONBody> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The status of the scheduled event
*/
status?: GuildScheduledEventStatus;
}>;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event
*/
export type RESTPatchAPIGuildScheduledEventResult = APIGuildScheduledEvent;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event
*/
export type RESTDeleteAPIGuildScheduledEventResult = never;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users
*/
export interface RESTGetAPIGuildScheduledEventUsersQuery {
/**
* Number of users to receive from the event
*
* @default 100
*/
limit?: number;
/**
* Whether to include guild member data if it exists
*/
with_member?: boolean;
/**
* Consider only users before given user id
*/
before?: Snowflake;
/**
* Consider only users after given user id
*/
after?: Snowflake;
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users
*/
export type RESTGetAPIGuildScheduledEventUsersResult = APIGuildScheduledEventUser[];

View File

@@ -6,6 +6,7 @@ import type {
APIInteractionResponseCallbackData,
ApplicationCommandType,
} from '../../payloads/v8/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
import type {
RESTDeleteAPIWebhookWithTokenMessageResult,
RESTGetAPIWebhookWithTokenMessageResult,
@@ -25,18 +26,18 @@ export type RESTGetAPIApplicationCommandsResult = APIApplicationCommand[];
*/
export type RESTGetAPIApplicationCommandResult = APIApplicationCommand;
type RESTPostAPIBaseApplicationCommandsJSONBody = Omit<
APIApplicationCommand,
'id' | 'application_id' | 'description' | 'type' | 'version'
type RESTPostAPIBaseApplicationCommandsJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<
Omit<APIApplicationCommand, 'id' | 'application_id' | 'description' | 'type' | 'version' | 'guild_id'>
>;
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type?: ApplicationCommandType.ChatInput;
description: string;
}
export type RESTPostAPIChatInputApplicationCommandsJSONBody = RESTPostAPIBaseApplicationCommandsJSONBody &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
type?: ApplicationCommandType.ChatInput;
description: string;
}>;
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
@@ -60,7 +61,7 @@ export type RESTPostAPIApplicationCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
export type RESTPatchAPIApplicationCommandJSONBody = StrictPartial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
@@ -100,7 +101,7 @@ export type RESTPostAPIApplicationGuildCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
export type RESTPatchAPIApplicationGuildCommandJSONBody = StrictPartial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
@@ -126,22 +127,13 @@ export type RESTPostAPIInteractionCallbackJSONBody = APIInteractionResponse;
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackFormDataBody =
| {
| ({
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPostAPIInteractionCallbackJSONBody & {
/**
* The file contents
*/
file: unknown;
});
} & Record<`files[${bigint}]`, unknown>)
| (RESTPostAPIInteractionCallbackJSONBody & Record<`files[${bigint}]`, unknown>);
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
@@ -177,22 +169,13 @@ export type RESTPostAPIInteractionFollowupJSONBody = APIInteractionResponseCallb
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupFormDataBody =
| {
| ({
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPostAPIInteractionFollowupJSONBody & {
/**
* The file contents
*/
file: unknown;
});
} & Record<`files[${bigint}]`, unknown>)
| (RESTPostAPIInteractionFollowupJSONBody & Record<`files[${bigint}]`, unknown>);
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message

View File

@@ -1,3 +1,4 @@
import type { Snowflake } from '../../globals.ts';
import type { APIInvite } from '../../payloads/v8/mod.ts';
/**
@@ -12,6 +13,10 @@ export interface RESTGetAPIInviteQuery {
* Whether the invite should contain the expiration date
*/
with_expiration?: boolean;
/**
* The guild scheduled event to include with the invite
*/
guild_scheduled_event_id?: Snowflake;
}
export type RESTGetAPIInviteResult = APIInvite;

View File

@@ -7,6 +7,7 @@ export * from './channel.ts';
export * from './emoji.ts';
export * from './gateway.ts';
export * from './guild.ts';
export * from './guildScheduledEvent.ts';
export * from './interactions.ts';
export * from './invite.ts';
export * from './oauth2.ts';
@@ -440,6 +441,14 @@ export const Routes = {
return `/users/@me/guilds` as const;
},
/**
* Route for:
* - GET `/users/@me/guilds/{guild.id}/member`
*/
userGuildMember(guildId: Snowflake) {
return `/users/@me/guilds/${guildId}/member` as const;
},
/**
* Route for:
* - DELETE `/users/@me/guilds/{guild.id}`
@@ -569,6 +578,30 @@ export const Routes = {
return `/oauth2/@me` as const;
},
/**
* Route for:
* - GET `/oauth2/authorize`
*/
oauth2Authorization() {
return `/oauth2/authorize` as const;
},
/**
* Route for:
* - POST `/oauth2/token`
*/
oauth2TokenExchange() {
return `/oauth2/token` as const;
},
/**
* Route for:
* - POST `/oauth2/token/revoke`
*/
oauth2TokenRevocation() {
return `/oauth2/token/revoke` as const;
},
/**
* Route for:
* - GET `/applications/{application.id}/commands`
@@ -714,6 +747,33 @@ export const Routes = {
guildSticker(guildId: Snowflake, stickerId: Snowflake) {
return `/guilds/${guildId}/stickers/${stickerId}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/scheduled-events`
* - POST `/guilds/{guild.id}/scheduled-events`
*/
guildScheduledEvents(guildId: Snowflake) {
return `/guilds/${guildId}/scheduled-events`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/scheduled-events/{guildScheduledEvent.id}`
* - PATCH `/guilds/{guild.id}/scheduled-events/{guildScheduledEvent.id}`
* - DELETE `/guilds/{guild.id}/scheduled-events/{guildScheduledEvent.id}`
*/
guildScheduledEvent(guildId: Snowflake, guildScheduledEventId: Snowflake) {
return `/guilds/${guildId}/scheduled-events/${guildScheduledEventId}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/scheduled-events/{guildScheduledEvent.id}/users`
*/
guildScheduledEventUsers(guildId: Snowflake, guildScheduledEventId: Snowflake) {
return `/guilds/${guildId}/scheduled-events/${guildScheduledEventId}/users`;
},
};
export const RouteBases = {
@@ -728,37 +788,13 @@ export const RouteBases = {
Object.freeze(RouteBases);
export const OAuth2Routes = {
authorizationURL: `https://discord.com/api/v${APIVersion}/oauth2/authorize`,
tokenURL: `https://discord.com/api/v${APIVersion}/oauth2/token`,
authorizationURL: `${RouteBases.api}${Routes.oauth2Authorization()}`,
tokenURL: `${RouteBases.api}${Routes.oauth2TokenExchange()}`,
/**
* See https://tools.ietf.org/html/rfc7009
*/
tokenRevocationURL: `https://discord.com/api/v${APIVersion}/oauth2/token/revoke`,
tokenRevocationURL: `${RouteBases.api}${Routes.oauth2TokenRevocation()}`,
} as const;
// Freeze OAuth2 route object
Object.freeze(OAuth2Routes);
export interface DiscordErrorFieldInformation {
code: string;
message: string;
}
export interface DiscordErrorGroupWrapper {
_errors: DiscordError[];
}
export type DiscordErrorData =
| DiscordErrorGroupWrapper
| DiscordErrorFieldInformation
| { [k: string]: DiscordErrorData }
| string;
/**
* https://discord.com/developers/docs/reference#error-messages
*/
export interface DiscordError {
code: number;
message: string;
errors?: DiscordErrorData;
}

View File

@@ -1,5 +1,6 @@
import type { Snowflake } from '../../globals.ts';
import type { APIStageInstance, StageInstancePrivacyLevel } from '../../payloads/v8/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/stage-instance#create-stage-instance
@@ -34,7 +35,7 @@ export type RESTGetAPIStageInstanceResult = APIStageInstance;
/**
* https://discord.com/developers/docs/resources/stage-instance#update-stage-instance
*/
export interface RESTPatchAPIStageInstanceJSONBody {
export type RESTPatchAPIStageInstanceJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The topic of the stage instance (1-120 characters)
*/
@@ -43,7 +44,7 @@ export interface RESTPatchAPIStageInstanceJSONBody {
* The privacy level of the stage instance
*/
privacy_level?: StageInstancePrivacyLevel;
}
}>;
/**
* https://discord.com/developers/docs/resources/stage-instance#update-stage-instance

View File

@@ -1,4 +1,5 @@
import type { APISticker, APIStickerPack } from '../../payloads/v8/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
export type RESTGetAPIStickerResult = APISticker;
@@ -31,7 +32,7 @@ export interface RESTPostAPIGuildStickerFormDataBody {
export type RESTPostAPIGuildStickerResult = APISticker;
export interface RESTPatchAPIGuildStickerJSONBody {
export type RESTPatchAPIGuildStickerJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the sticker (2-30 characters)
*/
@@ -44,7 +45,7 @@ export interface RESTPatchAPIGuildStickerJSONBody {
* The Discord name of a unicode emoji representing the sticker's expression (2-200 characters)
*/
tags?: string;
}
}>;
export type RESTPatchAPIGuildStickerResult = APISticker;

View File

@@ -1,4 +1,5 @@
import type { APIGuild, APITemplate } from '../../payloads/v8/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/template#get-template
@@ -8,7 +9,7 @@ export type RESTGetAPITemplateResult = APITemplate;
/**
* https://discord.com/developers/docs/resources/template#create-guild-from-template
*/
export interface RESTPostAPITemplateCreateGuildJSONBody {
export type RESTPostAPITemplateCreateGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the guild (2-100 characters)
*/
@@ -19,7 +20,8 @@ export interface RESTPostAPITemplateCreateGuildJSONBody {
* See https://discord.com/developers/docs/reference#image-data
*/
icon?: string;
}
}>;
/**
* https://discord.com/developers/docs/resources/template#create-guild-from-template
*/
@@ -33,7 +35,7 @@ export type RESTGetAPIGuildTemplatesResult = APITemplate[];
/**
* https://discord.com/developers/docs/resources/template#create-guild-template
*/
export interface RESTPostAPIGuildTemplatesJSONBody {
export type RESTPostAPIGuildTemplatesJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the template (1-100 characters)
*/
@@ -42,7 +44,7 @@ export interface RESTPostAPIGuildTemplatesJSONBody {
* Description for the template (0-120 characters)
*/
description?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/template#create-guild-template
@@ -57,7 +59,7 @@ export type RESTPutAPIGuildTemplateSyncResult = APITemplate;
/**
* https://discord.com/developers/docs/resources/template#modify-guild-template
*/
export type RESTPatchAPIGuildTemplateJSONBody = Partial<RESTPostAPIGuildTemplatesJSONBody>;
export type RESTPatchAPIGuildTemplateJSONBody = StrictPartial<RESTPostAPIGuildTemplatesJSONBody>;
/**
* https://discord.com/developers/docs/resources/template#modify-guild-template

View File

@@ -1,5 +1,6 @@
import type { Permissions, Snowflake } from '../../globals.ts';
import type { APIChannel, APIConnection, APIUser, GuildFeature } from '../../payloads/v8/mod.ts';
import type { APIChannel, APIConnection, APIGuildMember, APIUser, GuildFeature } from '../../payloads/v8/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/user#get-current-user
@@ -11,10 +12,15 @@ export type RESTGetAPICurrentUserResult = APIUser;
*/
export type RESTGetAPIUserResult = APIUser;
/**
* https://discord.com/developers/docs/resources/guild#get-current-user-guild-member
*/
export type RESTGetCurrentUserGuildMemberResult = APIGuildMember;
/**
* https://discord.com/developers/docs/resources/user#modify-current-user
*/
export interface RESTPatchAPICurrentUserJSONBody {
export type RESTPatchAPICurrentUserJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* User's username, if changed may cause the user's discriminator to be randomized
*/
@@ -23,7 +29,7 @@ export interface RESTPatchAPICurrentUserJSONBody {
* If passed, modifies the user's avatar
*/
avatar?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/user#modify-current-user

View File

@@ -7,12 +7,12 @@ import type {
APIWebhook,
APIAttachment,
} from '../../payloads/v8/mod.ts';
import type { Nullable } from '../../utils/internals.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, Nullable } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/webhook#create-webhook
*/
export interface RESTPostAPIChannelWebhookJSONBody {
export type RESTPostAPIChannelWebhookJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the webhook (1-80 characters)
*/
@@ -23,7 +23,7 @@ export interface RESTPostAPIChannelWebhookJSONBody {
* See https://discord.com/developers/docs/reference#image-data
*/
avatar?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/webhook#create-webhook
@@ -53,7 +53,7 @@ export type RESTGetAPIWebhookWithTokenResult = Omit<APIWebhook, 'user'>;
/**
* https://discord.com/developers/docs/resources/webhook#modify-webhook
*/
export interface RESTPatchAPIWebhookJSONBody {
export type RESTPatchAPIWebhookJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The default name of the webhook
*/
@@ -68,7 +68,7 @@ export interface RESTPatchAPIWebhookJSONBody {
* The new channel id this webhook should be moved to
*/
channel_id?: Snowflake;
}
}>;
/**
* https://discord.com/developers/docs/resources/webhook#modify-webhook
@@ -98,7 +98,7 @@ export type RESTDeleteAPIWebhookWithTokenResult = never;
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook
*/
export interface RESTPostAPIWebhookWithTokenJSONBody {
export type RESTPostAPIWebhookWithTokenJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The message contents (up to 2000 characters)
*/
@@ -135,28 +135,23 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
* See https://discord.com/developers/docs/interactions/message-components#component-object
*/
components?: APIActionRowComponent[];
}
/**
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[];
}>;
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook
*/
export type RESTPostAPIWebhookWithTokenFormDataBody =
| {
| ({
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPostAPIWebhookWithTokenJSONBody & {
/**
* The file contents
*/
file: unknown;
});
} & Record<`files[${bigint}]`, unknown>)
| (RESTPostAPIWebhookWithTokenJSONBody & Record<`files[${bigint}]`, unknown>);
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook-querystring-params
@@ -169,6 +164,10 @@ export interface RESTPostAPIWebhookWithTokenQuery {
* @default false
*/
wait?: boolean;
/**
* Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived.
*/
thread_id?: Snowflake;
}
/**
@@ -228,38 +227,30 @@ export type RESTGetAPIWebhookWithTokenMessageResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
*/
export interface RESTPatchAPIWebhookWithTokenMessageJSONBody
extends Nullable<
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>
> {
/**
* Attached files to keep
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: APIAttachment[] | null;
}
export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<
Nullable<Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>> & {
/**
* Attached files to keep
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[];
}
>;
/**
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
*/
export type RESTPatchAPIWebhookWithTokenMessageFormDataBody =
| {
| ({
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPatchAPIWebhookWithTokenMessageJSONBody & {
/**
* The file contents
*/
file: unknown;
});
} & Record<`files[${bigint}]`, unknown>)
| (RESTPatchAPIWebhookWithTokenMessageJSONBody & Record<`files[${bigint}]`, unknown>);
/**
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message

View File

@@ -20,6 +20,7 @@ import type {
ThreadAutoArchiveDuration,
VideoQualityMode,
} from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/channel#get-channel
@@ -29,7 +30,7 @@ export type RESTGetAPIChannelResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/channel#modify-channel
*/
export interface RESTPatchAPIChannelJSONBody {
export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* 1-100 character channel name
*
@@ -136,7 +137,7 @@ export interface RESTPatchAPIChannelJSONBody {
* Channel types: privateThread
*/
invitable?: boolean;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#modify-channel
@@ -185,20 +186,21 @@ export type RESTGetAPIChannelMessageResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
*/
export type APIMessageReferenceSend = Partial<APIMessageReference> &
Required<Pick<APIMessageReference, 'message_id'>> & {
export type APIMessageReferenceSend = StrictPartial<APIMessageReference> &
Required<Pick<APIMessageReference, 'message_id'>> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message
*
* @default true
*/
fail_if_not_exists?: boolean;
};
}>;
/**
* https://discord.com/developers/docs/resources/channel#create-message
*/
export interface RESTPostAPIChannelMessageJSONBody {
export type RESTPostAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The message contents (up to 2000 characters)
*/
@@ -248,28 +250,23 @@ export interface RESTPostAPIChannelMessageJSONBody {
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
sticker_ids?: [Snowflake] | [Snowflake, Snowflake] | [Snowflake, Snowflake, Snowflake];
}
/**
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[];
}>;
/**
* https://discord.com/developers/docs/resources/channel#create-message
*/
export type RESTPostAPIChannelMessageFormDataBody =
| {
| ({
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPostAPIChannelMessageJSONBody & {
/**
* The file contents
*/
file: unknown;
});
} & Record<`files[${bigint}]`, unknown>)
| (RESTPostAPIChannelMessageJSONBody & Record<`files[${bigint}]`, unknown>);
/**
* https://discord.com/developers/docs/resources/channel#create-message
@@ -330,7 +327,7 @@ export type RESTDeleteAPIChannelMessageReactionResult = never;
/**
* https://discord.com/developers/docs/resources/channel#edit-message
*/
export interface RESTPatchAPIChannelMessageJSONBody {
export type RESTPatchAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The new message contents (up to 2000 characters)
*/
@@ -366,37 +363,30 @@ export interface RESTPatchAPIChannelMessageJSONBody {
/**
* Attached files to keep
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: APIAttachment[] | null;
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[];
/**
* The components to include with the message
*
* See https://discord.com/developers/docs/interactions/message-components#component-object
*/
components?: APIActionRowComponent[] | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#edit-message
*/
export type RESTPatchAPIChannelMessageFormDataBody =
| {
| ({
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPatchAPIChannelMessageJSONBody & {
/**
* The file contents
*/
file: unknown;
});
} & Record<`files[${bigint}]`, unknown>)
| (RESTPatchAPIChannelMessageJSONBody & Record<`files[${bigint}]`, unknown>);
/**
* https://discord.com/developers/docs/resources/channel#edit-message
@@ -458,7 +448,7 @@ export type RESTGetAPIChannelInvitesResult = APIExtendedInvite[];
/**
* https://discord.com/developers/docs/resources/channel#create-channel-invite
*/
export interface RESTPostAPIChannelInviteJSONBody {
export type RESTPostAPIChannelInviteJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Duration of invite in seconds before expiry, or 0 for never
*
@@ -502,7 +492,7 @@ export interface RESTPostAPIChannelInviteJSONBody {
* - The application must have the `EMBEDDED` flag
*/
target_application_id?: Snowflake;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#create-channel-invite
@@ -552,7 +542,7 @@ export type RESTDeleteAPIChannelPinResult = never;
/**
* https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
*/
export interface RESTPutAPIChannelRecipientJSONBody {
export type RESTPutAPIChannelRecipientJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Access token of a user that has granted your app the `gdm.join` scope
*/
@@ -561,7 +551,7 @@ export interface RESTPutAPIChannelRecipientJSONBody {
* Nickname of the user being added
*/
nick?: string;
}
}>;
/**
* https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
@@ -576,7 +566,7 @@ export type RESTDeleteAPIChannelRecipientResult = unknown;
/**
* https://discord.com/developers/docs/resources/channel#start-thread-with-message
*/
export interface RESTPostAPIChannelMessagesThreadsJSONBody {
export type RESTPostAPIChannelMessagesThreadsJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* 1-100 character thread name
*/
@@ -587,7 +577,11 @@ export interface RESTPostAPIChannelMessagesThreadsJSONBody {
* The 3 day and 7 day archive durations require the server to be boosted. The [guild features](https://discord.com/developers/docs/resources/guild#guild-object-guild-features) will indicate if a server is able to use those settings.
*/
auto_archive_duration: ThreadAutoArchiveDuration;
}
/**
* Amount of seconds a user has to wait before sending another message (0-21600)
*/
rate_limit_per_user?: number;
}>;
/**
* https://discord.com/developers/docs/resources/channel#start-thread-with-message
@@ -597,23 +591,24 @@ export type RESTPostAPIChannelMessagesThreadsResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/channel#start-thread-without-message
*/
export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMessagesThreadsJSONBody {
/**
* The type of thread to create
*
* In API v9, `type` defaults to `PRIVATE_THREAD`.
* In API v10 this will be changed to be a required field, with no default.
*
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
*
* @default 12
*/
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
/**
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
*/
invitable?: boolean;
}
export type RESTPostAPIChannelThreadsJSONBody = RESTPostAPIChannelMessagesThreadsJSONBody &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The type of thread to create
*
* In API v9, `type` defaults to `PRIVATE_THREAD`.
* In API v10 this will be changed to be a required field, with no default.
*
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
*
* @default 12
*/
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
/**
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
*/
invitable?: boolean;
}>;
/**
* https://discord.com/developers/docs/resources/channel#start-thread-without-message

View File

@@ -1,5 +1,6 @@
import type { Snowflake } from '../../globals.ts';
import type { APIEmoji } from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/emoji#list-guild-emojis
@@ -14,7 +15,7 @@ export type RESTGetAPIGuildEmojiResult = APIEmoji;
/**
* https://discord.com/developers/docs/resources/emoji#create-guild-emoji-json-params
*/
export interface RESTPostAPIGuildEmojiJSONBody {
export type RESTPostAPIGuildEmojiJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the emoji
*/
@@ -29,7 +30,7 @@ export interface RESTPostAPIGuildEmojiJSONBody {
* Roles for which this emoji will be whitelisted
*/
roles?: Snowflake[];
}
}>;
/**
* https://discord.com/developers/docs/resources/emoji#create-guild-emoji
@@ -39,7 +40,7 @@ export type RESTPostAPIGuildEmojiResult = APIEmoji;
/**
* https://discord.com/developers/docs/resources/emoji#modify-guild-emoji
*/
export interface RESTPatchAPIGuildEmojiJSONBody {
export type RESTPatchAPIGuildEmojiJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the emoji
*/
@@ -48,7 +49,7 @@ export interface RESTPatchAPIGuildEmojiJSONBody {
* Roles for which this emoji will be whitelisted
*/
roles?: Snowflake[] | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/emoji#modify-guild-emoji

View File

@@ -21,21 +21,27 @@ import type {
GuildVerificationLevel,
GuildWidgetStyle,
} from '../../payloads/v9/mod.ts';
import type { Nullable } from '../../utils/internals.ts';
import type {
AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
Nullable,
StrictPartial,
StrictRequired,
} from '../../utils/internals.ts';
import type { RESTPutAPIChannelPermissionJSONBody } from './channel.ts';
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
id: number | string;
}
export type APIGuildCreatePartialChannel = Partial<
export type APIGuildCreatePartialChannel = StrictPartial<
Pick<APIChannel, 'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'>
> & {
name: string;
id?: number | string;
parent_id?: number | string | null;
permission_overwrites?: APIGuildCreateOverwrite[];
};
> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
name: string;
id?: number | string;
parent_id?: number | string | null;
permission_overwrites?: APIGuildCreateOverwrite[];
}>;
export interface APIGuildCreateRole extends RESTPostAPIGuildRoleJSONBody {
id: number | string;
@@ -44,7 +50,7 @@ export interface APIGuildCreateRole extends RESTPostAPIGuildRoleJSONBody {
/**
* https://discord.com/developers/docs/resources/guild#create-guild
*/
export interface RESTPostAPIGuildsJSONBody {
export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the guild (2-100 characters)
*/
@@ -123,7 +129,11 @@ export interface RESTPostAPIGuildsJSONBody {
* See https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
*/
system_channel_flags?: GuildSystemChannelFlags;
}
/**
* Whether the boosts progress bar should be enabled.
*/
premium_progress_bar_enabled?: boolean;
}>;
/**
* https://discord.com/developers/docs/resources/guild#create-guild
@@ -155,7 +165,7 @@ export type RESTGetAPIGuildPreviewResult = APIGuildPreview;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild
*/
export interface RESTPatchAPIGuildJSONBody {
export type RESTPatchAPIGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* New name for the guild (2-100 characters)
*/
@@ -250,7 +260,11 @@ export interface RESTPatchAPIGuildJSONBody {
* The description for the guild, if the guild is discoverable
*/
description?: string | null;
}
/**
* Whether the boosts progress bar should be enabled.
*/
premium_progress_bar_enabled?: boolean;
}>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild
@@ -280,24 +294,26 @@ export type RESTPostAPIGuildChannelResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
*/
export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<{
/**
* Channel id
*/
id: Snowflake;
/**
* Sorting position of the channel
*/
position: number;
/**
* Sync channel overwrites with the new parent, when moving to a new `parent_id`
*/
lock_permissions?: boolean;
/**
* The new parent id of this channel
*/
parent_id?: Snowflake | null;
}>;
export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Channel id
*/
id: Snowflake;
/**
* Sorting position of the channel
*/
position: number;
/**
* Sync channel overwrites with the new parent, when moving to a new `parent_id`
*/
lock_permissions?: boolean;
/**
* The new parent id of this channel
*/
parent_id?: Snowflake | null;
}>
>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
@@ -358,7 +374,7 @@ export type RESTGetAPIGuildMembersSearchResult = APIGuildMember[];
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member
*/
export interface RESTPutAPIGuildMemberJSONBody {
export type RESTPutAPIGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* An oauth2 access token granted with the `guilds.join` to the bot's application for the user you want to add to the guild
*/
@@ -387,14 +403,14 @@ export interface RESTPutAPIGuildMemberJSONBody {
* Requires `DEAFEN_MEMBERS` permission
*/
deaf?: boolean;
}
}>;
export type RESTPutAPIGuildMemberResult = APIGuildMember | undefined;
export type RESTPutAPIGuildMemberResult = APIGuildMember | never;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-member
*/
export interface RESTPatchAPIGuildMemberJSONBody {
export type RESTPatchAPIGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Value to set users nickname to
*
@@ -425,7 +441,7 @@ export interface RESTPatchAPIGuildMemberJSONBody {
* Requires `MOVE_MEMBERS` permission
*/
channel_id?: Snowflake | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member
@@ -435,19 +451,20 @@ export type RESTPatchAPIGuildMemberResult = APIGuildMember;
/**
* https://discord.com/developers/docs/resources/guild#modify-current-user-nick
*/
export interface RESTPatchAPICurrentGuildMemberNicknameJSONBody {
export type RESTPatchAPICurrentGuildMemberNicknameJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Value to set users nickname to
*
* Requires `CHANGE_NICKNAME` permission
*/
nick?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#modify-current-user-nick
*/
export type RESTPatchAPICurrentGuildMemberNicknameResult = Required<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
export type RESTPatchAPICurrentGuildMemberNicknameResult =
StrictRequired<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
/**
* https://discord.com/developers/docs/resources/guild#add-guild-member-role
@@ -477,7 +494,7 @@ export type RESTGetAPIGuildBanResult = APIBan;
/**
* https://discord.com/developers/docs/resources/guild#create-guild-ban
*/
export interface RESTPutAPIGuildBanJSONBody {
export type RESTPutAPIGuildBanJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Number of days to delete messages for (0-7)
*/
@@ -486,7 +503,7 @@ export interface RESTPutAPIGuildBanJSONBody {
* Reason for the ban
*/
reason?: string;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#create-guild-ban
@@ -506,7 +523,7 @@ export type RESTGetAPIGuildRolesResult = APIRole[];
/**
* https://discord.com/developers/docs/resources/guild#create-guild-role
*/
export interface RESTPostAPIGuildRoleJSONBody {
export type RESTPostAPIGuildRoleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the role
*
@@ -516,7 +533,7 @@ export interface RESTPostAPIGuildRoleJSONBody {
/**
* Bitwise value of the enabled/disabled permissions
*
* @default "default role permissions in guild"
* @default "default role permissions in guild"
*/
permissions?: Permissions | null;
/**
@@ -531,13 +548,21 @@ export interface RESTPostAPIGuildRoleJSONBody {
* @default false
*/
hoist?: boolean | null;
/**
* The role's icon image (if the guild has the `ROLE_ICONS` feature)
*/
icon?: string | null;
/**
* The role's unicode emoji as a standard emoji (if the guild has the `ROLE_ICONS` feature)
*/
unicode_emoji?: string | null;
/**
* Whether the role should be mentionable
*
* @default false
*/
mentionable?: boolean | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#create-guild-role
@@ -547,16 +572,18 @@ export type RESTPostAPIGuildRoleResult = APIRole;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
*/
export type RESTPatchAPIGuildRolePositionsJSONBody = Array<{
/**
* Role id
*/
id: Snowflake;
/**
* Sorting position of the role
*/
position?: number;
}>;
export type RESTPatchAPIGuildRolePositionsJSONBody = Array<
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Role id
*/
id: Snowflake;
/**
* Sorting position of the role
*/
position?: number;
}>
>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
@@ -566,7 +593,7 @@ export type RESTPatchAPIGuildRolePositionsResult = APIRole[];
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role
*/
export interface RESTPatchAPIGuildRoleJSONBody {
export type RESTPatchAPIGuildRoleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the role
*/
@@ -583,11 +610,19 @@ export interface RESTPatchAPIGuildRoleJSONBody {
* Whether the role should be displayed separately in the sidebar
*/
hoist?: boolean | null;
/**
* The role's icon image (if the guild has the `ROLE_ICONS` feature)
*/
icon?: string | null;
/**
* The role's unicode emoji as a standard emoji (if the guild has the `ROLE_ICONS` feature)
*/
unicode_emoji?: string | null;
/**
* Whether the role should be mentionable
*/
mentionable?: boolean | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-role
@@ -630,7 +665,7 @@ export interface RESTGetAPIGuildPruneCountResult {
/**
* https://discord.com/developers/docs/resources/guild#begin-guild-prune
*/
export interface RESTPostAPIGuildPruneJSONBody {
export type RESTPostAPIGuildPruneJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Number of days to count prune for (1 or more)
*
@@ -647,7 +682,7 @@ export interface RESTPostAPIGuildPruneJSONBody {
* Role(s) to include
*/
include_roles?: Snowflake[];
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#begin-guild-prune
@@ -684,7 +719,7 @@ export type RESTGetAPIGuildWidgetSettingsResult = APIGuildWidgetSettings;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-widget
*/
export type RESTPatchAPIGuildWidgetSettingsJSONBody = Partial<APIGuildWidgetSettings>;
export type RESTPatchAPIGuildWidgetSettingsJSONBody = StrictPartial<APIGuildWidgetSettings>;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-widget
@@ -724,7 +759,7 @@ export type RESTGetAPIGuildWidgetImageResult = ArrayBuffer;
export type RESTGetAPIGuildMemberVerificationResult = APIGuildMembershipScreening;
export interface RESTPatchAPIGuildMemberVerificationJSONBody {
export type RESTPatchAPIGuildMemberVerificationJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Whether Membership Screening is enabled
*/
@@ -737,11 +772,11 @@ export interface RESTPatchAPIGuildMemberVerificationJSONBody {
* The server description to show in the screening form
*/
description?: string | null;
}
}>;
export type RESTPatchAPIGuildMemberVerificationResult = APIGuildMembershipScreening;
export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
export type RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The id of the channel the user is currently in
*/
@@ -754,9 +789,9 @@ export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
* Sets the user's request to speak
*/
request_to_speak_timestamp?: string | null;
}
}>;
export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
export type RESTPatchAPIGuildVoiceStateUserJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The id of the channel the user is currently in
*/
@@ -765,7 +800,7 @@ export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
* Toggles the user's suppress state
*/
suppress?: boolean;
}
}>;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen
@@ -775,9 +810,10 @@ export type RESTGetAPIGuildWelcomeScreenResult = APIGuildWelcomeScreen;
/**
* https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen
*/
export interface RESTPatchAPIGuildWelcomeScreenJSONBody extends Nullable<Partial<APIGuildWelcomeScreen>> {
/**
* Whether the welcome screen is enabled
*/
enabled?: boolean | null;
}
export type RESTPatchAPIGuildWelcomeScreenJSONBody = Nullable<StrictPartial<APIGuildWelcomeScreen>> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Whether the welcome screen is enabled
*/
enabled?: boolean | null;
}>;

View File

@@ -0,0 +1,133 @@
import type { Snowflake } from '../../globals.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
import type {
APIGuildScheduledEvent,
GuildScheduledEventEntityType,
GuildScheduledEventPrivacyLevel,
APIGuildScheduledEventEntityMetadata,
GuildScheduledEventStatus,
APIGuildScheduledEventUser,
} from '../../v9.ts';
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild
*/
export interface RESTGetAPIGuildScheduledEventsQuery {
/**
* Whether to include number of users subscribed to each event
*/
with_user_count?: boolean;
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild
*/
export type RESTGetAPIGuildScheduledEventsResult = APIGuildScheduledEvent[];
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
*/
export type RESTPostAPIGuildScheduledEventJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The stage channel id of the guild event
*/
channel_id?: Snowflake;
/**
* The name of the guild event
*/
name: string;
/**
* The privacy level of the guild event
*/
privacy_level: GuildScheduledEventPrivacyLevel;
/**
* The time to schedule the guild event at
*/
scheduled_start_time: string;
/**
* The time when the scheduled event is scheduled to end
*/
scheduled_end_time?: string;
/**
* The description of the guild event
*/
description?: string;
/**
* The scheduled entity type of the guild event
*/
entity_type?: GuildScheduledEventEntityType;
/**
* The entity metadata of the scheduled event
*/
entity_metadata?: APIGuildScheduledEventEntityMetadata;
}>;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
*/
export type RESTPostAPIGuildScheduledEventResult = APIGuildScheduledEvent;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event
*/
export interface RESTGetAPIGuildScheduledEventQuery {
/**
* Whether to include number of users subscribed to this event
*/
with_user_count?: boolean;
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event
*/
export type RESTGetAPIGuildScheduledEventResult = APIGuildScheduledEvent;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event
*/
export type RESTPatchAPIGuildScheduledEventJSONBody = StrictPartial<RESTPostAPIGuildScheduledEventJSONBody> &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The status of the scheduled event
*/
status?: GuildScheduledEventStatus;
}>;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event
*/
export type RESTPatchAPIGuildScheduledEventResult = APIGuildScheduledEvent;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event
*/
export type RESTDeleteAPIGuildScheduledEventResult = never;
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users
*/
export interface RESTGetAPIGuildScheduledEventUsersQuery {
/**
* Number of users to receive from the event
*
* @default 100
*/
limit?: number;
/**
* Whether to include guild member data if it exists
*/
with_member?: boolean;
/**
* Consider only users before given user id
*/
before?: Snowflake;
/**
* Consider only users after given user id
*/
after?: Snowflake;
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users
*/
export type RESTGetAPIGuildScheduledEventUsersResult = APIGuildScheduledEventUser[];

View File

@@ -6,6 +6,7 @@ import type {
APIInteractionResponseCallbackData,
ApplicationCommandType,
} from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
import type {
RESTDeleteAPIWebhookWithTokenMessageResult,
RESTGetAPIWebhookWithTokenMessageResult,
@@ -25,18 +26,18 @@ export type RESTGetAPIApplicationCommandsResult = APIApplicationCommand[];
*/
export type RESTGetAPIApplicationCommandResult = APIApplicationCommand;
type RESTPostAPIBaseApplicationCommandsJSONBody = Omit<
APIApplicationCommand,
'id' | 'application_id' | 'description' | 'type' | 'version'
type RESTPostAPIBaseApplicationCommandsJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<
Omit<APIApplicationCommand, 'id' | 'application_id' | 'description' | 'type' | 'version' | 'guild_id'>
>;
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type?: ApplicationCommandType.ChatInput;
description: string;
}
export type RESTPostAPIChatInputApplicationCommandsJSONBody = RESTPostAPIBaseApplicationCommandsJSONBody &
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
type?: ApplicationCommandType.ChatInput;
description: string;
}>;
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
@@ -60,7 +61,7 @@ export type RESTPostAPIApplicationCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
export type RESTPatchAPIApplicationCommandJSONBody = StrictPartial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
@@ -100,7 +101,7 @@ export type RESTPostAPIApplicationGuildCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
export type RESTPatchAPIApplicationGuildCommandJSONBody = StrictPartial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
@@ -126,22 +127,13 @@ export type RESTPostAPIInteractionCallbackJSONBody = APIInteractionResponse;
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackFormDataBody =
| {
| ({
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPostAPIInteractionCallbackJSONBody & {
/**
* The file contents
*/
file: unknown;
});
} & Record<`files[${bigint}]`, unknown>)
| (RESTPostAPIInteractionCallbackJSONBody & Record<`files[${bigint}]`, unknown>);
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
@@ -177,22 +169,13 @@ export type RESTPostAPIInteractionFollowupJSONBody = APIInteractionResponseCallb
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupFormDataBody =
| {
| ({
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPostAPIInteractionFollowupJSONBody & {
/**
* The file contents
*/
file: unknown;
});
} & Record<`files[${bigint}]`, unknown>)
| (RESTPostAPIInteractionFollowupJSONBody & Record<`files[${bigint}]`, unknown>);
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message

View File

@@ -1,3 +1,4 @@
import type { Snowflake } from '../../globals.ts';
import type { APIInvite } from '../../payloads/v9/mod.ts';
/**
@@ -12,6 +13,10 @@ export interface RESTGetAPIInviteQuery {
* Whether the invite should contain the expiration date
*/
with_expiration?: boolean;
/**
* The guild scheduled event to include with the invite
*/
guild_scheduled_event_id?: Snowflake;
}
export type RESTGetAPIInviteResult = APIInvite;

View File

@@ -7,6 +7,7 @@ export * from './channel.ts';
export * from './emoji.ts';
export * from './gateway.ts';
export * from './guild.ts';
export * from './guildScheduledEvent.ts';
export * from './interactions.ts';
export * from './invite.ts';
export * from './oauth2.ts';
@@ -473,6 +474,7 @@ export const Routes = {
/**
* Route for:
* - GET `/channels/{thread.id}/thread-members`
* - GET `/channels/{thread.id}/thread-members/{user.id}`
* - PUT `/channels/{thread.id}/thread-members/@me`
* - PUT `/channels/{thread.id}/thread-members/{user.id}`
* - DELETE `/channels/{thread.id}/thread-members/@me`
@@ -508,6 +510,14 @@ export const Routes = {
return `/users/@me/guilds` as const;
},
/**
* Route for:
* - GET `/users/@me/guilds/{guild.id}/member`
*/
userGuildMember(guildId: Snowflake) {
return `/users/@me/guilds/${guildId}/member` as const;
},
/**
* Route for:
* - DELETE `/users/@me/guilds/{guild.id}`
@@ -637,6 +647,30 @@ export const Routes = {
return `/oauth2/@me` as const;
},
/**
* Route for:
* - GET `/oauth2/authorize`
*/
oauth2Authorization() {
return `/oauth2/authorize` as const;
},
/**
* Route for:
* - POST `/oauth2/token`
*/
oauth2TokenExchange() {
return `/oauth2/token` as const;
},
/**
* Route for:
* - POST `/oauth2/token/revoke`
*/
oauth2TokenRevocation() {
return `/oauth2/token/revoke` as const;
},
/**
* Route for:
* - GET `/applications/{application.id}/commands`
@@ -782,6 +816,33 @@ export const Routes = {
guildSticker(guildId: Snowflake, stickerId: Snowflake) {
return `/guilds/${guildId}/stickers/${stickerId}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/scheduled-events`
* - POST `/guilds/{guild.id}/scheduled-events`
*/
guildScheduledEvents(guildId: Snowflake) {
return `/guilds/${guildId}/scheduled-events`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/scheduled-events/{guildScheduledEvent.id}`
* - PATCH `/guilds/{guild.id}/scheduled-events/{guildScheduledEvent.id}`
* - DELETE `/guilds/{guild.id}/scheduled-events/{guildScheduledEvent.id}`
*/
guildScheduledEvent(guildId: Snowflake, guildScheduledEventId: Snowflake) {
return `/guilds/${guildId}/scheduled-events/${guildScheduledEventId}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/scheduled-events/{guildScheduledEvent.id}/users`
*/
guildScheduledEventUsers(guildId: Snowflake, guildScheduledEventId: Snowflake) {
return `/guilds/${guildId}/scheduled-events/${guildScheduledEventId}/users`;
},
};
export const RouteBases = {
@@ -796,12 +857,12 @@ export const RouteBases = {
Object.freeze(RouteBases);
export const OAuth2Routes = {
authorizationURL: `https://discord.com/api/v${APIVersion}/oauth2/authorize`,
tokenURL: `https://discord.com/api/v${APIVersion}/oauth2/token`,
authorizationURL: `${RouteBases.api}${Routes.oauth2Authorization()}`,
tokenURL: `${RouteBases.api}${Routes.oauth2TokenExchange()}`,
/**
* See https://tools.ietf.org/html/rfc7009
*/
tokenRevocationURL: `https://discord.com/api/v${APIVersion}/oauth2/token/revoke`,
tokenRevocationURL: `${RouteBases.api}${Routes.oauth2TokenRevocation()}`,
} as const;
// Freeze OAuth2 route object

View File

@@ -1,5 +1,6 @@
import type { Snowflake } from '../../globals.ts';
import type { APIStageInstance, StageInstancePrivacyLevel } from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/stage-instance#create-stage-instance
@@ -34,7 +35,7 @@ export type RESTGetAPIStageInstanceResult = APIStageInstance;
/**
* https://discord.com/developers/docs/resources/stage-instance#update-stage-instance
*/
export interface RESTPatchAPIStageInstanceJSONBody {
export type RESTPatchAPIStageInstanceJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The topic of the stage instance (1-120 characters)
*/
@@ -43,7 +44,7 @@ export interface RESTPatchAPIStageInstanceJSONBody {
* The privacy level of the stage instance
*/
privacy_level?: StageInstancePrivacyLevel;
}
}>;
/**
* https://discord.com/developers/docs/resources/stage-instance#update-stage-instance

View File

@@ -1,4 +1,5 @@
import type { APISticker, APIStickerPack } from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
export type RESTGetAPIStickerResult = APISticker;
@@ -31,7 +32,7 @@ export interface RESTPostAPIGuildStickerFormDataBody {
export type RESTPostAPIGuildStickerResult = APISticker;
export interface RESTPatchAPIGuildStickerJSONBody {
export type RESTPatchAPIGuildStickerJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the sticker (2-30 characters)
*/
@@ -44,7 +45,7 @@ export interface RESTPatchAPIGuildStickerJSONBody {
* The Discord name of a unicode emoji representing the sticker's expression (2-200 characters)
*/
tags?: string;
}
}>;
export type RESTPatchAPIGuildStickerResult = APISticker;

View File

@@ -1,4 +1,5 @@
import type { APIGuild, APITemplate } from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/template#get-template
@@ -8,7 +9,7 @@ export type RESTGetAPITemplateResult = APITemplate;
/**
* https://discord.com/developers/docs/resources/template#create-guild-from-template
*/
export interface RESTPostAPITemplateCreateGuildJSONBody {
export type RESTPostAPITemplateCreateGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the guild (2-100 characters)
*/
@@ -19,7 +20,8 @@ export interface RESTPostAPITemplateCreateGuildJSONBody {
* See https://discord.com/developers/docs/reference#image-data
*/
icon?: string;
}
}>;
/**
* https://discord.com/developers/docs/resources/template#create-guild-from-template
*/
@@ -33,7 +35,7 @@ export type RESTGetAPIGuildTemplatesResult = APITemplate[];
/**
* https://discord.com/developers/docs/resources/template#create-guild-template
*/
export interface RESTPostAPIGuildTemplatesJSONBody {
export type RESTPostAPIGuildTemplatesJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the template (1-100 characters)
*/
@@ -42,7 +44,7 @@ export interface RESTPostAPIGuildTemplatesJSONBody {
* Description for the template (0-120 characters)
*/
description?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/template#create-guild-template
@@ -57,7 +59,7 @@ export type RESTPutAPIGuildTemplateSyncResult = APITemplate;
/**
* https://discord.com/developers/docs/resources/template#modify-guild-template
*/
export type RESTPatchAPIGuildTemplateJSONBody = Partial<RESTPostAPIGuildTemplatesJSONBody>;
export type RESTPatchAPIGuildTemplateJSONBody = StrictPartial<RESTPostAPIGuildTemplatesJSONBody>;
/**
* https://discord.com/developers/docs/resources/template#modify-guild-template

View File

@@ -1,5 +1,6 @@
import type { Permissions, Snowflake } from '../../globals.ts';
import type { APIChannel, APIConnection, APIUser, GuildFeature } from '../../payloads/v9/mod.ts';
import type { APIChannel, APIConnection, APIGuildMember, APIUser, GuildFeature } from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/user#get-current-user
@@ -11,10 +12,15 @@ export type RESTGetAPICurrentUserResult = APIUser;
*/
export type RESTGetAPIUserResult = APIUser;
/**
* https://discord.com/developers/docs/resources/guild#get-current-user-guild-member
*/
export type RESTGetCurrentUserGuildMemberResult = APIGuildMember;
/**
* https://discord.com/developers/docs/resources/user#modify-current-user
*/
export interface RESTPatchAPICurrentUserJSONBody {
export type RESTPatchAPICurrentUserJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* User's username, if changed may cause the user's discriminator to be randomized
*/
@@ -23,7 +29,7 @@ export interface RESTPatchAPICurrentUserJSONBody {
* If passed, modifies the user's avatar
*/
avatar?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/user#modify-current-user

View File

@@ -7,12 +7,12 @@ import type {
APIWebhook,
APIAttachment,
} from '../../payloads/v9/mod.ts';
import type { Nullable } from '../../utils/internals.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, Nullable } from '../../utils/internals.ts';
/**
* https://discord.com/developers/docs/resources/webhook#create-webhook
*/
export interface RESTPostAPIChannelWebhookJSONBody {
export type RESTPostAPIChannelWebhookJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* Name of the webhook (1-80 characters)
*/
@@ -23,7 +23,7 @@ export interface RESTPostAPIChannelWebhookJSONBody {
* See https://discord.com/developers/docs/reference#image-data
*/
avatar?: string | null;
}
}>;
/**
* https://discord.com/developers/docs/resources/webhook#create-webhook
@@ -53,7 +53,7 @@ export type RESTGetAPIWebhookWithTokenResult = Omit<APIWebhook, 'user'>;
/**
* https://discord.com/developers/docs/resources/webhook#modify-webhook
*/
export interface RESTPatchAPIWebhookJSONBody {
export type RESTPatchAPIWebhookJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The default name of the webhook
*/
@@ -68,7 +68,7 @@ export interface RESTPatchAPIWebhookJSONBody {
* The new channel id this webhook should be moved to
*/
channel_id?: Snowflake;
}
}>;
/**
* https://discord.com/developers/docs/resources/webhook#modify-webhook
@@ -98,7 +98,7 @@ export type RESTDeleteAPIWebhookWithTokenResult = never;
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook
*/
export interface RESTPostAPIWebhookWithTokenJSONBody {
export type RESTPostAPIWebhookWithTokenJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
/**
* The message contents (up to 2000 characters)
*/
@@ -135,28 +135,23 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
* See https://discord.com/developers/docs/interactions/message-components#component-object
*/
components?: APIActionRowComponent[];
}
/**
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[];
}>;
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook
*/
export type RESTPostAPIWebhookWithTokenFormDataBody =
| {
| ({
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPostAPIWebhookWithTokenJSONBody & {
/**
* The file contents
*/
file: unknown;
});
} & Record<`files[${bigint}]`, unknown>)
| (RESTPostAPIWebhookWithTokenJSONBody & Record<`files[${bigint}]`, unknown>);
/**
* https://discord.com/developers/docs/resources/webhook#execute-webhook-querystring-params
@@ -232,38 +227,30 @@ export type RESTGetAPIWebhookWithTokenMessageResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
*/
export interface RESTPatchAPIWebhookWithTokenMessageJSONBody
extends Nullable<
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>
> {
/**
* Attached files to keep
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: APIAttachment[] | null;
}
export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<
Nullable<Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>> & {
/**
* Attached files to keep
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[];
}
>;
/**
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
*/
export type RESTPatchAPIWebhookWithTokenMessageFormDataBody =
| {
| ({
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPatchAPIWebhookWithTokenMessageJSONBody & {
/**
* The file contents
*/
file: unknown;
});
} & Record<`files[${bigint}]`, unknown>)
| (RESTPatchAPIWebhookWithTokenMessageJSONBody & Record<`files[${bigint}]`, unknown>);
/**
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message

View File

@@ -1,3 +1,15 @@
export type Nullable<T> = {
[P in keyof T]: T[P] | null;
};
/**
* Allows support for TS 4.5's `exactOptionalPropertyTypes` option by ensuring a property present and undefined is valid
* (since JSON.stringify ignores undefined properties)
*/
export type AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Base> = {
[K in keyof Base]: Base[K] extends Exclude<Base[K], undefined> ? Base[K] : Base[K] | undefined;
};
export type StrictPartial<Base> = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Partial<Base>>;
export type StrictRequired<Base> = Required<{ [K in keyof Base]: Exclude<Base[K], undefined> }>;

View File

@@ -9,6 +9,7 @@ import type {
APIChannel,
APIEmoji,
APIGuild,
APIGuildScheduledEvent,
APIGuildIntegration,
APIGuildMember,
APIMessage,
@@ -183,6 +184,7 @@ export const enum GatewayIntentBits {
DirectMessages = 1 << 12,
DirectMessageReactions = 1 << 13,
DirectMessageTyping = 1 << 14,
GuildScheduledEvents = 1 << 16,
}
/**
@@ -233,6 +235,11 @@ export const enum GatewayDispatchEvents {
VoiceServerUpdate = 'VOICE_SERVER_UPDATE',
VoiceStateUpdate = 'VOICE_STATE_UPDATE',
WebhooksUpdate = 'WEBHOOKS_UPDATE',
GuildScheduledEventCreate = 'GUILD_SCHEDULED_EVENT_CREATE',
GuildScheduledEventUpdate = 'GUILD_SCHEDULED_EVENT_UPDATE',
GuildScheduledEventDelete = 'GUILD_SCHEDULED_EVENT_DELETE',
GuildScheduledEventUserAdd = 'GUILD_SCHEDULED_EVENT_USER_ADD',
GuildScheduledEventUserRemove = 'GUILD_SCHEDULED_EVENT_USER_REMOVE',
}
export type GatewaySendPayload =
@@ -265,6 +272,11 @@ export type GatewayDispatchPayload =
| GatewayGuildModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayGuildRoleModifyDispatch
| GatewayGuildScheduledEventCreateDispatch
| GatewayGuildScheduledEventUpdateDispatch
| GatewayGuildScheduledEventDeleteDispatch
| GatewayGuildScheduledEventUserAddDispatch
| GatewayGuildScheduledEventUserRemoveDispatch
| GatewayGuildStickersUpdateDispatch
| GatewayIntegrationCreateDispatch
| GatewayIntegrationDeleteDispatch
@@ -808,6 +820,49 @@ export interface GatewayGuildRoleDeleteDispatchData {
role_id: Snowflake;
}
export type GatewayGuildScheduledEventCreateDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventCreate,
GatewayGuildScheduledEventCreateDispatchData
>;
export type GatewayGuildScheduledEventCreateDispatchData = APIGuildScheduledEvent;
export type GatewayGuildScheduledEventUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventUpdate,
GatewayGuildScheduledEventUpdateDispatchData
>;
export type GatewayGuildScheduledEventUpdateDispatchData = APIGuildScheduledEvent;
export type GatewayGuildScheduledEventDeleteDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventDelete,
GatewayGuildScheduledEventDeleteDispatchData
>;
export type GatewayGuildScheduledEventDeleteDispatchData = APIGuildScheduledEvent;
export type GatewayGuildScheduledEventUserAddDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventUserAdd,
GatewayGuildScheduledEventUserAddDispatchData
>;
export interface GatewayGuildScheduledEventUserAddDispatchData {
guild_scheduled_event_id: Snowflake;
user_id: Snowflake;
guild_id: Snowflake;
}
export type GatewayGuildScheduledEventUserRemoveDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventUserRemove,
GatewayGuildScheduledEventUserAddDispatchData
>;
export interface GatewayGuildScheduledEventUserRemoveDispatchData {
guild_scheduled_event_id: Snowflake;
user_id: Snowflake;
guild_id: Snowflake;
}
/**
* https://discord.com/developers/docs/topics/gateway#integration-create
*/
@@ -1513,7 +1568,10 @@ interface BasePayload {
t?: string;
}
type NonDispatchPayload = Omit<BasePayload, 't'>;
type NonDispatchPayload = Omit<BasePayload, 't' | 's'> & {
t: null;
s: null;
};
interface DataPayload<Event extends GatewayDispatchEvents, D = unknown> extends BasePayload {
op: GatewayOpcodes.Dispatch;

View File

@@ -9,6 +9,7 @@ import type {
APIChannel,
APIEmoji,
APIGuild,
APIGuildScheduledEvent,
APIGuildIntegration,
APIGuildMember,
APIMessage,
@@ -186,6 +187,7 @@ export const enum GatewayIntentBits {
DirectMessages = 1 << 12,
DirectMessageReactions = 1 << 13,
DirectMessageTyping = 1 << 14,
GuildScheduledEvents = 1 << 16,
}
/**
@@ -242,6 +244,11 @@ export const enum GatewayDispatchEvents {
VoiceServerUpdate = 'VOICE_SERVER_UPDATE',
VoiceStateUpdate = 'VOICE_STATE_UPDATE',
WebhooksUpdate = 'WEBHOOKS_UPDATE',
GuildScheduledEventCreate = 'GUILD_SCHEDULED_EVENT_CREATE',
GuildScheduledEventUpdate = 'GUILD_SCHEDULED_EVENT_UPDATE',
GuildScheduledEventDelete = 'GUILD_SCHEDULED_EVENT_DELETE',
GuildScheduledEventUserAdd = 'GUILD_SCHEDULED_EVENT_USER_ADD',
GuildScheduledEventUserRemove = 'GUILD_SCHEDULED_EVENT_USER_REMOVE',
}
export type GatewaySendPayload =
@@ -274,6 +281,11 @@ export type GatewayDispatchPayload =
| GatewayGuildModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayGuildRoleModifyDispatch
| GatewayGuildScheduledEventCreateDispatch
| GatewayGuildScheduledEventUpdateDispatch
| GatewayGuildScheduledEventDeleteDispatch
| GatewayGuildScheduledEventUserAddDispatch
| GatewayGuildScheduledEventUserRemoveDispatch
| GatewayGuildStickersUpdateDispatch
| GatewayIntegrationCreateDispatch
| GatewayIntegrationDeleteDispatch
@@ -290,6 +302,9 @@ export type GatewayDispatchPayload =
| GatewayMessageReactionRemoveEmojiDispatch
| GatewayMessageUpdateDispatch
| GatewayPresenceUpdateDispatch
| GatewayStageInstanceCreateDispatch
| GatewayStageInstanceDeleteDispatch
| GatewayStageInstanceUpdateDispatch
| GatewayReadyDispatch
| GatewayResumedDispatch
| GatewayThreadListSyncDispatch
@@ -818,6 +833,49 @@ export interface GatewayGuildRoleDeleteDispatchData {
role_id: Snowflake;
}
export type GatewayGuildScheduledEventCreateDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventCreate,
GatewayGuildScheduledEventCreateDispatchData
>;
export type GatewayGuildScheduledEventCreateDispatchData = APIGuildScheduledEvent;
export type GatewayGuildScheduledEventUpdateDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventUpdate,
GatewayGuildScheduledEventUpdateDispatchData
>;
export type GatewayGuildScheduledEventUpdateDispatchData = APIGuildScheduledEvent;
export type GatewayGuildScheduledEventDeleteDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventDelete,
GatewayGuildScheduledEventDeleteDispatchData
>;
export type GatewayGuildScheduledEventDeleteDispatchData = APIGuildScheduledEvent;
export type GatewayGuildScheduledEventUserAddDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventUserAdd,
GatewayGuildScheduledEventUserAddDispatchData
>;
export interface GatewayGuildScheduledEventUserAddDispatchData {
guild_scheduled_event_id: Snowflake;
user_id: Snowflake;
guild_id: Snowflake;
}
export type GatewayGuildScheduledEventUserRemoveDispatch = DataPayload<
GatewayDispatchEvents.GuildScheduledEventUserRemove,
GatewayGuildScheduledEventUserAddDispatchData
>;
export interface GatewayGuildScheduledEventUserRemoveDispatchData {
guild_scheduled_event_id: Snowflake;
user_id: Snowflake;
guild_id: Snowflake;
}
/**
* https://discord.com/developers/docs/topics/gateway#integration-create
*/
@@ -1202,7 +1260,7 @@ export type GatewayThreadMemberUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway#thread-member-update
*/
export type GatewayThreadMemberUpdateDispatchData = APIThreadMember;
export type GatewayThreadMemberUpdateDispatchData = APIThreadMember & { guild_id: Snowflake };
/**
* https://discord.com/developers/docs/topics/gateway#thread-create
@@ -1602,7 +1660,10 @@ interface BasePayload {
t?: string;
}
type NonDispatchPayload = Omit<BasePayload, 't'>;
type NonDispatchPayload = Omit<BasePayload, 't' | 's'> & {
t: null;
s: null;
};
interface DataPayload<Event extends GatewayDispatchEvents, D = unknown> extends BasePayload {
op: GatewayOpcodes.Dispatch;

7778
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,7 @@
{
"name": "discord-api-types",
"version": "0.23.1",
"version": "0.26.0",
"description": "Discord API typings that are kept up to date for use in bot library creation.",
"main": "./v9.js",
"module": "./v9.mjs",
"types": "./v9.d.ts",
"exports": {
"./globals": {
@@ -112,29 +110,29 @@
"node": ">=12"
},
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/eslint-parser": "^7.14.7",
"@babel/core": "^7.16.5",
"@babel/eslint-parser": "^7.16.5",
"@babel/plugin-syntax-top-level-await": "^7.14.5",
"@commitlint/cli": "^12.1.4",
"@commitlint/config-angular": "^12.1.4",
"@types/node": "^16.3.3",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@typescript-eslint/parser": "^4.28.3",
"@commitlint/cli": "^15.0.0",
"@commitlint/config-angular": "^15.0.0",
"@types/node": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^5.8.0",
"@typescript-eslint/parser": "^5.8.0",
"conventional-changelog-cli": "^2.1.1",
"eslint": "^7.30.0",
"eslint-config-marine": "^9.0.6",
"eslint": "^8.5.0",
"eslint-config-marine": "^9.1.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"gen-esm-wrapper": "^1.1.2",
"husky": "^7.0.1",
"is-ci": "^3.0.0",
"lint-staged": "^11.0.1",
"eslint-plugin-prettier": "^4.0.0",
"gen-esm-wrapper": "^1.1.3",
"husky": "^7.0.4",
"is-ci": "^3.0.1",
"lint-staged": "^12.1.4",
"npm-run-all": "^4.1.5",
"prettier": "^2.3.2",
"pretty-quick": "^3.1.1",
"prettier": "^2.5.1",
"pretty-quick": "^3.1.3",
"rimraf": "^3.0.2",
"tsd": "^0.17.0",
"typescript": "^4.3.5"
"tsd": "^0.19.0",
"typescript": "^4.5.4"
},
"repository": {
"type": "git",

View File

@@ -540,7 +540,7 @@ export type APIAuditLogChangeKeyExpireGracePeriod = AuditLogChangeData<'expire_g
* @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> {
interface AuditLogChangeData<K extends string, D> {
key: K;
new_value?: D;
old_value?: D;

View File

@@ -0,0 +1,26 @@
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared';
export interface APIApplicationCommandOptionBase<Type extends ApplicationCommandOptionType> {
type: Type;
name: string;
description: string;
required?: boolean;
}
export interface APIInteractionDataOptionBase<T extends ApplicationCommandOptionType, D> {
name: string;
type: T;
value: D;
}
export type APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
Base extends APIApplicationCommandOptionBase<ApplicationCommandOptionType>,
ChoiceType extends APIApplicationCommandOptionChoice,
> =
| (Base & {
autocomplete: true;
})
| (Base & {
autocomplete?: false;
choices?: ChoiceType[];
});

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