mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-05-22 19:30:09 +00:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ce0a231c7 | ||
|
|
0ad06fc639 | ||
|
|
9af4b4776b | ||
|
|
ed1f717679 | ||
|
|
5056da523a | ||
|
|
7abeb2e039 | ||
|
|
f88727bd80 | ||
|
|
72e9617fee | ||
|
|
d5d228e6c2 | ||
|
|
bf0f66b60a | ||
|
|
71c4e6aecd | ||
|
|
ee2b7cd920 | ||
|
|
269a75ccf7 | ||
|
|
87b9b0885a | ||
|
|
7e542152da | ||
|
|
c48aab3921 | ||
|
|
8e13cd80c6 | ||
|
|
70bab5d1b2 | ||
|
|
663c4e97fb | ||
|
|
9c2b185367 | ||
|
|
76588d9d38 | ||
|
|
80ed7ba1c1 | ||
|
|
56d39756c0 | ||
|
|
7655e20248 | ||
|
|
d95d9562dc | ||
|
|
4194bd9054 | ||
|
|
51fb37cbba | ||
|
|
310c68f034 | ||
|
|
2c1fbda621 | ||
|
|
08a8b28ee1 | ||
|
|
b07d5a0c22 | ||
|
|
03b8d3fee0 | ||
|
|
03f12d71ee | ||
|
|
83f29b6928 | ||
|
|
9a982ff8d9 | ||
|
|
5056b0f2b3 |
8
.eslintrc.json
Normal file
8
.eslintrc.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "marine/prettier/node",
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.eslint.json",
|
||||
"extraFileExtensions": [".mjs"]
|
||||
}
|
||||
}
|
||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,3 +1,3 @@
|
||||
**Please describe the changes this PR makes and why it should be merged:**
|
||||
|
||||
**Reference Discord API Docs PRs or commits:**
|
||||
**If applicable, please reference Discord API Docs PRs or commits that influenced this PR:**
|
||||
|
||||
2
.github/SUPPORT.md
vendored
2
.github/SUPPORT.md
vendored
@@ -5,4 +5,4 @@ We only use this issue tracker for bug reports and feature request. We are not a
|
||||
For general questions about discord-api-types installation and use please ask in [GitHub Discussions](https://github.com/discordjs/discord-api-types/discussions),
|
||||
or in the dedicated support channels in our Discord server: https://discord.gg/djs
|
||||
|
||||
Any issues that don't directly involve a bug or a feature request will likely be closed and redirected.
|
||||
Any issues that don't directly involve a bug or a feature request will likely be redirected or closed.
|
||||
|
||||
53
.github/labels.yml
vendored
Normal file
53
.github/labels.yml
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# General labels
|
||||
- name: 'semver:major'
|
||||
color: 'c10f47'
|
||||
- name: 'semver:minor'
|
||||
color: 'e4f486'
|
||||
- name: 'semver:patch'
|
||||
color: 'e8be8b'
|
||||
- name: 'question (please use Discord instead)'
|
||||
color: 'd876e3'
|
||||
- name: 'regression'
|
||||
color: 'ea8785'
|
||||
- name: 'wontfix'
|
||||
color: 'ffffff'
|
||||
- name: 'chore'
|
||||
color: 'ffffff'
|
||||
- name: 'ci'
|
||||
color: '0075ca'
|
||||
- name: 'dependencies'
|
||||
color: '276bd1'
|
||||
- name: 'duplicate'
|
||||
color: 'cfd3d7'
|
||||
- name: 'feature request'
|
||||
color: 'fcf95a'
|
||||
- name: 'bug'
|
||||
color: 'd73a4a'
|
||||
- name: 'backlog'
|
||||
color: '7ef7ef'
|
||||
- name: 'good first issue'
|
||||
color: '7057ff'
|
||||
- name: 'has PR'
|
||||
color: '4b1f8e'
|
||||
- name: 'help wanted'
|
||||
color: '008672'
|
||||
|
||||
# Topic labels
|
||||
- name: 'topic:deno'
|
||||
color: 'aed5fc'
|
||||
- name: 'topic:gateway'
|
||||
color: 'aed5fc'
|
||||
- name: 'topic:payloads'
|
||||
color: 'aed5fc'
|
||||
- name: 'topic:rest'
|
||||
color: 'aed5fc'
|
||||
- name: 'topic:rpc'
|
||||
color: 'aed5fc'
|
||||
- name: 'topic:scripts'
|
||||
color: 'aed5fc'
|
||||
- name: 'topic:tests'
|
||||
color: 'aed5fc'
|
||||
- name: 'topic:utils'
|
||||
color: 'aed5fc'
|
||||
- name: 'topic:voice'
|
||||
color: 'aed5fc'
|
||||
28
.github/workflows/check-deno.yml
vendored
Normal file
28
.github/workflows/check-deno.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: Deno
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
|
||||
jobs:
|
||||
check_deno:
|
||||
name: Ensure Deno types are in sync with the code
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Project
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Use Node.js v16
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run Check Script
|
||||
run: node ./scripts/actions/report-deno-not-ran.mjs
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
34
.github/workflows/cicd.yml
vendored
34
.github/workflows/cicd.yml
vendored
@@ -28,40 +28,6 @@ jobs:
|
||||
- name: Run TSC
|
||||
run: npm run build:ci
|
||||
|
||||
deno:
|
||||
name: Generate Deno compatible code
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
needs: testing
|
||||
# Run workflow only if testing passes
|
||||
if: needs.testing.result == 'success'
|
||||
|
||||
steps:
|
||||
- name: Checkout Project
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Use Node.js v16
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build Files
|
||||
run: npm run build:deno
|
||||
|
||||
- name: Set Git User and Email
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Commit and Push New Code
|
||||
run: |
|
||||
git add --all .
|
||||
git commit -m "build: deno build for ${GITHUB_SHA}" || true
|
||||
git push || true
|
||||
|
||||
tsd:
|
||||
name: TSD checks
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
93
.github/workflows/create-pr-for-release-and-publish.yml
vendored
Normal file
93
.github/workflows/create-pr-for-release-and-publish.yml
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
name: Create PR for new releases and publish new version
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
# Run every Tuesday and Thursday at 12:00
|
||||
- cron: '0 12 * * 2,4'
|
||||
|
||||
jobs:
|
||||
create_pr:
|
||||
name: Create PR for new version
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'discordjs' && github.event_name != 'push'
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Node v16
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci --ignore-scripts
|
||||
|
||||
- name: Set Git User and Email
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Bump version
|
||||
run: node ./scripts/bump-version.mjs
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create branch for changes, add all changes and push
|
||||
run: |
|
||||
git checkout -b "chore/release/$(jq --raw-output '.version' package.json)"
|
||||
|
||||
# Run changelog generation and deno scripts
|
||||
npm run ci:pr
|
||||
|
||||
# Add all changes, commit and push
|
||||
git add --all .
|
||||
git commit -m "chore(release): $(jq --raw-output '.version' package.json) 🎉" -m "Build ran for ${GITHUB_SHA}"
|
||||
git push -u origin "chore/release/$(jq --raw-output '.version' package.json)"
|
||||
|
||||
- name: Create Pull Request
|
||||
run: node ./scripts/actions/create-pr.mjs
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
create_release:
|
||||
name: Create release and publish
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'discordjs' && github.event_name == 'push' && startsWith(github.event.head_commit.message, 'chore(release)') && !contains(github.event.head_commit.message, '[skip ci]')
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Node v16
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci --ignore-scripts
|
||||
|
||||
- name: Deprecate old versions
|
||||
run: npx npm-deprecate --name "*" --package discord-api-types --message "No longer supported. Install the latest release!" || true
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
|
||||
- name: Publish release to npm
|
||||
run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
|
||||
- name: Create GitHub release
|
||||
run: node ./scripts/actions/create-release.mjs
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
22
.github/workflows/labelsync.yml
vendored
Normal file
22
.github/workflows/labelsync.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
name: Label Sync
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '.github/labels.yml'
|
||||
jobs:
|
||||
labelsync:
|
||||
name: Label sync
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Label sync
|
||||
uses: crazy-max/ghaction-github-labeler@v3
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
27
.github/workflows/publish-next.yml
vendored
27
.github/workflows/publish-next.yml
vendored
@@ -2,14 +2,21 @@ name: Publish next
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 */12 * * *'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish to npm
|
||||
name: Publish @next release to npm
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'discordjs' && !(github.event_name == 'push' && startsWith(github.event.head_commit.message, 'chore(release)'))
|
||||
steps:
|
||||
- name: Cancel previous publish attempts
|
||||
uses: styfle/cancel-workflow-action@0.9.1
|
||||
with:
|
||||
access_token: ${{ github.token }}
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
@@ -25,18 +32,16 @@ jobs:
|
||||
run: npm ci --ignore-scripts
|
||||
|
||||
- name: Bump version
|
||||
run: npx standard-version
|
||||
run: node ./scripts/bump-version.mjs
|
||||
|
||||
- name: Deprecate old @next versions
|
||||
run: npx npm-deprecate --name "*next*" --package discord-api-types --message "No longer supported. Install the latest @next release" || true
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
|
||||
- name: Deprecate old versions
|
||||
run: npm deprecate discord-api-types@"~$(jq --raw-output '.version' package.json)-next" "No longer supported. Install the latest @next release" || true
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
|
||||
- name: Publish new version
|
||||
- name: Publish new @next version
|
||||
run: |
|
||||
npm version --git-tag-version=false $(jq --raw-output '.version' package.json)-next.$(git rev-parse --short HEAD).$(date +%s)
|
||||
npm version $(jq --raw-output '.version' package.json)-next.$(git rev-parse --short HEAD).$(date +%s)
|
||||
npm publish --tag next || true
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
|
||||
11
.gitignore
vendored
11
.gitignore
vendored
@@ -6,10 +6,10 @@ globals.*map
|
||||
globals.d.ts
|
||||
globals.mjs
|
||||
|
||||
v*.js
|
||||
v*.*map
|
||||
v*.d.ts
|
||||
v*.mjs
|
||||
./v*.js
|
||||
./v*.*map
|
||||
./v*.d.ts
|
||||
./v*.mjs
|
||||
|
||||
gateway/**/*.js
|
||||
gateway/**/*.map
|
||||
@@ -45,3 +45,6 @@ voice/**/*.js
|
||||
voice/**/*.map
|
||||
voice/**/*.d.ts
|
||||
voice/**/*.mjs
|
||||
|
||||
# macOS files
|
||||
.DS_store
|
||||
|
||||
1
.npmrc
1
.npmrc
@@ -2,4 +2,5 @@ audit=false
|
||||
fund=false
|
||||
legacy-peer-deps=true
|
||||
tag-version-prefix=""
|
||||
git-tag-version=false
|
||||
message="chore(release): %s 🎉"
|
||||
|
||||
1
.prettierignore
Normal file
1
.prettierignore
Normal file
@@ -0,0 +1 @@
|
||||
deno/
|
||||
60
CHANGELOG.md
60
CHANGELOG.md
@@ -1,3 +1,63 @@
|
||||
## [0.27.1](https://github.com/discordjs/discord-api-types/compare/0.27.0...0.27.1) (2022-02-14)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **APIInteraction:** add modal submit interaction & make `data` required in APIModalSubmit ([#321](https://github.com/discordjs/discord-api-types/issues/321)) ([f88727b](https://github.com/discordjs/discord-api-types/commit/f88727bd80d32f3ddf4374b1fd46ce50c36eea4d))
|
||||
- **APIInteractions:** export ApplicationCommandAutocomplete ([#309](https://github.com/discordjs/discord-api-types/issues/309)) ([5056da5](https://github.com/discordjs/discord-api-types/commit/5056da523af6154fbf2fbcf10e30ce437ec42ce8))
|
||||
- **CI:** skip pull request checks for runs that don't include the token ([#327](https://github.com/discordjs/discord-api-types/issues/327)) ([0ad06fc](https://github.com/discordjs/discord-api-types/commit/0ad06fc639d7f8bdff135a58d435e6cb15029842))
|
||||
- make `data` required in autocomplete interaction and add separate dm/guild types ([#322](https://github.com/discordjs/discord-api-types/issues/322)) ([7abeb2e](https://github.com/discordjs/discord-api-types/commit/7abeb2e0391d6e47517edba63342ba9c4adc4fcb))
|
||||
|
||||
### Features
|
||||
|
||||
- **RESTJSONErrorCodes:** add error 40060 ([#320](https://github.com/discordjs/discord-api-types/issues/320)) ([72e9617](https://github.com/discordjs/discord-api-types/commit/72e9617fee6e05d2eb4b715c0261d316ff0e1f1e))
|
||||
|
||||
# [0.27.0](https://github.com/discordjs/discord-api-types/compare/0.26.1...0.27.0) (2022-02-10)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **GatewayThreadCreateDispatchData:** `newly_created` is optional, and `true` when present ([#312](https://github.com/discordjs/discord-api-types/issues/312)) ([87b9b08](https://github.com/discordjs/discord-api-types/commit/87b9b0885a3734b376e64da51d7667b74558f7e5))
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
- **ActivityType:** change `Game` to `Playing` ([#298](https://github.com/discordjs/discord-api-types/issues/298)) ([08a8b28](https://github.com/discordjs/discord-api-types/commit/08a8b28ee1ed2041744d922db35dab24f3861469))
|
||||
- **UserFlags:** remove `None` ([#308](https://github.com/discordjs/discord-api-types/issues/308)) ([8e13cd8](https://github.com/discordjs/discord-api-types/commit/8e13cd80c66d11d93157a053e329ad98ece4a457))
|
||||
|
||||
### Features
|
||||
|
||||
- **APIGuildPreview:** add `stickers` ([#279](https://github.com/discordjs/discord-api-types/issues/279)) ([310c68f](https://github.com/discordjs/discord-api-types/commit/310c68f034812072ca3cacbeaff1f5b9454e3409))
|
||||
- **APIInteraction:** add locale props to interactions ([#273](https://github.com/discordjs/discord-api-types/issues/273)) ([03b8d3f](https://github.com/discordjs/discord-api-types/commit/03b8d3fee032fb77213389019baa2b80377dcfdc))
|
||||
- **APIMessageInteraction:** add `member` field ([#299](https://github.com/discordjs/discord-api-types/issues/299)) ([80ed7ba](https://github.com/discordjs/discord-api-types/commit/80ed7ba1c1ebb2e12d3a04339d4ff0209be9bbef))
|
||||
- **APIScheduledEvent:** add `image` prop ([#303](https://github.com/discordjs/discord-api-types/issues/303)) ([663c4e9](https://github.com/discordjs/discord-api-types/commit/663c4e97fbe2029ab040388b50d5600bfe281c4f))
|
||||
- **APIThreadMetadata:** add `create_timestamp` field ([#301](https://github.com/discordjs/discord-api-types/issues/301)) ([d95d956](https://github.com/discordjs/discord-api-types/commit/d95d9562dcc514556f3a4ced3e8f3ee4c5ed1282))
|
||||
- **ApplicationCommand:** attachment application command option type ([#272](https://github.com/discordjs/discord-api-types/issues/272)) ([71c4e6a](https://github.com/discordjs/discord-api-types/commit/71c4e6aecd044ce5282742c0e47bff7b64b890f7))
|
||||
- **GatewayThreadCreateDispatch:** Add `newly_created` field ([#311](https://github.com/discordjs/discord-api-types/issues/311)) ([7e54215](https://github.com/discordjs/discord-api-types/commit/7e542152da2e58f44c2314d5bd3b04a518fa979e))
|
||||
- **Interactions:** add modal and text input interactions ([#243](https://github.com/discordjs/discord-api-types/issues/243)) ([bf0f66b](https://github.com/discordjs/discord-api-types/commit/bf0f66b60a97f79c0e80ace5b408baee343bc82c))
|
||||
- **Locales:** add locale string enum ([#297](https://github.com/discordjs/discord-api-types/issues/297)) ([b07d5a0](https://github.com/discordjs/discord-api-types/commit/b07d5a0c2273b6b51b44542b638a768c36d0f184))
|
||||
- **MessageFlags:** add `FailedToMentionSomeRolesInThread` ([#280](https://github.com/discordjs/discord-api-types/issues/280)) ([76588d9](https://github.com/discordjs/discord-api-types/commit/76588d9d384f71ace05d96de17889e4490874462))
|
||||
- **RESTPostAPIChannelMessage, RESTPostAPIWebhookMessage:** add flags for creation ([#300](https://github.com/discordjs/discord-api-types/issues/300)) ([4194bd9](https://github.com/discordjs/discord-api-types/commit/4194bd9054a7e4b004f9244706f423292a8a0e56))
|
||||
- **RESTJSONErrorCodes:** add error 30042 ([#305](https://github.com/discordjs/discord-api-types/issues/305)) ([9c2b185](https://github.com/discordjs/discord-api-types/commit/9c2b185367b1ea2e432355d76af8f19e8fca7398))
|
||||
- **RESTJSONErrorCodes:** add error 30046 ([#304](https://github.com/discordjs/discord-api-types/issues/304)) ([56d3975](https://github.com/discordjs/discord-api-types/commit/56d39756c0d973ec56fe6e1eeb75d827f50aac81))
|
||||
- **RESTJSONErrorCodes:** add error 40004 ([#314](https://github.com/discordjs/discord-api-types/issues/314)) ([269a75c](https://github.com/discordjs/discord-api-types/commit/269a75ccf7b413bfc031849713e919ebb8d87a1a))
|
||||
- **RESTJSONErrorCodes:** add error 50068 ([#302](https://github.com/discordjs/discord-api-types/issues/302)) ([7655e20](https://github.com/discordjs/discord-api-types/commit/7655e2024800abc4431011668b83373e0868485e))
|
||||
- **RESTJSONErrorCodes:** add error code 50086 ([#286](https://github.com/discordjs/discord-api-types/issues/286)) ([51fb37c](https://github.com/discordjs/discord-api-types/commit/51fb37cbba44677870f0f916bd1416bdbd34e052))
|
||||
- **RESTPatchAPIGuildMember:** add `communication_disabled_until` field ([#289](https://github.com/discordjs/discord-api-types/issues/289)) ([5056b0f](https://github.com/discordjs/discord-api-types/commit/5056b0f2b3798480dbbc193fd80dedfefedff4fc))
|
||||
- **RESTPatchAPIGuildMember:** add modify current member and deprecate nick route ([#262](https://github.com/discordjs/discord-api-types/issues/262)) ([9a982ff](https://github.com/discordjs/discord-api-types/commit/9a982ff8d9592a02d78f24295efd756dc0c69fa8))
|
||||
- **RouteBases:** add base for guild scheduled events ([#293](https://github.com/discordjs/discord-api-types/issues/293)) ([83f29b6](https://github.com/discordjs/discord-api-types/commit/83f29b692839cc51869bcafdaf387b68731e0a28))
|
||||
- **UserFlags:** add `Spammer` flag ([#294](https://github.com/discordjs/discord-api-types/issues/294)) ([03f12d7](https://github.com/discordjs/discord-api-types/commit/03f12d71eef2661ee5290152952ea1adc9a92383))
|
||||
|
||||
### types
|
||||
|
||||
- Add tagged `type` unions for channel types ([#200](https://github.com/discordjs/discord-api-types/issues/200)) ([2c1fbda](https://github.com/discordjs/discord-api-types/commit/2c1fbda621fc1c1ea227295c578e6d8486dbc4f2))
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
- **Interactions:** `APIBaseMessageComponent` was renamed to `APIBaseComponent`
|
||||
- **UserFlags:** The `None` user flag is bye-bye (although I doubt anyone is using it)
|
||||
- All of the channel types are now split based on their type. As such, you will need to assert the type (either by checking it with the enum or by casting the data as the correct channel) before accessing data.
|
||||
_If you encounter any missing properties due to this, please open an issue! This is a big change, and we hope nothing is missing_
|
||||
|
||||
- **ActivityType:** `Game` was renamed to `Playing`
|
||||
|
||||
## [0.26.1](https://github.com/discordjs/discord-api-types/compare/0.26.0...0.26.1) (2022-01-02)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,3 +1,63 @@
|
||||
## [0.27.1](https://github.com/discordjs/discord-api-types/compare/0.27.0...0.27.1) (2022-02-14)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **APIInteraction:** add modal submit interaction & make `data` required in APIModalSubmit ([#321](https://github.com/discordjs/discord-api-types/issues/321)) ([f88727b](https://github.com/discordjs/discord-api-types/commit/f88727bd80d32f3ddf4374b1fd46ce50c36eea4d))
|
||||
- **APIInteractions:** export ApplicationCommandAutocomplete ([#309](https://github.com/discordjs/discord-api-types/issues/309)) ([5056da5](https://github.com/discordjs/discord-api-types/commit/5056da523af6154fbf2fbcf10e30ce437ec42ce8))
|
||||
- **CI:** skip pull request checks for runs that don't include the token ([#327](https://github.com/discordjs/discord-api-types/issues/327)) ([0ad06fc](https://github.com/discordjs/discord-api-types/commit/0ad06fc639d7f8bdff135a58d435e6cb15029842))
|
||||
- make `data` required in autocomplete interaction and add separate dm/guild types ([#322](https://github.com/discordjs/discord-api-types/issues/322)) ([7abeb2e](https://github.com/discordjs/discord-api-types/commit/7abeb2e0391d6e47517edba63342ba9c4adc4fcb))
|
||||
|
||||
### Features
|
||||
|
||||
- **RESTJSONErrorCodes:** add error 40060 ([#320](https://github.com/discordjs/discord-api-types/issues/320)) ([72e9617](https://github.com/discordjs/discord-api-types/commit/72e9617fee6e05d2eb4b715c0261d316ff0e1f1e))
|
||||
|
||||
# [0.27.0](https://github.com/discordjs/discord-api-types/compare/0.26.1...0.27.0) (2022-02-10)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **GatewayThreadCreateDispatchData:** `newly_created` is optional, and `true` when present ([#312](https://github.com/discordjs/discord-api-types/issues/312)) ([87b9b08](https://github.com/discordjs/discord-api-types/commit/87b9b0885a3734b376e64da51d7667b74558f7e5))
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
- **ActivityType:** change `Game` to `Playing` ([#298](https://github.com/discordjs/discord-api-types/issues/298)) ([08a8b28](https://github.com/discordjs/discord-api-types/commit/08a8b28ee1ed2041744d922db35dab24f3861469))
|
||||
- **UserFlags:** remove `None` ([#308](https://github.com/discordjs/discord-api-types/issues/308)) ([8e13cd8](https://github.com/discordjs/discord-api-types/commit/8e13cd80c66d11d93157a053e329ad98ece4a457))
|
||||
|
||||
### Features
|
||||
|
||||
- **APIGuildPreview:** add `stickers` ([#279](https://github.com/discordjs/discord-api-types/issues/279)) ([310c68f](https://github.com/discordjs/discord-api-types/commit/310c68f034812072ca3cacbeaff1f5b9454e3409))
|
||||
- **APIInteraction:** add locale props to interactions ([#273](https://github.com/discordjs/discord-api-types/issues/273)) ([03b8d3f](https://github.com/discordjs/discord-api-types/commit/03b8d3fee032fb77213389019baa2b80377dcfdc))
|
||||
- **APIMessageInteraction:** add `member` field ([#299](https://github.com/discordjs/discord-api-types/issues/299)) ([80ed7ba](https://github.com/discordjs/discord-api-types/commit/80ed7ba1c1ebb2e12d3a04339d4ff0209be9bbef))
|
||||
- **APIScheduledEvent:** add `image` prop ([#303](https://github.com/discordjs/discord-api-types/issues/303)) ([663c4e9](https://github.com/discordjs/discord-api-types/commit/663c4e97fbe2029ab040388b50d5600bfe281c4f))
|
||||
- **APIThreadMetadata:** add `create_timestamp` field ([#301](https://github.com/discordjs/discord-api-types/issues/301)) ([d95d956](https://github.com/discordjs/discord-api-types/commit/d95d9562dcc514556f3a4ced3e8f3ee4c5ed1282))
|
||||
- **ApplicationCommand:** attachment application command option type ([#272](https://github.com/discordjs/discord-api-types/issues/272)) ([71c4e6a](https://github.com/discordjs/discord-api-types/commit/71c4e6aecd044ce5282742c0e47bff7b64b890f7))
|
||||
- **GatewayThreadCreateDispatch:** Add `newly_created` field ([#311](https://github.com/discordjs/discord-api-types/issues/311)) ([7e54215](https://github.com/discordjs/discord-api-types/commit/7e542152da2e58f44c2314d5bd3b04a518fa979e))
|
||||
- **Interactions:** add modal and text input interactions ([#243](https://github.com/discordjs/discord-api-types/issues/243)) ([bf0f66b](https://github.com/discordjs/discord-api-types/commit/bf0f66b60a97f79c0e80ace5b408baee343bc82c))
|
||||
- **Locales:** add locale string enum ([#297](https://github.com/discordjs/discord-api-types/issues/297)) ([b07d5a0](https://github.com/discordjs/discord-api-types/commit/b07d5a0c2273b6b51b44542b638a768c36d0f184))
|
||||
- **MessageFlags:** add `FailedToMentionSomeRolesInThread` ([#280](https://github.com/discordjs/discord-api-types/issues/280)) ([76588d9](https://github.com/discordjs/discord-api-types/commit/76588d9d384f71ace05d96de17889e4490874462))
|
||||
- **RESTPostAPIChannelMessage, RESTPostAPIWebhookMessage:** add flags for creation ([#300](https://github.com/discordjs/discord-api-types/issues/300)) ([4194bd9](https://github.com/discordjs/discord-api-types/commit/4194bd9054a7e4b004f9244706f423292a8a0e56))
|
||||
- **RESTJSONErrorCodes:** add error 30042 ([#305](https://github.com/discordjs/discord-api-types/issues/305)) ([9c2b185](https://github.com/discordjs/discord-api-types/commit/9c2b185367b1ea2e432355d76af8f19e8fca7398))
|
||||
- **RESTJSONErrorCodes:** add error 30046 ([#304](https://github.com/discordjs/discord-api-types/issues/304)) ([56d3975](https://github.com/discordjs/discord-api-types/commit/56d39756c0d973ec56fe6e1eeb75d827f50aac81))
|
||||
- **RESTJSONErrorCodes:** add error 40004 ([#314](https://github.com/discordjs/discord-api-types/issues/314)) ([269a75c](https://github.com/discordjs/discord-api-types/commit/269a75ccf7b413bfc031849713e919ebb8d87a1a))
|
||||
- **RESTJSONErrorCodes:** add error 50068 ([#302](https://github.com/discordjs/discord-api-types/issues/302)) ([7655e20](https://github.com/discordjs/discord-api-types/commit/7655e2024800abc4431011668b83373e0868485e))
|
||||
- **RESTJSONErrorCodes:** add error code 50086 ([#286](https://github.com/discordjs/discord-api-types/issues/286)) ([51fb37c](https://github.com/discordjs/discord-api-types/commit/51fb37cbba44677870f0f916bd1416bdbd34e052))
|
||||
- **RESTPatchAPIGuildMember:** add `communication_disabled_until` field ([#289](https://github.com/discordjs/discord-api-types/issues/289)) ([5056b0f](https://github.com/discordjs/discord-api-types/commit/5056b0f2b3798480dbbc193fd80dedfefedff4fc))
|
||||
- **RESTPatchAPIGuildMember:** add modify current member and deprecate nick route ([#262](https://github.com/discordjs/discord-api-types/issues/262)) ([9a982ff](https://github.com/discordjs/discord-api-types/commit/9a982ff8d9592a02d78f24295efd756dc0c69fa8))
|
||||
- **RouteBases:** add base for guild scheduled events ([#293](https://github.com/discordjs/discord-api-types/issues/293)) ([83f29b6](https://github.com/discordjs/discord-api-types/commit/83f29b692839cc51869bcafdaf387b68731e0a28))
|
||||
- **UserFlags:** add `Spammer` flag ([#294](https://github.com/discordjs/discord-api-types/issues/294)) ([03f12d7](https://github.com/discordjs/discord-api-types/commit/03f12d71eef2661ee5290152952ea1adc9a92383))
|
||||
|
||||
### types
|
||||
|
||||
- Add tagged `type` unions for channel types ([#200](https://github.com/discordjs/discord-api-types/issues/200)) ([2c1fbda](https://github.com/discordjs/discord-api-types/commit/2c1fbda621fc1c1ea227295c578e6d8486dbc4f2))
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
- **Interactions:** `APIBaseMessageComponent` was renamed to `APIBaseComponent`
|
||||
- **UserFlags:** The `None` user flag is bye-bye (although I doubt anyone is using it)
|
||||
- All of the channel types are now split based on their type. As such, you will need to assert the type (either by checking it with the enum or by casting the data as the correct channel) before accessing data.
|
||||
_If you encounter any missing properties due to this, please open an issue! This is a big change, and we hope nothing is missing_
|
||||
|
||||
- **ActivityType:** `Game` was renamed to `Playing`
|
||||
|
||||
## [0.26.1](https://github.com/discordjs/discord-api-types/compare/0.26.0...0.26.1) (2022-01-02)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -694,7 +694,6 @@ export interface GatewayIdentify {
|
||||
properties: GatewayIdentifyProperties;
|
||||
compress?: boolean;
|
||||
large_threshold?: number;
|
||||
// eslint-disable-next-line prettier/prettier
|
||||
shard?: [shard_id: number, shard_count: number];
|
||||
presence?: RawGatewayPresenceUpdate;
|
||||
guild_subscriptions?: boolean;
|
||||
|
||||
@@ -27,6 +27,7 @@ import type {
|
||||
GatewayVoiceState,
|
||||
InviteTargetType,
|
||||
PresenceUpdateStatus,
|
||||
APIThreadChannel,
|
||||
} from '../payloads/v9/mod.ts';
|
||||
import type { Nullable } from '../utils/internals.ts';
|
||||
|
||||
@@ -1280,7 +1281,12 @@ export type GatewayThreadCreateDispatch = GatewayChannelModifyDispatch;
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#thread-create
|
||||
*/
|
||||
export type GatewayThreadCreateDispatchData = GatewayChannelModifyDispatchData;
|
||||
export interface GatewayThreadCreateDispatchData extends APIThreadChannel {
|
||||
/**
|
||||
* Whether the thread is newly created or not.
|
||||
*/
|
||||
newly_created?: true;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#thread-update
|
||||
|
||||
@@ -122,7 +122,6 @@ export type GatewayActivityEmoji = Partial<Pick<APIEmoji, 'name' | 'animated'>>
|
||||
*/
|
||||
export interface GatewayActivityParty {
|
||||
id?: string;
|
||||
// eslint-disable-next-line prettier/prettier
|
||||
size?: [currentSize: number, maxSize: number];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { Snowflake } from '../../../../../globals.ts';
|
||||
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export type APIApplicationCommandAttachmentOption =
|
||||
APIApplicationCommandOptionBase<ApplicationCommandOptionType.Attachment>;
|
||||
|
||||
export type APIApplicationCommandInteractionDataAttachmentOption = APIInteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Attachment,
|
||||
Snowflake
|
||||
>;
|
||||
@@ -12,6 +12,7 @@ export enum ApplicationCommandOptionType {
|
||||
Role,
|
||||
Mentionable,
|
||||
Number,
|
||||
Attachment,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Snowflake } from '../../../../globals.ts';
|
||||
import type { APIRole, APIUser } from '../../mod.ts';
|
||||
import type { APIAttachment, APIRole, APIUser } from '../../mod.ts';
|
||||
import type {
|
||||
APIApplicationCommandInteractionWrapper,
|
||||
APIInteractionDataResolvedChannel,
|
||||
@@ -41,6 +41,10 @@ import type {
|
||||
APIApplicationCommandNumberOption,
|
||||
APIApplicationCommandInteractionDataNumberOption,
|
||||
} from './_chatInput/number.ts';
|
||||
import type {
|
||||
APIApplicationCommandAttachmentOption,
|
||||
APIApplicationCommandInteractionDataAttachmentOption,
|
||||
} from './_chatInput/attachment.ts';
|
||||
import type {
|
||||
APIApplicationCommandSubcommandOption,
|
||||
APIApplicationCommandInteractionDataSubcommandOption,
|
||||
@@ -58,6 +62,7 @@ export * from './_chatInput/channel.ts';
|
||||
export * from './_chatInput/role.ts';
|
||||
export * from './_chatInput/mentionable.ts';
|
||||
export * from './_chatInput/number.ts';
|
||||
export * from './_chatInput/attachment.ts';
|
||||
export * from './_chatInput/subcommand.ts';
|
||||
export * from './_chatInput/subcommandGroup.ts';
|
||||
export * from './_chatInput/shared.ts';
|
||||
@@ -73,7 +78,8 @@ export type APIApplicationCommandBasicOption =
|
||||
| APIApplicationCommandChannelOption
|
||||
| APIApplicationCommandRoleOption
|
||||
| APIApplicationCommandMentionableOption
|
||||
| APIApplicationCommandNumberOption;
|
||||
| APIApplicationCommandNumberOption
|
||||
| APIApplicationCommandAttachmentOption;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||
@@ -99,7 +105,8 @@ export type APIApplicationCommandInteractionDataBasicOption =
|
||||
| APIApplicationCommandInteractionDataChannelOption
|
||||
| APIApplicationCommandInteractionDataRoleOption
|
||||
| APIApplicationCommandInteractionDataMentionableOption
|
||||
| APIApplicationCommandInteractionDataNumberOption;
|
||||
| APIApplicationCommandInteractionDataNumberOption
|
||||
| APIApplicationCommandInteractionDataAttachmentOption;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
|
||||
@@ -118,6 +125,7 @@ export interface APIChatInputApplicationCommandInteractionDataResolved {
|
||||
roles?: Record<Snowflake, APIRole>;
|
||||
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
|
||||
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
|
||||
attachments?: Record<Snowflake, APIAttachment>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,30 @@
|
||||
import type { APIBaseInteraction, APIChatInputApplicationCommandInteractionData, InteractionType } from '../mod.ts';
|
||||
import type {
|
||||
APIBaseInteraction,
|
||||
APIChatInputApplicationCommandInteractionData,
|
||||
APIDMInteractionWrapper,
|
||||
APIGuildInteractionWrapper,
|
||||
InteractionType,
|
||||
} from '../mod.ts';
|
||||
|
||||
export type APIApplicationCommandAutocompleteInteraction = APIBaseInteraction<
|
||||
InteractionType.ApplicationCommandAutocomplete,
|
||||
APIChatInputApplicationCommandInteractionData
|
||||
>;
|
||||
> &
|
||||
Required<
|
||||
Pick<
|
||||
APIBaseInteraction<InteractionType.ApplicationCommandAutocomplete, APIChatInputApplicationCommandInteractionData>,
|
||||
'data'
|
||||
>
|
||||
>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandAutocompleteDMInteraction =
|
||||
APIDMInteractionWrapper<APIApplicationCommandAutocompleteInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandAutocompleteGuildInteraction =
|
||||
APIGuildInteractionWrapper<APIApplicationCommandAutocompleteInteraction>;
|
||||
|
||||
@@ -3,6 +3,20 @@ import type { InteractionType } from './responses.ts';
|
||||
import type { APIMessage } from '../channel.ts';
|
||||
import type { APIGuildMember } from '../guild.ts';
|
||||
import type { APIUser } from '../user.ts';
|
||||
import type { LocaleString } from '../../../v8.ts';
|
||||
|
||||
export type PartialAPIMessageInteractionGuildMember = Pick<
|
||||
APIGuildMember,
|
||||
| 'roles'
|
||||
| 'premium_since'
|
||||
| 'pending'
|
||||
| 'nick'
|
||||
| 'mute'
|
||||
| 'joined_at'
|
||||
| 'deaf'
|
||||
| 'communication_disabled_until'
|
||||
| 'avatar'
|
||||
>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object
|
||||
@@ -24,6 +38,10 @@ export interface APIMessageInteraction {
|
||||
* The user who invoked the interaction
|
||||
*/
|
||||
user: APIUser;
|
||||
/**
|
||||
* The guild member who invoked the interaction, only sent in MESSAGE_CREATE events
|
||||
*/
|
||||
member?: PartialAPIMessageInteractionGuildMember;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,6 +104,14 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
|
||||
* For components, the message they were attached to
|
||||
*/
|
||||
message?: APIMessage;
|
||||
/**
|
||||
* The selected language of the invoking user
|
||||
*/
|
||||
locale: LocaleString;
|
||||
/**
|
||||
* The guild's preferred locale, if invoked in a guild
|
||||
*/
|
||||
guild_locale?: LocaleString;
|
||||
}
|
||||
|
||||
export type APIDMInteractionWrapper<Original extends APIBaseInteraction<InteractionType, unknown>> = Omit<
|
||||
|
||||
46
deno/payloads/v8/_interactions/modalSubmit.ts
Normal file
46
deno/payloads/v8/_interactions/modalSubmit.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel.ts';
|
||||
import type {
|
||||
APIBaseInteraction,
|
||||
InteractionType,
|
||||
ComponentType,
|
||||
APIDMInteractionWrapper,
|
||||
APIGuildInteractionWrapper,
|
||||
} from '../mod.ts';
|
||||
|
||||
export interface ModalSubmitComponent {
|
||||
type: ComponentType;
|
||||
custom_id: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface ModalSubmitActionRowComponent
|
||||
extends Omit<APIActionRowComponent<APIModalActionRowComponent>, 'components'> {
|
||||
components: ModalSubmitComponent[];
|
||||
}
|
||||
|
||||
export interface APIModalSubmission {
|
||||
/**
|
||||
* A developer-defined identifier for the component, max 100 characters
|
||||
*/
|
||||
custom_id: string;
|
||||
/**
|
||||
* A list of child components
|
||||
*/
|
||||
components?: ModalSubmitActionRowComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitInteraction = APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission> &
|
||||
Required<Pick<APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission>, 'data'>>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitDMInteraction = APIDMInteractionWrapper<APIModalSubmitInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitGuildInteraction = APIGuildInteractionWrapper<APIModalSubmitInteraction>;
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { APIBaseInteraction } from './base.ts';
|
||||
import type { InteractionType } from './responses.ts';
|
||||
|
||||
export type APIPingInteraction = APIBaseInteraction<InteractionType.Ping, never>;
|
||||
export type APIPingInteraction = Omit<APIBaseInteraction<InteractionType.Ping, never>, 'locale'>;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { MessageFlags } from '../mod.ts';
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8.ts';
|
||||
import type { APIApplicationCommandOptionChoice } from './applicationCommands.ts';
|
||||
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
|
||||
@@ -10,6 +11,7 @@ export enum InteractionType {
|
||||
ApplicationCommand,
|
||||
MessageComponent,
|
||||
ApplicationCommandAutocomplete,
|
||||
ModalSubmit,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,6 +34,11 @@ export interface APIApplicationCommandAutocompleteResponse {
|
||||
data: APICommandAutocompleteInteractionResponseCallbackData;
|
||||
}
|
||||
|
||||
export interface APIModalInteractionResponse {
|
||||
type: InteractionResponseType.Modal;
|
||||
data: APIModalInteractionResponseCallbackData;
|
||||
}
|
||||
|
||||
export interface APIInteractionResponseChannelMessageWithSource {
|
||||
type: InteractionResponseType.ChannelMessageWithSource;
|
||||
data: APIInteractionResponseCallbackData;
|
||||
@@ -79,6 +86,10 @@ export enum InteractionResponseType {
|
||||
* For autocomplete interactions
|
||||
*/
|
||||
ApplicationCommandAutocompleteResult,
|
||||
/**
|
||||
* Respond to an interaction with an modal for a user to fill-out
|
||||
*/
|
||||
Modal,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,3 +103,21 @@ export type APIInteractionResponseCallbackData = Omit<
|
||||
export interface APICommandAutocompleteInteractionResponseCallbackData {
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal
|
||||
*/
|
||||
export interface APIModalInteractionResponseCallbackData {
|
||||
/**
|
||||
* A developer-defined identifier for the component, max 100 characters
|
||||
*/
|
||||
custom_id: string;
|
||||
/**
|
||||
* The title of the popup modal
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* Between 1 and 5 (inclusive) components that make up the modal
|
||||
*/
|
||||
components: APIActionRowComponent<APIModalActionRowComponent>[];
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
*/
|
||||
|
||||
import type { Permissions, Snowflake } from '../../globals.ts';
|
||||
import type { APIApplication } from './application.ts';
|
||||
import type { APIPartialEmoji } from './emoji.ts';
|
||||
import type { APIGuildMember } from './guild.ts';
|
||||
import type { APIMessageInteraction } from './interactions.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';
|
||||
@@ -32,17 +32,37 @@ export interface APIPartialChannel {
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
|
||||
* This interface is used to allow easy extension for other channel types. While
|
||||
* also allowing `APIPartialChannel` to be used without breaking.
|
||||
*/
|
||||
export interface APIChannel extends APIPartialChannel {
|
||||
export interface APIChannelBase<T extends ChannelType> extends APIPartialChannel {
|
||||
type: T;
|
||||
}
|
||||
|
||||
// TODO: update when text in voice is released
|
||||
export type TextChannelType = ChannelType.DM | ChannelType.GroupDM | ChannelType.GuildNews | ChannelType.GuildText;
|
||||
|
||||
export type GuildChannelType = Exclude<
|
||||
| TextChannelType
|
||||
| ChannelType.GuildVoice
|
||||
| ChannelType.GuildStageVoice
|
||||
| ChannelType.GuildNews
|
||||
| ChannelType.GuildStore,
|
||||
ChannelType.DM | ChannelType.GroupDM
|
||||
>;
|
||||
|
||||
export interface APITextBasedChannel<T extends ChannelType> extends APIChannelBase<T> {
|
||||
/**
|
||||
* The id of the last message sent in this channel (may not point to an existing or valid message)
|
||||
*/
|
||||
last_message_id?: Snowflake | null;
|
||||
}
|
||||
|
||||
export interface APIGuildChannel<T extends ChannelType> extends APIChannelBase<T> {
|
||||
/**
|
||||
* The id of the guild (may be missing for some channel objects received over gateway guild dispatches)
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
position?: number;
|
||||
/**
|
||||
* Explicit permission overwrites for members and roles
|
||||
*
|
||||
@@ -50,17 +70,48 @@ export interface APIChannel extends APIPartialChannel {
|
||||
*/
|
||||
permission_overwrites?: APIOverwrite[];
|
||||
/**
|
||||
* The channel topic (0-1024 characters)
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
topic?: string | null;
|
||||
position?: number;
|
||||
/**
|
||||
* ID of the parent category for a channel (each parent category can contain up to 50 channels)
|
||||
*/
|
||||
parent_id?: Snowflake | null;
|
||||
/**
|
||||
* Whether the channel is nsfw
|
||||
*/
|
||||
nsfw?: boolean;
|
||||
}
|
||||
|
||||
export type GuildTextChannelType = Exclude<TextChannelType, ChannelType.DM | ChannelType.GroupDM>;
|
||||
|
||||
export interface APIGuildTextChannel<T extends GuildTextChannelType>
|
||||
extends APITextBasedChannel<T>,
|
||||
APIGuildChannel<T> {
|
||||
/**
|
||||
* The id of the last message sent in this channel (may not point to an existing or valid message)
|
||||
* The channel topic (0-1024 characters)
|
||||
*/
|
||||
last_message_id?: Snowflake | null;
|
||||
topic?: string | null;
|
||||
/**
|
||||
* When the last pinned message was pinned.
|
||||
* This may be `null` in events such as `GUILD_CREATE` when a message is not pinned
|
||||
*/
|
||||
last_pin_timestamp?: string | null;
|
||||
}
|
||||
|
||||
export interface APITextChannel extends APIGuildTextChannel<ChannelType.GuildText> {
|
||||
/**
|
||||
* 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?: number;
|
||||
}
|
||||
|
||||
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildNews>;
|
||||
export type APIGuildCategoryChannel = APIGuildChannel<ChannelType.GuildCategory>;
|
||||
export type APIGuildStoreChannel = APIGuildChannel<ChannelType.GuildStore>;
|
||||
|
||||
export interface APIVoiceChannel extends APIGuildChannel<ChannelType.GuildStageVoice | ChannelType.GuildVoice> {
|
||||
/**
|
||||
* The bitrate (in bits) of the voice channel
|
||||
*/
|
||||
@@ -69,38 +120,6 @@ export interface APIChannel extends APIPartialChannel {
|
||||
* The user limit of the voice channel
|
||||
*/
|
||||
user_limit?: number;
|
||||
/**
|
||||
* 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?: number;
|
||||
/**
|
||||
* The recipients of the DM
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
recipients?: APIUser[];
|
||||
/**
|
||||
* Icon hash
|
||||
*/
|
||||
icon?: string | null;
|
||||
/**
|
||||
* ID of the DM creator
|
||||
*/
|
||||
owner_id?: Snowflake;
|
||||
/**
|
||||
* Application id of the group DM creator if it is bot-created
|
||||
*/
|
||||
application_id?: Snowflake;
|
||||
/**
|
||||
* ID of the parent category for a channel (each parent category can contain up to 50 channels)
|
||||
*/
|
||||
parent_id?: Snowflake | null;
|
||||
/**
|
||||
* When the last pinned message was pinned.
|
||||
* This may be `null` in events such as `GUILD_CREATE` when a message is not pinned
|
||||
*/
|
||||
last_pin_timestamp?: string | null;
|
||||
/**
|
||||
* Voice region id for the voice or stage channel, automatic when set to `null`
|
||||
*
|
||||
@@ -115,6 +134,49 @@ export interface APIChannel extends APIPartialChannel {
|
||||
video_quality_mode?: VideoQualityMode;
|
||||
}
|
||||
|
||||
interface APIDMChannelBase<T extends ChannelType> extends APITextBasedChannel<T> {
|
||||
/**
|
||||
* The recipients of the DM
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
recipients?: APIUser[];
|
||||
}
|
||||
|
||||
export type APIDMChannel = APIDMChannelBase<ChannelType.DM>;
|
||||
|
||||
export interface APIGroupDMChannel extends APIDMChannelBase<ChannelType.GroupDM> {
|
||||
/**
|
||||
* Application id of the group DM creator if it is bot-created
|
||||
*/
|
||||
application_id?: Snowflake;
|
||||
/**
|
||||
* Icon hash
|
||||
*/
|
||||
icon?: string | null;
|
||||
/**
|
||||
* ID of the DM creator
|
||||
*/
|
||||
owner_id?: Snowflake;
|
||||
/**
|
||||
* The id of the last message sent in this channel (may not point to an existing or valid message)
|
||||
*/
|
||||
last_message_id?: Snowflake | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
|
||||
*/
|
||||
export type APIChannel =
|
||||
| APIGroupDMChannel
|
||||
| APIDMChannel
|
||||
| APITextChannel
|
||||
| APINewsChannel
|
||||
| APIGuildStoreChannel
|
||||
| APIVoiceChannel
|
||||
| APIGuildCategoryChannel
|
||||
| APINewsChannel;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-types
|
||||
*/
|
||||
@@ -344,7 +406,7 @@ export interface APIMessage {
|
||||
/**
|
||||
* Sent if the message contains components like buttons, action rows, or other interactive components
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
components?: APIActionRowComponent<APIMessageActionRowComponent>[];
|
||||
/**
|
||||
* Sent if the message contains stickers
|
||||
*
|
||||
@@ -914,7 +976,7 @@ export interface APIAllowedMentions {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
export interface APIBaseMessageComponent<T extends ComponentType> {
|
||||
export interface APIBaseComponent<T extends ComponentType> {
|
||||
/**
|
||||
* The type of the component
|
||||
*/
|
||||
@@ -937,22 +999,27 @@ export enum ComponentType {
|
||||
* Select Menu component
|
||||
*/
|
||||
SelectMenu,
|
||||
/**
|
||||
* Text Input component
|
||||
*/
|
||||
TextInput,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#action-rows
|
||||
*/
|
||||
export interface APIActionRowComponent extends APIBaseMessageComponent<ComponentType.ActionRow> {
|
||||
export interface APIActionRowComponent<T extends APIActionRowComponentTypes>
|
||||
extends APIBaseComponent<ComponentType.ActionRow> {
|
||||
/**
|
||||
* The components in the ActionRow
|
||||
*/
|
||||
components: Exclude<APIMessageComponent, APIActionRowComponent>[];
|
||||
components: T[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#buttons
|
||||
*/
|
||||
interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseMessageComponent<ComponentType.Button> {
|
||||
interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseComponent<ComponentType.Button> {
|
||||
/**
|
||||
* The label to be displayed on the button
|
||||
*/
|
||||
@@ -1016,10 +1083,18 @@ export enum ButtonStyle {
|
||||
Link,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-styles
|
||||
*/
|
||||
export enum TextInputStyle {
|
||||
Short = 1,
|
||||
Paragraph,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#select-menus
|
||||
*/
|
||||
export interface APISelectMenuComponent extends APIBaseMessageComponent<ComponentType.SelectMenu> {
|
||||
export interface APISelectMenuComponent extends APIBaseComponent<ComponentType.SelectMenu> {
|
||||
/**
|
||||
* A developer-defined identifier for the select menu, max 100 characters
|
||||
*/
|
||||
@@ -1078,7 +1153,56 @@ export interface APISelectMenuOption {
|
||||
default?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-structure
|
||||
*/
|
||||
export interface APITextInputComponent extends APIBaseComponent<ComponentType.TextInput> {
|
||||
/**
|
||||
* One of text input styles
|
||||
*/
|
||||
style: TextInputStyle;
|
||||
/**
|
||||
* The custom id for the text input
|
||||
*/
|
||||
custom_id: string;
|
||||
/**
|
||||
* Text that appears on top of the text input field, max 80 characters
|
||||
*/
|
||||
label: string;
|
||||
/**
|
||||
* Placeholder for the text input
|
||||
*/
|
||||
placeholder?: string;
|
||||
/**
|
||||
* The pre-filled text in the text input
|
||||
*/
|
||||
value?: string;
|
||||
/**
|
||||
* Minimal length of text input
|
||||
*/
|
||||
min_length?: number;
|
||||
/**
|
||||
* Maximal length of text input
|
||||
*/
|
||||
max_length?: number;
|
||||
/**
|
||||
* Whether or not this text input is required or not
|
||||
*/
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#message-components
|
||||
*/
|
||||
export type APIMessageComponent = APIActionRowComponent | APIButtonComponent | APISelectMenuComponent;
|
||||
export type APIMessageComponent = APIMessageActionRowComponent | APIActionRowComponent<APIMessageActionRowComponent>;
|
||||
export type APIModalComponent = APIModalActionRowComponent | APIActionRowComponent<APIModalActionRowComponent>;
|
||||
|
||||
export type APIActionRowComponentTypes = APIMessageActionRowComponent | APIModalActionRowComponent;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#message-components
|
||||
*/
|
||||
export type APIMessageActionRowComponent = APIButtonComponent | APISelectMenuComponent;
|
||||
|
||||
// Modal components
|
||||
export type APIModalActionRowComponent = APITextInputComponent;
|
||||
|
||||
@@ -220,7 +220,7 @@ export enum ActivityType {
|
||||
/**
|
||||
* Playing {game}
|
||||
*/
|
||||
Game,
|
||||
Playing,
|
||||
/**
|
||||
* Streaming {details}
|
||||
*/
|
||||
|
||||
@@ -582,6 +582,10 @@ export interface APIGuildPreview {
|
||||
* The description for the guild
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* Custom guild stickers
|
||||
*/
|
||||
stickers: APISticker[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@ interface APIGuildScheduledEventBase<Type extends GuildScheduledEventEntityType>
|
||||
/**
|
||||
* The id of the user that created the scheduled event
|
||||
*/
|
||||
creator_id: Snowflake | null;
|
||||
creator_id?: Snowflake | null;
|
||||
/**
|
||||
* The name of the scheduled event
|
||||
*/
|
||||
@@ -63,6 +63,10 @@ interface APIGuildScheduledEventBase<Type extends GuildScheduledEventEntityType>
|
||||
* The number of users subscribed to the scheduled event
|
||||
*/
|
||||
user_count?: number;
|
||||
/**
|
||||
* The cover image of the scheduled event
|
||||
*/
|
||||
image: string | null;
|
||||
}
|
||||
|
||||
export interface APIStageInstanceGuildScheduledEvent
|
||||
|
||||
@@ -9,13 +9,24 @@ import type {
|
||||
APIApplicationCommandGuildInteraction,
|
||||
APIApplicationCommandInteraction,
|
||||
} from './_interactions/applicationCommands.ts';
|
||||
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete.ts';
|
||||
import type {
|
||||
APIApplicationCommandAutocompleteDMInteraction,
|
||||
APIApplicationCommandAutocompleteGuildInteraction,
|
||||
APIApplicationCommandAutocompleteInteraction,
|
||||
} from './_interactions/autocomplete.ts';
|
||||
import type {
|
||||
APIModalSubmitDMInteraction,
|
||||
APIModalSubmitGuildInteraction,
|
||||
APIModalSubmitInteraction,
|
||||
} from './_interactions/modalSubmit.ts';
|
||||
|
||||
export * from './_interactions/base.ts';
|
||||
export * from './_interactions/messageComponents.ts';
|
||||
export * from './_interactions/ping.ts';
|
||||
export * from './_interactions/responses.ts';
|
||||
export * from './_interactions/applicationCommands.ts';
|
||||
export * from './_interactions/modalSubmit.ts';
|
||||
export * from './_interactions/autocomplete.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
@@ -24,14 +35,23 @@ export type APIInteraction =
|
||||
| APIPingInteraction
|
||||
| APIApplicationCommandInteraction
|
||||
| APIMessageComponentInteraction
|
||||
| APIApplicationCommandAutocompleteInteraction;
|
||||
| APIApplicationCommandAutocompleteInteraction
|
||||
| APIModalSubmitInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
|
||||
export type APIDMInteraction =
|
||||
| APIApplicationCommandDMInteraction
|
||||
| APIMessageComponentDMInteraction
|
||||
| APIApplicationCommandAutocompleteDMInteraction
|
||||
| APIModalSubmitDMInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;
|
||||
export type APIGuildInteraction =
|
||||
| APIApplicationCommandGuildInteraction
|
||||
| APIMessageComponentGuildInteraction
|
||||
| APIApplicationCommandAutocompleteGuildInteraction
|
||||
| APIModalSubmitGuildInteraction;
|
||||
|
||||
@@ -85,10 +85,6 @@ export interface APIUser {
|
||||
* https://discord.com/developers/docs/resources/user#user-object-user-flags
|
||||
*/
|
||||
export enum UserFlags {
|
||||
/**
|
||||
* None
|
||||
*/
|
||||
None = 0,
|
||||
/**
|
||||
* Discord Employee
|
||||
*/
|
||||
@@ -145,6 +141,10 @@ export enum UserFlags {
|
||||
* Bot uses only [HTTP interactions](https://discord.com/developers/docs/interactions/receiving-and-responding#receiving-an-interaction) and is shown in the online member list
|
||||
*/
|
||||
BotHTTPInteractions = 1 << 19,
|
||||
/**
|
||||
* User has been identified as spammer
|
||||
*/
|
||||
Spammer = 1 << 20,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { Snowflake } from '../../../../../globals.ts';
|
||||
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export type APIApplicationCommandAttachmentOption =
|
||||
APIApplicationCommandOptionBase<ApplicationCommandOptionType.Attachment>;
|
||||
|
||||
export type APIApplicationCommandInteractionDataAttachmentOption = APIInteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Attachment,
|
||||
Snowflake
|
||||
>;
|
||||
@@ -12,6 +12,7 @@ export enum ApplicationCommandOptionType {
|
||||
Role,
|
||||
Mentionable,
|
||||
Number,
|
||||
Attachment,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Snowflake } from '../../../../globals.ts';
|
||||
import type { APIRole, APIUser } from '../../mod.ts';
|
||||
import type { APIAttachment, APIRole, APIUser } from '../../mod.ts';
|
||||
import type {
|
||||
APIApplicationCommandInteractionWrapper,
|
||||
APIInteractionDataResolvedChannel,
|
||||
@@ -41,6 +41,10 @@ import type {
|
||||
APIApplicationCommandNumberOption,
|
||||
APIApplicationCommandInteractionDataNumberOption,
|
||||
} from './_chatInput/number.ts';
|
||||
import type {
|
||||
APIApplicationCommandAttachmentOption,
|
||||
APIApplicationCommandInteractionDataAttachmentOption,
|
||||
} from './_chatInput/attachment.ts';
|
||||
import type {
|
||||
APIApplicationCommandSubcommandOption,
|
||||
APIApplicationCommandInteractionDataSubcommandOption,
|
||||
@@ -58,6 +62,7 @@ export * from './_chatInput/channel.ts';
|
||||
export * from './_chatInput/role.ts';
|
||||
export * from './_chatInput/mentionable.ts';
|
||||
export * from './_chatInput/number.ts';
|
||||
export * from './_chatInput/attachment.ts';
|
||||
export * from './_chatInput/subcommand.ts';
|
||||
export * from './_chatInput/subcommandGroup.ts';
|
||||
export * from './_chatInput/shared.ts';
|
||||
@@ -73,7 +78,8 @@ export type APIApplicationCommandBasicOption =
|
||||
| APIApplicationCommandChannelOption
|
||||
| APIApplicationCommandRoleOption
|
||||
| APIApplicationCommandMentionableOption
|
||||
| APIApplicationCommandNumberOption;
|
||||
| APIApplicationCommandNumberOption
|
||||
| APIApplicationCommandAttachmentOption;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||
@@ -99,7 +105,8 @@ export type APIApplicationCommandInteractionDataBasicOption =
|
||||
| APIApplicationCommandInteractionDataChannelOption
|
||||
| APIApplicationCommandInteractionDataRoleOption
|
||||
| APIApplicationCommandInteractionDataMentionableOption
|
||||
| APIApplicationCommandInteractionDataNumberOption;
|
||||
| APIApplicationCommandInteractionDataNumberOption
|
||||
| APIApplicationCommandInteractionDataAttachmentOption;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
|
||||
@@ -118,6 +125,7 @@ export interface APIChatInputApplicationCommandInteractionDataResolved {
|
||||
roles?: Record<Snowflake, APIRole>;
|
||||
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
|
||||
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
|
||||
attachments?: Record<Snowflake, APIAttachment>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,30 @@
|
||||
import type { APIBaseInteraction, APIChatInputApplicationCommandInteractionData, InteractionType } from '../mod.ts';
|
||||
import type {
|
||||
APIBaseInteraction,
|
||||
APIChatInputApplicationCommandInteractionData,
|
||||
APIDMInteractionWrapper,
|
||||
APIGuildInteractionWrapper,
|
||||
InteractionType,
|
||||
} from '../mod.ts';
|
||||
|
||||
export type APIApplicationCommandAutocompleteInteraction = APIBaseInteraction<
|
||||
InteractionType.ApplicationCommandAutocomplete,
|
||||
APIChatInputApplicationCommandInteractionData
|
||||
>;
|
||||
> &
|
||||
Required<
|
||||
Pick<
|
||||
APIBaseInteraction<InteractionType.ApplicationCommandAutocomplete, APIChatInputApplicationCommandInteractionData>,
|
||||
'data'
|
||||
>
|
||||
>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandAutocompleteDMInteraction =
|
||||
APIDMInteractionWrapper<APIApplicationCommandAutocompleteInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandAutocompleteGuildInteraction =
|
||||
APIGuildInteractionWrapper<APIApplicationCommandAutocompleteInteraction>;
|
||||
|
||||
@@ -3,6 +3,20 @@ import type { InteractionType } from './responses.ts';
|
||||
import type { APIMessage } from '../channel.ts';
|
||||
import type { APIGuildMember } from '../guild.ts';
|
||||
import type { APIUser } from '../user.ts';
|
||||
import type { LocaleString } from '../../../v9.ts';
|
||||
|
||||
export type PartialAPIMessageInteractionGuildMember = Pick<
|
||||
APIGuildMember,
|
||||
| 'roles'
|
||||
| 'premium_since'
|
||||
| 'pending'
|
||||
| 'nick'
|
||||
| 'mute'
|
||||
| 'joined_at'
|
||||
| 'deaf'
|
||||
| 'communication_disabled_until'
|
||||
| 'avatar'
|
||||
>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object
|
||||
@@ -24,6 +38,10 @@ export interface APIMessageInteraction {
|
||||
* The user who invoked the interaction
|
||||
*/
|
||||
user: APIUser;
|
||||
/**
|
||||
* The guild member who invoked the interaction, only sent in MESSAGE_CREATE events
|
||||
*/
|
||||
member?: PartialAPIMessageInteractionGuildMember;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,6 +104,14 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
|
||||
* For components, the message they were attached to
|
||||
*/
|
||||
message?: APIMessage;
|
||||
/**
|
||||
* The selected language of the invoking user
|
||||
*/
|
||||
locale: LocaleString;
|
||||
/**
|
||||
* The guild's preferred locale, if invoked in a guild
|
||||
*/
|
||||
guild_locale?: LocaleString;
|
||||
}
|
||||
|
||||
export type APIDMInteractionWrapper<Original extends APIBaseInteraction<InteractionType, unknown>> = Omit<
|
||||
|
||||
46
deno/payloads/v9/_interactions/modalSubmit.ts
Normal file
46
deno/payloads/v9/_interactions/modalSubmit.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel.ts';
|
||||
import type {
|
||||
APIBaseInteraction,
|
||||
InteractionType,
|
||||
ComponentType,
|
||||
APIDMInteractionWrapper,
|
||||
APIGuildInteractionWrapper,
|
||||
} from '../mod.ts';
|
||||
|
||||
export interface ModalSubmitComponent {
|
||||
type: ComponentType;
|
||||
custom_id: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface ModalSubmitActionRowComponent
|
||||
extends Omit<APIActionRowComponent<APIModalActionRowComponent>, 'components'> {
|
||||
components: ModalSubmitComponent[];
|
||||
}
|
||||
|
||||
export interface APIModalSubmission {
|
||||
/**
|
||||
* A developer-defined identifier for the component, max 100 characters
|
||||
*/
|
||||
custom_id: string;
|
||||
/**
|
||||
* A list of child components
|
||||
*/
|
||||
components?: ModalSubmitActionRowComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitInteraction = APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission> &
|
||||
Required<Pick<APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission>, 'data'>>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitDMInteraction = APIDMInteractionWrapper<APIModalSubmitInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitGuildInteraction = APIGuildInteractionWrapper<APIModalSubmitInteraction>;
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { APIBaseInteraction } from './base.ts';
|
||||
import type { InteractionType } from './responses.ts';
|
||||
|
||||
export type APIPingInteraction = APIBaseInteraction<InteractionType.Ping, never>;
|
||||
export type APIPingInteraction = Omit<APIBaseInteraction<InteractionType.Ping, never>, 'locale'>;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { MessageFlags } from '../mod.ts';
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9.ts';
|
||||
import type { APIApplicationCommandOptionChoice } from './applicationCommands.ts';
|
||||
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
|
||||
@@ -10,6 +11,7 @@ export enum InteractionType {
|
||||
ApplicationCommand,
|
||||
MessageComponent,
|
||||
ApplicationCommandAutocomplete,
|
||||
ModalSubmit,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,6 +34,11 @@ export interface APIApplicationCommandAutocompleteResponse {
|
||||
data: APICommandAutocompleteInteractionResponseCallbackData;
|
||||
}
|
||||
|
||||
export interface APIModalInteractionResponse {
|
||||
type: InteractionResponseType.Modal;
|
||||
data: APIModalInteractionResponseCallbackData;
|
||||
}
|
||||
|
||||
export interface APIInteractionResponseChannelMessageWithSource {
|
||||
type: InteractionResponseType.ChannelMessageWithSource;
|
||||
data: APIInteractionResponseCallbackData;
|
||||
@@ -79,6 +86,10 @@ export enum InteractionResponseType {
|
||||
* For autocomplete interactions
|
||||
*/
|
||||
ApplicationCommandAutocompleteResult,
|
||||
/**
|
||||
* Respond to an interaction with an modal for a user to fill-out
|
||||
*/
|
||||
Modal,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,3 +103,21 @@ export type APIInteractionResponseCallbackData = Omit<
|
||||
export interface APICommandAutocompleteInteractionResponseCallbackData {
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal
|
||||
*/
|
||||
export interface APIModalInteractionResponseCallbackData {
|
||||
/**
|
||||
* A developer-defined identifier for the component, max 100 characters
|
||||
*/
|
||||
custom_id: string;
|
||||
/**
|
||||
* The title of the popup modal
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* Between 1 and 5 (inclusive) components that make up the modal
|
||||
*/
|
||||
components: APIActionRowComponent<APIModalActionRowComponent>[];
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
*/
|
||||
|
||||
import type { Permissions, Snowflake } from '../../globals.ts';
|
||||
import type { APIApplication } from './application.ts';
|
||||
import type { APIPartialEmoji } from './emoji.ts';
|
||||
import type { APIGuildMember } from './guild.ts';
|
||||
import type { APIMessageInteraction } from './interactions.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';
|
||||
@@ -32,17 +32,44 @@ export interface APIPartialChannel {
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
|
||||
* This interface is used to allow easy extension for other channel types. While
|
||||
* also allowing `APIPartialChannel` to be used without breaking.
|
||||
*/
|
||||
export interface APIChannel extends APIPartialChannel {
|
||||
export interface APIChannelBase<T extends ChannelType> extends APIPartialChannel {
|
||||
type: T;
|
||||
}
|
||||
|
||||
// TODO: update when text in voice is released
|
||||
export type TextChannelType =
|
||||
| ChannelType.DM
|
||||
| ChannelType.GroupDM
|
||||
| ChannelType.GuildNews
|
||||
| ChannelType.GuildPublicThread
|
||||
| ChannelType.GuildPrivateThread
|
||||
| ChannelType.GuildNewsThread
|
||||
| ChannelType.GuildText;
|
||||
|
||||
export type GuildChannelType = Exclude<
|
||||
| TextChannelType
|
||||
| ChannelType.GuildVoice
|
||||
| ChannelType.GuildStageVoice
|
||||
| ChannelType.GuildNews
|
||||
| ChannelType.GuildStore,
|
||||
ChannelType.DM | ChannelType.GroupDM
|
||||
>;
|
||||
|
||||
export interface APITextBasedChannel<T extends ChannelType> extends APIChannelBase<T> {
|
||||
/**
|
||||
* The id of the last message sent in this channel (may not point to an existing or valid message)
|
||||
*/
|
||||
last_message_id?: Snowflake | null;
|
||||
}
|
||||
|
||||
export interface APIGuildChannel<T extends ChannelType> extends APIChannelBase<T> {
|
||||
/**
|
||||
* The id of the guild (may be missing for some channel objects received over gateway guild dispatches)
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
position?: number;
|
||||
/**
|
||||
* Explicit permission overwrites for members and roles
|
||||
*
|
||||
@@ -50,25 +77,44 @@ export interface APIChannel extends APIPartialChannel {
|
||||
*/
|
||||
permission_overwrites?: APIOverwrite[];
|
||||
/**
|
||||
* The channel topic (0-1024 characters)
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
topic?: string | null;
|
||||
position?: number;
|
||||
/**
|
||||
* ID of the parent category for a channel (each parent category can contain up to 50 channels)
|
||||
*
|
||||
* OR
|
||||
*
|
||||
* ID of the parent channel for a thread
|
||||
*/
|
||||
parent_id?: Snowflake | null;
|
||||
/**
|
||||
* Whether the channel is nsfw
|
||||
*/
|
||||
nsfw?: boolean;
|
||||
}
|
||||
|
||||
export type GuildTextChannelType = Exclude<TextChannelType, ChannelType.DM | ChannelType.GroupDM>;
|
||||
|
||||
export interface APIGuildTextChannel<T extends GuildTextChannelType>
|
||||
extends APITextBasedChannel<T>,
|
||||
APIGuildChannel<T> {
|
||||
/**
|
||||
* The id of the last message sent in this channel (may not point to an existing or valid message)
|
||||
* Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity
|
||||
*/
|
||||
last_message_id?: Snowflake | null;
|
||||
default_auto_archive_duration?: ThreadAutoArchiveDuration;
|
||||
/**
|
||||
* The bitrate (in bits) of the voice channel
|
||||
* The channel topic (0-1024 characters)
|
||||
*/
|
||||
bitrate?: number;
|
||||
topic?: string | null;
|
||||
/**
|
||||
* The user limit of the voice channel
|
||||
* When the last pinned message was pinned.
|
||||
* This may be `null` in events such as `GUILD_CREATE` when a message is not pinned
|
||||
*/
|
||||
user_limit?: number;
|
||||
last_pin_timestamp?: string | null;
|
||||
}
|
||||
|
||||
export interface APITextChannel extends APIGuildTextChannel<ChannelType.GuildText> {
|
||||
/**
|
||||
* 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
|
||||
@@ -79,37 +125,21 @@ export interface APIChannel extends APIPartialChannel {
|
||||
* 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;
|
||||
}
|
||||
|
||||
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildNews>;
|
||||
export type APIGuildCategoryChannel = APIGuildChannel<ChannelType.GuildCategory>;
|
||||
export type APIGuildStoreChannel = APIGuildChannel<ChannelType.GuildStore>;
|
||||
|
||||
export interface APIVoiceChannel extends APIGuildChannel<ChannelType.GuildStageVoice | ChannelType.GuildVoice> {
|
||||
/**
|
||||
* The recipients of the DM
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
* The bitrate (in bits) of the voice channel
|
||||
*/
|
||||
recipients?: APIUser[];
|
||||
bitrate?: number;
|
||||
/**
|
||||
* Icon hash
|
||||
* The user limit of the voice channel
|
||||
*/
|
||||
icon?: string | null;
|
||||
/**
|
||||
* ID of the DM creator or thread creator
|
||||
*/
|
||||
owner_id?: Snowflake;
|
||||
/**
|
||||
* Application id of the group DM creator if it is bot-created
|
||||
*/
|
||||
application_id?: Snowflake;
|
||||
/**
|
||||
* ID of the parent category for a channel (each parent category can contain up to 50 channels)
|
||||
*
|
||||
* OR
|
||||
*
|
||||
* ID of the parent channel for a thread
|
||||
*/
|
||||
parent_id?: Snowflake | null;
|
||||
/**
|
||||
* When the last pinned message was pinned.
|
||||
* This may be `null` in events such as `GUILD_CREATE` when a message is not pinned
|
||||
*/
|
||||
last_pin_timestamp?: string | null;
|
||||
user_limit?: number;
|
||||
/**
|
||||
* Voice region id for the voice or stage channel, automatic when set to `null`
|
||||
*
|
||||
@@ -122,6 +152,50 @@ export interface APIChannel extends APIPartialChannel {
|
||||
* See https://discord.com/developers/docs/resources/channel#channel-object-video-quality-modes
|
||||
*/
|
||||
video_quality_mode?: VideoQualityMode;
|
||||
}
|
||||
|
||||
interface APIDMChannelBase<T extends ChannelType> extends APITextBasedChannel<T> {
|
||||
/**
|
||||
* The recipients of the DM
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
recipients?: APIUser[];
|
||||
}
|
||||
|
||||
export type APIDMChannel = APIDMChannelBase<ChannelType.DM>;
|
||||
|
||||
export interface APIGroupDMChannel extends APIDMChannelBase<ChannelType.GroupDM> {
|
||||
/**
|
||||
* Application id of the group DM creator if it is bot-created
|
||||
*/
|
||||
application_id?: Snowflake;
|
||||
/**
|
||||
* Icon hash
|
||||
*/
|
||||
icon?: string | null;
|
||||
/**
|
||||
* ID of the DM creator
|
||||
*/
|
||||
owner_id?: Snowflake;
|
||||
/**
|
||||
* The id of the last message sent in this channel (may not point to an existing or valid message)
|
||||
*/
|
||||
last_message_id?: Snowflake | null;
|
||||
}
|
||||
|
||||
export interface APIThreadChannel
|
||||
extends APIGuildChannel<
|
||||
ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread | ChannelType.GuildNewsThread
|
||||
> {
|
||||
/**
|
||||
* The client users member for the thread, only included in select endpoints
|
||||
*/
|
||||
member?: APIThreadMember;
|
||||
/**
|
||||
* The metadata for a thread channel not shared by other channels
|
||||
*/
|
||||
thread_metadata?: APIThreadMetadata;
|
||||
/**
|
||||
* The approximate message count of the thread, does not count above 50 even if there are more messages
|
||||
*/
|
||||
@@ -131,19 +205,39 @@ export interface APIChannel extends APIPartialChannel {
|
||||
*/
|
||||
member_count?: number;
|
||||
/**
|
||||
* The metadata for a thread channel not shared by other channels
|
||||
* 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.
|
||||
*/
|
||||
thread_metadata?: APIThreadMetadata;
|
||||
rate_limit_per_user?: number;
|
||||
/**
|
||||
* The client users member for the thread, only included in select endpoints
|
||||
* ID of the thread creator
|
||||
*/
|
||||
member?: APIThreadMember;
|
||||
owner_id?: Snowflake;
|
||||
/**
|
||||
* Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity
|
||||
* The id of the last message sent in this thread (may not point to an existing or valid message)
|
||||
*/
|
||||
default_auto_archive_duration?: ThreadAutoArchiveDuration;
|
||||
last_message_id?: Snowflake | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
|
||||
*/
|
||||
export type APIChannel =
|
||||
| APIGroupDMChannel
|
||||
| APIDMChannel
|
||||
| APITextChannel
|
||||
| APINewsChannel
|
||||
| APIGuildStoreChannel
|
||||
| APIVoiceChannel
|
||||
| APIGuildCategoryChannel
|
||||
| APIThreadChannel
|
||||
| APINewsChannel;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-types
|
||||
*/
|
||||
@@ -389,7 +483,7 @@ export interface APIMessage {
|
||||
/**
|
||||
* Sent if the message contains components like buttons, action rows, or other interactive components
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
components?: APIActionRowComponent<APIMessageActionRowComponent>[];
|
||||
/**
|
||||
* Sent if the message contains stickers
|
||||
*
|
||||
@@ -516,6 +610,10 @@ export enum MessageFlags {
|
||||
* This message is an Interaction Response and the bot is "thinking"
|
||||
*/
|
||||
Loading = 1 << 7,
|
||||
/**
|
||||
* This message failed to mention some roles and add their members to the thread
|
||||
*/
|
||||
FailedToMentionSomeRolesInThread = 1 << 8,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -613,6 +711,10 @@ export interface APIThreadMetadata {
|
||||
* Whether non-moderators can add other non-moderators to the thread; only available on private threads
|
||||
*/
|
||||
invitable?: boolean;
|
||||
/**
|
||||
* Timestamp when the thread was created; only populated for threads created after 2022-01-09
|
||||
*/
|
||||
create_timestamp?: string;
|
||||
}
|
||||
|
||||
export enum ThreadAutoArchiveDuration {
|
||||
@@ -1043,7 +1145,7 @@ export interface APIAllowedMentions {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
export interface APIBaseMessageComponent<T extends ComponentType> {
|
||||
export interface APIBaseComponent<T extends ComponentType> {
|
||||
/**
|
||||
* The type of the component
|
||||
*/
|
||||
@@ -1066,22 +1168,27 @@ export enum ComponentType {
|
||||
* Select Menu component
|
||||
*/
|
||||
SelectMenu,
|
||||
/**
|
||||
* Text Input component
|
||||
*/
|
||||
TextInput,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#action-rows
|
||||
*/
|
||||
export interface APIActionRowComponent extends APIBaseMessageComponent<ComponentType.ActionRow> {
|
||||
export interface APIActionRowComponent<T extends APIActionRowComponentTypes>
|
||||
extends APIBaseComponent<ComponentType.ActionRow> {
|
||||
/**
|
||||
* The components in the ActionRow
|
||||
*/
|
||||
components: Exclude<APIMessageComponent, APIActionRowComponent>[];
|
||||
components: T[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#buttons
|
||||
*/
|
||||
interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseMessageComponent<ComponentType.Button> {
|
||||
interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseComponent<ComponentType.Button> {
|
||||
/**
|
||||
* The label to be displayed on the button
|
||||
*/
|
||||
@@ -1145,10 +1252,18 @@ export enum ButtonStyle {
|
||||
Link,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-styles
|
||||
*/
|
||||
export enum TextInputStyle {
|
||||
Short = 1,
|
||||
Paragraph,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#select-menus
|
||||
*/
|
||||
export interface APISelectMenuComponent extends APIBaseMessageComponent<ComponentType.SelectMenu> {
|
||||
export interface APISelectMenuComponent extends APIBaseComponent<ComponentType.SelectMenu> {
|
||||
/**
|
||||
* A developer-defined identifier for the select menu, max 100 characters
|
||||
*/
|
||||
@@ -1207,7 +1322,56 @@ export interface APISelectMenuOption {
|
||||
default?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-structure
|
||||
*/
|
||||
export interface APITextInputComponent extends APIBaseComponent<ComponentType.TextInput> {
|
||||
/**
|
||||
* One of text input styles
|
||||
*/
|
||||
style: TextInputStyle;
|
||||
/**
|
||||
* The custom id for the text input
|
||||
*/
|
||||
custom_id: string;
|
||||
/**
|
||||
* Text that appears on top of the text input field, max 80 characters
|
||||
*/
|
||||
label: string;
|
||||
/**
|
||||
* Placeholder for the text input
|
||||
*/
|
||||
placeholder?: string;
|
||||
/**
|
||||
* The pre-filled text in the text input
|
||||
*/
|
||||
value?: string;
|
||||
/**
|
||||
* Minimal length of text input
|
||||
*/
|
||||
min_length?: number;
|
||||
/**
|
||||
* Maximal length of text input
|
||||
*/
|
||||
max_length?: number;
|
||||
/**
|
||||
* Whether or not this text input is required or not
|
||||
*/
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#message-components
|
||||
*/
|
||||
export type APIMessageComponent = APIActionRowComponent | APIButtonComponent | APISelectMenuComponent;
|
||||
export type APIMessageComponent = APIMessageActionRowComponent | APIActionRowComponent<APIMessageActionRowComponent>;
|
||||
export type APIModalComponent = APIModalActionRowComponent | APIActionRowComponent<APIModalActionRowComponent>;
|
||||
|
||||
export type APIActionRowComponentTypes = APIMessageActionRowComponent | APIModalActionRowComponent;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#message-components
|
||||
*/
|
||||
export type APIMessageActionRowComponent = APIButtonComponent | APISelectMenuComponent;
|
||||
|
||||
// Modal components
|
||||
export type APIModalActionRowComponent = APITextInputComponent;
|
||||
|
||||
@@ -221,7 +221,7 @@ export enum ActivityType {
|
||||
/**
|
||||
* Playing {game}
|
||||
*/
|
||||
Game,
|
||||
Playing,
|
||||
/**
|
||||
* Streaming {details}
|
||||
*/
|
||||
|
||||
@@ -590,6 +590,10 @@ export interface APIGuildPreview {
|
||||
* The description for the guild
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* Custom guild stickers
|
||||
*/
|
||||
stickers: APISticker[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@ interface APIGuildScheduledEventBase<Type extends GuildScheduledEventEntityType>
|
||||
/**
|
||||
* The id of the user that created the scheduled event
|
||||
*/
|
||||
creator_id: Snowflake | null;
|
||||
creator_id?: Snowflake | null;
|
||||
/**
|
||||
* The name of the scheduled event
|
||||
*/
|
||||
@@ -63,6 +63,10 @@ interface APIGuildScheduledEventBase<Type extends GuildScheduledEventEntityType>
|
||||
* The number of users subscribed to the scheduled event
|
||||
*/
|
||||
user_count?: number;
|
||||
/**
|
||||
* The cover image of the scheduled event
|
||||
*/
|
||||
image: string | null;
|
||||
}
|
||||
|
||||
export interface APIStageInstanceGuildScheduledEvent
|
||||
|
||||
@@ -9,13 +9,24 @@ import type {
|
||||
APIApplicationCommandGuildInteraction,
|
||||
APIApplicationCommandInteraction,
|
||||
} from './_interactions/applicationCommands.ts';
|
||||
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete.ts';
|
||||
import type {
|
||||
APIApplicationCommandAutocompleteDMInteraction,
|
||||
APIApplicationCommandAutocompleteGuildInteraction,
|
||||
APIApplicationCommandAutocompleteInteraction,
|
||||
} from './_interactions/autocomplete.ts';
|
||||
import type {
|
||||
APIModalSubmitDMInteraction,
|
||||
APIModalSubmitGuildInteraction,
|
||||
APIModalSubmitInteraction,
|
||||
} from './_interactions/modalSubmit.ts';
|
||||
|
||||
export * from './_interactions/base.ts';
|
||||
export * from './_interactions/messageComponents.ts';
|
||||
export * from './_interactions/ping.ts';
|
||||
export * from './_interactions/responses.ts';
|
||||
export * from './_interactions/applicationCommands.ts';
|
||||
export * from './_interactions/modalSubmit.ts';
|
||||
export * from './_interactions/autocomplete.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
@@ -24,14 +35,23 @@ export type APIInteraction =
|
||||
| APIPingInteraction
|
||||
| APIApplicationCommandInteraction
|
||||
| APIMessageComponentInteraction
|
||||
| APIApplicationCommandAutocompleteInteraction;
|
||||
| APIApplicationCommandAutocompleteInteraction
|
||||
| APIModalSubmitInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
|
||||
export type APIDMInteraction =
|
||||
| APIApplicationCommandDMInteraction
|
||||
| APIMessageComponentDMInteraction
|
||||
| APIApplicationCommandAutocompleteDMInteraction
|
||||
| APIModalSubmitDMInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;
|
||||
export type APIGuildInteraction =
|
||||
| APIApplicationCommandGuildInteraction
|
||||
| APIMessageComponentGuildInteraction
|
||||
| APIApplicationCommandAutocompleteGuildInteraction
|
||||
| APIModalSubmitGuildInteraction;
|
||||
|
||||
@@ -85,10 +85,6 @@ export interface APIUser {
|
||||
* https://discord.com/developers/docs/resources/user#user-object-user-flags
|
||||
*/
|
||||
export enum UserFlags {
|
||||
/**
|
||||
* None
|
||||
*/
|
||||
None = 0,
|
||||
/**
|
||||
* Discord Employee
|
||||
*/
|
||||
@@ -145,6 +141,10 @@ export enum UserFlags {
|
||||
* Bot uses only [HTTP interactions](https://discord.com/developers/docs/interactions/receiving-and-responding#receiving-an-interaction) and is shown in the online member list
|
||||
*/
|
||||
BotHTTPInteractions = 1 << 19,
|
||||
/**
|
||||
* User has been identified as spammer
|
||||
*/
|
||||
Spammer = 1 << 20,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -107,11 +107,15 @@ export enum RESTJSONErrorCodes {
|
||||
MaximumNumberOfStickersReached = 30039,
|
||||
MaximumNumberOfPruneRequestsHasBeenReached,
|
||||
|
||||
MaximumNumberOfGuildWidgetSettingsUpdatesHasBeenReached = 30042,
|
||||
|
||||
MaxmimumNumberOfEditsToMessagesOlderThanOneHourReached = 30046,
|
||||
|
||||
Unauthorized = 40001,
|
||||
VerifyYourAccount,
|
||||
OpeningDirectMessagesTooFast,
|
||||
|
||||
RequestEntityTooLarge = 40005,
|
||||
SendMessagesHasBeenTemporarilyDisabled,
|
||||
RequestEntityTooLarge,
|
||||
FeatureTemporarilyDisabledServerSide,
|
||||
UserBannedFromThisGuild,
|
||||
|
||||
@@ -120,6 +124,8 @@ export enum RESTJSONErrorCodes {
|
||||
|
||||
ApplicationCommandWithThatNameAlreadyExists = 40041,
|
||||
|
||||
InteractionHasAlreadyBeenAcknowledged = 40060,
|
||||
|
||||
MissingAccess = 50001,
|
||||
InvalidAccountType,
|
||||
CannotExecuteActionOnDMChannel,
|
||||
@@ -161,6 +167,8 @@ export enum RESTJSONErrorCodes {
|
||||
CannotSelfRedeemThisGift = 50054,
|
||||
InvalidGuild,
|
||||
|
||||
InvalidMessageType = 50068,
|
||||
|
||||
PaymentSourceRequiredToRedeemGift = 50070,
|
||||
|
||||
CannotDeleteChannelRequiredForCommunityGuilds = 50074,
|
||||
@@ -170,6 +178,7 @@ export enum RESTJSONErrorCodes {
|
||||
InvalidActionOnArchivedThread = 50083,
|
||||
InvalidThreadNotificationSettings,
|
||||
ParameterEarlierThanCreation,
|
||||
CommunityServerChannelsMustBeTextChannels,
|
||||
|
||||
ServerNotAvailableInYourLocation = 50095,
|
||||
|
||||
@@ -208,3 +217,38 @@ export enum RESTJSONErrorCodes {
|
||||
|
||||
FailedToCreateStageNeededForStageEvent = 180002,
|
||||
}
|
||||
|
||||
export enum Locale {
|
||||
EnglishUS = 'en-US',
|
||||
EnglishGB = 'en-GB',
|
||||
Bulgarian = 'bg',
|
||||
ChineseCN = 'zh-CN',
|
||||
ChineseTW = 'zh-TW',
|
||||
Croatian = 'hr',
|
||||
Czech = 'cs',
|
||||
Danish = 'da',
|
||||
Dutch = 'nl',
|
||||
Finnish = 'fi',
|
||||
French = 'fr',
|
||||
German = 'de',
|
||||
Greek = 'el',
|
||||
Hindi = 'hi',
|
||||
Hungarian = 'hu',
|
||||
Italian = 'it',
|
||||
Japanese = 'ja',
|
||||
Korean = 'ko',
|
||||
Lithuanian = 'lt',
|
||||
Norwegian = 'no',
|
||||
Polish = 'pl',
|
||||
PortugueseBR = 'pt-BR',
|
||||
Romanian = 'ro',
|
||||
Russian = 'ru',
|
||||
SpanishES = 'es-ES',
|
||||
Swedish = 'sv-SE',
|
||||
Thai = 'th',
|
||||
Turkish = 'tr',
|
||||
Ukrainian = 'uk',
|
||||
Vietnamese = 'vi',
|
||||
}
|
||||
|
||||
export type LocaleString = `${Locale}`;
|
||||
|
||||
@@ -9,16 +9,20 @@ import type {
|
||||
APIFollowedChannel,
|
||||
APIMessage,
|
||||
APIMessageReference,
|
||||
APIOverwrite,
|
||||
APIUser,
|
||||
ChannelType,
|
||||
InviteTargetType,
|
||||
MessageFlags,
|
||||
OverwriteType,
|
||||
VideoQualityMode,
|
||||
APIMessageActionRowComponent,
|
||||
} from '../../payloads/v8/mod.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
|
||||
|
||||
export interface APIChannelPatchOverwrite extends RESTPutAPIChannelPermissionJSONBody {
|
||||
id: Snowflake;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#get-channel
|
||||
*/
|
||||
@@ -85,7 +89,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
*
|
||||
* Channel types: all
|
||||
*/
|
||||
permission_overwrites?: APIOverwrite[] | null;
|
||||
permission_overwrites?: APIChannelPatchOverwrite[] | null;
|
||||
/**
|
||||
* ID of the new parent category for a channel
|
||||
*
|
||||
@@ -210,7 +214,7 @@ export type RESTPostAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedP
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
components?: APIActionRowComponent<APIMessageActionRowComponent>[];
|
||||
/**
|
||||
* IDs of up to 3 stickers in the server to send in the message
|
||||
*
|
||||
@@ -221,6 +225,10 @@ export type RESTPostAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedP
|
||||
* Attachment objects with filename and description
|
||||
*/
|
||||
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[];
|
||||
/**
|
||||
* Message flags combined as a bitfield
|
||||
*/
|
||||
flags?: MessageFlags;
|
||||
}>;
|
||||
|
||||
/**
|
||||
@@ -340,7 +348,7 @@ export type RESTPatchAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefined
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[] | null;
|
||||
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
@@ -388,14 +396,18 @@ export interface RESTPutAPIChannelPermissionJSONBody {
|
||||
* The bitwise value of all allowed permissions
|
||||
*
|
||||
* See https://en.wikipedia.org/wiki/Bit_field
|
||||
*
|
||||
* @default "0"
|
||||
*/
|
||||
allow: Permissions;
|
||||
allow?: Permissions | null;
|
||||
/**
|
||||
* The bitwise value of all disallowed permissions
|
||||
*
|
||||
* See https://en.wikipedia.org/wiki/Bit_field
|
||||
*
|
||||
* @default "0"
|
||||
*/
|
||||
deny: Permissions;
|
||||
deny?: Permissions | null;
|
||||
/**
|
||||
* `0` for a role or `1` for a member
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,9 @@ import type { Permissions, Snowflake } from '../../globals.ts';
|
||||
import type {
|
||||
APIBan,
|
||||
APIChannel,
|
||||
APIDMChannel,
|
||||
APIExtendedInvite,
|
||||
APIGroupDMChannel,
|
||||
APIGuild,
|
||||
APIGuildIntegration,
|
||||
APIGuildMember,
|
||||
@@ -25,6 +27,7 @@ import type {
|
||||
Nullable,
|
||||
StrictPartial,
|
||||
StrictRequired,
|
||||
UnionToIntersection,
|
||||
} from '../../utils/internals.ts';
|
||||
import type { RESTPutAPIChannelPermissionJSONBody } from './channel.ts';
|
||||
|
||||
@@ -32,8 +35,12 @@ export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSON
|
||||
id: number | string;
|
||||
}
|
||||
|
||||
export type APIGuildChannelResolvable = Exclude<APIChannel, APIDMChannel | APIGroupDMChannel>;
|
||||
export type APIGuildCreatePartialChannel = StrictPartial<
|
||||
Pick<APIChannel, 'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'>
|
||||
Pick<
|
||||
UnionToIntersection<APIGuildChannelResolvable>,
|
||||
'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'
|
||||
>
|
||||
> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
name: string;
|
||||
@@ -435,6 +442,10 @@ export type RESTPatchAPIGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPro
|
||||
* Requires `MOVE_MEMBERS` permission
|
||||
*/
|
||||
channel_id?: Snowflake | null;
|
||||
/**
|
||||
* Timestamp of when the time out will be removed; until then, they cannot interact with the guild
|
||||
*/
|
||||
communication_disabled_until?: string | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
@@ -444,6 +455,8 @@ export type RESTPatchAPIGuildMemberResult = APIGuildMember;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-current-user-nick
|
||||
*
|
||||
* @deprecated Use [Modify Current Member](https://discord.com/developers/docs/resources/guild#modify-current-member) instead.
|
||||
*/
|
||||
export type RESTPatchAPICurrentGuildMemberNicknameJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
@@ -454,8 +467,22 @@ export type RESTPatchAPICurrentGuildMemberNicknameJSONBody = AddUndefinedToPossi
|
||||
nick?: string | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-current-member
|
||||
*/
|
||||
export type RESTPatchAPICurrentGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Value to set users nickname to
|
||||
*
|
||||
* Requires `CHANGE_NICKNAME` permission
|
||||
*/
|
||||
nick?: string | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-current-user-nick
|
||||
*
|
||||
* @deprecated Use [Modify Current Member](https://discord.com/developers/docs/resources/guild#modify-current-member) instead.
|
||||
*/
|
||||
export type RESTPatchAPICurrentGuildMemberNicknameResult =
|
||||
StrictRequired<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
|
||||
|
||||
@@ -60,6 +60,10 @@ export type RESTPostAPIGuildScheduledEventJSONBody = AddUndefinedToPossiblyUndef
|
||||
* The entity metadata of the scheduled event
|
||||
*/
|
||||
entity_metadata?: APIGuildScheduledEventEntityMetadata;
|
||||
/**
|
||||
* The cover image of the scheduled event
|
||||
*/
|
||||
image?: string | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
|
||||
@@ -233,10 +233,11 @@ export const Routes = {
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/members/{user.id}`
|
||||
* - PUT `/guilds/{guild.id}/members/{user.id}`
|
||||
* - PATCH `/guilds/{guild.id}/members/@me`
|
||||
* - PATCH `/guilds/{guild.id}/members/{user.id}`
|
||||
* - DELETE `/guilds/{guild.id}/members/{user.id}`
|
||||
*/
|
||||
guildMember(guildId: Snowflake, userId: Snowflake) {
|
||||
guildMember(guildId: Snowflake, userId: Snowflake | '@me' = '@me') {
|
||||
return `/guilds/${guildId}/members/${userId}` as const;
|
||||
},
|
||||
|
||||
@@ -259,6 +260,7 @@ export const Routes = {
|
||||
/**
|
||||
* Route for:
|
||||
* - PATCH `/guilds/{guild.id}/members/@me/nick`
|
||||
* @deprecated Use {@link Routes.guildMember} instead.
|
||||
*/
|
||||
guildCurrentMemberNickname(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/members/@me/nick` as const;
|
||||
@@ -782,6 +784,7 @@ export const RouteBases = {
|
||||
invite: 'https://discord.gg',
|
||||
template: 'https://discord.new',
|
||||
gift: 'https://discord.gift',
|
||||
scheduledEvent: 'https://discord.com/events',
|
||||
} as const;
|
||||
|
||||
// Freeze bases object
|
||||
|
||||
@@ -6,6 +6,8 @@ import type {
|
||||
APIMessage,
|
||||
APIWebhook,
|
||||
APIAttachment,
|
||||
MessageFlags,
|
||||
APIMessageActionRowComponent,
|
||||
} from '../../payloads/v8/mod.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, Nullable } from '../../utils/internals.ts';
|
||||
|
||||
@@ -134,11 +136,15 @@ export type RESTPostAPIWebhookWithTokenJSONBody = AddUndefinedToPossiblyUndefine
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
components?: APIActionRowComponent<APIMessageActionRowComponent>[];
|
||||
/**
|
||||
* Attachment objects with filename and description
|
||||
*/
|
||||
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[];
|
||||
/**
|
||||
* Message flags combined as a bitfield
|
||||
*/
|
||||
flags?: MessageFlags;
|
||||
}>;
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,6 @@ import type {
|
||||
APIFollowedChannel,
|
||||
APIMessage,
|
||||
APIMessageReference,
|
||||
APIOverwrite,
|
||||
APIThreadList,
|
||||
APIThreadMember,
|
||||
APIUser,
|
||||
@@ -19,9 +18,14 @@ import type {
|
||||
OverwriteType,
|
||||
ThreadAutoArchiveDuration,
|
||||
VideoQualityMode,
|
||||
APIMessageActionRowComponent,
|
||||
} from '../../payloads/v9/mod.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
|
||||
|
||||
export interface APIChannelPatchOverwrite extends RESTPutAPIChannelPermissionJSONBody {
|
||||
id: Snowflake;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#get-channel
|
||||
*/
|
||||
@@ -88,7 +92,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
|
||||
*
|
||||
* Channel types: all excluding newsThread, publicThread, privateThread
|
||||
*/
|
||||
permission_overwrites?: APIOverwrite[] | null;
|
||||
permission_overwrites?: APIChannelPatchOverwrite[] | null;
|
||||
/**
|
||||
* ID of the new parent category for a channel
|
||||
*
|
||||
@@ -243,7 +247,7 @@ export type RESTPostAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedP
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
components?: APIActionRowComponent<APIMessageActionRowComponent>[];
|
||||
/**
|
||||
* IDs of up to 3 stickers in the server to send in the message
|
||||
*
|
||||
@@ -254,6 +258,10 @@ export type RESTPostAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedP
|
||||
* Attachment objects with filename and description
|
||||
*/
|
||||
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[];
|
||||
/**
|
||||
* Message flags combined as a bitfield
|
||||
*/
|
||||
flags?: MessageFlags;
|
||||
}>;
|
||||
|
||||
/**
|
||||
@@ -373,7 +381,7 @@ export type RESTPatchAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefined
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[] | null;
|
||||
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
@@ -421,14 +429,18 @@ export interface RESTPutAPIChannelPermissionJSONBody {
|
||||
* The bitwise value of all allowed permissions
|
||||
*
|
||||
* See https://en.wikipedia.org/wiki/Bit_field
|
||||
*
|
||||
* @default "0"
|
||||
*/
|
||||
allow: Permissions;
|
||||
allow?: Permissions | null;
|
||||
/**
|
||||
* The bitwise value of all disallowed permissions
|
||||
*
|
||||
* See https://en.wikipedia.org/wiki/Bit_field
|
||||
*
|
||||
* @default "0"
|
||||
*/
|
||||
deny: Permissions;
|
||||
deny?: Permissions | null;
|
||||
/**
|
||||
* `0` for a role or `1` for a member
|
||||
*/
|
||||
|
||||
@@ -20,12 +20,15 @@ import type {
|
||||
GuildSystemChannelFlags,
|
||||
GuildVerificationLevel,
|
||||
GuildWidgetStyle,
|
||||
APIDMChannel,
|
||||
APIGroupDMChannel,
|
||||
} from '../../payloads/v9/mod.ts';
|
||||
import type {
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
|
||||
Nullable,
|
||||
StrictPartial,
|
||||
StrictRequired,
|
||||
UnionToIntersection,
|
||||
} from '../../utils/internals.ts';
|
||||
import type { RESTPutAPIChannelPermissionJSONBody } from './channel.ts';
|
||||
|
||||
@@ -33,8 +36,12 @@ export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSON
|
||||
id: number | string;
|
||||
}
|
||||
|
||||
export type APIGuildChannelResolvable = Exclude<APIChannel, APIDMChannel | APIGroupDMChannel>;
|
||||
export type APIGuildCreatePartialChannel = StrictPartial<
|
||||
Pick<APIChannel, 'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'>
|
||||
Pick<
|
||||
UnionToIntersection<APIGuildChannelResolvable>,
|
||||
'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'
|
||||
>
|
||||
> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
name: string;
|
||||
@@ -441,6 +448,10 @@ export type RESTPatchAPIGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPro
|
||||
* Requires `MOVE_MEMBERS` permission
|
||||
*/
|
||||
channel_id?: Snowflake | null;
|
||||
/**
|
||||
* Timestamp of when the time out will be removed; until then, they cannot interact with the guild
|
||||
*/
|
||||
communication_disabled_until?: string | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
@@ -450,6 +461,8 @@ export type RESTPatchAPIGuildMemberResult = APIGuildMember;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-current-user-nick
|
||||
*
|
||||
* @deprecated Use [Modify Current Member](https://discord.com/developers/docs/resources/guild#modify-current-member) instead.
|
||||
*/
|
||||
export type RESTPatchAPICurrentGuildMemberNicknameJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
@@ -460,8 +473,22 @@ export type RESTPatchAPICurrentGuildMemberNicknameJSONBody = AddUndefinedToPossi
|
||||
nick?: string | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-current-member
|
||||
*/
|
||||
export type RESTPatchAPICurrentGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Value to set users nickname to
|
||||
*
|
||||
* Requires `CHANGE_NICKNAME` permission
|
||||
*/
|
||||
nick?: string | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-current-user-nick
|
||||
*
|
||||
* @deprecated Use [Modify Current Member](https://discord.com/developers/docs/resources/guild#modify-current-member) instead.
|
||||
*/
|
||||
export type RESTPatchAPICurrentGuildMemberNicknameResult =
|
||||
StrictRequired<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
|
||||
|
||||
@@ -60,6 +60,10 @@ export type RESTPostAPIGuildScheduledEventJSONBody = AddUndefinedToPossiblyUndef
|
||||
* The entity metadata of the scheduled event
|
||||
*/
|
||||
entity_metadata?: APIGuildScheduledEventEntityMetadata;
|
||||
/**
|
||||
* The cover image of the scheduled event
|
||||
*/
|
||||
image?: string | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
|
||||
@@ -233,10 +233,11 @@ export const Routes = {
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/members/{user.id}`
|
||||
* - PUT `/guilds/{guild.id}/members/{user.id}`
|
||||
* - PATCH `/guilds/{guild.id}/members/@me`
|
||||
* - PATCH `/guilds/{guild.id}/members/{user.id}`
|
||||
* - DELETE `/guilds/{guild.id}/members/{user.id}`
|
||||
*/
|
||||
guildMember(guildId: Snowflake, userId: Snowflake) {
|
||||
guildMember(guildId: Snowflake, userId: Snowflake | '@me' = '@me') {
|
||||
return `/guilds/${guildId}/members/${userId}` as const;
|
||||
},
|
||||
|
||||
@@ -259,6 +260,7 @@ export const Routes = {
|
||||
/**
|
||||
* Route for:
|
||||
* - PATCH `/guilds/{guild.id}/members/@me/nick`
|
||||
* @deprecated Use {@link Routes.guildMember} instead.
|
||||
*/
|
||||
guildCurrentMemberNickname(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/members/@me/nick` as const;
|
||||
@@ -851,6 +853,7 @@ export const RouteBases = {
|
||||
invite: 'https://discord.gg',
|
||||
template: 'https://discord.new',
|
||||
gift: 'https://discord.gift',
|
||||
scheduledEvent: 'https://discord.com/events',
|
||||
} as const;
|
||||
|
||||
// Freeze bases object
|
||||
|
||||
@@ -6,9 +6,10 @@ import type {
|
||||
APIMessage,
|
||||
APIWebhook,
|
||||
APIAttachment,
|
||||
MessageFlags,
|
||||
APIMessageActionRowComponent,
|
||||
} from '../../payloads/v9/mod.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, Nullable } from '../../utils/internals.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#create-webhook
|
||||
*/
|
||||
@@ -134,11 +135,15 @@ export type RESTPostAPIWebhookWithTokenJSONBody = AddUndefinedToPossiblyUndefine
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
components?: APIActionRowComponent<APIMessageActionRowComponent>[];
|
||||
/**
|
||||
* Attachment objects with filename and description
|
||||
*/
|
||||
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[];
|
||||
/**
|
||||
* Message flags combined as a bitfield
|
||||
*/
|
||||
flags?: MessageFlags;
|
||||
}>;
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,3 +13,5 @@ export type AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Base> = {
|
||||
export type StrictPartial<Base> = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Partial<Base>>;
|
||||
|
||||
export type StrictRequired<Base> = Required<{ [K in keyof Base]: Exclude<Base[K], undefined> }>;
|
||||
|
||||
export type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never;
|
||||
|
||||
@@ -694,7 +694,6 @@ export interface GatewayIdentify {
|
||||
properties: GatewayIdentifyProperties;
|
||||
compress?: boolean;
|
||||
large_threshold?: number;
|
||||
// eslint-disable-next-line prettier/prettier
|
||||
shard?: [shard_id: number, shard_count: number];
|
||||
presence?: RawGatewayPresenceUpdate;
|
||||
guild_subscriptions?: boolean;
|
||||
|
||||
@@ -34,7 +34,7 @@ export const GatewayVersion = '8';
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes
|
||||
*/
|
||||
export const enum GatewayOpcodes {
|
||||
export enum GatewayOpcodes {
|
||||
/**
|
||||
* An event was dispatched
|
||||
*/
|
||||
@@ -85,7 +85,7 @@ export const enum GatewayOpcodes {
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes
|
||||
*/
|
||||
export const enum GatewayCloseCodes {
|
||||
export enum GatewayCloseCodes {
|
||||
/**
|
||||
* We're not sure what went wrong. Try reconnecting?
|
||||
*/
|
||||
@@ -168,7 +168,7 @@ export const enum GatewayCloseCodes {
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#list-of-intents
|
||||
*/
|
||||
export const enum GatewayIntentBits {
|
||||
export enum GatewayIntentBits {
|
||||
Guilds = 1 << 0,
|
||||
GuildMembers = 1 << 1,
|
||||
GuildBans = 1 << 2,
|
||||
@@ -190,7 +190,7 @@ export const enum GatewayIntentBits {
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
|
||||
*/
|
||||
export const enum GatewayDispatchEvents {
|
||||
export enum GatewayDispatchEvents {
|
||||
ChannelCreate = 'CHANNEL_CREATE',
|
||||
ChannelDelete = 'CHANNEL_DELETE',
|
||||
ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE',
|
||||
|
||||
@@ -27,6 +27,7 @@ import type {
|
||||
GatewayVoiceState,
|
||||
InviteTargetType,
|
||||
PresenceUpdateStatus,
|
||||
APIThreadChannel,
|
||||
} from '../payloads/v9/index';
|
||||
import type { Nullable } from '../utils/internals';
|
||||
|
||||
@@ -37,7 +38,7 @@ export const GatewayVersion = '9';
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes
|
||||
*/
|
||||
export const enum GatewayOpcodes {
|
||||
export enum GatewayOpcodes {
|
||||
/**
|
||||
* An event was dispatched
|
||||
*/
|
||||
@@ -88,7 +89,7 @@ export const enum GatewayOpcodes {
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes
|
||||
*/
|
||||
export const enum GatewayCloseCodes {
|
||||
export enum GatewayCloseCodes {
|
||||
/**
|
||||
* We're not sure what went wrong. Try reconnecting?
|
||||
*/
|
||||
@@ -171,7 +172,7 @@ export const enum GatewayCloseCodes {
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#list-of-intents
|
||||
*/
|
||||
export const enum GatewayIntentBits {
|
||||
export enum GatewayIntentBits {
|
||||
Guilds = 1 << 0,
|
||||
GuildMembers = 1 << 1,
|
||||
GuildBans = 1 << 2,
|
||||
@@ -193,7 +194,7 @@ export const enum GatewayIntentBits {
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
|
||||
*/
|
||||
export const enum GatewayDispatchEvents {
|
||||
export enum GatewayDispatchEvents {
|
||||
ChannelCreate = 'CHANNEL_CREATE',
|
||||
ChannelDelete = 'CHANNEL_DELETE',
|
||||
ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE',
|
||||
@@ -1280,7 +1281,12 @@ export type GatewayThreadCreateDispatch = GatewayChannelModifyDispatch;
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#thread-create
|
||||
*/
|
||||
export type GatewayThreadCreateDispatchData = GatewayChannelModifyDispatchData;
|
||||
export interface GatewayThreadCreateDispatchData extends APIThreadChannel {
|
||||
/**
|
||||
* Whether the thread is newly created or not.
|
||||
*/
|
||||
newly_created?: true;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#thread-update
|
||||
|
||||
4391
package-lock.json
generated
4391
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
76
package.json
76
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "discord-api-types",
|
||||
"version": "0.26.1",
|
||||
"version": "0.27.1",
|
||||
"description": "Discord API typings that are kept up to date for use in bot library creation.",
|
||||
"types": "./v9.d.ts",
|
||||
"exports": {
|
||||
@@ -73,6 +73,8 @@
|
||||
"build:ci": "tsc --noEmit --incremental false",
|
||||
"build:deno": "node ./scripts/deno.mjs",
|
||||
"build:node": "tsc && run-p esm:*",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
||||
"ci:pr": "run-s changelog lint build:deno",
|
||||
"clean:deno": "rimraf deno/",
|
||||
"clean:node": "rimraf {gateway,payloads,rest,rpc,voice,utils}/**/*.{js,mjs,d.ts,*map} {globals,v*}.{js,mjs,d.ts,*map}",
|
||||
"clean": "run-p clean:*",
|
||||
@@ -84,15 +86,14 @@
|
||||
"esm:utils": "gen-esm-wrapper ./utils/index.js ./utils/index.mjs",
|
||||
"esm:versions": "node ./scripts/versions.mjs",
|
||||
"esm:voice": "gen-esm-wrapper ./voice/index.js ./voice/index.mjs",
|
||||
"lint": "eslint --fix --ext mjs,ts {gateway,payloads,rest,rpc,voice,utils}/**/*.ts {globals,v*}.ts",
|
||||
"lint": "prettier --write . && eslint --fix --ext mjs,ts {gateway,payloads,rest,rpc,voice,utils}/**/*.ts {globals,v*}.ts scripts/**/*.{mjs,ts}",
|
||||
"postpublish": "run-s clean:node build:deno",
|
||||
"prepare": "is-ci || husky install",
|
||||
"prepublishOnly": "run-s clean test:lint build:node",
|
||||
"test:lint": "eslint --ext mjs,ts {gateway,payloads,rest,rpc,voice,utils}/**/*.ts {globals,v*}.ts",
|
||||
"test:lint": "prettier --check . && eslint --ext mjs,ts {gateway,payloads,rest,rpc,voice,utils}/**/*.ts {globals,v*}.ts scripts/**/*.{mjs,ts}",
|
||||
"pretest:types": "tsc",
|
||||
"test:types": "tsd",
|
||||
"posttest:types": "npm run clean:node",
|
||||
"version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"
|
||||
"posttest:types": "npm run clean:node"
|
||||
},
|
||||
"keywords": [
|
||||
"discord",
|
||||
@@ -106,62 +107,36 @@
|
||||
"{gateway,payloads,rest,rpc,voice,utils}/**/*.{js,js.map,d.ts,d.ts.map,mjs}",
|
||||
"{globals,v*}.{js,js.map,d.ts,d.ts.map,mjs}"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.16.5",
|
||||
"@babel/eslint-parser": "^7.16.5",
|
||||
"@babel/plugin-syntax-top-level-await": "^7.14.5",
|
||||
"@commitlint/cli": "^15.0.0",
|
||||
"@commitlint/config-angular": "^15.0.0",
|
||||
"@types/node": "^17.0.4",
|
||||
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
||||
"@typescript-eslint/parser": "^5.8.0",
|
||||
"conventional-changelog-cli": "^2.1.1",
|
||||
"eslint": "^8.5.0",
|
||||
"eslint-config-marine": "^9.1.0",
|
||||
"@commitlint/cli": "^16.1.0",
|
||||
"@commitlint/config-angular": "^16.0.0",
|
||||
"@favware/npm-deprecate": "^1.0.4",
|
||||
"@octokit/action": "^3.18.0",
|
||||
"@octokit/webhooks-types": "^5.4.0",
|
||||
"@types/conventional-recommended-bump": "^6.1.0",
|
||||
"@types/node": "^17.0.17",
|
||||
"@typescript-eslint/eslint-plugin": "^5.11.0",
|
||||
"@typescript-eslint/parser": "^5.11.0",
|
||||
"conventional-changelog-cli": "^2.2.2",
|
||||
"conventional-recommended-bump": "^6.1.0",
|
||||
"eslint": "^8.8.0",
|
||||
"eslint-config-marine": "^9.3.2",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"gen-esm-wrapper": "^1.1.3",
|
||||
"husky": "^7.0.4",
|
||||
"is-ci": "^3.0.1",
|
||||
"lint-staged": "^12.1.4",
|
||||
"lint-staged": "^12.3.3",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.5.1",
|
||||
"pretty-quick": "^3.1.3",
|
||||
"rimraf": "^3.0.2",
|
||||
"tsd": "^0.19.0",
|
||||
"typescript": "^4.5.4"
|
||||
"tsd": "^0.19.1",
|
||||
"typescript": "^4.5.5"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/discordjs/discord-api-types"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "marine/prettier/node",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.eslint.json",
|
||||
"extraFileExtensions": [
|
||||
".mjs"
|
||||
]
|
||||
},
|
||||
"rules": {
|
||||
"@typescript-eslint/naming-convention": 0
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"scripts/**/*.mjs"
|
||||
],
|
||||
"parser": "@babel/eslint-parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2021,
|
||||
"sourceType": "module"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"lint-staged": {
|
||||
"{gateway,payloads,rest,rpc,voice,utils}/**/*.{mjs,js,ts}": "eslint --fix --ext mjs,js,ts",
|
||||
"{globals,v*}.ts": "eslint --fix --ext mjs,js,ts"
|
||||
@@ -197,13 +172,6 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"standard-version": {
|
||||
"skip": {
|
||||
"changelog": true,
|
||||
"commit": true,
|
||||
"tag": true
|
||||
}
|
||||
},
|
||||
"tsd": {
|
||||
"directory": "tests"
|
||||
}
|
||||
|
||||
@@ -122,7 +122,6 @@ export type GatewayActivityEmoji = Partial<Pick<APIEmoji, 'name' | 'animated'>>
|
||||
*/
|
||||
export interface GatewayActivityParty {
|
||||
id?: string;
|
||||
// eslint-disable-next-line prettier/prettier
|
||||
size?: [currentSize: number, maxSize: number];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { Snowflake } from '../../../../../globals';
|
||||
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base';
|
||||
import type { ApplicationCommandOptionType } from './shared';
|
||||
|
||||
export type APIApplicationCommandAttachmentOption =
|
||||
APIApplicationCommandOptionBase<ApplicationCommandOptionType.Attachment>;
|
||||
|
||||
export type APIApplicationCommandInteractionDataAttachmentOption = APIInteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Attachment,
|
||||
Snowflake
|
||||
>;
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
|
||||
*/
|
||||
export const enum ApplicationCommandOptionType {
|
||||
export enum ApplicationCommandOptionType {
|
||||
Subcommand = 1,
|
||||
SubcommandGroup,
|
||||
String,
|
||||
@@ -12,6 +12,7 @@ export const enum ApplicationCommandOptionType {
|
||||
Role,
|
||||
Mentionable,
|
||||
Number,
|
||||
Attachment,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Snowflake } from '../../../../globals';
|
||||
import type { APIRole, APIUser } from '../../index';
|
||||
import type { APIAttachment, APIRole, APIUser } from '../../index';
|
||||
import type {
|
||||
APIApplicationCommandInteractionWrapper,
|
||||
APIInteractionDataResolvedChannel,
|
||||
@@ -41,6 +41,10 @@ import type {
|
||||
APIApplicationCommandNumberOption,
|
||||
APIApplicationCommandInteractionDataNumberOption,
|
||||
} from './_chatInput/number';
|
||||
import type {
|
||||
APIApplicationCommandAttachmentOption,
|
||||
APIApplicationCommandInteractionDataAttachmentOption,
|
||||
} from './_chatInput/attachment';
|
||||
import type {
|
||||
APIApplicationCommandSubcommandOption,
|
||||
APIApplicationCommandInteractionDataSubcommandOption,
|
||||
@@ -58,6 +62,7 @@ export * from './_chatInput/channel';
|
||||
export * from './_chatInput/role';
|
||||
export * from './_chatInput/mentionable';
|
||||
export * from './_chatInput/number';
|
||||
export * from './_chatInput/attachment';
|
||||
export * from './_chatInput/subcommand';
|
||||
export * from './_chatInput/subcommandGroup';
|
||||
export * from './_chatInput/shared';
|
||||
@@ -73,7 +78,8 @@ export type APIApplicationCommandBasicOption =
|
||||
| APIApplicationCommandChannelOption
|
||||
| APIApplicationCommandRoleOption
|
||||
| APIApplicationCommandMentionableOption
|
||||
| APIApplicationCommandNumberOption;
|
||||
| APIApplicationCommandNumberOption
|
||||
| APIApplicationCommandAttachmentOption;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||
@@ -99,7 +105,8 @@ export type APIApplicationCommandInteractionDataBasicOption =
|
||||
| APIApplicationCommandInteractionDataChannelOption
|
||||
| APIApplicationCommandInteractionDataRoleOption
|
||||
| APIApplicationCommandInteractionDataMentionableOption
|
||||
| APIApplicationCommandInteractionDataNumberOption;
|
||||
| APIApplicationCommandInteractionDataNumberOption
|
||||
| APIApplicationCommandInteractionDataAttachmentOption;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
|
||||
@@ -118,6 +125,7 @@ export interface APIChatInputApplicationCommandInteractionDataResolved {
|
||||
roles?: Record<Snowflake, APIRole>;
|
||||
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
|
||||
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
|
||||
attachments?: Record<Snowflake, APIAttachment>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,7 +43,7 @@ export interface APIApplicationCommandPermission {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type
|
||||
*/
|
||||
export const enum ApplicationCommandPermissionType {
|
||||
export enum ApplicationCommandPermissionType {
|
||||
Role = 1,
|
||||
User,
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ export interface APIApplicationCommand {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types
|
||||
*/
|
||||
export const enum ApplicationCommandType {
|
||||
export enum ApplicationCommandType {
|
||||
ChatInput = 1,
|
||||
User,
|
||||
Message,
|
||||
|
||||
@@ -1,6 +1,30 @@
|
||||
import type { APIBaseInteraction, APIChatInputApplicationCommandInteractionData, InteractionType } from '../index';
|
||||
import type {
|
||||
APIBaseInteraction,
|
||||
APIChatInputApplicationCommandInteractionData,
|
||||
APIDMInteractionWrapper,
|
||||
APIGuildInteractionWrapper,
|
||||
InteractionType,
|
||||
} from '../index';
|
||||
|
||||
export type APIApplicationCommandAutocompleteInteraction = APIBaseInteraction<
|
||||
InteractionType.ApplicationCommandAutocomplete,
|
||||
APIChatInputApplicationCommandInteractionData
|
||||
>;
|
||||
> &
|
||||
Required<
|
||||
Pick<
|
||||
APIBaseInteraction<InteractionType.ApplicationCommandAutocomplete, APIChatInputApplicationCommandInteractionData>,
|
||||
'data'
|
||||
>
|
||||
>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandAutocompleteDMInteraction =
|
||||
APIDMInteractionWrapper<APIApplicationCommandAutocompleteInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandAutocompleteGuildInteraction =
|
||||
APIGuildInteractionWrapper<APIApplicationCommandAutocompleteInteraction>;
|
||||
|
||||
@@ -3,6 +3,20 @@ import type { InteractionType } from './responses';
|
||||
import type { APIMessage } from '../channel';
|
||||
import type { APIGuildMember } from '../guild';
|
||||
import type { APIUser } from '../user';
|
||||
import type { LocaleString } from '../../../v8';
|
||||
|
||||
export type PartialAPIMessageInteractionGuildMember = Pick<
|
||||
APIGuildMember,
|
||||
| 'roles'
|
||||
| 'premium_since'
|
||||
| 'pending'
|
||||
| 'nick'
|
||||
| 'mute'
|
||||
| 'joined_at'
|
||||
| 'deaf'
|
||||
| 'communication_disabled_until'
|
||||
| 'avatar'
|
||||
>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object
|
||||
@@ -24,6 +38,10 @@ export interface APIMessageInteraction {
|
||||
* The user who invoked the interaction
|
||||
*/
|
||||
user: APIUser;
|
||||
/**
|
||||
* The guild member who invoked the interaction, only sent in MESSAGE_CREATE events
|
||||
*/
|
||||
member?: PartialAPIMessageInteractionGuildMember;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,6 +104,14 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
|
||||
* For components, the message they were attached to
|
||||
*/
|
||||
message?: APIMessage;
|
||||
/**
|
||||
* The selected language of the invoking user
|
||||
*/
|
||||
locale: LocaleString;
|
||||
/**
|
||||
* The guild's preferred locale, if invoked in a guild
|
||||
*/
|
||||
guild_locale?: LocaleString;
|
||||
}
|
||||
|
||||
export type APIDMInteractionWrapper<Original extends APIBaseInteraction<InteractionType, unknown>> = Omit<
|
||||
|
||||
46
payloads/v8/_interactions/modalSubmit.ts
Normal file
46
payloads/v8/_interactions/modalSubmit.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel';
|
||||
import type {
|
||||
APIBaseInteraction,
|
||||
InteractionType,
|
||||
ComponentType,
|
||||
APIDMInteractionWrapper,
|
||||
APIGuildInteractionWrapper,
|
||||
} from '../index';
|
||||
|
||||
export interface ModalSubmitComponent {
|
||||
type: ComponentType;
|
||||
custom_id: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface ModalSubmitActionRowComponent
|
||||
extends Omit<APIActionRowComponent<APIModalActionRowComponent>, 'components'> {
|
||||
components: ModalSubmitComponent[];
|
||||
}
|
||||
|
||||
export interface APIModalSubmission {
|
||||
/**
|
||||
* A developer-defined identifier for the component, max 100 characters
|
||||
*/
|
||||
custom_id: string;
|
||||
/**
|
||||
* A list of child components
|
||||
*/
|
||||
components?: ModalSubmitActionRowComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitInteraction = APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission> &
|
||||
Required<Pick<APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission>, 'data'>>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitDMInteraction = APIDMInteractionWrapper<APIModalSubmitInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitGuildInteraction = APIGuildInteractionWrapper<APIModalSubmitInteraction>;
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { APIBaseInteraction } from './base';
|
||||
import type { InteractionType } from './responses';
|
||||
|
||||
export type APIPingInteraction = APIBaseInteraction<InteractionType.Ping, never>;
|
||||
export type APIPingInteraction = Omit<APIBaseInteraction<InteractionType.Ping, never>, 'locale'>;
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
import type { MessageFlags } from '../index';
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8';
|
||||
import type { APIApplicationCommandOptionChoice } from './applicationCommands';
|
||||
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
|
||||
*/
|
||||
export const enum InteractionType {
|
||||
export enum InteractionType {
|
||||
Ping = 1,
|
||||
ApplicationCommand,
|
||||
MessageComponent,
|
||||
ApplicationCommandAutocomplete,
|
||||
ModalSubmit,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,6 +34,11 @@ export interface APIApplicationCommandAutocompleteResponse {
|
||||
data: APICommandAutocompleteInteractionResponseCallbackData;
|
||||
}
|
||||
|
||||
export interface APIModalInteractionResponse {
|
||||
type: InteractionResponseType.Modal;
|
||||
data: APIModalInteractionResponseCallbackData;
|
||||
}
|
||||
|
||||
export interface APIInteractionResponseChannelMessageWithSource {
|
||||
type: InteractionResponseType.ChannelMessageWithSource;
|
||||
data: APIInteractionResponseCallbackData;
|
||||
@@ -54,7 +61,7 @@ export interface APIInteractionResponseUpdateMessage {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
|
||||
*/
|
||||
export const enum InteractionResponseType {
|
||||
export enum InteractionResponseType {
|
||||
/**
|
||||
* ACK a `Ping`
|
||||
*/
|
||||
@@ -79,6 +86,10 @@ export const enum InteractionResponseType {
|
||||
* For autocomplete interactions
|
||||
*/
|
||||
ApplicationCommandAutocompleteResult,
|
||||
/**
|
||||
* Respond to an interaction with an modal for a user to fill-out
|
||||
*/
|
||||
Modal,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,3 +103,21 @@ export type APIInteractionResponseCallbackData = Omit<
|
||||
export interface APICommandAutocompleteInteractionResponseCallbackData {
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal
|
||||
*/
|
||||
export interface APIModalInteractionResponseCallbackData {
|
||||
/**
|
||||
* A developer-defined identifier for the component, max 100 characters
|
||||
*/
|
||||
custom_id: string;
|
||||
/**
|
||||
* The title of the popup modal
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* Between 1 and 5 (inclusive) components that make up the modal
|
||||
*/
|
||||
components: APIActionRowComponent<APIModalActionRowComponent>[];
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ export interface APIApplication {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
export const enum ApplicationFlags {
|
||||
export enum ApplicationFlags {
|
||||
EmbeddedReleased = 1 << 1,
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
|
||||
@@ -104,7 +104,7 @@ export interface APIAuditLogEntry {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events
|
||||
*/
|
||||
export const enum AuditLogEvent {
|
||||
export enum AuditLogEvent {
|
||||
GuildUpdate = 1,
|
||||
|
||||
ChannelCreate = 10,
|
||||
@@ -249,7 +249,7 @@ export interface APIAuditLogOptions {
|
||||
role_name?: string;
|
||||
}
|
||||
|
||||
export const enum AuditLogOptionsType {
|
||||
export enum AuditLogOptionsType {
|
||||
Role = '0',
|
||||
Member = '1',
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
*/
|
||||
|
||||
import type { Permissions, Snowflake } from '../../globals';
|
||||
import type { APIApplication } from './application';
|
||||
import type { APIPartialEmoji } from './emoji';
|
||||
import type { APIGuildMember } from './guild';
|
||||
import type { APIMessageInteraction } from './interactions';
|
||||
import type { APIApplication } from './application';
|
||||
import type { APIRole } from './permissions';
|
||||
import type { APISticker, APIStickerItem } from './sticker';
|
||||
import type { APIUser } from './user';
|
||||
@@ -32,17 +32,37 @@ export interface APIPartialChannel {
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
|
||||
* This interface is used to allow easy extension for other channel types. While
|
||||
* also allowing `APIPartialChannel` to be used without breaking.
|
||||
*/
|
||||
export interface APIChannel extends APIPartialChannel {
|
||||
export interface APIChannelBase<T extends ChannelType> extends APIPartialChannel {
|
||||
type: T;
|
||||
}
|
||||
|
||||
// TODO: update when text in voice is released
|
||||
export type TextChannelType = ChannelType.DM | ChannelType.GroupDM | ChannelType.GuildNews | ChannelType.GuildText;
|
||||
|
||||
export type GuildChannelType = Exclude<
|
||||
| TextChannelType
|
||||
| ChannelType.GuildVoice
|
||||
| ChannelType.GuildStageVoice
|
||||
| ChannelType.GuildNews
|
||||
| ChannelType.GuildStore,
|
||||
ChannelType.DM | ChannelType.GroupDM
|
||||
>;
|
||||
|
||||
export interface APITextBasedChannel<T extends ChannelType> extends APIChannelBase<T> {
|
||||
/**
|
||||
* The id of the last message sent in this channel (may not point to an existing or valid message)
|
||||
*/
|
||||
last_message_id?: Snowflake | null;
|
||||
}
|
||||
|
||||
export interface APIGuildChannel<T extends ChannelType> extends APIChannelBase<T> {
|
||||
/**
|
||||
* The id of the guild (may be missing for some channel objects received over gateway guild dispatches)
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
position?: number;
|
||||
/**
|
||||
* Explicit permission overwrites for members and roles
|
||||
*
|
||||
@@ -50,17 +70,48 @@ export interface APIChannel extends APIPartialChannel {
|
||||
*/
|
||||
permission_overwrites?: APIOverwrite[];
|
||||
/**
|
||||
* The channel topic (0-1024 characters)
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
topic?: string | null;
|
||||
position?: number;
|
||||
/**
|
||||
* ID of the parent category for a channel (each parent category can contain up to 50 channels)
|
||||
*/
|
||||
parent_id?: Snowflake | null;
|
||||
/**
|
||||
* Whether the channel is nsfw
|
||||
*/
|
||||
nsfw?: boolean;
|
||||
}
|
||||
|
||||
export type GuildTextChannelType = Exclude<TextChannelType, ChannelType.DM | ChannelType.GroupDM>;
|
||||
|
||||
export interface APIGuildTextChannel<T extends GuildTextChannelType>
|
||||
extends APITextBasedChannel<T>,
|
||||
APIGuildChannel<T> {
|
||||
/**
|
||||
* The id of the last message sent in this channel (may not point to an existing or valid message)
|
||||
* The channel topic (0-1024 characters)
|
||||
*/
|
||||
last_message_id?: Snowflake | null;
|
||||
topic?: string | null;
|
||||
/**
|
||||
* When the last pinned message was pinned.
|
||||
* This may be `null` in events such as `GUILD_CREATE` when a message is not pinned
|
||||
*/
|
||||
last_pin_timestamp?: string | null;
|
||||
}
|
||||
|
||||
export interface APITextChannel extends APIGuildTextChannel<ChannelType.GuildText> {
|
||||
/**
|
||||
* 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?: number;
|
||||
}
|
||||
|
||||
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildNews>;
|
||||
export type APIGuildCategoryChannel = APIGuildChannel<ChannelType.GuildCategory>;
|
||||
export type APIGuildStoreChannel = APIGuildChannel<ChannelType.GuildStore>;
|
||||
|
||||
export interface APIVoiceChannel extends APIGuildChannel<ChannelType.GuildStageVoice | ChannelType.GuildVoice> {
|
||||
/**
|
||||
* The bitrate (in bits) of the voice channel
|
||||
*/
|
||||
@@ -69,38 +120,6 @@ export interface APIChannel extends APIPartialChannel {
|
||||
* The user limit of the voice channel
|
||||
*/
|
||||
user_limit?: number;
|
||||
/**
|
||||
* 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?: number;
|
||||
/**
|
||||
* The recipients of the DM
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
recipients?: APIUser[];
|
||||
/**
|
||||
* Icon hash
|
||||
*/
|
||||
icon?: string | null;
|
||||
/**
|
||||
* ID of the DM creator
|
||||
*/
|
||||
owner_id?: Snowflake;
|
||||
/**
|
||||
* Application id of the group DM creator if it is bot-created
|
||||
*/
|
||||
application_id?: Snowflake;
|
||||
/**
|
||||
* ID of the parent category for a channel (each parent category can contain up to 50 channels)
|
||||
*/
|
||||
parent_id?: Snowflake | null;
|
||||
/**
|
||||
* When the last pinned message was pinned.
|
||||
* This may be `null` in events such as `GUILD_CREATE` when a message is not pinned
|
||||
*/
|
||||
last_pin_timestamp?: string | null;
|
||||
/**
|
||||
* Voice region id for the voice or stage channel, automatic when set to `null`
|
||||
*
|
||||
@@ -115,10 +134,53 @@ export interface APIChannel extends APIPartialChannel {
|
||||
video_quality_mode?: VideoQualityMode;
|
||||
}
|
||||
|
||||
interface APIDMChannelBase<T extends ChannelType> extends APITextBasedChannel<T> {
|
||||
/**
|
||||
* The recipients of the DM
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
recipients?: APIUser[];
|
||||
}
|
||||
|
||||
export type APIDMChannel = APIDMChannelBase<ChannelType.DM>;
|
||||
|
||||
export interface APIGroupDMChannel extends APIDMChannelBase<ChannelType.GroupDM> {
|
||||
/**
|
||||
* Application id of the group DM creator if it is bot-created
|
||||
*/
|
||||
application_id?: Snowflake;
|
||||
/**
|
||||
* Icon hash
|
||||
*/
|
||||
icon?: string | null;
|
||||
/**
|
||||
* ID of the DM creator
|
||||
*/
|
||||
owner_id?: Snowflake;
|
||||
/**
|
||||
* The id of the last message sent in this channel (may not point to an existing or valid message)
|
||||
*/
|
||||
last_message_id?: Snowflake | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
|
||||
*/
|
||||
export type APIChannel =
|
||||
| APIGroupDMChannel
|
||||
| APIDMChannel
|
||||
| APITextChannel
|
||||
| APINewsChannel
|
||||
| APIGuildStoreChannel
|
||||
| APIVoiceChannel
|
||||
| APIGuildCategoryChannel
|
||||
| APINewsChannel;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#channel-object-channel-types
|
||||
*/
|
||||
export const enum ChannelType {
|
||||
export enum ChannelType {
|
||||
/**
|
||||
* A text channel within a guild
|
||||
*/
|
||||
@@ -161,7 +223,7 @@ export const enum ChannelType {
|
||||
GuildStageVoice = 13,
|
||||
}
|
||||
|
||||
export const enum VideoQualityMode {
|
||||
export enum VideoQualityMode {
|
||||
/**
|
||||
* Discord chooses the quality for optimal performance
|
||||
*/
|
||||
@@ -344,7 +406,7 @@ export interface APIMessage {
|
||||
/**
|
||||
* Sent if the message contains components like buttons, action rows, or other interactive components
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
components?: APIActionRowComponent<APIMessageActionRowComponent>[];
|
||||
/**
|
||||
* Sent if the message contains stickers
|
||||
*
|
||||
@@ -363,7 +425,7 @@ export interface APIMessage {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#message-object-message-types
|
||||
*/
|
||||
export const enum MessageType {
|
||||
export enum MessageType {
|
||||
Default,
|
||||
RecipientAdd,
|
||||
RecipientRemove,
|
||||
@@ -426,7 +488,7 @@ export interface APIMessageReference {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#message-object-message-activity-types
|
||||
*/
|
||||
export const enum MessageActivityType {
|
||||
export enum MessageActivityType {
|
||||
Join = 1,
|
||||
Spectate,
|
||||
Listen,
|
||||
@@ -436,7 +498,7 @@ export const enum MessageActivityType {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#message-object-message-flags
|
||||
*/
|
||||
export const enum MessageFlags {
|
||||
export enum MessageFlags {
|
||||
/**
|
||||
* This message has been published to subscribed channels (via Channel Following)
|
||||
*/
|
||||
@@ -533,7 +595,7 @@ export interface APIOverwrite {
|
||||
deny: Permissions;
|
||||
}
|
||||
|
||||
export const enum OverwriteType {
|
||||
export enum OverwriteType {
|
||||
Role,
|
||||
Member,
|
||||
}
|
||||
@@ -626,7 +688,7 @@ export interface APIEmbed {
|
||||
* https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
*/
|
||||
export const enum EmbedType {
|
||||
export enum EmbedType {
|
||||
/**
|
||||
* Generic embed rendered from embed attributes
|
||||
*/
|
||||
@@ -870,7 +932,7 @@ export interface APIChannelMention {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types
|
||||
*/
|
||||
export const enum AllowedMentionsTypes {
|
||||
export enum AllowedMentionsTypes {
|
||||
/**
|
||||
* Controls @everyone and @here mentions
|
||||
*/
|
||||
@@ -914,7 +976,7 @@ export interface APIAllowedMentions {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
export interface APIBaseMessageComponent<T extends ComponentType> {
|
||||
export interface APIBaseComponent<T extends ComponentType> {
|
||||
/**
|
||||
* The type of the component
|
||||
*/
|
||||
@@ -924,7 +986,7 @@ export interface APIBaseMessageComponent<T extends ComponentType> {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#component-types
|
||||
*/
|
||||
export const enum ComponentType {
|
||||
export enum ComponentType {
|
||||
/**
|
||||
* Action Row component
|
||||
*/
|
||||
@@ -937,22 +999,27 @@ export const enum ComponentType {
|
||||
* Select Menu component
|
||||
*/
|
||||
SelectMenu,
|
||||
/**
|
||||
* Text Input component
|
||||
*/
|
||||
TextInput,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#action-rows
|
||||
*/
|
||||
export interface APIActionRowComponent extends APIBaseMessageComponent<ComponentType.ActionRow> {
|
||||
export interface APIActionRowComponent<T extends APIActionRowComponentTypes>
|
||||
extends APIBaseComponent<ComponentType.ActionRow> {
|
||||
/**
|
||||
* The components in the ActionRow
|
||||
*/
|
||||
components: Exclude<APIMessageComponent, APIActionRowComponent>[];
|
||||
components: T[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#buttons
|
||||
*/
|
||||
interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseMessageComponent<ComponentType.Button> {
|
||||
interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseComponent<ComponentType.Button> {
|
||||
/**
|
||||
* The label to be displayed on the button
|
||||
*/
|
||||
@@ -1008,7 +1075,7 @@ export type APIButtonComponent = APIButtonComponentWithCustomId | APIButtonCompo
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#button-object-button-styles
|
||||
*/
|
||||
export const enum ButtonStyle {
|
||||
export enum ButtonStyle {
|
||||
Primary = 1,
|
||||
Secondary,
|
||||
Success,
|
||||
@@ -1016,10 +1083,18 @@ export const enum ButtonStyle {
|
||||
Link,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-styles
|
||||
*/
|
||||
export enum TextInputStyle {
|
||||
Short = 1,
|
||||
Paragraph,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#select-menus
|
||||
*/
|
||||
export interface APISelectMenuComponent extends APIBaseMessageComponent<ComponentType.SelectMenu> {
|
||||
export interface APISelectMenuComponent extends APIBaseComponent<ComponentType.SelectMenu> {
|
||||
/**
|
||||
* A developer-defined identifier for the select menu, max 100 characters
|
||||
*/
|
||||
@@ -1078,7 +1153,56 @@ export interface APISelectMenuOption {
|
||||
default?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-structure
|
||||
*/
|
||||
export interface APITextInputComponent extends APIBaseComponent<ComponentType.TextInput> {
|
||||
/**
|
||||
* One of text input styles
|
||||
*/
|
||||
style: TextInputStyle;
|
||||
/**
|
||||
* The custom id for the text input
|
||||
*/
|
||||
custom_id: string;
|
||||
/**
|
||||
* Text that appears on top of the text input field, max 80 characters
|
||||
*/
|
||||
label: string;
|
||||
/**
|
||||
* Placeholder for the text input
|
||||
*/
|
||||
placeholder?: string;
|
||||
/**
|
||||
* The pre-filled text in the text input
|
||||
*/
|
||||
value?: string;
|
||||
/**
|
||||
* Minimal length of text input
|
||||
*/
|
||||
min_length?: number;
|
||||
/**
|
||||
* Maximal length of text input
|
||||
*/
|
||||
max_length?: number;
|
||||
/**
|
||||
* Whether or not this text input is required or not
|
||||
*/
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#message-components
|
||||
*/
|
||||
export type APIMessageComponent = APIActionRowComponent | APIButtonComponent | APISelectMenuComponent;
|
||||
export type APIMessageComponent = APIMessageActionRowComponent | APIActionRowComponent<APIMessageActionRowComponent>;
|
||||
export type APIModalComponent = APIModalActionRowComponent | APIActionRowComponent<APIModalActionRowComponent>;
|
||||
|
||||
export type APIActionRowComponentTypes = APIMessageActionRowComponent | APIModalActionRowComponent;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/message-components#message-components
|
||||
*/
|
||||
export type APIMessageActionRowComponent = APIButtonComponent | APISelectMenuComponent;
|
||||
|
||||
// Modal components
|
||||
export type APIModalActionRowComponent = APITextInputComponent;
|
||||
|
||||
@@ -91,7 +91,7 @@ export interface GatewayPresenceUpdate {
|
||||
client_status?: GatewayPresenceClientStatus;
|
||||
}
|
||||
|
||||
export const enum PresenceUpdateStatus {
|
||||
export enum PresenceUpdateStatus {
|
||||
Online = 'online',
|
||||
DoNotDisturb = 'dnd',
|
||||
Idle = 'idle',
|
||||
@@ -216,11 +216,11 @@ export enum ActivityPlatform {
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-types
|
||||
*/
|
||||
export const enum ActivityType {
|
||||
export enum ActivityType {
|
||||
/**
|
||||
* Playing {game}
|
||||
*/
|
||||
Game,
|
||||
Playing,
|
||||
/**
|
||||
* Streaming {details}
|
||||
*/
|
||||
@@ -291,7 +291,7 @@ export type GatewayActivitySecrets = Partial<Record<'join' | 'spectate' | 'match
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-flags
|
||||
*/
|
||||
export const enum ActivityFlags {
|
||||
export enum ActivityFlags {
|
||||
Instance = 1 << 0,
|
||||
Join = 1 << 1,
|
||||
Spectate = 1 << 2,
|
||||
|
||||
@@ -343,7 +343,7 @@ export interface APIGuild extends APIPartialGuild {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
|
||||
*/
|
||||
export const enum GuildDefaultMessageNotifications {
|
||||
export enum GuildDefaultMessageNotifications {
|
||||
AllMessages,
|
||||
OnlyMentions,
|
||||
}
|
||||
@@ -351,7 +351,7 @@ export const enum GuildDefaultMessageNotifications {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
|
||||
*/
|
||||
export const enum GuildExplicitContentFilter {
|
||||
export enum GuildExplicitContentFilter {
|
||||
Disabled,
|
||||
MembersWithoutRoles,
|
||||
AllMembers,
|
||||
@@ -360,7 +360,7 @@ export const enum GuildExplicitContentFilter {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
|
||||
*/
|
||||
export const enum GuildMFALevel {
|
||||
export enum GuildMFALevel {
|
||||
None,
|
||||
Elevated,
|
||||
}
|
||||
@@ -368,7 +368,7 @@ export const enum GuildMFALevel {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#guild-object-guild-nsfw-level
|
||||
*/
|
||||
export const enum GuildNSFWLevel {
|
||||
export enum GuildNSFWLevel {
|
||||
Default,
|
||||
Explicit,
|
||||
Safe,
|
||||
@@ -378,7 +378,7 @@ export const enum GuildNSFWLevel {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#guild-object-verification-level
|
||||
*/
|
||||
export const enum GuildVerificationLevel {
|
||||
export enum GuildVerificationLevel {
|
||||
/**
|
||||
* Unrestricted
|
||||
*/
|
||||
@@ -404,7 +404,7 @@ export const enum GuildVerificationLevel {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#guild-object-premium-tier
|
||||
*/
|
||||
export const enum GuildPremiumTier {
|
||||
export enum GuildPremiumTier {
|
||||
None,
|
||||
Tier1,
|
||||
Tier2,
|
||||
@@ -414,7 +414,7 @@ export const enum GuildPremiumTier {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags
|
||||
*/
|
||||
export const enum GuildSystemChannelFlags {
|
||||
export enum GuildSystemChannelFlags {
|
||||
/**
|
||||
* Suppress member join notifications
|
||||
*/
|
||||
@@ -436,7 +436,7 @@ export const enum GuildSystemChannelFlags {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#guild-object-guild-features
|
||||
*/
|
||||
export const enum GuildFeature {
|
||||
export enum GuildFeature {
|
||||
/**
|
||||
* Guild has access to set an animated guild icon
|
||||
*/
|
||||
@@ -582,6 +582,10 @@ export interface APIGuildPreview {
|
||||
* The description for the guild
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* Custom guild stickers
|
||||
*/
|
||||
stickers: APISticker[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -753,7 +757,7 @@ export type APIGuildInteractionType = 'twitch' | 'youtube' | 'discord';
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors
|
||||
*/
|
||||
export const enum IntegrationExpireBehavior {
|
||||
export enum IntegrationExpireBehavior {
|
||||
RemoveRole,
|
||||
Kick,
|
||||
}
|
||||
@@ -857,7 +861,7 @@ export interface APIGuildWidgetMember {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#get-guild-widget-image-widget-style-options
|
||||
*/
|
||||
export const enum GuildWidgetStyle {
|
||||
export enum GuildWidgetStyle {
|
||||
/**
|
||||
* Shield style widget with Discord icon and guild members online count
|
||||
*/
|
||||
@@ -947,7 +951,7 @@ export interface APIGuildMembershipScreeningField {
|
||||
required: boolean;
|
||||
}
|
||||
|
||||
export const enum MembershipScreeningFieldType {
|
||||
export enum MembershipScreeningFieldType {
|
||||
/**
|
||||
* Server Rules
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,7 @@ interface APIGuildScheduledEventBase<Type extends GuildScheduledEventEntityType>
|
||||
/**
|
||||
* The id of the user that created the scheduled event
|
||||
*/
|
||||
creator_id: Snowflake | null;
|
||||
creator_id?: Snowflake | null;
|
||||
/**
|
||||
* The name of the scheduled event
|
||||
*/
|
||||
@@ -63,6 +63,10 @@ interface APIGuildScheduledEventBase<Type extends GuildScheduledEventEntityType>
|
||||
* The number of users subscribed to the scheduled event
|
||||
*/
|
||||
user_count?: number;
|
||||
/**
|
||||
* The cover image of the scheduled event
|
||||
*/
|
||||
image: string | null;
|
||||
}
|
||||
|
||||
export interface APIStageInstanceGuildScheduledEvent
|
||||
@@ -103,7 +107,7 @@ export interface APIGuildScheduledEventEntityMetadata {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types
|
||||
*/
|
||||
export const enum GuildScheduledEventEntityType {
|
||||
export enum GuildScheduledEventEntityType {
|
||||
StageInstance = 1,
|
||||
Voice,
|
||||
External,
|
||||
@@ -112,7 +116,7 @@ export const enum GuildScheduledEventEntityType {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status
|
||||
*/
|
||||
export const enum GuildScheduledEventStatus {
|
||||
export enum GuildScheduledEventStatus {
|
||||
Scheduled = 1,
|
||||
Active,
|
||||
Completed,
|
||||
@@ -122,7 +126,7 @@ export const enum GuildScheduledEventStatus {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level
|
||||
*/
|
||||
export const enum GuildScheduledEventPrivacyLevel {
|
||||
export enum GuildScheduledEventPrivacyLevel {
|
||||
/**
|
||||
* The scheduled event is only accessible to guild members
|
||||
*/
|
||||
|
||||
@@ -9,13 +9,24 @@ import type {
|
||||
APIApplicationCommandGuildInteraction,
|
||||
APIApplicationCommandInteraction,
|
||||
} from './_interactions/applicationCommands';
|
||||
import type { APIApplicationCommandAutocompleteInteraction } from './_interactions/autocomplete';
|
||||
import type {
|
||||
APIApplicationCommandAutocompleteDMInteraction,
|
||||
APIApplicationCommandAutocompleteGuildInteraction,
|
||||
APIApplicationCommandAutocompleteInteraction,
|
||||
} from './_interactions/autocomplete';
|
||||
import type {
|
||||
APIModalSubmitDMInteraction,
|
||||
APIModalSubmitGuildInteraction,
|
||||
APIModalSubmitInteraction,
|
||||
} from './_interactions/modalSubmit';
|
||||
|
||||
export * from './_interactions/base';
|
||||
export * from './_interactions/messageComponents';
|
||||
export * from './_interactions/ping';
|
||||
export * from './_interactions/responses';
|
||||
export * from './_interactions/applicationCommands';
|
||||
export * from './_interactions/modalSubmit';
|
||||
export * from './_interactions/autocomplete';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
@@ -24,14 +35,23 @@ export type APIInteraction =
|
||||
| APIPingInteraction
|
||||
| APIApplicationCommandInteraction
|
||||
| APIMessageComponentInteraction
|
||||
| APIApplicationCommandAutocompleteInteraction;
|
||||
| APIApplicationCommandAutocompleteInteraction
|
||||
| APIModalSubmitInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;
|
||||
export type APIDMInteraction =
|
||||
| APIApplicationCommandDMInteraction
|
||||
| APIMessageComponentDMInteraction
|
||||
| APIApplicationCommandAutocompleteDMInteraction
|
||||
| APIModalSubmitDMInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIGuildInteraction = APIApplicationCommandGuildInteraction | APIMessageComponentGuildInteraction;
|
||||
export type APIGuildInteraction =
|
||||
| APIApplicationCommandGuildInteraction
|
||||
| APIMessageComponentGuildInteraction
|
||||
| APIApplicationCommandAutocompleteGuildInteraction
|
||||
| APIModalSubmitGuildInteraction;
|
||||
|
||||
@@ -78,7 +78,7 @@ export interface APIInvite {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/invite#invite-object-invite-target-types
|
||||
*/
|
||||
export const enum InviteTargetType {
|
||||
export enum InviteTargetType {
|
||||
Stream = 1,
|
||||
EmbeddedApplication,
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Types extracted from https://discord.com/developers/docs/topics/oauth2
|
||||
*/
|
||||
|
||||
export const enum OAuth2Scopes {
|
||||
export enum OAuth2Scopes {
|
||||
/**
|
||||
* For oauth2 bots, this puts the bot in the user's selected guild by default
|
||||
*/
|
||||
|
||||
@@ -36,7 +36,7 @@ export interface APIStageInstance {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level
|
||||
*/
|
||||
export const enum StageInstancePrivacyLevel {
|
||||
export enum StageInstancePrivacyLevel {
|
||||
/**
|
||||
* The stage instance is visible publicly, such as on stage discovery
|
||||
*/
|
||||
|
||||
@@ -67,7 +67,7 @@ export interface APISticker {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
|
||||
*/
|
||||
export const enum StickerType {
|
||||
export enum StickerType {
|
||||
/**
|
||||
* An official sticker in a pack, part of Nitro or in a removed purchasable pack
|
||||
*/
|
||||
@@ -81,7 +81,7 @@ export const enum StickerType {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types
|
||||
*/
|
||||
export const enum StickerFormatType {
|
||||
export enum StickerFormatType {
|
||||
PNG = 1,
|
||||
APNG,
|
||||
Lottie,
|
||||
|
||||
@@ -60,7 +60,7 @@ export interface APITeamMember {
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum
|
||||
*/
|
||||
export const enum TeamMemberMembershipState {
|
||||
export enum TeamMemberMembershipState {
|
||||
Invited = 1,
|
||||
Accepted,
|
||||
}
|
||||
|
||||
@@ -84,11 +84,7 @@ export interface APIUser {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/user#user-object-user-flags
|
||||
*/
|
||||
export const enum UserFlags {
|
||||
/**
|
||||
* None
|
||||
*/
|
||||
None = 0,
|
||||
export enum UserFlags {
|
||||
/**
|
||||
* Discord Employee
|
||||
*/
|
||||
@@ -145,12 +141,16 @@ export const enum UserFlags {
|
||||
* Bot uses only [HTTP interactions](https://discord.com/developers/docs/interactions/receiving-and-responding#receiving-an-interaction) and is shown in the online member list
|
||||
*/
|
||||
BotHTTPInteractions = 1 << 19,
|
||||
/**
|
||||
* User has been identified as spammer
|
||||
*/
|
||||
Spammer = 1 << 20,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/user#user-object-premium-types
|
||||
*/
|
||||
export const enum UserPremiumType {
|
||||
export enum UserPremiumType {
|
||||
None,
|
||||
NitroClassic,
|
||||
Nitro,
|
||||
@@ -202,7 +202,7 @@ export interface APIConnection {
|
||||
visibility: ConnectionVisibility;
|
||||
}
|
||||
|
||||
export const enum ConnectionVisibility {
|
||||
export enum ConnectionVisibility {
|
||||
/**
|
||||
* Invisible to everyone except the user themselves
|
||||
*/
|
||||
|
||||
@@ -63,7 +63,7 @@ export interface APIWebhook {
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export const enum WebhookType {
|
||||
export enum WebhookType {
|
||||
/**
|
||||
* Incoming Webhooks can post messages to channels with a generated token
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { Snowflake } from '../../../../../globals';
|
||||
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base';
|
||||
import type { ApplicationCommandOptionType } from './shared';
|
||||
|
||||
export type APIApplicationCommandAttachmentOption =
|
||||
APIApplicationCommandOptionBase<ApplicationCommandOptionType.Attachment>;
|
||||
|
||||
export type APIApplicationCommandInteractionDataAttachmentOption = APIInteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Attachment,
|
||||
Snowflake
|
||||
>;
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
|
||||
*/
|
||||
export const enum ApplicationCommandOptionType {
|
||||
export enum ApplicationCommandOptionType {
|
||||
Subcommand = 1,
|
||||
SubcommandGroup,
|
||||
String,
|
||||
@@ -12,6 +12,7 @@ export const enum ApplicationCommandOptionType {
|
||||
Role,
|
||||
Mentionable,
|
||||
Number,
|
||||
Attachment,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Snowflake } from '../../../../globals';
|
||||
import type { APIRole, APIUser } from '../../index';
|
||||
import type { APIAttachment, APIRole, APIUser } from '../../index';
|
||||
import type {
|
||||
APIApplicationCommandInteractionWrapper,
|
||||
APIInteractionDataResolvedChannel,
|
||||
@@ -41,6 +41,10 @@ import type {
|
||||
APIApplicationCommandNumberOption,
|
||||
APIApplicationCommandInteractionDataNumberOption,
|
||||
} from './_chatInput/number';
|
||||
import type {
|
||||
APIApplicationCommandAttachmentOption,
|
||||
APIApplicationCommandInteractionDataAttachmentOption,
|
||||
} from './_chatInput/attachment';
|
||||
import type {
|
||||
APIApplicationCommandSubcommandOption,
|
||||
APIApplicationCommandInteractionDataSubcommandOption,
|
||||
@@ -58,6 +62,7 @@ export * from './_chatInput/channel';
|
||||
export * from './_chatInput/role';
|
||||
export * from './_chatInput/mentionable';
|
||||
export * from './_chatInput/number';
|
||||
export * from './_chatInput/attachment';
|
||||
export * from './_chatInput/subcommand';
|
||||
export * from './_chatInput/subcommandGroup';
|
||||
export * from './_chatInput/shared';
|
||||
@@ -73,7 +78,8 @@ export type APIApplicationCommandBasicOption =
|
||||
| APIApplicationCommandChannelOption
|
||||
| APIApplicationCommandRoleOption
|
||||
| APIApplicationCommandMentionableOption
|
||||
| APIApplicationCommandNumberOption;
|
||||
| APIApplicationCommandNumberOption
|
||||
| APIApplicationCommandAttachmentOption;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||
@@ -99,7 +105,8 @@ export type APIApplicationCommandInteractionDataBasicOption =
|
||||
| APIApplicationCommandInteractionDataChannelOption
|
||||
| APIApplicationCommandInteractionDataRoleOption
|
||||
| APIApplicationCommandInteractionDataMentionableOption
|
||||
| APIApplicationCommandInteractionDataNumberOption;
|
||||
| APIApplicationCommandInteractionDataNumberOption
|
||||
| APIApplicationCommandInteractionDataAttachmentOption;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
|
||||
@@ -118,6 +125,7 @@ export interface APIChatInputApplicationCommandInteractionDataResolved {
|
||||
roles?: Record<Snowflake, APIRole>;
|
||||
members?: Record<Snowflake, APIInteractionDataResolvedGuildMember>;
|
||||
channels?: Record<Snowflake, APIInteractionDataResolvedChannel>;
|
||||
attachments?: Record<Snowflake, APIAttachment>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,7 +43,7 @@ export interface APIApplicationCommandPermission {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type
|
||||
*/
|
||||
export const enum ApplicationCommandPermissionType {
|
||||
export enum ApplicationCommandPermissionType {
|
||||
Role = 1,
|
||||
User,
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ export interface APIApplicationCommand {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types
|
||||
*/
|
||||
export const enum ApplicationCommandType {
|
||||
export enum ApplicationCommandType {
|
||||
ChatInput = 1,
|
||||
User,
|
||||
Message,
|
||||
|
||||
@@ -1,6 +1,30 @@
|
||||
import type { APIBaseInteraction, APIChatInputApplicationCommandInteractionData, InteractionType } from '../index';
|
||||
import type {
|
||||
APIBaseInteraction,
|
||||
APIChatInputApplicationCommandInteractionData,
|
||||
APIDMInteractionWrapper,
|
||||
APIGuildInteractionWrapper,
|
||||
InteractionType,
|
||||
} from '../index';
|
||||
|
||||
export type APIApplicationCommandAutocompleteInteraction = APIBaseInteraction<
|
||||
InteractionType.ApplicationCommandAutocomplete,
|
||||
APIChatInputApplicationCommandInteractionData
|
||||
>;
|
||||
> &
|
||||
Required<
|
||||
Pick<
|
||||
APIBaseInteraction<InteractionType.ApplicationCommandAutocomplete, APIChatInputApplicationCommandInteractionData>,
|
||||
'data'
|
||||
>
|
||||
>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandAutocompleteDMInteraction =
|
||||
APIDMInteractionWrapper<APIApplicationCommandAutocompleteInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandAutocompleteGuildInteraction =
|
||||
APIGuildInteractionWrapper<APIApplicationCommandAutocompleteInteraction>;
|
||||
|
||||
@@ -3,6 +3,20 @@ import type { InteractionType } from './responses';
|
||||
import type { APIMessage } from '../channel';
|
||||
import type { APIGuildMember } from '../guild';
|
||||
import type { APIUser } from '../user';
|
||||
import type { LocaleString } from '../../../v9';
|
||||
|
||||
export type PartialAPIMessageInteractionGuildMember = Pick<
|
||||
APIGuildMember,
|
||||
| 'roles'
|
||||
| 'premium_since'
|
||||
| 'pending'
|
||||
| 'nick'
|
||||
| 'mute'
|
||||
| 'joined_at'
|
||||
| 'deaf'
|
||||
| 'communication_disabled_until'
|
||||
| 'avatar'
|
||||
>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object
|
||||
@@ -24,6 +38,10 @@ export interface APIMessageInteraction {
|
||||
* The user who invoked the interaction
|
||||
*/
|
||||
user: APIUser;
|
||||
/**
|
||||
* The guild member who invoked the interaction, only sent in MESSAGE_CREATE events
|
||||
*/
|
||||
member?: PartialAPIMessageInteractionGuildMember;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,6 +104,14 @@ export interface APIBaseInteraction<Type extends InteractionType, Data> {
|
||||
* For components, the message they were attached to
|
||||
*/
|
||||
message?: APIMessage;
|
||||
/**
|
||||
* The selected language of the invoking user
|
||||
*/
|
||||
locale: LocaleString;
|
||||
/**
|
||||
* The guild's preferred locale, if invoked in a guild
|
||||
*/
|
||||
guild_locale?: LocaleString;
|
||||
}
|
||||
|
||||
export type APIDMInteractionWrapper<Original extends APIBaseInteraction<InteractionType, unknown>> = Omit<
|
||||
|
||||
46
payloads/v9/_interactions/modalSubmit.ts
Normal file
46
payloads/v9/_interactions/modalSubmit.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel';
|
||||
import type {
|
||||
APIBaseInteraction,
|
||||
InteractionType,
|
||||
ComponentType,
|
||||
APIDMInteractionWrapper,
|
||||
APIGuildInteractionWrapper,
|
||||
} from '../index';
|
||||
|
||||
export interface ModalSubmitComponent {
|
||||
type: ComponentType;
|
||||
custom_id: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface ModalSubmitActionRowComponent
|
||||
extends Omit<APIActionRowComponent<APIModalActionRowComponent>, 'components'> {
|
||||
components: ModalSubmitComponent[];
|
||||
}
|
||||
|
||||
export interface APIModalSubmission {
|
||||
/**
|
||||
* A developer-defined identifier for the component, max 100 characters
|
||||
*/
|
||||
custom_id: string;
|
||||
/**
|
||||
* A list of child components
|
||||
*/
|
||||
components?: ModalSubmitActionRowComponent[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitInteraction = APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission> &
|
||||
Required<Pick<APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission>, 'data'>>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitDMInteraction = APIDMInteractionWrapper<APIModalSubmitInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIModalSubmitGuildInteraction = APIGuildInteractionWrapper<APIModalSubmitInteraction>;
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { APIBaseInteraction } from './base';
|
||||
import type { InteractionType } from './responses';
|
||||
|
||||
export type APIPingInteraction = APIBaseInteraction<InteractionType.Ping, never>;
|
||||
export type APIPingInteraction = Omit<APIBaseInteraction<InteractionType.Ping, never>, 'locale'>;
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
import type { MessageFlags } from '../index';
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9';
|
||||
import type { APIApplicationCommandOptionChoice } from './applicationCommands';
|
||||
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type
|
||||
*/
|
||||
export const enum InteractionType {
|
||||
export enum InteractionType {
|
||||
Ping = 1,
|
||||
ApplicationCommand,
|
||||
MessageComponent,
|
||||
ApplicationCommandAutocomplete,
|
||||
ModalSubmit,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,6 +34,11 @@ export interface APIApplicationCommandAutocompleteResponse {
|
||||
data: APICommandAutocompleteInteractionResponseCallbackData;
|
||||
}
|
||||
|
||||
export interface APIModalInteractionResponse {
|
||||
type: InteractionResponseType.Modal;
|
||||
data: APIModalInteractionResponseCallbackData;
|
||||
}
|
||||
|
||||
export interface APIInteractionResponseChannelMessageWithSource {
|
||||
type: InteractionResponseType.ChannelMessageWithSource;
|
||||
data: APIInteractionResponseCallbackData;
|
||||
@@ -54,7 +61,7 @@ export interface APIInteractionResponseUpdateMessage {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
|
||||
*/
|
||||
export const enum InteractionResponseType {
|
||||
export enum InteractionResponseType {
|
||||
/**
|
||||
* ACK a `Ping`
|
||||
*/
|
||||
@@ -79,6 +86,10 @@ export const enum InteractionResponseType {
|
||||
* For autocomplete interactions
|
||||
*/
|
||||
ApplicationCommandAutocompleteResult,
|
||||
/**
|
||||
* Respond to an interaction with an modal for a user to fill-out
|
||||
*/
|
||||
Modal,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,3 +103,21 @@ export type APIInteractionResponseCallbackData = Omit<
|
||||
export interface APICommandAutocompleteInteractionResponseCallbackData {
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal
|
||||
*/
|
||||
export interface APIModalInteractionResponseCallbackData {
|
||||
/**
|
||||
* A developer-defined identifier for the component, max 100 characters
|
||||
*/
|
||||
custom_id: string;
|
||||
/**
|
||||
* The title of the popup modal
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* Between 1 and 5 (inclusive) components that make up the modal
|
||||
*/
|
||||
components: APIActionRowComponent<APIModalActionRowComponent>[];
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ export interface APIApplication {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
export const enum ApplicationFlags {
|
||||
export enum ApplicationFlags {
|
||||
EmbeddedReleased = 1 << 1,
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
|
||||
@@ -112,7 +112,7 @@ export interface APIAuditLogEntry {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events
|
||||
*/
|
||||
export const enum AuditLogEvent {
|
||||
export enum AuditLogEvent {
|
||||
GuildUpdate = 1,
|
||||
|
||||
ChannelCreate = 10,
|
||||
@@ -261,7 +261,7 @@ export interface APIAuditLogOptions {
|
||||
role_name?: string;
|
||||
}
|
||||
|
||||
export const enum AuditLogOptionsType {
|
||||
export enum AuditLogOptionsType {
|
||||
Role = '0',
|
||||
Member = '1',
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user