mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-05-22 11:20:10 +00:00
Compare commits
57 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 | ||
|
|
7ecf9b2c16 | ||
|
|
fe1f5313a8 | ||
|
|
0cf51abc26 | ||
|
|
751aee6fa7 | ||
|
|
9f4f59c8e5 | ||
|
|
cd580fa2c6 | ||
|
|
c20e5ae2a9 | ||
|
|
7fe78cec25 | ||
|
|
bfc5e46f53 | ||
|
|
8bbb81942b | ||
|
|
46db72da2f | ||
|
|
0bbc9721f6 | ||
|
|
7eee39d86c | ||
|
|
2c72242a03 | ||
|
|
7ab780b3ae | ||
|
|
315ce35849 | ||
|
|
c67d426e3d | ||
|
|
e9d02a19fc | ||
|
|
9e619fc460 | ||
|
|
b01716bf22 | ||
|
|
c7efcd5505 |
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/
|
||||
108
CHANGELOG.md
108
CHANGELOG.md
@@ -1,3 +1,111 @@
|
||||
## [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
|
||||
|
||||
- **APIApplicationCommandOption:** correct type for integer and number ([#284](https://github.com/discordjs/discord-api-types/issues/284)) ([fe1f531](https://github.com/discordjs/discord-api-types/commit/fe1f5313a8fc13d0a2433738cce9be37f5d9eeb5))
|
||||
|
||||
### Features
|
||||
|
||||
- **APIAuditLogChangeData:** Add `communication_disabled_until` ([#281](https://github.com/discordjs/discord-api-types/issues/281)) ([0cf51ab](https://github.com/discordjs/discord-api-types/commit/0cf51abc267bd6246a7952e7f6a23fa8c5db290a))
|
||||
- **APIGuildScheduledEvent:** add more precise types for stage instance/voice/external events ([#278](https://github.com/discordjs/discord-api-types/issues/278)) ([751aee6](https://github.com/discordjs/discord-api-types/commit/751aee6fa7d4c542324a30e9b9bc641b0e7a8bf4))
|
||||
- **ApplicationFlags:** add embedded application flags ([#277](https://github.com/discordjs/discord-api-types/issues/277)) ([9f4f59c](https://github.com/discordjs/discord-api-types/commit/9f4f59c8e55f78caf614e27e28b6bca939665ca5))
|
||||
|
||||
# [0.26.0](https://github.com/discordjs/discord-api-types/compare/0.25.2...0.26.0) (2021-12-24)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **APIInvite:** channel can be null ([#182](https://github.com/discordjs/discord-api-types/issues/182)) ([c67d426](https://github.com/discordjs/discord-api-types/commit/c67d426e3d3634eb0756f07029b9176cfc5873ce))
|
||||
- **GatewayStageInstance:** Stage Instance dispatches not included in `GatewayDispatchPayload` ([#267](https://github.com/discordjs/discord-api-types/issues/267)) ([46db72d](https://github.com/discordjs/discord-api-types/commit/46db72da2fd14a51047b4e66e934738785e72d96))
|
||||
- **NonDispatchPayload:** `t` & `s` fields are always null on non-dispatch payloads ([#259](https://github.com/discordjs/discord-api-types/issues/259)) ([315ce35](https://github.com/discordjs/discord-api-types/commit/315ce3584917635b93a26123470f37a10bd8d846))
|
||||
- only a partial object is needed when updating attachments ([#263](https://github.com/discordjs/discord-api-types/issues/263)) ([7ab780b](https://github.com/discordjs/discord-api-types/commit/7ab780b3aefb3c8c34a8114db3ace6c4e6ae3206))
|
||||
- **StickerPack:** Optional `banner_asset_id` ([#270](https://github.com/discordjs/discord-api-types/issues/270)) ([7eee39d](https://github.com/discordjs/discord-api-types/commit/7eee39d86c0d40857d0bf6fc0d4d1e31cda1895c))
|
||||
|
||||
### Features
|
||||
|
||||
- Add API error code `50055` ([#256](https://github.com/discordjs/discord-api-types/issues/256)) ([b01716b](https://github.com/discordjs/discord-api-types/commit/b01716bf22fba617c0a09084ff607127366432b6))
|
||||
- Add API error code 50109 ([#268](https://github.com/discordjs/discord-api-types/issues/268)) ([bfc5e46](https://github.com/discordjs/discord-api-types/commit/bfc5e46f5374289997219c35aa0b992dfaa4ec40))
|
||||
- add support for user guild member read oauth2 scope and route ([#254](https://github.com/discordjs/discord-api-types/issues/254)) ([e9d02a1](https://github.com/discordjs/discord-api-types/commit/e9d02a19fc3b4fad2f488b0db3b63d6301878730))
|
||||
- **APIAuditLog:** add `guild_scheduled_events` prop ([#251](https://github.com/discordjs/discord-api-types/issues/251)) ([c7efcd5](https://github.com/discordjs/discord-api-types/commit/c7efcd55059673ab9fc8e6ef9711050700274057))
|
||||
- **APIGuildMember:** add guild timeouts ([#235](https://github.com/discordjs/discord-api-types/issues/235)) ([0bbc972](https://github.com/discordjs/discord-api-types/commit/0bbc9721f6e18eb559c40e207f60218e7862d4ea))
|
||||
- **GatewayThreadMemberUpdateDispatchData:** add `guild_id` extra field ([#266](https://github.com/discordjs/discord-api-types/issues/266)) ([2c72242](https://github.com/discordjs/discord-api-types/commit/2c72242a03bd5adfd0fc145bf5645d1bad59254e))
|
||||
- **RESTJSONErrorCodes:** add error 20029 ([#257](https://github.com/discordjs/discord-api-types/issues/257)) ([9e619fc](https://github.com/discordjs/discord-api-types/commit/9e619fc460337d53c85fc3977c89489c14bd8254))
|
||||
- bring in support for TS 4.5's `exactOptionalPropertyTypes` ([#275](https://github.com/discordjs/discord-api-types/issues/275)) ([c20e5ae](https://github.com/discordjs/discord-api-types/commit/c20e5ae2a9edcca529e233a4deb634bc760076d2))
|
||||
|
||||
### Cleanups
|
||||
|
||||
- Make application command option union easier to use ([#250](https://github.com/discordjs/discord-api-types/issues/250)) ([8bbb819](https://github.com/discordjs/discord-api-types/commit/8bbb81942b3f87e46273bb75a12e2db4ef7ee797))
|
||||
- **ChatInputCommandOptions:** cleanup chat input options ([#274](https://github.com/discordjs/discord-api-types/issues/274)) ([7fe78ce](https://github.com/discordjs/discord-api-types/commit/7fe78cec25a07dcd5d7ba2af3a5d773620c2d3cf))
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
- **StickerPack:** `banner_asset_id` is now optional. Reference PR: https://github.com/discord/discord-api-docs/pull/4245
|
||||
- **APIInvite:** this marks the channel property of invites as possibly null
|
||||
- **ChatInputCommandOptions:** A lot of the options were renamed and split up to clean up internal code.
|
||||
All option interfaces that ended in a plural (`*Options`) have had their pluralization removed (`*Option` now).
|
||||
`APIApplicationCommandInteractionDataOptionWithValues` has been renamed to `APIApplicationCommandInteractionDataBasicOption`,
|
||||
and every `*InteractionDataOptions{Type}` interfaces have been renamed to `*InteractionData{Type}Option`
|
||||
(i.e.: `ApplicationCommandInteractionDataOptionString` -> `APIApplicationCommandInteractionDataStringOption`).
|
||||
|
||||
## [0.25.2](https://github.com/discordjs/discord-api-types/compare/0.25.1...0.25.2) (2021-11-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,3 +1,111 @@
|
||||
## [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
|
||||
|
||||
- **APIApplicationCommandOption:** correct type for integer and number ([#284](https://github.com/discordjs/discord-api-types/issues/284)) ([fe1f531](https://github.com/discordjs/discord-api-types/commit/fe1f5313a8fc13d0a2433738cce9be37f5d9eeb5))
|
||||
|
||||
### Features
|
||||
|
||||
- **APIAuditLogChangeData:** Add `communication_disabled_until` ([#281](https://github.com/discordjs/discord-api-types/issues/281)) ([0cf51ab](https://github.com/discordjs/discord-api-types/commit/0cf51abc267bd6246a7952e7f6a23fa8c5db290a))
|
||||
- **APIGuildScheduledEvent:** add more precise types for stage instance/voice/external events ([#278](https://github.com/discordjs/discord-api-types/issues/278)) ([751aee6](https://github.com/discordjs/discord-api-types/commit/751aee6fa7d4c542324a30e9b9bc641b0e7a8bf4))
|
||||
- **ApplicationFlags:** add embedded application flags ([#277](https://github.com/discordjs/discord-api-types/issues/277)) ([9f4f59c](https://github.com/discordjs/discord-api-types/commit/9f4f59c8e55f78caf614e27e28b6bca939665ca5))
|
||||
|
||||
# [0.26.0](https://github.com/discordjs/discord-api-types/compare/0.25.2...0.26.0) (2021-12-24)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **APIInvite:** channel can be null ([#182](https://github.com/discordjs/discord-api-types/issues/182)) ([c67d426](https://github.com/discordjs/discord-api-types/commit/c67d426e3d3634eb0756f07029b9176cfc5873ce))
|
||||
- **GatewayStageInstance:** Stage Instance dispatches not included in `GatewayDispatchPayload` ([#267](https://github.com/discordjs/discord-api-types/issues/267)) ([46db72d](https://github.com/discordjs/discord-api-types/commit/46db72da2fd14a51047b4e66e934738785e72d96))
|
||||
- **NonDispatchPayload:** `t` & `s` fields are always null on non-dispatch payloads ([#259](https://github.com/discordjs/discord-api-types/issues/259)) ([315ce35](https://github.com/discordjs/discord-api-types/commit/315ce3584917635b93a26123470f37a10bd8d846))
|
||||
- only a partial object is needed when updating attachments ([#263](https://github.com/discordjs/discord-api-types/issues/263)) ([7ab780b](https://github.com/discordjs/discord-api-types/commit/7ab780b3aefb3c8c34a8114db3ace6c4e6ae3206))
|
||||
- **StickerPack:** Optional `banner_asset_id` ([#270](https://github.com/discordjs/discord-api-types/issues/270)) ([7eee39d](https://github.com/discordjs/discord-api-types/commit/7eee39d86c0d40857d0bf6fc0d4d1e31cda1895c))
|
||||
|
||||
### Features
|
||||
|
||||
- Add API error code `50055` ([#256](https://github.com/discordjs/discord-api-types/issues/256)) ([b01716b](https://github.com/discordjs/discord-api-types/commit/b01716bf22fba617c0a09084ff607127366432b6))
|
||||
- Add API error code 50109 ([#268](https://github.com/discordjs/discord-api-types/issues/268)) ([bfc5e46](https://github.com/discordjs/discord-api-types/commit/bfc5e46f5374289997219c35aa0b992dfaa4ec40))
|
||||
- add support for user guild member read oauth2 scope and route ([#254](https://github.com/discordjs/discord-api-types/issues/254)) ([e9d02a1](https://github.com/discordjs/discord-api-types/commit/e9d02a19fc3b4fad2f488b0db3b63d6301878730))
|
||||
- **APIAuditLog:** add `guild_scheduled_events` prop ([#251](https://github.com/discordjs/discord-api-types/issues/251)) ([c7efcd5](https://github.com/discordjs/discord-api-types/commit/c7efcd55059673ab9fc8e6ef9711050700274057))
|
||||
- **APIGuildMember:** add guild timeouts ([#235](https://github.com/discordjs/discord-api-types/issues/235)) ([0bbc972](https://github.com/discordjs/discord-api-types/commit/0bbc9721f6e18eb559c40e207f60218e7862d4ea))
|
||||
- **GatewayThreadMemberUpdateDispatchData:** add `guild_id` extra field ([#266](https://github.com/discordjs/discord-api-types/issues/266)) ([2c72242](https://github.com/discordjs/discord-api-types/commit/2c72242a03bd5adfd0fc145bf5645d1bad59254e))
|
||||
- **RESTJSONErrorCodes:** add error 20029 ([#257](https://github.com/discordjs/discord-api-types/issues/257)) ([9e619fc](https://github.com/discordjs/discord-api-types/commit/9e619fc460337d53c85fc3977c89489c14bd8254))
|
||||
- bring in support for TS 4.5's `exactOptionalPropertyTypes` ([#275](https://github.com/discordjs/discord-api-types/issues/275)) ([c20e5ae](https://github.com/discordjs/discord-api-types/commit/c20e5ae2a9edcca529e233a4deb634bc760076d2))
|
||||
|
||||
### Cleanups
|
||||
|
||||
- Make application command option union easier to use ([#250](https://github.com/discordjs/discord-api-types/issues/250)) ([8bbb819](https://github.com/discordjs/discord-api-types/commit/8bbb81942b3f87e46273bb75a12e2db4ef7ee797))
|
||||
- **ChatInputCommandOptions:** cleanup chat input options ([#274](https://github.com/discordjs/discord-api-types/issues/274)) ([7fe78ce](https://github.com/discordjs/discord-api-types/commit/7fe78cec25a07dcd5d7ba2af3a5d773620c2d3cf))
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
- **StickerPack:** `banner_asset_id` is now optional. Reference PR: https://github.com/discord/discord-api-docs/pull/4245
|
||||
- **APIInvite:** this marks the channel property of invites as possibly null
|
||||
- **ChatInputCommandOptions:** A lot of the options were renamed and split up to clean up internal code.
|
||||
All option interfaces that ended in a plural (`*Options`) have had their pluralization removed (`*Option` now).
|
||||
`APIApplicationCommandInteractionDataOptionWithValues` has been renamed to `APIApplicationCommandInteractionDataBasicOption`,
|
||||
and every `*InteractionDataOptions{Type}` interfaces have been renamed to `*InteractionData{Type}Option`
|
||||
(i.e.: `ApplicationCommandInteractionDataOptionString` -> `APIApplicationCommandInteractionDataStringOption`).
|
||||
|
||||
## [0.25.2](https://github.com/discordjs/discord-api-types/compare/0.25.1...0.25.2) (2021-11-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1568,7 +1568,10 @@ interface BasePayload {
|
||||
t?: string;
|
||||
}
|
||||
|
||||
type NonDispatchPayload = Omit<BasePayload, 't'>;
|
||||
type NonDispatchPayload = Omit<BasePayload, 't' | 's'> & {
|
||||
t: null;
|
||||
s: null;
|
||||
};
|
||||
|
||||
interface DataPayload<Event extends GatewayDispatchEvents, D = unknown> extends BasePayload {
|
||||
op: GatewayOpcodes.Dispatch;
|
||||
|
||||
@@ -27,6 +27,7 @@ import type {
|
||||
GatewayVoiceState,
|
||||
InviteTargetType,
|
||||
PresenceUpdateStatus,
|
||||
APIThreadChannel,
|
||||
} from '../payloads/v9/mod.ts';
|
||||
import type { Nullable } from '../utils/internals.ts';
|
||||
|
||||
@@ -302,6 +303,9 @@ export type GatewayDispatchPayload =
|
||||
| GatewayMessageReactionRemoveEmojiDispatch
|
||||
| GatewayMessageUpdateDispatch
|
||||
| GatewayPresenceUpdateDispatch
|
||||
| GatewayStageInstanceCreateDispatch
|
||||
| GatewayStageInstanceDeleteDispatch
|
||||
| GatewayStageInstanceUpdateDispatch
|
||||
| GatewayReadyDispatch
|
||||
| GatewayResumedDispatch
|
||||
| GatewayThreadListSyncDispatch
|
||||
@@ -1257,7 +1261,7 @@ export type GatewayThreadMemberUpdateDispatch = DataPayload<
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#thread-member-update
|
||||
*/
|
||||
export type GatewayThreadMemberUpdateDispatchData = APIThreadMember;
|
||||
export type GatewayThreadMemberUpdateDispatchData = APIThreadMember & { guild_id: Snowflake };
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#thread-create
|
||||
@@ -1277,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
|
||||
@@ -1657,7 +1666,10 @@ interface BasePayload {
|
||||
t?: string;
|
||||
}
|
||||
|
||||
type NonDispatchPayload = Omit<BasePayload, 't'>;
|
||||
type NonDispatchPayload = Omit<BasePayload, 't' | 's'> & {
|
||||
t: null;
|
||||
s: null;
|
||||
};
|
||||
|
||||
interface DataPayload<Event extends GatewayDispatchEvents, D = unknown> extends BasePayload {
|
||||
op: GatewayOpcodes.Dispatch;
|
||||
|
||||
@@ -540,7 +540,7 @@ export type APIAuditLogChangeKeyExpireGracePeriod = AuditLogChangeData<'expire_g
|
||||
* @internal
|
||||
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
|
||||
*/
|
||||
interface AuditLogChangeData<K extends string, D extends unknown> {
|
||||
interface AuditLogChangeData<K extends string, D> {
|
||||
key: K;
|
||||
new_value?: D;
|
||||
old_value?: D;
|
||||
|
||||
@@ -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
|
||||
>;
|
||||
@@ -0,0 +1,26 @@
|
||||
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export interface APIApplicationCommandOptionBase<Type extends ApplicationCommandOptionType> {
|
||||
type: Type;
|
||||
name: string;
|
||||
description: string;
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
export interface APIInteractionDataOptionBase<T extends ApplicationCommandOptionType, D> {
|
||||
name: string;
|
||||
type: T;
|
||||
value: D;
|
||||
}
|
||||
|
||||
export type APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
|
||||
Base extends APIApplicationCommandOptionBase<ApplicationCommandOptionType>,
|
||||
ChoiceType extends APIApplicationCommandOptionChoice,
|
||||
> =
|
||||
| (Base & {
|
||||
autocomplete: true;
|
||||
})
|
||||
| (Base & {
|
||||
autocomplete?: false;
|
||||
choices?: ChoiceType[];
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export type APIApplicationCommandBooleanOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.Boolean>;
|
||||
|
||||
export type APIApplicationCommandInteractionDataBooleanOption = APIInteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Boolean,
|
||||
boolean
|
||||
>;
|
||||
@@ -0,0 +1,14 @@
|
||||
import type { Snowflake } from '../../../../../globals.ts';
|
||||
import type { ChannelType } from '../../../channel.ts';
|
||||
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export interface APIApplicationCommandChannelOption
|
||||
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Channel> {
|
||||
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
|
||||
}
|
||||
|
||||
export type APIApplicationCommandInteractionDataChannelOption = APIInteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Channel,
|
||||
Snowflake
|
||||
>;
|
||||
@@ -0,0 +1,28 @@
|
||||
import type {
|
||||
APIApplicationCommandOptionBase,
|
||||
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
|
||||
APIInteractionDataOptionBase,
|
||||
} from './base.ts';
|
||||
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
interface APIApplicationCommandIntegerOptionBase
|
||||
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Integer> {
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
max_value?: number;
|
||||
}
|
||||
|
||||
export type APIApplicationCommandIntegerOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
|
||||
APIApplicationCommandIntegerOptionBase,
|
||||
APIApplicationCommandOptionChoice<number>
|
||||
>;
|
||||
|
||||
export interface APIApplicationCommandInteractionDataIntegerOption
|
||||
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
|
||||
focused?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { Snowflake } from '../../../../../globals.ts';
|
||||
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export type APIApplicationCommandMentionableOption =
|
||||
APIApplicationCommandOptionBase<ApplicationCommandOptionType.Mentionable>;
|
||||
|
||||
export type APIApplicationCommandInteractionDataMentionableOption = APIInteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Mentionable,
|
||||
Snowflake
|
||||
>;
|
||||
@@ -0,0 +1,28 @@
|
||||
import type {
|
||||
APIApplicationCommandOptionBase,
|
||||
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
|
||||
APIInteractionDataOptionBase,
|
||||
} from './base.ts';
|
||||
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
interface APIApplicationCommandNumberOptionBase
|
||||
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Number> {
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
max_value?: number;
|
||||
}
|
||||
|
||||
export type APIApplicationCommandNumberOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
|
||||
APIApplicationCommandNumberOptionBase,
|
||||
APIApplicationCommandOptionChoice<number>
|
||||
>;
|
||||
|
||||
export interface APIApplicationCommandInteractionDataNumberOption
|
||||
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
|
||||
focused?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { Snowflake } from '../../../../../globals.ts';
|
||||
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export type APIApplicationCommandRoleOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.Role>;
|
||||
|
||||
export type APIApplicationCommandInteractionDataRoleOption = APIInteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Role,
|
||||
Snowflake
|
||||
>;
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
|
||||
*/
|
||||
export enum ApplicationCommandOptionType {
|
||||
Subcommand = 1,
|
||||
SubcommandGroup,
|
||||
String,
|
||||
Integer,
|
||||
Boolean,
|
||||
User,
|
||||
Channel,
|
||||
Role,
|
||||
Mentionable,
|
||||
Number,
|
||||
Attachment,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
|
||||
*/
|
||||
export interface APIApplicationCommandOptionChoice<ValueType = string | number> {
|
||||
name: string;
|
||||
value: ValueType;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import type {
|
||||
APIApplicationCommandOptionBase,
|
||||
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
|
||||
APIInteractionDataOptionBase,
|
||||
} from './base.ts';
|
||||
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export type APIApplicationCommandStringOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
|
||||
APIApplicationCommandOptionBase<ApplicationCommandOptionType.String>,
|
||||
APIApplicationCommandOptionChoice<string>
|
||||
>;
|
||||
|
||||
export interface APIApplicationCommandInteractionDataStringOption
|
||||
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
|
||||
focused?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import type { APIApplicationCommandBasicOption, APIApplicationCommandInteractionDataBasicOption } from '../chatInput.ts';
|
||||
import type { APIApplicationCommandOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export interface APIApplicationCommandSubcommandOption
|
||||
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Subcommand> {
|
||||
options?: APIApplicationCommandBasicOption[];
|
||||
}
|
||||
|
||||
export interface APIApplicationCommandInteractionDataSubcommandOption {
|
||||
name: string;
|
||||
type: ApplicationCommandOptionType.Subcommand;
|
||||
options?: APIApplicationCommandInteractionDataBasicOption[];
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { APIApplicationCommandOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
import type {
|
||||
APIApplicationCommandInteractionDataSubcommandOption,
|
||||
APIApplicationCommandSubcommandOption,
|
||||
} from './subcommand.ts';
|
||||
|
||||
export interface APIApplicationCommandSubcommandGroupOption
|
||||
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.SubcommandGroup> {
|
||||
options?: APIApplicationCommandSubcommandOption[];
|
||||
}
|
||||
|
||||
export interface APIApplicationCommandInteractionDataSubcommandGroupOption {
|
||||
name: string;
|
||||
type: ApplicationCommandOptionType.SubcommandGroup;
|
||||
options: APIApplicationCommandInteractionDataSubcommandOption[];
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { Snowflake } from '../../../../../globals.ts';
|
||||
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export type APIApplicationCommandUserOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.User>;
|
||||
|
||||
export type APIApplicationCommandInteractionDataUserOption = APIInteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.User,
|
||||
Snowflake
|
||||
>;
|
||||
@@ -1,232 +1,112 @@
|
||||
import type { APIRole, APIUser, ChannelType } from '../../mod.ts';
|
||||
import type { Snowflake } from '../../../../globals.ts';
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
|
||||
import type { APIAttachment, APIRole, APIUser } from '../../mod.ts';
|
||||
import type {
|
||||
APIApplicationCommandInteractionWrapper,
|
||||
APIInteractionDataResolvedChannel,
|
||||
APIInteractionDataResolvedGuildMember,
|
||||
ApplicationCommandType,
|
||||
} from '../applicationCommands.ts';
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
|
||||
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
|
||||
|
||||
interface APIApplicationCommandOptionBase {
|
||||
type:
|
||||
| ApplicationCommandOptionType.Boolean
|
||||
| ApplicationCommandOptionType.User
|
||||
| ApplicationCommandOptionType.Role
|
||||
| ApplicationCommandOptionType.Mentionable;
|
||||
name: string;
|
||||
description: string;
|
||||
required?: boolean;
|
||||
autocomplete?: never;
|
||||
}
|
||||
import type {
|
||||
APIApplicationCommandStringOption,
|
||||
APIApplicationCommandInteractionDataStringOption,
|
||||
} from './_chatInput/string.ts';
|
||||
import type {
|
||||
APIApplicationCommandIntegerOption,
|
||||
APIApplicationCommandInteractionDataIntegerOption,
|
||||
} from './_chatInput/integer.ts';
|
||||
import type {
|
||||
APIApplicationCommandBooleanOption,
|
||||
APIApplicationCommandInteractionDataBooleanOption,
|
||||
} from './_chatInput/boolean.ts';
|
||||
import type {
|
||||
APIApplicationCommandUserOption,
|
||||
APIApplicationCommandInteractionDataUserOption,
|
||||
} from './_chatInput/user.ts';
|
||||
import type {
|
||||
APIApplicationCommandChannelOption,
|
||||
APIApplicationCommandInteractionDataChannelOption,
|
||||
} from './_chatInput/channel.ts';
|
||||
import type {
|
||||
APIApplicationCommandRoleOption,
|
||||
APIApplicationCommandInteractionDataRoleOption,
|
||||
} from './_chatInput/role.ts';
|
||||
import type {
|
||||
APIApplicationCommandMentionableOption,
|
||||
APIApplicationCommandInteractionDataMentionableOption,
|
||||
} from './_chatInput/mentionable.ts';
|
||||
import type {
|
||||
APIApplicationCommandNumberOption,
|
||||
APIApplicationCommandInteractionDataNumberOption,
|
||||
} from './_chatInput/number.ts';
|
||||
import type {
|
||||
APIApplicationCommandAttachmentOption,
|
||||
APIApplicationCommandInteractionDataAttachmentOption,
|
||||
} from './_chatInput/attachment.ts';
|
||||
import type {
|
||||
APIApplicationCommandSubcommandOption,
|
||||
APIApplicationCommandInteractionDataSubcommandOption,
|
||||
} from './_chatInput/subcommand.ts';
|
||||
import type {
|
||||
APIApplicationCommandSubcommandGroupOption,
|
||||
APIApplicationCommandInteractionDataSubcommandGroupOption,
|
||||
} from './_chatInput/subcommandGroup.ts';
|
||||
|
||||
export * from './_chatInput/string.ts';
|
||||
export * from './_chatInput/integer.ts';
|
||||
export * from './_chatInput/boolean.ts';
|
||||
export * from './_chatInput/user.ts';
|
||||
export * from './_chatInput/channel.ts';
|
||||
export * from './_chatInput/role.ts';
|
||||
export * from './_chatInput/mentionable.ts';
|
||||
export * from './_chatInput/number.ts';
|
||||
export * from './_chatInput/attachment.ts';
|
||||
export * from './_chatInput/subcommand.ts';
|
||||
export * from './_chatInput/subcommandGroup.ts';
|
||||
export * from './_chatInput/shared.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||
*/
|
||||
export type APIApplicationCommandBasicOption =
|
||||
| APIApplicationCommandStringOption
|
||||
| APIApplicationCommandIntegerOption
|
||||
| APIApplicationCommandBooleanOption
|
||||
| APIApplicationCommandUserOption
|
||||
| APIApplicationCommandChannelOption
|
||||
| APIApplicationCommandRoleOption
|
||||
| APIApplicationCommandMentionableOption
|
||||
| APIApplicationCommandNumberOption
|
||||
| APIApplicationCommandAttachmentOption;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||
*/
|
||||
export type APIApplicationCommandOption =
|
||||
| APIApplicationCommandStringArgumentOptions
|
||||
| APIApplicationCommandSubCommandOptions
|
||||
| APIApplicationCommandOptionBase
|
||||
| APIApplicationCommandChannelOptions
|
||||
| APIApplicationCommandOptionBase
|
||||
| APIApplicationCommandNumberArgumentOptions
|
||||
| APIApplicationCommandStringAutocompleteOptions
|
||||
| APIApplicationCommandNumericAutocompleteOptions;
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
|
||||
*/
|
||||
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
|
||||
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
|
||||
options?: APIApplicationCommandOption[];
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
|
||||
* but they can have a `choices` one
|
||||
*/
|
||||
export interface APIApplicationCommandStringArgumentOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
|
||||
type: ApplicationCommandOptionType.String;
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
|
||||
* but they can have a `choices`, a `min_value` and `max_value` field
|
||||
*/
|
||||
export interface APIApplicationCommandNumberArgumentOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* if the option is an `INTEGER` or `NUMBER` type, the maximum value permitted
|
||||
*/
|
||||
max_value?: number;
|
||||
autocomplete?: false;
|
||||
}
|
||||
export interface APIApplicationCommandArgumentOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type:
|
||||
| ApplicationCommandOptionType.String
|
||||
| ApplicationCommandOptionType.Integer
|
||||
| ApplicationCommandOptionType.Number;
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
autocomplete?: false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
|
||||
* but they can a `autocomplete` field where it's set to `true`
|
||||
*/
|
||||
export interface APIApplicationCommandStringAutocompleteOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type: ApplicationCommandOptionType.String;
|
||||
autocomplete: true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
|
||||
* but they can a `autocomplete` field where it's set to `true`
|
||||
*/
|
||||
export interface APIApplicationCommandNumericAutocompleteOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
|
||||
autocomplete: true;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
max_value?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions` and `APIApplicationCommandArgumentOptions`,
|
||||
* these types cannot have an `options` array, or a `choices` array, but they can have a `channel_types` one.
|
||||
*/
|
||||
export interface APIApplicationCommandChannelOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
|
||||
type: ApplicationCommandOptionType.Channel;
|
||||
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
|
||||
*/
|
||||
export enum ApplicationCommandOptionType {
|
||||
Subcommand = 1,
|
||||
SubcommandGroup,
|
||||
String,
|
||||
Integer,
|
||||
Boolean,
|
||||
User,
|
||||
Channel,
|
||||
Role,
|
||||
Mentionable,
|
||||
Number,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
|
||||
*/
|
||||
export interface APIApplicationCommandOptionChoice {
|
||||
name: string;
|
||||
value: string | number;
|
||||
}
|
||||
| APIApplicationCommandSubcommandOption
|
||||
| APIApplicationCommandSubcommandGroupOption
|
||||
| APIApplicationCommandBasicOption;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
|
||||
*/
|
||||
export type APIApplicationCommandInteractionDataOption =
|
||||
| ApplicationCommandInteractionDataOptionSubCommand
|
||||
| ApplicationCommandInteractionDataOptionSubCommandGroup
|
||||
| APIApplicationCommandInteractionDataOptionWithValues;
|
||||
| APIApplicationCommandInteractionDataSubcommandOption
|
||||
| APIApplicationCommandInteractionDataSubcommandGroupOption
|
||||
| APIApplicationCommandInteractionDataBasicOption;
|
||||
|
||||
export interface ApplicationCommandInteractionDataOptionSubCommand {
|
||||
name: string;
|
||||
type: ApplicationCommandOptionType.Subcommand;
|
||||
options?: APIApplicationCommandInteractionDataOptionWithValues[];
|
||||
}
|
||||
|
||||
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
|
||||
name: string;
|
||||
type: ApplicationCommandOptionType.SubcommandGroup;
|
||||
options: ApplicationCommandInteractionDataOptionSubCommand[];
|
||||
}
|
||||
|
||||
export type APIApplicationCommandInteractionDataOptionWithValues =
|
||||
| ApplicationCommandInteractionDataOptionString
|
||||
| ApplicationCommandInteractionDataOptionRole
|
||||
| ApplicationCommandInteractionDataOptionChannel
|
||||
| ApplicationCommandInteractionDataOptionUser
|
||||
| ApplicationCommandInteractionDataOptionMentionable
|
||||
| ApplicationCommandInteractionDataOptionInteger
|
||||
| ApplicationCommandInteractionDataOptionNumber
|
||||
| ApplicationCommandInteractionDataOptionBoolean;
|
||||
|
||||
export interface ApplicationCommandInteractionDataOptionString
|
||||
extends InteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
|
||||
focused?: boolean;
|
||||
}
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionRole = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Role,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionChannel = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Channel,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionUser = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.User,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionMentionable = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Mentionable,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export interface ApplicationCommandInteractionDataOptionInteger
|
||||
extends InteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
|
||||
focused?: boolean;
|
||||
}
|
||||
|
||||
export interface ApplicationCommandInteractionDataOptionNumber
|
||||
extends InteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
|
||||
focused?: boolean;
|
||||
}
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Boolean,
|
||||
boolean
|
||||
>;
|
||||
|
||||
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
|
||||
name: string;
|
||||
type: T;
|
||||
value: D;
|
||||
}
|
||||
export type APIApplicationCommandInteractionDataBasicOption =
|
||||
| APIApplicationCommandInteractionDataStringOption
|
||||
| APIApplicationCommandInteractionDataIntegerOption
|
||||
| APIApplicationCommandInteractionDataBooleanOption
|
||||
| APIApplicationCommandInteractionDataUserOption
|
||||
| APIApplicationCommandInteractionDataChannelOption
|
||||
| APIApplicationCommandInteractionDataRoleOption
|
||||
| APIApplicationCommandInteractionDataMentionableOption
|
||||
| APIApplicationCommandInteractionDataNumberOption
|
||||
| APIApplicationCommandInteractionDataAttachmentOption;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
|
||||
@@ -245,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,7 +57,7 @@ export interface APIInteractionGuildMember extends APIGuildMember {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
|
||||
export interface APIBaseInteraction<Type extends InteractionType, Data> {
|
||||
/**
|
||||
* ID of the interaction
|
||||
*/
|
||||
@@ -86,6 +104,14 @@ export interface APIBaseInteraction<Type extends InteractionType, Data extends u
|
||||
* 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>[];
|
||||
}
|
||||
|
||||
@@ -97,6 +97,7 @@ export interface APIApplication {
|
||||
* https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
export enum ApplicationFlags {
|
||||
EmbeddedReleased = 1 << 1,
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
@@ -108,4 +109,5 @@ export enum ApplicationFlags {
|
||||
Embedded = 1 << 17,
|
||||
GatewayMessageContent = 1 << 18,
|
||||
GatewayMessageContentLimited = 1 << 19,
|
||||
EmbeddedFirstParty = 1 << 20,
|
||||
}
|
||||
|
||||
@@ -17,7 +17,11 @@ import type { StickerFormatType } from './sticker.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
import type { APIWebhook } from './webhook.ts';
|
||||
import type { StageInstancePrivacyLevel } from './stageInstance.ts';
|
||||
import type { GuildScheduledEventEntityType, GuildScheduledEventStatus } from './guildScheduledEvent.ts';
|
||||
import type {
|
||||
APIGuildScheduledEvent,
|
||||
GuildScheduledEventEntityType,
|
||||
GuildScheduledEventStatus,
|
||||
} from './guildScheduledEvent.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
|
||||
@@ -47,6 +51,12 @@ export interface APIAuditLog {
|
||||
* See https://discord.com/developers/docs/resources/guild#integration-object
|
||||
*/
|
||||
integrations: APIGuildIntegration[];
|
||||
/**
|
||||
* The guild scheduled events in the audit log
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object
|
||||
*/
|
||||
guild_scheduled_events: APIGuildScheduledEvent[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -310,7 +320,8 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKeyGuildId
|
||||
| APIAuditLogChangeKeyEntityType
|
||||
| APIAuditLogChangeKeyStatus
|
||||
| APIAuditLogChangeKeyLocation;
|
||||
| APIAuditLogChangeKeyLocation
|
||||
| APIAuditLogChangeKeyCommunicationDisabledUntil;
|
||||
|
||||
/**
|
||||
* Returned when an entity's name is changed
|
||||
@@ -634,7 +645,12 @@ export type APIAuditLogChangeKeyStatus = AuditLogChangeData<'status', GuildSched
|
||||
*/
|
||||
export type APIAuditLogChangeKeyLocation = AuditLogChangeData<'location', string>;
|
||||
|
||||
interface AuditLogChangeData<K extends string, D extends unknown> {
|
||||
/**
|
||||
* Returned when a user's timeout is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyCommunicationDisabledUntil = AuditLogChangeData<'communication_disabled_until', string>;
|
||||
|
||||
interface AuditLogChangeData<K extends string, D> {
|
||||
key: K;
|
||||
/**
|
||||
* The new value
|
||||
|
||||
@@ -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[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -648,6 +652,10 @@ export interface APIGuildMember {
|
||||
* *If this field is not present, it can be assumed as `false`.*
|
||||
*/
|
||||
pending?: boolean;
|
||||
/**
|
||||
* Timestamp of when the time out will be removed; until then, they cannot interact with the guild
|
||||
*/
|
||||
communication_disabled_until?: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { APIUser } from './user.ts';
|
||||
import type { APIGuildMember } from './guild.ts';
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
|
||||
export interface APIGuildScheduledEvent {
|
||||
interface APIGuildScheduledEventBase<Type extends GuildScheduledEventEntityType> {
|
||||
/**
|
||||
* The id of the guild event
|
||||
*/
|
||||
@@ -17,7 +18,7 @@ export interface APIGuildScheduledEvent {
|
||||
/**
|
||||
* The id of the user that created the scheduled event
|
||||
*/
|
||||
creator_id: Snowflake | null;
|
||||
creator_id?: Snowflake | null;
|
||||
/**
|
||||
* The name of the scheduled event
|
||||
*/
|
||||
@@ -45,7 +46,7 @@ export interface APIGuildScheduledEvent {
|
||||
/**
|
||||
* The type of hosting entity associated with the scheduled event
|
||||
*/
|
||||
entity_type: GuildScheduledEventEntityType;
|
||||
entity_type: Type;
|
||||
/**
|
||||
* The id of the hosting entity associated with the scheduled event
|
||||
*/
|
||||
@@ -53,7 +54,7 @@ export interface APIGuildScheduledEvent {
|
||||
/**
|
||||
* The entity metadata for the scheduled event
|
||||
*/
|
||||
entity_metadata: APIGuildScheduledEventEntityMetadata;
|
||||
entity_metadata: APIGuildScheduledEventEntityMetadata | null;
|
||||
/**
|
||||
* The user that created the scheduled event
|
||||
*/
|
||||
@@ -62,8 +63,37 @@ export interface APIGuildScheduledEvent {
|
||||
* 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
|
||||
extends APIGuildScheduledEventBase<GuildScheduledEventEntityType.StageInstance> {
|
||||
channel_id: Snowflake;
|
||||
entity_metadata: null;
|
||||
}
|
||||
|
||||
export interface APIVoiceGuildScheduledEvent extends APIGuildScheduledEventBase<GuildScheduledEventEntityType.Voice> {
|
||||
channel_id: Snowflake;
|
||||
entity_metadata: null;
|
||||
}
|
||||
|
||||
export interface APIExternalGuildScheduledEvent
|
||||
extends APIGuildScheduledEventBase<GuildScheduledEventEntityType.External> {
|
||||
channel_id: null;
|
||||
entity_metadata: Required<APIGuildScheduledEventEntityMetadata>;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-structure
|
||||
*/
|
||||
export type APIGuildScheduledEvent =
|
||||
| APIStageInstanceGuildScheduledEvent
|
||||
| APIVoiceGuildScheduledEvent
|
||||
| APIExternalGuildScheduledEvent;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata
|
||||
*/
|
||||
@@ -102,3 +132,21 @@ export enum GuildScheduledEventPrivacyLevel {
|
||||
*/
|
||||
GuildOnly = 2,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object-guild-scheduled-event-user-structure
|
||||
*/
|
||||
export interface APIGuildScheduledEventUser {
|
||||
/**
|
||||
* The scheduled event id which the user subscribed to
|
||||
*/
|
||||
guild_scheduled_event_id: Snowflake;
|
||||
/**
|
||||
* The user which subscribed to the event
|
||||
*/
|
||||
user: APIUser;
|
||||
/**
|
||||
* The guild member data for this user for the guild which this event belongs to, if any
|
||||
*/
|
||||
member?: APIGuildMember;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -28,7 +28,7 @@ export interface APIInvite {
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#channel-object
|
||||
*/
|
||||
channel: Required<APIPartialChannel>;
|
||||
channel: Required<APIPartialChannel> | null;
|
||||
/**
|
||||
* The user who created the invite
|
||||
*
|
||||
|
||||
@@ -40,6 +40,12 @@ export enum OAuth2Scopes {
|
||||
* See https://discord.com/developers/docs/resources/guild#add-guild-member
|
||||
*/
|
||||
GuildsJoin = 'guilds.join',
|
||||
/**
|
||||
* Allows /users/@me/guilds/{guild.id}/member to return a user's member information in a guild
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/guild#get-current-user-guild-member
|
||||
*/
|
||||
GuildsMembersRead = 'guilds.members.read',
|
||||
/**
|
||||
* Allows your app to join users to a group dm
|
||||
*
|
||||
|
||||
@@ -48,6 +48,7 @@ export const PermissionFlagsBits = {
|
||||
ManageEvents: 1n << 33n,
|
||||
UseExternalStickers: 1n << 37n,
|
||||
StartEmbeddedActivities: 1n << 39n,
|
||||
ModerateMembers: 1n << 40n,
|
||||
} as const;
|
||||
|
||||
/**
|
||||
|
||||
@@ -93,7 +93,7 @@ export enum StickerFormatType {
|
||||
export type APIStickerItem = Pick<APISticker, 'id' | 'name' | 'format_type'>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/sticker#sticker-object
|
||||
* https://discord.com/developers/docs/resources/sticker#sticker-pack-object
|
||||
*/
|
||||
export interface APIStickerPack {
|
||||
/**
|
||||
@@ -123,5 +123,5 @@ export interface APIStickerPack {
|
||||
/**
|
||||
* ID of the sticker pack's banner image
|
||||
*/
|
||||
banner_asset_id: Snowflake;
|
||||
banner_asset_id?: Snowflake;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
>;
|
||||
@@ -0,0 +1,26 @@
|
||||
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export interface APIApplicationCommandOptionBase<Type extends ApplicationCommandOptionType> {
|
||||
type: Type;
|
||||
name: string;
|
||||
description: string;
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
export interface APIInteractionDataOptionBase<T extends ApplicationCommandOptionType, D> {
|
||||
name: string;
|
||||
type: T;
|
||||
value: D;
|
||||
}
|
||||
|
||||
export type APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
|
||||
Base extends APIApplicationCommandOptionBase<ApplicationCommandOptionType>,
|
||||
ChoiceType extends APIApplicationCommandOptionChoice,
|
||||
> =
|
||||
| (Base & {
|
||||
autocomplete: true;
|
||||
})
|
||||
| (Base & {
|
||||
autocomplete?: false;
|
||||
choices?: ChoiceType[];
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export type APIApplicationCommandBooleanOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.Boolean>;
|
||||
|
||||
export type APIApplicationCommandInteractionDataBooleanOption = APIInteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Boolean,
|
||||
boolean
|
||||
>;
|
||||
@@ -0,0 +1,14 @@
|
||||
import type { Snowflake } from '../../../../../globals.ts';
|
||||
import type { ChannelType } from '../../../channel.ts';
|
||||
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export interface APIApplicationCommandChannelOption
|
||||
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Channel> {
|
||||
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
|
||||
}
|
||||
|
||||
export type APIApplicationCommandInteractionDataChannelOption = APIInteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Channel,
|
||||
Snowflake
|
||||
>;
|
||||
@@ -0,0 +1,28 @@
|
||||
import type {
|
||||
APIApplicationCommandOptionBase,
|
||||
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
|
||||
APIInteractionDataOptionBase,
|
||||
} from './base.ts';
|
||||
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
interface APIApplicationCommandIntegerOptionBase
|
||||
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Integer> {
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
max_value?: number;
|
||||
}
|
||||
|
||||
export type APIApplicationCommandIntegerOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
|
||||
APIApplicationCommandIntegerOptionBase,
|
||||
APIApplicationCommandOptionChoice<number>
|
||||
>;
|
||||
|
||||
export interface APIApplicationCommandInteractionDataIntegerOption
|
||||
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
|
||||
focused?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { Snowflake } from '../../../../../globals.ts';
|
||||
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export type APIApplicationCommandMentionableOption =
|
||||
APIApplicationCommandOptionBase<ApplicationCommandOptionType.Mentionable>;
|
||||
|
||||
export type APIApplicationCommandInteractionDataMentionableOption = APIInteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Mentionable,
|
||||
Snowflake
|
||||
>;
|
||||
@@ -0,0 +1,28 @@
|
||||
import type {
|
||||
APIApplicationCommandOptionBase,
|
||||
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
|
||||
APIInteractionDataOptionBase,
|
||||
} from './base.ts';
|
||||
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
interface APIApplicationCommandNumberOptionBase
|
||||
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Number> {
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
max_value?: number;
|
||||
}
|
||||
|
||||
export type APIApplicationCommandNumberOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
|
||||
APIApplicationCommandNumberOptionBase,
|
||||
APIApplicationCommandOptionChoice<number>
|
||||
>;
|
||||
|
||||
export interface APIApplicationCommandInteractionDataNumberOption
|
||||
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
|
||||
focused?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { Snowflake } from '../../../../../globals.ts';
|
||||
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export type APIApplicationCommandRoleOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.Role>;
|
||||
|
||||
export type APIApplicationCommandInteractionDataRoleOption = APIInteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Role,
|
||||
Snowflake
|
||||
>;
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
|
||||
*/
|
||||
export enum ApplicationCommandOptionType {
|
||||
Subcommand = 1,
|
||||
SubcommandGroup,
|
||||
String,
|
||||
Integer,
|
||||
Boolean,
|
||||
User,
|
||||
Channel,
|
||||
Role,
|
||||
Mentionable,
|
||||
Number,
|
||||
Attachment,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
|
||||
*/
|
||||
export interface APIApplicationCommandOptionChoice<ValueType = string | number> {
|
||||
name: string;
|
||||
value: ValueType;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import type {
|
||||
APIApplicationCommandOptionBase,
|
||||
APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper,
|
||||
APIInteractionDataOptionBase,
|
||||
} from './base.ts';
|
||||
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export type APIApplicationCommandStringOption = APIApplicationCommandOptionWithAutocompleteOrChoicesWrapper<
|
||||
APIApplicationCommandOptionBase<ApplicationCommandOptionType.String>,
|
||||
APIApplicationCommandOptionChoice<string>
|
||||
>;
|
||||
|
||||
export interface APIApplicationCommandInteractionDataStringOption
|
||||
extends APIInteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
|
||||
focused?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import type { APIApplicationCommandBasicOption, APIApplicationCommandInteractionDataBasicOption } from '../chatInput.ts';
|
||||
import type { APIApplicationCommandOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export interface APIApplicationCommandSubcommandOption
|
||||
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Subcommand> {
|
||||
options?: APIApplicationCommandBasicOption[];
|
||||
}
|
||||
|
||||
export interface APIApplicationCommandInteractionDataSubcommandOption {
|
||||
name: string;
|
||||
type: ApplicationCommandOptionType.Subcommand;
|
||||
options?: APIApplicationCommandInteractionDataBasicOption[];
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { APIApplicationCommandOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
import type {
|
||||
APIApplicationCommandInteractionDataSubcommandOption,
|
||||
APIApplicationCommandSubcommandOption,
|
||||
} from './subcommand.ts';
|
||||
|
||||
export interface APIApplicationCommandSubcommandGroupOption
|
||||
extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.SubcommandGroup> {
|
||||
options?: APIApplicationCommandSubcommandOption[];
|
||||
}
|
||||
|
||||
export interface APIApplicationCommandInteractionDataSubcommandGroupOption {
|
||||
name: string;
|
||||
type: ApplicationCommandOptionType.SubcommandGroup;
|
||||
options: APIApplicationCommandInteractionDataSubcommandOption[];
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { Snowflake } from '../../../../../globals.ts';
|
||||
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
|
||||
import type { ApplicationCommandOptionType } from './shared.ts';
|
||||
|
||||
export type APIApplicationCommandUserOption = APIApplicationCommandOptionBase<ApplicationCommandOptionType.User>;
|
||||
|
||||
export type APIApplicationCommandInteractionDataUserOption = APIInteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.User,
|
||||
Snowflake
|
||||
>;
|
||||
@@ -1,228 +1,112 @@
|
||||
import type { APIRole, APIUser, ChannelType } from '../../mod.ts';
|
||||
import type { Snowflake } from '../../../../globals.ts';
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
|
||||
import type { APIAttachment, APIRole, APIUser } from '../../mod.ts';
|
||||
import type {
|
||||
APIApplicationCommandInteractionWrapper,
|
||||
APIInteractionDataResolvedChannel,
|
||||
APIInteractionDataResolvedGuildMember,
|
||||
ApplicationCommandType,
|
||||
} from '../applicationCommands.ts';
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
|
||||
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
|
||||
|
||||
interface APIApplicationCommandOptionBase {
|
||||
type:
|
||||
| ApplicationCommandOptionType.Boolean
|
||||
| ApplicationCommandOptionType.User
|
||||
| ApplicationCommandOptionType.Role
|
||||
| ApplicationCommandOptionType.Mentionable;
|
||||
name: string;
|
||||
description: string;
|
||||
required?: boolean;
|
||||
autocomplete?: never;
|
||||
}
|
||||
import type {
|
||||
APIApplicationCommandStringOption,
|
||||
APIApplicationCommandInteractionDataStringOption,
|
||||
} from './_chatInput/string.ts';
|
||||
import type {
|
||||
APIApplicationCommandIntegerOption,
|
||||
APIApplicationCommandInteractionDataIntegerOption,
|
||||
} from './_chatInput/integer.ts';
|
||||
import type {
|
||||
APIApplicationCommandBooleanOption,
|
||||
APIApplicationCommandInteractionDataBooleanOption,
|
||||
} from './_chatInput/boolean.ts';
|
||||
import type {
|
||||
APIApplicationCommandUserOption,
|
||||
APIApplicationCommandInteractionDataUserOption,
|
||||
} from './_chatInput/user.ts';
|
||||
import type {
|
||||
APIApplicationCommandChannelOption,
|
||||
APIApplicationCommandInteractionDataChannelOption,
|
||||
} from './_chatInput/channel.ts';
|
||||
import type {
|
||||
APIApplicationCommandRoleOption,
|
||||
APIApplicationCommandInteractionDataRoleOption,
|
||||
} from './_chatInput/role.ts';
|
||||
import type {
|
||||
APIApplicationCommandMentionableOption,
|
||||
APIApplicationCommandInteractionDataMentionableOption,
|
||||
} from './_chatInput/mentionable.ts';
|
||||
import type {
|
||||
APIApplicationCommandNumberOption,
|
||||
APIApplicationCommandInteractionDataNumberOption,
|
||||
} from './_chatInput/number.ts';
|
||||
import type {
|
||||
APIApplicationCommandAttachmentOption,
|
||||
APIApplicationCommandInteractionDataAttachmentOption,
|
||||
} from './_chatInput/attachment.ts';
|
||||
import type {
|
||||
APIApplicationCommandSubcommandOption,
|
||||
APIApplicationCommandInteractionDataSubcommandOption,
|
||||
} from './_chatInput/subcommand.ts';
|
||||
import type {
|
||||
APIApplicationCommandSubcommandGroupOption,
|
||||
APIApplicationCommandInteractionDataSubcommandGroupOption,
|
||||
} from './_chatInput/subcommandGroup.ts';
|
||||
|
||||
export * from './_chatInput/string.ts';
|
||||
export * from './_chatInput/integer.ts';
|
||||
export * from './_chatInput/boolean.ts';
|
||||
export * from './_chatInput/user.ts';
|
||||
export * from './_chatInput/channel.ts';
|
||||
export * from './_chatInput/role.ts';
|
||||
export * from './_chatInput/mentionable.ts';
|
||||
export * from './_chatInput/number.ts';
|
||||
export * from './_chatInput/attachment.ts';
|
||||
export * from './_chatInput/subcommand.ts';
|
||||
export * from './_chatInput/subcommandGroup.ts';
|
||||
export * from './_chatInput/shared.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||
*/
|
||||
export type APIApplicationCommandBasicOption =
|
||||
| APIApplicationCommandStringOption
|
||||
| APIApplicationCommandIntegerOption
|
||||
| APIApplicationCommandBooleanOption
|
||||
| APIApplicationCommandUserOption
|
||||
| APIApplicationCommandChannelOption
|
||||
| APIApplicationCommandRoleOption
|
||||
| APIApplicationCommandMentionableOption
|
||||
| APIApplicationCommandNumberOption
|
||||
| APIApplicationCommandAttachmentOption;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure
|
||||
*/
|
||||
export type APIApplicationCommandOption =
|
||||
| APIApplicationCommandStringArgumentOptions
|
||||
| APIApplicationCommandSubCommandOptions
|
||||
| APIApplicationCommandOptionBase
|
||||
| APIApplicationCommandChannelOptions
|
||||
| APIApplicationCommandOptionBase
|
||||
| APIApplicationCommandNumberArgumentOptions
|
||||
| APIApplicationCommandStringAutocompleteOptions
|
||||
| APIApplicationCommandNumericAutocompleteOptions;
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* If the option is a `SUB_COMMAND` or `SUB_COMMAND_GROUP` type, this nested options will be the parameters
|
||||
*/
|
||||
export interface APIApplicationCommandSubCommandOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
|
||||
type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
|
||||
options?: APIApplicationCommandOption[];
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
|
||||
* but they can have a either a `choices` or a `autocomplete` field where it's set to false.
|
||||
*/
|
||||
export interface APIApplicationCommandStringArgumentOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type:
|
||||
| ApplicationCommandOptionType.String
|
||||
| ApplicationCommandOptionType.Integer
|
||||
| ApplicationCommandOptionType.Number;
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
autocomplete?: false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
|
||||
* but they can a `autocomplete` field where it's set to `true`
|
||||
*/
|
||||
export interface APIApplicationCommandStringAutocompleteOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type: ApplicationCommandOptionType.String;
|
||||
autocomplete: true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandArgumentOptions`, these types cannot have an `choices` array,
|
||||
* but they can a `autocomplete` field where it's set to `true`
|
||||
*/
|
||||
export interface APIApplicationCommandNumericAutocompleteOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
|
||||
autocomplete: true;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
max_value?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions`, these types cannot have an `options` array,
|
||||
* but they can have a `choices`, a `min_value` and `max_value` field
|
||||
*/
|
||||
export interface APIApplicationCommandNumberArgumentOptions
|
||||
extends Omit<APIApplicationCommandOptionBase, 'type' | 'autocomplete'> {
|
||||
type: ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
/**
|
||||
* If the option is an `INTEGER` or `NUMBER` type, the minimum value permitted.
|
||||
*/
|
||||
min_value?: number;
|
||||
/**
|
||||
* if the option is an `INTEGER` or `NUMBER` type, the maximum value permitted
|
||||
*/
|
||||
max_value?: number;
|
||||
autocomplete?: false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This type is exported as a way to make it stricter for you when you're writing your commands
|
||||
*
|
||||
* In contrast to `APIApplicationCommandSubCommandOptions` and `APIApplicationCommandArgumentOptions`,
|
||||
* these types cannot have an `options` array, or a `choices` array, but they can have a `channel_types` one.
|
||||
*/
|
||||
export interface APIApplicationCommandChannelOptions extends Omit<APIApplicationCommandOptionBase, 'type'> {
|
||||
type: ApplicationCommandOptionType.Channel;
|
||||
channel_types?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
|
||||
*/
|
||||
export enum ApplicationCommandOptionType {
|
||||
Subcommand = 1,
|
||||
SubcommandGroup,
|
||||
String,
|
||||
Integer,
|
||||
Boolean,
|
||||
User,
|
||||
Channel,
|
||||
Role,
|
||||
Mentionable,
|
||||
Number,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure
|
||||
*/
|
||||
export interface APIApplicationCommandOptionChoice {
|
||||
name: string;
|
||||
value: string | number;
|
||||
}
|
||||
| APIApplicationCommandSubcommandOption
|
||||
| APIApplicationCommandSubcommandGroupOption
|
||||
| APIApplicationCommandBasicOption;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure
|
||||
*/
|
||||
export type APIApplicationCommandInteractionDataOption =
|
||||
| ApplicationCommandInteractionDataOptionSubCommand
|
||||
| ApplicationCommandInteractionDataOptionSubCommandGroup
|
||||
| APIApplicationCommandInteractionDataOptionWithValues;
|
||||
| APIApplicationCommandInteractionDataSubcommandOption
|
||||
| APIApplicationCommandInteractionDataSubcommandGroupOption
|
||||
| APIApplicationCommandInteractionDataBasicOption;
|
||||
|
||||
export interface ApplicationCommandInteractionDataOptionSubCommand {
|
||||
name: string;
|
||||
type: ApplicationCommandOptionType.Subcommand;
|
||||
options?: APIApplicationCommandInteractionDataOptionWithValues[];
|
||||
}
|
||||
|
||||
export interface ApplicationCommandInteractionDataOptionSubCommandGroup {
|
||||
name: string;
|
||||
type: ApplicationCommandOptionType.SubcommandGroup;
|
||||
options: ApplicationCommandInteractionDataOptionSubCommand[];
|
||||
}
|
||||
|
||||
export type APIApplicationCommandInteractionDataOptionWithValues =
|
||||
| ApplicationCommandInteractionDataOptionString
|
||||
| ApplicationCommandInteractionDataOptionRole
|
||||
| ApplicationCommandInteractionDataOptionChannel
|
||||
| ApplicationCommandInteractionDataOptionUser
|
||||
| ApplicationCommandInteractionDataOptionMentionable
|
||||
| ApplicationCommandInteractionDataOptionInteger
|
||||
| ApplicationCommandInteractionDataOptionNumber
|
||||
| ApplicationCommandInteractionDataOptionBoolean;
|
||||
|
||||
export interface ApplicationCommandInteractionDataOptionString
|
||||
extends InteractionDataOptionBase<ApplicationCommandOptionType.String, string> {
|
||||
focused?: boolean;
|
||||
}
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionRole = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Role,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionChannel = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Channel,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionUser = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.User,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionMentionable = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Mentionable,
|
||||
Snowflake
|
||||
>;
|
||||
|
||||
export interface ApplicationCommandInteractionDataOptionInteger
|
||||
extends InteractionDataOptionBase<ApplicationCommandOptionType.Integer, number> {
|
||||
focused?: boolean;
|
||||
}
|
||||
|
||||
export interface ApplicationCommandInteractionDataOptionNumber
|
||||
extends InteractionDataOptionBase<ApplicationCommandOptionType.Number, number> {
|
||||
focused?: boolean;
|
||||
}
|
||||
|
||||
export type ApplicationCommandInteractionDataOptionBoolean = InteractionDataOptionBase<
|
||||
ApplicationCommandOptionType.Boolean,
|
||||
boolean
|
||||
>;
|
||||
|
||||
interface InteractionDataOptionBase<T extends ApplicationCommandOptionType, D = unknown> {
|
||||
name: string;
|
||||
type: T;
|
||||
value: D;
|
||||
}
|
||||
export type APIApplicationCommandInteractionDataBasicOption =
|
||||
| APIApplicationCommandInteractionDataStringOption
|
||||
| APIApplicationCommandInteractionDataIntegerOption
|
||||
| APIApplicationCommandInteractionDataBooleanOption
|
||||
| APIApplicationCommandInteractionDataUserOption
|
||||
| APIApplicationCommandInteractionDataChannelOption
|
||||
| APIApplicationCommandInteractionDataRoleOption
|
||||
| APIApplicationCommandInteractionDataMentionableOption
|
||||
| APIApplicationCommandInteractionDataNumberOption
|
||||
| APIApplicationCommandInteractionDataAttachmentOption;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure
|
||||
@@ -241,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,7 +57,7 @@ export interface APIInteractionGuildMember extends APIGuildMember {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export interface APIBaseInteraction<Type extends InteractionType, Data extends unknown> {
|
||||
export interface APIBaseInteraction<Type extends InteractionType, Data> {
|
||||
/**
|
||||
* ID of the interaction
|
||||
*/
|
||||
@@ -86,6 +104,14 @@ export interface APIBaseInteraction<Type extends InteractionType, Data extends u
|
||||
* 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>[];
|
||||
}
|
||||
|
||||
@@ -97,6 +97,7 @@ export interface APIApplication {
|
||||
* https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
export enum ApplicationFlags {
|
||||
EmbeddedReleased = 1 << 1,
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
@@ -108,4 +109,5 @@ export enum ApplicationFlags {
|
||||
Embedded = 1 << 17,
|
||||
GatewayMessageContent = 1 << 18,
|
||||
GatewayMessageContentLimited = 1 << 19,
|
||||
EmbeddedFirstParty = 1 << 20,
|
||||
}
|
||||
|
||||
@@ -17,7 +17,11 @@ import type { StickerFormatType } from './sticker.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
import type { APIWebhook } from './webhook.ts';
|
||||
import type { StageInstancePrivacyLevel } from './stageInstance.ts';
|
||||
import type { GuildScheduledEventEntityType, GuildScheduledEventStatus } from './guildScheduledEvent.ts';
|
||||
import type {
|
||||
APIGuildScheduledEvent,
|
||||
GuildScheduledEventEntityType,
|
||||
GuildScheduledEventStatus,
|
||||
} from './guildScheduledEvent.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure
|
||||
@@ -55,6 +59,12 @@ export interface APIAuditLog {
|
||||
* See https://discord.com/developers/docs/resources/channel#channel-object
|
||||
*/
|
||||
threads: APIChannel[];
|
||||
/**
|
||||
* The guild scheduled events in the audit log
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object
|
||||
*/
|
||||
guild_scheduled_events: APIGuildScheduledEvent[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -326,7 +336,8 @@ export type APIAuditLogChange =
|
||||
| APIAuditLogChangeKeyDefaultAutoArchiveDuration
|
||||
| APIAuditLogChangeKeyEntityType
|
||||
| APIAuditLogChangeKeyStatus
|
||||
| APIAuditLogChangeKeyLocation;
|
||||
| APIAuditLogChangeKeyLocation
|
||||
| APIAuditLogChangeKeyCommunicationDisabledUntil;
|
||||
|
||||
/**
|
||||
* Returned when an entity's name is changed
|
||||
@@ -673,7 +684,12 @@ export type APIAuditLogChangeKeyStatus = AuditLogChangeData<'status', GuildSched
|
||||
*/
|
||||
export type APIAuditLogChangeKeyLocation = AuditLogChangeData<'location', string>;
|
||||
|
||||
interface AuditLogChangeData<K extends string, D extends unknown> {
|
||||
/**
|
||||
* Returned when a user's timeout is changed
|
||||
*/
|
||||
export type APIAuditLogChangeKeyCommunicationDisabledUntil = AuditLogChangeData<'communication_disabled_until', string>;
|
||||
|
||||
interface AuditLogChangeData<K extends string, D> {
|
||||
key: K;
|
||||
/**
|
||||
* The new value
|
||||
|
||||
@@ -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[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -656,6 +660,10 @@ export interface APIGuildMember {
|
||||
* *If this field is not present, it can be assumed as `false`.*
|
||||
*/
|
||||
pending?: boolean;
|
||||
/**
|
||||
* Timestamp of when the time out will be removed; until then, they cannot interact with the guild
|
||||
*/
|
||||
communication_disabled_until?: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { APIUser } from './user.ts';
|
||||
import type { APIGuildMember } from './guild.ts';
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
|
||||
export interface APIGuildScheduledEvent {
|
||||
interface APIGuildScheduledEventBase<Type extends GuildScheduledEventEntityType> {
|
||||
/**
|
||||
* The id of the guild event
|
||||
*/
|
||||
@@ -17,7 +18,7 @@ export interface APIGuildScheduledEvent {
|
||||
/**
|
||||
* The id of the user that created the scheduled event
|
||||
*/
|
||||
creator_id: Snowflake | null;
|
||||
creator_id?: Snowflake | null;
|
||||
/**
|
||||
* The name of the scheduled event
|
||||
*/
|
||||
@@ -45,7 +46,7 @@ export interface APIGuildScheduledEvent {
|
||||
/**
|
||||
* The type of hosting entity associated with the scheduled event
|
||||
*/
|
||||
entity_type: GuildScheduledEventEntityType;
|
||||
entity_type: Type;
|
||||
/**
|
||||
* The id of the hosting entity associated with the scheduled event
|
||||
*/
|
||||
@@ -53,7 +54,7 @@ export interface APIGuildScheduledEvent {
|
||||
/**
|
||||
* The entity metadata for the scheduled event
|
||||
*/
|
||||
entity_metadata: APIGuildScheduledEventEntityMetadata;
|
||||
entity_metadata: APIGuildScheduledEventEntityMetadata | null;
|
||||
/**
|
||||
* The user that created the scheduled event
|
||||
*/
|
||||
@@ -62,8 +63,37 @@ export interface APIGuildScheduledEvent {
|
||||
* 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
|
||||
extends APIGuildScheduledEventBase<GuildScheduledEventEntityType.StageInstance> {
|
||||
channel_id: Snowflake;
|
||||
entity_metadata: null;
|
||||
}
|
||||
|
||||
export interface APIVoiceGuildScheduledEvent extends APIGuildScheduledEventBase<GuildScheduledEventEntityType.Voice> {
|
||||
channel_id: Snowflake;
|
||||
entity_metadata: null;
|
||||
}
|
||||
|
||||
export interface APIExternalGuildScheduledEvent
|
||||
extends APIGuildScheduledEventBase<GuildScheduledEventEntityType.External> {
|
||||
channel_id: null;
|
||||
entity_metadata: Required<APIGuildScheduledEventEntityMetadata>;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-structure
|
||||
*/
|
||||
export type APIGuildScheduledEvent =
|
||||
| APIStageInstanceGuildScheduledEvent
|
||||
| APIVoiceGuildScheduledEvent
|
||||
| APIExternalGuildScheduledEvent;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata
|
||||
*/
|
||||
@@ -102,3 +132,21 @@ export enum GuildScheduledEventPrivacyLevel {
|
||||
*/
|
||||
GuildOnly = 2,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object-guild-scheduled-event-user-structure
|
||||
*/
|
||||
export interface APIGuildScheduledEventUser {
|
||||
/**
|
||||
* The scheduled event id which the user subscribed to
|
||||
*/
|
||||
guild_scheduled_event_id: Snowflake;
|
||||
/**
|
||||
* The user which subscribed to the event
|
||||
*/
|
||||
user: APIUser;
|
||||
/**
|
||||
* The guild member data for this user for the guild which this event belongs to, if any
|
||||
*/
|
||||
member?: APIGuildMember;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -28,7 +28,7 @@ export interface APIInvite {
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#channel-object
|
||||
*/
|
||||
channel: Required<APIPartialChannel>;
|
||||
channel: Required<APIPartialChannel> | null;
|
||||
/**
|
||||
* The user who created the invite
|
||||
*
|
||||
|
||||
@@ -40,6 +40,12 @@ export enum OAuth2Scopes {
|
||||
* See https://discord.com/developers/docs/resources/guild#add-guild-member
|
||||
*/
|
||||
GuildsJoin = 'guilds.join',
|
||||
/**
|
||||
* Allows /users/@me/guilds/{guild.id}/member to return a user's member information in a guild
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/guild#get-current-user-guild-member
|
||||
*/
|
||||
GuildsMembersRead = 'guilds.members.read',
|
||||
/**
|
||||
* Allows your app to join users to a group dm
|
||||
*
|
||||
|
||||
@@ -52,6 +52,7 @@ export const PermissionFlagsBits = {
|
||||
UseExternalStickers: 1n << 37n,
|
||||
SendMessagesInThreads: 1n << 38n,
|
||||
StartEmbeddedActivities: 1n << 39n,
|
||||
ModerateMembers: 1n << 40n,
|
||||
} as const;
|
||||
|
||||
/**
|
||||
|
||||
@@ -93,7 +93,7 @@ export enum StickerFormatType {
|
||||
export type APIStickerItem = Pick<APISticker, 'id' | 'name' | 'format_type'>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/sticker#sticker-object
|
||||
* https://discord.com/developers/docs/resources/sticker#sticker-pack-object
|
||||
*/
|
||||
export interface APIStickerPack {
|
||||
/**
|
||||
@@ -123,5 +123,5 @@ export interface APIStickerPack {
|
||||
/**
|
||||
* ID of the sticker pack's banner image
|
||||
*/
|
||||
banner_asset_id: Snowflake;
|
||||
banner_asset_id?: Snowflake;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,6 +68,7 @@ export enum RESTJSONErrorCodes {
|
||||
AnnouncementEditLimitExceeded = 20022,
|
||||
|
||||
ChannelSendRateLimit = 20028,
|
||||
ServerSendRateLimit,
|
||||
|
||||
StageTopicServerNameServerDescriptionOrChannelNamesContainDisallowedWords = 20031,
|
||||
|
||||
@@ -106,11 +107,15 @@ export enum RESTJSONErrorCodes {
|
||||
MaximumNumberOfStickersReached = 30039,
|
||||
MaximumNumberOfPruneRequestsHasBeenReached,
|
||||
|
||||
MaximumNumberOfGuildWidgetSettingsUpdatesHasBeenReached = 30042,
|
||||
|
||||
MaxmimumNumberOfEditsToMessagesOlderThanOneHourReached = 30046,
|
||||
|
||||
Unauthorized = 40001,
|
||||
VerifyYourAccount,
|
||||
OpeningDirectMessagesTooFast,
|
||||
|
||||
RequestEntityTooLarge = 40005,
|
||||
SendMessagesHasBeenTemporarilyDisabled,
|
||||
RequestEntityTooLarge,
|
||||
FeatureTemporarilyDisabledServerSide,
|
||||
UserBannedFromThisGuild,
|
||||
|
||||
@@ -119,6 +124,8 @@ export enum RESTJSONErrorCodes {
|
||||
|
||||
ApplicationCommandWithThatNameAlreadyExists = 40041,
|
||||
|
||||
InteractionHasAlreadyBeenAcknowledged = 40060,
|
||||
|
||||
MissingAccess = 50001,
|
||||
InvalidAccountType,
|
||||
CannotExecuteActionOnDMChannel,
|
||||
@@ -158,6 +165,9 @@ export enum RESTJSONErrorCodes {
|
||||
InvalidFileUploaded,
|
||||
|
||||
CannotSelfRedeemThisGift = 50054,
|
||||
InvalidGuild,
|
||||
|
||||
InvalidMessageType = 50068,
|
||||
|
||||
PaymentSourceRequiredToRedeemGift = 50070,
|
||||
|
||||
@@ -168,6 +178,7 @@ export enum RESTJSONErrorCodes {
|
||||
InvalidActionOnArchivedThread = 50083,
|
||||
InvalidThreadNotificationSettings,
|
||||
ParameterEarlierThanCreation,
|
||||
CommunityServerChannelsMustBeTextChannels,
|
||||
|
||||
ServerNotAvailableInYourLocation = 50095,
|
||||
|
||||
@@ -175,6 +186,8 @@ export enum RESTJSONErrorCodes {
|
||||
|
||||
ServerNeedsMoreBoostsToPerformThisAction = 50101,
|
||||
|
||||
RequestBodyContainsInvalidJSON = 50109,
|
||||
|
||||
TwoFactorAuthenticationIsRequired = 60003,
|
||||
|
||||
NoUsersWithDiscordTagExist = 80004,
|
||||
@@ -204,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,14 +9,19 @@ 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
|
||||
@@ -26,7 +31,7 @@ export type RESTGetAPIChannelResult = APIChannel;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#modify-channel
|
||||
*/
|
||||
export interface RESTPatchAPIChannelJSONBody {
|
||||
export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* 1-100 character channel name
|
||||
*
|
||||
@@ -84,7 +89,7 @@ export interface RESTPatchAPIChannelJSONBody {
|
||||
*
|
||||
* Channel types: all
|
||||
*/
|
||||
permission_overwrites?: APIOverwrite[] | null;
|
||||
permission_overwrites?: APIChannelPatchOverwrite[] | null;
|
||||
/**
|
||||
* ID of the new parent category for a channel
|
||||
*
|
||||
@@ -103,7 +108,7 @@ export interface RESTPatchAPIChannelJSONBody {
|
||||
* See https://discord.com/developers/docs/resources/channel#channel-object-video-quality-modes
|
||||
*/
|
||||
video_quality_mode?: VideoQualityMode | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#modify-channel
|
||||
@@ -152,20 +157,21 @@ export type RESTGetAPIChannelMessageResult = APIMessage;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
|
||||
*/
|
||||
export type APIMessageReferenceSend = Partial<APIMessageReference> &
|
||||
Required<Pick<APIMessageReference, 'message_id'>> & {
|
||||
export type APIMessageReferenceSend = StrictPartial<APIMessageReference> &
|
||||
Required<Pick<APIMessageReference, 'message_id'>> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
fail_if_not_exists?: boolean;
|
||||
};
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#create-message
|
||||
*/
|
||||
export interface RESTPostAPIChannelMessageJSONBody {
|
||||
export type RESTPostAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The message contents (up to 2000 characters)
|
||||
*/
|
||||
@@ -188,6 +194,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
|
||||
* Embedded `rich` content
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
* @deprecated Use `embeds` instead
|
||||
*/
|
||||
embed?: APIEmbed;
|
||||
/**
|
||||
@@ -207,7 +214,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@@ -218,7 +225,11 @@ export interface RESTPostAPIChannelMessageJSONBody {
|
||||
* Attachment objects with filename and description
|
||||
*/
|
||||
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[];
|
||||
}
|
||||
/**
|
||||
* Message flags combined as a bitfield
|
||||
*/
|
||||
flags?: MessageFlags;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#create-message
|
||||
@@ -291,7 +302,7 @@ export type RESTDeleteAPIChannelMessageReactionResult = never;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
*/
|
||||
export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
export type RESTPatchAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The new message contents (up to 2000 characters)
|
||||
*/
|
||||
@@ -331,14 +342,14 @@ export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: APIAttachment[] | null;
|
||||
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[];
|
||||
/**
|
||||
* The components to include with the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[] | null;
|
||||
}
|
||||
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
@@ -351,6 +362,7 @@ export type RESTPatchAPIChannelMessageFormDataBody =
|
||||
payload_json?: string;
|
||||
} & Record<`files[${bigint}]`, unknown>)
|
||||
| (RESTPatchAPIChannelMessageJSONBody & Record<`files[${bigint}]`, unknown>);
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
*/
|
||||
@@ -384,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
|
||||
*/
|
||||
@@ -411,7 +427,7 @@ export type RESTGetAPIChannelInvitesResult = APIExtendedInvite[];
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#create-channel-invite
|
||||
*/
|
||||
export interface RESTPostAPIChannelInviteJSONBody {
|
||||
export type RESTPostAPIChannelInviteJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Duration of invite in seconds before expiry, or 0 for never
|
||||
*
|
||||
@@ -455,7 +471,7 @@ export interface RESTPostAPIChannelInviteJSONBody {
|
||||
* - The application must have the `EMBEDDED` flag
|
||||
*/
|
||||
target_application_id?: Snowflake;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#create-channel-invite
|
||||
@@ -505,7 +521,7 @@ export type RESTDeleteAPIChannelPinResult = never;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
|
||||
*/
|
||||
export interface RESTPutAPIChannelRecipientJSONBody {
|
||||
export type RESTPutAPIChannelRecipientJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Access token of a user that has granted your app the `gdm.join` scope
|
||||
*/
|
||||
@@ -514,7 +530,7 @@ export interface RESTPutAPIChannelRecipientJSONBody {
|
||||
* Nickname of the user being added
|
||||
*/
|
||||
nick?: string;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import type { APIEmoji } from '../../payloads/v8/mod.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/emoji#list-guild-emojis
|
||||
@@ -14,7 +15,7 @@ export type RESTGetAPIGuildEmojiResult = APIEmoji;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/emoji#create-guild-emoji-json-params
|
||||
*/
|
||||
export interface RESTPostAPIGuildEmojiJSONBody {
|
||||
export type RESTPostAPIGuildEmojiJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Name of the emoji
|
||||
*/
|
||||
@@ -29,7 +30,7 @@ export interface RESTPostAPIGuildEmojiJSONBody {
|
||||
* Roles for which this emoji will be whitelisted
|
||||
*/
|
||||
roles?: Snowflake[];
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/emoji#create-guild-emoji
|
||||
@@ -39,7 +40,7 @@ export type RESTPostAPIGuildEmojiResult = APIEmoji;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/emoji#modify-guild-emoji
|
||||
*/
|
||||
export interface RESTPatchAPIGuildEmojiJSONBody {
|
||||
export type RESTPatchAPIGuildEmojiJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Name of the emoji
|
||||
*/
|
||||
@@ -48,7 +49,7 @@ export interface RESTPatchAPIGuildEmojiJSONBody {
|
||||
* Roles for which this emoji will be whitelisted
|
||||
*/
|
||||
roles?: Snowflake[] | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/emoji#modify-guild-emoji
|
||||
|
||||
@@ -2,7 +2,9 @@ import type { Permissions, Snowflake } from '../../globals.ts';
|
||||
import type {
|
||||
APIBan,
|
||||
APIChannel,
|
||||
APIDMChannel,
|
||||
APIExtendedInvite,
|
||||
APIGroupDMChannel,
|
||||
APIGuild,
|
||||
APIGuildIntegration,
|
||||
APIGuildMember,
|
||||
@@ -20,21 +22,32 @@ import type {
|
||||
GuildVerificationLevel,
|
||||
GuildWidgetStyle,
|
||||
} from '../../payloads/v8/mod.ts';
|
||||
import type { Nullable } from '../../utils/internals.ts';
|
||||
import type {
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
|
||||
Nullable,
|
||||
StrictPartial,
|
||||
StrictRequired,
|
||||
UnionToIntersection,
|
||||
} from '../../utils/internals.ts';
|
||||
import type { RESTPutAPIChannelPermissionJSONBody } from './channel.ts';
|
||||
|
||||
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
|
||||
id: number | string;
|
||||
}
|
||||
|
||||
export type APIGuildCreatePartialChannel = Partial<
|
||||
Pick<APIChannel, 'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'>
|
||||
> & {
|
||||
name: string;
|
||||
id?: number | string;
|
||||
parent_id?: number | string | null;
|
||||
permission_overwrites?: APIGuildCreateOverwrite[];
|
||||
};
|
||||
export type APIGuildChannelResolvable = Exclude<APIChannel, APIDMChannel | APIGroupDMChannel>;
|
||||
export type APIGuildCreatePartialChannel = StrictPartial<
|
||||
Pick<
|
||||
UnionToIntersection<APIGuildChannelResolvable>,
|
||||
'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'
|
||||
>
|
||||
> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
name: string;
|
||||
id?: number | string;
|
||||
parent_id?: number | string | null;
|
||||
permission_overwrites?: APIGuildCreateOverwrite[];
|
||||
}>;
|
||||
|
||||
export interface APIGuildCreateRole extends RESTPostAPIGuildRoleJSONBody {
|
||||
id: number | string;
|
||||
@@ -43,7 +56,7 @@ export interface APIGuildCreateRole extends RESTPostAPIGuildRoleJSONBody {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild
|
||||
*/
|
||||
export interface RESTPostAPIGuildsJSONBody {
|
||||
export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Name of the guild (2-100 characters)
|
||||
*/
|
||||
@@ -126,7 +139,7 @@ export interface RESTPostAPIGuildsJSONBody {
|
||||
* Whether the boosts progress bar should be enabled.
|
||||
*/
|
||||
premium_progress_bar_enabled?: boolean;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild
|
||||
@@ -158,7 +171,7 @@ export type RESTGetAPIGuildPreviewResult = APIGuildPreview;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild
|
||||
*/
|
||||
export interface RESTPatchAPIGuildJSONBody {
|
||||
export type RESTPatchAPIGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* New name for the guild (2-100 characters)
|
||||
*/
|
||||
@@ -257,7 +270,7 @@ export interface RESTPatchAPIGuildJSONBody {
|
||||
* Whether the boosts progress bar should be enabled.
|
||||
*/
|
||||
premium_progress_bar_enabled?: boolean;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild
|
||||
@@ -287,24 +300,26 @@ export type RESTPostAPIGuildChannelResult = APIChannel;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
|
||||
*/
|
||||
export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<{
|
||||
/**
|
||||
* Channel id
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
position: number;
|
||||
/**
|
||||
* Sync channel overwrites with the new parent, when moving to a new `parent_id`
|
||||
*/
|
||||
lock_permissions?: boolean;
|
||||
/**
|
||||
* The new parent id of this channel
|
||||
*/
|
||||
parent_id?: Snowflake | null;
|
||||
}>;
|
||||
export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Channel id
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
position: number;
|
||||
/**
|
||||
* Sync channel overwrites with the new parent, when moving to a new `parent_id`
|
||||
*/
|
||||
lock_permissions?: boolean;
|
||||
/**
|
||||
* The new parent id of this channel
|
||||
*/
|
||||
parent_id?: Snowflake | null;
|
||||
}>
|
||||
>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
|
||||
@@ -360,7 +375,7 @@ export type RESTGetAPIGuildMembersSearchResult = APIGuildMember[];
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#add-guild-member
|
||||
*/
|
||||
export interface RESTPutAPIGuildMemberJSONBody {
|
||||
export type RESTPutAPIGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* An oauth2 access token granted with the `guilds.join` to the bot's application for the user you want to add to the guild
|
||||
*/
|
||||
@@ -389,14 +404,14 @@ export interface RESTPutAPIGuildMemberJSONBody {
|
||||
* Requires `DEAFEN_MEMBERS` permission
|
||||
*/
|
||||
deaf?: boolean;
|
||||
}
|
||||
}>;
|
||||
|
||||
export type RESTPutAPIGuildMemberResult = APIGuildMember | undefined;
|
||||
export type RESTPutAPIGuildMemberResult = APIGuildMember | never;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-member
|
||||
*/
|
||||
export interface RESTPatchAPIGuildMemberJSONBody {
|
||||
export type RESTPatchAPIGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Value to set users nickname to
|
||||
*
|
||||
@@ -427,7 +442,11 @@ export interface RESTPatchAPIGuildMemberJSONBody {
|
||||
* 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;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#add-guild-member
|
||||
@@ -436,20 +455,37 @@ 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 interface RESTPatchAPICurrentGuildMemberNicknameJSONBody {
|
||||
export type RESTPatchAPICurrentGuildMemberNicknameJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Value to set users nickname to
|
||||
*
|
||||
* Requires `CHANGE_NICKNAME` permission
|
||||
*/
|
||||
nick?: string | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-current-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 = Required<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
|
||||
export type RESTPatchAPICurrentGuildMemberNicknameResult =
|
||||
StrictRequired<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#add-guild-member-role
|
||||
@@ -479,7 +515,7 @@ export type RESTGetAPIGuildBanResult = APIBan;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-ban
|
||||
*/
|
||||
export interface RESTPutAPIGuildBanJSONBody {
|
||||
export type RESTPutAPIGuildBanJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Number of days to delete messages for (0-7)
|
||||
*/
|
||||
@@ -488,7 +524,7 @@ export interface RESTPutAPIGuildBanJSONBody {
|
||||
* Reason for the ban
|
||||
*/
|
||||
reason?: string;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-ban
|
||||
@@ -508,7 +544,7 @@ export type RESTGetAPIGuildRolesResult = APIRole[];
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-role
|
||||
*/
|
||||
export interface RESTPostAPIGuildRoleJSONBody {
|
||||
export type RESTPostAPIGuildRoleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Name of the role
|
||||
*
|
||||
@@ -518,7 +554,7 @@ export interface RESTPostAPIGuildRoleJSONBody {
|
||||
/**
|
||||
* Bitwise value of the enabled/disabled permissions
|
||||
*
|
||||
* @default "default role permissions in guild"
|
||||
* @default "default role permissions in guild"
|
||||
*/
|
||||
permissions?: Permissions | null;
|
||||
/**
|
||||
@@ -547,7 +583,7 @@ export interface RESTPostAPIGuildRoleJSONBody {
|
||||
* @default false
|
||||
*/
|
||||
mentionable?: boolean | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-role
|
||||
@@ -557,16 +593,18 @@ export type RESTPostAPIGuildRoleResult = APIRole;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
|
||||
*/
|
||||
export type RESTPatchAPIGuildRolePositionsJSONBody = Array<{
|
||||
/**
|
||||
* Role id
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* Sorting position of the role
|
||||
*/
|
||||
position?: number;
|
||||
}>;
|
||||
export type RESTPatchAPIGuildRolePositionsJSONBody = Array<
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Role id
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* Sorting position of the role
|
||||
*/
|
||||
position?: number;
|
||||
}>
|
||||
>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
|
||||
@@ -576,7 +614,7 @@ export type RESTPatchAPIGuildRolePositionsResult = APIRole[];
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-role
|
||||
*/
|
||||
export interface RESTPatchAPIGuildRoleJSONBody {
|
||||
export type RESTPatchAPIGuildRoleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Name of the role
|
||||
*/
|
||||
@@ -605,7 +643,7 @@ export interface RESTPatchAPIGuildRoleJSONBody {
|
||||
* Whether the role should be mentionable
|
||||
*/
|
||||
mentionable?: boolean | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-role
|
||||
@@ -648,7 +686,7 @@ export interface RESTGetAPIGuildPruneCountResult {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#begin-guild-prune
|
||||
*/
|
||||
export interface RESTPostAPIGuildPruneJSONBody {
|
||||
export type RESTPostAPIGuildPruneJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Number of days to count prune for (1 or more)
|
||||
*
|
||||
@@ -665,7 +703,7 @@ export interface RESTPostAPIGuildPruneJSONBody {
|
||||
* Role(s) to include
|
||||
*/
|
||||
include_roles?: Snowflake[];
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#begin-guild-prune
|
||||
@@ -702,7 +740,7 @@ export type RESTGetAPIGuildWidgetSettingsResult = APIGuildWidgetSettings;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-widget
|
||||
*/
|
||||
export type RESTPatchAPIGuildWidgetSettingsJSONBody = Partial<APIGuildWidgetSettings>;
|
||||
export type RESTPatchAPIGuildWidgetSettingsJSONBody = StrictPartial<APIGuildWidgetSettings>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-widget
|
||||
@@ -742,7 +780,7 @@ export type RESTGetAPIGuildWidgetImageResult = ArrayBuffer;
|
||||
|
||||
export type RESTGetAPIGuildMemberVerificationResult = APIGuildMembershipScreening;
|
||||
|
||||
export interface RESTPatchAPIGuildMemberVerificationJSONBody {
|
||||
export type RESTPatchAPIGuildMemberVerificationJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Whether Membership Screening is enabled
|
||||
*/
|
||||
@@ -755,11 +793,11 @@ export interface RESTPatchAPIGuildMemberVerificationJSONBody {
|
||||
* The server description to show in the screening form
|
||||
*/
|
||||
description?: string | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
export type RESTPatchAPIGuildMemberVerificationResult = APIGuildMembershipScreening;
|
||||
|
||||
export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
|
||||
export type RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The id of the channel the user is currently in
|
||||
*/
|
||||
@@ -772,9 +810,9 @@ export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
|
||||
* Sets the user's request to speak
|
||||
*/
|
||||
request_to_speak_timestamp?: string | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
|
||||
export type RESTPatchAPIGuildVoiceStateUserJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The id of the channel the user is currently in
|
||||
*/
|
||||
@@ -783,7 +821,7 @@ export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
|
||||
* Toggles the user's suppress state
|
||||
*/
|
||||
suppress?: boolean;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen
|
||||
@@ -793,9 +831,10 @@ export type RESTGetAPIGuildWelcomeScreenResult = APIGuildWelcomeScreen;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen
|
||||
*/
|
||||
export interface RESTPatchAPIGuildWelcomeScreenJSONBody extends Nullable<Partial<APIGuildWelcomeScreen>> {
|
||||
/**
|
||||
* Whether the welcome screen is enabled
|
||||
*/
|
||||
enabled?: boolean | null;
|
||||
}
|
||||
export type RESTPatchAPIGuildWelcomeScreenJSONBody = Nullable<StrictPartial<APIGuildWelcomeScreen>> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Whether the welcome screen is enabled
|
||||
*/
|
||||
enabled?: boolean | null;
|
||||
}>;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
|
||||
import type {
|
||||
APIGuildScheduledEvent,
|
||||
GuildScheduledEventEntityType,
|
||||
GuildScheduledEventPrivacyLevel,
|
||||
APIGuildScheduledEventEntityMetadata,
|
||||
GuildScheduledEventStatus,
|
||||
APIGuildMember,
|
||||
APIUser,
|
||||
APIGuildScheduledEventUser,
|
||||
} from '../../v8.ts';
|
||||
|
||||
/**
|
||||
@@ -27,7 +27,7 @@ export type RESTGetAPIGuildScheduledEventsResult = APIGuildScheduledEvent[];
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
|
||||
*/
|
||||
export interface RESTPostAPIGuildScheduledEventJSONBody {
|
||||
export type RESTPostAPIGuildScheduledEventJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The stage channel id of the guild event
|
||||
*/
|
||||
@@ -60,7 +60,11 @@ export interface RESTPostAPIGuildScheduledEventJSONBody {
|
||||
* The entity metadata of the scheduled event
|
||||
*/
|
||||
entity_metadata?: APIGuildScheduledEventEntityMetadata;
|
||||
}
|
||||
/**
|
||||
* The cover image of the scheduled event
|
||||
*/
|
||||
image?: string | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
|
||||
@@ -85,12 +89,13 @@ export type RESTGetAPIGuildScheduledEventResult = APIGuildScheduledEvent;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event
|
||||
*/
|
||||
export interface RESTPatchAPIGuildScheduledEventJSONBody extends Partial<RESTPostAPIGuildScheduledEventJSONBody> {
|
||||
/**
|
||||
* The status of the scheduled event
|
||||
*/
|
||||
status?: GuildScheduledEventStatus;
|
||||
}
|
||||
export type RESTPatchAPIGuildScheduledEventJSONBody = StrictPartial<RESTPostAPIGuildScheduledEventJSONBody> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The status of the scheduled event
|
||||
*/
|
||||
status?: GuildScheduledEventStatus;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event
|
||||
@@ -130,21 +135,3 @@ export interface RESTGetAPIGuildScheduledEventUsersQuery {
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users
|
||||
*/
|
||||
export type RESTGetAPIGuildScheduledEventUsersResult = APIGuildScheduledEventUser[];
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object-guild-scheduled-event-user-structure
|
||||
*/
|
||||
export interface APIGuildScheduledEventUser {
|
||||
/**
|
||||
* The scheduled event id which the user subscribed to
|
||||
*/
|
||||
guild_scheduled_event_id: Snowflake;
|
||||
/**
|
||||
* The user which subscribed to the event
|
||||
*/
|
||||
user: APIUser;
|
||||
/**
|
||||
* The guild member data for this user for the guild which this event belongs to, if any
|
||||
*/
|
||||
member?: APIGuildMember;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import type {
|
||||
APIInteractionResponseCallbackData,
|
||||
ApplicationCommandType,
|
||||
} from '../../payloads/v8/mod.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
|
||||
import type {
|
||||
RESTDeleteAPIWebhookWithTokenMessageResult,
|
||||
RESTGetAPIWebhookWithTokenMessageResult,
|
||||
@@ -25,22 +26,18 @@ export type RESTGetAPIApplicationCommandsResult = APIApplicationCommand[];
|
||||
*/
|
||||
export type RESTGetAPIApplicationCommandResult = APIApplicationCommand;
|
||||
|
||||
type RESTPostAPIBaseApplicationCommandsJSONBody = Omit<
|
||||
APIApplicationCommand,
|
||||
'id' | 'application_id' | 'description' | 'type' | 'version'
|
||||
type RESTPostAPIBaseApplicationCommandsJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<
|
||||
Omit<APIApplicationCommand, 'id' | 'application_id' | 'description' | 'type' | 'version' | 'guild_id'>
|
||||
>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
*/
|
||||
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
|
||||
type?: ApplicationCommandType.ChatInput;
|
||||
/**
|
||||
* Whether this application command option should be autocompleted
|
||||
*/
|
||||
autocomplete?: boolean;
|
||||
description: string;
|
||||
}
|
||||
export type RESTPostAPIChatInputApplicationCommandsJSONBody = RESTPostAPIBaseApplicationCommandsJSONBody &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
type?: ApplicationCommandType.ChatInput;
|
||||
description: string;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
@@ -64,7 +61,7 @@ export type RESTPostAPIApplicationCommandsResult = APIApplicationCommand;
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
|
||||
*/
|
||||
export type RESTPatchAPIApplicationCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
|
||||
export type RESTPatchAPIApplicationCommandJSONBody = StrictPartial<RESTPostAPIApplicationCommandsJSONBody>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
|
||||
@@ -104,7 +101,7 @@ export type RESTPostAPIApplicationGuildCommandsResult = APIApplicationCommand;
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
|
||||
*/
|
||||
export type RESTPatchAPIApplicationGuildCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
|
||||
export type RESTPatchAPIApplicationGuildCommandJSONBody = StrictPartial<RESTPostAPIApplicationCommandsJSONBody>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
|
||||
|
||||
@@ -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;
|
||||
@@ -441,6 +443,14 @@ export const Routes = {
|
||||
return `/users/@me/guilds` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/users/@me/guilds/{guild.id}/member`
|
||||
*/
|
||||
userGuildMember(guildId: Snowflake) {
|
||||
return `/users/@me/guilds/${guildId}/member` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - DELETE `/users/@me/guilds/{guild.id}`
|
||||
@@ -774,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
|
||||
@@ -790,27 +801,3 @@ export const OAuth2Routes = {
|
||||
|
||||
// Freeze OAuth2 route object
|
||||
Object.freeze(OAuth2Routes);
|
||||
|
||||
export interface DiscordErrorFieldInformation {
|
||||
code: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface DiscordErrorGroupWrapper {
|
||||
_errors: DiscordError[];
|
||||
}
|
||||
|
||||
export type DiscordErrorData =
|
||||
| DiscordErrorGroupWrapper
|
||||
| DiscordErrorFieldInformation
|
||||
| { [k: string]: DiscordErrorData }
|
||||
| string;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/reference#error-messages
|
||||
*/
|
||||
export interface DiscordError {
|
||||
code: number;
|
||||
message: string;
|
||||
errors?: DiscordErrorData;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import type { APIStageInstance, StageInstancePrivacyLevel } from '../../payloads/v8/mod.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/stage-instance#create-stage-instance
|
||||
@@ -34,7 +35,7 @@ export type RESTGetAPIStageInstanceResult = APIStageInstance;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/stage-instance#update-stage-instance
|
||||
*/
|
||||
export interface RESTPatchAPIStageInstanceJSONBody {
|
||||
export type RESTPatchAPIStageInstanceJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The topic of the stage instance (1-120 characters)
|
||||
*/
|
||||
@@ -43,7 +44,7 @@ export interface RESTPatchAPIStageInstanceJSONBody {
|
||||
* The privacy level of the stage instance
|
||||
*/
|
||||
privacy_level?: StageInstancePrivacyLevel;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/stage-instance#update-stage-instance
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { APISticker, APIStickerPack } from '../../payloads/v8/mod.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
|
||||
|
||||
export type RESTGetAPIStickerResult = APISticker;
|
||||
|
||||
@@ -31,7 +32,7 @@ export interface RESTPostAPIGuildStickerFormDataBody {
|
||||
|
||||
export type RESTPostAPIGuildStickerResult = APISticker;
|
||||
|
||||
export interface RESTPatchAPIGuildStickerJSONBody {
|
||||
export type RESTPatchAPIGuildStickerJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Name of the sticker (2-30 characters)
|
||||
*/
|
||||
@@ -44,7 +45,7 @@ export interface RESTPatchAPIGuildStickerJSONBody {
|
||||
* The Discord name of a unicode emoji representing the sticker's expression (2-200 characters)
|
||||
*/
|
||||
tags?: string;
|
||||
}
|
||||
}>;
|
||||
|
||||
export type RESTPatchAPIGuildStickerResult = APISticker;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { APIGuild, APITemplate } from '../../payloads/v8/mod.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/template#get-template
|
||||
@@ -8,7 +9,7 @@ export type RESTGetAPITemplateResult = APITemplate;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/template#create-guild-from-template
|
||||
*/
|
||||
export interface RESTPostAPITemplateCreateGuildJSONBody {
|
||||
export type RESTPostAPITemplateCreateGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Name of the guild (2-100 characters)
|
||||
*/
|
||||
@@ -19,7 +20,8 @@ export interface RESTPostAPITemplateCreateGuildJSONBody {
|
||||
* See https://discord.com/developers/docs/reference#image-data
|
||||
*/
|
||||
icon?: string;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/template#create-guild-from-template
|
||||
*/
|
||||
@@ -33,7 +35,7 @@ export type RESTGetAPIGuildTemplatesResult = APITemplate[];
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/template#create-guild-template
|
||||
*/
|
||||
export interface RESTPostAPIGuildTemplatesJSONBody {
|
||||
export type RESTPostAPIGuildTemplatesJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Name of the template (1-100 characters)
|
||||
*/
|
||||
@@ -42,7 +44,7 @@ export interface RESTPostAPIGuildTemplatesJSONBody {
|
||||
* Description for the template (0-120 characters)
|
||||
*/
|
||||
description?: string | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/template#create-guild-template
|
||||
@@ -57,7 +59,7 @@ export type RESTPutAPIGuildTemplateSyncResult = APITemplate;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/template#modify-guild-template
|
||||
*/
|
||||
export type RESTPatchAPIGuildTemplateJSONBody = Partial<RESTPostAPIGuildTemplatesJSONBody>;
|
||||
export type RESTPatchAPIGuildTemplateJSONBody = StrictPartial<RESTPostAPIGuildTemplatesJSONBody>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/template#modify-guild-template
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { Permissions, Snowflake } from '../../globals.ts';
|
||||
import type { APIChannel, APIConnection, APIUser, GuildFeature } from '../../payloads/v8/mod.ts';
|
||||
import type { APIChannel, APIConnection, APIGuildMember, APIUser, GuildFeature } from '../../payloads/v8/mod.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/user#get-current-user
|
||||
@@ -11,10 +12,15 @@ export type RESTGetAPICurrentUserResult = APIUser;
|
||||
*/
|
||||
export type RESTGetAPIUserResult = APIUser;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#get-current-user-guild-member
|
||||
*/
|
||||
export type RESTGetCurrentUserGuildMemberResult = APIGuildMember;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/user#modify-current-user
|
||||
*/
|
||||
export interface RESTPatchAPICurrentUserJSONBody {
|
||||
export type RESTPatchAPICurrentUserJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* User's username, if changed may cause the user's discriminator to be randomized
|
||||
*/
|
||||
@@ -23,7 +29,7 @@ export interface RESTPatchAPICurrentUserJSONBody {
|
||||
* If passed, modifies the user's avatar
|
||||
*/
|
||||
avatar?: string | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/user#modify-current-user
|
||||
|
||||
@@ -6,13 +6,15 @@ import type {
|
||||
APIMessage,
|
||||
APIWebhook,
|
||||
APIAttachment,
|
||||
MessageFlags,
|
||||
APIMessageActionRowComponent,
|
||||
} from '../../payloads/v8/mod.ts';
|
||||
import type { Nullable } from '../../utils/internals.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, Nullable } from '../../utils/internals.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#create-webhook
|
||||
*/
|
||||
export interface RESTPostAPIChannelWebhookJSONBody {
|
||||
export type RESTPostAPIChannelWebhookJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Name of the webhook (1-80 characters)
|
||||
*/
|
||||
@@ -23,7 +25,7 @@ export interface RESTPostAPIChannelWebhookJSONBody {
|
||||
* See https://discord.com/developers/docs/reference#image-data
|
||||
*/
|
||||
avatar?: string | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#create-webhook
|
||||
@@ -53,7 +55,7 @@ export type RESTGetAPIWebhookWithTokenResult = Omit<APIWebhook, 'user'>;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#modify-webhook
|
||||
*/
|
||||
export interface RESTPatchAPIWebhookJSONBody {
|
||||
export type RESTPatchAPIWebhookJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The default name of the webhook
|
||||
*/
|
||||
@@ -68,7 +70,7 @@ export interface RESTPatchAPIWebhookJSONBody {
|
||||
* The new channel id this webhook should be moved to
|
||||
*/
|
||||
channel_id?: Snowflake;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#modify-webhook
|
||||
@@ -98,7 +100,7 @@ export type RESTDeleteAPIWebhookWithTokenResult = never;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#execute-webhook
|
||||
*/
|
||||
export interface RESTPostAPIWebhookWithTokenJSONBody {
|
||||
export type RESTPostAPIWebhookWithTokenJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The message contents (up to 2000 characters)
|
||||
*/
|
||||
@@ -134,12 +136,16 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
|
||||
*
|
||||
* 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;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#execute-webhook
|
||||
@@ -164,6 +170,10 @@ export interface RESTPostAPIWebhookWithTokenQuery {
|
||||
* @default false
|
||||
*/
|
||||
wait?: boolean;
|
||||
/**
|
||||
* Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived.
|
||||
*/
|
||||
thread_id?: Snowflake;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,19 +233,18 @@ export type RESTGetAPIWebhookWithTokenMessageResult = APIMessage;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
*/
|
||||
export interface RESTPatchAPIWebhookWithTokenMessageJSONBody
|
||||
extends Nullable<
|
||||
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>
|
||||
> {
|
||||
/**
|
||||
* Attached files to keep
|
||||
*
|
||||
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: APIAttachment[] | null;
|
||||
}
|
||||
export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<
|
||||
Nullable<Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>> & {
|
||||
/**
|
||||
* Attached files to keep
|
||||
*
|
||||
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[];
|
||||
}
|
||||
>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
|
||||
@@ -9,7 +9,6 @@ import type {
|
||||
APIFollowedChannel,
|
||||
APIMessage,
|
||||
APIMessageReference,
|
||||
APIOverwrite,
|
||||
APIThreadList,
|
||||
APIThreadMember,
|
||||
APIUser,
|
||||
@@ -19,7 +18,13 @@ 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
|
||||
@@ -29,7 +34,7 @@ export type RESTGetAPIChannelResult = APIChannel;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#modify-channel
|
||||
*/
|
||||
export interface RESTPatchAPIChannelJSONBody {
|
||||
export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* 1-100 character channel name
|
||||
*
|
||||
@@ -87,7 +92,7 @@ export interface RESTPatchAPIChannelJSONBody {
|
||||
*
|
||||
* Channel types: all excluding newsThread, publicThread, privateThread
|
||||
*/
|
||||
permission_overwrites?: APIOverwrite[] | null;
|
||||
permission_overwrites?: APIChannelPatchOverwrite[] | null;
|
||||
/**
|
||||
* ID of the new parent category for a channel
|
||||
*
|
||||
@@ -136,7 +141,7 @@ export interface RESTPatchAPIChannelJSONBody {
|
||||
* Channel types: privateThread
|
||||
*/
|
||||
invitable?: boolean;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#modify-channel
|
||||
@@ -185,20 +190,21 @@ export type RESTGetAPIChannelMessageResult = APIMessage;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
|
||||
*/
|
||||
export type APIMessageReferenceSend = Partial<APIMessageReference> &
|
||||
Required<Pick<APIMessageReference, 'message_id'>> & {
|
||||
export type APIMessageReferenceSend = StrictPartial<APIMessageReference> &
|
||||
Required<Pick<APIMessageReference, 'message_id'>> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
fail_if_not_exists?: boolean;
|
||||
};
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#create-message
|
||||
*/
|
||||
export interface RESTPostAPIChannelMessageJSONBody {
|
||||
export type RESTPostAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The message contents (up to 2000 characters)
|
||||
*/
|
||||
@@ -241,7 +247,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@@ -252,7 +258,11 @@ export interface RESTPostAPIChannelMessageJSONBody {
|
||||
* Attachment objects with filename and description
|
||||
*/
|
||||
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[];
|
||||
}
|
||||
/**
|
||||
* Message flags combined as a bitfield
|
||||
*/
|
||||
flags?: MessageFlags;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#create-message
|
||||
@@ -325,7 +335,7 @@ export type RESTDeleteAPIChannelMessageReactionResult = never;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
*/
|
||||
export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
export type RESTPatchAPIChannelMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The new message contents (up to 2000 characters)
|
||||
*/
|
||||
@@ -365,14 +375,14 @@ export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: APIAttachment[] | null;
|
||||
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[];
|
||||
/**
|
||||
* The components to include with the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[] | null;
|
||||
}
|
||||
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
@@ -419,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
|
||||
*/
|
||||
@@ -446,7 +460,7 @@ export type RESTGetAPIChannelInvitesResult = APIExtendedInvite[];
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#create-channel-invite
|
||||
*/
|
||||
export interface RESTPostAPIChannelInviteJSONBody {
|
||||
export type RESTPostAPIChannelInviteJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Duration of invite in seconds before expiry, or 0 for never
|
||||
*
|
||||
@@ -490,7 +504,7 @@ export interface RESTPostAPIChannelInviteJSONBody {
|
||||
* - The application must have the `EMBEDDED` flag
|
||||
*/
|
||||
target_application_id?: Snowflake;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#create-channel-invite
|
||||
@@ -540,7 +554,7 @@ export type RESTDeleteAPIChannelPinResult = never;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
|
||||
*/
|
||||
export interface RESTPutAPIChannelRecipientJSONBody {
|
||||
export type RESTPutAPIChannelRecipientJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Access token of a user that has granted your app the `gdm.join` scope
|
||||
*/
|
||||
@@ -549,7 +563,7 @@ export interface RESTPutAPIChannelRecipientJSONBody {
|
||||
* Nickname of the user being added
|
||||
*/
|
||||
nick?: string;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
|
||||
@@ -564,7 +578,7 @@ export type RESTDeleteAPIChannelRecipientResult = unknown;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#start-thread-with-message
|
||||
*/
|
||||
export interface RESTPostAPIChannelMessagesThreadsJSONBody {
|
||||
export type RESTPostAPIChannelMessagesThreadsJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* 1-100 character thread name
|
||||
*/
|
||||
@@ -579,7 +593,7 @@ export interface RESTPostAPIChannelMessagesThreadsJSONBody {
|
||||
* Amount of seconds a user has to wait before sending another message (0-21600)
|
||||
*/
|
||||
rate_limit_per_user?: number;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#start-thread-with-message
|
||||
@@ -589,23 +603,24 @@ export type RESTPostAPIChannelMessagesThreadsResult = APIChannel;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#start-thread-without-message
|
||||
*/
|
||||
export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMessagesThreadsJSONBody {
|
||||
/**
|
||||
* The type of thread to create
|
||||
*
|
||||
* In API v9, `type` defaults to `PRIVATE_THREAD`.
|
||||
* In API v10 this will be changed to be a required field, with no default.
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
|
||||
*
|
||||
* @default 12
|
||||
*/
|
||||
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
|
||||
/**
|
||||
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
|
||||
*/
|
||||
invitable?: boolean;
|
||||
}
|
||||
export type RESTPostAPIChannelThreadsJSONBody = RESTPostAPIChannelMessagesThreadsJSONBody &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The type of thread to create
|
||||
*
|
||||
* In API v9, `type` defaults to `PRIVATE_THREAD`.
|
||||
* In API v10 this will be changed to be a required field, with no default.
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
|
||||
*
|
||||
* @default 12
|
||||
*/
|
||||
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
|
||||
/**
|
||||
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
|
||||
*/
|
||||
invitable?: boolean;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#start-thread-without-message
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import type { APIEmoji } from '../../payloads/v9/mod.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface } from '../../utils/internals.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/emoji#list-guild-emojis
|
||||
@@ -14,7 +15,7 @@ export type RESTGetAPIGuildEmojiResult = APIEmoji;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/emoji#create-guild-emoji-json-params
|
||||
*/
|
||||
export interface RESTPostAPIGuildEmojiJSONBody {
|
||||
export type RESTPostAPIGuildEmojiJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Name of the emoji
|
||||
*/
|
||||
@@ -29,7 +30,7 @@ export interface RESTPostAPIGuildEmojiJSONBody {
|
||||
* Roles for which this emoji will be whitelisted
|
||||
*/
|
||||
roles?: Snowflake[];
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/emoji#create-guild-emoji
|
||||
@@ -39,7 +40,7 @@ export type RESTPostAPIGuildEmojiResult = APIEmoji;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/emoji#modify-guild-emoji
|
||||
*/
|
||||
export interface RESTPatchAPIGuildEmojiJSONBody {
|
||||
export type RESTPatchAPIGuildEmojiJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Name of the emoji
|
||||
*/
|
||||
@@ -48,7 +49,7 @@ export interface RESTPatchAPIGuildEmojiJSONBody {
|
||||
* Roles for which this emoji will be whitelisted
|
||||
*/
|
||||
roles?: Snowflake[] | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/emoji#modify-guild-emoji
|
||||
|
||||
@@ -20,22 +20,35 @@ import type {
|
||||
GuildSystemChannelFlags,
|
||||
GuildVerificationLevel,
|
||||
GuildWidgetStyle,
|
||||
APIDMChannel,
|
||||
APIGroupDMChannel,
|
||||
} from '../../payloads/v9/mod.ts';
|
||||
import type { Nullable } from '../../utils/internals.ts';
|
||||
import type {
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
|
||||
Nullable,
|
||||
StrictPartial,
|
||||
StrictRequired,
|
||||
UnionToIntersection,
|
||||
} from '../../utils/internals.ts';
|
||||
import type { RESTPutAPIChannelPermissionJSONBody } from './channel.ts';
|
||||
|
||||
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
|
||||
id: number | string;
|
||||
}
|
||||
|
||||
export type APIGuildCreatePartialChannel = Partial<
|
||||
Pick<APIChannel, 'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'>
|
||||
> & {
|
||||
name: string;
|
||||
id?: number | string;
|
||||
parent_id?: number | string | null;
|
||||
permission_overwrites?: APIGuildCreateOverwrite[];
|
||||
};
|
||||
export type APIGuildChannelResolvable = Exclude<APIChannel, APIDMChannel | APIGroupDMChannel>;
|
||||
export type APIGuildCreatePartialChannel = StrictPartial<
|
||||
Pick<
|
||||
UnionToIntersection<APIGuildChannelResolvable>,
|
||||
'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'
|
||||
>
|
||||
> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
name: string;
|
||||
id?: number | string;
|
||||
parent_id?: number | string | null;
|
||||
permission_overwrites?: APIGuildCreateOverwrite[];
|
||||
}>;
|
||||
|
||||
export interface APIGuildCreateRole extends RESTPostAPIGuildRoleJSONBody {
|
||||
id: number | string;
|
||||
@@ -44,7 +57,7 @@ export interface APIGuildCreateRole extends RESTPostAPIGuildRoleJSONBody {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild
|
||||
*/
|
||||
export interface RESTPostAPIGuildsJSONBody {
|
||||
export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Name of the guild (2-100 characters)
|
||||
*/
|
||||
@@ -127,7 +140,7 @@ export interface RESTPostAPIGuildsJSONBody {
|
||||
* Whether the boosts progress bar should be enabled.
|
||||
*/
|
||||
premium_progress_bar_enabled?: boolean;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild
|
||||
@@ -159,7 +172,7 @@ export type RESTGetAPIGuildPreviewResult = APIGuildPreview;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild
|
||||
*/
|
||||
export interface RESTPatchAPIGuildJSONBody {
|
||||
export type RESTPatchAPIGuildJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* New name for the guild (2-100 characters)
|
||||
*/
|
||||
@@ -258,7 +271,7 @@ export interface RESTPatchAPIGuildJSONBody {
|
||||
* Whether the boosts progress bar should be enabled.
|
||||
*/
|
||||
premium_progress_bar_enabled?: boolean;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild
|
||||
@@ -288,24 +301,26 @@ export type RESTPostAPIGuildChannelResult = APIChannel;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
|
||||
*/
|
||||
export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<{
|
||||
/**
|
||||
* Channel id
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
position: number;
|
||||
/**
|
||||
* Sync channel overwrites with the new parent, when moving to a new `parent_id`
|
||||
*/
|
||||
lock_permissions?: boolean;
|
||||
/**
|
||||
* The new parent id of this channel
|
||||
*/
|
||||
parent_id?: Snowflake | null;
|
||||
}>;
|
||||
export type RESTPatchAPIGuildChannelPositionsJSONBody = Array<
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Channel id
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
position: number;
|
||||
/**
|
||||
* Sync channel overwrites with the new parent, when moving to a new `parent_id`
|
||||
*/
|
||||
lock_permissions?: boolean;
|
||||
/**
|
||||
* The new parent id of this channel
|
||||
*/
|
||||
parent_id?: Snowflake | null;
|
||||
}>
|
||||
>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
|
||||
@@ -366,7 +381,7 @@ export type RESTGetAPIGuildMembersSearchResult = APIGuildMember[];
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#add-guild-member
|
||||
*/
|
||||
export interface RESTPutAPIGuildMemberJSONBody {
|
||||
export type RESTPutAPIGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* An oauth2 access token granted with the `guilds.join` to the bot's application for the user you want to add to the guild
|
||||
*/
|
||||
@@ -395,14 +410,14 @@ export interface RESTPutAPIGuildMemberJSONBody {
|
||||
* Requires `DEAFEN_MEMBERS` permission
|
||||
*/
|
||||
deaf?: boolean;
|
||||
}
|
||||
}>;
|
||||
|
||||
export type RESTPutAPIGuildMemberResult = APIGuildMember | undefined;
|
||||
export type RESTPutAPIGuildMemberResult = APIGuildMember | never;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-member
|
||||
*/
|
||||
export interface RESTPatchAPIGuildMemberJSONBody {
|
||||
export type RESTPatchAPIGuildMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Value to set users nickname to
|
||||
*
|
||||
@@ -433,7 +448,11 @@ export interface RESTPatchAPIGuildMemberJSONBody {
|
||||
* 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;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#add-guild-member
|
||||
@@ -442,20 +461,37 @@ 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 interface RESTPatchAPICurrentGuildMemberNicknameJSONBody {
|
||||
export type RESTPatchAPICurrentGuildMemberNicknameJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Value to set users nickname to
|
||||
*
|
||||
* Requires `CHANGE_NICKNAME` permission
|
||||
*/
|
||||
nick?: string | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-current-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 = Required<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
|
||||
export type RESTPatchAPICurrentGuildMemberNicknameResult =
|
||||
StrictRequired<RESTPatchAPICurrentGuildMemberNicknameJSONBody>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#add-guild-member-role
|
||||
@@ -485,7 +521,7 @@ export type RESTGetAPIGuildBanResult = APIBan;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-ban
|
||||
*/
|
||||
export interface RESTPutAPIGuildBanJSONBody {
|
||||
export type RESTPutAPIGuildBanJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Number of days to delete messages for (0-7)
|
||||
*/
|
||||
@@ -494,7 +530,7 @@ export interface RESTPutAPIGuildBanJSONBody {
|
||||
* Reason for the ban
|
||||
*/
|
||||
reason?: string;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-ban
|
||||
@@ -514,7 +550,7 @@ export type RESTGetAPIGuildRolesResult = APIRole[];
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-role
|
||||
*/
|
||||
export interface RESTPostAPIGuildRoleJSONBody {
|
||||
export type RESTPostAPIGuildRoleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Name of the role
|
||||
*
|
||||
@@ -524,7 +560,7 @@ export interface RESTPostAPIGuildRoleJSONBody {
|
||||
/**
|
||||
* Bitwise value of the enabled/disabled permissions
|
||||
*
|
||||
* @default "default role permissions in guild"
|
||||
* @default "default role permissions in guild"
|
||||
*/
|
||||
permissions?: Permissions | null;
|
||||
/**
|
||||
@@ -553,7 +589,7 @@ export interface RESTPostAPIGuildRoleJSONBody {
|
||||
* @default false
|
||||
*/
|
||||
mentionable?: boolean | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-role
|
||||
@@ -563,16 +599,18 @@ export type RESTPostAPIGuildRoleResult = APIRole;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
|
||||
*/
|
||||
export type RESTPatchAPIGuildRolePositionsJSONBody = Array<{
|
||||
/**
|
||||
* Role id
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* Sorting position of the role
|
||||
*/
|
||||
position?: number;
|
||||
}>;
|
||||
export type RESTPatchAPIGuildRolePositionsJSONBody = Array<
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Role id
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* Sorting position of the role
|
||||
*/
|
||||
position?: number;
|
||||
}>
|
||||
>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
|
||||
@@ -582,7 +620,7 @@ export type RESTPatchAPIGuildRolePositionsResult = APIRole[];
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-role
|
||||
*/
|
||||
export interface RESTPatchAPIGuildRoleJSONBody {
|
||||
export type RESTPatchAPIGuildRoleJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Name of the role
|
||||
*/
|
||||
@@ -611,7 +649,7 @@ export interface RESTPatchAPIGuildRoleJSONBody {
|
||||
* Whether the role should be mentionable
|
||||
*/
|
||||
mentionable?: boolean | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-role
|
||||
@@ -654,7 +692,7 @@ export interface RESTGetAPIGuildPruneCountResult {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#begin-guild-prune
|
||||
*/
|
||||
export interface RESTPostAPIGuildPruneJSONBody {
|
||||
export type RESTPostAPIGuildPruneJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Number of days to count prune for (1 or more)
|
||||
*
|
||||
@@ -671,7 +709,7 @@ export interface RESTPostAPIGuildPruneJSONBody {
|
||||
* Role(s) to include
|
||||
*/
|
||||
include_roles?: Snowflake[];
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#begin-guild-prune
|
||||
@@ -708,7 +746,7 @@ export type RESTGetAPIGuildWidgetSettingsResult = APIGuildWidgetSettings;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-widget
|
||||
*/
|
||||
export type RESTPatchAPIGuildWidgetSettingsJSONBody = Partial<APIGuildWidgetSettings>;
|
||||
export type RESTPatchAPIGuildWidgetSettingsJSONBody = StrictPartial<APIGuildWidgetSettings>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-widget
|
||||
@@ -748,7 +786,7 @@ export type RESTGetAPIGuildWidgetImageResult = ArrayBuffer;
|
||||
|
||||
export type RESTGetAPIGuildMemberVerificationResult = APIGuildMembershipScreening;
|
||||
|
||||
export interface RESTPatchAPIGuildMemberVerificationJSONBody {
|
||||
export type RESTPatchAPIGuildMemberVerificationJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Whether Membership Screening is enabled
|
||||
*/
|
||||
@@ -761,11 +799,11 @@ export interface RESTPatchAPIGuildMemberVerificationJSONBody {
|
||||
* The server description to show in the screening form
|
||||
*/
|
||||
description?: string | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
export type RESTPatchAPIGuildMemberVerificationResult = APIGuildMembershipScreening;
|
||||
|
||||
export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
|
||||
export type RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The id of the channel the user is currently in
|
||||
*/
|
||||
@@ -778,9 +816,9 @@ export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
|
||||
* Sets the user's request to speak
|
||||
*/
|
||||
request_to_speak_timestamp?: string | null;
|
||||
}
|
||||
}>;
|
||||
|
||||
export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
|
||||
export type RESTPatchAPIGuildVoiceStateUserJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The id of the channel the user is currently in
|
||||
*/
|
||||
@@ -789,7 +827,7 @@ export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
|
||||
* Toggles the user's suppress state
|
||||
*/
|
||||
suppress?: boolean;
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen
|
||||
@@ -799,9 +837,10 @@ export type RESTGetAPIGuildWelcomeScreenResult = APIGuildWelcomeScreen;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen
|
||||
*/
|
||||
export interface RESTPatchAPIGuildWelcomeScreenJSONBody extends Nullable<Partial<APIGuildWelcomeScreen>> {
|
||||
/**
|
||||
* Whether the welcome screen is enabled
|
||||
*/
|
||||
enabled?: boolean | null;
|
||||
}
|
||||
export type RESTPatchAPIGuildWelcomeScreenJSONBody = Nullable<StrictPartial<APIGuildWelcomeScreen>> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* Whether the welcome screen is enabled
|
||||
*/
|
||||
enabled?: boolean | null;
|
||||
}>;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
|
||||
import type {
|
||||
APIGuildScheduledEvent,
|
||||
GuildScheduledEventEntityType,
|
||||
GuildScheduledEventPrivacyLevel,
|
||||
APIGuildScheduledEventEntityMetadata,
|
||||
GuildScheduledEventStatus,
|
||||
APIGuildMember,
|
||||
APIUser,
|
||||
APIGuildScheduledEventUser,
|
||||
} from '../../v9.ts';
|
||||
|
||||
/**
|
||||
@@ -27,7 +27,7 @@ export type RESTGetAPIGuildScheduledEventsResult = APIGuildScheduledEvent[];
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
|
||||
*/
|
||||
export interface RESTPostAPIGuildScheduledEventJSONBody {
|
||||
export type RESTPostAPIGuildScheduledEventJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The stage channel id of the guild event
|
||||
*/
|
||||
@@ -60,7 +60,11 @@ export interface RESTPostAPIGuildScheduledEventJSONBody {
|
||||
* The entity metadata of the scheduled event
|
||||
*/
|
||||
entity_metadata?: APIGuildScheduledEventEntityMetadata;
|
||||
}
|
||||
/**
|
||||
* The cover image of the scheduled event
|
||||
*/
|
||||
image?: string | null;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event
|
||||
@@ -85,12 +89,13 @@ export type RESTGetAPIGuildScheduledEventResult = APIGuildScheduledEvent;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event
|
||||
*/
|
||||
export interface RESTPatchAPIGuildScheduledEventJSONBody extends Partial<RESTPostAPIGuildScheduledEventJSONBody> {
|
||||
/**
|
||||
* The status of the scheduled event
|
||||
*/
|
||||
status?: GuildScheduledEventStatus;
|
||||
}
|
||||
export type RESTPatchAPIGuildScheduledEventJSONBody = StrictPartial<RESTPostAPIGuildScheduledEventJSONBody> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
/**
|
||||
* The status of the scheduled event
|
||||
*/
|
||||
status?: GuildScheduledEventStatus;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event
|
||||
@@ -130,21 +135,3 @@ export interface RESTGetAPIGuildScheduledEventUsersQuery {
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users
|
||||
*/
|
||||
export type RESTGetAPIGuildScheduledEventUsersResult = APIGuildScheduledEventUser[];
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object-guild-scheduled-event-user-structure
|
||||
*/
|
||||
export interface APIGuildScheduledEventUser {
|
||||
/**
|
||||
* The scheduled event id which the user subscribed to
|
||||
*/
|
||||
guild_scheduled_event_id: Snowflake;
|
||||
/**
|
||||
* The user which subscribed to the event
|
||||
*/
|
||||
user: APIUser;
|
||||
/**
|
||||
* The guild member data for this user for the guild which this event belongs to, if any
|
||||
*/
|
||||
member?: APIGuildMember;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import type {
|
||||
APIInteractionResponseCallbackData,
|
||||
ApplicationCommandType,
|
||||
} from '../../payloads/v9/mod.ts';
|
||||
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
|
||||
import type {
|
||||
RESTDeleteAPIWebhookWithTokenMessageResult,
|
||||
RESTGetAPIWebhookWithTokenMessageResult,
|
||||
@@ -25,22 +26,18 @@ export type RESTGetAPIApplicationCommandsResult = APIApplicationCommand[];
|
||||
*/
|
||||
export type RESTGetAPIApplicationCommandResult = APIApplicationCommand;
|
||||
|
||||
type RESTPostAPIBaseApplicationCommandsJSONBody = Omit<
|
||||
APIApplicationCommand,
|
||||
'id' | 'application_id' | 'description' | 'type' | 'version'
|
||||
type RESTPostAPIBaseApplicationCommandsJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<
|
||||
Omit<APIApplicationCommand, 'id' | 'application_id' | 'description' | 'type' | 'version' | 'guild_id'>
|
||||
>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
*/
|
||||
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
|
||||
type?: ApplicationCommandType.ChatInput;
|
||||
/**
|
||||
* Whether this application command option should be autocompleted
|
||||
*/
|
||||
autocomplete?: boolean;
|
||||
description: string;
|
||||
}
|
||||
export type RESTPostAPIChatInputApplicationCommandsJSONBody = RESTPostAPIBaseApplicationCommandsJSONBody &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
type?: ApplicationCommandType.ChatInput;
|
||||
description: string;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
@@ -64,7 +61,7 @@ export type RESTPostAPIApplicationCommandsResult = APIApplicationCommand;
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
|
||||
*/
|
||||
export type RESTPatchAPIApplicationCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
|
||||
export type RESTPatchAPIApplicationCommandJSONBody = StrictPartial<RESTPostAPIApplicationCommandsJSONBody>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command
|
||||
@@ -104,7 +101,7 @@ export type RESTPostAPIApplicationGuildCommandsResult = APIApplicationCommand;
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
|
||||
*/
|
||||
export type RESTPatchAPIApplicationGuildCommandJSONBody = Partial<RESTPostAPIApplicationCommandsJSONBody>;
|
||||
export type RESTPatchAPIApplicationGuildCommandJSONBody = StrictPartial<RESTPostAPIApplicationCommandsJSONBody>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command
|
||||
|
||||
@@ -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;
|
||||
@@ -510,6 +512,14 @@ export const Routes = {
|
||||
return `/users/@me/guilds` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/users/@me/guilds/{guild.id}/member`
|
||||
*/
|
||||
userGuildMember(guildId: Snowflake) {
|
||||
return `/users/@me/guilds/${guildId}/member` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - DELETE `/users/@me/guilds/{guild.id}`
|
||||
@@ -843,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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user