mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-05-22 19:30:09 +00:00
Compare commits
51 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a507765bba | ||
|
|
9dd3446b64 | ||
|
|
24f658de38 | ||
|
|
329451c6c9 | ||
|
|
7db69531d8 | ||
|
|
77396b557c | ||
|
|
0331518c49 | ||
|
|
64e4e5246c | ||
|
|
b453d75e4d | ||
|
|
1076822b90 | ||
|
|
0c592a0950 | ||
|
|
68d97aed14 | ||
|
|
a787426082 | ||
|
|
2aee879600 | ||
|
|
4bbe1eaa86 | ||
|
|
6f6e6daccd | ||
|
|
43cc755e33 | ||
|
|
21e1148f2d | ||
|
|
8b49887c7f | ||
|
|
d590caf359 | ||
|
|
ecbed18042 | ||
|
|
e628f0f6f0 | ||
|
|
0024823d05 | ||
|
|
64937e2311 | ||
|
|
f2e22869d0 | ||
|
|
b6babf2ee2 | ||
|
|
f2b58acbf8 | ||
|
|
b07b9030c1 | ||
|
|
fdc1c1a5b4 | ||
|
|
8fcd0f2222 | ||
|
|
5723cc04bf | ||
|
|
f93b6be252 | ||
|
|
b75b05f0d5 | ||
|
|
47100bcf2c | ||
|
|
a93235c9df | ||
|
|
b1589545e9 | ||
|
|
647905e16b | ||
|
|
f2995073e0 | ||
|
|
6f15e537df | ||
|
|
d338409410 | ||
|
|
ef2a0aeb07 | ||
|
|
ab1951b7b9 | ||
|
|
ff75eb3f5d | ||
|
|
f0f44e6db4 | ||
|
|
f99f07f72e | ||
|
|
b9d61aed90 | ||
|
|
d009554cae | ||
|
|
8dbeca0fc9 | ||
|
|
5dccc6b2a3 | ||
|
|
323e531a77 | ||
|
|
634f64d4ce |
2
.github/CODE_OF_CONDUCT.md
vendored
2
.github/CODE_OF_CONDUCT.md
vendored
@@ -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.
|
||||
|
||||
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
@@ -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)
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -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:**
|
||||
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/config.yml
vendored
2
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -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.
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -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
2
.github/SUPPORT.md
vendored
@@ -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
0
.husky/commit-msg
Normal file → Executable file
0
.husky/pre-commit
Normal file → Executable file
0
.husky/pre-commit
Normal file → Executable file
138
CHANGELOG.md
138
CHANGELOG.md
@@ -1,3 +1,141 @@
|
||||
# [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
|
||||
|
||||
- **APIInteraction:** bring back Ping type ([#164](https://github.com/discordjs/discord-api-types/issues/164)) ([ff75eb3](https://github.com/discordjs/discord-api-types/commit/ff75eb3f5dfd7597968c26133d125cfe40ee5838))
|
||||
|
||||
## [0.20.1](https://github.com/discordjs/discord-api-types/compare/0.20.0...0.20.1) (2021-07-20)
|
||||
|
||||
### Features
|
||||
|
||||
- **Interactions:** add interaction response and followup route ([#162](https://github.com/discordjs/discord-api-types/issues/162)) ([f99f07f](https://github.com/discordjs/discord-api-types/commit/f99f07f72e95a9537a955eb942b52e345c1067d6))
|
||||
|
||||
# [0.20.0](https://github.com/discordjs/discord-api-types/compare/0.19.0...0.20.0) (2021-07-20)
|
||||
|
||||
### chore
|
||||
|
||||
- Add more missing stuff ([#160](https://github.com/discordjs/discord-api-types/issues/160)) ([d009554](https://github.com/discordjs/discord-api-types/commit/d009554caed6c738c4a801f00806ab7cc4ac7e16))
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
- change `xID` to `xId` ([#159](https://github.com/discordjs/discord-api-types/issues/159)) ([323e531](https://github.com/discordjs/discord-api-types/commit/323e531a77aa75397ee1ce59f0db35b08b80b606))
|
||||
- rename `isStyledButton` to `isInteractionButton` ([#158](https://github.com/discordjs/discord-api-types/issues/158)) ([634f64d](https://github.com/discordjs/discord-api-types/commit/634f64d4ce143bd0a6b9ccf0ffb1241c21550958))
|
||||
|
||||
### Features
|
||||
|
||||
- **PermissionFlagsBits:** add `UseExternalStickers` (1n << 37n) ([#154](https://github.com/discordjs/discord-api-types/issues/154)) ([5dccc6b](https://github.com/discordjs/discord-api-types/commit/5dccc6b2a3711e14d499ee9a2122403a80da99fe))
|
||||
- **RESTJSONErrorCodes:** add sticker errors ([#155](https://github.com/discordjs/discord-api-types/issues/155)) ([8dbeca0](https://github.com/discordjs/discord-api-types/commit/8dbeca0fc91cafef59eb8ee30bcfee9ab14a422c))
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
- `GatewayGuildMemberUpdateDispatchData#joined_at` is properly marked as nullable now
|
||||
- In v9, `thread_id` was incorrectly placed in `RESTPostAPIWebhookWithTokenJSONBody` and has been moved to `RESTPostAPIWebhookWithTokenQuery`
|
||||
- All types that contained the `ID` word in them have had it renamed to `Id` (ex: `APIButtonComponentWithCustomID` is now `APIButtonComponentWithCustomId`)
|
||||
- The `isStyledButton` util has been renamed to `isInteractionButton`
|
||||
|
||||
# [0.19.0](https://github.com/discordjs/discord-api-types/compare/0.18.1...0.19.0) (2021-07-19)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,3 +1,141 @@
|
||||
# [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
|
||||
|
||||
- **APIInteraction:** bring back Ping type ([#164](https://github.com/discordjs/discord-api-types/issues/164)) ([ff75eb3](https://github.com/discordjs/discord-api-types/commit/ff75eb3f5dfd7597968c26133d125cfe40ee5838))
|
||||
|
||||
## [0.20.1](https://github.com/discordjs/discord-api-types/compare/0.20.0...0.20.1) (2021-07-20)
|
||||
|
||||
### Features
|
||||
|
||||
- **Interactions:** add interaction response and followup route ([#162](https://github.com/discordjs/discord-api-types/issues/162)) ([f99f07f](https://github.com/discordjs/discord-api-types/commit/f99f07f72e95a9537a955eb942b52e345c1067d6))
|
||||
|
||||
# [0.20.0](https://github.com/discordjs/discord-api-types/compare/0.19.0...0.20.0) (2021-07-20)
|
||||
|
||||
### chore
|
||||
|
||||
- Add more missing stuff ([#160](https://github.com/discordjs/discord-api-types/issues/160)) ([d009554](https://github.com/discordjs/discord-api-types/commit/d009554caed6c738c4a801f00806ab7cc4ac7e16))
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
- change `xID` to `xId` ([#159](https://github.com/discordjs/discord-api-types/issues/159)) ([323e531](https://github.com/discordjs/discord-api-types/commit/323e531a77aa75397ee1ce59f0db35b08b80b606))
|
||||
- rename `isStyledButton` to `isInteractionButton` ([#158](https://github.com/discordjs/discord-api-types/issues/158)) ([634f64d](https://github.com/discordjs/discord-api-types/commit/634f64d4ce143bd0a6b9ccf0ffb1241c21550958))
|
||||
|
||||
### Features
|
||||
|
||||
- **PermissionFlagsBits:** add `UseExternalStickers` (1n << 37n) ([#154](https://github.com/discordjs/discord-api-types/issues/154)) ([5dccc6b](https://github.com/discordjs/discord-api-types/commit/5dccc6b2a3711e14d499ee9a2122403a80da99fe))
|
||||
- **RESTJSONErrorCodes:** add sticker errors ([#155](https://github.com/discordjs/discord-api-types/issues/155)) ([8dbeca0](https://github.com/discordjs/discord-api-types/commit/8dbeca0fc91cafef59eb8ee30bcfee9ab14a422c))
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
- `GatewayGuildMemberUpdateDispatchData#joined_at` is properly marked as nullable now
|
||||
- In v9, `thread_id` was incorrectly placed in `RESTPostAPIWebhookWithTokenJSONBody` and has been moved to `RESTPostAPIWebhookWithTokenQuery`
|
||||
- All types that contained the `ID` word in them have had it renamed to `Id` (ex: `APIButtonComponentWithCustomID` is now `APIButtonComponentWithCustomId`)
|
||||
- The `isStyledButton` util has been renamed to `isInteractionButton`
|
||||
|
||||
# [0.19.0](https://github.com/discordjs/discord-api-types/compare/0.18.1...0.19.0) (2021-07-19)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import type { Snowflake } from '../globals.ts';
|
||||
import type {
|
||||
APIApplication,
|
||||
APIApplicationCommand,
|
||||
APIApplicationCommandInteraction,
|
||||
APIChannel,
|
||||
APIEmoji,
|
||||
@@ -25,6 +24,7 @@ import type {
|
||||
InviteTargetType,
|
||||
PresenceUpdateStatus,
|
||||
} from '../payloads/v8/mod.ts';
|
||||
import type { Nullable } from '../utils/internals.ts';
|
||||
|
||||
export * from './common.ts';
|
||||
|
||||
@@ -189,9 +189,6 @@ export enum GatewayIntentBits {
|
||||
* 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',
|
||||
@@ -297,55 +294,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
|
||||
*/
|
||||
@@ -441,7 +389,7 @@ export interface GatewayReadyDispatchData {
|
||||
/**
|
||||
* Contains `id` and `flags`
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/oauth2#application-object
|
||||
* See https://discord.com/developers/docs/resources/application#application-object
|
||||
*/
|
||||
application: Pick<APIApplication, 'id' | 'flags'>;
|
||||
}
|
||||
@@ -734,9 +682,10 @@ export type GatewayGuildMemberUpdateDispatch = DataPayload<
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#guild-member-update
|
||||
*/
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user'> &
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user' | 'joined_at'> &
|
||||
Partial<Pick<APIGuildMember, 'deaf' | 'mute'>> &
|
||||
Required<Pick<APIGuildMember, 'user'>> & {
|
||||
Required<Pick<APIGuildMember, 'user'>> &
|
||||
Nullable<Pick<APIGuildMember, 'joined_at'>> & {
|
||||
/**
|
||||
* The id of the guild
|
||||
*/
|
||||
@@ -1375,7 +1324,7 @@ export interface GatewayIdentifyData {
|
||||
/**
|
||||
* Presence structure for initial presence information
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence
|
||||
*/
|
||||
presence?: GatewayPresenceUpdateData;
|
||||
/**
|
||||
@@ -1504,7 +1453,7 @@ export interface GatewayVoiceStateUpdateData {
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#update-status
|
||||
* https://discord.com/developers/docs/topics/gateway#update-presence
|
||||
*/
|
||||
export interface GatewayUpdatePresence {
|
||||
op: GatewayOpcodes.PresenceUpdate;
|
||||
@@ -1512,7 +1461,7 @@ export interface GatewayUpdatePresence {
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure
|
||||
* https://discord.com/developers/docs/topics/gateway#update-presence-gateway-presence-update-structure
|
||||
*/
|
||||
export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
@@ -1528,7 +1477,7 @@ export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
* The user's new status
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status-status-types
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence-status-types
|
||||
*/
|
||||
status: PresenceUpdateStatus;
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import type { Snowflake } from '../globals.ts';
|
||||
import type {
|
||||
APIApplication,
|
||||
APIApplicationCommand,
|
||||
APIApplicationCommandInteraction,
|
||||
APIChannel,
|
||||
APIEmoji,
|
||||
@@ -28,6 +27,7 @@ import type {
|
||||
InviteTargetType,
|
||||
PresenceUpdateStatus,
|
||||
} from '../payloads/v9/mod.ts';
|
||||
import type { Nullable } from '../utils/internals.ts';
|
||||
|
||||
export * from './common.ts';
|
||||
|
||||
@@ -192,9 +192,6 @@ export enum GatewayIntentBits {
|
||||
* 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',
|
||||
@@ -307,55 +304,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
|
||||
*/
|
||||
@@ -451,7 +399,7 @@ export interface GatewayReadyDispatchData {
|
||||
/**
|
||||
* Contains `id` and `flags`
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/oauth2#application-object
|
||||
* See https://discord.com/developers/docs/resources/application#application-object
|
||||
*/
|
||||
application: Pick<APIApplication, 'id' | 'flags'>;
|
||||
}
|
||||
@@ -744,9 +692,10 @@ export type GatewayGuildMemberUpdateDispatch = DataPayload<
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#guild-member-update
|
||||
*/
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user'> &
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user' | 'joined_at'> &
|
||||
Partial<Pick<APIGuildMember, 'deaf' | 'mute'>> &
|
||||
Required<Pick<APIGuildMember, 'user'>> & {
|
||||
Required<Pick<APIGuildMember, 'user'>> &
|
||||
Nullable<Pick<APIGuildMember, 'joined_at'>> & {
|
||||
/**
|
||||
* The id of the guild
|
||||
*/
|
||||
@@ -1464,7 +1413,7 @@ export interface GatewayIdentifyData {
|
||||
/**
|
||||
* Presence structure for initial presence information
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence
|
||||
*/
|
||||
presence?: GatewayPresenceUpdateData;
|
||||
/**
|
||||
@@ -1601,7 +1550,7 @@ export interface GatewayUpdatePresence {
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure
|
||||
* https://discord.com/developers/docs/topics/gateway#update-presence-gateway-presence-update-structure
|
||||
*/
|
||||
export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
@@ -1617,7 +1566,7 @@ export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
* The user's new status
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status-status-types
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence-status-types
|
||||
*/
|
||||
status: PresenceUpdateStatus;
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
203
deno/payloads/v8/_interactions/_applicationCommands/chatInput.ts
Normal file
203
deno/payloads/v8/_interactions/_applicationCommands/chatInput.ts
Normal file
@@ -0,0 +1,203 @@
|
||||
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;
|
||||
default?: boolean;
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||
*/
|
||||
export type APIApplicationCommandOption =
|
||||
| APIApplicationCommandArgumentOptions
|
||||
| APIApplicationCommandSubCommandOptions
|
||||
| APIApplicationCommandChannelOptions
|
||||
| APIApplicationCommandOptionBase;
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
|
||||
*/
|
||||
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
|
||||
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
|
||||
options?: APIApplicationCommandOption[];
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
|
||||
* but they can have a `choices` one
|
||||
*/
|
||||
export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
|
||||
type:
|
||||
| ApplicationCommandOptionType.String
|
||||
| ApplicationCommandOptionType.Integer
|
||||
| ApplicationCommandOptionType.Number;
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 type ApplicationCommandInteractionDataOptionString = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.String,
|
||||
string
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionRole = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Role,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionChannel = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Channel,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionUser = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.User,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionMentionable = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Mentionable,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionInteger = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Integer,
|
||||
number
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionNumber = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Number,
|
||||
number
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Boolean,
|
||||
boolean
|
||||
>;
|
||||
|
||||
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
|
||||
name: string;
|
||||
type: T;
|
||||
value: D;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
|
||||
*/
|
||||
export interface APIChatInputApplicationCommandInteractionData
|
||||
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.ChatInput> {
|
||||
options?: APIApplicationCommandInteractionDataOption[];
|
||||
resolved?: APIChatInputApplicationCommandInteractionDataResolved;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
|
||||
*/
|
||||
export interface APIChatInputApplicationCommandInteractionDataResolved {
|
||||
users?: Record<Snowflake, APIUser>;
|
||||
roles?: Record<Snowflake, APIRole>;
|
||||
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
|
||||
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIChatInputApplicationCommandInteraction =
|
||||
APIApplicationCommandInteractionWrapper<APIChatInputApplicationCommandInteractionData>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIChatInputApplicationCommandDMInteraction =
|
||||
APIDMInteractionWrapper<APIChatInputApplicationCommandInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIChatInputApplicationCommandGuildInteraction =
|
||||
APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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,
|
||||
}
|
||||
122
deno/payloads/v8/_interactions/applicationCommands.ts
Normal file
122
deno/payloads/v8/_interactions/applicationCommands.ts
Normal 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;
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Permissions, Snowflake } from '../../../globals.ts';
|
||||
import { InteractionType } from '../../v8.ts';
|
||||
import { APIMessage } from '../channel.ts';
|
||||
import { APIGuildMember } from '../guild.ts';
|
||||
import { APIUser } from '../user.ts';
|
||||
import type { Permissions, Snowflake } from '../../../globals.ts';
|
||||
import type { InteractionType } from './responses.ts';
|
||||
import type { APIMessage } from '../channel.ts';
|
||||
import type { APIGuildMember } from '../guild.ts';
|
||||
import type { APIUser } from '../user.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/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> {
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ComponentType } from '../channel.ts';
|
||||
import { APIBaseInteraction, InteractionType } from '../interactions.ts';
|
||||
import { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
|
||||
import type { ComponentType } from '../channel.ts';
|
||||
import type { APIBaseInteraction, InteractionType } from '../interactions.ts';
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
|
||||
|
||||
export type APIMessageComponentInteraction = APIBaseInteraction<
|
||||
InteractionType.MessageComponent,
|
||||
|
||||
4
deno/payloads/v8/_interactions/ping.ts
Normal file
4
deno/payloads/v8/_interactions/ping.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { APIBaseInteraction } from './base.ts';
|
||||
import type { InteractionType } from './responses.ts';
|
||||
|
||||
export type APIPingInteraction = APIBaseInteraction<InteractionType.Ping, never>;
|
||||
@@ -1,8 +1,8 @@
|
||||
import { MessageFlags } from '../mod.ts';
|
||||
import { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8.ts';
|
||||
import type { MessageFlags } from '../mod.ts';
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8.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,
|
||||
@@ -11,7 +11,7 @@ export enum InteractionType {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -44,7 +44,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 {
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ export enum InteractionResponseType {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,
|
||||
|
||||
@@ -1,273 +0,0 @@
|
||||
import { APIRole, APIUser } from '../mod.ts';
|
||||
import { Permissions, Snowflake } from '../../../globals.ts';
|
||||
import { APIPartialChannel } from '../channel.ts';
|
||||
import { APIGuildMember } from '../guild.ts';
|
||||
import { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
|
||||
import { 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>;
|
||||
109
deno/payloads/v8/application.ts
Normal file
109
deno/payloads/v8/application.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Types extracted from https://discord.com/developers/docs/resources/application
|
||||
*/
|
||||
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import type { APITeam } from './teams.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object
|
||||
*/
|
||||
export interface APIApplication {
|
||||
/**
|
||||
* The id of the app
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the app
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The icon hash of the app
|
||||
*/
|
||||
icon: string | null;
|
||||
/**
|
||||
* The description of the app
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* An array of rpc origin urls, if rpc is enabled
|
||||
*/
|
||||
rpc_origins?: string[];
|
||||
/**
|
||||
* When `false` only app owner can join the app's bot to guilds
|
||||
*/
|
||||
bot_public: boolean;
|
||||
/**
|
||||
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
|
||||
*/
|
||||
bot_require_code_grant: boolean;
|
||||
/**
|
||||
* The url of the application's terms of service
|
||||
*/
|
||||
terms_of_service_url?: string;
|
||||
/**
|
||||
* The url of the application's privacy policy
|
||||
*/
|
||||
privacy_policy_url?: string;
|
||||
/**
|
||||
* Partial user object containing info on the owner of the application
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
owner?: APIUser;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the summary field for the store page
|
||||
* of its primary sku
|
||||
*/
|
||||
summary: string;
|
||||
/**
|
||||
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
|
||||
*
|
||||
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
|
||||
*/
|
||||
verify_key: string;
|
||||
/**
|
||||
* The team this application belongs to
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
|
||||
*/
|
||||
team: APITeam | null;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
|
||||
*/
|
||||
primary_sku_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
|
||||
*/
|
||||
slug?: string;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
|
||||
*/
|
||||
cover_image?: string;
|
||||
/**
|
||||
* The application's public flags
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
flags: ApplicationFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
export enum ApplicationFlags {
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
GatewayPresence = 1 << 12,
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
Embedded = 1 << 17,
|
||||
}
|
||||
@@ -249,13 +249,13 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKeySplashHash
|
||||
| APIAuditLogChangeKeyDiscoverySplashHash
|
||||
| APIAuditLogChangeKeyBannerHash
|
||||
| APIAuditLogChangeKeyOwnerID
|
||||
| APIAuditLogChangeKeyOwnerId
|
||||
| APIAuditLogChangeKeyRegion
|
||||
| APIAuditLogChangeKeyPreferredLocale
|
||||
| APIAuditLogChangeKeyAFKChannelID
|
||||
| APIAuditLogChangeKeyAFKChannelId
|
||||
| APIAuditLogChangeKeyAFKTimeout
|
||||
| APIAuditLogChangeKeyRulesChannelID
|
||||
| APIAuditLogChangeKeyPublicUpdatesChannelID
|
||||
| APIAuditLogChangeKeyRulesChannelId
|
||||
| APIAuditLogChangeKeyPublicUpdatesChannelId
|
||||
| APIAuditLogChangeKeyMFALevel
|
||||
| APIAuditLogChangeKeyVerificationLevel
|
||||
| APIAuditLogChangeKeyExplicitContentFilter
|
||||
@@ -265,14 +265,14 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKey$Remove
|
||||
| APIAuditLogChangeKeyPruneDeleteDays
|
||||
| APIAuditLogChangeKeyWidgetEnabled
|
||||
| APIAuditLogChangeKeyWidgetChannelID
|
||||
| APIAuditLogChangeKeySystemChannelID
|
||||
| APIAuditLogChangeKeyWidgetChannelId
|
||||
| APIAuditLogChangeKeySystemChannelId
|
||||
| APIAuditLogChangeKeyPosition
|
||||
| APIAuditLogChangeKeyTopic
|
||||
| APIAuditLogChangeKeyBitrate
|
||||
| APIAuditLogChangeKeyPermissionOverwrites
|
||||
| APIAuditLogChangeKeyNSFW
|
||||
| APIAuditLogChangeKeyApplicationID
|
||||
| APIAuditLogChangeKeyApplicationId
|
||||
| APIAuditLogChangeKeyRateLimitPerUser
|
||||
| APIAuditLogChangeKeyPermissions
|
||||
| APIAuditLogChangeKeyColor
|
||||
@@ -281,8 +281,8 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKeyAllow
|
||||
| APIAuditLogChangeKeyDeny
|
||||
| APIAuditLogChangeKeyCode
|
||||
| APIAuditLogChangeKeyChannelID
|
||||
| APIAuditLogChangeKeyInviterID
|
||||
| APIAuditLogChangeKeyChannelId
|
||||
| APIAuditLogChangeKeyInviterId
|
||||
| APIAuditLogChangeKeyMaxUses
|
||||
| APIAuditLogChangeKeyUses
|
||||
| APIAuditLogChangeKeyMaxAge
|
||||
@@ -291,7 +291,7 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKeyMute
|
||||
| APIAuditLogChangeKeyNick
|
||||
| APIAuditLogChangeKeyAvatarHash
|
||||
| APIAuditLogChangeKeyID
|
||||
| APIAuditLogChangeKeyId
|
||||
| APIAuditLogChangeKeyType
|
||||
| APIAuditLogChangeKeyEnableEmoticons
|
||||
| APIAuditLogChangeKeyExpireBehavior
|
||||
@@ -302,7 +302,7 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKeyFormatType
|
||||
| APIAuditLogChangeKeyAsset
|
||||
| APIAuditLogChangeKeyAvailable
|
||||
| APIAuditLogChangeKeyGuildID;
|
||||
| APIAuditLogChangeKeyGuildId;
|
||||
|
||||
/**
|
||||
* Returned when an entity's name is changed
|
||||
@@ -337,7 +337,7 @@ export type APIAuditLogChangeKeyBannerHash = AuditLogChangeData<'banner_hash', s
|
||||
/**
|
||||
* Returned when a guild's owner_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyOwnerID = AuditLogChangeData<'owner_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyOwnerId = AuditLogChangeData<'owner_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when a guild's region is changed
|
||||
@@ -352,7 +352,7 @@ export type APIAuditLogChangeKeyPreferredLocale = AuditLogChangeData<'preferred_
|
||||
/**
|
||||
* Returned when a guild's afk_channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyAFKChannelID = AuditLogChangeData<'afk_channel_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyAFKChannelId = AuditLogChangeData<'afk_channel_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when a guild's afk_timeout is changed
|
||||
@@ -362,12 +362,12 @@ export type APIAuditLogChangeKeyAFKTimeout = AuditLogChangeData<'afk_timeout', n
|
||||
/**
|
||||
* Returned when a guild's rules_channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyRulesChannelID = AuditLogChangeData<'rules_channel_id', string>;
|
||||
export type APIAuditLogChangeKeyRulesChannelId = AuditLogChangeData<'rules_channel_id', string>;
|
||||
|
||||
/**
|
||||
* Returned when a guild's public_updates_channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyPublicUpdatesChannelID = AuditLogChangeData<'public_updates_channel_id', string>;
|
||||
export type APIAuditLogChangeKeyPublicUpdatesChannelId = AuditLogChangeData<'public_updates_channel_id', string>;
|
||||
|
||||
/**
|
||||
* Returned when a guild's mfa_level is changed
|
||||
@@ -423,12 +423,12 @@ export type APIAuditLogChangeKeyWidgetEnabled = AuditLogChangeData<'widget_enabl
|
||||
/**
|
||||
* Returned when a guild's widget_channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyWidgetChannelID = AuditLogChangeData<'widget_channel_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyWidgetChannelId = AuditLogChangeData<'widget_channel_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when a guild's system_channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeySystemChannelID = AuditLogChangeData<'system_channel_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeySystemChannelId = AuditLogChangeData<'system_channel_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when a channel's position is changed
|
||||
@@ -458,7 +458,7 @@ export type APIAuditLogChangeKeyNSFW = AuditLogChangeData<'nsfw', boolean>;
|
||||
/**
|
||||
* The application ID of the added or removed Webhook or Bot
|
||||
*/
|
||||
export type APIAuditLogChangeKeyApplicationID = AuditLogChangeData<'application_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyApplicationId = AuditLogChangeData<'application_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when a channel's amount of seconds a user has to wait before sending another message
|
||||
@@ -504,12 +504,12 @@ export type APIAuditLogChangeKeyCode = AuditLogChangeData<'code', string>;
|
||||
/**
|
||||
* Returned when an invite's channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyChannelID = AuditLogChangeData<'channel_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyChannelId = AuditLogChangeData<'channel_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when an invite's inviter_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyInviterID = AuditLogChangeData<'inviter_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyInviterId = AuditLogChangeData<'inviter_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when an invite's max_uses is changed
|
||||
@@ -544,7 +544,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
|
||||
@@ -554,7 +554,7 @@ export type APIAuditLogChangeKeyAvatarHash = AuditLogChangeData<'avatar_hash', s
|
||||
/**
|
||||
* The ID of the changed entity - sometimes used in conjunction with other keys
|
||||
*/
|
||||
export type APIAuditLogChangeKeyID = AuditLogChangeData<'id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyId = AuditLogChangeData<'id', Snowflake>;
|
||||
|
||||
/**
|
||||
* The type of entity created
|
||||
@@ -609,7 +609,7 @@ export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', bool
|
||||
/**
|
||||
* Returned when a sticker's guild_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyGuildID = AuditLogChangeData<'guild_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyGuildId = AuditLogChangeData<'guild_id', Snowflake>;
|
||||
|
||||
interface AuditLogChangeData<K extends string, D extends unknown> {
|
||||
key: K;
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { Permissions, Snowflake } from '../../globals.ts';
|
||||
import type { APIPartialEmoji } from './emoji.ts';
|
||||
import type { APIGuildMember } from './guild.ts';
|
||||
import type { APIMessageInteraction } from './interactions.ts';
|
||||
import type { APIApplication } from './oauth2.ts';
|
||||
import type { APIApplication } from './application.ts';
|
||||
import type { APIRole } from './permissions.ts';
|
||||
import type { APISticker, APIStickerItem } from './sticker.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
@@ -382,8 +382,9 @@ export enum MessageType {
|
||||
GuildDiscoveryGracePeriodInitialWarning,
|
||||
GuildDiscoveryGracePeriodFinalWarning,
|
||||
Reply = 19,
|
||||
ApplicationCommand,
|
||||
ChatInputCommand,
|
||||
GuildInviteReminder = 22,
|
||||
ContextMenuCommand,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -560,7 +561,7 @@ export interface APIEmbed {
|
||||
/**
|
||||
* Description of embed
|
||||
*
|
||||
* Length limit: 2048 characters
|
||||
* Length limit: 4096 characters
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
@@ -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
|
||||
*/
|
||||
@@ -832,6 +833,10 @@ export interface APIAttachment {
|
||||
* Width of file (if image)
|
||||
*/
|
||||
width?: number | null;
|
||||
/**
|
||||
* Whether this attachment is ephemeral
|
||||
*/
|
||||
ephemeral?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -955,14 +960,29 @@ 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 APIButtonComponentWithCustomID
|
||||
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
|
||||
> {
|
||||
@@ -979,7 +999,7 @@ export interface APIButtonComponentWithURL extends APIButtonComponentBase<Button
|
||||
url: string;
|
||||
}
|
||||
|
||||
export type APIButtonComponent = APIButtonComponentWithCustomID | APIButtonComponentWithURL;
|
||||
export type APIButtonComponent = APIButtonComponentWithCustomId | APIButtonComponentWithURL;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#button-object-button-styles
|
||||
@@ -1003,7 +1023,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 +1067,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
|
||||
*/
|
||||
|
||||
@@ -246,7 +246,7 @@ export interface APIGuild extends APIPartialGuild {
|
||||
*/
|
||||
presences?: GatewayPresenceUpdate[];
|
||||
/**
|
||||
* The maximum number of presences for the guild (the default value, currently 25000, is in effect when `null` is returned)
|
||||
* The maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds)
|
||||
*/
|
||||
max_presences?: number | null;
|
||||
/**
|
||||
@@ -448,6 +448,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 +468,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 +509,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 +597,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
|
||||
*
|
||||
|
||||
@@ -1,21 +1,32 @@
|
||||
import {
|
||||
import type {
|
||||
APIMessageComponentDMInteraction,
|
||||
APIMessageComponentGuildInteraction,
|
||||
APIMessageComponentInteraction,
|
||||
} from './_interactions/messageComponents.ts';
|
||||
import {
|
||||
import type { APIPingInteraction } from './_interactions/ping.ts';
|
||||
import type {
|
||||
APIApplicationCommandDMInteraction,
|
||||
APIApplicationCommandGuildInteraction,
|
||||
APIApplicationCommandInteraction,
|
||||
} from './_interactions/slashCommands.ts';
|
||||
} from './_interactions/applicationCommands.ts';
|
||||
|
||||
export * from './_interactions/base.ts';
|
||||
export * from './_interactions/messageComponents.ts';
|
||||
export * from './_interactions/ping.ts';
|
||||
export * from './_interactions/responses.ts';
|
||||
export * from './_interactions/slashCommands.ts';
|
||||
export * from './_interactions/applicationCommands.ts';
|
||||
|
||||
export type APIInteraction = APIApplicationCommandInteraction | APIMessageComponentInteraction;
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIInteraction = APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import type { APIPartialChannel } from './channel.ts';
|
||||
import type { APIPartialGuild } from './guild.ts';
|
||||
import type { APIApplication } from './oauth2.ts';
|
||||
import type { APIApplication } from './application.ts';
|
||||
import type { APIInviteStageInstance } from './stageInstance.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './application.ts';
|
||||
export * from './auditLog.ts';
|
||||
export * from './channel.ts';
|
||||
export * from './emoji.ts';
|
||||
|
||||
@@ -2,107 +2,6 @@
|
||||
* Types extracted from https://discord.com/developers/docs/topics/oauth2
|
||||
*/
|
||||
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import type { APITeam } from './teams.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information-response-structure
|
||||
*/
|
||||
export interface APIApplication {
|
||||
/**
|
||||
* The id of the app
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the app
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The icon hash of the app
|
||||
*/
|
||||
icon: string | null;
|
||||
/**
|
||||
* The description of the app
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* An array of rpc origin urls, if rpc is enabled
|
||||
*/
|
||||
rpc_origins?: string[];
|
||||
/**
|
||||
* When `false` only app owner can join the app's bot to guilds
|
||||
*/
|
||||
bot_public: boolean;
|
||||
/**
|
||||
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
|
||||
*/
|
||||
bot_require_code_grant: boolean;
|
||||
/**
|
||||
* The url of the application's terms of service
|
||||
*/
|
||||
terms_of_service_url?: string;
|
||||
/**
|
||||
* The url of the application's privacy policy
|
||||
*/
|
||||
privacy_policy_url?: string;
|
||||
/**
|
||||
* Partial user object containing info on the owner of the application
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
owner?: APIUser;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the summary field for the store page
|
||||
* of its primary sku
|
||||
*/
|
||||
summary: string;
|
||||
/**
|
||||
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
|
||||
*
|
||||
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
|
||||
*/
|
||||
verify_key: string;
|
||||
/**
|
||||
* The team this application belongs to
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
|
||||
*/
|
||||
team: APITeam | null;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
|
||||
*/
|
||||
primary_sku_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
|
||||
*/
|
||||
slug?: string;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
|
||||
*/
|
||||
cover_image?: string;
|
||||
/**
|
||||
* The application's public flags
|
||||
*/
|
||||
flags: ApplicationFlags;
|
||||
}
|
||||
|
||||
export enum ApplicationFlags {
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
GatewayPresence = 1 << 12,
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
Embedded = 1 << 17,
|
||||
}
|
||||
|
||||
export enum OAuth2Scopes {
|
||||
/**
|
||||
* For oauth2 bots, this puts the bot in the user's selected guild by default
|
||||
@@ -195,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',
|
||||
}
|
||||
|
||||
@@ -43,8 +43,10 @@ export const PermissionFlagsBits = {
|
||||
ManageRoles: 1n << 28n,
|
||||
ManageWebhooks: 1n << 29n,
|
||||
ManageEmojisAndStickers: 1n << 30n,
|
||||
UseSlashCommands: 1n << 31n,
|
||||
UseApplicationCommands: 1n << 31n,
|
||||
RequestToSpeak: 1n << 32n,
|
||||
UseExternalStickers: 1n << 37n,
|
||||
StartEmbeddedActivities: 1n << 39n,
|
||||
} as const;
|
||||
|
||||
/**
|
||||
@@ -73,6 +75,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
|
||||
*/
|
||||
|
||||
@@ -21,6 +21,10 @@ export interface APITeam {
|
||||
* The members of the team
|
||||
*/
|
||||
members: APITeamMember[];
|
||||
/**
|
||||
* The name of the team
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The user id of the current team owner
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -72,4 +72,8 @@ export enum WebhookType {
|
||||
* Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels
|
||||
*/
|
||||
ChannelFollower,
|
||||
/**
|
||||
* Application webhooks are webhooks used with Interactions
|
||||
*/
|
||||
Application,
|
||||
}
|
||||
|
||||
203
deno/payloads/v9/_interactions/_applicationCommands/chatInput.ts
Normal file
203
deno/payloads/v9/_interactions/_applicationCommands/chatInput.ts
Normal file
@@ -0,0 +1,203 @@
|
||||
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;
|
||||
default?: boolean;
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||
*/
|
||||
export type APIApplicationCommandOption =
|
||||
| APIApplicationCommandArgumentOptions
|
||||
| APIApplicationCommandSubCommandOptions
|
||||
| APIApplicationCommandChannelOptions
|
||||
| APIApplicationCommandOptionBase;
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
|
||||
*/
|
||||
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
|
||||
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
|
||||
options?: APIApplicationCommandOption[];
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
|
||||
* but they can have a `choices` one
|
||||
*/
|
||||
export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
|
||||
type:
|
||||
| ApplicationCommandOptionType.String
|
||||
| ApplicationCommandOptionType.Integer
|
||||
| ApplicationCommandOptionType.Number;
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 type ApplicationCommandInteractionDataOptionString = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.String,
|
||||
string
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionRole = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Role,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionChannel = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Channel,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionUser = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.User,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionMentionable = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Mentionable,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionInteger = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Integer,
|
||||
number
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionNumber = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Number,
|
||||
number
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Boolean,
|
||||
boolean
|
||||
>;
|
||||
|
||||
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
|
||||
name: string;
|
||||
type: T;
|
||||
value: D;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
|
||||
*/
|
||||
export interface APIChatInputApplicationCommandInteractionData
|
||||
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.ChatInput> {
|
||||
options?: APIApplicationCommandInteractionDataOption[];
|
||||
resolved?: APIChatInputApplicationCommandInteractionDataResolved;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
|
||||
*/
|
||||
export interface APIChatInputApplicationCommandInteractionDataResolved {
|
||||
users?: Record<Snowflake, APIUser>;
|
||||
roles?: Record<Snowflake, APIRole>;
|
||||
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
|
||||
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIChatInputApplicationCommandInteraction =
|
||||
APIApplicationCommandInteractionWrapper<APIChatInputApplicationCommandInteractionData>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIChatInputApplicationCommandDMInteraction =
|
||||
APIDMInteractionWrapper<APIChatInputApplicationCommandInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIChatInputApplicationCommandGuildInteraction =
|
||||
APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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,
|
||||
}
|
||||
124
deno/payloads/v9/_interactions/applicationCommands.ts
Normal file
124
deno/payloads/v9/_interactions/applicationCommands.ts
Normal 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;
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Permissions, Snowflake } from '../../../globals.ts';
|
||||
import { InteractionType } from '../../v9.ts';
|
||||
import { APIMessage } from '../channel.ts';
|
||||
import { APIGuildMember } from '../guild.ts';
|
||||
import { APIUser } from '../user.ts';
|
||||
import type { Permissions, Snowflake } from '../../../globals.ts';
|
||||
import type { InteractionType } from './responses.ts';
|
||||
import type { APIMessage } from '../channel.ts';
|
||||
import type { APIGuildMember } from '../guild.ts';
|
||||
import type { APIUser } from '../user.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/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> {
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ComponentType } from '../channel.ts';
|
||||
import { APIBaseInteraction, InteractionType } from '../interactions.ts';
|
||||
import { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
|
||||
import type { ComponentType } from '../channel.ts';
|
||||
import type { APIBaseInteraction, InteractionType } from '../interactions.ts';
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
|
||||
|
||||
export type APIMessageComponentInteraction = APIBaseInteraction<
|
||||
InteractionType.MessageComponent,
|
||||
|
||||
4
deno/payloads/v9/_interactions/ping.ts
Normal file
4
deno/payloads/v9/_interactions/ping.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { APIBaseInteraction } from './base.ts';
|
||||
import type { InteractionType } from './responses.ts';
|
||||
|
||||
export type APIPingInteraction = APIBaseInteraction<InteractionType.Ping, never>;
|
||||
@@ -1,8 +1,8 @@
|
||||
import { MessageFlags } from '../mod.ts';
|
||||
import { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9.ts';
|
||||
import type { MessageFlags } from '../mod.ts';
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9.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,
|
||||
@@ -11,7 +11,7 @@ export enum InteractionType {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -44,7 +44,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 {
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ export enum InteractionResponseType {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,
|
||||
|
||||
@@ -1,273 +0,0 @@
|
||||
import { APIRole, APIUser } from '../mod.ts';
|
||||
import { Permissions, Snowflake } from '../../../globals.ts';
|
||||
import { APIPartialChannel } from '../channel.ts';
|
||||
import { APIGuildMember } from '../guild.ts';
|
||||
import { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
|
||||
import { 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>;
|
||||
109
deno/payloads/v9/application.ts
Normal file
109
deno/payloads/v9/application.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Types extracted from https://discord.com/developers/docs/resources/application
|
||||
*/
|
||||
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import type { APITeam } from './teams.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object
|
||||
*/
|
||||
export interface APIApplication {
|
||||
/**
|
||||
* The id of the app
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the app
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The icon hash of the app
|
||||
*/
|
||||
icon: string | null;
|
||||
/**
|
||||
* The description of the app
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* An array of rpc origin urls, if rpc is enabled
|
||||
*/
|
||||
rpc_origins?: string[];
|
||||
/**
|
||||
* When `false` only app owner can join the app's bot to guilds
|
||||
*/
|
||||
bot_public: boolean;
|
||||
/**
|
||||
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
|
||||
*/
|
||||
bot_require_code_grant: boolean;
|
||||
/**
|
||||
* The url of the application's terms of service
|
||||
*/
|
||||
terms_of_service_url?: string;
|
||||
/**
|
||||
* The url of the application's privacy policy
|
||||
*/
|
||||
privacy_policy_url?: string;
|
||||
/**
|
||||
* Partial user object containing info on the owner of the application
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
owner?: APIUser;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the summary field for the store page
|
||||
* of its primary sku
|
||||
*/
|
||||
summary: string;
|
||||
/**
|
||||
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
|
||||
*
|
||||
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
|
||||
*/
|
||||
verify_key: string;
|
||||
/**
|
||||
* The team this application belongs to
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
|
||||
*/
|
||||
team: APITeam | null;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
|
||||
*/
|
||||
primary_sku_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
|
||||
*/
|
||||
slug?: string;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
|
||||
*/
|
||||
cover_image?: string;
|
||||
/**
|
||||
* The application's public flags
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
flags: ApplicationFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
export enum ApplicationFlags {
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
GatewayPresence = 1 << 12,
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
Embedded = 1 << 17,
|
||||
}
|
||||
@@ -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,
|
||||
@@ -46,6 +46,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 +152,10 @@ export enum AuditLogEvent {
|
||||
StickerCreate = 90,
|
||||
StickerUpdate,
|
||||
StickerDelete,
|
||||
|
||||
ThreadCreate = 110,
|
||||
ThreadUpdate,
|
||||
ThreadDelete,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,13 +261,13 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKeySplashHash
|
||||
| APIAuditLogChangeKeyDiscoverySplashHash
|
||||
| APIAuditLogChangeKeyBannerHash
|
||||
| APIAuditLogChangeKeyOwnerID
|
||||
| APIAuditLogChangeKeyOwnerId
|
||||
| APIAuditLogChangeKeyRegion
|
||||
| APIAuditLogChangeKeyPreferredLocale
|
||||
| APIAuditLogChangeKeyAFKChannelID
|
||||
| APIAuditLogChangeKeyAFKChannelId
|
||||
| APIAuditLogChangeKeyAFKTimeout
|
||||
| APIAuditLogChangeKeyRulesChannelID
|
||||
| APIAuditLogChangeKeyPublicUpdatesChannelID
|
||||
| APIAuditLogChangeKeyRulesChannelId
|
||||
| APIAuditLogChangeKeyPublicUpdatesChannelId
|
||||
| APIAuditLogChangeKeyMFALevel
|
||||
| APIAuditLogChangeKeyVerificationLevel
|
||||
| APIAuditLogChangeKeyExplicitContentFilter
|
||||
@@ -265,14 +277,14 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKey$Remove
|
||||
| APIAuditLogChangeKeyPruneDeleteDays
|
||||
| APIAuditLogChangeKeyWidgetEnabled
|
||||
| APIAuditLogChangeKeyWidgetChannelID
|
||||
| APIAuditLogChangeKeySystemChannelID
|
||||
| APIAuditLogChangeKeyWidgetChannelId
|
||||
| APIAuditLogChangeKeySystemChannelId
|
||||
| APIAuditLogChangeKeyPosition
|
||||
| APIAuditLogChangeKeyTopic
|
||||
| APIAuditLogChangeKeyBitrate
|
||||
| APIAuditLogChangeKeyPermissionOverwrites
|
||||
| APIAuditLogChangeKeyNSFW
|
||||
| APIAuditLogChangeKeyApplicationID
|
||||
| APIAuditLogChangeKeyApplicationId
|
||||
| APIAuditLogChangeKeyRateLimitPerUser
|
||||
| APIAuditLogChangeKeyPermissions
|
||||
| APIAuditLogChangeKeyColor
|
||||
@@ -281,8 +293,8 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKeyAllow
|
||||
| APIAuditLogChangeKeyDeny
|
||||
| APIAuditLogChangeKeyCode
|
||||
| APIAuditLogChangeKeyChannelID
|
||||
| APIAuditLogChangeKeyInviterID
|
||||
| APIAuditLogChangeKeyChannelId
|
||||
| APIAuditLogChangeKeyInviterId
|
||||
| APIAuditLogChangeKeyMaxUses
|
||||
| APIAuditLogChangeKeyUses
|
||||
| APIAuditLogChangeKeyMaxAge
|
||||
@@ -291,7 +303,7 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKeyMute
|
||||
| APIAuditLogChangeKeyNick
|
||||
| APIAuditLogChangeKeyAvatarHash
|
||||
| APIAuditLogChangeKeyID
|
||||
| APIAuditLogChangeKeyId
|
||||
| APIAuditLogChangeKeyType
|
||||
| APIAuditLogChangeKeyEnableEmoticons
|
||||
| APIAuditLogChangeKeyExpireBehavior
|
||||
@@ -302,7 +314,11 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKeyFormatType
|
||||
| APIAuditLogChangeKeyAsset
|
||||
| APIAuditLogChangeKeyAvailable
|
||||
| APIAuditLogChangeKeyGuildID;
|
||||
| APIAuditLogChangeKeyGuildId
|
||||
| APIAuditLogChangeKeyArchived
|
||||
| APIAuditLogChangeKeyLocked
|
||||
| APIAuditLogChangeKeyAutoArchiveDuration
|
||||
| APIAuditLogChangeKeyDefaultAutoArchiveDuration;
|
||||
|
||||
/**
|
||||
* Returned when an entity's name is changed
|
||||
@@ -337,7 +353,7 @@ export type APIAuditLogChangeKeyBannerHash = AuditLogChangeData<'banner_hash', s
|
||||
/**
|
||||
* Returned when a guild's owner_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyOwnerID = AuditLogChangeData<'owner_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyOwnerId = AuditLogChangeData<'owner_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when a guild's region is changed
|
||||
@@ -352,7 +368,7 @@ export type APIAuditLogChangeKeyPreferredLocale = AuditLogChangeData<'preferred_
|
||||
/**
|
||||
* Returned when a guild's afk_channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyAFKChannelID = AuditLogChangeData<'afk_channel_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyAFKChannelId = AuditLogChangeData<'afk_channel_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when a guild's afk_timeout is changed
|
||||
@@ -362,12 +378,12 @@ export type APIAuditLogChangeKeyAFKTimeout = AuditLogChangeData<'afk_timeout', n
|
||||
/**
|
||||
* Returned when a guild's rules_channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyRulesChannelID = AuditLogChangeData<'rules_channel_id', string>;
|
||||
export type APIAuditLogChangeKeyRulesChannelId = AuditLogChangeData<'rules_channel_id', string>;
|
||||
|
||||
/**
|
||||
* Returned when a guild's public_updates_channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyPublicUpdatesChannelID = AuditLogChangeData<'public_updates_channel_id', string>;
|
||||
export type APIAuditLogChangeKeyPublicUpdatesChannelId = AuditLogChangeData<'public_updates_channel_id', string>;
|
||||
|
||||
/**
|
||||
* Returned when a guild's mfa_level is changed
|
||||
@@ -423,12 +439,12 @@ export type APIAuditLogChangeKeyWidgetEnabled = AuditLogChangeData<'widget_enabl
|
||||
/**
|
||||
* Returned when a guild's widget_channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyWidgetChannelID = AuditLogChangeData<'widget_channel_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyWidgetChannelId = AuditLogChangeData<'widget_channel_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when a guild's system_channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeySystemChannelID = AuditLogChangeData<'system_channel_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeySystemChannelId = AuditLogChangeData<'system_channel_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when a channel's position is changed
|
||||
@@ -458,7 +474,7 @@ export type APIAuditLogChangeKeyNSFW = AuditLogChangeData<'nsfw', boolean>;
|
||||
/**
|
||||
* The application ID of the added or removed Webhook or Bot
|
||||
*/
|
||||
export type APIAuditLogChangeKeyApplicationID = AuditLogChangeData<'application_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyApplicationId = AuditLogChangeData<'application_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when a channel's amount of seconds a user has to wait before sending another message
|
||||
@@ -504,12 +520,12 @@ export type APIAuditLogChangeKeyCode = AuditLogChangeData<'code', string>;
|
||||
/**
|
||||
* Returned when an invite's channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyChannelID = AuditLogChangeData<'channel_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyChannelId = AuditLogChangeData<'channel_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when an invite's inviter_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyInviterID = AuditLogChangeData<'inviter_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyInviterId = AuditLogChangeData<'inviter_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when an invite's max_uses is changed
|
||||
@@ -544,7 +560,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
|
||||
@@ -554,7 +570,7 @@ export type APIAuditLogChangeKeyAvatarHash = AuditLogChangeData<'avatar_hash', s
|
||||
/**
|
||||
* The ID of the changed entity - sometimes used in conjunction with other keys
|
||||
*/
|
||||
export type APIAuditLogChangeKeyID = AuditLogChangeData<'id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyId = AuditLogChangeData<'id', Snowflake>;
|
||||
|
||||
/**
|
||||
* The type of entity created
|
||||
@@ -609,7 +625,30 @@ export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', bool
|
||||
/**
|
||||
* Returned when a sticker's guild_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyGuildID = AuditLogChangeData<'guild_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyGuildId = AuditLogChangeData<'guild_id', Snowflake>;
|
||||
|
||||
/*
|
||||
* Returned when a thread's archive status is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyArchived = AuditLogChangeData<'archived', boolean>;
|
||||
|
||||
/*
|
||||
* Returned when a thread's lock status is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyLocked = AuditLogChangeData<'locked', boolean>;
|
||||
|
||||
/*
|
||||
* Returned when a thread's auto archive duration is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyAutoArchiveDuration = AuditLogChangeData<'auto_archive_duration', number>;
|
||||
|
||||
/*
|
||||
* Returned when a channel's default auto archive duration for newly created threads is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyDefaultAutoArchiveDuration = AuditLogChangeData<
|
||||
'default_auto_archive_duration',
|
||||
number
|
||||
>;
|
||||
|
||||
interface AuditLogChangeData<K extends string, D extends unknown> {
|
||||
key: K;
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { Permissions, Snowflake } from '../../globals.ts';
|
||||
import type { APIPartialEmoji } from './emoji.ts';
|
||||
import type { APIGuildMember } from './guild.ts';
|
||||
import type { APIMessageInteraction } from './interactions.ts';
|
||||
import type { APIApplication } from './oauth2.ts';
|
||||
import type { APIApplication } from './application.ts';
|
||||
import type { APIRole } from './permissions.ts';
|
||||
import type { APISticker, APIStickerItem } from './sticker.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
@@ -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 {
|
||||
@@ -680,7 +690,7 @@ export interface APIEmbed {
|
||||
/**
|
||||
* Description of embed
|
||||
*
|
||||
* Length limit: 2048 characters
|
||||
* Length limit: 4096 characters
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
@@ -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
|
||||
*/
|
||||
@@ -952,6 +962,10 @@ export interface APIAttachment {
|
||||
* Width of file (if image)
|
||||
*/
|
||||
width?: number | null;
|
||||
/**
|
||||
* Whether this attachment is ephemeral
|
||||
*/
|
||||
ephemeral?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1075,14 +1089,29 @@ 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 APIButtonComponentWithCustomID
|
||||
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
|
||||
> {
|
||||
@@ -1099,7 +1128,7 @@ export interface APIButtonComponentWithURL extends APIButtonComponentBase<Button
|
||||
url: string;
|
||||
}
|
||||
|
||||
export type APIButtonComponent = APIButtonComponentWithCustomID | APIButtonComponentWithURL;
|
||||
export type APIButtonComponent = APIButtonComponentWithCustomId | APIButtonComponentWithURL;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#button-object-button-styles
|
||||
@@ -1123,7 +1152,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 +1196,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
|
||||
*/
|
||||
|
||||
@@ -331,11 +331,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
|
||||
*/
|
||||
|
||||
@@ -254,7 +254,7 @@ export interface APIGuild extends APIPartialGuild {
|
||||
*/
|
||||
presences?: GatewayPresenceUpdate[];
|
||||
/**
|
||||
* The maximum number of presences for the guild (the default value, currently 25000, is in effect when `null` is returned)
|
||||
* The maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds)
|
||||
*/
|
||||
max_presences?: number | null;
|
||||
/**
|
||||
@@ -456,6 +456,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 +476,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 +517,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 +605,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
|
||||
*
|
||||
|
||||
@@ -1,21 +1,32 @@
|
||||
import {
|
||||
import type {
|
||||
APIMessageComponentDMInteraction,
|
||||
APIMessageComponentGuildInteraction,
|
||||
APIMessageComponentInteraction,
|
||||
} from './_interactions/messageComponents.ts';
|
||||
import {
|
||||
import type { APIPingInteraction } from './_interactions/ping.ts';
|
||||
import type {
|
||||
APIApplicationCommandDMInteraction,
|
||||
APIApplicationCommandGuildInteraction,
|
||||
APIApplicationCommandInteraction,
|
||||
} from './_interactions/slashCommands.ts';
|
||||
} from './_interactions/applicationCommands.ts';
|
||||
|
||||
export * from './_interactions/base.ts';
|
||||
export * from './_interactions/messageComponents.ts';
|
||||
export * from './_interactions/ping.ts';
|
||||
export * from './_interactions/responses.ts';
|
||||
export * from './_interactions/slashCommands.ts';
|
||||
export * from './_interactions/applicationCommands.ts';
|
||||
|
||||
export type APIInteraction = APIApplicationCommandInteraction | APIMessageComponentInteraction;
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIInteraction = APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import type { APIPartialChannel } from './channel.ts';
|
||||
import type { APIPartialGuild } from './guild.ts';
|
||||
import type { APIApplication } from './oauth2.ts';
|
||||
import type { APIApplication } from './application.ts';
|
||||
import type { APIInviteStageInstance } from './stageInstance.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './application.ts';
|
||||
export * from './auditLog.ts';
|
||||
export * from './channel.ts';
|
||||
export * from './emoji.ts';
|
||||
|
||||
@@ -2,107 +2,6 @@
|
||||
* Types extracted from https://discord.com/developers/docs/topics/oauth2
|
||||
*/
|
||||
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import type { APITeam } from './teams.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information-response-structure
|
||||
*/
|
||||
export interface APIApplication {
|
||||
/**
|
||||
* The id of the app
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the app
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The icon hash of the app
|
||||
*/
|
||||
icon: string | null;
|
||||
/**
|
||||
* The description of the app
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* An array of rpc origin urls, if rpc is enabled
|
||||
*/
|
||||
rpc_origins?: string[];
|
||||
/**
|
||||
* When `false` only app owner can join the app's bot to guilds
|
||||
*/
|
||||
bot_public: boolean;
|
||||
/**
|
||||
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
|
||||
*/
|
||||
bot_require_code_grant: boolean;
|
||||
/**
|
||||
* The url of the application's terms of service
|
||||
*/
|
||||
terms_of_service_url?: string;
|
||||
/**
|
||||
* The url of the application's privacy policy
|
||||
*/
|
||||
privacy_policy_url?: string;
|
||||
/**
|
||||
* Partial user object containing info on the owner of the application
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
owner?: APIUser;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the summary field for the store page
|
||||
* of its primary sku
|
||||
*/
|
||||
summary: string;
|
||||
/**
|
||||
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
|
||||
*
|
||||
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
|
||||
*/
|
||||
verify_key: string;
|
||||
/**
|
||||
* The team this application belongs to
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
|
||||
*/
|
||||
team: APITeam | null;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
|
||||
*/
|
||||
primary_sku_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
|
||||
*/
|
||||
slug?: string;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
|
||||
*/
|
||||
cover_image?: string;
|
||||
/**
|
||||
* The application's public flags
|
||||
*/
|
||||
flags: ApplicationFlags;
|
||||
}
|
||||
|
||||
export enum ApplicationFlags {
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
GatewayPresence = 1 << 12,
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
Embedded = 1 << 17,
|
||||
}
|
||||
|
||||
export enum OAuth2Scopes {
|
||||
/**
|
||||
* For oauth2 bots, this puts the bot in the user's selected guild by default
|
||||
@@ -195,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',
|
||||
}
|
||||
|
||||
@@ -43,11 +43,14 @@ export const PermissionFlagsBits = {
|
||||
ManageRoles: 1n << 28n,
|
||||
ManageWebhooks: 1n << 29n,
|
||||
ManageEmojisAndStickers: 1n << 30n,
|
||||
UseSlashCommands: 1n << 31n,
|
||||
UseApplicationCommands: 1n << 31n,
|
||||
RequestToSpeak: 1n << 32n,
|
||||
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;
|
||||
|
||||
/**
|
||||
@@ -76,6 +79,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
|
||||
*/
|
||||
|
||||
@@ -21,6 +21,10 @@ export interface APITeam {
|
||||
* The members of the team
|
||||
*/
|
||||
members: APITeamMember[];
|
||||
/**
|
||||
* The name of the team
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The user id of the current team owner
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -72,4 +72,8 @@ export enum WebhookType {
|
||||
* Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels
|
||||
*/
|
||||
ChannelFollower,
|
||||
/**
|
||||
* Application webhooks are webhooks used with Interactions
|
||||
*/
|
||||
Application,
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ export enum RESTJSONErrorCodes {
|
||||
UnknownUser,
|
||||
UnknownEmoji,
|
||||
UnknownWebhook,
|
||||
UnknownWebhookService,
|
||||
|
||||
UnknownSession = 10020,
|
||||
|
||||
UnknownBan = 10026,
|
||||
UnknownSKU,
|
||||
@@ -27,30 +30,57 @@ export enum RESTJSONErrorCodes {
|
||||
UnknownBuild,
|
||||
UnknownLobby,
|
||||
UnknownBranch,
|
||||
UnknownStoreDirectoryLayout,
|
||||
|
||||
UnknownRedistributable = 10036,
|
||||
|
||||
UnknownGiftCode = 10038,
|
||||
|
||||
UnknownStream = 10049,
|
||||
UnknownPremiumServerSubscribeCooldown,
|
||||
|
||||
UnknownGuildTemplate = 10057,
|
||||
|
||||
UnknownSticker = 10060,
|
||||
UnknownDiscoverableServerCategory = 10059,
|
||||
UnknownSticker,
|
||||
|
||||
UnknownInteraction = 10062,
|
||||
UnknownApplicationCommand,
|
||||
|
||||
UnknownApplicationCommandPermissions = 10066,
|
||||
UnknownStageInstance,
|
||||
UnknownGuildMemberVerificationForm,
|
||||
UnknownGuildWelcomeScreen,
|
||||
UnknownGuildScheduledEvent,
|
||||
UnknownGuildScheduledEventUser,
|
||||
|
||||
BotsCannotUseThisEndpoint = 20001,
|
||||
OnlyBotsCanUseThisEndpoint,
|
||||
|
||||
ExplicitContentCannotBeSentToTheDesiredRecipient = 20009,
|
||||
|
||||
NotAuthorizedToPerformThisActionOnThisApplication = 20012,
|
||||
|
||||
ActionCannotBePerformedDueToSlowmodeRateLimit = 20016,
|
||||
|
||||
OnlyTheOwnerOfThisAccountCanPerformThisAction = 20018,
|
||||
|
||||
AnnouncementEditLimitExceeded = 20022,
|
||||
|
||||
ChannelSendRateLimit = 20028,
|
||||
|
||||
StageTopicServerNameServerDescriptionOrChannelNamesContainDisallowedWords = 20031,
|
||||
|
||||
GuildPremiumSubscriptionLevelTooLow = 20035,
|
||||
|
||||
MaximumNumberOfGuildsReached = 30001,
|
||||
MaximumNumberOfFriendsReached,
|
||||
MaximumNumberOfPinsReachedForTheChannel,
|
||||
|
||||
MaximumNumberOfGuildRolesReached = 30005,
|
||||
MaximumNumberOfRecipientsReached,
|
||||
MaximumNumberOfGuildRolesReached,
|
||||
|
||||
MaximumNumberOfWebhooksReached = 30007,
|
||||
MaximumNumberOfEmojisReached,
|
||||
|
||||
MaximumNumberOfReactionsReached = 30010,
|
||||
|
||||
@@ -59,20 +89,34 @@ export enum RESTJSONErrorCodes {
|
||||
MaximumNumberOfAttachmentsInAMessageReached = 30015,
|
||||
MaximumNumberOfInvitesReached,
|
||||
|
||||
MaximumNumberOfAnimatedEmojisReached = 30018,
|
||||
MaximumNumberOfServerMembersReached,
|
||||
|
||||
MaximumNumberOfServerCategoriesReached = 30030,
|
||||
|
||||
GuildAlreadyHasTemplate = 30031,
|
||||
|
||||
MaximumThreadParticipants = 30033,
|
||||
|
||||
MaximumNumberOfNonGuildMemberBansHasBeenExceeded = 30035,
|
||||
|
||||
MaximumNumberOfBanFetchesHasBeenReached = 30037,
|
||||
|
||||
MaximumNumberOfStickersReached = 30039,
|
||||
MaximumNumberOfPruneRequestsHasBeenReached,
|
||||
|
||||
Unauthorized = 40001,
|
||||
VerifyYourAccount,
|
||||
OpeningDirectMessagesTooFast,
|
||||
|
||||
RequestEntityTooLarge = 40005,
|
||||
FeatureTemporarilyDisabledServerSide,
|
||||
UserBannedFromThisGuild,
|
||||
|
||||
ThisMessageWasAlreadyCrossposted = 40033,
|
||||
TargetUserIsNotConnectedToVoice = 40032,
|
||||
ThisMessageWasAlreadyCrossposted,
|
||||
|
||||
ApplicationCommandWithThatNameAlreadyExists = 40041,
|
||||
|
||||
MissingAccess = 50001,
|
||||
InvalidAccountType,
|
||||
@@ -97,8 +141,10 @@ export enum RESTJSONErrorCodes {
|
||||
|
||||
CannotExecuteActionOnThisChannelType = 50024,
|
||||
InvalidOAuth2AccessToken,
|
||||
MissingRequiredOAuth2Scope,
|
||||
|
||||
InvalidWebhookToken = 50027,
|
||||
InvalidRole,
|
||||
|
||||
InvalidRecipients = 50033,
|
||||
OneOfTheMessagesProvidedWasTooOldForBulkDelete,
|
||||
@@ -110,6 +156,10 @@ export enum RESTJSONErrorCodes {
|
||||
FileUploadedExceedsMaximumSize = 50045,
|
||||
InvalidFileUploaded,
|
||||
|
||||
CannotSelfRedeemThisGift = 50054,
|
||||
|
||||
PaymentSourceRequiredToRedeemGift = 50070,
|
||||
|
||||
CannotDeleteChannelRequiredForCommunityGuilds = 50074,
|
||||
|
||||
InvalidStickerSent = 50081,
|
||||
@@ -118,18 +168,34 @@ export enum RESTJSONErrorCodes {
|
||||
InvalidThreadNotificationSettings,
|
||||
ParameterEarlierThanCreation,
|
||||
|
||||
ServerNotAvailableInYourLocation = 50095,
|
||||
|
||||
ServerNeedsMonetizationEnabledToPerformThisAction = 50097,
|
||||
|
||||
ServerNeedsMoreBoostsToPerformThisAction = 50101,
|
||||
|
||||
TwoFactorAuthenticationIsRequired = 60003,
|
||||
|
||||
NoUsersWithDiscordTagExist = 80004,
|
||||
|
||||
ReactionWasBlocked = 90001,
|
||||
|
||||
APIResourceOverloaded = 130000,
|
||||
|
||||
TheStageIsAlreadyOpen = 150006,
|
||||
|
||||
CannotReplyWithoutPermissionToReadMessageHistory = 160002,
|
||||
|
||||
ThreadAlreadyCreatedForMessage = 160004,
|
||||
ThreadLocked,
|
||||
MaximumActiveThreads,
|
||||
MaximumActiveAnnouncementThreads,
|
||||
|
||||
InvalidJSONForUploadedLottieFile = 170001,
|
||||
|
||||
LottieAnimationMaximumDimensionsExceeded = 170005,
|
||||
UploadedLottiesCannotContainRasterizedImages,
|
||||
StickerMaximumFramerateExceeded,
|
||||
StickerFrameCountExceedsMaximumOf1000Frames,
|
||||
LottieAnimationMaximumDimensionsExceeded,
|
||||
StickerFramerateIsTooSmallOrTooLarge,
|
||||
StickerAnimationDurationExceedsMaximumOf5Seconds,
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import type { Permissions, Snowflake } from '../../globals.ts';
|
||||
import type {
|
||||
APIActionRowComponent,
|
||||
APIAllowedMentions,
|
||||
APIAttachment,
|
||||
APIChannel,
|
||||
APIEmbed,
|
||||
APIExtendedInvite,
|
||||
@@ -26,7 +28,7 @@ export type RESTGetAPIChannelResult = APIChannel;
|
||||
*/
|
||||
export interface RESTPatchAPIChannelJSONBody {
|
||||
/**
|
||||
* 2-100 character channel name
|
||||
* 1-100 character channel name
|
||||
*
|
||||
* Channel types: all
|
||||
*/
|
||||
@@ -200,6 +202,12 @@ export interface RESTPostAPIChannelMessageJSONBody {
|
||||
* See https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
|
||||
*/
|
||||
message_reference?: APIMessageReferenceSend;
|
||||
/**
|
||||
* The components to include with the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
/**
|
||||
* IDs of up to 3 stickers in the server to send in the message
|
||||
*
|
||||
@@ -295,10 +303,15 @@ export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
content?: string | null;
|
||||
/**
|
||||
* Embedded `rich` content (up to 6000 characters)
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
*/
|
||||
embeds?: APIEmbed[];
|
||||
embeds?: APIEmbed[] | null;
|
||||
/**
|
||||
* Embedded `rich` content
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
* @deprecated Use `embeds` instead
|
||||
*/
|
||||
embed?: APIEmbed | null;
|
||||
/**
|
||||
@@ -306,14 +319,50 @@ export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
*
|
||||
* When specifying flags, ensure to include all previously set flags/bits
|
||||
* in addition to ones that you are modifying
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#message-object-message-flags
|
||||
*/
|
||||
flags?: MessageFlags | null;
|
||||
/**
|
||||
* Allowed mentions for the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
||||
*/
|
||||
allowed_mentions?: APIAllowedMentions | null;
|
||||
/**
|
||||
* Attached files to keep
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: APIAttachment[] | null;
|
||||
/**
|
||||
* The components to include with the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
*/
|
||||
export type RESTPatchAPIChannelMessageFormDataBody =
|
||||
| {
|
||||
/**
|
||||
* JSON stringified message body
|
||||
*/
|
||||
payload_json?: string;
|
||||
/**
|
||||
* The file contents
|
||||
*/
|
||||
file: unknown;
|
||||
}
|
||||
| (RESTPatchAPIChannelMessageJSONBody & {
|
||||
/**
|
||||
* The file contents
|
||||
*/
|
||||
file: unknown;
|
||||
});
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,7 @@ import type {
|
||||
GuildVerificationLevel,
|
||||
GuildWidgetStyle,
|
||||
} from '../../payloads/v8/mod.ts';
|
||||
import type { Nullable } from '../../utils/internals.ts';
|
||||
import type { RESTPutAPIChannelPermissionJSONBody } from './channel.ts';
|
||||
|
||||
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
|
||||
@@ -524,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
|
||||
*
|
||||
@@ -576,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
|
||||
*/
|
||||
@@ -774,7 +791,3 @@ export interface RESTPatchAPIGuildWelcomeScreenJSONBody extends Nullable<Partial
|
||||
*/
|
||||
enabled?: boolean | null;
|
||||
}
|
||||
|
||||
type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null;
|
||||
};
|
||||
|
||||
@@ -3,95 +3,127 @@ import type {
|
||||
APIApplicationCommandPermission,
|
||||
APIGuildApplicationCommandPermissions,
|
||||
APIInteractionResponse,
|
||||
APIInteractionResponseCallbackData,
|
||||
ApplicationCommandType,
|
||||
} from '../../payloads/v8/mod.ts';
|
||||
import type {
|
||||
RESTDeleteAPIWebhookWithTokenMessageResult,
|
||||
RESTGetAPIWebhookWithTokenMessageResult,
|
||||
RESTPatchAPIWebhookWithTokenMessageFormDataBody,
|
||||
RESTPatchAPIWebhookWithTokenMessageJSONBody,
|
||||
RESTPatchAPIWebhookWithTokenMessageResult,
|
||||
RESTPostAPIWebhookWithTokenWaitResult,
|
||||
} 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;
|
||||
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 =
|
||||
| {
|
||||
@@ -112,29 +144,110 @@ export type RESTPostAPIInteractionCallbackFormDataBody =
|
||||
});
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command-permissions
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
|
||||
*/
|
||||
export type RESTGetAPIInteractionOriginalResponseResult = RESTGetAPIWebhookWithTokenMessageResult;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
|
||||
*/
|
||||
export type RESTPatchAPIInteractionOriginalResponseJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
|
||||
*/
|
||||
export type RESTPatchAPIInteractionOriginalResponseFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
|
||||
*/
|
||||
export type RESTPatchAPIInteractionOriginalResponseResult = RESTPatchAPIWebhookWithTokenMessageResult;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response
|
||||
*/
|
||||
export type RESTDeleteAPIInteractionOriginalResponseResult = RESTDeleteAPIWebhookWithTokenMessageResult;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
|
||||
*/
|
||||
export type RESTPostAPIInteractionFollowupJSONBody = APIInteractionResponseCallbackData;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
});
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
|
||||
*/
|
||||
export type RESTPostAPIInteractionFollowupResult = RESTPostAPIWebhookWithTokenWaitResult;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-followup-message
|
||||
*/
|
||||
export type RESTGetAPIInteractionFollowupResult = RESTGetAPIWebhookWithTokenMessageResult;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
|
||||
*/
|
||||
export type RESTPatchAPIInteractionFollowupJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
|
||||
*/
|
||||
export type RESTPatchAPIInteractionFollowupFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
|
||||
*/
|
||||
export type RESTPatchAPIInteractionFollowupResult = RESTPatchAPIWebhookWithTokenMessageResult;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message
|
||||
*/
|
||||
export type RESTDeleteAPIInteractionFollowupResult = RESTDeleteAPIWebhookWithTokenMessageResult;
|
||||
|
||||
/**
|
||||
* 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,
|
||||
@@ -142,6 +255,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[];
|
||||
|
||||
@@ -24,8 +24,8 @@ export const Routes = {
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/audit-logs`
|
||||
*/
|
||||
guildAuditLog(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/audit-logs` as const;
|
||||
guildAuditLog(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/audit-logs` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -34,8 +34,8 @@ export const Routes = {
|
||||
* - PATCH `/channels/{channel.id}`
|
||||
* - DELETE `/channels/{channel.id}`
|
||||
*/
|
||||
channel(channelID: Snowflake) {
|
||||
return `/channels/${channelID}` as const;
|
||||
channel(channelId: Snowflake) {
|
||||
return `/channels/${channelId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -43,8 +43,8 @@ export const Routes = {
|
||||
* - GET `/channels/{channel.id}/messages`
|
||||
* - POST `/channels/{channel.id}/messages`
|
||||
*/
|
||||
channelMessages(channelID: Snowflake) {
|
||||
return `/channels/${channelID}/messages` as const;
|
||||
channelMessages(channelId: Snowflake) {
|
||||
return `/channels/${channelId}/messages` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -53,16 +53,16 @@ export const Routes = {
|
||||
* - PATCH `/channels/{channel.id}/messages/{message.id}`
|
||||
* - DELETE `/channels/{channel.id}/messages/{message.id}`
|
||||
*/
|
||||
channelMessage(channelID: Snowflake, messageID: Snowflake) {
|
||||
return `/channels/${channelID}/messages/${messageID}` as const;
|
||||
channelMessage(channelId: Snowflake, messageId: Snowflake) {
|
||||
return `/channels/${channelId}/messages/${messageId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - POST `/channels/{channel.id}/messages/{message.id}/crosspost`
|
||||
*/
|
||||
channelMessageCrosspost(channelID: Snowflake, messageID: Snowflake) {
|
||||
return `/channels/${channelID}/messages/${messageID}/crosspost` as const;
|
||||
channelMessageCrosspost(channelId: Snowflake, messageId: Snowflake) {
|
||||
return `/channels/${channelId}/messages/${messageId}/crosspost` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -72,8 +72,8 @@ export const Routes = {
|
||||
*
|
||||
* **Note**: You need to URL encode the emoji yourself
|
||||
*/
|
||||
channelMessageOwnReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) {
|
||||
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/@me` as const;
|
||||
channelMessageOwnReaction(channelId: Snowflake, messageId: Snowflake, emoji: string) {
|
||||
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}/@me` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -82,8 +82,8 @@ export const Routes = {
|
||||
*
|
||||
* **Note**: You need to URL encode the emoji yourself
|
||||
*/
|
||||
channelMessageUserReaction(channelID: Snowflake, messageID: Snowflake, emoji: string, userID: Snowflake) {
|
||||
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/${userID}` as const;
|
||||
channelMessageUserReaction(channelId: Snowflake, messageId: Snowflake, emoji: string, userId: Snowflake) {
|
||||
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}/${userId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -93,24 +93,24 @@ export const Routes = {
|
||||
*
|
||||
* **Note**: You need to URL encode the emoji yourself
|
||||
*/
|
||||
channelMessageReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) {
|
||||
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}` as const;
|
||||
channelMessageReaction(channelId: Snowflake, messageId: Snowflake, emoji: string) {
|
||||
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - DELETE `/channels/{channel.id}/messages/{message.id}/reactions`
|
||||
*/
|
||||
channelMessageAllReactions(channelID: Snowflake, messageID: Snowflake) {
|
||||
return `/channels/${channelID}/messages/${messageID}/reactions` as const;
|
||||
channelMessageAllReactions(channelId: Snowflake, messageId: Snowflake) {
|
||||
return `/channels/${channelId}/messages/${messageId}/reactions` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - POST `/channels/{channel.id}/messages/bulk-delete`
|
||||
*/
|
||||
channelBulkDelete(channelID: Snowflake) {
|
||||
return `/channels/${channelID}/messages/bulk-delete` as const;
|
||||
channelBulkDelete(channelId: Snowflake) {
|
||||
return `/channels/${channelId}/messages/bulk-delete` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -118,8 +118,8 @@ export const Routes = {
|
||||
* - PUT `/channels/{channel.id}/permissions/{overwrite.id}`
|
||||
* - DELETE `/channels/{channel.id}/permissions/{overwrite.id}`
|
||||
*/
|
||||
channelPermission(channelID: Snowflake, overwriteID: Snowflake) {
|
||||
return `/channels/${channelID}/permissions/${overwriteID}` as const;
|
||||
channelPermission(channelId: Snowflake, overwriteId: Snowflake) {
|
||||
return `/channels/${channelId}/permissions/${overwriteId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -127,32 +127,32 @@ export const Routes = {
|
||||
* - GET `/channels/{channel.id}/invites`
|
||||
* - POST `/channels/{channel.id}/invites`
|
||||
*/
|
||||
channelInvites(channelID: Snowflake) {
|
||||
return `/channels/${channelID}/invites` as const;
|
||||
channelInvites(channelId: Snowflake) {
|
||||
return `/channels/${channelId}/invites` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - POST `/channels/{channel.id}/followers`
|
||||
*/
|
||||
channelFollowers(channelID: Snowflake) {
|
||||
return `/channels/${channelID}/followers` as const;
|
||||
channelFollowers(channelId: Snowflake) {
|
||||
return `/channels/${channelId}/followers` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - POST `/channels/{channel.id}/typing`
|
||||
*/
|
||||
channelTyping(channelID: Snowflake) {
|
||||
return `/channels/${channelID}/typing` as const;
|
||||
channelTyping(channelId: Snowflake) {
|
||||
return `/channels/${channelId}/typing` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/channels/{channel.id}/pins`
|
||||
*/
|
||||
channelPins(channelID: Snowflake) {
|
||||
return `/channels/${channelID}/pins` as const;
|
||||
channelPins(channelId: Snowflake) {
|
||||
return `/channels/${channelId}/pins` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -160,8 +160,8 @@ export const Routes = {
|
||||
* - PUT `/channels/{channel.id}/pins/{message.id}`
|
||||
* - DELETE `/channels/{channel.id}/pins/{message.id}`
|
||||
*/
|
||||
channelPin(channelID: Snowflake, messageID: Snowflake) {
|
||||
return `/channels/${channelID}/pins/${messageID}` as const;
|
||||
channelPin(channelId: Snowflake, messageId: Snowflake) {
|
||||
return `/channels/${channelId}/pins/${messageId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -169,8 +169,8 @@ export const Routes = {
|
||||
* - PUT `/channels/{channel.id}/recipients/{user.id}`
|
||||
* - DELETE `/channels/{channel.id}/recipients/{user.id}`
|
||||
*/
|
||||
channelRecipient(channelID: Snowflake, userID: Snowflake) {
|
||||
return `/channels/${channelID}/recipients/${userID}` as const;
|
||||
channelRecipient(channelId: Snowflake, userId: Snowflake) {
|
||||
return `/channels/${channelId}/recipients/${userId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -178,8 +178,8 @@ export const Routes = {
|
||||
* - GET `/guilds/{guild.id}/emojis`
|
||||
* - POST `/guilds/{guild.id}/emojis`
|
||||
*/
|
||||
guildEmojis(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/emojis` as const;
|
||||
guildEmojis(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/emojis` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -188,8 +188,8 @@ export const Routes = {
|
||||
* - PATCH `/guilds/{guild.id}/emojis/{emoji.id}`
|
||||
* - DELETE `/guilds/{guild.id}/emojis/{emoji.id}`
|
||||
*/
|
||||
guildEmoji(guildID: Snowflake, emojiID: Snowflake) {
|
||||
return `/guilds/${guildID}/emojis/${emojiID}` as const;
|
||||
guildEmoji(guildId: Snowflake, emojiId: Snowflake) {
|
||||
return `/guilds/${guildId}/emojis/${emojiId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -206,16 +206,16 @@ export const Routes = {
|
||||
* - PATCH `/guilds/{guild.id}`
|
||||
* - DELETE `/guilds/{guild.id}`
|
||||
*/
|
||||
guild(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}` as const;
|
||||
guild(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/preview`
|
||||
*/
|
||||
guildPreview(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/preview` as const;
|
||||
guildPreview(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/preview` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -224,8 +224,8 @@ export const Routes = {
|
||||
* - POST `/guilds/{guild.id}/channels`
|
||||
* - PATCH `/guilds/{guild.id}/channels`
|
||||
*/
|
||||
guildChannels(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/channels` as const;
|
||||
guildChannels(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/channels` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -235,32 +235,32 @@ export const Routes = {
|
||||
* - PATCH `/guilds/{guild.id}/members/{user.id}`
|
||||
* - DELETE `/guilds/{guild.id}/members/{user.id}`
|
||||
*/
|
||||
guildMember(guildID: Snowflake, userID: Snowflake) {
|
||||
return `/guilds/${guildID}/members/${userID}` as const;
|
||||
guildMember(guildId: Snowflake, userId: Snowflake) {
|
||||
return `/guilds/${guildId}/members/${userId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/members`
|
||||
*/
|
||||
guildMembers(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/members` as const;
|
||||
guildMembers(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/members` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/members/search`
|
||||
*/
|
||||
guildMembersSearch(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/members/search` as const;
|
||||
guildMembersSearch(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/members/search` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - PATCH `/guilds/{guild.id}/members/@me/nick`
|
||||
*/
|
||||
guildCurrentMemberNickname(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/members/@me/nick` as const;
|
||||
guildCurrentMemberNickname(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/members/@me/nick` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -268,16 +268,16 @@ export const Routes = {
|
||||
* - PUT `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
|
||||
* - DELETE `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
|
||||
*/
|
||||
guildMemberRole(guildID: Snowflake, memberID: Snowflake, roleID: Snowflake) {
|
||||
return `/guilds/${guildID}/members/${memberID}/roles/${roleID}` as const;
|
||||
guildMemberRole(guildId: Snowflake, memberId: Snowflake, roleId: Snowflake) {
|
||||
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/bans`
|
||||
*/
|
||||
guildBans(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/bans` as const;
|
||||
guildBans(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/bans` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -286,8 +286,8 @@ export const Routes = {
|
||||
* - PUT `/guilds/{guild.id}/bans/{user.id}`
|
||||
* - DELETE `/guilds/{guild.id}/bans/{user.id}`
|
||||
*/
|
||||
guildBan(guildID: Snowflake, userID: Snowflake) {
|
||||
return `/guilds/${guildID}/bans/${userID}` as const;
|
||||
guildBan(guildId: Snowflake, userId: Snowflake) {
|
||||
return `/guilds/${guildId}/bans/${userId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -296,8 +296,8 @@ export const Routes = {
|
||||
* - POST `/guilds/{guild.id}/roles`
|
||||
* - PATCH `/guilds/{guild.id}/roles`
|
||||
*/
|
||||
guildRoles(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/roles` as const;
|
||||
guildRoles(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/roles` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -305,8 +305,8 @@ export const Routes = {
|
||||
* - PATCH `/guilds/{guild.id}/roles/{role.id}`
|
||||
* - DELETE `/guilds/{guild.id}/roles/{role.id}`
|
||||
*/
|
||||
guildRole(guildID: Snowflake, roleID: Snowflake) {
|
||||
return `/guilds/${guildID}/roles/${roleID}` as const;
|
||||
guildRole(guildId: Snowflake, roleId: Snowflake) {
|
||||
return `/guilds/${guildId}/roles/${roleId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -314,40 +314,40 @@ export const Routes = {
|
||||
* - GET `/guilds/{guild.id}/prune`
|
||||
* - POST `/guilds/{guild.id}/prune`
|
||||
*/
|
||||
guildPrune(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/prune` as const;
|
||||
guildPrune(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/prune` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/regions`
|
||||
*/
|
||||
guildVoiceRegions(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/regions` as const;
|
||||
guildVoiceRegions(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/regions` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/invites`
|
||||
*/
|
||||
guildInvites(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/invites` as const;
|
||||
guildInvites(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/invites` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/integrations`
|
||||
*/
|
||||
guildIntegrations(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/integrations` as const;
|
||||
guildIntegrations(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/integrations` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - DELETE `/guilds/{guild.id}/integrations/{integration.id}`
|
||||
*/
|
||||
guildIntegration(guildID: Snowflake, integrationID: Snowflake) {
|
||||
return `/guilds/${guildID}/integrations/${integrationID}` as const;
|
||||
guildIntegration(guildId: Snowflake, integrationId: Snowflake) {
|
||||
return `/guilds/${guildId}/integrations/${integrationId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -355,32 +355,32 @@ export const Routes = {
|
||||
* - GET `/guilds/{guild.id}/widget`
|
||||
* - PATCH `/guilds/{guild.id}/widget`
|
||||
*/
|
||||
guildWidgetSettings(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/widget` as const;
|
||||
guildWidgetSettings(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/widget` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/widget.json`
|
||||
*/
|
||||
guildWidgetJSON(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/widget.json` as const;
|
||||
guildWidgetJSON(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/widget.json` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/vanity-url`
|
||||
*/
|
||||
guildVanityUrl(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/vanity-url` as const;
|
||||
guildVanityUrl(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/vanity-url` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/widget.png`
|
||||
*/
|
||||
guildWidgetImage(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/widget.png` as const;
|
||||
guildWidgetImage(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/widget.png` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -406,8 +406,8 @@ export const Routes = {
|
||||
* - GET `/guilds/{guild.id}/templates`
|
||||
* - POST `/guilds/{guild.id}/templates`
|
||||
*/
|
||||
guildTemplates(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/templates` as const;
|
||||
guildTemplates(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/templates` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -416,8 +416,8 @@ export const Routes = {
|
||||
* - PATCH `/guilds/{guild.id}/templates/{template.code}`
|
||||
* - DELETE `/guilds/{guild.id}/templates/{template.code}`
|
||||
*/
|
||||
guildTemplate(guildID: Snowflake, code: string) {
|
||||
return `/guilds/${guildID}/templates/${code}` as const;
|
||||
guildTemplate(guildId: Snowflake, code: string) {
|
||||
return `/guilds/${guildId}/templates/${code}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -426,10 +426,10 @@ export const Routes = {
|
||||
* - GET `/users/{user.id}`
|
||||
* - PATCH `/users/@me`
|
||||
*
|
||||
* @param [userID='@me'] The user ID, defaulted to `@me`
|
||||
* @param [userId='@me'] The user ID, defaulted to `@me`
|
||||
*/
|
||||
user(userID: Snowflake | '@me' = '@me') {
|
||||
return `/users/${userID}` as const;
|
||||
user(userId: Snowflake | '@me' = '@me') {
|
||||
return `/users/${userId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -444,8 +444,8 @@ export const Routes = {
|
||||
* Route for:
|
||||
* - DELETE `/users/@me/guilds/{guild.id}`
|
||||
*/
|
||||
userGuild(guildID: Snowflake) {
|
||||
return `/users/@me/guilds/${guildID}` as const;
|
||||
userGuild(guildId: Snowflake) {
|
||||
return `/users/@me/guilds/${guildId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -477,16 +477,16 @@ export const Routes = {
|
||||
* - GET `/channels/{channel.id}/webhooks`
|
||||
* - POST `/channels/{channel.id}/webhooks`
|
||||
*/
|
||||
channelWebhooks(channelID: Snowflake) {
|
||||
return `/channels/${channelID}/webhooks` as const;
|
||||
channelWebhooks(channelId: Snowflake) {
|
||||
return `/channels/${channelId}/webhooks` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/webhooks`
|
||||
*/
|
||||
guildWebhooks(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/webhooks` as const;
|
||||
guildWebhooks(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/webhooks` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -501,8 +501,8 @@ export const Routes = {
|
||||
*
|
||||
* - POST `/webhooks/{application.id}/{interaction.token}`
|
||||
*/
|
||||
webhook(webhookID: Snowflake, webhookToken?: string) {
|
||||
const parts = ['', 'webhooks', webhookID];
|
||||
webhook(webhookId: Snowflake, webhookToken?: string) {
|
||||
const parts = ['', 'webhooks', webhookId];
|
||||
|
||||
if (webhookToken) parts.push(webhookToken);
|
||||
|
||||
@@ -522,10 +522,10 @@ export const Routes = {
|
||||
* - PATCH `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
|
||||
* - DELETE `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
|
||||
*
|
||||
* @param [messageID='@original'] The message ID to change, defaulted to `@original`
|
||||
* @param [messageId='@original'] The message ID to change, defaulted to `@original`
|
||||
*/
|
||||
webhookMessage(webhookID: Snowflake, webhookToken: string, messageID: Snowflake | '@original' = '@original') {
|
||||
return `/webhooks/${webhookID}/${webhookToken}/messages/${messageID}` as const;
|
||||
webhookMessage(webhookId: Snowflake, webhookToken: string, messageId: Snowflake | '@original' = '@original') {
|
||||
return `/webhooks/${webhookId}/${webhookToken}/messages/${messageId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -533,8 +533,8 @@ export const Routes = {
|
||||
* - POST `/webhooks/{webhook.id}/{webhook.token}/github`
|
||||
* - POST `/webhooks/{webhook.id}/{webhook.token}/slack`
|
||||
*/
|
||||
webhookPlatform(webhookID: Snowflake, webhookToken: string, platform: 'github' | 'slack') {
|
||||
return `/webhooks/${webhookID}/${webhookToken}/${platform}` as const;
|
||||
webhookPlatform(webhookId: Snowflake, webhookToken: string, platform: 'github' | 'slack') {
|
||||
return `/webhooks/${webhookId}/${webhookToken}/${platform}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -569,14 +569,38 @@ 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`
|
||||
* - PUT `/applications/{application.id}/commands`
|
||||
* - POST `/applications/{application.id}/commands`
|
||||
*/
|
||||
applicationCommands(applicationID: Snowflake) {
|
||||
return `/applications/${applicationID}/commands` as const;
|
||||
applicationCommands(applicationId: Snowflake) {
|
||||
return `/applications/${applicationId}/commands` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -585,8 +609,8 @@ export const Routes = {
|
||||
* - PATCH `/applications/{application.id}/commands/{command.id}`
|
||||
* - DELETE `/applications/{application.id}/commands/{command.id}`
|
||||
*/
|
||||
applicationCommand(applicationID: Snowflake, commandID: Snowflake) {
|
||||
return `/applications/${applicationID}/commands/${commandID}` as const;
|
||||
applicationCommand(applicationId: Snowflake, commandId: Snowflake) {
|
||||
return `/applications/${applicationId}/commands/${commandId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -595,8 +619,8 @@ export const Routes = {
|
||||
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands`
|
||||
* - POST `/applications/{application.id}/guilds/{guild.id}/commands`
|
||||
*/
|
||||
applicationGuildCommands(applicationID: Snowflake, guildID: Snowflake) {
|
||||
return `/applications/${applicationID}/guilds/${guildID}/commands` as const;
|
||||
applicationGuildCommands(applicationId: Snowflake, guildId: Snowflake) {
|
||||
return `/applications/${applicationId}/guilds/${guildId}/commands` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -605,16 +629,16 @@ export const Routes = {
|
||||
* - PATCH `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
|
||||
* - DELETE `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
|
||||
*/
|
||||
applicationGuildCommand(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) {
|
||||
return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}` as const;
|
||||
applicationGuildCommand(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake) {
|
||||
return `/applications/${applicationId}/guilds/${guildId}/commands/${commandId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - POST `/interactions/{interaction.id}/{interaction.token}/callback`
|
||||
*/
|
||||
interactionCallback(interactionID: Snowflake, interactionToken: string) {
|
||||
return `/interactions/${interactionID}/${interactionToken}/callback` as const;
|
||||
interactionCallback(interactionId: Snowflake, interactionToken: string) {
|
||||
return `/interactions/${interactionId}/${interactionToken}/callback` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -622,8 +646,8 @@ export const Routes = {
|
||||
* - GET `/guilds/{guild.id}/member-verification`
|
||||
* - PATCH `/guilds/{guild.id}/member-verification`
|
||||
*/
|
||||
guildMemberVerification(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/member-verification` as const;
|
||||
guildMemberVerification(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/member-verification` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -631,8 +655,8 @@ export const Routes = {
|
||||
* - PATCH `/guilds/{guild.id}/voice-states/@me`
|
||||
* - PATCH `/guilds/{guild.id}/voice-states/{user.id}`
|
||||
*/
|
||||
guildVoiceState(guildID: Snowflake, userID: Snowflake | '@me' = '@me') {
|
||||
return `/guilds/${guildID}/voice-states/${userID}` as const;
|
||||
guildVoiceState(guildId: Snowflake, userId: Snowflake | '@me' = '@me') {
|
||||
return `/guilds/${guildId}/voice-states/${userId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -640,8 +664,8 @@ export const Routes = {
|
||||
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
|
||||
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
|
||||
*/
|
||||
guildApplicationCommandsPermissions(applicationID: Snowflake, guildID: Snowflake) {
|
||||
return `/applications/${applicationID}/guilds/${guildID}/commands/permissions` as const;
|
||||
guildApplicationCommandsPermissions(applicationId: Snowflake, guildId: Snowflake) {
|
||||
return `/applications/${applicationId}/guilds/${guildId}/commands/permissions` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -649,8 +673,8 @@ export const Routes = {
|
||||
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
|
||||
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
|
||||
*/
|
||||
applicationCommandPermissions(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) {
|
||||
return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}/permissions` as const;
|
||||
applicationCommandPermissions(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake) {
|
||||
return `/applications/${applicationId}/guilds/${guildId}/commands/${commandId}/permissions` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -658,8 +682,8 @@ export const Routes = {
|
||||
* - GET `/guilds/{guild.id}/welcome-screen`
|
||||
* - PATCH `/guilds/{guild.id}/welcome-screen`
|
||||
*/
|
||||
guildWelcomeScreen(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/welcome-screen` as const;
|
||||
guildWelcomeScreen(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/welcome-screen` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -676,16 +700,16 @@ export const Routes = {
|
||||
* - PATCH `/stage-instances/{channel.id}`
|
||||
* - DELETE `/stage-instances/{channel.id}`
|
||||
*/
|
||||
stageInstance(channelID: Snowflake) {
|
||||
return `/stage-instances/${channelID}` as const;
|
||||
stageInstance(channelId: Snowflake) {
|
||||
return `/stage-instances/${channelId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/stickers/{sticker.id}`
|
||||
*/
|
||||
sticker(stickerID: Snowflake) {
|
||||
return `/stickers/${stickerID}` as const;
|
||||
sticker(stickerId: Snowflake) {
|
||||
return `/stickers/${stickerId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -701,8 +725,8 @@ export const Routes = {
|
||||
* - GET `/guilds/{guild.id}/stickers`
|
||||
* - POST `/guilds/{guild.id}/stickers`
|
||||
*/
|
||||
guildStickers(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/stickers` as const;
|
||||
guildStickers(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/stickers` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -711,8 +735,8 @@ export const Routes = {
|
||||
* - PATCH `/guilds/{guild.id}/stickers/{sticker.id}`
|
||||
* - DELETE `/guilds/{guild.id}/stickers/{sticker.id}`
|
||||
*/
|
||||
guildSticker(guildID: Snowflake, stickerID: Snowflake) {
|
||||
return `/guilds/${guildID}/stickers/${stickerID}` as const;
|
||||
guildSticker(guildId: Snowflake, stickerId: Snowflake) {
|
||||
return `/guilds/${guildId}/stickers/${stickerId}` as const;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -728,12 +752,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
|
||||
|
||||
@@ -5,7 +5,9 @@ import type {
|
||||
APIEmbed,
|
||||
APIMessage,
|
||||
APIWebhook,
|
||||
APIAttachment,
|
||||
} from '../../payloads/v8/mod.ts';
|
||||
import type { Nullable } from '../../utils/internals.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#create-webhook
|
||||
@@ -115,14 +117,22 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
|
||||
tts?: boolean;
|
||||
/**
|
||||
* Embedded `rich` content
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
*/
|
||||
embeds?: APIEmbed[];
|
||||
/**
|
||||
* Allowed mentions for the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
||||
*/
|
||||
allowed_mentions?: APIAllowedMentions;
|
||||
/**
|
||||
* the components to include with the message
|
||||
* The components to include with the message
|
||||
*
|
||||
* Requires an application-owned webhook
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
}
|
||||
@@ -210,12 +220,25 @@ export type RESTPostAPIWebhookWithTokenGitHubResult = never;
|
||||
*/
|
||||
export type RESTPostAPIWebhookWithTokenGitHubWaitResult = APIMessage;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#get-webhook-message
|
||||
*/
|
||||
export type RESTGetAPIWebhookWithTokenMessageResult = APIMessage;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
*/
|
||||
export type RESTPatchAPIWebhookWithTokenMessageJSONBody = Nullable<
|
||||
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions'>
|
||||
>;
|
||||
export interface RESTPatchAPIWebhookWithTokenMessageJSONBody
|
||||
extends Nullable<
|
||||
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>
|
||||
> {
|
||||
/**
|
||||
* Attached files to keep
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: APIAttachment[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
@@ -238,11 +261,6 @@ export type RESTPatchAPIWebhookWithTokenMessageFormDataBody =
|
||||
file: unknown;
|
||||
});
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#get-webhook-message
|
||||
*/
|
||||
export type RESTGetAPIWebhookWithTokenMessageResult = APIMessage;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
*/
|
||||
@@ -252,7 +270,3 @@ export type RESTPatchAPIWebhookWithTokenMessageResult = APIMessage;
|
||||
* https://discord.com/developers/docs/resources/webhook#delete-webhook-message
|
||||
*/
|
||||
export type RESTDeleteAPIWebhookWithTokenMessageResult = never;
|
||||
|
||||
type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import type { Permissions, Snowflake } from '../../globals.ts';
|
||||
import type {
|
||||
APIActionRowComponent,
|
||||
APIAllowedMentions,
|
||||
APIAttachment,
|
||||
APIChannel,
|
||||
APIEmbed,
|
||||
APIExtendedInvite,
|
||||
@@ -29,7 +31,7 @@ export type RESTGetAPIChannelResult = APIChannel;
|
||||
*/
|
||||
export interface RESTPatchAPIChannelJSONBody {
|
||||
/**
|
||||
* 2-100 character channel name
|
||||
* 1-100 character channel name
|
||||
*
|
||||
* Channel types: all
|
||||
*/
|
||||
@@ -128,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -228,6 +236,12 @@ export interface RESTPostAPIChannelMessageJSONBody {
|
||||
* See https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
|
||||
*/
|
||||
message_reference?: APIMessageReferenceSend;
|
||||
/**
|
||||
* The components to include with the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
/**
|
||||
* IDs of up to 3 stickers in the server to send in the message
|
||||
*
|
||||
@@ -323,10 +337,14 @@ export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
content?: string | null;
|
||||
/**
|
||||
* Embedded `rich` content (up to 6000 characters)
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
*/
|
||||
embeds?: APIEmbed[];
|
||||
embeds?: APIEmbed[] | null;
|
||||
/**
|
||||
* Embedded `rich` content
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
* @deprecated Use `embeds` instead
|
||||
*/
|
||||
embed?: APIEmbed | null;
|
||||
@@ -335,14 +353,51 @@ export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
*
|
||||
* When specifying flags, ensure to include all previously set flags/bits
|
||||
* in addition to ones that you are modifying
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#message-object-message-flags
|
||||
*/
|
||||
flags?: MessageFlags | null;
|
||||
/**
|
||||
* Allowed mentions for the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
||||
*/
|
||||
allowed_mentions?: APIAllowedMentions | null;
|
||||
/**
|
||||
* Attached files to keep
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: APIAttachment[] | null;
|
||||
/**
|
||||
* The components to include with the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
*/
|
||||
export type RESTPatchAPIChannelMessageFormDataBody =
|
||||
| {
|
||||
/**
|
||||
* JSON stringified message body
|
||||
*/
|
||||
payload_json?: string;
|
||||
/**
|
||||
* The file contents
|
||||
*/
|
||||
file: unknown;
|
||||
}
|
||||
| (RESTPatchAPIChannelMessageJSONBody & {
|
||||
/**
|
||||
* The file contents
|
||||
*/
|
||||
file: unknown;
|
||||
});
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
*/
|
||||
@@ -523,11 +578,13 @@ export type RESTDeleteAPIChannelRecipientResult = unknown;
|
||||
*/
|
||||
export interface RESTPostAPIChannelMessagesThreadsJSONBody {
|
||||
/**
|
||||
* 2-100 character thread name
|
||||
* 1-100 character thread name
|
||||
*/
|
||||
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;
|
||||
}
|
||||
@@ -543,8 +600,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -583,6 +651,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;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import type {
|
||||
APIGuildWidget,
|
||||
APIGuildWidgetSettings,
|
||||
APIRole,
|
||||
APIThreadList,
|
||||
APIVoiceRegion,
|
||||
GuildDefaultMessageNotifications,
|
||||
GuildExplicitContentFilter,
|
||||
@@ -20,6 +21,7 @@ import type {
|
||||
GuildVerificationLevel,
|
||||
GuildWidgetStyle,
|
||||
} from '../../payloads/v9/mod.ts';
|
||||
import type { Nullable } from '../../utils/internals.ts';
|
||||
import type { RESTPutAPIChannelPermissionJSONBody } from './channel.ts';
|
||||
|
||||
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
|
||||
@@ -302,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
|
||||
*/
|
||||
@@ -524,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
|
||||
*
|
||||
@@ -576,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
|
||||
*/
|
||||
@@ -774,7 +797,3 @@ export interface RESTPatchAPIGuildWelcomeScreenJSONBody extends Nullable<Partial
|
||||
*/
|
||||
enabled?: boolean | null;
|
||||
}
|
||||
|
||||
type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null;
|
||||
};
|
||||
|
||||
@@ -3,95 +3,127 @@ import type {
|
||||
APIApplicationCommandPermission,
|
||||
APIGuildApplicationCommandPermissions,
|
||||
APIInteractionResponse,
|
||||
APIInteractionResponseCallbackData,
|
||||
ApplicationCommandType,
|
||||
} from '../../payloads/v9/mod.ts';
|
||||
import type {
|
||||
RESTDeleteAPIWebhookWithTokenMessageResult,
|
||||
RESTGetAPIWebhookWithTokenMessageResult,
|
||||
RESTPatchAPIWebhookWithTokenMessageFormDataBody,
|
||||
RESTPatchAPIWebhookWithTokenMessageJSONBody,
|
||||
RESTPatchAPIWebhookWithTokenMessageResult,
|
||||
RESTPostAPIWebhookWithTokenWaitResult,
|
||||
} 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;
|
||||
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 =
|
||||
| {
|
||||
@@ -112,29 +144,110 @@ export type RESTPostAPIInteractionCallbackFormDataBody =
|
||||
});
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command-permissions
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
|
||||
*/
|
||||
export type RESTGetAPIInteractionOriginalResponseResult = RESTGetAPIWebhookWithTokenMessageResult;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
|
||||
*/
|
||||
export type RESTPatchAPIInteractionOriginalResponseJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
|
||||
*/
|
||||
export type RESTPatchAPIInteractionOriginalResponseFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
|
||||
*/
|
||||
export type RESTPatchAPIInteractionOriginalResponseResult = RESTPatchAPIWebhookWithTokenMessageResult;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response
|
||||
*/
|
||||
export type RESTDeleteAPIInteractionOriginalResponseResult = RESTDeleteAPIWebhookWithTokenMessageResult;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
|
||||
*/
|
||||
export type RESTPostAPIInteractionFollowupJSONBody = APIInteractionResponseCallbackData;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
});
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
|
||||
*/
|
||||
export type RESTPostAPIInteractionFollowupResult = RESTPostAPIWebhookWithTokenWaitResult;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#get-followup-message
|
||||
*/
|
||||
export type RESTGetAPIInteractionFollowupResult = RESTGetAPIWebhookWithTokenMessageResult;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
|
||||
*/
|
||||
export type RESTPatchAPIInteractionFollowupJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
|
||||
*/
|
||||
export type RESTPatchAPIInteractionFollowupFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
|
||||
*/
|
||||
export type RESTPatchAPIInteractionFollowupResult = RESTPatchAPIWebhookWithTokenMessageResult;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message
|
||||
*/
|
||||
export type RESTDeleteAPIInteractionFollowupResult = RESTDeleteAPIWebhookWithTokenMessageResult;
|
||||
|
||||
/**
|
||||
* 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,
|
||||
@@ -142,6 +255,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[];
|
||||
|
||||
@@ -24,8 +24,8 @@ export const Routes = {
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/audit-logs`
|
||||
*/
|
||||
guildAuditLog(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/audit-logs` as const;
|
||||
guildAuditLog(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/audit-logs` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -34,8 +34,8 @@ export const Routes = {
|
||||
* - PATCH `/channels/{channel.id}`
|
||||
* - DELETE `/channels/{channel.id}`
|
||||
*/
|
||||
channel(channelID: Snowflake) {
|
||||
return `/channels/${channelID}` as const;
|
||||
channel(channelId: Snowflake) {
|
||||
return `/channels/${channelId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -43,8 +43,8 @@ export const Routes = {
|
||||
* - GET `/channels/{channel.id}/messages`
|
||||
* - POST `/channels/{channel.id}/messages`
|
||||
*/
|
||||
channelMessages(channelID: Snowflake) {
|
||||
return `/channels/${channelID}/messages` as const;
|
||||
channelMessages(channelId: Snowflake) {
|
||||
return `/channels/${channelId}/messages` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -53,16 +53,16 @@ export const Routes = {
|
||||
* - PATCH `/channels/{channel.id}/messages/{message.id}`
|
||||
* - DELETE `/channels/{channel.id}/messages/{message.id}`
|
||||
*/
|
||||
channelMessage(channelID: Snowflake, messageID: Snowflake) {
|
||||
return `/channels/${channelID}/messages/${messageID}` as const;
|
||||
channelMessage(channelId: Snowflake, messageId: Snowflake) {
|
||||
return `/channels/${channelId}/messages/${messageId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - POST `/channels/{channel.id}/messages/{message.id}/crosspost`
|
||||
*/
|
||||
channelMessageCrosspost(channelID: Snowflake, messageID: Snowflake) {
|
||||
return `/channels/${channelID}/messages/${messageID}/crosspost` as const;
|
||||
channelMessageCrosspost(channelId: Snowflake, messageId: Snowflake) {
|
||||
return `/channels/${channelId}/messages/${messageId}/crosspost` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -72,8 +72,8 @@ export const Routes = {
|
||||
*
|
||||
* **Note**: You need to URL encode the emoji yourself
|
||||
*/
|
||||
channelMessageOwnReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) {
|
||||
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/@me` as const;
|
||||
channelMessageOwnReaction(channelId: Snowflake, messageId: Snowflake, emoji: string) {
|
||||
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}/@me` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -82,8 +82,8 @@ export const Routes = {
|
||||
*
|
||||
* **Note**: You need to URL encode the emoji yourself
|
||||
*/
|
||||
channelMessageUserReaction(channelID: Snowflake, messageID: Snowflake, emoji: string, userID: Snowflake) {
|
||||
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/${userID}` as const;
|
||||
channelMessageUserReaction(channelId: Snowflake, messageId: Snowflake, emoji: string, userId: Snowflake) {
|
||||
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}/${userId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -93,24 +93,24 @@ export const Routes = {
|
||||
*
|
||||
* **Note**: You need to URL encode the emoji yourself
|
||||
*/
|
||||
channelMessageReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) {
|
||||
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}` as const;
|
||||
channelMessageReaction(channelId: Snowflake, messageId: Snowflake, emoji: string) {
|
||||
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - DELETE `/channels/{channel.id}/messages/{message.id}/reactions`
|
||||
*/
|
||||
channelMessageAllReactions(channelID: Snowflake, messageID: Snowflake) {
|
||||
return `/channels/${channelID}/messages/${messageID}/reactions` as const;
|
||||
channelMessageAllReactions(channelId: Snowflake, messageId: Snowflake) {
|
||||
return `/channels/${channelId}/messages/${messageId}/reactions` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - POST `/channels/{channel.id}/messages/bulk-delete`
|
||||
*/
|
||||
channelBulkDelete(channelID: Snowflake) {
|
||||
return `/channels/${channelID}/messages/bulk-delete` as const;
|
||||
channelBulkDelete(channelId: Snowflake) {
|
||||
return `/channels/${channelId}/messages/bulk-delete` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -118,8 +118,8 @@ export const Routes = {
|
||||
* - PUT `/channels/{channel.id}/permissions/{overwrite.id}`
|
||||
* - DELETE `/channels/{channel.id}/permissions/{overwrite.id}`
|
||||
*/
|
||||
channelPermission(channelID: Snowflake, overwriteID: Snowflake) {
|
||||
return `/channels/${channelID}/permissions/${overwriteID}` as const;
|
||||
channelPermission(channelId: Snowflake, overwriteId: Snowflake) {
|
||||
return `/channels/${channelId}/permissions/${overwriteId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -127,32 +127,32 @@ export const Routes = {
|
||||
* - GET `/channels/{channel.id}/invites`
|
||||
* - POST `/channels/{channel.id}/invites`
|
||||
*/
|
||||
channelInvites(channelID: Snowflake) {
|
||||
return `/channels/${channelID}/invites` as const;
|
||||
channelInvites(channelId: Snowflake) {
|
||||
return `/channels/${channelId}/invites` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - POST `/channels/{channel.id}/followers`
|
||||
*/
|
||||
channelFollowers(channelID: Snowflake) {
|
||||
return `/channels/${channelID}/followers` as const;
|
||||
channelFollowers(channelId: Snowflake) {
|
||||
return `/channels/${channelId}/followers` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - POST `/channels/{channel.id}/typing`
|
||||
*/
|
||||
channelTyping(channelID: Snowflake) {
|
||||
return `/channels/${channelID}/typing` as const;
|
||||
channelTyping(channelId: Snowflake) {
|
||||
return `/channels/${channelId}/typing` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/channels/{channel.id}/pins`
|
||||
*/
|
||||
channelPins(channelID: Snowflake) {
|
||||
return `/channels/${channelID}/pins` as const;
|
||||
channelPins(channelId: Snowflake) {
|
||||
return `/channels/${channelId}/pins` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -160,8 +160,8 @@ export const Routes = {
|
||||
* - PUT `/channels/{channel.id}/pins/{message.id}`
|
||||
* - DELETE `/channels/{channel.id}/pins/{message.id}`
|
||||
*/
|
||||
channelPin(channelID: Snowflake, messageID: Snowflake) {
|
||||
return `/channels/${channelID}/pins/${messageID}` as const;
|
||||
channelPin(channelId: Snowflake, messageId: Snowflake) {
|
||||
return `/channels/${channelId}/pins/${messageId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -169,8 +169,8 @@ export const Routes = {
|
||||
* - PUT `/channels/{channel.id}/recipients/{user.id}`
|
||||
* - DELETE `/channels/{channel.id}/recipients/{user.id}`
|
||||
*/
|
||||
channelRecipient(channelID: Snowflake, userID: Snowflake) {
|
||||
return `/channels/${channelID}/recipients/${userID}` as const;
|
||||
channelRecipient(channelId: Snowflake, userId: Snowflake) {
|
||||
return `/channels/${channelId}/recipients/${userId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -178,8 +178,8 @@ export const Routes = {
|
||||
* - GET `/guilds/{guild.id}/emojis`
|
||||
* - POST `/guilds/{guild.id}/emojis`
|
||||
*/
|
||||
guildEmojis(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/emojis` as const;
|
||||
guildEmojis(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/emojis` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -188,8 +188,8 @@ export const Routes = {
|
||||
* - PATCH `/guilds/{guild.id}/emojis/{emoji.id}`
|
||||
* - DELETE `/guilds/{guild.id}/emojis/{emoji.id}`
|
||||
*/
|
||||
guildEmoji(guildID: Snowflake, emojiID: Snowflake) {
|
||||
return `/guilds/${guildID}/emojis/${emojiID}` as const;
|
||||
guildEmoji(guildId: Snowflake, emojiId: Snowflake) {
|
||||
return `/guilds/${guildId}/emojis/${emojiId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -206,16 +206,16 @@ export const Routes = {
|
||||
* - PATCH `/guilds/{guild.id}`
|
||||
* - DELETE `/guilds/{guild.id}`
|
||||
*/
|
||||
guild(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}` as const;
|
||||
guild(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/preview`
|
||||
*/
|
||||
guildPreview(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/preview` as const;
|
||||
guildPreview(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/preview` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -224,8 +224,8 @@ export const Routes = {
|
||||
* - POST `/guilds/{guild.id}/channels`
|
||||
* - PATCH `/guilds/{guild.id}/channels`
|
||||
*/
|
||||
guildChannels(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/channels` as const;
|
||||
guildChannels(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/channels` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -235,32 +235,32 @@ export const Routes = {
|
||||
* - PATCH `/guilds/{guild.id}/members/{user.id}`
|
||||
* - DELETE `/guilds/{guild.id}/members/{user.id}`
|
||||
*/
|
||||
guildMember(guildID: Snowflake, userID: Snowflake) {
|
||||
return `/guilds/${guildID}/members/${userID}` as const;
|
||||
guildMember(guildId: Snowflake, userId: Snowflake) {
|
||||
return `/guilds/${guildId}/members/${userId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/members`
|
||||
*/
|
||||
guildMembers(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/members` as const;
|
||||
guildMembers(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/members` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/members/search`
|
||||
*/
|
||||
guildMembersSearch(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/members/search` as const;
|
||||
guildMembersSearch(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/members/search` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - PATCH `/guilds/{guild.id}/members/@me/nick`
|
||||
*/
|
||||
guildCurrentMemberNickname(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/members/@me/nick` as const;
|
||||
guildCurrentMemberNickname(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/members/@me/nick` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -268,16 +268,16 @@ export const Routes = {
|
||||
* - PUT `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
|
||||
* - DELETE `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
|
||||
*/
|
||||
guildMemberRole(guildID: Snowflake, memberID: Snowflake, roleID: Snowflake) {
|
||||
return `/guilds/${guildID}/members/${memberID}/roles/${roleID}` as const;
|
||||
guildMemberRole(guildId: Snowflake, memberId: Snowflake, roleId: Snowflake) {
|
||||
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/bans`
|
||||
*/
|
||||
guildBans(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/bans` as const;
|
||||
guildBans(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/bans` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -286,8 +286,8 @@ export const Routes = {
|
||||
* - PUT `/guilds/{guild.id}/bans/{user.id}`
|
||||
* - DELETE `/guilds/{guild.id}/bans/{user.id}`
|
||||
*/
|
||||
guildBan(guildID: Snowflake, userID: Snowflake) {
|
||||
return `/guilds/${guildID}/bans/${userID}` as const;
|
||||
guildBan(guildId: Snowflake, userId: Snowflake) {
|
||||
return `/guilds/${guildId}/bans/${userId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -296,8 +296,8 @@ export const Routes = {
|
||||
* - POST `/guilds/{guild.id}/roles`
|
||||
* - PATCH `/guilds/{guild.id}/roles`
|
||||
*/
|
||||
guildRoles(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/roles` as const;
|
||||
guildRoles(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/roles` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -305,8 +305,8 @@ export const Routes = {
|
||||
* - PATCH `/guilds/{guild.id}/roles/{role.id}`
|
||||
* - DELETE `/guilds/{guild.id}/roles/{role.id}`
|
||||
*/
|
||||
guildRole(guildID: Snowflake, roleID: Snowflake) {
|
||||
return `/guilds/${guildID}/roles/${roleID}` as const;
|
||||
guildRole(guildId: Snowflake, roleId: Snowflake) {
|
||||
return `/guilds/${guildId}/roles/${roleId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -314,40 +314,40 @@ export const Routes = {
|
||||
* - GET `/guilds/{guild.id}/prune`
|
||||
* - POST `/guilds/{guild.id}/prune`
|
||||
*/
|
||||
guildPrune(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/prune` as const;
|
||||
guildPrune(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/prune` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/regions`
|
||||
*/
|
||||
guildVoiceRegions(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/regions` as const;
|
||||
guildVoiceRegions(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/regions` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/invites`
|
||||
*/
|
||||
guildInvites(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/invites` as const;
|
||||
guildInvites(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/invites` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/integrations`
|
||||
*/
|
||||
guildIntegrations(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/integrations` as const;
|
||||
guildIntegrations(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/integrations` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - DELETE `/guilds/{guild.id}/integrations/{integration.id}`
|
||||
*/
|
||||
guildIntegration(guildID: Snowflake, integrationID: Snowflake) {
|
||||
return `/guilds/${guildID}/integrations/${integrationID}` as const;
|
||||
guildIntegration(guildId: Snowflake, integrationId: Snowflake) {
|
||||
return `/guilds/${guildId}/integrations/${integrationId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -355,32 +355,32 @@ export const Routes = {
|
||||
* - GET `/guilds/{guild.id}/widget`
|
||||
* - PATCH `/guilds/{guild.id}/widget`
|
||||
*/
|
||||
guildWidgetSettings(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/widget` as const;
|
||||
guildWidgetSettings(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/widget` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/widget.json`
|
||||
*/
|
||||
guildWidgetJSON(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/widget.json` as const;
|
||||
guildWidgetJSON(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/widget.json` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/vanity-url`
|
||||
*/
|
||||
guildVanityUrl(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/vanity-url` as const;
|
||||
guildVanityUrl(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/vanity-url` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/widget.png`
|
||||
*/
|
||||
guildWidgetImage(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/widget.png` as const;
|
||||
guildWidgetImage(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/widget.png` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -406,8 +406,8 @@ export const Routes = {
|
||||
* - GET `/guilds/{guild.id}/templates`
|
||||
* - POST `/guilds/{guild.id}/templates`
|
||||
*/
|
||||
guildTemplates(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/templates` as const;
|
||||
guildTemplates(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/templates` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -416,8 +416,8 @@ export const Routes = {
|
||||
* - PATCH `/guilds/{guild.id}/templates/{template.code}`
|
||||
* - DELETE `/guilds/{guild.id}/templates/{template.code}`
|
||||
*/
|
||||
guildTemplate(guildID: Snowflake, code: string) {
|
||||
return `/guilds/${guildID}/templates/${code}` as const;
|
||||
guildTemplate(guildId: Snowflake, code: string) {
|
||||
return `/guilds/${guildId}/templates/${code}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -425,24 +425,34 @@ export const Routes = {
|
||||
* - POST `/channels/{channel.id}/threads`
|
||||
* - POST `/channels/{channel.id}/messages/{message.id}/threads`
|
||||
*/
|
||||
threads(parentID: Snowflake, messageID?: Snowflake) {
|
||||
const parts = ['', 'channels', parentID];
|
||||
threads(parentId: Snowflake, messageId?: Snowflake) {
|
||||
const parts = ['', 'channels', parentId];
|
||||
|
||||
if (messageID) parts.push('messages', messageID);
|
||||
if (messageId) parts.push('messages', messageId);
|
||||
|
||||
parts.push('threads');
|
||||
|
||||
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`
|
||||
*/
|
||||
channelThreads(channelID: Snowflake, archived?: 'public' | 'private') {
|
||||
const parts = ['', 'channels', channelID, 'threads'];
|
||||
channelThreads(channelId: Snowflake, archived?: 'public' | 'private') {
|
||||
const parts = ['', 'channels', channelId, 'threads'];
|
||||
|
||||
if (archived) parts.push('archived', archived);
|
||||
else parts.push('active');
|
||||
@@ -456,8 +466,8 @@ export const Routes = {
|
||||
* Route for:
|
||||
* - GET `/channels/{channel.id}/users/@me/threads/archived/prviate`
|
||||
*/
|
||||
channelJoinedArhivedThreads(channelID: Snowflake) {
|
||||
return `/channels/${channelID}/users/@me/threads/archived/private` as const;
|
||||
channelJoinedArchivedThreads(channelId: Snowflake) {
|
||||
return `/channels/${channelId}/users/@me/threads/archived/private` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -468,10 +478,10 @@ export const Routes = {
|
||||
* - DELETE `/channels/{thread.id}/thread-members/@me`
|
||||
* - DELETE `/channels/{thread.id}/thread-members/{user.id}`
|
||||
*/
|
||||
threadMembers(threadID: Snowflake, userID?: Snowflake | '@me') {
|
||||
const parts = ['', 'channels', threadID, 'thread-members'];
|
||||
threadMembers(threadId: Snowflake, userId?: Snowflake | '@me') {
|
||||
const parts = ['', 'channels', threadId, 'thread-members'];
|
||||
|
||||
if (userID) parts.push(userID);
|
||||
if (userId) parts.push(userId);
|
||||
|
||||
return parts.join('/') as
|
||||
| `/channels/${Snowflake}/thread-members`
|
||||
@@ -484,10 +494,10 @@ export const Routes = {
|
||||
* - GET `/users/{user.id}`
|
||||
* - PATCH `/users/@me`
|
||||
*
|
||||
* @param [userID='@me'] The user ID, defaulted to `@me`
|
||||
* @param [userId='@me'] The user ID, defaulted to `@me`
|
||||
*/
|
||||
user(userID: Snowflake | '@me' = '@me') {
|
||||
return `/users/${userID}` as const;
|
||||
user(userId: Snowflake | '@me' = '@me') {
|
||||
return `/users/${userId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -502,8 +512,8 @@ export const Routes = {
|
||||
* Route for:
|
||||
* - DELETE `/users/@me/guilds/{guild.id}`
|
||||
*/
|
||||
userGuild(guildID: Snowflake) {
|
||||
return `/users/@me/guilds/${guildID}` as const;
|
||||
userGuild(guildId: Snowflake) {
|
||||
return `/users/@me/guilds/${guildId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -535,16 +545,16 @@ export const Routes = {
|
||||
* - GET `/channels/{channel.id}/webhooks`
|
||||
* - POST `/channels/{channel.id}/webhooks`
|
||||
*/
|
||||
channelWebhooks(channelID: Snowflake) {
|
||||
return `/channels/${channelID}/webhooks` as const;
|
||||
channelWebhooks(channelId: Snowflake) {
|
||||
return `/channels/${channelId}/webhooks` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/webhooks`
|
||||
*/
|
||||
guildWebhooks(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/webhooks` as const;
|
||||
guildWebhooks(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/webhooks` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -559,8 +569,8 @@ export const Routes = {
|
||||
*
|
||||
* - POST `/webhooks/{application.id}/{interaction.token}`
|
||||
*/
|
||||
webhook(webhookID: Snowflake, webhookToken?: string) {
|
||||
const parts = ['', 'webhooks', webhookID];
|
||||
webhook(webhookId: Snowflake, webhookToken?: string) {
|
||||
const parts = ['', 'webhooks', webhookId];
|
||||
|
||||
if (webhookToken) parts.push(webhookToken);
|
||||
|
||||
@@ -580,10 +590,10 @@ export const Routes = {
|
||||
* - PATCH `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
|
||||
* - DELETE `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
|
||||
*
|
||||
* @param [messageID='@original'] The message ID to change, defaulted to `@original`
|
||||
* @param [messageId='@original'] The message ID to change, defaulted to `@original`
|
||||
*/
|
||||
webhookMessage(webhookID: Snowflake, webhookToken: string, messageID: Snowflake | '@original' = '@original') {
|
||||
return `/webhooks/${webhookID}/${webhookToken}/messages/${messageID}` as const;
|
||||
webhookMessage(webhookId: Snowflake, webhookToken: string, messageId: Snowflake | '@original' = '@original') {
|
||||
return `/webhooks/${webhookId}/${webhookToken}/messages/${messageId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -591,8 +601,8 @@ export const Routes = {
|
||||
* - POST `/webhooks/{webhook.id}/{webhook.token}/github`
|
||||
* - POST `/webhooks/{webhook.id}/{webhook.token}/slack`
|
||||
*/
|
||||
webhookPlatform(webhookID: Snowflake, webhookToken: string, platform: 'github' | 'slack') {
|
||||
return `/webhooks/${webhookID}/${webhookToken}/${platform}` as const;
|
||||
webhookPlatform(webhookId: Snowflake, webhookToken: string, platform: 'github' | 'slack') {
|
||||
return `/webhooks/${webhookId}/${webhookToken}/${platform}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -627,14 +637,38 @@ 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`
|
||||
* - PUT `/applications/{application.id}/commands`
|
||||
* - POST `/applications/{application.id}/commands`
|
||||
*/
|
||||
applicationCommands(applicationID: Snowflake) {
|
||||
return `/applications/${applicationID}/commands` as const;
|
||||
applicationCommands(applicationId: Snowflake) {
|
||||
return `/applications/${applicationId}/commands` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -643,8 +677,8 @@ export const Routes = {
|
||||
* - PATCH `/applications/{application.id}/commands/{command.id}`
|
||||
* - DELETE `/applications/{application.id}/commands/{command.id}`
|
||||
*/
|
||||
applicationCommand(applicationID: Snowflake, commandID: Snowflake) {
|
||||
return `/applications/${applicationID}/commands/${commandID}` as const;
|
||||
applicationCommand(applicationId: Snowflake, commandId: Snowflake) {
|
||||
return `/applications/${applicationId}/commands/${commandId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -653,8 +687,8 @@ export const Routes = {
|
||||
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands`
|
||||
* - POST `/applications/{application.id}/guilds/{guild.id}/commands`
|
||||
*/
|
||||
applicationGuildCommands(applicationID: Snowflake, guildID: Snowflake) {
|
||||
return `/applications/${applicationID}/guilds/${guildID}/commands` as const;
|
||||
applicationGuildCommands(applicationId: Snowflake, guildId: Snowflake) {
|
||||
return `/applications/${applicationId}/guilds/${guildId}/commands` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -663,16 +697,16 @@ export const Routes = {
|
||||
* - PATCH `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
|
||||
* - DELETE `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
|
||||
*/
|
||||
applicationGuildCommand(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) {
|
||||
return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}` as const;
|
||||
applicationGuildCommand(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake) {
|
||||
return `/applications/${applicationId}/guilds/${guildId}/commands/${commandId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - POST `/interactions/{interaction.id}/{interaction.token}/callback`
|
||||
*/
|
||||
interactionCallback(interactionID: Snowflake, interactionToken: string) {
|
||||
return `/interactions/${interactionID}/${interactionToken}/callback` as const;
|
||||
interactionCallback(interactionId: Snowflake, interactionToken: string) {
|
||||
return `/interactions/${interactionId}/${interactionToken}/callback` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -680,8 +714,8 @@ export const Routes = {
|
||||
* - GET `/guilds/{guild.id}/member-verification`
|
||||
* - PATCH `/guilds/{guild.id}/member-verification`
|
||||
*/
|
||||
guildMemberVerification(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/member-verification` as const;
|
||||
guildMemberVerification(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/member-verification` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -689,8 +723,8 @@ export const Routes = {
|
||||
* - PATCH `/guilds/{guild.id}/voice-states/@me`
|
||||
* - PATCH `/guilds/{guild.id}/voice-states/{user.id}`
|
||||
*/
|
||||
guildVoiceState(guildID: Snowflake, userID: Snowflake | '@me' = '@me') {
|
||||
return `/guilds/${guildID}/voice-states/${userID}` as const;
|
||||
guildVoiceState(guildId: Snowflake, userId: Snowflake | '@me' = '@me') {
|
||||
return `/guilds/${guildId}/voice-states/${userId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -698,8 +732,8 @@ export const Routes = {
|
||||
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
|
||||
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
|
||||
*/
|
||||
guildApplicationCommandsPermissions(applicationID: Snowflake, guildID: Snowflake) {
|
||||
return `/applications/${applicationID}/guilds/${guildID}/commands/permissions` as const;
|
||||
guildApplicationCommandsPermissions(applicationId: Snowflake, guildId: Snowflake) {
|
||||
return `/applications/${applicationId}/guilds/${guildId}/commands/permissions` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -707,8 +741,8 @@ export const Routes = {
|
||||
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
|
||||
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
|
||||
*/
|
||||
applicationCommandPermissions(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) {
|
||||
return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}/permissions` as const;
|
||||
applicationCommandPermissions(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake) {
|
||||
return `/applications/${applicationId}/guilds/${guildId}/commands/${commandId}/permissions` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -716,8 +750,8 @@ export const Routes = {
|
||||
* - GET `/guilds/{guild.id}/welcome-screen`
|
||||
* - PATCH `/guilds/{guild.id}/welcome-screen`
|
||||
*/
|
||||
guildWelcomeScreen(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/welcome-screen` as const;
|
||||
guildWelcomeScreen(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/welcome-screen` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -734,16 +768,16 @@ export const Routes = {
|
||||
* - PATCH `/stage-instances/{channel.id}`
|
||||
* - DELETE `/stage-instances/{channel.id}`
|
||||
*/
|
||||
stageInstance(channelID: Snowflake) {
|
||||
return `/stage-instances/${channelID}` as const;
|
||||
stageInstance(channelId: Snowflake) {
|
||||
return `/stage-instances/${channelId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/stickers/{sticker.id}`
|
||||
*/
|
||||
sticker(stickerID: Snowflake) {
|
||||
return `/stickers/${stickerID}` as const;
|
||||
sticker(stickerId: Snowflake) {
|
||||
return `/stickers/${stickerId}` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -759,8 +793,8 @@ export const Routes = {
|
||||
* - GET `/guilds/{guild.id}/stickers`
|
||||
* - POST `/guilds/{guild.id}/stickers`
|
||||
*/
|
||||
guildStickers(guildID: Snowflake) {
|
||||
return `/guilds/${guildID}/stickers` as const;
|
||||
guildStickers(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/stickers` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -769,8 +803,8 @@ export const Routes = {
|
||||
* - PATCH `/guilds/{guild.id}/stickers/{sticker.id}`
|
||||
* - DELETE `/guilds/{guild.id}/stickers/{sticker.id}`
|
||||
*/
|
||||
guildSticker(guildID: Snowflake, stickerID: Snowflake) {
|
||||
return `/guilds/${guildID}/stickers/${stickerID}` as const;
|
||||
guildSticker(guildId: Snowflake, stickerId: Snowflake) {
|
||||
return `/guilds/${guildId}/stickers/${stickerId}` as const;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -786,12 +820,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
|
||||
|
||||
@@ -5,7 +5,9 @@ import type {
|
||||
APIEmbed,
|
||||
APIMessage,
|
||||
APIWebhook,
|
||||
APIAttachment,
|
||||
} from '../../payloads/v9/mod.ts';
|
||||
import type { Nullable } from '../../utils/internals.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#create-webhook
|
||||
@@ -115,18 +117,22 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
|
||||
tts?: boolean;
|
||||
/**
|
||||
* Embedded `rich` content
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
*/
|
||||
embeds?: APIEmbed[];
|
||||
/**
|
||||
* Allowed mentions for the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
||||
*/
|
||||
allowed_mentions?: APIAllowedMentions;
|
||||
/**
|
||||
* The thread to post this message in
|
||||
*/
|
||||
thread_id?: Snowflake;
|
||||
/**
|
||||
* the components to include with the message
|
||||
* The components to include with the message
|
||||
*
|
||||
* Requires an application-owned webhook
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
}
|
||||
@@ -163,6 +169,10 @@ export interface RESTPostAPIWebhookWithTokenQuery {
|
||||
* @default false
|
||||
*/
|
||||
wait?: boolean;
|
||||
/**
|
||||
* Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived.
|
||||
*/
|
||||
thread_id?: Snowflake;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -214,12 +224,25 @@ export type RESTPostAPIWebhookWithTokenGitHubResult = never;
|
||||
*/
|
||||
export type RESTPostAPIWebhookWithTokenGitHubWaitResult = APIMessage;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#get-webhook-message
|
||||
*/
|
||||
export type RESTGetAPIWebhookWithTokenMessageResult = APIMessage;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
*/
|
||||
export type RESTPatchAPIWebhookWithTokenMessageJSONBody = Nullable<
|
||||
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions'>
|
||||
>;
|
||||
export interface RESTPatchAPIWebhookWithTokenMessageJSONBody
|
||||
extends Nullable<
|
||||
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>
|
||||
> {
|
||||
/**
|
||||
* Attached files to keep
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: APIAttachment[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
@@ -242,11 +265,6 @@ export type RESTPatchAPIWebhookWithTokenMessageFormDataBody =
|
||||
file: unknown;
|
||||
});
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#get-webhook-message
|
||||
*/
|
||||
export type RESTGetAPIWebhookWithTokenMessageResult = APIMessage;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
*/
|
||||
@@ -256,7 +274,3 @@ export type RESTPatchAPIWebhookWithTokenMessageResult = APIMessage;
|
||||
* https://discord.com/developers/docs/resources/webhook#delete-webhook-message
|
||||
*/
|
||||
export type RESTDeleteAPIWebhookWithTokenMessageResult = never;
|
||||
|
||||
type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null;
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@ export enum RPCErrorCodes {
|
||||
InvalidEvent,
|
||||
InvalidChannel,
|
||||
InvalidPermissions,
|
||||
InvalidClientID,
|
||||
InvalidClientId,
|
||||
InvalidOrigin,
|
||||
InvalidToken,
|
||||
InvalidUser,
|
||||
@@ -24,7 +24,7 @@ export enum RPCErrorCodes {
|
||||
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-close-event-codes
|
||||
*/
|
||||
export enum RPCCloseEventCodes {
|
||||
InvalidClientID = 4000,
|
||||
InvalidClientId = 4000,
|
||||
InvalidOrigin,
|
||||
RateLimited,
|
||||
TokenRevoked,
|
||||
|
||||
@@ -9,7 +9,7 @@ export enum RPCErrorCodes {
|
||||
InvalidEvent,
|
||||
InvalidChannel,
|
||||
InvalidPermissions,
|
||||
InvalidClientID,
|
||||
InvalidClientId,
|
||||
InvalidOrigin,
|
||||
InvalidToken,
|
||||
InvalidUser,
|
||||
@@ -24,7 +24,7 @@ export enum RPCErrorCodes {
|
||||
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-close-event-codes
|
||||
*/
|
||||
export enum RPCCloseEventCodes {
|
||||
InvalidClientID = 4000,
|
||||
InvalidClientId = 4000,
|
||||
InvalidOrigin,
|
||||
RateLimited,
|
||||
TokenRevoked,
|
||||
|
||||
3
deno/utils/internals.ts
Normal file
3
deno/utils/internals.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null;
|
||||
};
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
APIApplicationCommandGuildInteraction,
|
||||
APIApplicationCommandInteraction,
|
||||
APIButtonComponent,
|
||||
APIButtonComponentWithCustomID,
|
||||
APIButtonComponentWithCustomId,
|
||||
APIButtonComponentWithURL,
|
||||
APIDMInteraction,
|
||||
APIGuildInteraction,
|
||||
@@ -98,6 +98,6 @@ export function isLinkButton(component: APIButtonComponent): component is APIBut
|
||||
* @param button The button to check against
|
||||
* @returns A boolean that indicates if the button has a `custom_id` attached to it
|
||||
*/
|
||||
export function isStyledButton(component: APIButtonComponent): component is APIButtonComponentWithCustomID {
|
||||
export function isInteractionButton(component: APIButtonComponent): component is APIButtonComponentWithCustomId {
|
||||
return component.style !== ButtonStyle.Link;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
APIApplicationCommandGuildInteraction,
|
||||
APIApplicationCommandInteraction,
|
||||
APIButtonComponent,
|
||||
APIButtonComponentWithCustomID,
|
||||
APIButtonComponentWithCustomId,
|
||||
APIButtonComponentWithURL,
|
||||
APIDMInteraction,
|
||||
APIGuildInteraction,
|
||||
@@ -98,6 +98,6 @@ export function isLinkButton(component: APIButtonComponent): component is APIBut
|
||||
* @param button The button to check against
|
||||
* @returns A boolean that indicates if the button has a `custom_id` attached to it
|
||||
*/
|
||||
export function isStyledButton(component: APIButtonComponent): component is APIButtonComponentWithCustomID {
|
||||
export function isInteractionButton(component: APIButtonComponent): component is APIButtonComponentWithCustomId {
|
||||
return component.style !== ButtonStyle.Link;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import type { Snowflake } from '../globals';
|
||||
import type {
|
||||
APIApplication,
|
||||
APIApplicationCommand,
|
||||
APIApplicationCommandInteraction,
|
||||
APIChannel,
|
||||
APIEmoji,
|
||||
@@ -25,6 +24,7 @@ import type {
|
||||
InviteTargetType,
|
||||
PresenceUpdateStatus,
|
||||
} from '../payloads/v8/index';
|
||||
import type { Nullable } from '../utils/internals';
|
||||
|
||||
export * from './common';
|
||||
|
||||
@@ -189,9 +189,6 @@ export const enum GatewayIntentBits {
|
||||
* 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',
|
||||
@@ -297,55 +294,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
|
||||
*/
|
||||
@@ -441,7 +389,7 @@ export interface GatewayReadyDispatchData {
|
||||
/**
|
||||
* Contains `id` and `flags`
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/oauth2#application-object
|
||||
* See https://discord.com/developers/docs/resources/application#application-object
|
||||
*/
|
||||
application: Pick<APIApplication, 'id' | 'flags'>;
|
||||
}
|
||||
@@ -734,9 +682,10 @@ export type GatewayGuildMemberUpdateDispatch = DataPayload<
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#guild-member-update
|
||||
*/
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user'> &
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user' | 'joined_at'> &
|
||||
Partial<Pick<APIGuildMember, 'deaf' | 'mute'>> &
|
||||
Required<Pick<APIGuildMember, 'user'>> & {
|
||||
Required<Pick<APIGuildMember, 'user'>> &
|
||||
Nullable<Pick<APIGuildMember, 'joined_at'>> & {
|
||||
/**
|
||||
* The id of the guild
|
||||
*/
|
||||
@@ -1375,7 +1324,7 @@ export interface GatewayIdentifyData {
|
||||
/**
|
||||
* Presence structure for initial presence information
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence
|
||||
*/
|
||||
presence?: GatewayPresenceUpdateData;
|
||||
/**
|
||||
@@ -1504,7 +1453,7 @@ export interface GatewayVoiceStateUpdateData {
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#update-status
|
||||
* https://discord.com/developers/docs/topics/gateway#update-presence
|
||||
*/
|
||||
export interface GatewayUpdatePresence {
|
||||
op: GatewayOpcodes.PresenceUpdate;
|
||||
@@ -1512,7 +1461,7 @@ export interface GatewayUpdatePresence {
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure
|
||||
* https://discord.com/developers/docs/topics/gateway#update-presence-gateway-presence-update-structure
|
||||
*/
|
||||
export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
@@ -1528,7 +1477,7 @@ export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
* The user's new status
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status-status-types
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence-status-types
|
||||
*/
|
||||
status: PresenceUpdateStatus;
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import type { Snowflake } from '../globals';
|
||||
import type {
|
||||
APIApplication,
|
||||
APIApplicationCommand,
|
||||
APIApplicationCommandInteraction,
|
||||
APIChannel,
|
||||
APIEmoji,
|
||||
@@ -28,6 +27,7 @@ import type {
|
||||
InviteTargetType,
|
||||
PresenceUpdateStatus,
|
||||
} from '../payloads/v9/index';
|
||||
import type { Nullable } from '../utils/internals';
|
||||
|
||||
export * from './common';
|
||||
|
||||
@@ -192,9 +192,6 @@ export const enum GatewayIntentBits {
|
||||
* 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',
|
||||
@@ -307,55 +304,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
|
||||
*/
|
||||
@@ -451,7 +399,7 @@ export interface GatewayReadyDispatchData {
|
||||
/**
|
||||
* Contains `id` and `flags`
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/oauth2#application-object
|
||||
* See https://discord.com/developers/docs/resources/application#application-object
|
||||
*/
|
||||
application: Pick<APIApplication, 'id' | 'flags'>;
|
||||
}
|
||||
@@ -744,9 +692,10 @@ export type GatewayGuildMemberUpdateDispatch = DataPayload<
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#guild-member-update
|
||||
*/
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user'> &
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user' | 'joined_at'> &
|
||||
Partial<Pick<APIGuildMember, 'deaf' | 'mute'>> &
|
||||
Required<Pick<APIGuildMember, 'user'>> & {
|
||||
Required<Pick<APIGuildMember, 'user'>> &
|
||||
Nullable<Pick<APIGuildMember, 'joined_at'>> & {
|
||||
/**
|
||||
* The id of the guild
|
||||
*/
|
||||
@@ -1464,7 +1413,7 @@ export interface GatewayIdentifyData {
|
||||
/**
|
||||
* Presence structure for initial presence information
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence
|
||||
*/
|
||||
presence?: GatewayPresenceUpdateData;
|
||||
/**
|
||||
@@ -1601,7 +1550,7 @@ export interface GatewayUpdatePresence {
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure
|
||||
* https://discord.com/developers/docs/topics/gateway#update-presence-gateway-presence-update-structure
|
||||
*/
|
||||
export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
@@ -1617,7 +1566,7 @@ export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
* The user's new status
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status-status-types
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence-status-types
|
||||
*/
|
||||
status: PresenceUpdateStatus;
|
||||
/**
|
||||
|
||||
@@ -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
4
package-lock.json
generated
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "discord-api-types",
|
||||
"version": "0.19.0",
|
||||
"version": "0.24.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"version": "0.19.0",
|
||||
"version": "0.24.0",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.14.6",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "discord-api-types",
|
||||
"version": "0.19.0",
|
||||
"version": "0.24.0",
|
||||
"description": "Discord API typings that are kept up to date for use in bot library creation.",
|
||||
"main": "./v9.js",
|
||||
"module": "./v9.mjs",
|
||||
|
||||
203
payloads/v8/_interactions/_applicationCommands/chatInput.ts
Normal file
203
payloads/v8/_interactions/_applicationCommands/chatInput.ts
Normal file
@@ -0,0 +1,203 @@
|
||||
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;
|
||||
default?: boolean;
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||
*/
|
||||
export type APIApplicationCommandOption =
|
||||
| APIApplicationCommandArgumentOptions
|
||||
| APIApplicationCommandSubCommandOptions
|
||||
| APIApplicationCommandChannelOptions
|
||||
| APIApplicationCommandOptionBase;
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
|
||||
*/
|
||||
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
|
||||
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
|
||||
options?: APIApplicationCommandOption[];
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
|
||||
* but they can have a `choices` one
|
||||
*/
|
||||
export interface APIApplicationCommandArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
|
||||
type:
|
||||
| ApplicationCommandOptionType.String
|
||||
| ApplicationCommandOptionType.Integer
|
||||
| ApplicationCommandOptionType.Number;
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 type ApplicationCommandInteractionDataOptionString = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.String,
|
||||
string
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionRole = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Role,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionChannel = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Channel,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionUser = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.User,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionMentionable = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Mentionable,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionInteger = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Integer,
|
||||
number
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionNumber = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Number,
|
||||
number
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Boolean,
|
||||
boolean
|
||||
>;
|
||||
|
||||
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
|
||||
name: string;
|
||||
type: T;
|
||||
value: D;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
|
||||
*/
|
||||
export interface APIChatInputApplicationCommandInteractionData
|
||||
extends APIBaseApplicationCommandInteractionData<ApplicationCommandType.ChatInput> {
|
||||
options?: APIApplicationCommandInteractionDataOption[];
|
||||
resolved?: APIChatInputApplicationCommandInteractionDataResolved;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure
|
||||
*/
|
||||
export interface APIChatInputApplicationCommandInteractionDataResolved {
|
||||
users?: Record<Snowflake, APIUser>;
|
||||
roles?: Record<Snowflake, APIRole>;
|
||||
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
|
||||
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIChatInputApplicationCommandInteraction =
|
||||
APIApplicationCommandInteractionWrapper<APIChatInputApplicationCommandInteractionData>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIChatInputApplicationCommandDMInteraction =
|
||||
APIDMInteractionWrapper<APIChatInputApplicationCommandInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIChatInputApplicationCommandGuildInteraction =
|
||||
APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;
|
||||
104
payloads/v8/_interactions/_applicationCommands/contextMenu.ts
Normal file
104
payloads/v8/_interactions/_applicationCommands/contextMenu.ts
Normal 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;
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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,
|
||||
}
|
||||
122
payloads/v8/_interactions/applicationCommands.ts
Normal file
122
payloads/v8/_interactions/applicationCommands.ts
Normal 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;
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Permissions, Snowflake } from '../../../globals';
|
||||
import { InteractionType } from '../../v8';
|
||||
import { APIMessage } from '../channel';
|
||||
import { APIGuildMember } from '../guild';
|
||||
import { APIUser } from '../user';
|
||||
import type { Permissions, Snowflake } from '../../../globals';
|
||||
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> {
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ComponentType } from '../channel';
|
||||
import { APIBaseInteraction, InteractionType } from '../interactions';
|
||||
import { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base';
|
||||
import type { ComponentType } from '../channel';
|
||||
import type { APIBaseInteraction, InteractionType } from '../interactions';
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base';
|
||||
|
||||
export type APIMessageComponentInteraction = APIBaseInteraction<
|
||||
InteractionType.MessageComponent,
|
||||
|
||||
4
payloads/v8/_interactions/ping.ts
Normal file
4
payloads/v8/_interactions/ping.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { APIBaseInteraction } from './base';
|
||||
import type { InteractionType } from './responses';
|
||||
|
||||
export type APIPingInteraction = APIBaseInteraction<InteractionType.Ping, never>;
|
||||
@@ -1,8 +1,8 @@
|
||||
import { MessageFlags } from '../index';
|
||||
import { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8';
|
||||
import type { MessageFlags } from '../index';
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8';
|
||||
|
||||
/**
|
||||
* 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,
|
||||
@@ -11,7 +11,7 @@ export const enum InteractionType {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -44,7 +44,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 {
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ export const enum InteractionResponseType {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,
|
||||
|
||||
@@ -1,273 +0,0 @@
|
||||
import { APIRole, APIUser } from '../index';
|
||||
import { Permissions, Snowflake } from '../../../globals';
|
||||
import { APIPartialChannel } from '../channel';
|
||||
import { APIGuildMember } from '../guild';
|
||||
import { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base';
|
||||
import { 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>;
|
||||
109
payloads/v8/application.ts
Normal file
109
payloads/v8/application.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Types extracted from https://discord.com/developers/docs/resources/application
|
||||
*/
|
||||
|
||||
import type { Snowflake } from '../../globals';
|
||||
import type { APITeam } from './teams';
|
||||
import type { APIUser } from './user';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object
|
||||
*/
|
||||
export interface APIApplication {
|
||||
/**
|
||||
* The id of the app
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the app
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The icon hash of the app
|
||||
*/
|
||||
icon: string | null;
|
||||
/**
|
||||
* The description of the app
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* An array of rpc origin urls, if rpc is enabled
|
||||
*/
|
||||
rpc_origins?: string[];
|
||||
/**
|
||||
* When `false` only app owner can join the app's bot to guilds
|
||||
*/
|
||||
bot_public: boolean;
|
||||
/**
|
||||
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
|
||||
*/
|
||||
bot_require_code_grant: boolean;
|
||||
/**
|
||||
* The url of the application's terms of service
|
||||
*/
|
||||
terms_of_service_url?: string;
|
||||
/**
|
||||
* The url of the application's privacy policy
|
||||
*/
|
||||
privacy_policy_url?: string;
|
||||
/**
|
||||
* Partial user object containing info on the owner of the application
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
owner?: APIUser;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the summary field for the store page
|
||||
* of its primary sku
|
||||
*/
|
||||
summary: string;
|
||||
/**
|
||||
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
|
||||
*
|
||||
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
|
||||
*/
|
||||
verify_key: string;
|
||||
/**
|
||||
* The team this application belongs to
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
|
||||
*/
|
||||
team: APITeam | null;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
|
||||
*/
|
||||
primary_sku_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
|
||||
*/
|
||||
slug?: string;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
|
||||
*/
|
||||
cover_image?: string;
|
||||
/**
|
||||
* The application's public flags
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
flags: ApplicationFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
export const enum ApplicationFlags {
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
GatewayPresence = 1 << 12,
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
Embedded = 1 << 17,
|
||||
}
|
||||
@@ -249,13 +249,13 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKeySplashHash
|
||||
| APIAuditLogChangeKeyDiscoverySplashHash
|
||||
| APIAuditLogChangeKeyBannerHash
|
||||
| APIAuditLogChangeKeyOwnerID
|
||||
| APIAuditLogChangeKeyOwnerId
|
||||
| APIAuditLogChangeKeyRegion
|
||||
| APIAuditLogChangeKeyPreferredLocale
|
||||
| APIAuditLogChangeKeyAFKChannelID
|
||||
| APIAuditLogChangeKeyAFKChannelId
|
||||
| APIAuditLogChangeKeyAFKTimeout
|
||||
| APIAuditLogChangeKeyRulesChannelID
|
||||
| APIAuditLogChangeKeyPublicUpdatesChannelID
|
||||
| APIAuditLogChangeKeyRulesChannelId
|
||||
| APIAuditLogChangeKeyPublicUpdatesChannelId
|
||||
| APIAuditLogChangeKeyMFALevel
|
||||
| APIAuditLogChangeKeyVerificationLevel
|
||||
| APIAuditLogChangeKeyExplicitContentFilter
|
||||
@@ -265,14 +265,14 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKey$Remove
|
||||
| APIAuditLogChangeKeyPruneDeleteDays
|
||||
| APIAuditLogChangeKeyWidgetEnabled
|
||||
| APIAuditLogChangeKeyWidgetChannelID
|
||||
| APIAuditLogChangeKeySystemChannelID
|
||||
| APIAuditLogChangeKeyWidgetChannelId
|
||||
| APIAuditLogChangeKeySystemChannelId
|
||||
| APIAuditLogChangeKeyPosition
|
||||
| APIAuditLogChangeKeyTopic
|
||||
| APIAuditLogChangeKeyBitrate
|
||||
| APIAuditLogChangeKeyPermissionOverwrites
|
||||
| APIAuditLogChangeKeyNSFW
|
||||
| APIAuditLogChangeKeyApplicationID
|
||||
| APIAuditLogChangeKeyApplicationId
|
||||
| APIAuditLogChangeKeyRateLimitPerUser
|
||||
| APIAuditLogChangeKeyPermissions
|
||||
| APIAuditLogChangeKeyColor
|
||||
@@ -281,8 +281,8 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKeyAllow
|
||||
| APIAuditLogChangeKeyDeny
|
||||
| APIAuditLogChangeKeyCode
|
||||
| APIAuditLogChangeKeyChannelID
|
||||
| APIAuditLogChangeKeyInviterID
|
||||
| APIAuditLogChangeKeyChannelId
|
||||
| APIAuditLogChangeKeyInviterId
|
||||
| APIAuditLogChangeKeyMaxUses
|
||||
| APIAuditLogChangeKeyUses
|
||||
| APIAuditLogChangeKeyMaxAge
|
||||
@@ -291,7 +291,7 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKeyMute
|
||||
| APIAuditLogChangeKeyNick
|
||||
| APIAuditLogChangeKeyAvatarHash
|
||||
| APIAuditLogChangeKeyID
|
||||
| APIAuditLogChangeKeyId
|
||||
| APIAuditLogChangeKeyType
|
||||
| APIAuditLogChangeKeyEnableEmoticons
|
||||
| APIAuditLogChangeKeyExpireBehavior
|
||||
@@ -302,7 +302,7 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKeyFormatType
|
||||
| APIAuditLogChangeKeyAsset
|
||||
| APIAuditLogChangeKeyAvailable
|
||||
| APIAuditLogChangeKeyGuildID;
|
||||
| APIAuditLogChangeKeyGuildId;
|
||||
|
||||
/**
|
||||
* Returned when an entity's name is changed
|
||||
@@ -337,7 +337,7 @@ export type APIAuditLogChangeKeyBannerHash = AuditLogChangeData<'banner_hash', s
|
||||
/**
|
||||
* Returned when a guild's owner_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyOwnerID = AuditLogChangeData<'owner_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyOwnerId = AuditLogChangeData<'owner_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when a guild's region is changed
|
||||
@@ -352,7 +352,7 @@ export type APIAuditLogChangeKeyPreferredLocale = AuditLogChangeData<'preferred_
|
||||
/**
|
||||
* Returned when a guild's afk_channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyAFKChannelID = AuditLogChangeData<'afk_channel_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyAFKChannelId = AuditLogChangeData<'afk_channel_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when a guild's afk_timeout is changed
|
||||
@@ -362,12 +362,12 @@ export type APIAuditLogChangeKeyAFKTimeout = AuditLogChangeData<'afk_timeout', n
|
||||
/**
|
||||
* Returned when a guild's rules_channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyRulesChannelID = AuditLogChangeData<'rules_channel_id', string>;
|
||||
export type APIAuditLogChangeKeyRulesChannelId = AuditLogChangeData<'rules_channel_id', string>;
|
||||
|
||||
/**
|
||||
* Returned when a guild's public_updates_channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyPublicUpdatesChannelID = AuditLogChangeData<'public_updates_channel_id', string>;
|
||||
export type APIAuditLogChangeKeyPublicUpdatesChannelId = AuditLogChangeData<'public_updates_channel_id', string>;
|
||||
|
||||
/**
|
||||
* Returned when a guild's mfa_level is changed
|
||||
@@ -423,12 +423,12 @@ export type APIAuditLogChangeKeyWidgetEnabled = AuditLogChangeData<'widget_enabl
|
||||
/**
|
||||
* Returned when a guild's widget_channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyWidgetChannelID = AuditLogChangeData<'widget_channel_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyWidgetChannelId = AuditLogChangeData<'widget_channel_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when a guild's system_channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeySystemChannelID = AuditLogChangeData<'system_channel_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeySystemChannelId = AuditLogChangeData<'system_channel_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when a channel's position is changed
|
||||
@@ -458,7 +458,7 @@ export type APIAuditLogChangeKeyNSFW = AuditLogChangeData<'nsfw', boolean>;
|
||||
/**
|
||||
* The application ID of the added or removed Webhook or Bot
|
||||
*/
|
||||
export type APIAuditLogChangeKeyApplicationID = AuditLogChangeData<'application_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyApplicationId = AuditLogChangeData<'application_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when a channel's amount of seconds a user has to wait before sending another message
|
||||
@@ -504,12 +504,12 @@ export type APIAuditLogChangeKeyCode = AuditLogChangeData<'code', string>;
|
||||
/**
|
||||
* Returned when an invite's channel_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyChannelID = AuditLogChangeData<'channel_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyChannelId = AuditLogChangeData<'channel_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when an invite's inviter_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyInviterID = AuditLogChangeData<'inviter_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyInviterId = AuditLogChangeData<'inviter_id', Snowflake>;
|
||||
|
||||
/**
|
||||
* Returned when an invite's max_uses is changed
|
||||
@@ -544,7 +544,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
|
||||
@@ -554,7 +554,7 @@ export type APIAuditLogChangeKeyAvatarHash = AuditLogChangeData<'avatar_hash', s
|
||||
/**
|
||||
* The ID of the changed entity - sometimes used in conjunction with other keys
|
||||
*/
|
||||
export type APIAuditLogChangeKeyID = AuditLogChangeData<'id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyId = AuditLogChangeData<'id', Snowflake>;
|
||||
|
||||
/**
|
||||
* The type of entity created
|
||||
@@ -609,7 +609,7 @@ export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', bool
|
||||
/**
|
||||
* Returned when a sticker's guild_id is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyGuildID = AuditLogChangeData<'guild_id', Snowflake>;
|
||||
export type APIAuditLogChangeKeyGuildId = AuditLogChangeData<'guild_id', Snowflake>;
|
||||
|
||||
interface AuditLogChangeData<K extends string, D extends unknown> {
|
||||
key: K;
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { Permissions, Snowflake } from '../../globals';
|
||||
import type { APIPartialEmoji } from './emoji';
|
||||
import type { APIGuildMember } from './guild';
|
||||
import type { APIMessageInteraction } from './interactions';
|
||||
import type { APIApplication } from './oauth2';
|
||||
import type { APIApplication } from './application';
|
||||
import type { APIRole } from './permissions';
|
||||
import type { APISticker, APIStickerItem } from './sticker';
|
||||
import type { APIUser } from './user';
|
||||
@@ -382,8 +382,9 @@ export const enum MessageType {
|
||||
GuildDiscoveryGracePeriodInitialWarning,
|
||||
GuildDiscoveryGracePeriodFinalWarning,
|
||||
Reply = 19,
|
||||
ApplicationCommand,
|
||||
ChatInputCommand,
|
||||
GuildInviteReminder = 22,
|
||||
ContextMenuCommand,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -560,7 +561,7 @@ export interface APIEmbed {
|
||||
/**
|
||||
* Description of embed
|
||||
*
|
||||
* Length limit: 2048 characters
|
||||
* Length limit: 4096 characters
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
@@ -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
|
||||
*/
|
||||
@@ -832,6 +833,10 @@ export interface APIAttachment {
|
||||
* Width of file (if image)
|
||||
*/
|
||||
width?: number | null;
|
||||
/**
|
||||
* Whether this attachment is ephemeral
|
||||
*/
|
||||
ephemeral?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -955,14 +960,29 @@ 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 APIButtonComponentWithCustomID
|
||||
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
|
||||
> {
|
||||
@@ -979,7 +999,7 @@ export interface APIButtonComponentWithURL extends APIButtonComponentBase<Button
|
||||
url: string;
|
||||
}
|
||||
|
||||
export type APIButtonComponent = APIButtonComponentWithCustomID | APIButtonComponentWithURL;
|
||||
export type APIButtonComponent = APIButtonComponentWithCustomId | APIButtonComponentWithURL;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#button-object-button-styles
|
||||
@@ -1003,7 +1023,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 +1067,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
|
||||
*/
|
||||
|
||||
@@ -246,7 +246,7 @@ export interface APIGuild extends APIPartialGuild {
|
||||
*/
|
||||
presences?: GatewayPresenceUpdate[];
|
||||
/**
|
||||
* The maximum number of presences for the guild (the default value, currently 25000, is in effect when `null` is returned)
|
||||
* The maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds)
|
||||
*/
|
||||
max_presences?: number | null;
|
||||
/**
|
||||
@@ -448,6 +448,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 +468,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 +509,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 +597,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
|
||||
*
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './application';
|
||||
export * from './auditLog';
|
||||
export * from './channel';
|
||||
export * from './emoji';
|
||||
|
||||
@@ -1,21 +1,32 @@
|
||||
import {
|
||||
import type {
|
||||
APIMessageComponentDMInteraction,
|
||||
APIMessageComponentGuildInteraction,
|
||||
APIMessageComponentInteraction,
|
||||
} from './_interactions/messageComponents';
|
||||
import {
|
||||
import type { APIPingInteraction } from './_interactions/ping';
|
||||
import type {
|
||||
APIApplicationCommandDMInteraction,
|
||||
APIApplicationCommandGuildInteraction,
|
||||
APIApplicationCommandInteraction,
|
||||
} from './_interactions/slashCommands';
|
||||
} from './_interactions/applicationCommands';
|
||||
|
||||
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 = APIApplicationCommandInteraction | APIMessageComponentInteraction;
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIInteraction = APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import type { APIPartialChannel } from './channel';
|
||||
import type { APIPartialGuild } from './guild';
|
||||
import type { APIApplication } from './oauth2';
|
||||
import type { APIApplication } from './application';
|
||||
import type { APIInviteStageInstance } from './stageInstance';
|
||||
import type { APIUser } from './user';
|
||||
|
||||
|
||||
@@ -2,107 +2,6 @@
|
||||
* Types extracted from https://discord.com/developers/docs/topics/oauth2
|
||||
*/
|
||||
|
||||
import type { Snowflake } from '../../globals';
|
||||
import type { APITeam } from './teams';
|
||||
import type { APIUser } from './user';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information-response-structure
|
||||
*/
|
||||
export interface APIApplication {
|
||||
/**
|
||||
* The id of the app
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the app
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The icon hash of the app
|
||||
*/
|
||||
icon: string | null;
|
||||
/**
|
||||
* The description of the app
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* An array of rpc origin urls, if rpc is enabled
|
||||
*/
|
||||
rpc_origins?: string[];
|
||||
/**
|
||||
* When `false` only app owner can join the app's bot to guilds
|
||||
*/
|
||||
bot_public: boolean;
|
||||
/**
|
||||
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
|
||||
*/
|
||||
bot_require_code_grant: boolean;
|
||||
/**
|
||||
* The url of the application's terms of service
|
||||
*/
|
||||
terms_of_service_url?: string;
|
||||
/**
|
||||
* The url of the application's privacy policy
|
||||
*/
|
||||
privacy_policy_url?: string;
|
||||
/**
|
||||
* Partial user object containing info on the owner of the application
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
owner?: APIUser;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the summary field for the store page
|
||||
* of its primary sku
|
||||
*/
|
||||
summary: string;
|
||||
/**
|
||||
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
|
||||
*
|
||||
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
|
||||
*/
|
||||
verify_key: string;
|
||||
/**
|
||||
* The team this application belongs to
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
|
||||
*/
|
||||
team: APITeam | null;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
|
||||
*/
|
||||
primary_sku_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
|
||||
*/
|
||||
slug?: string;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
|
||||
*/
|
||||
cover_image?: string;
|
||||
/**
|
||||
* The application's public flags
|
||||
*/
|
||||
flags: ApplicationFlags;
|
||||
}
|
||||
|
||||
export const enum ApplicationFlags {
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
GatewayPresence = 1 << 12,
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
Embedded = 1 << 17,
|
||||
}
|
||||
|
||||
export const enum OAuth2Scopes {
|
||||
/**
|
||||
* For oauth2 bots, this puts the bot in the user's selected guild by default
|
||||
@@ -195,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',
|
||||
}
|
||||
|
||||
@@ -43,8 +43,10 @@ export const PermissionFlagsBits = {
|
||||
ManageRoles: 1n << 28n,
|
||||
ManageWebhooks: 1n << 29n,
|
||||
ManageEmojisAndStickers: 1n << 30n,
|
||||
UseSlashCommands: 1n << 31n,
|
||||
UseApplicationCommands: 1n << 31n,
|
||||
RequestToSpeak: 1n << 32n,
|
||||
UseExternalStickers: 1n << 37n,
|
||||
StartEmbeddedActivities: 1n << 39n,
|
||||
} as const;
|
||||
|
||||
/**
|
||||
@@ -73,6 +75,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
|
||||
*/
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user