Compare commits

...

58 Commits

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

* something something deno

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

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

* feat: update Routes

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

View File

@@ -55,7 +55,7 @@ a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at https://discord.gg/bRCvFy9. All
reported by contacting the project team at https://discord.gg/djs. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.

View File

@@ -1,6 +1,6 @@
# discord-api-types Contributing Guide
**The issue tracker is only for bug reports and enhancement suggestions. If you have a question, please ask it in the [Discord server](https://discord.gg/bRCvFy9) instead of opening an issue, or on [GitHub Discussions](https://github.com/discordjs/discord-api-types/discussions) you will get redirected there anyway.**
**The issue tracker is only for bug reports and enhancement suggestions. If you have a question, please ask it in the [Discord server](https://discord.gg/djs) instead of opening an issue, or on [GitHub Discussions](https://github.com/discordjs/discord-api-types/discussions) you will get redirected there anyway.**
- [Code of Conduct](https://github.com/discordjs/discord-api-types/blob/main/.github/CODE_OF_CONDUCT.md)
- [Pull Request Guidelines](#pull-request-guidelines)

View File

@@ -6,7 +6,7 @@ labels: 'bug'
assignees: ''
---
<!-- Use Discord for questions: https://discord.gg/bRCvFy9 -->
<!-- Use Discord for questions: https://discord.gg/djs -->
**Please describe the problem you are having in as much detail as possible:**

View File

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

View File

@@ -6,7 +6,7 @@ labels: 'discussion'
assignees: ''
---
<!-- Use Discord for questions: https://discord.gg/bRCvFy9 -->
<!-- Use Discord for questions: https://discord.gg/djs -->
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Eg. I'm always frustrated when [...]

2
.github/SUPPORT.md vendored
View File

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

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,138 @@
# [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
- **RESTPostAPIBaseApplicationCommandsJSONBody:** omit `version` field ([#195](https://github.com/discordjs/discord-api-types/issues/195)) ([43cc755](https://github.com/discordjs/discord-api-types/commit/43cc755e3390437d11f7733477a2c86afd6daf23))
# [0.23.0](https://github.com/discordjs/discord-api-types/compare/0.22.0...0.23.0) (2021-09-07)
### Bug Fixes
- **AuditLog:** correct `nickname` type ([#189](https://github.com/discordjs/discord-api-types/issues/189)) ([64937e2](https://github.com/discordjs/discord-api-types/commit/64937e2311bf5e688f6789d9e66827e980e4e01c))
- **Embed:** correct certain optional types as being required ([#192](https://github.com/discordjs/discord-api-types/issues/192)) ([e628f0f](https://github.com/discordjs/discord-api-types/commit/e628f0f6f089a0840b9d69bea930dd3ad7fa7462))
- import causing error 404 on deno ([#178](https://github.com/discordjs/discord-api-types/issues/178)) ([8fcd0f2](https://github.com/discordjs/discord-api-types/commit/8fcd0f2222a77a1a0b19888d699e98d450268cc8))
### chore
- **Gateway:** remove `APPLICATION_COMMAND_*` events ([#191](https://github.com/discordjs/discord-api-types/issues/191)) ([d590caf](https://github.com/discordjs/discord-api-types/commit/d590caf359b61aa77780385437929f443cbf4a26))
### Features
- **APIApplicationCommand:** add `version` field ([#193](https://github.com/discordjs/discord-api-types/issues/193)) ([ecbed18](https://github.com/discordjs/discord-api-types/commit/ecbed180424c0975c52208f0f803b08f105df04a))
- **APIUser:** add `banner` and `accent_color` ([#183](https://github.com/discordjs/discord-api-types/issues/183)) ([b07b903](https://github.com/discordjs/discord-api-types/commit/b07b9030c134fdaf53f500d319c88067c1a8a175))
- **Interactions:** context menu items ([#166](https://github.com/discordjs/discord-api-types/issues/166)) ([fdc1c1a](https://github.com/discordjs/discord-api-types/commit/fdc1c1a5b411d8ef3d635ad90bd97c2b1bf77cf1))
- **JSONErrorCodes:** add `160002` ([#190](https://github.com/discordjs/discord-api-types/issues/190)) ([8b49887](https://github.com/discordjs/discord-api-types/commit/8b49887c7f732fe88cadb1e6ca17e0dc12db25f9))
- **MessageType:** add ContextMenuCommand and rename ApplicationCommand to ChatInputCommand ([#180](https://github.com/discordjs/discord-api-types/issues/180)) ([0024823](https://github.com/discordjs/discord-api-types/commit/0024823d053c15491011eb6d11c314e299689ba5))
- **Threads:** add `invitable` ([#185](https://github.com/discordjs/discord-api-types/issues/185)) ([b6babf2](https://github.com/discordjs/discord-api-types/commit/b6babf2ee2c66817ac99752d14feed2d574ecb14))
### BREAKING CHANGES
- **Gateway:** The three Application Command events have been removed
- **Embed:**
- `APIEmbedAuthor#name` is required, not optional
- `APIEmbedThumbnail#url` is required, not optional
- `APIEmbedImage#url` is required, not optional
# [0.22.0](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.22.0) (2021-07-31)
### Bug Fixes
- **Gateway:** thread list sync now sends an array as documented ([#174](https://github.com/discordjs/discord-api-types/issues/174)) ([a93235c](https://github.com/discordjs/discord-api-types/commit/a93235c9df2bc36a337c03e8ba08986e6e377483))
- **MessageComponent:** correct type for emoji ([#176](https://github.com/discordjs/discord-api-types/issues/176)) ([b75b05f](https://github.com/discordjs/discord-api-types/commit/b75b05f0d50014335fefc8bb8969d519ed0076d3))
### chore
- **ApplicationCommandOptionType:** casing changes for subcommands ([#175](https://github.com/discordjs/discord-api-types/issues/175)) ([f93b6be](https://github.com/discordjs/discord-api-types/commit/f93b6be2528c80f8dc038282a7d6ddb3c4685c2f))
### Features
- thread updates ([#167](https://github.com/discordjs/discord-api-types/issues/167)) ([47100bc](https://github.com/discordjs/discord-api-types/commit/47100bcf2c154146baecb359e1c00ecca9939ffa))
### BREAKING CHANGES
- **ApplicationCommandOptionType:** This renames `SubCommand` to `Subcommand`, and `SubCommandGroup` to `SubcommandGroup`
- `Routes#channelJoinedArchivedThreads` is now spelled right (from `Routes#channelJoinedArhivedThreads`)
- **Gateway:** `GatewayThreadListSync#members` is now an array of APIThreadMember instead of a Record of GatewayThreadListSyncMember
# [0.21.0](https://github.com/discordjs/discord-api-types/compare/0.20.1...0.21.0) (2021-07-30)
### Bug Fixes
- change resolved index types to string ([#169](https://github.com/discordjs/discord-api-types/issues/169)) ([d338409](https://github.com/discordjs/discord-api-types/commit/d338409410854cc1f97f9903fdc2565e1f45e778))
- export APIPingInteraction ([#168](https://github.com/discordjs/discord-api-types/issues/168)) ([ef2a0ae](https://github.com/discordjs/discord-api-types/commit/ef2a0aeb07cdd04b47e6cb0d40dd8a1b2a77b491))
- **APIInteraction:** bring back Ping type ([#164](https://github.com/discordjs/discord-api-types/issues/164)) ([ff75eb3](https://github.com/discordjs/discord-api-types/commit/ff75eb3f5dfd7597968c26133d125cfe40ee5838))
### Features
- **ApplicationCommandOptionType:** add Number (10) ([#153](https://github.com/discordjs/discord-api-types/issues/153)) ([6f15e53](https://github.com/discordjs/discord-api-types/commit/6f15e537dfee5bda383572cd725c05246c97ca62))
- **Globals:** revert template bigint type to string type ([#171](https://github.com/discordjs/discord-api-types/issues/171)) ([f299507](https://github.com/discordjs/discord-api-types/commit/f2995073e033b050ab459c42b480e626f3f6ae8e))
### Reverts
- fix: change resolved index types to string ([#172](https://github.com/discordjs/discord-api-types/issues/172)) ([647905e](https://github.com/discordjs/discord-api-types/commit/647905e16bfeb689e644695657ac5f05920c0c4c))
### BREAKING CHANGES
- **Globals:** The type for Snowflake and Permissions is reverted from the `${bigint}` template type back to a normal string type
## [0.20.2](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.20.2) (2021-07-21)
### Bug Fixes

View File

@@ -1,3 +1,138 @@
# [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
- **RESTPostAPIBaseApplicationCommandsJSONBody:** omit `version` field ([#195](https://github.com/discordjs/discord-api-types/issues/195)) ([43cc755](https://github.com/discordjs/discord-api-types/commit/43cc755e3390437d11f7733477a2c86afd6daf23))
# [0.23.0](https://github.com/discordjs/discord-api-types/compare/0.22.0...0.23.0) (2021-09-07)
### Bug Fixes
- **AuditLog:** correct `nickname` type ([#189](https://github.com/discordjs/discord-api-types/issues/189)) ([64937e2](https://github.com/discordjs/discord-api-types/commit/64937e2311bf5e688f6789d9e66827e980e4e01c))
- **Embed:** correct certain optional types as being required ([#192](https://github.com/discordjs/discord-api-types/issues/192)) ([e628f0f](https://github.com/discordjs/discord-api-types/commit/e628f0f6f089a0840b9d69bea930dd3ad7fa7462))
- import causing error 404 on deno ([#178](https://github.com/discordjs/discord-api-types/issues/178)) ([8fcd0f2](https://github.com/discordjs/discord-api-types/commit/8fcd0f2222a77a1a0b19888d699e98d450268cc8))
### chore
- **Gateway:** remove `APPLICATION_COMMAND_*` events ([#191](https://github.com/discordjs/discord-api-types/issues/191)) ([d590caf](https://github.com/discordjs/discord-api-types/commit/d590caf359b61aa77780385437929f443cbf4a26))
### Features
- **APIApplicationCommand:** add `version` field ([#193](https://github.com/discordjs/discord-api-types/issues/193)) ([ecbed18](https://github.com/discordjs/discord-api-types/commit/ecbed180424c0975c52208f0f803b08f105df04a))
- **APIUser:** add `banner` and `accent_color` ([#183](https://github.com/discordjs/discord-api-types/issues/183)) ([b07b903](https://github.com/discordjs/discord-api-types/commit/b07b9030c134fdaf53f500d319c88067c1a8a175))
- **Interactions:** context menu items ([#166](https://github.com/discordjs/discord-api-types/issues/166)) ([fdc1c1a](https://github.com/discordjs/discord-api-types/commit/fdc1c1a5b411d8ef3d635ad90bd97c2b1bf77cf1))
- **JSONErrorCodes:** add `160002` ([#190](https://github.com/discordjs/discord-api-types/issues/190)) ([8b49887](https://github.com/discordjs/discord-api-types/commit/8b49887c7f732fe88cadb1e6ca17e0dc12db25f9))
- **MessageType:** add ContextMenuCommand and rename ApplicationCommand to ChatInputCommand ([#180](https://github.com/discordjs/discord-api-types/issues/180)) ([0024823](https://github.com/discordjs/discord-api-types/commit/0024823d053c15491011eb6d11c314e299689ba5))
- **Threads:** add `invitable` ([#185](https://github.com/discordjs/discord-api-types/issues/185)) ([b6babf2](https://github.com/discordjs/discord-api-types/commit/b6babf2ee2c66817ac99752d14feed2d574ecb14))
### BREAKING CHANGES
- **Gateway:** The three Application Command events have been removed
- **Embed:**
- `APIEmbedAuthor#name` is required, not optional
- `APIEmbedThumbnail#url` is required, not optional
- `APIEmbedImage#url` is required, not optional
# [0.22.0](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.22.0) (2021-07-31)
### Bug Fixes
- **Gateway:** thread list sync now sends an array as documented ([#174](https://github.com/discordjs/discord-api-types/issues/174)) ([a93235c](https://github.com/discordjs/discord-api-types/commit/a93235c9df2bc36a337c03e8ba08986e6e377483))
- **MessageComponent:** correct type for emoji ([#176](https://github.com/discordjs/discord-api-types/issues/176)) ([b75b05f](https://github.com/discordjs/discord-api-types/commit/b75b05f0d50014335fefc8bb8969d519ed0076d3))
### chore
- **ApplicationCommandOptionType:** casing changes for subcommands ([#175](https://github.com/discordjs/discord-api-types/issues/175)) ([f93b6be](https://github.com/discordjs/discord-api-types/commit/f93b6be2528c80f8dc038282a7d6ddb3c4685c2f))
### Features
- thread updates ([#167](https://github.com/discordjs/discord-api-types/issues/167)) ([47100bc](https://github.com/discordjs/discord-api-types/commit/47100bcf2c154146baecb359e1c00ecca9939ffa))
### BREAKING CHANGES
- **ApplicationCommandOptionType:** This renames `SubCommand` to `Subcommand`, and `SubCommandGroup` to `SubcommandGroup`
- `Routes#channelJoinedArchivedThreads` is now spelled right (from `Routes#channelJoinedArhivedThreads`)
- **Gateway:** `GatewayThreadListSync#members` is now an array of APIThreadMember instead of a Record of GatewayThreadListSyncMember
# [0.21.0](https://github.com/discordjs/discord-api-types/compare/0.20.1...0.21.0) (2021-07-30)
### Bug Fixes
- change resolved index types to string ([#169](https://github.com/discordjs/discord-api-types/issues/169)) ([d338409](https://github.com/discordjs/discord-api-types/commit/d338409410854cc1f97f9903fdc2565e1f45e778))
- export APIPingInteraction ([#168](https://github.com/discordjs/discord-api-types/issues/168)) ([ef2a0ae](https://github.com/discordjs/discord-api-types/commit/ef2a0aeb07cdd04b47e6cb0d40dd8a1b2a77b491))
- **APIInteraction:** bring back Ping type ([#164](https://github.com/discordjs/discord-api-types/issues/164)) ([ff75eb3](https://github.com/discordjs/discord-api-types/commit/ff75eb3f5dfd7597968c26133d125cfe40ee5838))
### Features
- **ApplicationCommandOptionType:** add Number (10) ([#153](https://github.com/discordjs/discord-api-types/issues/153)) ([6f15e53](https://github.com/discordjs/discord-api-types/commit/6f15e537dfee5bda383572cd725c05246c97ca62))
- **Globals:** revert template bigint type to string type ([#171](https://github.com/discordjs/discord-api-types/issues/171)) ([f299507](https://github.com/discordjs/discord-api-types/commit/f2995073e033b050ab459c42b480e626f3f6ae8e))
### Reverts
- fix: change resolved index types to string ([#172](https://github.com/discordjs/discord-api-types/issues/172)) ([647905e](https://github.com/discordjs/discord-api-types/commit/647905e16bfeb689e644695657ac5f05920c0c4c))
### BREAKING CHANGES
- **Globals:** The type for Snowflake and Permissions is reverted from the `${bigint}` template type back to a normal string type
## [0.20.2](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.20.2) (2021-07-21)
### Bug Fixes

View File

@@ -5,11 +5,11 @@
import type { Snowflake } from '../globals.ts';
import type {
APIApplication,
APIApplicationCommand,
APIApplicationCommandInteraction,
APIChannel,
APIEmoji,
APIGuild,
APIGuildScheduledEvent,
APIGuildIntegration,
APIGuildMember,
APIMessage,
@@ -184,15 +184,13 @@ export enum GatewayIntentBits {
DirectMessages = 1 << 12,
DirectMessageReactions = 1 << 13,
DirectMessageTyping = 1 << 14,
GuildScheduledEvents = 1 << 16,
}
/**
* https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
*/
export enum GatewayDispatchEvents {
ApplicationCommandCreate = 'APPLICATION_COMMAND_CREATE',
ApplicationCommandDelete = 'APPLICATION_COMMAND_DELETE',
ApplicationCommandUpdate = 'APPLICATION_COMMAND_UPDATE',
ChannelCreate = 'CHANNEL_CREATE',
ChannelDelete = 'CHANNEL_DELETE',
ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE',
@@ -237,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 =
@@ -269,6 +272,11 @@ export type GatewayDispatchPayload =
| GatewayGuildModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayGuildRoleModifyDispatch
| GatewayGuildScheduledEventCreateDispatch
| GatewayGuildScheduledEventUpdateDispatch
| GatewayGuildScheduledEventDeleteDispatch
| GatewayGuildScheduledEventUserAddDispatch
| GatewayGuildScheduledEventUserRemoveDispatch
| GatewayGuildStickersUpdateDispatch
| GatewayIntegrationCreateDispatch
| GatewayIntegrationDeleteDispatch
@@ -298,55 +306,6 @@ export type GatewayDispatchPayload =
// #region Dispatch Payloads
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatch = DataPayload<
| GatewayDispatchEvents.ApplicationCommandCreate
| GatewayDispatchEvents.ApplicationCommandUpdate
| GatewayDispatchEvents.ApplicationCommandDelete,
GatewayApplicationCommandModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatchData = APIApplicationCommand;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#hello
*/
@@ -861,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
*/

View File

@@ -5,11 +5,11 @@
import type { Snowflake } from '../globals.ts';
import type {
APIApplication,
APIApplicationCommand,
APIApplicationCommandInteraction,
APIChannel,
APIEmoji,
APIGuild,
APIGuildScheduledEvent,
APIGuildIntegration,
APIGuildMember,
APIMessage,
@@ -187,15 +187,13 @@ export enum GatewayIntentBits {
DirectMessages = 1 << 12,
DirectMessageReactions = 1 << 13,
DirectMessageTyping = 1 << 14,
GuildScheduledEvents = 1 << 16,
}
/**
* https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
*/
export enum GatewayDispatchEvents {
ApplicationCommandCreate = 'APPLICATION_COMMAND_CREATE',
ApplicationCommandDelete = 'APPLICATION_COMMAND_DELETE',
ApplicationCommandUpdate = 'APPLICATION_COMMAND_UPDATE',
ChannelCreate = 'CHANNEL_CREATE',
ChannelDelete = 'CHANNEL_DELETE',
ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE',
@@ -246,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 =
@@ -278,6 +281,11 @@ export type GatewayDispatchPayload =
| GatewayGuildModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayGuildRoleModifyDispatch
| GatewayGuildScheduledEventCreateDispatch
| GatewayGuildScheduledEventUpdateDispatch
| GatewayGuildScheduledEventDeleteDispatch
| GatewayGuildScheduledEventUserAddDispatch
| GatewayGuildScheduledEventUserRemoveDispatch
| GatewayGuildStickersUpdateDispatch
| GatewayIntegrationCreateDispatch
| GatewayIntegrationDeleteDispatch
@@ -308,55 +316,6 @@ export type GatewayDispatchPayload =
// #region Dispatch Payloads
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatch = DataPayload<
| GatewayDispatchEvents.ApplicationCommandCreate
| GatewayDispatchEvents.ApplicationCommandUpdate
| GatewayDispatchEvents.ApplicationCommandDelete,
GatewayApplicationCommandModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatchData = APIApplicationCommand;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#hello
*/
@@ -871,6 +830,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
*/

View File

@@ -1,13 +1,13 @@
/**
* https://discord.com/developers/docs/reference#snowflakes
*/
export type Snowflake = `${bigint}`;
export type Snowflake = string;
/**
* https://discord.com/developers/docs/topics/permissions
* @internal
*/
export type Permissions = `${bigint}`;
export type Permissions = string;
/**
* https://discord.com/developers/docs/reference#message-formatting-formats

View File

@@ -0,0 +1,266 @@
import type { APIRole, APIUser, ChannelType } from '../../mod.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands.ts';
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
description: string;
required?: boolean;
autocomplete?: never;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandOption =
| APIApplicationCommandStringArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandOptionBase
| APIApplicationCommandChannelOptions
| APIApplicationCommandOptionBase
| APIApplicationCommandNumberArgumentOptions
| APIApplicationCommandStringAutocompleteOptions
| APIApplicationCommandNumericAutocompleteOptions;
/**
* 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 APIApplicationCommandStringArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.String;
choices?: APIApplicationCommandOptionChoice[];
}
/**
* 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`, a `min_value` and `max_value` field
*/
export interface APIApplicationCommandNumberArgumentOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
/**
* 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 maximum value permitted
*/
max_value?: number;
autocomplete?: false;
}
export interface APIApplicationCommandArgumentOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type:
| ApplicationCommandOptionType.String
| ApplicationCommandOptionType.Integer
| ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
autocomplete?: false;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandStringAutocompleteOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.String;
autocomplete: true;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandNumericAutocompleteOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
autocomplete: true;
/**
* 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;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions` and `APIApplicationCommandArgumentOptions`,
* these types cannot have an `options` array, or a `choices` array, but they can have a `channel_types` one.
*/
export interface APIApplicationCommandChannelOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Channel;
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export enum ApplicationCommandOptionType {
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
Number,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
value: string | number;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
| ApplicationCommandInteractionDataOptionSubCommandGroup
| APIApplicationCommandInteractionDataOptionWithValues;
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.Subcommand;
options?: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubcommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionString
| ApplicationCommandInteractionDataOptionRole
| ApplicationCommandInteractionDataOptionChannel
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| ApplicationCommandInteractionDataOptionNumber
| ApplicationCommandInteractionDataOptionBoolean;
export interface ApplicationCommandInteractionDataOptionString
extends InteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
focused?: boolean;
}
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 interface ApplicationCommandInteractionDataOptionInteger
extends InteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
focused?: boolean;
}
export interface ApplicationCommandInteractionDataOptionNumber
extends InteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
focused?: boolean;
}
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
name: string;
type: T;
value: D;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export interface APIChatInputApplicationCommandInteractionData
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.ChatInput> {
options?: APIApplicationCommandInteractionDataOption[];
resolved?: APIChatInputApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
*/
export interface APIChatInputApplicationCommandInteractionDataResolved {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandInteraction =
APIApplicationCommandInteractionWrapper<APIChatInputApplicationCommandInteractionData>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandDMInteraction =
APIDMInteractionWrapper<APIChatInputApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandGuildInteraction =
APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;

View File

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

View File

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

View File

@@ -0,0 +1,49 @@
import type { Snowflake } from '../../../../globals.ts';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure
*/
export interface APIGuildApplicationCommandPermissions {
/**
* The id of the command
*/
id: Snowflake;
/**
* The id of the application the command belongs to
*/
application_id: Snowflake;
/**
* The id of the guild
*/
guild_id: Snowflake;
/**
* The permissions for the command in the guild
*/
permissions: APIApplicationCommandPermission[];
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure
*/
export interface APIApplicationCommandPermission {
/**
* The id of the role or user
*/
id: Snowflake;
/**
* Role or user
*/
type: ApplicationCommandPermissionType;
/**
* `true` to allow, `false`, to disallow
*/
permission: boolean;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type
*/
export enum ApplicationCommandPermissionType {
Role = 1,
User,
}

View File

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

View File

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

View File

@@ -1,11 +1,11 @@
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { InteractionType } from '../../v8.ts';
import type { InteractionType } from './responses.ts';
import type { APIMessage } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIUser } from '../user.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#message-interaction-object-message-interaction-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object
*/
export interface APIMessageInteraction {
/**
@@ -37,7 +37,7 @@ export interface APIInteractionGuildMember extends APIGuildMember {
// INTERACTIONS RECEIVED
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
/**

View File

@@ -1,29 +1,37 @@
import type { MessageFlags } from '../mod.ts';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8.ts';
import type { APIApplicationCommandOptionChoice } from './applicationCommands.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-request-type
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
*/
export enum InteractionType {
Ping = 1,
ApplicationCommand,
MessageComponent,
ApplicationCommandAutocomplete,
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object
*/
export type APIInteractionResponse =
| APIInteractionResponsePong
| 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;
@@ -44,7 +52,7 @@ export interface APIInteractionResponseUpdateMessage {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object-interaction-callback-type
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
*/
export enum InteractionResponseType {
/**
@@ -67,12 +75,20 @@ export enum InteractionResponseType {
* ACK a button interaction and edit the message to which the button was attached
*/
UpdateMessage,
/**
* For autocomplete interactions
*/
ApplicationCommandAutocompleteResult,
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object-interaction-application-command-callback-data-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure
*/
export type APIInteractionResponseCallbackData = Omit<
RESTPostAPIWebhookWithTokenJSONBody,
'username' | 'avatar_url'
> & { flags?: MessageFlags };
export interface APICommandAutocompleteInteractionResponseCallbackData {
choices?: APIApplicationCommandOptionChoice[];
}

View File

@@ -1,273 +0,0 @@
import type { APIRole, APIUser } from '../mod.ts';
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { APIPartialChannel } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
import type { InteractionType } from './responses.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object
*/
export interface APIApplicationCommand {
/**
* Unique id of the command
*/
id: Snowflake;
/**
* Unique id of the parent application
*/
application_id: Snowflake;
/**
* Guild id of the command, if not global
*/
guild_id?: Snowflake;
/**
* 1-32 character name matching `^[\w-]{1,32}$`
*/
name: string;
/**
* 1-100 character description
*/
description: string;
/**
* The parameters for the command
*/
options?: APIApplicationCommandOption[];
/**
* Whether the command is enabled by default when the app is added to a guild
*
* If missing, this property should be assumed as `true`
*/
default_permission?: boolean;
}
interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Channel
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
description: string;
default?: boolean;
required?: boolean;
}
/**
* https://discord.com/developers/docs/interactions/slash-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;
choices?: APIApplicationCommandOptionChoice[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-type
*/
export enum ApplicationCommandOptionType {
SubCommand = 1,
SubCommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
value: string | number;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-structure
*/
export interface APIApplicationCommandInteractionData {
id: Snowflake;
name: string;
options?: APIApplicationCommandInteractionDataOption[];
resolved?: {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
};
}
/**
* https://discord.com/developers/docs/resources/channel#channel-object
*/
export interface APIInteractionDataResolvedChannel extends Required<APIPartialChannel> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIInteractionDataResolvedGuildMember extends Omit<APIGuildMember, 'user' | 'deaf' | 'mute'> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
| ApplicationCommandInteractionDataOptionSubCommandGroup
| APIApplicationCommandInteractionDataOptionWithValues;
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.SubCommand;
options: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubCommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionString
| ApplicationCommandInteractionDataOptionRole
| ApplicationCommandInteractionDataOptionChannel
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| 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 ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
name: string;
type: T;
value: D;
}
// PERMISSIONS
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure
*/
export interface APIGuildApplicationCommandPermissions {
/**
* The id of the command
*/
id: Snowflake;
/**
* The id of the application the command belongs to
*/
application_id: Snowflake;
/**
* The id of the guild
*/
guild_id: Snowflake;
/**
* The permissions for the command in the guild
*/
permissions: APIApplicationCommandPermission[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-application-command-permissions-structure
*/
export interface APIApplicationCommandPermission {
/**
* The id of the role or user
*/
id: Snowflake;
/**
* Role or user
*/
type: ApplicationCommandPermissionType;
/**
* `true` to allow, `false`, to disallow
*/
permission: boolean;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#applicationcommandpermissiontype
*/
export enum ApplicationCommandPermissionType {
Role = 1,
User,
}
// INTERACTIONS
export type APIApplicationCommandInteraction = APIBaseInteraction<
InteractionType.ApplicationCommand,
APIApplicationCommandInteractionData
> &
Required<
Pick<
APIBaseInteraction<InteractionType.ApplicationCommand, APIApplicationCommandInteractionData>,
'channel_id' | 'data'
>
>;
export type APIApplicationCommandDMInteraction = APIDMInteractionWrapper<APIApplicationCommandInteraction>;
export type APIApplicationCommandGuildInteraction = APIGuildInteractionWrapper<APIApplicationCommandInteraction>;

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,7 @@ 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 { GuildScheduledEventEntityType, GuildScheduledEventStatus } from './guildScheduledEvent.ts';
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
@@ -144,6 +145,10 @@ export enum AuditLogEvent {
StickerCreate = 90,
StickerUpdate,
StickerDelete,
GuildScheduledEventCreate = 100,
GuildScheduledEventUpdate,
GuildScheduledEventDelete,
}
/**
@@ -302,7 +307,10 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildId;
| APIAuditLogChangeKeyGuildId
| APIAuditLogChangeKeyEntityType
| APIAuditLogChangeKeyStatus
| APIAuditLogChangeKeyLocation;
/**
* Returned when an entity's name is changed
@@ -310,7 +318,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 +510,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>;
@@ -544,7 +552,7 @@ export type APIAuditLogChangeKeyMute = AuditLogChangeData<'mute', boolean>;
/**
* Returned when a user's nick is changed
*/
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', boolean>;
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', string>;
/**
* Returned when a user's avatar_hash is changed
@@ -582,7 +590,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,6 +619,21 @@ export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', bool
*/
export type APIAuditLogChangeKeyGuildId = AuditLogChangeData<'guild_id', Snowflake>;
/**
* 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 extends unknown> {
key: K;
/**

View File

@@ -382,8 +382,9 @@ export enum MessageType {
GuildDiscoveryGracePeriodInitialWarning,
GuildDiscoveryGracePeriodFinalWarning,
Reply = 19,
ApplicationCommand,
ChatInputCommand,
GuildInviteReminder = 22,
ContextMenuCommand,
}
/**
@@ -659,7 +660,7 @@ export interface APIEmbedThumbnail {
/**
* Source url of thumbnail (only supports http(s) and attachments)
*/
url?: string;
url: string;
/**
* A proxied url of the thumbnail
*/
@@ -699,7 +700,7 @@ export interface APIEmbedImage {
/**
* Source url of image (only supports http(s) and attachments)
*/
url?: string;
url: string;
/**
* A proxied url of the image
*/
@@ -737,7 +738,7 @@ export interface APIEmbedAuthor {
*
* Length limit: 256 characters
*/
name?: string;
name: string;
/**
* URL of author
*/
@@ -806,6 +807,10 @@ export interface APIAttachment {
* Name of file attached
*/
filename: string;
/**
* Description for the file
*/
description?: string;
/**
* The attachment's media type
*
@@ -832,6 +837,10 @@ export interface APIAttachment {
* Width of file (if image)
*/
width?: number | null;
/**
* Whether this attachment is ephemeral
*/
ephemeral?: boolean;
}
/**
@@ -955,13 +964,28 @@ interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseMessa
/**
* The emoji to display to the left of the text
*/
emoji?: APIPartialEmoji;
emoji?: APIMessageComponentEmoji;
/**
* The status of the button
*/
disabled?: boolean;
}
export interface APIMessageComponentEmoji {
/**
* Emoji id
*/
id?: Snowflake;
/**
* Emoji name
*/
name?: string;
/**
* Whether this emoji is animated
*/
animated?: boolean;
}
export interface APIButtonComponentWithCustomId
extends APIButtonComponentBase<
ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger
@@ -1003,7 +1027,7 @@ export interface APISelectMenuComponent extends APIBaseMessageComponent<Componen
/**
* The choices in the select, max 25
*/
options: APISelectMenuOption[];
options?: APISelectMenuOption[];
/**
* Custom placeholder text if nothing is selected, max 100 characters
*/
@@ -1047,7 +1071,7 @@ export interface APISelectMenuOption {
/**
* The emoji to display to the left of the option
*/
emoji?: APIPartialEmoji;
emoji?: APIMessageComponentEmoji;
/**
* Whether this option should be already-selected by default
*/

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,14 @@ export interface APIGuild extends APIPartialGuild {
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
stickers: APISticker[];
/**
* 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 +423,10 @@ export enum GuildSystemChannelFlags {
* Suppress server setup tips
*/
SuppressGuildReminderNotifications = 1 << 2,
/**
* Hide member join sticker reply buttons
*/
SuppressJoinNotificationReplies = 1 << 3,
}
/**
@@ -448,6 +461,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 +481,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 +522,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 +610,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
*

View File

@@ -0,0 +1,104 @@
import type { APIUser } from './user.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,
}

View File

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

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
@@ -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

@@ -94,15 +94,15 @@ export enum OAuth2Scopes {
*/
ActivitiesWrite = 'activities.write',
/**
* Allows your app to use Slash Commands in a guild
* Allows your app to use Application Commands in a guild
*
* See https://discord.com/developers/docs/interactions/slash-commands
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommands = 'applications.commands',
/**
* Allows your app to update its Slash Commands via this bearer token - client credentials grant only
* Allows your app to update its Application Commands via this bearer token - client credentials grant only
*
* See https://discord.com/developers/docs/interactions/slash-commands
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommandsUpdate = 'applications.commands.update',
}

View File

@@ -43,9 +43,11 @@ export const PermissionFlagsBits = {
ManageRoles: 1n << 28n,
ManageWebhooks: 1n << 29n,
ManageEmojisAndStickers: 1n << 30n,
UseSlashCommands: 1n << 31n,
UseApplicationCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
ManageEvents: 1n << 33n,
UseExternalStickers: 1n << 37n,
StartEmbeddedActivities: 1n << 39n,
} as const;
/**
@@ -74,6 +76,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

@@ -39,6 +39,16 @@ export interface APIUser {
* Whether the user has two factor enabled on their account
*/
mfa_enabled?: boolean;
/**
* The user's banner hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
banner?: string | null;
/**
* The user's banner color encoded as an integer representation of hexadecimal color code
*/
accent_color?: number | null;
/**
* The user's chosen language option
*/
@@ -75,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,262 @@
import type { APIRole, APIUser, ChannelType } from '../../mod.ts';
import type { Snowflake } from '../../../../globals.ts';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands.ts';
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
description: string;
required?: boolean;
autocomplete?: never;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandOption =
| APIApplicationCommandStringArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandOptionBase
| APIApplicationCommandChannelOptions
| APIApplicationCommandOptionBase
| APIApplicationCommandNumberArgumentOptions
| APIApplicationCommandStringAutocompleteOptions
| APIApplicationCommandNumericAutocompleteOptions;
/**
* 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 either a `choices` or a `autocomplete` field where it's set to false.
*/
export interface APIApplicationCommandStringArgumentOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type:
| ApplicationCommandOptionType.String
| ApplicationCommandOptionType.Integer
| ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
autocomplete?: false;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandStringAutocompleteOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.String;
autocomplete: true;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandNumericAutocompleteOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
autocomplete: true;
/**
* 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;
}
/**
* 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`, a `min_value` and `max_value` field
*/
export interface APIApplicationCommandNumberArgumentOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
/**
* 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 maximum value permitted
*/
max_value?: number;
autocomplete?: false;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions` and `APIApplicationCommandArgumentOptions`,
* these types cannot have an `options` array, or a `choices` array, but they can have a `channel_types` one.
*/
export interface APIApplicationCommandChannelOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Channel;
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export enum ApplicationCommandOptionType {
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
Number,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
value: string | number;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
| ApplicationCommandInteractionDataOptionSubCommandGroup
| APIApplicationCommandInteractionDataOptionWithValues;
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.Subcommand;
options?: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubcommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionString
| ApplicationCommandInteractionDataOptionRole
| ApplicationCommandInteractionDataOptionChannel
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| ApplicationCommandInteractionDataOptionNumber
| ApplicationCommandInteractionDataOptionBoolean;
export interface ApplicationCommandInteractionDataOptionString
extends InteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
focused?: boolean;
}
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 interface ApplicationCommandInteractionDataOptionInteger
extends InteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
focused?: boolean;
}
export interface ApplicationCommandInteractionDataOptionNumber
extends InteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
focused?: boolean;
}
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
name: string;
type: T;
value: D;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export interface APIChatInputApplicationCommandInteractionData
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.ChatInput> {
options?: APIApplicationCommandInteractionDataOption[];
resolved?: APIChatInputApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
*/
export interface APIChatInputApplicationCommandInteractionDataResolved {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandInteraction =
APIApplicationCommandInteractionWrapper<APIChatInputApplicationCommandInteractionData>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandDMInteraction =
APIDMInteractionWrapper<APIChatInputApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandGuildInteraction =
APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;

View File

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

View File

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

View File

@@ -0,0 +1,49 @@
import type { Snowflake } from '../../../../globals.ts';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure
*/
export interface APIGuildApplicationCommandPermissions {
/**
* The id of the command
*/
id: Snowflake;
/**
* The id of the application the command belongs to
*/
application_id: Snowflake;
/**
* The id of the guild
*/
guild_id: Snowflake;
/**
* The permissions for the command in the guild
*/
permissions: APIApplicationCommandPermission[];
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure
*/
export interface APIApplicationCommandPermission {
/**
* The id of the role or user
*/
id: Snowflake;
/**
* Role or user
*/
type: ApplicationCommandPermissionType;
/**
* `true` to allow, `false`, to disallow
*/
permission: boolean;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type
*/
export enum ApplicationCommandPermissionType {
Role = 1,
User,
}

View File

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

View File

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

View File

@@ -1,11 +1,11 @@
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { InteractionType } from '../../v9.ts';
import type { InteractionType } from './responses.ts';
import type { APIMessage } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIUser } from '../user.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#message-interaction-object-message-interaction-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object
*/
export interface APIMessageInteraction {
/**
@@ -37,7 +37,7 @@ export interface APIInteractionGuildMember extends APIGuildMember {
// INTERACTIONS RECEIVED
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
/**

View File

@@ -1,29 +1,37 @@
import type { MessageFlags } from '../mod.ts';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9.ts';
import type { APIApplicationCommandOptionChoice } from './applicationCommands.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-request-type
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
*/
export enum InteractionType {
Ping = 1,
ApplicationCommand,
MessageComponent,
ApplicationCommandAutocomplete,
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object
*/
export type APIInteractionResponse =
| APIInteractionResponsePong
| 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;
@@ -44,7 +52,7 @@ export interface APIInteractionResponseUpdateMessage {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object-interaction-callback-type
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
*/
export enum InteractionResponseType {
/**
@@ -67,12 +75,20 @@ export enum InteractionResponseType {
* ACK a button interaction and edit the message to which the button was attached
*/
UpdateMessage,
/**
* For autocomplete interactions
*/
ApplicationCommandAutocompleteResult,
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object-interaction-application-command-callback-data-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure
*/
export type APIInteractionResponseCallbackData = Omit<
RESTPostAPIWebhookWithTokenJSONBody,
'username' | 'avatar_url'
> & { flags?: MessageFlags };
export interface APICommandAutocompleteInteractionResponseCallbackData {
choices?: APIApplicationCommandOptionChoice[];
}

View File

@@ -1,273 +0,0 @@
import type { APIRole, APIUser } from '../mod.ts';
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { APIPartialChannel } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
import type { InteractionType } from './responses.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object
*/
export interface APIApplicationCommand {
/**
* Unique id of the command
*/
id: Snowflake;
/**
* Unique id of the parent application
*/
application_id: Snowflake;
/**
* Guild id of the command, if not global
*/
guild_id?: Snowflake;
/**
* 1-32 character name matching `^[\w-]{1,32}$`
*/
name: string;
/**
* 1-100 character description
*/
description: string;
/**
* The parameters for the command
*/
options?: APIApplicationCommandOption[];
/**
* Whether the command is enabled by default when the app is added to a guild
*
* If missing, this property should be assumed as `true`
*/
default_permission?: boolean;
}
interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Channel
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
description: string;
default?: boolean;
required?: boolean;
}
/**
* https://discord.com/developers/docs/interactions/slash-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;
choices?: APIApplicationCommandOptionChoice[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-type
*/
export enum ApplicationCommandOptionType {
SubCommand = 1,
SubCommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
value: string | number;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-structure
*/
export interface APIApplicationCommandInteractionData {
id: Snowflake;
name: string;
options?: APIApplicationCommandInteractionDataOption[];
resolved?: {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
};
}
/**
* https://discord.com/developers/docs/resources/channel#channel-object
*/
export interface APIInteractionDataResolvedChannel extends Required<APIPartialChannel> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIInteractionDataResolvedGuildMember extends Omit<APIGuildMember, 'user' | 'deaf' | 'mute'> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
| ApplicationCommandInteractionDataOptionSubCommandGroup
| APIApplicationCommandInteractionDataOptionWithValues;
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.SubCommand;
options: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubCommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionString
| ApplicationCommandInteractionDataOptionRole
| ApplicationCommandInteractionDataOptionChannel
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| 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 ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
name: string;
type: T;
value: D;
}
// PERMISSIONS
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure
*/
export interface APIGuildApplicationCommandPermissions {
/**
* The id of the command
*/
id: Snowflake;
/**
* The id of the application the command belongs to
*/
application_id: Snowflake;
/**
* The id of the guild
*/
guild_id: Snowflake;
/**
* The permissions for the command in the guild
*/
permissions: APIApplicationCommandPermission[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-application-command-permissions-structure
*/
export interface APIApplicationCommandPermission {
/**
* The id of the role or user
*/
id: Snowflake;
/**
* Role or user
*/
type: ApplicationCommandPermissionType;
/**
* `true` to allow, `false`, to disallow
*/
permission: boolean;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#applicationcommandpermissiontype
*/
export enum ApplicationCommandPermissionType {
Role = 1,
User,
}
// INTERACTIONS
export type APIApplicationCommandInteraction = APIBaseInteraction<
InteractionType.ApplicationCommand,
APIApplicationCommandInteractionData
> &
Required<
Pick<
APIBaseInteraction<InteractionType.ApplicationCommand, APIApplicationCommandInteractionData>,
'channel_id' | 'data'
>
>;
export type APIApplicationCommandDMInteraction = APIDMInteractionWrapper<APIApplicationCommandInteraction>;
export type APIApplicationCommandGuildInteraction = APIGuildInteractionWrapper<APIApplicationCommandInteraction>;

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

@@ -3,7 +3,7 @@
*/
import type { Snowflake } from '../../globals.ts';
import type { APIOverwrite } from './channel.ts';
import type { APIChannel, APIOverwrite } from './channel.ts';
import type {
APIGuildIntegration,
GuildDefaultMessageNotifications,
@@ -17,6 +17,7 @@ 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 { GuildScheduledEventEntityType, GuildScheduledEventStatus } from './guildScheduledEvent.ts';
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
@@ -46,6 +47,14 @@ export interface APIAuditLog {
* See https://discord.com/developers/docs/resources/guild#integration-object
*/
integrations: APIGuildIntegration[];
/**
* Threads found in the audit log
*
* Threads referenced in THREAD_CREATE and THREAD_UPDATE events are included in the threads map, since archived threads might not be kept in memory by clients.
*
* See https://discord.com/developers/docs/resources/channel#channel-object
*/
threads: APIChannel[];
}
/**
@@ -144,6 +153,14 @@ export enum AuditLogEvent {
StickerCreate = 90,
StickerUpdate,
StickerDelete,
GuildScheduledEventCreate = 100,
GuildScheduledEventUpdate,
GuildScheduledEventDelete,
ThreadCreate = 110,
ThreadUpdate,
ThreadDelete,
}
/**
@@ -302,7 +319,14 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildId;
| APIAuditLogChangeKeyGuildId
| APIAuditLogChangeKeyArchived
| APIAuditLogChangeKeyLocked
| APIAuditLogChangeKeyAutoArchiveDuration
| APIAuditLogChangeKeyDefaultAutoArchiveDuration
| APIAuditLogChangeKeyEntityType
| APIAuditLogChangeKeyStatus
| APIAuditLogChangeKeyLocation;
/**
* Returned when an entity's name is changed
@@ -310,7 +334,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 +526,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>;
@@ -544,7 +568,7 @@ export type APIAuditLogChangeKeyMute = AuditLogChangeData<'mute', boolean>;
/**
* Returned when a user's nick is changed
*/
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', boolean>;
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', string>;
/**
* Returned when a user's avatar_hash is changed
@@ -582,7 +606,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,6 +635,44 @@ export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', bool
*/
export type APIAuditLogChangeKeyGuildId = AuditLogChangeData<'guild_id', Snowflake>;
/*
* Returned when a thread's archive status is changed
*/
export type APIAuditLogChangeKeyArchived = AuditLogChangeData<'archived', boolean>;
/*
* Returned when a thread's lock status is changed
*/
export type APIAuditLogChangeKeyLocked = AuditLogChangeData<'locked', boolean>;
/*
* Returned when a thread's auto archive duration is changed
*/
export type APIAuditLogChangeKeyAutoArchiveDuration = AuditLogChangeData<'auto_archive_duration', number>;
/*
* Returned when a channel's default auto archive duration for newly created threads is changed
*/
export type APIAuditLogChangeKeyDefaultAutoArchiveDuration = AuditLogChangeData<
'default_auto_archive_duration',
number
>;
/**
* 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 extends unknown> {
key: K;
/**

View File

@@ -72,6 +72,11 @@ export interface APIChannel extends APIPartialChannel {
/**
* Amount of seconds a user has to wait before sending another message (0-21600);
* bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`, are unaffected
*
* `rate_limit_per_user` also applies to thread creation. Users can send one message and create one thread during each `rate_limit_per_user` interval.
*
* For thread channels, `rate_limit_per_user` is only returned if the field is set to a non-zero and non-null value.
* The absence of this field in API calls and Gateway events should indicate that slowmode has been reset to the default value.
*/
rate_limit_per_user?: number;
/**
@@ -423,9 +428,10 @@ export enum MessageType {
GuildDiscoveryGracePeriodFinalWarning,
ThreadCreated,
Reply,
ApplicationCommand,
ChatInputCommand,
ThreadStarterMessage,
GuildInviteReminder,
ContextMenuCommand,
}
/**
@@ -603,6 +609,10 @@ export interface APIThreadMetadata {
* Whether the thread is locked; when a thread is locked, only users with `MANAGE_THREADS` can unarchive it
*/
locked?: boolean;
/**
* Whether non-moderators can add other non-moderators to the thread; only available on private threads
*/
invitable?: boolean;
}
export enum ThreadAutoArchiveDuration {
@@ -779,7 +789,7 @@ export interface APIEmbedThumbnail {
/**
* Source url of thumbnail (only supports http(s) and attachments)
*/
url?: string;
url: string;
/**
* A proxied url of the thumbnail
*/
@@ -819,7 +829,7 @@ export interface APIEmbedImage {
/**
* Source url of image (only supports http(s) and attachments)
*/
url?: string;
url: string;
/**
* A proxied url of the image
*/
@@ -857,7 +867,7 @@ export interface APIEmbedAuthor {
*
* Length limit: 256 characters
*/
name?: string;
name: string;
/**
* URL of author
*/
@@ -926,6 +936,10 @@ export interface APIAttachment {
* Name of file attached
*/
filename: string;
/**
* Description for the file
*/
description?: string;
/**
* The attachment's media type
*
@@ -952,6 +966,10 @@ export interface APIAttachment {
* Width of file (if image)
*/
width?: number | null;
/**
* Whether this attachment is ephemeral
*/
ephemeral?: boolean;
}
/**
@@ -1075,13 +1093,28 @@ interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseMessa
/**
* The emoji to display to the left of the text
*/
emoji?: APIPartialEmoji;
emoji?: APIMessageComponentEmoji;
/**
* The status of the button
*/
disabled?: boolean;
}
export interface APIMessageComponentEmoji {
/**
* Emoji id
*/
id?: Snowflake;
/**
* Emoji name
*/
name?: string;
/**
* Whether this emoji is animated
*/
animated?: boolean;
}
export interface APIButtonComponentWithCustomId
extends APIButtonComponentBase<
ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger
@@ -1123,7 +1156,7 @@ export interface APISelectMenuComponent extends APIBaseMessageComponent<Componen
/**
* The choices in the select, max 25
*/
options: APISelectMenuOption[];
options?: APISelectMenuOption[];
/**
* Custom placeholder text if nothing is selected, max 100 characters
*/
@@ -1167,7 +1200,7 @@ export interface APISelectMenuOption {
/**
* The emoji to display to the left of the option
*/
emoji?: APIPartialEmoji;
emoji?: APIMessageComponentEmoji;
/**
* Whether this option should be already-selected by default
*/

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 {
@@ -331,11 +334,9 @@ export interface GatewayThreadListSync {
/**
* The member objects for the client user in each joined thread that was synced
*/
members: Record<Snowflake, GatewayThreadListSyncMember>;
members: APIThreadMember[];
}
export type GatewayThreadListSyncMember = Omit<APIThreadMember, 'id' | 'user_id'>;
/**
* https://discord.com/developers/docs/topics/gateway#thread-members-update-thread-members-update-event-fields
*/

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,14 @@ export interface APIGuild extends APIPartialGuild {
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
stickers: APISticker[];
/**
* 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 +431,10 @@ export enum GuildSystemChannelFlags {
* Suppress server setup tips
*/
SuppressGuildReminderNotifications = 1 << 2,
/**
* Hide member join sticker reply buttons
*/
SuppressJoinNotificationReplies = 1 << 3,
}
/**
@@ -456,6 +469,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 +489,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 +530,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 +618,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
*

View File

@@ -0,0 +1,104 @@
import type { APIUser } from './user.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,
}

View File

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

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
@@ -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

@@ -94,15 +94,15 @@ export enum OAuth2Scopes {
*/
ActivitiesWrite = 'activities.write',
/**
* Allows your app to use Slash Commands in a guild
* Allows your app to use Application Commands in a guild
*
* See https://discord.com/developers/docs/interactions/slash-commands
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommands = 'applications.commands',
/**
* Allows your app to update its Slash Commands via this bearer token - client credentials grant only
* Allows your app to update its Application Commands via this bearer token - client credentials grant only
*
* See https://discord.com/developers/docs/interactions/slash-commands
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommandsUpdate = 'applications.commands.update',
}

View File

@@ -43,12 +43,15 @@ export const PermissionFlagsBits = {
ManageRoles: 1n << 28n,
ManageWebhooks: 1n << 29n,
ManageEmojisAndStickers: 1n << 30n,
UseSlashCommands: 1n << 31n,
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,
} as const;
/**
@@ -77,6 +80,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

@@ -39,6 +39,16 @@ export interface APIUser {
* Whether the user has two factor enabled on their account
*/
mfa_enabled?: boolean;
/**
* The user's banner hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
banner?: string | null;
/**
* The user's banner color encoded as an integer representation of hexadecimal color code
*/
accent_color?: number | null;
/**
* The user's chosen language option
*/
@@ -75,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

@@ -36,6 +36,9 @@ export enum RESTJSONErrorCodes {
UnknownGiftCode = 10038,
UnknownStream = 10049,
UnknownPremiumServerSubscribeCooldown,
UnknownGuildTemplate = 10057,
UnknownDiscoverableServerCategory = 10059,
@@ -48,6 +51,8 @@ export enum RESTJSONErrorCodes {
UnknownStageInstance,
UnknownGuildMemberVerificationForm,
UnknownGuildWelcomeScreen,
UnknownGuildScheduledEvent,
UnknownGuildScheduledEventUser,
BotsCannotUseThisEndpoint = 20001,
OnlyBotsCanUseThisEndpoint,
@@ -57,8 +62,8 @@ export enum RESTJSONErrorCodes {
NotAuthorizedToPerformThisActionOnThisApplication = 20012,
ActionCannotBePerformedDueToSlowmodeRateLimit = 20016,
OnlyTheOwnerOfThisAccountCanPerformThisAction = 20018,
TheMazeIsntMeantForYou,
OnlyTheOwnerOfThisAccountCanPerformThisAction,
AnnouncementEditLimitExceeded = 20022,
@@ -96,8 +101,10 @@ export enum RESTJSONErrorCodes {
MaximumNumberOfNonGuildMemberBansHasBeenExceeded = 30035,
MaximumNumberOfBanFetchesHasBeenReached = 30037,
MaximumNumberOfUncompletedGuildScheduledEventsReached,
MaximumNumberOfStickersReached = 30039,
MaximumNumberOfPruneRequestsHasBeenReached,
Unauthorized = 40001,
VerifyYourAccount,
@@ -135,6 +142,7 @@ export enum RESTJSONErrorCodes {
CannotExecuteActionOnThisChannelType = 50024,
InvalidOAuth2AccessToken,
MissingRequiredOAuth2Scope,
InvalidWebhookToken = 50027,
InvalidRole,
@@ -149,7 +157,9 @@ export enum RESTJSONErrorCodes {
FileUploadedExceedsMaximumSize = 50045,
InvalidFileUploaded,
CannotSelfRedeemThisGift = 50070,
CannotSelfRedeemThisGift = 50054,
PaymentSourceRequiredToRedeemGift = 50070,
CannotDeleteChannelRequiredForCommunityGuilds = 50074,
@@ -159,6 +169,12 @@ export enum RESTJSONErrorCodes {
InvalidThreadNotificationSettings,
ParameterEarlierThanCreation,
ServerNotAvailableInYourLocation = 50095,
ServerNeedsMonetizationEnabledToPerformThisAction = 50097,
ServerNeedsMoreBoostsToPerformThisAction = 50101,
TwoFactorAuthenticationIsRequired = 60003,
NoUsersWithDiscordTagExist = 80004,
@@ -169,6 +185,8 @@ export enum RESTJSONErrorCodes {
TheStageIsAlreadyOpen = 150006,
CannotReplyWithoutPermissionToReadMessageHistory = 160002,
ThreadAlreadyCreatedForMessage = 160004,
ThreadLocked,
MaximumActiveThreads,
@@ -181,4 +199,8 @@ export enum RESTJSONErrorCodes {
LottieAnimationMaximumDimensionsExceeded,
StickerFramerateIsTooSmallOrTooLarge,
StickerAnimationDurationExceedsMaximumOf5Seconds,
CannotUpdateAFinishedEvent = 180000,
FailedToCreateStageNeededForStageEvent = 180002,
}

View File

@@ -214,28 +214,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
@@ -332,6 +327,8 @@ 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;
@@ -347,22 +344,13 @@ export interface RESTPatchAPIChannelMessageJSONBody {
* 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
*/

View File

@@ -525,6 +525,14 @@ 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
*
@@ -577,6 +585,14 @@ 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
*/

View File

@@ -0,0 +1,150 @@
import type { Snowflake } from '../../globals.ts';
import type {
APIGuildScheduledEvent,
GuildScheduledEventEntityType,
GuildScheduledEventPrivacyLevel,
APIGuildScheduledEventEntityMetadata,
GuildScheduledEventStatus,
APIGuildMember,
APIUser,
} from '../../payloads/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 interface RESTPostAPIGuildScheduledEventJSONBody {
/**
* 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 interface RESTPatchAPIGuildScheduledEventJSONBody extends Partial<RESTPostAPIGuildScheduledEventJSONBody> {
/**
* 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[];
/**
* 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

@@ -4,6 +4,7 @@ import type {
APIGuildApplicationCommandPermissions,
APIInteractionResponse,
APIInteractionResponseCallbackData,
ApplicationCommandType,
} from '../../payloads/v8/mod.ts';
import type {
RESTDeleteAPIWebhookWithTokenMessageResult,
@@ -15,216 +16,224 @@ import type {
} from './webhook.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands
*/
export type RESTGetAPIApplicationCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#get-global-application-command
*/
export type RESTGetAPIApplicationCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsJSONBody = Omit<APIApplicationCommand, 'id' | 'application_id'>;
type RESTPostAPIBaseApplicationCommandsJSONBody = Omit<
APIApplicationCommand,
'id' | 'application_id' | 'description' | 'type' | 'version'
>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type?: ApplicationCommandType.ChatInput;
/**
* Whether this application command option should be autocompleted
*/
autocomplete?: boolean;
description: string;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type: ApplicationCommandType.User | ApplicationCommandType.Message;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsJSONBody =
| RESTPostAPIChatInputApplicationCommandsJSONBody
| RESTPostAPIContextMenuApplicationCommandsJSONBody;
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-commands
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands
*/
export type RESTGetAPIApplicationGuildCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands
*/
export type RESTGetAPIApplicationGuildCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command
*/
export type RESTPostAPIApplicationGuildCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command
*/
export type RESTPostAPIApplicationGuildCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackJSONBody = APIInteractionResponse;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
* 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/slash-commands#get-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
*/
export type RESTGetAPIInteractionOriginalResponseResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response
*/
export type RESTDeleteAPIInteractionOriginalResponseResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupJSONBody = APIInteractionResponseCallbackData;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* 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/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupResult = RESTPostAPIWebhookWithTokenWaitResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-followup-message
*/
export type RESTGetAPIInteractionFollowupResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message
*/
export type RESTDeleteAPIInteractionFollowupResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions
*/
export type RESTGetAPIGuildApplicationCommandsPermissionsResult = APIGuildApplicationCommandPermissions[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions
*/
export type RESTGetAPIApplicationCommandPermissionsResult = APIGuildApplicationCommandPermissions;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions
*/
export interface RESTPutAPIApplicationCommandPermissionsJSONBody {
permissions: APIApplicationCommandPermission[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions
*/
export type RESTPutAPIApplicationCommandPermissionsResult = APIGuildApplicationCommandPermissions;
/**
* https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions
*/
export type RESTPutAPIGuildApplicationCommandsPermissionsJSONBody = Pick<
APIGuildApplicationCommandPermissions,
@@ -232,6 +241,6 @@ export type RESTPutAPIGuildApplicationCommandsPermissionsJSONBody = Pick<
>[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions
*/
export type RESTPutAPIGuildApplicationCommandsPermissionsResult = APIGuildApplicationCommandPermissions[];

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';
@@ -569,6 +570,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 +739,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,12 +780,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

@@ -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
@@ -235,6 +230,8 @@ export interface RESTPatchAPIWebhookWithTokenMessageJSONBody
/**
* 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;
@@ -244,22 +241,13 @@ export interface RESTPatchAPIWebhookWithTokenMessageJSONBody
* 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

@@ -130,6 +130,12 @@ export interface RESTPatchAPIChannelJSONBody {
* Channel types: text, news
*/
default_auto_archive_duration?: ThreadAutoArchiveDuration;
/**
* Whether non-moderators can add other non-moderators to the thread
*
* Channel types: privateThread
*/
invitable?: boolean;
}
/**
@@ -242,28 +248,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
@@ -360,6 +361,8 @@ 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;
@@ -375,22 +378,13 @@ export interface RESTPatchAPIChannelMessageJSONBody {
* 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
@@ -577,8 +571,14 @@ export interface RESTPostAPIChannelMessagesThreadsJSONBody {
name: string;
/**
* The amount of time in minutes to wait before automatically archiving the thread
*
* 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;
}
/**
@@ -592,8 +592,19 @@ export type RESTPostAPIChannelMessagesThreadsResult = APIChannel;
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;
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;
}
/**
@@ -632,6 +643,8 @@ export interface RESTGetAPIChannelThreadsArchivedQuery {
/**
* https://discord.com/developers/docs/resources/channel#list-active-threads
*
* @deprecated Use [List Active Guild Threads](https://discord.com/developers/docs/resources/guild#list-active-threads) instead. Will be removed in v10.
*/
export type RESTGetAPIChannelThreadsResult = APIThreadList;

View File

@@ -12,6 +12,7 @@ import type {
APIGuildWidget,
APIGuildWidgetSettings,
APIRole,
APIThreadList,
APIVoiceRegion,
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
@@ -303,6 +304,11 @@ export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<{
*/
export type RESTPatchAPIGuildChannelPositionsResult = never;
/**
* https://discord.com/developers/docs/resources/guild#list-active-threads
*/
export type RESTGetAPIGuildThreadsResult = Omit<APIThreadList, 'has_more'>;
/**
* https://discord.com/developers/docs/resources/guild#get-guild-member
*/
@@ -525,6 +531,14 @@ 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
*
@@ -577,6 +591,14 @@ 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
*/

View File

@@ -0,0 +1,150 @@
import type { Snowflake } from '../../globals.ts';
import type {
APIGuildScheduledEvent,
GuildScheduledEventEntityType,
GuildScheduledEventPrivacyLevel,
APIGuildScheduledEventEntityMetadata,
GuildScheduledEventStatus,
APIGuildMember,
APIUser,
} from '../../payloads/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 interface RESTPostAPIGuildScheduledEventJSONBody {
/**
* 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 interface RESTPatchAPIGuildScheduledEventJSONBody extends Partial<RESTPostAPIGuildScheduledEventJSONBody> {
/**
* 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[];
/**
* 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

@@ -4,6 +4,7 @@ import type {
APIGuildApplicationCommandPermissions,
APIInteractionResponse,
APIInteractionResponseCallbackData,
ApplicationCommandType,
} from '../../payloads/v9/mod.ts';
import type {
RESTDeleteAPIWebhookWithTokenMessageResult,
@@ -15,216 +16,224 @@ import type {
} from './webhook.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands
*/
export type RESTGetAPIApplicationCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#get-global-application-command
*/
export type RESTGetAPIApplicationCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsJSONBody = Omit<APIApplicationCommand, 'id' | 'application_id'>;
type RESTPostAPIBaseApplicationCommandsJSONBody = Omit<
APIApplicationCommand,
'id' | 'application_id' | 'description' | 'type' | 'version'
>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type?: ApplicationCommandType.ChatInput;
/**
* Whether this application command option should be autocompleted
*/
autocomplete?: boolean;
description: string;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
type: ApplicationCommandType.User | ApplicationCommandType.Message;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsJSONBody =
| RESTPostAPIChatInputApplicationCommandsJSONBody
| RESTPostAPIContextMenuApplicationCommandsJSONBody;
/**
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
*/
export type RESTPostAPIApplicationCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
*/
export type RESTPatchAPIApplicationCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
*/
export type RESTPutAPIApplicationCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-commands
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands
*/
export type RESTGetAPIApplicationGuildCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands
*/
export type RESTGetAPIApplicationGuildCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command
*/
export type RESTPostAPIApplicationGuildCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command
*/
export type RESTPostAPIApplicationGuildCommandsResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
*/
export type RESTPatchAPIApplicationGuildCommandResult = APIApplicationCommand;
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsJSONBody = RESTPostAPIApplicationCommandsJSONBody[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#bulk-overwrite-global-application-commands
* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands
*/
export type RESTPutAPIApplicationGuildCommandsResult = APIApplicationCommand[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
*/
export type RESTPostAPIInteractionCallbackJSONBody = APIInteractionResponse;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
* 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/slash-commands#get-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
*/
export type RESTGetAPIInteractionOriginalResponseResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-original-interaction-response
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response
*/
export type RESTDeleteAPIInteractionOriginalResponseResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupJSONBody = APIInteractionResponseCallbackData;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
* 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/slash-commands#create-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
*/
export type RESTPostAPIInteractionFollowupResult = RESTPostAPIWebhookWithTokenWaitResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-followup-message
*/
export type RESTGetAPIInteractionFollowupResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-followup-message
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message
*/
export type RESTDeleteAPIInteractionFollowupResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions
*/
export type RESTGetAPIGuildApplicationCommandsPermissionsResult = APIGuildApplicationCommandPermissions[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions
*/
export type RESTGetAPIApplicationCommandPermissionsResult = APIGuildApplicationCommandPermissions;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions
*/
export interface RESTPutAPIApplicationCommandPermissionsJSONBody {
permissions: APIApplicationCommandPermission[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions
*/
export type RESTPutAPIApplicationCommandPermissionsResult = APIGuildApplicationCommandPermissions;
/**
* https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions
*/
export type RESTPutAPIGuildApplicationCommandsPermissionsJSONBody = Pick<
APIGuildApplicationCommandPermissions,
@@ -232,6 +241,6 @@ export type RESTPutAPIGuildApplicationCommandsPermissionsJSONBody = Pick<
>[];
/**
* https://discord.com/developers/docs/interactions/slash-commands#batch-edit-application-command-permissions
* https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions
*/
export type RESTPutAPIGuildApplicationCommandsPermissionsResult = APIGuildApplicationCommandPermissions[];

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';
@@ -435,9 +436,19 @@ export const Routes = {
return parts.join('/') as `/channels/${Snowflake}/threads` | `/channels/${Snowflake}/messages/${Snowflake}/threads`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/threads/active`
*/
guildActiveThreads(guildId: Snowflake) {
return `/guilds/${guildId}/threads/active` as const;
},
/**
* Route for:
* - GET `/channels/{channel.id}/threads/active`
* (deprecated, use [List Active Guild Threads](https://discord.com/developers/docs/resources/guild#list-active-threads) instead.
* Will be removed in v10.)
* - GET `/channels/{channel.id}/threads/archived/public`
* - GET `/channels/{channel.id}/threads/archived/private`
*/
@@ -456,13 +467,14 @@ export const Routes = {
* Route for:
* - GET `/channels/{channel.id}/users/@me/threads/archived/prviate`
*/
channelJoinedArhivedThreads(channelId: Snowflake) {
channelJoinedArchivedThreads(channelId: Snowflake) {
return `/channels/${channelId}/users/@me/threads/archived/private` as const;
},
/**
* 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`
@@ -627,6 +639,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`
@@ -772,6 +808,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 = {
@@ -786,12 +849,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

@@ -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
@@ -239,6 +234,8 @@ export interface RESTPatchAPIWebhookWithTokenMessageJSONBody
/**
* 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;
@@ -248,22 +245,13 @@ export interface RESTPatchAPIWebhookWithTokenMessageJSONBody
* 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

@@ -5,11 +5,11 @@
import type { Snowflake } from '../globals';
import type {
APIApplication,
APIApplicationCommand,
APIApplicationCommandInteraction,
APIChannel,
APIEmoji,
APIGuild,
APIGuildScheduledEvent,
APIGuildIntegration,
APIGuildMember,
APIMessage,
@@ -184,15 +184,13 @@ export const enum GatewayIntentBits {
DirectMessages = 1 << 12,
DirectMessageReactions = 1 << 13,
DirectMessageTyping = 1 << 14,
GuildScheduledEvents = 1 << 16,
}
/**
* https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
*/
export const enum GatewayDispatchEvents {
ApplicationCommandCreate = 'APPLICATION_COMMAND_CREATE',
ApplicationCommandDelete = 'APPLICATION_COMMAND_DELETE',
ApplicationCommandUpdate = 'APPLICATION_COMMAND_UPDATE',
ChannelCreate = 'CHANNEL_CREATE',
ChannelDelete = 'CHANNEL_DELETE',
ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE',
@@ -237,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 =
@@ -269,6 +272,11 @@ export type GatewayDispatchPayload =
| GatewayGuildModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayGuildRoleModifyDispatch
| GatewayGuildScheduledEventCreateDispatch
| GatewayGuildScheduledEventUpdateDispatch
| GatewayGuildScheduledEventDeleteDispatch
| GatewayGuildScheduledEventUserAddDispatch
| GatewayGuildScheduledEventUserRemoveDispatch
| GatewayGuildStickersUpdateDispatch
| GatewayIntegrationCreateDispatch
| GatewayIntegrationDeleteDispatch
@@ -298,55 +306,6 @@ export type GatewayDispatchPayload =
// #region Dispatch Payloads
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatch = DataPayload<
| GatewayDispatchEvents.ApplicationCommandCreate
| GatewayDispatchEvents.ApplicationCommandUpdate
| GatewayDispatchEvents.ApplicationCommandDelete,
GatewayApplicationCommandModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatchData = APIApplicationCommand;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#hello
*/
@@ -861,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
*/

View File

@@ -5,11 +5,11 @@
import type { Snowflake } from '../globals';
import type {
APIApplication,
APIApplicationCommand,
APIApplicationCommandInteraction,
APIChannel,
APIEmoji,
APIGuild,
APIGuildScheduledEvent,
APIGuildIntegration,
APIGuildMember,
APIMessage,
@@ -187,15 +187,13 @@ export const enum GatewayIntentBits {
DirectMessages = 1 << 12,
DirectMessageReactions = 1 << 13,
DirectMessageTyping = 1 << 14,
GuildScheduledEvents = 1 << 16,
}
/**
* https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
*/
export const enum GatewayDispatchEvents {
ApplicationCommandCreate = 'APPLICATION_COMMAND_CREATE',
ApplicationCommandDelete = 'APPLICATION_COMMAND_DELETE',
ApplicationCommandUpdate = 'APPLICATION_COMMAND_UPDATE',
ChannelCreate = 'CHANNEL_CREATE',
ChannelDelete = 'CHANNEL_DELETE',
ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE',
@@ -246,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 =
@@ -278,6 +281,11 @@ export type GatewayDispatchPayload =
| GatewayGuildModifyDispatch
| GatewayGuildRoleDeleteDispatch
| GatewayGuildRoleModifyDispatch
| GatewayGuildScheduledEventCreateDispatch
| GatewayGuildScheduledEventUpdateDispatch
| GatewayGuildScheduledEventDeleteDispatch
| GatewayGuildScheduledEventUserAddDispatch
| GatewayGuildScheduledEventUserRemoveDispatch
| GatewayGuildStickersUpdateDispatch
| GatewayIntegrationCreateDispatch
| GatewayIntegrationDeleteDispatch
@@ -308,55 +316,6 @@ export type GatewayDispatchPayload =
// #region Dispatch Payloads
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatch = DataPayload<
| GatewayDispatchEvents.ApplicationCommandCreate
| GatewayDispatchEvents.ApplicationCommandUpdate
| GatewayDispatchEvents.ApplicationCommandDelete,
GatewayApplicationCommandModifyDispatchData
>;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
* https://discord.com/developers/docs/topics/gateway#application-command-update
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandModifyDispatchData = APIApplicationCommand;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-create
*/
export type GatewayApplicationCommandCreateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-update
*/
export type GatewayApplicationCommandUpdateDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatch = GatewayApplicationCommandModifyDispatch;
/**
* https://discord.com/developers/docs/topics/gateway#application-command-delete
*/
export type GatewayApplicationCommandDeleteDispatchData = GatewayApplicationCommandModifyDispatchData;
/**
* https://discord.com/developers/docs/topics/gateway#hello
*/
@@ -871,6 +830,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
*/

View File

@@ -1,13 +1,13 @@
/**
* https://discord.com/developers/docs/reference#snowflakes
*/
export type Snowflake = `${bigint}`;
export type Snowflake = string;
/**
* https://discord.com/developers/docs/topics/permissions
* @internal
*/
export type Permissions = `${bigint}`;
export type Permissions = string;
/**
* https://discord.com/developers/docs/reference#message-formatting-formats

4
package-lock.json generated
View File

@@ -1,11 +1,11 @@
{
"name": "discord-api-types",
"version": "0.20.2",
"version": "0.25.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "0.20.2",
"version": "0.25.0",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.14.6",

View File

@@ -1,6 +1,6 @@
{
"name": "discord-api-types",
"version": "0.20.2",
"version": "0.25.0",
"description": "Discord API typings that are kept up to date for use in bot library creation.",
"main": "./v9.js",
"module": "./v9.mjs",

View File

@@ -0,0 +1,266 @@
import type { APIRole, APIUser, ChannelType } from '../../index';
import type { Snowflake } from '../../../../globals';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands';
import type { APIBaseApplicationCommandInteractionData } from './internals';
interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
description: string;
required?: boolean;
autocomplete?: never;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandOption =
| APIApplicationCommandStringArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandOptionBase
| APIApplicationCommandChannelOptions
| APIApplicationCommandOptionBase
| APIApplicationCommandNumberArgumentOptions
| APIApplicationCommandStringAutocompleteOptions
| APIApplicationCommandNumericAutocompleteOptions;
/**
* 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 APIApplicationCommandStringArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.String;
choices?: APIApplicationCommandOptionChoice[];
}
/**
* 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`, a `min_value` and `max_value` field
*/
export interface APIApplicationCommandNumberArgumentOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
/**
* 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 maximum value permitted
*/
max_value?: number;
autocomplete?: false;
}
export interface APIApplicationCommandArgumentOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type:
| ApplicationCommandOptionType.String
| ApplicationCommandOptionType.Integer
| ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
autocomplete?: false;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandStringAutocompleteOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.String;
autocomplete: true;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandNumericAutocompleteOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
autocomplete: true;
/**
* 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;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions` and `APIApplicationCommandArgumentOptions`,
* these types cannot have an `options` array, or a `choices` array, but they can have a `channel_types` one.
*/
export interface APIApplicationCommandChannelOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Channel;
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export const enum ApplicationCommandOptionType {
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
Number,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
value: string | number;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
| ApplicationCommandInteractionDataOptionSubCommandGroup
| APIApplicationCommandInteractionDataOptionWithValues;
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.Subcommand;
options?: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubcommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionString
| ApplicationCommandInteractionDataOptionRole
| ApplicationCommandInteractionDataOptionChannel
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| ApplicationCommandInteractionDataOptionNumber
| ApplicationCommandInteractionDataOptionBoolean;
export interface ApplicationCommandInteractionDataOptionString
extends InteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
focused?: boolean;
}
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 interface ApplicationCommandInteractionDataOptionInteger
extends InteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
focused?: boolean;
}
export interface ApplicationCommandInteractionDataOptionNumber
extends InteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
focused?: boolean;
}
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
name: string;
type: T;
value: D;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export interface APIChatInputApplicationCommandInteractionData
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.ChatInput> {
options?: APIApplicationCommandInteractionDataOption[];
resolved?: APIChatInputApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
*/
export interface APIChatInputApplicationCommandInteractionDataResolved {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandInteraction =
APIApplicationCommandInteractionWrapper<APIChatInputApplicationCommandInteractionData>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandDMInteraction =
APIDMInteractionWrapper<APIChatInputApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandGuildInteraction =
APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;

View File

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

View File

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

View File

@@ -0,0 +1,49 @@
import type { Snowflake } from '../../../../globals';
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure
*/
export interface APIGuildApplicationCommandPermissions {
/**
* The id of the command
*/
id: Snowflake;
/**
* The id of the application the command belongs to
*/
application_id: Snowflake;
/**
* The id of the guild
*/
guild_id: Snowflake;
/**
* The permissions for the command in the guild
*/
permissions: APIApplicationCommandPermission[];
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure
*/
export interface APIApplicationCommandPermission {
/**
* The id of the role or user
*/
id: Snowflake;
/**
* Role or user
*/
type: ApplicationCommandPermissionType;
/**
* `true` to allow, `false`, to disallow
*/
permission: boolean;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type
*/
export const enum ApplicationCommandPermissionType {
Role = 1,
User,
}

View File

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

View File

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

View File

@@ -1,11 +1,11 @@
import type { Permissions, Snowflake } from '../../../globals';
import type { InteractionType } from '../../v8';
import type { InteractionType } from './responses';
import type { APIMessage } from '../channel';
import type { APIGuildMember } from '../guild';
import type { APIUser } from '../user';
/**
* https://discord.com/developers/docs/interactions/slash-commands#message-interaction-object-message-interaction-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object
*/
export interface APIMessageInteraction {
/**
@@ -37,7 +37,7 @@ export interface APIInteractionGuildMember extends APIGuildMember {
// INTERACTIONS RECEIVED
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
/**

View File

@@ -1,29 +1,37 @@
import type { MessageFlags } from '../index';
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8';
import type { APIApplicationCommandOptionChoice } from './applicationCommands';
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-request-type
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
*/
export const enum InteractionType {
Ping = 1,
ApplicationCommand,
MessageComponent,
ApplicationCommandAutocomplete,
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object
*/
export type APIInteractionResponse =
| APIInteractionResponsePong
| 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;
@@ -44,7 +52,7 @@ export interface APIInteractionResponseUpdateMessage {
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object-interaction-callback-type
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
*/
export const enum InteractionResponseType {
/**
@@ -67,12 +75,20 @@ export const enum InteractionResponseType {
* ACK a button interaction and edit the message to which the button was attached
*/
UpdateMessage,
/**
* For autocomplete interactions
*/
ApplicationCommandAutocompleteResult,
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-object-interaction-application-command-callback-data-structure
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure
*/
export type APIInteractionResponseCallbackData = Omit<
RESTPostAPIWebhookWithTokenJSONBody,
'username' | 'avatar_url'
> & { flags?: MessageFlags };
export interface APICommandAutocompleteInteractionResponseCallbackData {
choices?: APIApplicationCommandOptionChoice[];
}

View File

@@ -1,273 +0,0 @@
import type { APIRole, APIUser } from '../index';
import type { Permissions, Snowflake } from '../../../globals';
import type { APIPartialChannel } from '../channel';
import type { APIGuildMember } from '../guild';
import type { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base';
import type { InteractionType } from './responses';
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object
*/
export interface APIApplicationCommand {
/**
* Unique id of the command
*/
id: Snowflake;
/**
* Unique id of the parent application
*/
application_id: Snowflake;
/**
* Guild id of the command, if not global
*/
guild_id?: Snowflake;
/**
* 1-32 character name matching `^[\w-]{1,32}$`
*/
name: string;
/**
* 1-100 character description
*/
description: string;
/**
* The parameters for the command
*/
options?: APIApplicationCommandOption[];
/**
* Whether the command is enabled by default when the app is added to a guild
*
* If missing, this property should be assumed as `true`
*/
default_permission?: boolean;
}
interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Channel
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
description: string;
default?: boolean;
required?: boolean;
}
/**
* https://discord.com/developers/docs/interactions/slash-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;
choices?: APIApplicationCommandOptionChoice[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-type
*/
export const enum ApplicationCommandOptionType {
SubCommand = 1,
SubCommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
value: string | number;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-structure
*/
export interface APIApplicationCommandInteractionData {
id: Snowflake;
name: string;
options?: APIApplicationCommandInteractionDataOption[];
resolved?: {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
};
}
/**
* https://discord.com/developers/docs/resources/channel#channel-object
*/
export interface APIInteractionDataResolvedChannel extends Required<APIPartialChannel> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/resources/guild#guild-member-object
*/
export interface APIInteractionDataResolvedGuildMember extends Omit<APIGuildMember, 'user' | 'deaf' | 'mute'> {
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
| ApplicationCommandInteractionDataOptionSubCommandGroup
| APIApplicationCommandInteractionDataOptionWithValues;
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.SubCommand;
options: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubCommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionString
| ApplicationCommandInteractionDataOptionRole
| ApplicationCommandInteractionDataOptionChannel
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| 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 ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
name: string;
type: T;
value: D;
}
// PERMISSIONS
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-guild-application-command-permissions-structure
*/
export interface APIGuildApplicationCommandPermissions {
/**
* The id of the command
*/
id: Snowflake;
/**
* The id of the application the command belongs to
*/
application_id: Snowflake;
/**
* The id of the guild
*/
guild_id: Snowflake;
/**
* The permissions for the command in the guild
*/
permissions: APIApplicationCommandPermission[];
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#application-command-permissions-object-application-command-permissions-structure
*/
export interface APIApplicationCommandPermission {
/**
* The id of the role or user
*/
id: Snowflake;
/**
* Role or user
*/
type: ApplicationCommandPermissionType;
/**
* `true` to allow, `false`, to disallow
*/
permission: boolean;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#applicationcommandpermissiontype
*/
export const enum ApplicationCommandPermissionType {
Role = 1,
User,
}
// INTERACTIONS
export type APIApplicationCommandInteraction = APIBaseInteraction<
InteractionType.ApplicationCommand,
APIApplicationCommandInteractionData
> &
Required<
Pick<
APIBaseInteraction<InteractionType.ApplicationCommand, APIApplicationCommandInteractionData>,
'channel_id' | 'data'
>
>;
export type APIApplicationCommandDMInteraction = APIDMInteractionWrapper<APIApplicationCommandInteraction>;
export type APIApplicationCommandGuildInteraction = APIGuildInteractionWrapper<APIApplicationCommandInteraction>;

View File

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

View File

@@ -17,6 +17,7 @@ import type { StickerFormatType } from './sticker';
import type { APIUser } from './user';
import type { APIWebhook } from './webhook';
import type { StageInstancePrivacyLevel } from './stageInstance';
import type { GuildScheduledEventEntityType, GuildScheduledEventStatus } from './guildScheduledEvent';
/**
* https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
@@ -144,6 +145,10 @@ export const enum AuditLogEvent {
StickerCreate = 90,
StickerUpdate,
StickerDelete,
GuildScheduledEventCreate = 100,
GuildScheduledEventUpdate,
GuildScheduledEventDelete,
}
/**
@@ -302,7 +307,10 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildId;
| APIAuditLogChangeKeyGuildId
| APIAuditLogChangeKeyEntityType
| APIAuditLogChangeKeyStatus
| APIAuditLogChangeKeyLocation;
/**
* Returned when an entity's name is changed
@@ -310,7 +318,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 +510,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>;
@@ -544,7 +552,7 @@ export type APIAuditLogChangeKeyMute = AuditLogChangeData<'mute', boolean>;
/**
* Returned when a user's nick is changed
*/
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', boolean>;
export type APIAuditLogChangeKeyNick = AuditLogChangeData<'nick', string>;
/**
* Returned when a user's avatar_hash is changed
@@ -582,7 +590,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,6 +619,21 @@ export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', bool
*/
export type APIAuditLogChangeKeyGuildId = AuditLogChangeData<'guild_id', Snowflake>;
/**
* 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 extends unknown> {
key: K;
/**

View File

@@ -382,8 +382,9 @@ export const enum MessageType {
GuildDiscoveryGracePeriodInitialWarning,
GuildDiscoveryGracePeriodFinalWarning,
Reply = 19,
ApplicationCommand,
ChatInputCommand,
GuildInviteReminder = 22,
ContextMenuCommand,
}
/**
@@ -659,7 +660,7 @@ export interface APIEmbedThumbnail {
/**
* Source url of thumbnail (only supports http(s) and attachments)
*/
url?: string;
url: string;
/**
* A proxied url of the thumbnail
*/
@@ -699,7 +700,7 @@ export interface APIEmbedImage {
/**
* Source url of image (only supports http(s) and attachments)
*/
url?: string;
url: string;
/**
* A proxied url of the image
*/
@@ -737,7 +738,7 @@ export interface APIEmbedAuthor {
*
* Length limit: 256 characters
*/
name?: string;
name: string;
/**
* URL of author
*/
@@ -806,6 +807,10 @@ export interface APIAttachment {
* Name of file attached
*/
filename: string;
/**
* Description for the file
*/
description?: string;
/**
* The attachment's media type
*
@@ -832,6 +837,10 @@ export interface APIAttachment {
* Width of file (if image)
*/
width?: number | null;
/**
* Whether this attachment is ephemeral
*/
ephemeral?: boolean;
}
/**
@@ -955,13 +964,28 @@ interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseMessa
/**
* The emoji to display to the left of the text
*/
emoji?: APIPartialEmoji;
emoji?: APIMessageComponentEmoji;
/**
* The status of the button
*/
disabled?: boolean;
}
export interface APIMessageComponentEmoji {
/**
* Emoji id
*/
id?: Snowflake;
/**
* Emoji name
*/
name?: string;
/**
* Whether this emoji is animated
*/
animated?: boolean;
}
export interface APIButtonComponentWithCustomId
extends APIButtonComponentBase<
ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger
@@ -1003,7 +1027,7 @@ export interface APISelectMenuComponent extends APIBaseMessageComponent<Componen
/**
* The choices in the select, max 25
*/
options: APISelectMenuOption[];
options?: APISelectMenuOption[];
/**
* Custom placeholder text if nothing is selected, max 100 characters
*/
@@ -1047,7 +1071,7 @@ export interface APISelectMenuOption {
/**
* The emoji to display to the left of the option
*/
emoji?: APIPartialEmoji;
emoji?: APIMessageComponentEmoji;
/**
* Whether this option should be already-selected by default
*/

View File

@@ -298,6 +298,9 @@ export const 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';
import type { APISticker } from './sticker';
import type { APIUser } from './user';
import type { GatewayVoiceState } from './voice';
import type { APIGuildScheduledEvent } from './guildScheduledEvent';
/**
* https://discord.com/developers/docs/resources/guild#unavailable-guild-object
@@ -325,6 +326,14 @@ export interface APIGuild extends APIPartialGuild {
* See https://discord.com/developers/docs/resources/sticker#sticker-object
*/
stickers: APISticker[];
/**
* 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 +423,10 @@ export const enum GuildSystemChannelFlags {
* Suppress server setup tips
*/
SuppressGuildReminderNotifications = 1 << 2,
/**
* Hide member join sticker reply buttons
*/
SuppressJoinNotificationReplies = 1 << 3,
}
/**
@@ -448,6 +461,18 @@ export const 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 +481,31 @@ export const 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 +522,6 @@ export const 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 +610,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
*

View File

@@ -0,0 +1,104 @@
import type { APIUser } from './user';
import type { Snowflake } from '../../globals';
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 const enum GuildScheduledEventEntityType {
StageInstance = 1,
Voice,
External,
}
/**
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status
*/
export const 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 const enum GuildScheduledEventPrivacyLevel {
/**
* The scheduled event is only accessible to guild members
*/
GuildOnly = 2,
}

View File

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

View File

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

View File

@@ -7,6 +7,7 @@ import type { APIPartialGuild } from './guild';
import type { APIApplication } from './application';
import type { APIInviteStageInstance } from './stageInstance';
import type { APIUser } from './user';
import type { APIGuildScheduledEvent } from './guildScheduledEvent';
/**
* https://discord.com/developers/docs/resources/invite#invite-object
@@ -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

@@ -94,15 +94,15 @@ export const enum OAuth2Scopes {
*/
ActivitiesWrite = 'activities.write',
/**
* Allows your app to use Slash Commands in a guild
* Allows your app to use Application Commands in a guild
*
* See https://discord.com/developers/docs/interactions/slash-commands
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommands = 'applications.commands',
/**
* Allows your app to update its Slash Commands via this bearer token - client credentials grant only
* Allows your app to update its Application Commands via this bearer token - client credentials grant only
*
* See https://discord.com/developers/docs/interactions/slash-commands
* See https://discord.com/developers/docs/interactions/application-commands
*/
ApplicationsCommandsUpdate = 'applications.commands.update',
}

View File

@@ -43,9 +43,11 @@ export const PermissionFlagsBits = {
ManageRoles: 1n << 28n,
ManageWebhooks: 1n << 29n,
ManageEmojisAndStickers: 1n << 30n,
UseSlashCommands: 1n << 31n,
UseApplicationCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
ManageEvents: 1n << 33n,
UseExternalStickers: 1n << 37n,
StartEmbeddedActivities: 1n << 39n,
} as const;
/**
@@ -74,6 +76,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

@@ -39,6 +39,16 @@ export interface APIUser {
* Whether the user has two factor enabled on their account
*/
mfa_enabled?: boolean;
/**
* The user's banner hash
*
* See https://discord.com/developers/docs/reference#image-formatting
*/
banner?: string | null;
/**
* The user's banner color encoded as an integer representation of hexadecimal color code
*/
accent_color?: number | null;
/**
* The user's chosen language option
*/
@@ -75,20 +85,66 @@ export interface APIUser {
* https://discord.com/developers/docs/resources/user#user-object-user-flags
*/
export const 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,262 @@
import type { APIRole, APIUser, ChannelType } from '../../index';
import type { Snowflake } from '../../../../globals';
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
import type {
APIApplicationCommandInteractionWrapper,
APIInteractionDataResolvedChannel,
APIInteractionDataResolvedGuildMember,
ApplicationCommandType,
} from '../applicationCommands';
import type { APIBaseApplicationCommandInteractionData } from './internals';
interface APIApplicationCommandOptionBase {
type:
| ApplicationCommandOptionType.Boolean
| ApplicationCommandOptionType.User
| ApplicationCommandOptionType.Role
| ApplicationCommandOptionType.Mentionable;
name: string;
description: string;
required?: boolean;
autocomplete?: never;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
*/
export type APIApplicationCommandOption =
| APIApplicationCommandStringArgumentOptions
| APIApplicationCommandSubCommandOptions
| APIApplicationCommandOptionBase
| APIApplicationCommandChannelOptions
| APIApplicationCommandOptionBase
| APIApplicationCommandNumberArgumentOptions
| APIApplicationCommandStringAutocompleteOptions
| APIApplicationCommandNumericAutocompleteOptions;
/**
* 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 either a `choices` or a `autocomplete` field where it's set to false.
*/
export interface APIApplicationCommandStringArgumentOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type:
| ApplicationCommandOptionType.String
| ApplicationCommandOptionType.Integer
| ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
autocomplete?: false;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandStringAutocompleteOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.String;
autocomplete: true;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
* but they can a `autocomplete` field where it's set to `true`
*/
export interface APIApplicationCommandNumericAutocompleteOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
autocomplete: true;
/**
* 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;
}
/**
* 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`, a `min_value` and `max_value` field
*/
export interface APIApplicationCommandNumberArgumentOptions
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
choices?: APIApplicationCommandOptionChoice[];
/**
* 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 maximum value permitted
*/
max_value?: number;
autocomplete?: false;
}
/**
* This type is exported as a way to make it stricter for you when you're writing your commands
*
* In contrast to `APIApplicationCommandSubCommandOptions` and `APIApplicationCommandArgumentOptions`,
* these types cannot have an `options` array, or a `choices` array, but they can have a `channel_types` one.
*/
export interface APIApplicationCommandChannelOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
type: ApplicationCommandOptionType.Channel;
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
export const enum ApplicationCommandOptionType {
Subcommand = 1,
SubcommandGroup,
String,
Integer,
Boolean,
User,
Channel,
Role,
Mentionable,
Number,
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
*/
export interface APIApplicationCommandOptionChoice {
name: string;
value: string | number;
}
/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
*/
export type APIApplicationCommandInteractionDataOption =
| ApplicationCommandInteractionDataOptionSubCommand
| ApplicationCommandInteractionDataOptionSubCommandGroup
| APIApplicationCommandInteractionDataOptionWithValues;
export interface ApplicationCommandInteractionDataOptionSubCommand {
name: string;
type: ApplicationCommandOptionType.Subcommand;
options?: APIApplicationCommandInteractionDataOptionWithValues[];
}
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
name: string;
type: ApplicationCommandOptionType.SubcommandGroup;
options: ApplicationCommandInteractionDataOptionSubCommand[];
}
export type APIApplicationCommandInteractionDataOptionWithValues =
| ApplicationCommandInteractionDataOptionString
| ApplicationCommandInteractionDataOptionRole
| ApplicationCommandInteractionDataOptionChannel
| ApplicationCommandInteractionDataOptionUser
| ApplicationCommandInteractionDataOptionMentionable
| ApplicationCommandInteractionDataOptionInteger
| ApplicationCommandInteractionDataOptionNumber
| ApplicationCommandInteractionDataOptionBoolean;
export interface ApplicationCommandInteractionDataOptionString
extends InteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
focused?: boolean;
}
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 interface ApplicationCommandInteractionDataOptionInteger
extends InteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
focused?: boolean;
}
export interface ApplicationCommandInteractionDataOptionNumber
extends InteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
focused?: boolean;
}
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
ApplicationCommandOptionType.Boolean,
boolean
>;
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
name: string;
type: T;
value: D;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
*/
export interface APIChatInputApplicationCommandInteractionData
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.ChatInput> {
options?: APIApplicationCommandInteractionDataOption[];
resolved?: APIChatInputApplicationCommandInteractionDataResolved;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
*/
export interface APIChatInputApplicationCommandInteractionDataResolved {
users?: Record<Snowflake, APIUser>;
roles?: Record<Snowflake, APIRole>;
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
}
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandInteraction =
APIApplicationCommandInteractionWrapper<APIChatInputApplicationCommandInteractionData>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandDMInteraction =
APIDMInteractionWrapper<APIChatInputApplicationCommandInteraction>;
/**
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
*/
export type APIChatInputApplicationCommandGuildInteraction =
APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;

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