mirror of
https://github.com/discordjs/discord.js.git
synced 2026-05-23 20:10:08 +00:00
Compare commits
96 Commits
@discordjs
...
@discordjs
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7dc588d9f | ||
|
|
2291429d30 | ||
|
|
bf7326729d | ||
|
|
124d8123b8 | ||
|
|
0b61dbf720 | ||
|
|
ba6797e742 | ||
|
|
7fd9ed8f13 | ||
|
|
b6bba9901b | ||
|
|
2130aae321 | ||
|
|
80b9738957 | ||
|
|
5d8bd030d6 | ||
|
|
e9920a9c98 | ||
|
|
6d248051cf | ||
|
|
798466a696 | ||
|
|
1275918ca8 | ||
|
|
a7d49e56fc | ||
|
|
34ba9d1c4c | ||
|
|
77ed407f6a | ||
|
|
4fc2c60a3b | ||
|
|
9f4446b10f | ||
|
|
78d4295a40 | ||
|
|
5a3c9996e0 | ||
|
|
4fff6076e7 | ||
|
|
4bda24678a | ||
|
|
9ae461d84d | ||
|
|
160487d866 | ||
|
|
41e4e10b48 | ||
|
|
200ab91f52 | ||
|
|
3839958e3f | ||
|
|
58c1b51c5c | ||
|
|
6a2d0d8e96 | ||
|
|
335695c698 | ||
|
|
8e520f946a | ||
|
|
59a7e52224 | ||
|
|
af837debe3 | ||
|
|
df42fdfc42 | ||
|
|
5f667c0c82 | ||
|
|
90cbd2bbd5 | ||
|
|
f50382e1ce | ||
|
|
1b03631205 | ||
|
|
a490adfe36 | ||
|
|
f097f0bc1f | ||
|
|
1d63d3ce1c | ||
|
|
6d25fb8856 | ||
|
|
86a9be7d33 | ||
|
|
82165d4f80 | ||
|
|
ee455c812e | ||
|
|
0d687b5606 | ||
|
|
748d7271c4 | ||
|
|
830c670c61 | ||
|
|
74ec7be346 | ||
|
|
96b62b6539 | ||
|
|
8a6ee906a7 | ||
|
|
1fb7b30963 | ||
|
|
45c9659080 | ||
|
|
07a5cd7048 | ||
|
|
d0e3c972b4 | ||
|
|
a05386a46c | ||
|
|
3b0197bd8e | ||
|
|
d1245418f9 | ||
|
|
e7d4d41640 | ||
|
|
ce1807dc80 | ||
|
|
34d3917a28 | ||
|
|
9e624abf1a | ||
|
|
8c4b9865e1 | ||
|
|
dbad1c468b | ||
|
|
4ffd7f9f80 | ||
|
|
660e212e83 | ||
|
|
70dd757ec3 | ||
|
|
b5d4b2d78b | ||
|
|
78d013f87c | ||
|
|
21d61ca260 | ||
|
|
b316ac7cc4 | ||
|
|
ed94b3d9ec | ||
|
|
dcbbecfed2 | ||
|
|
0c5e37d515 | ||
|
|
656e9550db | ||
|
|
3a7e93df57 | ||
|
|
66092cad8b | ||
|
|
ec230faa4d | ||
|
|
cd13a4a902 | ||
|
|
dda2895bfb | ||
|
|
f0b77348d3 | ||
|
|
b0a9131b1c | ||
|
|
29be5b570b | ||
|
|
d677c31161 | ||
|
|
f6ef92ad6a | ||
|
|
52a9e213c2 | ||
|
|
b7e62380f2 | ||
|
|
cafde77d73 | ||
|
|
b7d4e55419 | ||
|
|
5aeed99350 | ||
|
|
452dec57ca | ||
|
|
64f814066c | ||
|
|
33a7a5cbdc | ||
|
|
edf83f02ea |
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -18,6 +18,7 @@ body:
|
||||
- proxy
|
||||
- proxy-container
|
||||
- voice
|
||||
- ws
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
|
||||
1
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
1
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
@@ -20,6 +20,7 @@ body:
|
||||
- proxy
|
||||
- proxy-container
|
||||
- voice
|
||||
- ws
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
|
||||
13
.github/check_deploy_branch.sh
vendored
Executable file
13
.github/check_deploy_branch.sh
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
git diff HEAD^ HEAD --quiet .
|
||||
|
||||
if [[ "$VERCEL_GIT_COMMIT_REF" == "main" || $? -eq 1 ]]; then
|
||||
# Proceed with the build
|
||||
echo "✅ - Proceed"
|
||||
exit 1;
|
||||
else
|
||||
# Don't build
|
||||
echo "🛑 - Build cancelled"
|
||||
exit 0;
|
||||
fi
|
||||
4
.github/labels.yml
vendored
4
.github/labels.yml
vendored
@@ -62,10 +62,10 @@
|
||||
color: 'fbca04'
|
||||
- name: 'packages:voice'
|
||||
color: 'fbca04'
|
||||
- name: 'packages:ws'
|
||||
color: 'fbca04'
|
||||
- name: 'packages:website'
|
||||
color: 'fbca04'
|
||||
- name: 'packages:ws'
|
||||
color: 'fbca04'
|
||||
- name: 'performance'
|
||||
color: '80c042'
|
||||
- name: 'permissions'
|
||||
|
||||
6
.github/powered-by-vercel.svg
vendored
Normal file
6
.github/powered-by-vercel.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 5.2 KiB |
26
.github/workflows/documentation.yml
vendored
26
.github/workflows/documentation.yml
vendored
@@ -34,23 +34,14 @@ jobs:
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: yarn.lock
|
||||
|
||||
- name: Turbo cache
|
||||
id: turbo-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: .turbo
|
||||
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
turbo-${{ github.job }}-${{ github.ref_name }}-
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --immutable
|
||||
|
||||
- name: Build dependencies
|
||||
run: yarn build --cache-dir=".turbo"
|
||||
run: yarn build
|
||||
|
||||
- name: Build docs
|
||||
run: yarn docs --cache-dir=".turbo"
|
||||
run: yarn docs
|
||||
|
||||
- name: Upload docgen artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
@@ -78,7 +69,7 @@ jobs:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
package: ['builders', 'collection', 'discord.js', 'proxy', 'rest', 'voice']
|
||||
package: ['builders', 'collection', 'discord.js', 'proxy', 'rest', 'voice', 'ws']
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
BRANCH_NAME: ${{ github.event.inputs.ref || needs.build.outputs.BRANCH_NAME }}
|
||||
@@ -95,20 +86,11 @@ jobs:
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: yarn.lock
|
||||
|
||||
- name: Turbo cache
|
||||
id: turbo-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: .turbo
|
||||
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
turbo-${{ github.job }}-${{ github.ref_name }}-
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --immutable
|
||||
|
||||
- name: Build actions
|
||||
run: yarn build --cache-dir=".turbo"
|
||||
run: yarn build
|
||||
|
||||
- name: Download docgen artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Label Sync
|
||||
name: Label sync
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
@@ -9,9 +9,10 @@ on:
|
||||
paths:
|
||||
- '.github/labels.yml'
|
||||
jobs:
|
||||
labelsync:
|
||||
label-sync:
|
||||
name: Label sync
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'discordjs'
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
@@ -4,7 +4,7 @@ on:
|
||||
schedule:
|
||||
- cron: '0 1 * * *'
|
||||
jobs:
|
||||
auto-deprecate:
|
||||
npm-auto-deprecate:
|
||||
name: npm auto deprecate
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'discordjs'
|
||||
@@ -23,6 +23,6 @@ jobs:
|
||||
run: yarn --immutable
|
||||
|
||||
- name: Deprecate versions
|
||||
run: 'yarn npm-deprecate --name "*dev*" --package @discordjs/builders @discordjs/collection discord.js @discordjs/rest @discordjs/voice'
|
||||
run: 'yarn npm-deprecate --name "*dev*" --package @discordjs/builders @discordjs/collection discord.js @discordjs/proxy @discordjs/rest @discordjs/voice'
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
@@ -1,8 +1,9 @@
|
||||
name: 'PR Automation'
|
||||
name: 'PR Triage'
|
||||
on:
|
||||
pull_request_target:
|
||||
jobs:
|
||||
triage:
|
||||
pr-triage:
|
||||
name: PR Triage
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Automatically label PR
|
||||
7
.github/workflows/publish-dev-docker.yml
vendored
7
.github/workflows/publish-dev-docker.yml
vendored
@@ -1,14 +1,13 @@
|
||||
name: Publish dev Docker Images
|
||||
name: Publish dev docker images
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 */12 * * *'
|
||||
jobs:
|
||||
docker:
|
||||
name: Docker
|
||||
docker-publish:
|
||||
name: Docker publish
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'discordjs'
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
37
.github/workflows/publish-dev.yml
vendored
37
.github/workflows/publish-dev.yml
vendored
@@ -4,8 +4,8 @@ on:
|
||||
schedule:
|
||||
- cron: '0 */12 * * *'
|
||||
jobs:
|
||||
npm:
|
||||
name: npm
|
||||
npm-publish:
|
||||
name: npm publish
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -22,6 +22,8 @@ jobs:
|
||||
folder: 'rest'
|
||||
- package: '@discordjs/voice'
|
||||
folder: 'voice'
|
||||
- package: '@discordjs/ws'
|
||||
folder: 'ws'
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'discordjs'
|
||||
steps:
|
||||
@@ -36,40 +38,15 @@ jobs:
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: yarn.lock
|
||||
|
||||
- name: Turbo cache
|
||||
id: turbo-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: .turbo
|
||||
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
turbo-${{ github.job }}-${{ github.ref_name }}-
|
||||
|
||||
- name: Check previous released version
|
||||
id: pre-release
|
||||
run: |
|
||||
if [[ $(npm view ${{ matrix.package }}@dev version | grep -e "$(jq --raw-output '.version' packages/${{ matrix.folder }}/package.json)\..*-$(git rev-parse --short HEAD)") ]]; \
|
||||
then echo '::set-output name=release::false'; \
|
||||
else echo '::set-output name=release::true'; fi
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.pre-release.outputs.release == 'true'
|
||||
run: yarn --immutable
|
||||
|
||||
- name: Build dependencies
|
||||
if: steps.pre-release.outputs.release == 'true'
|
||||
run: yarn build --cache-dir=".turbo"
|
||||
run: yarn build
|
||||
|
||||
- name: Deprecate old versions
|
||||
if: steps.pre-release.outputs.release == 'true'
|
||||
run: npm deprecate ${{ matrix.package }}@"~$(jq --raw-output '.version' packages/${{ matrix.folder }}/package.json)" "no longer supported" || true
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
|
||||
- name: Publish
|
||||
if: steps.pre-release.outputs.release == 'true'
|
||||
- name: Publish package
|
||||
run: |
|
||||
yarn workspace ${{ matrix.package }} version $(jq --raw-output '.version' packages/${{ matrix.folder }}/package.json).$(date +%s)-$(git rev-parse --short HEAD)
|
||||
yarn workspace ${{ matrix.package }} release --preid "dev.$(date +%s)-$(git rev-parse --short HEAD)"
|
||||
yarn workspace ${{ matrix.package }} npm publish --tag dev || true
|
||||
env:
|
||||
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
|
||||
11
.github/workflows/publish-docker.yml
vendored
11
.github/workflows/publish-docker.yml
vendored
@@ -1,11 +1,10 @@
|
||||
name: Publish Docker Images
|
||||
name: Publish docker images
|
||||
on:
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
docker:
|
||||
name: Docker
|
||||
docker-publish:
|
||||
name: Docker publish
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
@@ -16,10 +15,10 @@ jobs:
|
||||
- name: Login to DockerHub
|
||||
run: echo ${{ secrets.DOCKER_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||
|
||||
- name: Build the image
|
||||
- name: Build docker image
|
||||
run: docker build -t discordjs/proxy:latest -f packages/proxy-container/Dockerfile .
|
||||
|
||||
- name: Tag the image with major
|
||||
- name: Tag image with major
|
||||
run: docker tag discordjs/proxy discordjs/proxy:$(cut -d '.' -f1 <<< $(jq --raw-output '.version' packages/proxy-container/package.json))
|
||||
|
||||
- name: Push image to DockerHub
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
name: Tests
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
tests:
|
||||
name: Tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -15,20 +15,14 @@ jobs:
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: yarn.lock
|
||||
|
||||
- name: Turbo cache
|
||||
id: turbo-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: .turbo
|
||||
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
turbo-${{ github.job }}-${{ github.ref_name }}-
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --immutable
|
||||
|
||||
- name: Build dependencies
|
||||
run: yarn build
|
||||
|
||||
- name: ESLint
|
||||
run: yarn lint --cache-dir=".turbo"
|
||||
run: yarn lint
|
||||
|
||||
- name: Tests
|
||||
run: yarn test
|
||||
@@ -36,6 +30,3 @@ jobs:
|
||||
- name: Upload Coverage
|
||||
uses: ./packages/actions/src/uploadCoverage
|
||||
if: github.repository_owner == 'discordjs'
|
||||
|
||||
- name: Build
|
||||
run: yarn build --cache-dir=".turbo"
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
yarn build && yarn lint && yarn test
|
||||
yarn build && yarn lint-staged
|
||||
|
||||
5
.lintstagedrc.json
Normal file
5
.lintstagedrc.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"*": "prettier --ignore-unknown --write",
|
||||
"{src/**,__tests__/**}.{mjs,js,ts}": "eslint --ext mjs,js,ts --fix",
|
||||
"src/**.ts": "vitest related"
|
||||
}
|
||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -6,5 +6,6 @@
|
||||
"source.fixAll": true,
|
||||
"source.organizeImports": false
|
||||
},
|
||||
"unocss.root": "./packages/website"
|
||||
"unocss.root": "./packages/website",
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
diff --git a/lib/TSDocConfigFile.js b/lib/TSDocConfigFile.js
|
||||
index caf3515d60fd386c5909db5a0aa8b4180b10d602..6fa4f1984b6ba6b3a7aecd05e54477ebf141af94 100644
|
||||
--- a/lib/TSDocConfigFile.js
|
||||
+++ b/lib/TSDocConfigFile.js
|
||||
@@ -31,8 +31,7 @@ const ajv_1 = __importDefault(require("ajv"));
|
||||
const jju = __importStar(require("jju"));
|
||||
const ajv = new ajv_1.default({ verbose: true });
|
||||
function initializeSchemaValidator() {
|
||||
- const jsonSchemaPath = resolve.sync('@microsoft/tsdoc/schemas/tsdoc.schema.json', { basedir: __dirname });
|
||||
- const jsonSchemaContent = fs.readFileSync(jsonSchemaPath).toString();
|
||||
+ const jsonSchemaContent = "{\"title\":\"TSDoc Configuration\",\"description\":\"Describes the TSDoc configuration for a TypeScript project\",\"type\":\"object\",\"properties\":{\"$schema\":{\"description\":\"Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.\",\"type\":\"string\"},\"extends\":{\"description\":\"Optionally specifies one or more JSON config files that will be combined with this file. This provides a way for standard settings to be shared across multiple projects. Important: The \\\"extends\\\" paths are resolved using NodeJS module resolution, so a path to a local file MUST be prefixed with \\\"./\\\".\",\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"noStandardTags\":{\"description\":\"By default, the config file loader will predefine all of the standardized TSDoc tags. To disable this and start with a completely empty configuration, set \\\"noStandardTags\\\"=true.\",\"type\":\"boolean\"},\"tagDefinitions\":{\"description\":\"Additional tags to support when parsing documentation comments with TSDoc.\",\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tsdocTagDefinition\"}},\"supportedHtmlElements\":{\"description\":\"The HTML element names that are supported in this configuration. Used in conjunction with the \\\"reportUnsupportedHtmlElements\\\" setting.\",\"type\":\"array\",\"items\":{\"type\":\"string\",\"pattern\":\"^[a-zA-Z0-9-]+$\"}},\"reportUnsupportedHtmlElements\":{\"description\":\"Whether an error should be reported when an unsupported HTML element is encountered in a doc comment. Defaults to \\\"true\\\" if the \\\"supportedHtmlElements\\\" field is present in this file, \\\"false\\\" if not.\",\"type\":\"boolean\"},\"supportForTags\":{\"description\":\"A collection of key/value pairs. The key is a TSDoc tag name (e.g. \\\"@myTag\\\") that must be defined in this configuration. The value is a boolean indicating whether the tag is supported. The TSDoc parser may report warnings when unsupported tags are encountered. If \\\"supportForTags\\\" is specified for at least one tag, then the \\\"reportUnsupportedTags\\\" validation check is enabled by default.\",\"type\":\"object\",\"patternProperties\":{\"@[a-zA-Z][a-zA-Z0-9]*$\":{\"type\":\"boolean\"}},\"additionalItems\":false}},\"required\":[\"$schema\"],\"additionalProperties\":false,\"definitions\":{\"tsdocTagDefinition\":{\"description\":\"Configuration for a custom supported TSDoc tag.\",\"type\":\"object\",\"properties\":{\"tagName\":{\"description\":\"Name of the custom tag. TSDoc tag names start with an at-sign (@) followed by ASCII letters using camelCase capitalization.\",\"type\":\"string\"},\"syntaxKind\":{\"description\":\"Syntax kind of the custom tag. \\\"inline\\\" means that this tag can appear inside other documentation sections (example: {@link}). \\\"block\\\" means that this tag starts a new documentation section (example: @remarks). \\\"modifier\\\" means that this tag's presence indicates an aspect of the associated API item (example: @internal).\",\"type\":\"string\",\"enum\":[\"inline\",\"block\",\"modifier\"]},\"allowMultiple\":{\"description\":\"If true, then this tag may appear multiple times in a doc comment. By default, a tag may only appear once.\",\"type\":\"boolean\"}},\"required\":[\"tagName\",\"syntaxKind\"],\"additionalProperties\":false}}}";
|
||||
const jsonSchema = jju.parse(jsonSchemaContent, { mode: 'cjson' });
|
||||
return ajv.compile(jsonSchema);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
diff --git a/dist/rollup-plugin-typescript2.cjs.js b/dist/rollup-plugin-typescript2.cjs.js
|
||||
index 9ab972b041cc76f8f786d6a20f3efb53c364cad6..13e056a3c0971eb18b307d91fad096a9f3b9de79 100644
|
||||
--- a/dist/rollup-plugin-typescript2.cjs.js
|
||||
+++ b/dist/rollup-plugin-typescript2.cjs.js
|
||||
@@ -29799,6 +29799,13 @@ const typescript = (options) => {
|
||||
declarations[key] = { type: result.dts, map: result.dtsmap };
|
||||
context.debug(() => `${safe.exports.blue("generated declarations")} for '${key}'`);
|
||||
}
|
||||
+ // if a user sets this compilerOption, they probably want another plugin (e.g. Babel, ESBuild) to transform their TS instead, while rpt2 just type-checks and/or outputs declarations
|
||||
+ // note that result.code is non-existent if emitDeclarationOnly per https://github.com/ezolenko/rollup-plugin-typescript2/issues/268
|
||||
+ if (parsedConfig.options.emitDeclarationOnly)
|
||||
+ {
|
||||
+ context.debug(() => `${blue("emitDeclarationOnly")} enabled, not transforming TS'`);
|
||||
+ return undefined;
|
||||
+ }
|
||||
const transformResult = { code: result.code, map: { mappings: "" } };
|
||||
if (result.map) {
|
||||
if (pluginOptions.sourceMapCallback)
|
||||
diff --git a/dist/rollup-plugin-typescript2.es.js b/dist/rollup-plugin-typescript2.es.js
|
||||
index e43bf8f03bc6792b61d8352e04bb6466712426c2..420e8f0d0d109076bc72e9d60240077235a9ba11 100644
|
||||
--- a/dist/rollup-plugin-typescript2.es.js
|
||||
+++ b/dist/rollup-plugin-typescript2.es.js
|
||||
@@ -29770,6 +29770,13 @@ const typescript = (options) => {
|
||||
declarations[key] = { type: result.dts, map: result.dtsmap };
|
||||
context.debug(() => `${safe.exports.blue("generated declarations")} for '${key}'`);
|
||||
}
|
||||
+ // if a user sets this compilerOption, they probably want another plugin (e.g. Babel, ESBuild) to transform their TS instead, while rpt2 just type-checks and/or outputs declarations
|
||||
+ // note that result.code is non-existent if emitDeclarationOnly per https://github.com/ezolenko/rollup-plugin-typescript2/issues/268
|
||||
+ if (parsedConfig.options.emitDeclarationOnly)
|
||||
+ {
|
||||
+ context.debug(() => `${blue("emitDeclarationOnly")} enabled, not transforming TS'`);
|
||||
+ return undefined;
|
||||
+ }
|
||||
const transformResult = { code: result.code, map: { mappings: "" } };
|
||||
if (result.map) {
|
||||
if (pluginOptions.sourceMapCallback)
|
||||
191
LICENSE
Normal file
191
LICENSE
Normal file
@@ -0,0 +1,191 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Copyright 2021 Noel Buechler
|
||||
Copyright 2015 Amish Shah
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
29
README.md
29
README.md
@@ -1,16 +1,19 @@
|
||||
<div align="center">
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
|
||||
<a href="https://www.npmjs.com/package/discord.js"><img src="https://img.shields.io/npm/v/discord.js.svg?maxAge=3600" alt="npm version" /></a>
|
||||
<a href="https://www.npmjs.com/package/discord.js"><img src="https://img.shields.io/npm/dt/discord.js.svg?maxAge=3600" alt="npm downloads" /></a>
|
||||
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/test.yml/badge.svg" alt="Tests status" /></a>
|
||||
<a href="https://codecov.io/gh/discordjs/discord.js" ><img src="https://codecov.io/gh/discordjs/discord.js/branch/main/graph/badge.svg?precision=2" alt="Code coverage" /></a>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
|
||||
<a href="https://www.npmjs.com/package/discord.js"><img src="https://img.shields.io/npm/v/discord.js.svg?maxAge=3600" alt="npm version" /></a>
|
||||
<a href="https://www.npmjs.com/package/discord.js"><img src="https://img.shields.io/npm/dt/discord.js.svg?maxAge=3600" alt="npm downloads" /></a>
|
||||
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/test.yml/badge.svg" alt="Tests status" /></a>
|
||||
<a href="https://codecov.io/gh/discordjs/discord.js" ><img src="https://codecov.io/gh/discordjs/discord.js/branch/main/graph/badge.svg?precision=2" alt="Code coverage" /></a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"><img src="https://raw.githubusercontent.com/discordjs/discord.js/main/.github/powered-by-vercel.svg" alt="Vercel" /></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
## About
|
||||
@@ -105,7 +108,7 @@ client.login('token');
|
||||
- [Website](https://discord.js.org/) ([source](https://github.com/discordjs/discord.js/tree/main/packages/website))
|
||||
- [Documentation](https://discord.js.org/#/docs)
|
||||
- [Guide](https://discordjs.guide/) ([source](https://github.com/discordjs/guide))
|
||||
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v13.html), including updated and removed items in the library.
|
||||
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v14.html), including updated and removed items in the library.
|
||||
- [discord.js Discord server](https://discord.gg/djs)
|
||||
- [Discord API Discord server](https://discord.gg/discord-api)
|
||||
- [GitHub](https://github.com/discordjs/discord.js)
|
||||
|
||||
93
build.config.ts
Normal file
93
build.config.ts
Normal file
@@ -0,0 +1,93 @@
|
||||
import { relative, resolve } from 'node:path';
|
||||
import glob from 'fast-glob';
|
||||
import typescript from 'rollup-plugin-typescript2';
|
||||
import { defineBuildConfig, BuildEntry } from 'unbuild';
|
||||
|
||||
interface ConfigOptions {
|
||||
entries: (BuildEntry | string)[];
|
||||
minify: boolean;
|
||||
emitCJS: boolean;
|
||||
externals: string[];
|
||||
cjsBridge: boolean;
|
||||
sourcemap: boolean;
|
||||
preserveModules: boolean;
|
||||
preserveModulesRoot: string;
|
||||
declaration: boolean;
|
||||
typeCheck: boolean;
|
||||
}
|
||||
|
||||
export function createUnbuildConfig({
|
||||
entries = [{ builder: 'rollup', input: 'src/index' }],
|
||||
minify = false,
|
||||
emitCJS = true,
|
||||
cjsBridge = true,
|
||||
externals = [],
|
||||
sourcemap = true,
|
||||
preserveModules = true,
|
||||
preserveModulesRoot = 'src',
|
||||
declaration = true,
|
||||
typeCheck = false,
|
||||
}: Partial<ConfigOptions> = {}) {
|
||||
const files = glob
|
||||
.sync('**', { cwd: 'src' })
|
||||
.map((file) => [`${file.slice(0, -2)}cjs`, `${file.slice(0, -2)}mjs`])
|
||||
.flat();
|
||||
|
||||
return defineBuildConfig({
|
||||
entries,
|
||||
clean: true,
|
||||
rollup: {
|
||||
esbuild: {
|
||||
minify,
|
||||
minifyIdentifiers: false,
|
||||
},
|
||||
emitCJS,
|
||||
cjsBridge,
|
||||
json: {
|
||||
namedExports: false,
|
||||
},
|
||||
},
|
||||
|
||||
externals: [...files, ...externals],
|
||||
|
||||
hooks: {
|
||||
'rollup:options': (_, options) => {
|
||||
// @ts-expect-error: This will always be an array
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
options.output![0] = {
|
||||
// @ts-expect-error: This will always be an array
|
||||
...options.output![0],
|
||||
sourcemap,
|
||||
preserveModules,
|
||||
preserveModulesRoot,
|
||||
};
|
||||
|
||||
if (emitCJS) {
|
||||
// @ts-expect-error: This will always be an array
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
options.output![1] = {
|
||||
// @ts-expect-error: This will always be an array
|
||||
...options.output![1],
|
||||
sourcemap,
|
||||
preserveModules,
|
||||
preserveModulesRoot,
|
||||
};
|
||||
}
|
||||
|
||||
if (declaration) {
|
||||
options.plugins?.unshift(
|
||||
typescript({
|
||||
check: typeCheck,
|
||||
tsconfig: relative(__dirname, resolve(process.cwd(), 'tsconfig.json')),
|
||||
tsconfigOverride: {
|
||||
compilerOptions: {
|
||||
emitDeclarationOnly: true,
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
26
package.json
26
package.json
@@ -4,14 +4,13 @@
|
||||
"description": "A powerful library for interacting with the Discord API",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "turbo run build",
|
||||
"test": "turbo run test",
|
||||
"lint": "turbo run lint",
|
||||
"format": "turbo run format",
|
||||
"fmt": "turbo run format",
|
||||
"build": "yarn workspaces foreach --parallel --topological run build",
|
||||
"test": "yarn workspaces foreach --parallel --topological run test",
|
||||
"lint": "yarn workspaces foreach --parallel --topological run lint",
|
||||
"format": "yarn workspaces foreach --parallel --topological run format",
|
||||
"fmt": "yarn format",
|
||||
"postinstall": "is-ci || husky install",
|
||||
"docs": "turbo run docs",
|
||||
"changelog": "turbo run changelog",
|
||||
"docs": "yarn workspaces foreach --parallel --topological run docs",
|
||||
"update": "yarn upgrade-interactive"
|
||||
},
|
||||
"contributors": [
|
||||
@@ -42,20 +41,25 @@
|
||||
"@commitlint/config-angular": "^17.0.3",
|
||||
"@favware/cliff-jumper": "^1.8.5",
|
||||
"@favware/npm-deprecate": "^1.0.4",
|
||||
"@typescript-eslint/eslint-plugin": "^5.30.6",
|
||||
"@typescript-eslint/parser": "^5.30.6",
|
||||
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
||||
"@typescript-eslint/parser": "^5.31.0",
|
||||
"conventional-changelog-cli": "^2.2.2",
|
||||
"eslint": "^8.20.0",
|
||||
"eslint-config-marine": "^9.4.1",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-import-resolver-typescript": "^3.2.7",
|
||||
"eslint-import-resolver-typescript": "^3.3.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"fast-glob": "^3.2.11",
|
||||
"husky": "^8.0.1",
|
||||
"is-ci": "^3.0.1",
|
||||
"lint-staged": "^13.0.3",
|
||||
"prettier": "^2.7.1",
|
||||
"turbo": "^1.3.1",
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"resolutions": {
|
||||
"rollup-plugin-typescript2@0.32.1": "patch:rollup-plugin-typescript2@npm:0.32.1#.yarn/patches/rollup-plugin-typescript2-npm-0.32.1-b5887420f2.patch",
|
||||
"@microsoft/tsdoc-config": "patch:@microsoft/tsdoc-config@npm:0.16.1#.yarn/patches/@microsoft-tsdoc-config-npm-0.16.1-81031b1bbf.patch"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.9.0"
|
||||
},
|
||||
|
||||
1
packages/actions/.lintstagedrc.js
Normal file
1
packages/actions/.lintstagedrc.js
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('../../.lintstagedrc.json');
|
||||
@@ -4,10 +4,13 @@
|
||||
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<p>
|
||||
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
|
||||
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/test.yml/badge.svg" alt="Build status" /></a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"><img src="https://raw.githubusercontent.com/discordjs/discord.js/main/.github/powered-by-vercel.svg" alt="Vercel" /></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
## Links
|
||||
@@ -15,7 +18,7 @@
|
||||
- [Website](https://discord.js.org/) ([source](https://github.com/discordjs/discord.js/tree/main/packages/website))
|
||||
- [Documentation](https://discord.js.org/#/docs)
|
||||
- [Guide](https://discordjs.guide/) ([source](https://github.com/discordjs/guide))
|
||||
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v13.html), including updated and removed items in the library.
|
||||
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v14.html), including updated and removed items in the library.
|
||||
- [discord.js Discord server](https://discord.gg/djs)
|
||||
- [Discord API Discord server](https://discord.gg/discord-api)
|
||||
- [GitHub](https://github.com/discordjs/discord.js/tree/main/packages/scripts)
|
||||
|
||||
@@ -11,8 +11,8 @@ describe('Format Tag', () => {
|
||||
});
|
||||
|
||||
test('GIVEN tag with no prefix THEN return tag', () => {
|
||||
expect(formatTag('13.5.1')).toEqual({ semver: '13.5.1' });
|
||||
expect(formatTag('13.7.0')).toEqual({ package: undefined, semver: '13.7.0' });
|
||||
expect(formatTag('13.5.1')).toEqual({ package: 'discord.js', semver: '13.5.1' });
|
||||
expect(formatTag('13.7.0')).toEqual({ package: 'discord.js', semver: '13.7.0' });
|
||||
});
|
||||
|
||||
test('GIVEN no or invalid tag THEN return null', () => {
|
||||
|
||||
3
packages/actions/build.config.ts
Normal file
3
packages/actions/build.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { createUnbuildConfig } from '../../build.config';
|
||||
|
||||
export default createUnbuildConfig({ minify: true });
|
||||
@@ -1,20 +1,21 @@
|
||||
{
|
||||
"name": "@discordjs/actions",
|
||||
"version": "0.1.0-dev",
|
||||
"version": "0.1.0",
|
||||
"description": "A set of actions that we use for our workflows",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "tsup",
|
||||
"build": "unbuild",
|
||||
"lint": "prettier --check . && eslint src __tests__ --ext mjs,js,ts",
|
||||
"format": "prettier --write . && eslint src __tests__ --ext mjs,js,ts --fix"
|
||||
"format": "prettier --write . && eslint src __tests__ --ext mjs,js,ts --fix",
|
||||
"fmt": "yarn format"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.js",
|
||||
"require": "./dist/index.cjs",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"directories": {
|
||||
@@ -49,12 +50,14 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.11.45",
|
||||
"c8": "^7.11.3",
|
||||
"c8": "^7.12.0",
|
||||
"eslint": "^8.20.0",
|
||||
"prettier": "^2.7.1",
|
||||
"tsup": "^6.1.3",
|
||||
"rollup-plugin-typescript2": "0.32.1",
|
||||
"tsup": "^6.2.0",
|
||||
"typescript": "^4.7.4",
|
||||
"vitest": "^0.18.1"
|
||||
"unbuild": "^0.7.6",
|
||||
"vitest": "^0.19.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.9.0"
|
||||
|
||||
@@ -2,7 +2,10 @@ export function formatTag(tag: string) {
|
||||
const parsed = /(^@.*\/(?<package>.*)@v?)?(?<semver>\d+.\d+.\d+)-?.*/.exec(tag);
|
||||
|
||||
if (parsed?.groups) {
|
||||
return parsed.groups;
|
||||
return {
|
||||
package: parsed.groups.package ?? 'discord.js',
|
||||
semver: parsed.groups.semver,
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -45,6 +45,12 @@ runs:
|
||||
files: ./packages/website/coverage/cobertura-coverage.xml
|
||||
flags: website
|
||||
|
||||
- name: Upload WS Coverage
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
files: ./packages/ws/coverage/cobertura-coverage.xml
|
||||
flags: ws
|
||||
|
||||
- name: Upload Utilities Coverage
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
|
||||
1
packages/builders/.lintstagedrc.js
Normal file
1
packages/builders/.lintstagedrc.js
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('../../.lintstagedrc.json');
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
# [@discordjs/builders@1.0.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@0.16.0...@discordjs/builders@1.0.0) - (2022-07-17)
|
||||
|
||||
## Info
|
||||
|
||||
- 1.0.0 release bump, no new features.
|
||||
|
||||
# [@discordjs/builders@0.16.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@0.15.0...@discordjs/builders@0.16.0) - (2022-07-17)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
@@ -4,13 +4,16 @@
|
||||
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<p>
|
||||
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
|
||||
<a href="https://www.npmjs.com/package/@discordjs/builders"><img src="https://img.shields.io/npm/v/@discordjs/builders.svg?maxAge=3600" alt="npm version" /></a>
|
||||
<a href="https://www.npmjs.com/package/@discordjs/builders"><img src="https://img.shields.io/npm/dt/@discordjs/builders.svg?maxAge=3600" alt="npm downloads" /></a>
|
||||
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/test.yml/badge.svg" alt="Build status" /></a>
|
||||
<a href="https://codecov.io/gh/discordjs/discord.js" ><img src="https://codecov.io/gh/discordjs/discord.js/branch/main/graph/badge.svg?precision=2&flag=builders" alt="Code coverage" /></a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"><img src="https://raw.githubusercontent.com/discordjs/discord.js/main/.github/powered-by-vercel.svg" alt="Vercel" /></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
## Installation
|
||||
@@ -34,7 +37,7 @@ Here are some examples for the builders and utilities you can find in this packa
|
||||
- [Website](https://discord.js.org/) ([source](https://github.com/discordjs/discord.js/tree/main/packages/website))
|
||||
- [Documentation](https://discord.js.org/#/docs/builders)
|
||||
- [Guide](https://discordjs.guide/) ([source](https://github.com/discordjs/guide))
|
||||
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v13.html), including updated and removed items in the library.
|
||||
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v14.html), including updated and removed items in the library.
|
||||
- [discord.js Discord server](https://discord.gg/djs)
|
||||
- [Discord API Discord server](https://discord.gg/discord-api)
|
||||
- [GitHub](https://github.com/discordjs/discord.js/tree/main/packages/builders)
|
||||
|
||||
73
packages/builders/__tests__/components/components.test.ts
Normal file
73
packages/builders/__tests__/components/components.test.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import {
|
||||
APIActionRowComponent,
|
||||
APIButtonComponent,
|
||||
APIMessageActionRowComponent,
|
||||
APISelectMenuComponent,
|
||||
APITextInputComponent,
|
||||
ButtonStyle,
|
||||
ComponentType,
|
||||
TextInputStyle,
|
||||
} from 'discord-api-types/v10';
|
||||
import { describe, test, expect } from 'vitest';
|
||||
import {
|
||||
ActionRowBuilder,
|
||||
ButtonBuilder,
|
||||
createComponentBuilder,
|
||||
SelectMenuBuilder,
|
||||
TextInputBuilder,
|
||||
} from '../../src/index';
|
||||
|
||||
describe('createComponentBuilder', () => {
|
||||
test.each([ButtonBuilder, SelectMenuBuilder, TextInputBuilder])(
|
||||
'passing an instance of %j should return itself',
|
||||
(Builder) => {
|
||||
const builder = new Builder();
|
||||
expect(createComponentBuilder(builder)).toBe(builder);
|
||||
},
|
||||
);
|
||||
|
||||
test('GIVEN an action row component THEN returns a ActionRowBuilder', () => {
|
||||
const actionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
||||
components: [],
|
||||
type: ComponentType.ActionRow,
|
||||
};
|
||||
|
||||
expect(createComponentBuilder(actionRow)).toBeInstanceOf(ActionRowBuilder);
|
||||
});
|
||||
|
||||
test('GIVEN a button component THEN returns a ButtonBuilder', () => {
|
||||
const button: APIButtonComponent = {
|
||||
custom_id: 'abc',
|
||||
style: ButtonStyle.Primary,
|
||||
type: ComponentType.Button,
|
||||
};
|
||||
|
||||
expect(createComponentBuilder(button)).toBeInstanceOf(ButtonBuilder);
|
||||
});
|
||||
|
||||
test('GIVEN a select menu component THEN returns a SelectMenuBuilder', () => {
|
||||
const selectMenu: APISelectMenuComponent = {
|
||||
custom_id: 'abc',
|
||||
options: [],
|
||||
type: ComponentType.SelectMenu,
|
||||
};
|
||||
|
||||
expect(createComponentBuilder(selectMenu)).toBeInstanceOf(SelectMenuBuilder);
|
||||
});
|
||||
|
||||
test('GIVEN a text input component THEN returns a TextInputBuilder', () => {
|
||||
const textInput: APITextInputComponent = {
|
||||
custom_id: 'abc',
|
||||
label: 'abc',
|
||||
style: TextInputStyle.Short,
|
||||
type: ComponentType.TextInput,
|
||||
};
|
||||
|
||||
expect(createComponentBuilder(textInput)).toBeInstanceOf(TextInputBuilder);
|
||||
});
|
||||
|
||||
test('GIVEN an unknown component type THEN throws error', () => {
|
||||
// @ts-expect-error
|
||||
expect(() => createComponentBuilder({ type: 'invalid' })).toThrowError();
|
||||
});
|
||||
});
|
||||
@@ -149,6 +149,17 @@ describe('Select Menu Components', () => {
|
||||
}).toThrowError();
|
||||
});
|
||||
|
||||
test('GIVEN valid option types THEN does not throw', () => {
|
||||
expect(() =>
|
||||
selectMenu().addOptions({
|
||||
label: 'test',
|
||||
value: 'test',
|
||||
}),
|
||||
).not.toThrowError();
|
||||
|
||||
expect(() => selectMenu().addOptions(selectMenuOption().setLabel('test').setValue('test'))).not.toThrowError();
|
||||
});
|
||||
|
||||
test('GIVEN valid JSON input THEN valid JSON history is correct', () => {
|
||||
expect(
|
||||
new SelectMenuBuilder(selectMenuDataWithoutOptions)
|
||||
|
||||
@@ -86,6 +86,10 @@ describe('Context Menu Commands', () => {
|
||||
test('GIVEN valid builder with defaultPermission false THEN does not throw error', () => {
|
||||
expect(() => getBuilder().setName('foo').setDefaultPermission(false)).not.toThrowError();
|
||||
});
|
||||
|
||||
test('GIVEN valid builder with dmPermission false THEN does not throw error', () => {
|
||||
expect(() => getBuilder().setName('foo').setDMPermission(false)).not.toThrowError();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Context menu command localizations', () => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
APIApplicationCommandAttachmentOption,
|
||||
APIApplicationCommandBooleanOption,
|
||||
APIApplicationCommandChannelOption,
|
||||
APIApplicationCommandIntegerOption,
|
||||
@@ -12,6 +13,7 @@ import {
|
||||
} from 'discord-api-types/v10';
|
||||
import { describe, test, expect } from 'vitest';
|
||||
import {
|
||||
SlashCommandAttachmentOption,
|
||||
SlashCommandBooleanOption,
|
||||
SlashCommandChannelOption,
|
||||
SlashCommandIntegerOption,
|
||||
@@ -58,6 +60,9 @@ const getRoleOption = () => new SlashCommandRoleOption().setName('owo').setDescr
|
||||
const getMentionableOption = () =>
|
||||
new SlashCommandMentionableOption().setName('owo').setDescription('Testing 123').setRequired(true);
|
||||
|
||||
const getAttachmentOption = () =>
|
||||
new SlashCommandAttachmentOption().setName('attachment').setDescription('attachment').setRequired(true);
|
||||
|
||||
describe('Application Command toJSON() results', () => {
|
||||
test('GIVEN a boolean option THEN calling toJSON should return a valid JSON', () => {
|
||||
expect(getBooleanOption().toJSON()).toEqual<APIApplicationCommandBooleanOption>({
|
||||
@@ -205,4 +210,13 @@ describe('Application Command toJSON() results', () => {
|
||||
required: true,
|
||||
});
|
||||
});
|
||||
|
||||
test('GIVEN an attachment option THEN calling toJSON should return a valid JSON', () => {
|
||||
expect(getAttachmentOption().toJSON()).toEqual<APIApplicationCommandAttachmentOption>({
|
||||
name: 'attachment',
|
||||
description: 'attachment',
|
||||
type: ApplicationCommandOptionType.Attachment,
|
||||
required: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -93,6 +93,7 @@ describe('Slash Commands', () => {
|
||||
test('GIVEN valid array of options or choices THEN does not throw error', () => {
|
||||
expect(() => SlashCommandAssertions.validateMaxOptionsLength([])).not.toThrowError();
|
||||
|
||||
expect(() => SlashCommandAssertions.validateChoicesLength(25)).not.toThrowError();
|
||||
expect(() => SlashCommandAssertions.validateChoicesLength(25, [])).not.toThrowError();
|
||||
});
|
||||
|
||||
@@ -133,6 +134,7 @@ describe('Slash Commands', () => {
|
||||
getBuilder()
|
||||
.setName('example')
|
||||
.setDescription('Example command')
|
||||
.setDMPermission(false)
|
||||
.addBooleanOption((boolean) =>
|
||||
boolean.setName('iscool').setDescription('Are we cool or what?').setRequired(true),
|
||||
)
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { APIModalInteractionResponseCallbackData, ComponentType, TextInputStyle } from 'discord-api-types/v10';
|
||||
import {
|
||||
APIModalInteractionResponseCallbackData,
|
||||
APITextInputComponent,
|
||||
ComponentType,
|
||||
TextInputStyle,
|
||||
} from 'discord-api-types/v10';
|
||||
import { describe, test, expect } from 'vitest';
|
||||
import {
|
||||
ActionRowBuilder,
|
||||
@@ -49,16 +54,18 @@ describe('Modals', () => {
|
||||
|
||||
test('GIVEN valid fields THEN builder does not throw', () => {
|
||||
expect(() =>
|
||||
modal()
|
||||
.setTitle('test')
|
||||
.setCustomId('foobar')
|
||||
.setComponents(new ActionRowBuilder())
|
||||
.addComponents([new ActionRowBuilder()]),
|
||||
modal().setTitle('test').setCustomId('foobar').setComponents(new ActionRowBuilder()),
|
||||
).not.toThrowError();
|
||||
|
||||
expect(() =>
|
||||
// @ts-expect-error: You can pass a TextInputBuilder and it will add it to an action row
|
||||
modal().setTitle('test').setCustomId('foobar').addComponents(new TextInputBuilder()),
|
||||
).not.toThrowError();
|
||||
});
|
||||
|
||||
test('GIVEN invalid fields THEN builder does throw', () => {
|
||||
expect(() => modal().setTitle('test').setCustomId('foobar').toJSON()).toThrowError();
|
||||
|
||||
// @ts-expect-error
|
||||
expect(() => modal().setTitle('test').setCustomId(42).toJSON()).toThrowError();
|
||||
});
|
||||
@@ -112,4 +119,55 @@ describe('Modals', () => {
|
||||
.toJSON(),
|
||||
).toEqual(modalData);
|
||||
});
|
||||
|
||||
describe('equals()', () => {
|
||||
const textInput1 = new TextInputBuilder()
|
||||
.setCustomId('custom id')
|
||||
.setLabel('label')
|
||||
.setStyle(TextInputStyle.Paragraph);
|
||||
|
||||
const textInput2: APITextInputComponent = {
|
||||
type: ComponentType.TextInput,
|
||||
custom_id: 'custom id',
|
||||
label: 'label',
|
||||
style: TextInputStyle.Paragraph,
|
||||
};
|
||||
|
||||
test('GIVEN equal builders THEN returns true', () => {
|
||||
const equalTextInput = new TextInputBuilder()
|
||||
.setCustomId('custom id')
|
||||
.setLabel('label')
|
||||
.setStyle(TextInputStyle.Paragraph);
|
||||
|
||||
expect(textInput1.equals(equalTextInput)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('GIVEN the same builder THEN returns true', () => {
|
||||
expect(textInput1.equals(textInput1)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('GIVEN equal builder and data THEN returns true', () => {
|
||||
expect(textInput1.equals(textInput2)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('GIVEN different builders THEN returns false', () => {
|
||||
const diffTextInput = new TextInputBuilder()
|
||||
.setCustomId('custom id')
|
||||
.setLabel('label 2')
|
||||
.setStyle(TextInputStyle.Paragraph);
|
||||
|
||||
expect(textInput1.equals(diffTextInput)).toBeFalsy();
|
||||
});
|
||||
|
||||
test('GIVEN different text input builder and data THEN returns false', () => {
|
||||
const diffTextInputData: APITextInputComponent = {
|
||||
type: ComponentType.TextInput,
|
||||
custom_id: 'custom id',
|
||||
label: 'label 2',
|
||||
style: TextInputStyle.Short,
|
||||
};
|
||||
|
||||
expect(textInput1.equals(diffTextInputData)).toBeFalsy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -24,11 +24,11 @@ import {
|
||||
describe('Message formatters', () => {
|
||||
describe('codeBlock', () => {
|
||||
test('GIVEN "discord.js" with no language THEN returns "```\\ndiscord.js```"', () => {
|
||||
expect<'```\ndiscord.js```'>(codeBlock('discord.js')).toEqual('```\ndiscord.js```');
|
||||
expect<'```\ndiscord.js\n```'>(codeBlock('discord.js')).toEqual('```\ndiscord.js\n```');
|
||||
});
|
||||
|
||||
test('GIVEN "discord.js" with "js" as language THEN returns "```js\\ndiscord.js```"', () => {
|
||||
expect<'```js\ndiscord.js```'>(codeBlock('js', 'discord.js')).toEqual('```js\ndiscord.js```');
|
||||
expect<'```js\ndiscord.js\n```'>(codeBlock('js', 'discord.js')).toEqual('```js\ndiscord.js\n```');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
42
packages/builders/__tests__/util.test.ts
Normal file
42
packages/builders/__tests__/util.test.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { describe, test, expect } from 'vitest';
|
||||
import {
|
||||
isJSONEncodable,
|
||||
isEquatable,
|
||||
ActionRowBuilder,
|
||||
enableValidators,
|
||||
disableValidators,
|
||||
isValidationEnabled,
|
||||
} from '../src/index';
|
||||
|
||||
describe('isEquatable', () => {
|
||||
test('returns true if the object is equatable', () => {
|
||||
expect(isEquatable({ equals: () => true })).toBeTruthy();
|
||||
});
|
||||
|
||||
test('returns false if the object is not equatable', () => {
|
||||
expect(isEquatable({})).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('isJSONEncodable', () => {
|
||||
test('returns true if the object is JSON encodable', () => {
|
||||
expect(isJSONEncodable({ toJSON: () => ({}) })).toBeTruthy();
|
||||
expect(isJSONEncodable(new ActionRowBuilder())).toBeTruthy();
|
||||
});
|
||||
|
||||
test('returns false if the object is not JSON encodable', () => {
|
||||
expect(isJSONEncodable({})).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('validation', () => {
|
||||
test('enables validation', () => {
|
||||
enableValidators();
|
||||
expect(isValidationEnabled()).toBeTruthy();
|
||||
});
|
||||
|
||||
test('disables validation', () => {
|
||||
disableValidators();
|
||||
expect(isValidationEnabled()).toBeFalsy();
|
||||
});
|
||||
});
|
||||
@@ -45,7 +45,7 @@
|
||||
*
|
||||
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
|
||||
*/
|
||||
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts",
|
||||
"mainEntryPointFilePath": "<projectFolder>/docs/dist/index.d.ts",
|
||||
|
||||
/**
|
||||
* A list of NPM package names whose exports should be treated as part of this package.
|
||||
|
||||
3
packages/builders/build.config.ts
Normal file
3
packages/builders/build.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { createUnbuildConfig } from '../../build.config';
|
||||
|
||||
export default createUnbuildConfig();
|
||||
@@ -1,23 +1,24 @@
|
||||
{
|
||||
"name": "@discordjs/builders",
|
||||
"version": "0.17.0-dev",
|
||||
"version": "1.0.0",
|
||||
"description": "A set of builders that you can use when creating your bot",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "tsup",
|
||||
"build": "unbuild",
|
||||
"lint": "prettier --check . && eslint src __tests__ --ext mjs,js,ts",
|
||||
"format": "prettier --write . && eslint src __tests__ --ext mjs,js,ts --fix",
|
||||
"docs": "docgen -i src/index.ts -c docs/index.json -o docs/docs.json --typescript && api-extractor run --local",
|
||||
"prepack": "yarn build && yarn lint",
|
||||
"fmt": "yarn format",
|
||||
"docs": "downlevel-dts . docs --to=3.7 && docgen -i src/index.ts -c docs/index.json -o docs/docs.json --typescript && api-extractor run --local",
|
||||
"prepack": "yarn lint && yarn test && yarn build",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/builders/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.js",
|
||||
"require": "./dist/index.cjs",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"directories": {
|
||||
@@ -54,23 +55,25 @@
|
||||
"homepage": "https://discord.js.org",
|
||||
"dependencies": {
|
||||
"@sapphire/shapeshift": "^3.5.1",
|
||||
"discord-api-types": "^0.36.2",
|
||||
"discord-api-types": "^0.36.3",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"ts-mixer": "^6.0.1",
|
||||
"tslib": "^2.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@discordjs/docgen": "workspace:^",
|
||||
"@discordjs/scripts": "workspace:^",
|
||||
"@favware/cliff-jumper": "^1.8.5",
|
||||
"@microsoft/api-extractor": "^7.28.4",
|
||||
"@microsoft/api-extractor": "^7.28.6",
|
||||
"@types/node": "^16.11.45",
|
||||
"c8": "^7.11.3",
|
||||
"c8": "^7.12.0",
|
||||
"downlevel-dts": "^0.10.0",
|
||||
"eslint": "^8.20.0",
|
||||
"prettier": "^2.7.1",
|
||||
"tsup": "^6.1.3",
|
||||
"rollup-plugin-typescript2": "0.32.1",
|
||||
"tsup": "^6.2.0",
|
||||
"typescript": "^4.7.4",
|
||||
"vitest": "^0.18.1"
|
||||
"unbuild": "^0.7.6",
|
||||
"vitest": "^0.19.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.9.0"
|
||||
|
||||
@@ -35,19 +35,19 @@ export const labelValueDescriptionValidator = s.string
|
||||
.lengthGreaterThanOrEqual(1)
|
||||
.lengthLessThanOrEqual(100)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
export const optionValidator = s
|
||||
.union(
|
||||
s.object({
|
||||
label: labelValueDescriptionValidator,
|
||||
value: labelValueDescriptionValidator,
|
||||
description: labelValueDescriptionValidator.optional,
|
||||
emoji: emojiValidator.optional,
|
||||
default: s.boolean.optional,
|
||||
}),
|
||||
s.instance(SelectMenuOptionBuilder),
|
||||
)
|
||||
|
||||
export const jsonOptionValidator = s
|
||||
.object({
|
||||
label: labelValueDescriptionValidator,
|
||||
value: labelValueDescriptionValidator,
|
||||
description: labelValueDescriptionValidator.optional,
|
||||
emoji: emojiValidator.optional,
|
||||
default: s.boolean.optional,
|
||||
})
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const optionValidator = s.instance(SelectMenuOptionBuilder).setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const optionsValidator = optionValidator.array
|
||||
.lengthGreaterThanOrEqual(0)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
@@ -4,9 +4,9 @@ import { normalizeArray, type RestOrArray } from '../../util/normalizeArray';
|
||||
import {
|
||||
customIdValidator,
|
||||
disabledValidator,
|
||||
jsonOptionValidator,
|
||||
minMaxValidator,
|
||||
optionsLengthValidator,
|
||||
optionValidator,
|
||||
placeholderValidator,
|
||||
validateRequiredSelectMenuParameters,
|
||||
} from '../Assertions';
|
||||
@@ -90,7 +90,7 @@ export class SelectMenuBuilder extends ComponentBuilder<APISelectMenuComponent>
|
||||
...options.map((option) =>
|
||||
option instanceof SelectMenuOptionBuilder
|
||||
? option
|
||||
: new SelectMenuOptionBuilder(optionValidator.parse<APISelectMenuOption>(option)),
|
||||
: new SelectMenuOptionBuilder(jsonOptionValidator.parse(option)),
|
||||
),
|
||||
);
|
||||
return this;
|
||||
@@ -110,7 +110,7 @@ export class SelectMenuBuilder extends ComponentBuilder<APISelectMenuComponent>
|
||||
...options.map((option) =>
|
||||
option instanceof SelectMenuOptionBuilder
|
||||
? option
|
||||
: new SelectMenuOptionBuilder(optionValidator.parse<APISelectMenuOption>(option)),
|
||||
: new SelectMenuOptionBuilder(jsonOptionValidator.parse(option)),
|
||||
),
|
||||
);
|
||||
return this;
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { Snowflake } from 'discord-api-types/globals';
|
||||
*
|
||||
* @param content - The content to wrap
|
||||
*/
|
||||
export function codeBlock<C extends string>(content: C): `\`\`\`\n${C}\`\`\``;
|
||||
export function codeBlock<C extends string>(content: C): `\`\`\`\n${C}\n\`\`\``;
|
||||
|
||||
/**
|
||||
* Wraps the content inside a codeblock with the specified language
|
||||
@@ -14,9 +14,9 @@ export function codeBlock<C extends string>(content: C): `\`\`\`\n${C}\`\`\``;
|
||||
* @param language - The language for the codeblock
|
||||
* @param content - The content to wrap
|
||||
*/
|
||||
export function codeBlock<L extends string, C extends string>(language: L, content: C): `\`\`\`${L}\n${C}\`\`\``;
|
||||
export function codeBlock<L extends string, C extends string>(language: L, content: C): `\`\`\`${L}\n${C}\n\`\`\``;
|
||||
export function codeBlock(language: string, content?: string): string {
|
||||
return typeof content === 'undefined' ? `\`\`\`\n${language}\`\`\`` : `\`\`\`${language}\n${content}\`\`\``;
|
||||
return typeof content === 'undefined' ? `\`\`\`\n${language}\n\`\`\`` : `\`\`\`${language}\n${content}\n\`\`\``;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
1
packages/collection/.lintstagedrc.js
Normal file
1
packages/collection/.lintstagedrc.js
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('../../.lintstagedrc.json');
|
||||
@@ -33,6 +33,43 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
- **collection:** Improve coverage (#8222) ([a51f721](https://github.com/discordjs/discord.js/commit/a51f7215eca67a0f46fba8b2d706f7ec6f6dc228))
|
||||
|
||||
# [@discordjs/collection@1.0.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@0.8.0...@discordjs/collection@1.0.0) - (2022-07-17)
|
||||
|
||||
## Info
|
||||
|
||||
- 1.0.0 release bump, no new features.
|
||||
|
||||
# [@discordjs/collection@0.8.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@0.7.0...@discordjs/collection@0.8.0) - (2022-07-17)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **Collection:** Make error messages consistent (#8224) ([5bd6b28](https://github.com/discordjs/discord.js/commit/5bd6b28b3ebfced1cb9d23e83bd7c0def7a12404))
|
||||
- Check for function type (#8064) ([3bb9c0e](https://github.com/discordjs/discord.js/commit/3bb9c0e5c37311044ff41761b572ac4f91cda57c))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Add codecov coverage badge to readmes (#8226) ([f6db285](https://github.com/discordjs/discord.js/commit/f6db285c073898a749fe4591cbd4463d1896daf5))
|
||||
|
||||
## Features
|
||||
|
||||
- Codecov (#8219) ([f10f4cd](https://github.com/discordjs/discord.js/commit/f10f4cdcd88ca6be7ec735ed3a415ba13da83db0))
|
||||
- **docgen:** Update typedoc ([b3346f4](https://github.com/discordjs/discord.js/commit/b3346f4b9b3d4f96443506643d4631dc1c6d7b21))
|
||||
- Website (#8043) ([127931d](https://github.com/discordjs/discord.js/commit/127931d1df7a2a5c27923c2f2151dbf3824e50cc))
|
||||
- **docgen:** Typescript support ([3279b40](https://github.com/discordjs/discord.js/commit/3279b40912e6aa61507bedb7db15a2b8668de44b))
|
||||
- Docgen package (#8029) ([8b979c0](https://github.com/discordjs/discord.js/commit/8b979c0245c42fd824d8e98745ee869f5360fc86))
|
||||
- Use vitest instead of jest for more speed ([8d8e6c0](https://github.com/discordjs/discord.js/commit/8d8e6c03decd7352a2aa180f6e5bc1a13602539b))
|
||||
- Add scripts package for locally used scripts ([f2ae1f9](https://github.com/discordjs/discord.js/commit/f2ae1f9348bfd893332a9060f71a8a5f272a1b8b))
|
||||
|
||||
## Refactor
|
||||
|
||||
- **collection:** Remove `default` property (#8055) ([c8f1690](https://github.com/discordjs/discord.js/commit/c8f1690896f55f06e05a83704262783cfc2bb91d))
|
||||
- **collection:** Remove default export (#8053) ([16810f3](https://github.com/discordjs/discord.js/commit/16810f3e410bf35ed7e6e7412d517ea74c792c5d))
|
||||
- Move all the config files to root (#8033) ([769ea0b](https://github.com/discordjs/discord.js/commit/769ea0bfe78c4f1d413c6b397c604ffe91e39c6a))
|
||||
|
||||
## Testing
|
||||
|
||||
- **collection:** Improve coverage (#8222) ([a51f721](https://github.com/discordjs/discord.js/commit/a51f7215eca67a0f46fba8b2d706f7ec6f6dc228))
|
||||
|
||||
# [@discordjs/collection@0.7.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@0.6.0...@discordjs/collection@0.7.0) - (2022-06-04)
|
||||
|
||||
## Styling
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
<div align="center">
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
|
||||
<a href="https://www.npmjs.com/package/@discordjs/collection"><img src="https://img.shields.io/npm/v/@discordjs/collection.svg?maxAge=3600" alt="npm version" /></a>
|
||||
<a href="https://www.npmjs.com/package/@discordjs/collection"><img src="https://img.shields.io/npm/dt/@discordjs/collection.svg?maxAge=3600" alt="npm downloads" /></a>
|
||||
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/test.yml/badge.svg" alt="Build status" /></a>
|
||||
<a href="https://codecov.io/gh/discordjs/discord.js" ><img src="https://codecov.io/gh/discordjs/discord.js/branch/main/graph/badge.svg?precision=2&flag=collection" alt="Code coverage" /></a>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
|
||||
<a href="https://www.npmjs.com/package/@discordjs/collection"><img src="https://img.shields.io/npm/v/@discordjs/collection.svg?maxAge=3600" alt="npm version" /></a>
|
||||
<a href="https://www.npmjs.com/package/@discordjs/collection"><img src="https://img.shields.io/npm/dt/@discordjs/collection.svg?maxAge=3600" alt="npm downloads" /></a>
|
||||
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/test.yml/badge.svg" alt="Build status" /></a>
|
||||
<a href="https://codecov.io/gh/discordjs/discord.js" ><img src="https://codecov.io/gh/discordjs/discord.js/branch/main/graph/badge.svg?precision=2&flag=collection" alt="Code coverage" /></a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"><img src="https://raw.githubusercontent.com/discordjs/discord.js/main/.github/powered-by-vercel.svg" alt="Vercel" /></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
## About
|
||||
@@ -32,7 +35,7 @@ pnpm add @discordjs/collection
|
||||
- [Website](https://discord.js.org/) ([source](https://github.com/discordjs/discord.js/tree/main/packages/website))
|
||||
- [Documentation](https://discord.js.org/#/docs/collection)
|
||||
- [Guide](https://discordjs.guide/) ([source](https://github.com/discordjs/guide))
|
||||
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v13.html), including updated and removed items in the library.
|
||||
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v14.html), including updated and removed items in the library.
|
||||
- [discord.js Discord server](https://discord.gg/djs)
|
||||
- [Discord API Discord server](https://discord.gg/discord-api)
|
||||
- [GitHub](https://github.com/discordjs/discord.js/tree/main/packages/collection)
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
*
|
||||
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
|
||||
*/
|
||||
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts",
|
||||
"mainEntryPointFilePath": "<projectFolder>/docs/dist/index.d.ts",
|
||||
|
||||
/**
|
||||
* A list of NPM package names whose exports should be treated as part of this package.
|
||||
|
||||
3
packages/collection/build.config.ts
Normal file
3
packages/collection/build.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { createUnbuildConfig } from '../../build.config';
|
||||
|
||||
export default createUnbuildConfig();
|
||||
@@ -1,23 +1,24 @@
|
||||
{
|
||||
"name": "@discordjs/collection",
|
||||
"version": "0.8.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Utility data structure used in discord.js",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "tsup",
|
||||
"build": "unbuild",
|
||||
"lint": "prettier --check . && eslint src __tests__ --ext mjs,js,ts",
|
||||
"format": "prettier --write . && eslint src __tests__ --ext mjs,js,ts --fix",
|
||||
"docs": "docgen -i src/index.ts -c docs/index.json -o docs/docs.json --typescript && api-extractor run --local",
|
||||
"prepack": "yarn build && yarn lint",
|
||||
"fmt": "yarn format",
|
||||
"docs": "downlevel-dts . docs --to=3.7 && docgen -i src/index.ts -c docs/index.json -o docs/docs.json --typescript && api-extractor run --local",
|
||||
"prepack": "yarn lint && yarn test && yarn build",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/collection/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.js",
|
||||
"require": "./dist/index.cjs",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"directories": {
|
||||
@@ -50,16 +51,18 @@
|
||||
"homepage": "https://discord.js.org",
|
||||
"devDependencies": {
|
||||
"@discordjs/docgen": "workspace:^",
|
||||
"@discordjs/scripts": "workspace:^",
|
||||
"@favware/cliff-jumper": "^1.8.5",
|
||||
"@microsoft/api-extractor": "^7.28.4",
|
||||
"@microsoft/api-extractor": "^7.28.6",
|
||||
"@types/node": "^16.11.45",
|
||||
"c8": "^7.11.3",
|
||||
"c8": "^7.12.0",
|
||||
"downlevel-dts": "^0.10.0",
|
||||
"eslint": "^8.20.0",
|
||||
"prettier": "^2.7.1",
|
||||
"tsup": "^6.1.3",
|
||||
"rollup-plugin-typescript2": "0.32.1",
|
||||
"tsup": "^6.2.0",
|
||||
"typescript": "^4.7.4",
|
||||
"vitest": "^0.18.1"
|
||||
"unbuild": "^0.7.6",
|
||||
"vitest": "^0.19.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.9.0"
|
||||
|
||||
4
packages/discord.js/.lintstagedrc.json
Normal file
4
packages/discord.js/.lintstagedrc.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"*": "prettier --ignore-unknown --write",
|
||||
"{src/**,test/**,typings/**,scripts/**}.{mjs,js,ts}": "eslint --ext mjs,js,ts --fix"
|
||||
}
|
||||
@@ -2,6 +2,430 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
# [14.0.3](https://github.com/discordjs/discord.js/compare/14.0.2...14.0.3) - (2022-07-18)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **Components:** Support emoji id strings (#8310) ([660e212](https://github.com/discordjs/discord.js/commit/660e212e83df026c684ee2cda7fb4e98870f342e))
|
||||
|
||||
# [14.0.2](https://github.com/discordjs/discord.js/compare/14.0.1...14.0.2) - (2022-07-18)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **DataResolver#resolveImage:** Adjust to updated resolveFile (#8308) ([3a7e93d](https://github.com/discordjs/discord.js/commit/3a7e93df576172c797f1d8bd6483234bb6af2d00))
|
||||
|
||||
# [14.0.1](https://github.com/discordjs/discord.js/compare/14.0.0...14.0.1) - (2022-07-17)
|
||||
|
||||
## Info
|
||||
|
||||
- 14.0.1 release bump, no new features.
|
||||
|
||||
# [14.0.0](https://github.com/discordjs/discord.js/compare/13.9.0...14.0.0) - (2022-07-17)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **GuildMemberManager:** Allow setting own nickname (#8066) ([52a9e21](https://github.com/discordjs/discord.js/commit/52a9e213c2dc13ee52ee0234593fdce392f43890))
|
||||
- **PermissionOverwriteManager:** Mutates user (#8283) ([3bf30b1](https://github.com/discordjs/discord.js/commit/3bf30b1e6d2d6f583f7069a1e24e7842d59fab2f))
|
||||
- **GuildChannelManager:** Access `resolveId` correctly (#8296) ([3648f6d](https://github.com/discordjs/discord.js/commit/3648f6d567cd834c301de913ce19f786a265240d))
|
||||
- **GuildChannelManager:** Edit lockPermissions (#8269) ([7876548](https://github.com/discordjs/discord.js/commit/787654816d2b6a5168d199d32cdaeb4ef6d270b9))
|
||||
- **`SelectMenuBuilder`:** Properly accept `SelectMenuOptionBuilder`s (#8174) ([31d5930](https://github.com/discordjs/discord.js/commit/31d593046466438c55f5784b0f2098e233c5edc4))
|
||||
- Remove global flag on regular expressions (#8177) ([cdd9214](https://github.com/discordjs/discord.js/commit/cdd9214212892e30b3eaa161837c37516c5bcaa0))
|
||||
- **MessagePayload:** Guard against `repliedUser` property (#8211) ([fa010b5](https://github.com/discordjs/discord.js/commit/fa010b516254c4ab2762278817f31bf289f0ab6a))
|
||||
- **ApplicationCommandManager:** Explicitly allow passing builders to methods (#8209) ([50d55bd](https://github.com/discordjs/discord.js/commit/50d55bd6b819307c86701f4808c087f359c6ccff))
|
||||
- **GuildMemberRemove:** Remove member's presence (#8181) ([11b1739](https://github.com/discordjs/discord.js/commit/11b173931968c548f8504649ae7090865892e62d))
|
||||
- Edit() data can be partial and `defaultMemberPermissions` can be `null` (#8163) ([0ffbef5](https://github.com/discordjs/discord.js/commit/0ffbef506a97a0bf22cb134fc007c2aec29cbffc))
|
||||
- **WebSocketShard:** Keep an error handler on connections (#8150) ([c34c02a](https://github.com/discordjs/discord.js/commit/c34c02ab8d119bf16d8d14d125a9b650b4bb18f4))
|
||||
- **DJSError:** Error code validation (#8149) ([31f6582](https://github.com/discordjs/discord.js/commit/31f658247fe0e1047897edab629643d140e77e07))
|
||||
- **vcs:** Nsfw property (#8132) ([2eeaad6](https://github.com/discordjs/discord.js/commit/2eeaad6f27fdf8868364fa95ed20755ee09bda87))
|
||||
- **WebSocketManager:** Correct error name (#8138) ([db2b033](https://github.com/discordjs/discord.js/commit/db2b0333d912fe83381db2ffe16829d7d03d6c2e))
|
||||
- **WebSocketShard:** Disconnected casing (#8117) ([23e183a](https://github.com/discordjs/discord.js/commit/23e183a9ac7aaa3bca2bc4eb8634d1738ec34a26))
|
||||
- **webhooks:** Revert webhook caching (and returning Message) (#8038) ([d54bf5d](https://github.com/discordjs/discord.js/commit/d54bf5d286f4057db130901591b192fd4d1668c1))
|
||||
- **ApplicationCommand:** Remove `autocomplete` check at the top level and correctly check for `dmPermission` (#8100) ([0a44b05](https://github.com/discordjs/discord.js/commit/0a44b05db83948857afbe18471e7a867da47177a))
|
||||
- **ApplicationCommand:** Fix default member permissions assignment (#8067) ([96053ba](https://github.com/discordjs/discord.js/commit/96053babe1bd65ebe1fc6a261f5eb052906afdb9))
|
||||
- **scripts:** Read directory and rerun (#8065) ([f527dea](https://github.com/discordjs/discord.js/commit/f527dea36ead194aaae1bf5da1e953df59d692fd))
|
||||
- Select menu options to accept both rest and array (#8032) ([fbe67e1](https://github.com/discordjs/discord.js/commit/fbe67e102502b4b49690cbf8ff891ead2232ecf3))
|
||||
- **CommandInteractionOptionResolver:** Handle autocompletion interactions (#8058) ([d8077c6](https://github.com/discordjs/discord.js/commit/d8077c6839dc8ceb57d3c3a86bf9746be2a91ada))
|
||||
- **scripts:** Add quotes around blob arguments (#8054) ([598f61b](https://github.com/discordjs/discord.js/commit/598f61b992fab1b3fdcab8ff960366f7af0b37ea))
|
||||
- **Message:** Force fetching (#8047) ([f2b267c](https://github.com/discordjs/discord.js/commit/f2b267c079dd8aa7277910471f3db2f88af6efb2))
|
||||
- **Attachment:** Do not destructure `data` (#8041) ([1afae90](https://github.com/discordjs/discord.js/commit/1afae909d72e648cf48d63d7de2708737a78c126))
|
||||
- **DirectoryChannel:** Type `name` and handle `url` (#8023) ([86d8fbc](https://github.com/discordjs/discord.js/commit/86d8fbc023e3925e8f86799d6ebf2d423f7bf2ec))
|
||||
- Readd `isThread` type guard (#8019) ([f8ed71b](https://github.com/discordjs/discord.js/commit/f8ed71bfca6e47e3d44ad063e23804354bd23604))
|
||||
- Add static method `from` in builders (#7990) ([ad36c0b](https://github.com/discordjs/discord.js/commit/ad36c0be7744ea4214ccf345fe80a5a1a9e89101))
|
||||
- Typings (#7965) ([7a1095b](https://github.com/discordjs/discord.js/commit/7a1095b66be3c5d81185e026281e2908c10c1695))
|
||||
- **GuildAuditLogs:** Cache guild scheduled events (#7951) ([2f03f9a](https://github.com/discordjs/discord.js/commit/2f03f9ad3f63abee5b5c46d02f1afa8885e8977c))
|
||||
- Make sure action row builders create djs builders (#7945) ([adf461b](https://github.com/discordjs/discord.js/commit/adf461baf49be754c7a10c61faf1ef3df333413a))
|
||||
- **TextBasedChannel#bulkDelete:** Return deleted message (#7943) ([191510b](https://github.com/discordjs/discord.js/commit/191510b7f87903e4bd93b891649cb290fd50c47e))
|
||||
- Remove trailing invites on channel deletion (#7932) ([5e9b757](https://github.com/discordjs/discord.js/commit/5e9b757a3733e6526770eb60a15072612294eb21))
|
||||
- **DataResolver:** Fix check for readable streams (#7928) ([28172ca](https://github.com/discordjs/discord.js/commit/28172ca7b57357436d3252ec01ec17dad865d87f))
|
||||
- **AuditLog:** Default changes to empty array (#7880) ([19eaed6](https://github.com/discordjs/discord.js/commit/19eaed63905367ef4604366b8839023384524d1f))
|
||||
- **Util:** Flatten ignoring certain fields (#7773) ([df64d3e](https://github.com/discordjs/discord.js/commit/df64d3ea382c07e66bc7cc8877ee430206c31d63))
|
||||
- Possibly missing (#7829) ([6239d83](https://github.com/discordjs/discord.js/commit/6239d83c4d5f0a396678410d7fef35e39ed29009))
|
||||
- `endReason` not being properly set in base Collector (#7833) ([0c18dab](https://github.com/discordjs/discord.js/commit/0c18dab1280205b8855d17d075b7421860d59c14))
|
||||
- **SelectMenuBuilder:** Options array (#7826) ([3617093](https://github.com/discordjs/discord.js/commit/361709332bdc871822c2b9919f14fd090d68666a))
|
||||
- **Activity:** Platform type (#7805) ([4ac91c6](https://github.com/discordjs/discord.js/commit/4ac91c61d08111ae4d49d1e64caf94e6e49832c8))
|
||||
- **ApplicationCommand:** Equal nameLocalizations and descriptionLocalizations (#7802) ([4972bd8](https://github.com/discordjs/discord.js/commit/4972bd87c17cbc6a94c9608ba2ab39c475f9921f))
|
||||
- **InteractionResponses:** Use optional chaining on nullable property (#7812) ([c5fb548](https://github.com/discordjs/discord.js/commit/c5fb54852906898ffb19282dd60168dfc6fb2eba))
|
||||
- **MessageManager:** Allow caching option of an unspecified limit (#7763) ([1b2d8de](https://github.com/discordjs/discord.js/commit/1b2d8decb638faeae8184119c5cedfcdaf9485e3))
|
||||
- **builders:** Add constructor default param (#7788) ([c286650](https://github.com/discordjs/discord.js/commit/c2866504a3824005fe756556fec4b349898b7d22))
|
||||
- **MessagePayload:** ResolveBody check body instead of data (#7738) ([3db20ab](https://github.com/discordjs/discord.js/commit/3db20abdd2d502a1ed457842181b164dc6390ba1))
|
||||
- **ActionRow:** ToJSON should include components (#7739) ([ebb4dfa](https://github.com/discordjs/discord.js/commit/ebb4dfa262adb2086c83db487002bb2e1ed5ab88))
|
||||
- Prevent `NaN` for nullable timestamps (#7750) ([8625d81](https://github.com/discordjs/discord.js/commit/8625d817145eb642aeb0da05184352f438586986))
|
||||
- **InteractionCreateAction:** Ensure text-based channel for caching messages (#7755) ([25fdb38](https://github.com/discordjs/discord.js/commit/25fdb3894d33dc395a376a3d962a063eb5735253))
|
||||
- Pass `force` correctly (#7721) ([402514f](https://github.com/discordjs/discord.js/commit/402514ff323ccf1f8c95d295f044cf0bb5547c2e))
|
||||
- Support reason in setRTCRegion helpers (#7723) ([905a6a1](https://github.com/discordjs/discord.js/commit/905a6a11663f9469ada67f8310a969453ffc5b2a))
|
||||
- **GuildMemberManager:** Return type can be null (#7680) ([74bf7d5](https://github.com/discordjs/discord.js/commit/74bf7d57ab959eb820ab1c213ac86ab1ea660398))
|
||||
- **gateway:** Use version 10 (#7689) ([8880de0](https://github.com/discordjs/discord.js/commit/8880de0cecdf273fd6df23988e4cb77774a75390))
|
||||
- Audit log static reference (#7703) ([85e531f](https://github.com/discordjs/discord.js/commit/85e531f22d7a8f8ad043647ce445726ae0df26c0))
|
||||
- Handle possibly missing property (#7641) ([0c32332](https://github.com/discordjs/discord.js/commit/0c32332a5aacbbb6c415da75c166d09cfdb34bbd))
|
||||
- **util:** Allow `escapeInlineCode` to escape double backtics (#7638) ([d5369a5](https://github.com/discordjs/discord.js/commit/d5369a56e3fcf50513f3bc582552c2838b04d199))
|
||||
- **GuildEditData:** Some fields can be null (#7632) ([4d2b559](https://github.com/discordjs/discord.js/commit/4d2b55955d1a3ff05c3047599232becdc3f2c445))
|
||||
- TOKEN_INVALID error not thrown at login with invalid token (#7630) ([cd79bef](https://github.com/discordjs/discord.js/commit/cd79bef2547594f4d0c744faa8fa67fb9fd61526))
|
||||
- **GuildScheduledEvent:** Handle missing `image` (#7625) ([c684ac5](https://github.com/discordjs/discord.js/commit/c684ac55e1d225740e67ab7bd5643de1b35f4594))
|
||||
- **guild:** Throw if ownerId falsey (#7575) ([98177aa](https://github.com/discordjs/discord.js/commit/98177aa38d3d6516d4c5354d6c7edea925dc881d))
|
||||
- Remove Modal export (#7654) ([87a6b84](https://github.com/discordjs/discord.js/commit/87a6b8445bfbf3981cd39813fe961dfa1c7f2bce))
|
||||
- **Embed:** Fix incorrect destructuring import (#7615) ([cbdb408](https://github.com/discordjs/discord.js/commit/cbdb408dffd1c7f2193c15989528a3de5fd9f13a))
|
||||
- **ThreadMembersUpdate:** Only emit added & removed thread members (#7539) ([c12d61a](https://github.com/discordjs/discord.js/commit/c12d61a3421afcdc41f77c0fddde4efbb257fa69))
|
||||
- **Util:** EscapeInlineCode properly (#7587) ([851f380](https://github.com/discordjs/discord.js/commit/851f380eb10d23ffd08e8b845aed4039abbcd03b))
|
||||
- **GuildStickerManager:** Correctly access guild ID (#7605) ([4b08d9b](https://github.com/discordjs/discord.js/commit/4b08d9b376bda7a7f4bb3fb8c555d25cca648de4))
|
||||
- **MessageManager:** Pin route (#7610) ([cb566c8](https://github.com/discordjs/discord.js/commit/cb566c8b6abff489a944db7952e5c5a48e0c98b0))
|
||||
- Handle partial data for `Typing#user` (#7542) ([c6cb5e9](https://github.com/discordjs/discord.js/commit/c6cb5e9ebbf46d81404119a6aa11bb8ebb17d5a4))
|
||||
- **guild:** Fix typo accessing user instead of users (#7537) ([8203c5d](https://github.com/discordjs/discord.js/commit/8203c5d843f2431c0f49023282f1bf73d85881d1))
|
||||
- **test:** `MessageActionRow` to `ActionRow` (#7523) ([d1d1b07](https://github.com/discordjs/discord.js/commit/d1d1b076bebf7cb706b2436a40d87c6efaed1e1d))
|
||||
- **MessagePayload:** Don't set reply flags to target flags (#7514) ([4f30652](https://github.com/discordjs/discord.js/commit/4f306521d829fef21ebd70557b37f8199b82572b))
|
||||
- **invite:** Add back channelId property (#7501) ([78aa36f](https://github.com/discordjs/discord.js/commit/78aa36f9f5913b86c82376ecdf20653b15340bbe))
|
||||
- Properly serialize `undefined` values (#7497) ([8dbd345](https://github.com/discordjs/discord.js/commit/8dbd34544cbeb499282f01dda9d35ed9bca93591))
|
||||
- Allow unsafe embeds to be serialized (#7494) ([942ea1a](https://github.com/discordjs/discord.js/commit/942ea1acbfb49289ccb3a1882b5a2da0a7d0bccf))
|
||||
- Attachment types (#7478) ([395a68f](https://github.com/discordjs/discord.js/commit/395a68ff49c622d5136d6b775beaf8e88a2d8610))
|
||||
- Use case converter for json component serialization (#7464) ([2d45544](https://github.com/discordjs/discord.js/commit/2d4554440ed9329a5876a9c674c3eb2de0f2f917))
|
||||
- **GuildAuditLogs:** Typings and consistency (#7445) ([c1b27f8](https://github.com/discordjs/discord.js/commit/c1b27f8eed8ea04a48bc106453892bddcdc6b73e))
|
||||
- **dataresolver:** Ensure fetched file is convert to a buffer (#7457) ([9311fa7](https://github.com/discordjs/discord.js/commit/9311fa7b42b2b5a74e411aa263daa4fbfc270645))
|
||||
- **messagepayload:** ResolveFile property names (#7458) ([a8106f7](https://github.com/discordjs/discord.js/commit/a8106f7c586f0ecac76e7f72c53b0da215a6fbf1))
|
||||
- **ci:** Ci error (#7454) ([0af9bc8](https://github.com/discordjs/discord.js/commit/0af9bc841ffe1a297d308500d696bad4b85abda9))
|
||||
- **threads:** Require being sendable to be unarchivable (#7406) ([861f0e2](https://github.com/discordjs/discord.js/commit/861f0e2134662ab64a11d313130aff58b413d495))
|
||||
- **guildmember:** Check if member has administrator permission (#7384) ([81d8b54](https://github.com/discordjs/discord.js/commit/81d8b54ff6b98b0e7ee2c57eaee6bc0b707e135a))
|
||||
- **guild:** Remove `maximumPresences` default value (#7440) ([55b388a](https://github.com/discordjs/discord.js/commit/55b388a763dc7223e88b62ae928fe85fe8b8fe58))
|
||||
- **guildchannelmanager:** Edit always sets parent to null (#7446) ([b97aedd](https://github.com/discordjs/discord.js/commit/b97aedd8e15f9358960cb59403f3a8ea24b87141))
|
||||
- **guildmember:** Make `pending` nullable (#7401) ([fe11ff5](https://github.com/discordjs/discord.js/commit/fe11ff5f6e85571a981e90eba5b9f3bda7a2cd04))
|
||||
- **clientpresence:** Fix used opcodes (#7415) ([a921ec7](https://github.com/discordjs/discord.js/commit/a921ec7dc525c58d40b4678e66270f9238abed31))
|
||||
- Correctly export UnsafeSelectMenuComponent from builders (#7421) ([aadfbda](https://github.com/discordjs/discord.js/commit/aadfbda586d57a7b775ad26c201f0dc34618180b))
|
||||
- MessageReaction.me being false when it shouldn't (#7378) ([04502ce](https://github.com/discordjs/discord.js/commit/04502ce702da53c4b00bf391d0fd936746851381))
|
||||
- Fix some typos (#7393) ([92a04f4](https://github.com/discordjs/discord.js/commit/92a04f4d98f6c6760214034cc8f5a1eaa78893c7))
|
||||
- **messagementions:** Fix `has` method (#7292) ([3a5ab2c](https://github.com/discordjs/discord.js/commit/3a5ab2c4e54de4e67ab6e323d7eac86482da7382))
|
||||
- **guildmembermanager:** Use rest in edit (#7356) ([00ce1c5](https://github.com/discordjs/discord.js/commit/00ce1c56ac224691a8691a3525cb14ae002319c6))
|
||||
- **typings:** Mark `RESTOptions` as Partial in `ClientOptions` (#7349) ([e1ecc1a](https://github.com/discordjs/discord.js/commit/e1ecc1a80a9358cdbafbe8542c40b9de8cad467e))
|
||||
- **Webhook:** Use correct method name (#7348) ([11e5e5a](https://github.com/discordjs/discord.js/commit/11e5e5ac5b70138f56332eb3e61a42443670b0de))
|
||||
- **thread:** Don't assign directly to getters (#7346) ([2db0cdd](https://github.com/discordjs/discord.js/commit/2db0cdd357c3a02decb4fd4168db87888efba283))
|
||||
- Missed enums and typings from #7290 (#7331) ([47633f0](https://github.com/discordjs/discord.js/commit/47633f0fd2435d6d8c694d8d37b26039a7b3797a))
|
||||
- **guildchannelmanager:** Remove reverse enum lookup (#7304) ([857bba4](https://github.com/discordjs/discord.js/commit/857bba448029f3f070c67fb40b59a3a2a2e5c6f4))
|
||||
- Import `clear{Timeout,Interval}` from `node:timers` (#7269) ([8ddd44e](https://github.com/discordjs/discord.js/commit/8ddd44ed85b32c86243efe0ec35b283eaaa8212c))
|
||||
- **ApplicationCommand:** Use new ApplicationCommandOptionType enums (#7257) ([06f5210](https://github.com/discordjs/discord.js/commit/06f5210f58bbba6102173033a9f1e6fb004fdf5d))
|
||||
- Use enums from discord-api-types (#7258) ([f284a46](https://github.com/discordjs/discord.js/commit/f284a4641fd68de9190bda97ec1eab0981149630))
|
||||
- **exports:** Export ApplicationCommandType properly (#7256) ([f753882](https://github.com/discordjs/discord.js/commit/f75388259262bf6b4a64375b97800bd72378f3bc))
|
||||
- **Shard:** EventEmitter listener warning (#7240) ([ff3a8b8](https://github.com/discordjs/discord.js/commit/ff3a8b83234d3826fc49c5a8c3cb52ef9f281ffd))
|
||||
- **timestamps:** Account for timestamps of 0 when creating Dates (#7226) ([a8509c9](https://github.com/discordjs/discord.js/commit/a8509c91ca0147393b407221405b6b917677961a))
|
||||
- **MessageEmbed:** CreatedAt field can be zero (#7218) ([37cad54](https://github.com/discordjs/discord.js/commit/37cad54dbdade39607397b8ad697eca94f1b7197))
|
||||
- **BaseClient:** Do not append default options if provided is not an object (#6453) ([b92a7d7](https://github.com/discordjs/discord.js/commit/b92a7d72332c35b607db54aa6aca24b8e10e00ad))
|
||||
- Snowflakeutil import (#7219) ([962f4bf](https://github.com/discordjs/discord.js/commit/962f4bf88211dbfb5ad0295a9467dede1e2688ee))
|
||||
- **Role:** Remove unused process (#7215) ([63034b4](https://github.com/discordjs/discord.js/commit/63034b44c9849087e391684d9b6c0c6ae9a21113))
|
||||
- **WebhookClient:** Updated webhook url regex (#6804) ([1c615d1](https://github.com/discordjs/discord.js/commit/1c615d1bb2606d5f19e55076d4ecab95c619518e))
|
||||
- **Sweepers:** Add sweepStickers function (#7213) ([95f8375](https://github.com/discordjs/discord.js/commit/95f8375d425f58f501f32ead03f7927e6596f8e6))
|
||||
- **InteractionCreate:** Use ChatInputCommandInteraction instead (#7210) ([49dada3](https://github.com/discordjs/discord.js/commit/49dada35f92470d3e4426362510847b93dd42d1a))
|
||||
- **Structues:** Rename old module's name (#7207) ([fbef454](https://github.com/discordjs/discord.js/commit/fbef45489457a2198357dc4dd303740d79036784))
|
||||
- **WebSocket:** Remove application command handler (#7202) ([033151c](https://github.com/discordjs/discord.js/commit/033151cf92fe43536b8a4c0f4d7d9ed75a2095c5))
|
||||
- **User:** `bannerURL()` should not throw when not present (#6789) ([3872acf](https://github.com/discordjs/discord.js/commit/3872acfeb8390f6f7202d69cf1f7f8616a7b0b34))
|
||||
- **VoiceState:** Ensure `suppress` & `streaming` have proper fallback values (#6377) ([a0d5f13](https://github.com/discordjs/discord.js/commit/a0d5f13dd9b27c44f5183a2a9af4c4fdecb312c0))
|
||||
- **sweepers:** Provide default for object param (#7182) ([ae2f013](https://github.com/discordjs/discord.js/commit/ae2f013653c8a9f9ffb12ae8fcdb1bb604b39236))
|
||||
|
||||
## Deprecation
|
||||
|
||||
- **Caching:** Clean up deprecated cache sweeping (#7118) ([12ffa06](https://github.com/discordjs/discord.js/commit/12ffa069aa8b247e945fef16a543f41c2c391bf1))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Align webhook method return types with implementation (#8253) ([5aeed99](https://github.com/discordjs/discord.js/commit/5aeed9935058241648507d7f651679226a89dbb3))
|
||||
- Remove `@private` constructor documentation (#8255) ([452dec5](https://github.com/discordjs/discord.js/commit/452dec57ca422f5e7424a0f0e78c3e152717f413))
|
||||
- **ApplicationCommand:** Add `min_length` and `max_length` to ApplicationCommandOptionData (#8239) ([43f62bb](https://github.com/discordjs/discord.js/commit/43f62bb6678ec332795c8cfbe0c01854b95aa61e))
|
||||
- **MessageInteraction#commandName:** Updated description (#8212) ([ab238a9](https://github.com/discordjs/discord.js/commit/ab238a9046e0201dbd4755fa41fa69c44b186912))
|
||||
- Add missing `@extends` (#8205) ([e0c8282](https://github.com/discordjs/discord.js/commit/e0c82824905dcebf62c2d1afcc5e5590a5594838))
|
||||
- **Constants:** Fix SweeperKeys type (#8157) ([af04992](https://github.com/discordjs/discord.js/commit/af04992ed3c2617fda686c2bc7338dcada283dc6))
|
||||
- **Channels:** Internally document channel creation (#8154) ([5e5853a](https://github.com/discordjs/discord.js/commit/5e5853a4e885c47e3dde519761dd59a5ec0e06fc))
|
||||
- Update threads to use `ThreadAutoArchiveDuration` (#8153) ([ee36d60](https://github.com/discordjs/discord.js/commit/ee36d60dc6714c83569a20716fa8ca8e1bd7de4f))
|
||||
- **APITypes:** Remove duplicate type definition (#8144) ([a061233](https://github.com/discordjs/discord.js/commit/a0612335101c7ce2a07d95da4b79f0d4a2b1a6a0))
|
||||
- Document missing type definitions (#8130) ([203bc4a](https://github.com/discordjs/discord.js/commit/203bc4a2cf0c2d90a003093318aa0741605610f5))
|
||||
- **InteractionResponse:** Fix return (#8141) ([f1ac17c](https://github.com/discordjs/discord.js/commit/f1ac17c961cf95d99e205133605d10d8be5bd737))
|
||||
- **PermissionsBitField:** Fix `@name` of bitfield (#8115) ([3a77ce0](https://github.com/discordjs/discord.js/commit/3a77ce0b18c60a0b21ba088590ff89f2ace94087))
|
||||
- `TextBasedChannel` -> `TextBasedChannels` typos (#8110) ([db663a5](https://github.com/discordjs/discord.js/commit/db663a55c2ed2faf61e217009158da50dfcf274f))
|
||||
- Remove `number`s from enums (#8098) ([0a138da](https://github.com/discordjs/discord.js/commit/0a138dab95a86512f08ac3be356f77f38f2ea880))
|
||||
- **GuildAuditLogs:** Fix and reimplement type definitions (#8108) ([4155136](https://github.com/discordjs/discord.js/commit/415513696c7b7e139d1b958e480bf0c7e4d14111))
|
||||
- **WebSocketOptions:** Add `version` to docs and typings (#8050) ([386c41f](https://github.com/discordjs/discord.js/commit/386c41f24fb3c9d06967d9c1881a57645c3a71f2))
|
||||
- **BaseGuildTextChannel:** Update `setType()`'s parameter type (#8088) ([9c0f190](https://github.com/discordjs/discord.js/commit/9c0f190de1f743d9bd597ffd656503c672db71c1))
|
||||
- Update outdated examples (#8081) ([51eadf3](https://github.com/discordjs/discord.js/commit/51eadf37371a6138847efdb4b5b81ee132001cf0))
|
||||
- **ThreadMemberManager:** Require `member` in `FetchThreadMemberOptions` (#8079) ([552ec72](https://github.com/discordjs/discord.js/commit/552ec72542ec3b2b3ebf35c9fd84ab502dd746cf))
|
||||
- **AutocompleteInteraction:** Change useless log in responds example (#8077) ([ac7bf69](https://github.com/discordjs/discord.js/commit/ac7bf692bfce8204e278205dde811515a51f154b))
|
||||
- Description and missing `@typedef` fixes (#8087) ([a2eebf6](https://github.com/discordjs/discord.js/commit/a2eebf6c66f3e4c96ece9d2ae2a1133c84257f42))
|
||||
- Ignore docs of unexported functions (#8051) ([94bdcac](https://github.com/discordjs/discord.js/commit/94bdcaca62414a77d4ee0b8b79752a2be937320b))
|
||||
- **ClientOptions:** Fix closeTimeout default (#8049) ([b2eea1c](https://github.com/discordjs/discord.js/commit/b2eea1c900ba73d4b98b72f5c196f51e27d3ab8f))
|
||||
- **DirectoryChannel:** Extend `Channel` (#8022) ([f3f34f0](https://github.com/discordjs/discord.js/commit/f3f34f07b3b396015b130b8e9d938a3eec688fc3))
|
||||
- **Attachment:** Remove constructor doc (#8009) ([0a7953e](https://github.com/discordjs/discord.js/commit/0a7953e46310c77483d277539b47f1a7ab051fd9))
|
||||
- **VoiceChannel:** Annotate that it is implementing TextBasedChannel (#8007) ([5987dbe](https://github.com/discordjs/discord.js/commit/5987dbe5cff6991ae6905b0387411fa042d3e9b7))
|
||||
- Add missing discord-api-types external types (#8001) ([546d486](https://github.com/discordjs/discord.js/commit/546d48655f36ed9a6c6c5ce3c2eabcca1a86a945))
|
||||
- **InteractionResponses:** Replace outdated Embed example for reply (#7875) ([d308c66](https://github.com/discordjs/discord.js/commit/d308c66eeca6bdc3471637ae3aaaaa0a2f5c9989))
|
||||
- Require parameter (#7838) ([f4ccc67](https://github.com/discordjs/discord.js/commit/f4ccc6772c15e32489ca22fb2c3e803b85d4dbf9))
|
||||
- **ApplicationCommand:** Fix and improve localization docs (#7804) ([61a44c5](https://github.com/discordjs/discord.js/commit/61a44c509c40abaf7ffb95b10942889cbbf155ac))
|
||||
- **ApplicationCommand:** Fix ApplicationCommandOptionChoice (#7794) ([f1d0084](https://github.com/discordjs/discord.js/commit/f1d0084da26b0111ca029c789ad9e8e6c2882b4d))
|
||||
- Add back static properties and methods (#7706) ([520f471](https://github.com/discordjs/discord.js/commit/520f471ac56cbc01402b79197333a8a34c4ac5c9))
|
||||
- **InteractionCollector:** Document channel option type (#7551) ([e787cd5](https://github.com/discordjs/discord.js/commit/e787cd5fa5d013319347392ee4f799a677f6f512))
|
||||
- Correctly type getters (#7500) ([ffecf08](https://github.com/discordjs/discord.js/commit/ffecf084956f954cf10e1b844e00326e443a86f2))
|
||||
- ApplicationCommandData typedef (#7389) ([d32db88](https://github.com/discordjs/discord.js/commit/d32db8833e1058fb36f2e83af79d5353a9f2f693))
|
||||
- **channel:** Fix `isDMBased` docs (#7411) ([f2a7a9f](https://github.com/discordjs/discord.js/commit/f2a7a9f1b30af272a6a8d81825d09f84e749cc24))
|
||||
- **messageattachment:** Fix `contentType` docs (#7413) ([2800e07](https://github.com/discordjs/discord.js/commit/2800e07e5974e07b9f8ce043722b9b99a5bcc80d))
|
||||
- Add supported option types for autocomplete (#7368) ([8bb3751](https://github.com/discordjs/discord.js/commit/8bb37513400d646d784d59875d6b6a6ec10160cd))
|
||||
- Add external builder docs links (#7390) ([0b866c9](https://github.com/discordjs/discord.js/commit/0b866c9fb284971113e288e52327d4506db28011))
|
||||
- Add EnumResolvers (#7353) ([72767a1](https://github.com/discordjs/discord.js/commit/72767a1059526bdf617e80d5a9e5da1fbd2936d3))
|
||||
- **locales:** Update Discord API docs link (#7266) ([b640272](https://github.com/discordjs/discord.js/commit/b6402723c31bed3c49f8b8cde873b65b9f373fd7))
|
||||
- **StageInstance:** Deprecate discoverableDisabled (#7179) ([bd33ebb](https://github.com/discordjs/discord.js/commit/bd33ebb507eab36bc2219103dbd1e0217b9f38c0))
|
||||
- **shardingmanager:** Fix type of `execArgv` option (#7284) ([e65da44](https://github.com/discordjs/discord.js/commit/e65da44d9c564d1ffcb0f4df2bcdaf0ce0636f35))
|
||||
- **interaction:** Add locale list link (#7261) ([37ec0bd](https://github.com/discordjs/discord.js/commit/37ec0bda6df75fb1dc69b7a1eafbb8ea19e68457))
|
||||
- Fix a typo and use milliseconds instead of ms (#7251) ([0dd56af](https://github.com/discordjs/discord.js/commit/0dd56afe1cdf16f1e7d9afe1f8c29c31d1833a25))
|
||||
- Fix command interaction docs (#7212) ([137ea24](https://github.com/discordjs/discord.js/commit/137ea249df3aa6b8375ecb42aa456a6fdb811f19))
|
||||
- **TextBasedChannel:** Fixed syntax error in examples (#7163) ([b454740](https://github.com/discordjs/discord.js/commit/b454740ae87b6c3c13536181965519c7277e5840))
|
||||
- **TextBasedChannel:** Fix #createMessageComponentCollector description (#7168) ([d4e6e03](https://github.com/discordjs/discord.js/commit/d4e6e0370857dff00185d59faf8aaac12b343a7a))
|
||||
- Fixes the examples for kick and ban (#7170) ([db669b8](https://github.com/discordjs/discord.js/commit/db669b897132ec458d50ca6c1e3afa761e98ffc3))
|
||||
- **RoleManager:** Fix incorrect example (#7174) ([f79ea67](https://github.com/discordjs/discord.js/commit/f79ea67d3a9ba134a9acef0a443bd089c4e173a6))
|
||||
|
||||
## Features
|
||||
|
||||
- **builder:** Add max min length in string option (#8214) ([96c8d21](https://github.com/discordjs/discord.js/commit/96c8d21f95eb366c46ae23505ba9054f44821b25))
|
||||
- **applicationCommand:** Add max min length in string option (#8215) ([94ee60d](https://github.com/discordjs/discord.js/commit/94ee60d3d438f6657bdef51471528769af09624c))
|
||||
- Add website documentation early mvp (#8183) ([d95197c](https://github.com/discordjs/discord.js/commit/d95197cc78593df4d0a8d1cc492b0e41b4ab58b8))
|
||||
- **BaseInteraction:** Add support for `app_permissions` (#8194) ([002d6a5](https://github.com/discordjs/discord.js/commit/002d6a5aede3d1c0e08bd58eeef38a3b9202f525))
|
||||
- **util:** ParseWebhookURL (#8166) ([c4653f9](https://github.com/discordjs/discord.js/commit/c4653f97b1529eb0b99fccdba67c37eb4f467ff9))
|
||||
- **AutocompleteInteraction:** Add `commandGuildId` (#8086) ([10a6c42](https://github.com/discordjs/discord.js/commit/10a6c4287dd45a30290814e50fa29a086f85da02))
|
||||
- **guild:** Add support for setting MFA level (#8024) ([c5176be](https://github.com/discordjs/discord.js/commit/c5176be14b697ff506eb973c4119644eab544304))
|
||||
- **vcs:** Add missing property and methods (#8002) ([0415300](https://github.com/discordjs/discord.js/commit/0415300243877ddbcb501c0a26b1ff65618a1da7))
|
||||
- **docgen:** Update typedoc ([b3346f4](https://github.com/discordjs/discord.js/commit/b3346f4b9b3d4f96443506643d4631dc1c6d7b21))
|
||||
- Website (#8043) ([127931d](https://github.com/discordjs/discord.js/commit/127931d1df7a2a5c27923c2f2151dbf3824e50cc))
|
||||
- Docgen package (#8029) ([8b979c0](https://github.com/discordjs/discord.js/commit/8b979c0245c42fd824d8e98745ee869f5360fc86))
|
||||
- Backport handle zombie connection (#7626) ([e1176fa](https://github.com/discordjs/discord.js/commit/e1176faa27898d4f127c293c099201cb294e10ee))
|
||||
- **CommandInteraction:** Add 'commandGuildId' (#8018) ([aa59a40](https://github.com/discordjs/discord.js/commit/aa59a409b36c7ef7018d1785d2dba4da17b57864))
|
||||
- Allow builders to accept rest params and arrays (#7874) ([ad75be9](https://github.com/discordjs/discord.js/commit/ad75be9a9cf90c8624495df99b75177e6c24022f))
|
||||
- **MessageReaction:** Add react method (#7810) ([a328778](https://github.com/discordjs/discord.js/commit/a3287782b57c28b94c390c24e7d5f2d8c303301f))
|
||||
- **Collector:** Add `ignore` event (#7644) ([5244fe3](https://github.com/discordjs/discord.js/commit/5244fe3c1cd400985b00e95d8e5ec73823cf4f25))
|
||||
- **GuildMemberManager:** Add `GuildMemberManager#fetchMe()` (#7526) ([349766d](https://github.com/discordjs/discord.js/commit/349766dd6925e2d5e5597cc78c73e46f17c56eab))
|
||||
- **guildChannelManager:** Add `videoQualityMode` option for `create()` (#7980) ([cdd2ba0](https://github.com/discordjs/discord.js/commit/cdd2ba036ab1559783eb067786c52aff61807557))
|
||||
- **EnumResolvers:** Remove Enumresolvers (#7876) ([76694c1](https://github.com/discordjs/discord.js/commit/76694c1497de1b083a792fd1fda20f0eace50c48))
|
||||
- Move `me` to `GuildMemberManager` manager (#7669) ([aed687b](https://github.com/discordjs/discord.js/commit/aed687b09f87862eb2f33fb9f95b2cbd0b770585))
|
||||
- **rest:** Use undici (#7747) ([d1ec8c3](https://github.com/discordjs/discord.js/commit/d1ec8c37ffb7fe3b63eaa8c382f22ca1fb348c9b))
|
||||
- **VoiceChannel:** Add support for text in voice (#6921) ([4ba0f56](https://github.com/discordjs/discord.js/commit/4ba0f56b6af64bac30eea807fb3e9f3c41c3c83c))
|
||||
- **SelectMenu:** Allow emojis in options and option constructors (#7797) ([f22245e](https://github.com/discordjs/discord.js/commit/f22245e9d072ac4ef63b0ae0d84d5ba94608ce22))
|
||||
- Allow `createMessageComponentCollector` without using `fetchReply` (#7623) ([a58556a](https://github.com/discordjs/discord.js/commit/a58556adc02b2b9239c8f277a4387c743c9d6f04))
|
||||
- Add guild directory support (#6788) ([b01f414](https://github.com/discordjs/discord.js/commit/b01f4147d4f3bca021bc269c9f06463f06e3db53))
|
||||
- **GuildBanManager:** Support pagination results (#7734) ([fc2a8bb](https://github.com/discordjs/discord.js/commit/fc2a8bb6750919ecd6ee7c872df05f4b677ff5d3))
|
||||
- **CommandInteraction:** Add support for localized slash commands (#7684) ([01a423d](https://github.com/discordjs/discord.js/commit/01a423d110cfcddb3d794fcc32579a1547dd472d))
|
||||
- Allow emoji strings to be passed through constructors (#7718) ([0faac04](https://github.com/discordjs/discord.js/commit/0faac04b69f1dda3dc860cd584af100e36a40917))
|
||||
- **StageInstanceManager:** Add `sendStartNotification` option to create (#7730) ([29f8807](https://github.com/discordjs/discord.js/commit/29f88079559cc02ccfef7a7c16458d481e573fb5))
|
||||
- Add `makeURLSearchParams` utility function (#7744) ([8eaec11](https://github.com/discordjs/discord.js/commit/8eaec114a98026024c21545988860c123948c55d))
|
||||
- **modal:** Add `awaitModalSubmit` (#7751) ([3037fca](https://github.com/discordjs/discord.js/commit/3037fca196a0f9238d53bb51394daf737bbf3742))
|
||||
- **Actions:** Add parent structure to events parameters (#7577) ([3f3e432](https://github.com/discordjs/discord.js/commit/3f3e4327c86da86734c19a96e97115bd505b4532))
|
||||
- Export `UnsafeModalBuilder` and `UnsafeTextInputBuilder` (#7628) ([6fec252](https://github.com/discordjs/discord.js/commit/6fec25239dfed46a30826d38dc97f3680f24ec65))
|
||||
- **VoiceChannel:** Support `video_quality_mode` (#7722) ([3b3dabf](https://github.com/discordjs/discord.js/commit/3b3dabf3da2e2f24b81967d68b581d7f7452273f))
|
||||
- Add API v10 support (#7477) ([72577c4](https://github.com/discordjs/discord.js/commit/72577c4bfd02524a27afb6ff4aebba9301a690d3))
|
||||
- **embed:** Remove Embed.setColor (#7662) ([9b0d8cb](https://github.com/discordjs/discord.js/commit/9b0d8cb2d8f7b55753de584eb3a3f347f87596c2))
|
||||
- **StageInstance:** Add support for associated guild event (#7576) ([3dff31f](https://github.com/discordjs/discord.js/commit/3dff31f63fe4afdcc818193d737e1917f1ac8105))
|
||||
- **VoiceState:** Add edit method (#7569) ([b162f27](https://github.com/discordjs/discord.js/commit/b162f27e46524bfc64515969d753c6e8f30e6c40))
|
||||
- **ModalSubmitInteraction:** Add boolean properties (#7596) ([8907390](https://github.com/discordjs/discord.js/commit/89073903a253d9408839573502c72cae93fe70b6))
|
||||
- Add Modals and Text Inputs (#7023) ([ed92015](https://github.com/discordjs/discord.js/commit/ed920156344233241a21b0c0b99736a3a855c23c))
|
||||
- **discord.js:** Partial transition to undici (#7482) ([5158332](https://github.com/discordjs/discord.js/commit/51583320d3b0f6452cd96bad1021f2a57e4cc6f6))
|
||||
- **message:** Add `reason` on pin and unpin (#7520) ([00728f7](https://github.com/discordjs/discord.js/commit/00728f72b36123b607502624b4b02a02ee524d4a))
|
||||
- Re-export AuditLogEvent enum (#7528) ([6a2fa70](https://github.com/discordjs/discord.js/commit/6a2fa70b8e79a460be38916eeb605976ad6fe68b))
|
||||
- **options:** Add support for custom JSON transformers (#7476) ([dee27db](https://github.com/discordjs/discord.js/commit/dee27db35af379b0835f9fd5cc19563f7bf3dfc0))
|
||||
- Add CategoryChannelChildManager (#7320) ([5cf5071](https://github.com/discordjs/discord.js/commit/5cf5071061760c2f9c1e36d7648aef544b03323a))
|
||||
- **Co-authored-by:** Antonio Román <kyradiscord@gmail.com>
|
||||
- Attachment application command option type (#7200) ([0034396](https://github.com/discordjs/discord.js/commit/003439671d359dcfe481446ef12b90bd71c57835))
|
||||
- **builders:** Add attachment command option type (#7203) ([ae0f35f](https://github.com/discordjs/discord.js/commit/ae0f35f51d68dfa5a7dc43d161ef9365171debdb))
|
||||
- **scheduledevents:** Add image option (#7436) ([fbc71ef](https://github.com/discordjs/discord.js/commit/fbc71ef6b668c4b1e2b065d9b65541d9303db0a0))
|
||||
- Add methods to managers (#7300) ([dd751ae](https://github.com/discordjs/discord.js/commit/dd751ae19da196cc2f90ccd35c7d8e99878daaf9))
|
||||
- **channel:** Add .url getter (#7402) ([f59d630](https://github.com/discordjs/discord.js/commit/f59d6305cb0cd0d154a909f18be76407c4d452d3))
|
||||
- **components:** Add unsafe message component builders (#7387) ([6b6222b](https://github.com/discordjs/discord.js/commit/6b6222bf513d1ee8cd98fba0ad313def560b864f))
|
||||
- **thread:** Add `newlyCreated` to `threadCreate` event (#7386) ([51beda5](https://github.com/discordjs/discord.js/commit/51beda56f74e44ed013b5d25044b8d5fd1978b29))
|
||||
- **channel:** Add isDMBased typeguard (#7362) ([388f535](https://github.com/discordjs/discord.js/commit/388f53550cca7ded7350a050fda03c36e4c1fdf7))
|
||||
- **`Interaction`:** Add `.commandType` property to `CommandInteraction` and `AutocompleteInteraction` (#7357) ([567db60](https://github.com/discordjs/discord.js/commit/567db60475c8704661b2e788c9905ef364d6c00c))
|
||||
- **scheduledevent:** Add support for event cover images (#7337) ([355f579](https://github.com/discordjs/discord.js/commit/355f579771771a28a293c327a38574c8918d18f8))
|
||||
- **enumResolvers:** Strengthen typings (#7344) ([9a566e8](https://github.com/discordjs/discord.js/commit/9a566e8068f28fce87c07861ef1d2877c6ae105f))
|
||||
- Allow setting message flags when sending (#7312) ([706db92](https://github.com/discordjs/discord.js/commit/706db9228a91ef42e49d2ec749eac153b9ef75d0))
|
||||
- **minor:** Add application_id to Webhook (#7317) ([5ccdb0a](https://github.com/discordjs/discord.js/commit/5ccdb0ab266e4f74c331386ac2d6dd32bc225c62))
|
||||
- **threadchannel:** Add `createdTimestamp` field (#7306) ([9a16234](https://github.com/discordjs/discord.js/commit/9a1623425ae2d69f5c16f0096af4951ff5096e80))
|
||||
- **GuildPreview:** Add stickers (#7152) ([cf25de9](https://github.com/discordjs/discord.js/commit/cf25de9373df98b3c1cd0ca0a092d9dc8172929d))
|
||||
- Enum resolvers & internal enum string removal (#7290) ([213acd7](https://github.com/discordjs/discord.js/commit/213acd799738b888d550cdf3f08906764f8288e0))
|
||||
- **guildemojimanager:** Add `delete` and `edit` methods (#7286) ([9181a31](https://github.com/discordjs/discord.js/commit/9181a31e0ba330502052c94da544bb15c8b66f11))
|
||||
- **interaction:** Add `isRepliable` type guard (#7259) ([da05a88](https://github.com/discordjs/discord.js/commit/da05a8856b11cc1bf0df424c88a1cf9573e5b654))
|
||||
- **Channel:** Improve typeguards (#6957) ([37a22e0](https://github.com/discordjs/discord.js/commit/37a22e04c27724c2a65b05c701e3000ba3653ba1))
|
||||
- Add Locales to Interactions (#7131) ([9052e32](https://github.com/discordjs/discord.js/commit/9052e321d1c9c8841962d4e8dc5d9e060b104438))
|
||||
- **Permissions:** Remove deprecated thread-related permissions (#6755) ([ab3ff5a](https://github.com/discordjs/discord.js/commit/ab3ff5a262caf7d6225b8d6b54ab2c6b6613c0d0))
|
||||
- **VoiceRegion:** Remove the unsent vip field (#6759) ([caaef53](https://github.com/discordjs/discord.js/commit/caaef53dd97ecac9f714072ddba5ae9a99ab1027))
|
||||
- **richpresenceassets:** Add YouTube and custom image support (#7184) ([d06d70c](https://github.com/discordjs/discord.js/commit/d06d70ccf26c04c1122fac8430922588a489f95e))
|
||||
- **Collector:** Yield all collected values (#7073) ([2b480cb](https://github.com/discordjs/discord.js/commit/2b480cb14e6f52855efcb372da7fb455c15b13b1))
|
||||
|
||||
## Refactor
|
||||
|
||||
- **Util:** Rename `fetchRecommendedShards` (#8298) ([cafde77](https://github.com/discordjs/discord.js/commit/cafde77d73452d729ba8e2cb1cac3f14235b889b))
|
||||
- **Embed:** Add all the types (#8254) ([64f8140](https://github.com/discordjs/discord.js/commit/64f814066cc4adebaca47eb8d7a2040a8df399ae))
|
||||
- **rest:** Add content-type(s) to uploads (#8290) ([103a358](https://github.com/discordjs/discord.js/commit/103a3584c95a7b7f57fa62d47b86520d5ec32303))
|
||||
- Make `GuildAuditLogsEntry.action` return an `AuditLogEvent` (#8256) ([f0b68d5](https://github.com/discordjs/discord.js/commit/f0b68d57368d7ac3db97925df68c11a945ccd84c))
|
||||
- **builder:** Remove `unsafe*Builder`s (#8074) ([a4d1862](https://github.com/discordjs/discord.js/commit/a4d18629828234f43f03d1bd4851d4b727c6903b))
|
||||
- Make `ShardEvents` the events of `Shard` (#8185) ([c5750d5](https://github.com/discordjs/discord.js/commit/c5750d59f529ab48a5bc88a73a1c449ef6ddbffd))
|
||||
- **Util:** Make single `replace` call in `cleanContent` (#8210) ([6b20645](https://github.com/discordjs/discord.js/commit/6b206457400ce31d566b02a0c135042afb540853))
|
||||
- **ApplicationCommandManager:** Use `makeURLSearchParams` (#8196) ([cb3dca4](https://github.com/discordjs/discord.js/commit/cb3dca4ae029724421f3d04a784ace0ae2de75e2))
|
||||
- Use `Base` prefix for channel and interaction base classes (#8099) ([e24970e](https://github.com/discordjs/discord.js/commit/e24970e3c3d24f71ba711e59666cd8a49a33e33b))
|
||||
- **Constants:** Remove leftover code (#8156) ([cd17aad](https://github.com/discordjs/discord.js/commit/cd17aad720430d23af51c364caeb8b22bf6cb6b5))
|
||||
- Errors (#8068) ([e68effa](https://github.com/discordjs/discord.js/commit/e68effa822f064a324ed5b92e797c9fc3ce5e211))
|
||||
- **ClientOptions:** Remove `$` prefix from `ws.properties` keys (#8094) ([90a98fe](https://github.com/discordjs/discord.js/commit/90a98fee16b7d1d06768461f4e85127c0edf8419))
|
||||
- Use `GuildFeature` enum (#8101) ([e5ec1c4](https://github.com/discordjs/discord.js/commit/e5ec1c4dbc3fa54b2c43d1fec24932d7363e17cb))
|
||||
- **util:** Make utility functions top level (#8052) ([e53d162](https://github.com/discordjs/discord.js/commit/e53d1621986035b0c92a1782f6e013d408480e00))
|
||||
- **ApplicationCommand:** Permissions v2 (#7857) ([c7391db](https://github.com/discordjs/discord.js/commit/c7391db11b3efd4b1a6904affb26887ad06d6db4))
|
||||
- **\*:** Include name/reason/etc fields into options/data params (#8026) ([9c8b310](https://github.com/discordjs/discord.js/commit/9c8b3102ce00d1f2c1255c150fb3030f8b6dd026))
|
||||
- **ThreadMemberManager:** Consistent thread member fetching (#8021) ([da9107c](https://github.com/discordjs/discord.js/commit/da9107c007536952107bd92943b6c714538d5aeb))
|
||||
- **interactions:** Remove redundant interaction typeguards (#8027) ([f57d676](https://github.com/discordjs/discord.js/commit/f57d6768ad24f6e37dc598f9c93709449d3bc4dd))
|
||||
- Move all the config files to root (#8033) ([769ea0b](https://github.com/discordjs/discord.js/commit/769ea0bfe78c4f1d413c6b397c604ffe91e39c6a))
|
||||
- **channel:** Remove redundant channel type guards (#8012) ([70c733b](https://github.com/discordjs/discord.js/commit/70c733bb9a5bde0f79e6bea0bdc416458bda4c06))
|
||||
- Always return `Message` instances in interactions (#7917) ([9720e55](https://github.com/discordjs/discord.js/commit/9720e555340431c3b3ad7bd670ad0ac7eee8865f))
|
||||
- **attachment:** Don't return attachment builders from API (#7852) ([dfadcbc](https://github.com/discordjs/discord.js/commit/dfadcbc2fd50be64c8a0c1cae3be10f83678c5ee))
|
||||
- Clean up modal submissions (#7994) ([643dab3](https://github.com/discordjs/discord.js/commit/643dab3b1b5305d002fcefed62755bbe11fc3267))
|
||||
- **ThreadChannel:** Remove `MAX` helper from threads (#7846) ([dfd9eb2](https://github.com/discordjs/discord.js/commit/dfd9eb20b2d3e0e7db26744b1f15134ac6eda139))
|
||||
- **Activity:** Remove undocumented properties (#7844) ([5ba7740](https://github.com/discordjs/discord.js/commit/5ba7740fcfefda1eeba81ace4e6351eac02522a4))
|
||||
- **MessageAttachment:** Use `Attachment` instead (#7691) ([ab4c608](https://github.com/discordjs/discord.js/commit/ab4c608b97ff319935e1a7f23564622bfd7ddd57))
|
||||
- **Util:** Remove splitting (#7780) ([54e5629](https://github.com/discordjs/discord.js/commit/54e56299865a6746744544ba25d5540a1166d27c))
|
||||
- Tidy up builders and components (#7711) ([96a0d83](https://github.com/discordjs/discord.js/commit/96a0d83a1366703ecae40b5e0d5171be9123d079))
|
||||
- Remove nickname parsing (#7736) ([78a3afc](https://github.com/discordjs/discord.js/commit/78a3afcd7fdac358e06764cc0d675e1215c785f3))
|
||||
- Remove store channels (#7634) ([aedddb8](https://github.com/discordjs/discord.js/commit/aedddb875e740e1f1bd77f06ce1b361fd3b7bc36))
|
||||
- **IntegrationApplication:** Remove `summary` (#7729) ([eb6b472](https://github.com/discordjs/discord.js/commit/eb6b472f72488cad7e96befccc00270cf6dc01b8))
|
||||
- **GuildAuditLogs:** Remove build (#7704) ([cedd053](https://github.com/discordjs/discord.js/commit/cedd0536baa1301984daf89dfda4e63a7be595a2))
|
||||
- **InteractionCollector:** Simplify constructor logic (#7667) ([07b23a9](https://github.com/discordjs/discord.js/commit/07b23a99c7088a7c740f23051f3f755f091519b0))
|
||||
- Remove undocumented checks (#7637) ([9a6e691](https://github.com/discordjs/discord.js/commit/9a6e691eaa6c3d133098b2734414590cb838de2e))
|
||||
- Allow builders to accept emoji strings (#7616) ([fb9a9c2](https://github.com/discordjs/discord.js/commit/fb9a9c221121ee1c7986f9c775b77b9691a0ae15))
|
||||
- Use `static` fields (#7701) ([e805777](https://github.com/discordjs/discord.js/commit/e805777a7a81d1dc7a2edd9741ecb04e685a3886))
|
||||
- **EmbedBuilder:** Allow hex strings in setColor (#7673) ([f472975](https://github.com/discordjs/discord.js/commit/f4729759f600372455f062c75859f084e23a5d78))
|
||||
- Don't return builders from API data (#7584) ([549716e](https://github.com/discordjs/discord.js/commit/549716e4fcec89ca81216a6d22aa8e623175e37a))
|
||||
- **embed:** Allow hex strings in `setColor()` (#7593) ([79d6c04](https://github.com/discordjs/discord.js/commit/79d6c0489c3d563fdd05de63c4fcf93a6deefce1))
|
||||
- **InteractionResponses:** Use ClientOptions.jsonTransformer (#7599) ([fac55bc](https://github.com/discordjs/discord.js/commit/fac55bcfd1e8b76aae1273415f74fa6de7aca66d))
|
||||
- Deprecate invite stage instance (#7437) ([d2bc9d4](https://github.com/discordjs/discord.js/commit/d2bc9d444f42a70a3c4cc4c68eb107bcaebec509))
|
||||
- **guild:** Move `premiumSubscriptionCount` to `AnonymousGuild` (#7451) ([6d3da22](https://github.com/discordjs/discord.js/commit/6d3da226d3c003d137639e719394a807330e4844))
|
||||
- **actions:** Use optional chaining (#7460) ([d1bb362](https://github.com/discordjs/discord.js/commit/d1bb36256f2f86022884e6ee9e05b0536cb6384d))
|
||||
- **guildbanmanager:** Rename days option to deleteMessageDays (#7447) ([0dfdb2c](https://github.com/discordjs/discord.js/commit/0dfdb2cf11e236e67dd34277108973b5b79790a8))
|
||||
- Make public builder props getters (#7422) ([e8252ed](https://github.com/discordjs/discord.js/commit/e8252ed3b981a4b7e4013f12efadd2f5d9318d3e))
|
||||
- Remove redundant API defaults (#7449) ([532846b](https://github.com/discordjs/discord.js/commit/532846b1f8260d85022a022d093553310052afc9))
|
||||
- Allow discord.js builders to accept camelCase (#7424) ([94bf727](https://github.com/discordjs/discord.js/commit/94bf727cc3a2f11c88e95cdb151b235f775cd1ca))
|
||||
- Replace `WSCodes`, `WSEvents`, and `InviteScopes` with `discord-api-types` equivalent (#7409) ([cc25455](https://github.com/discordjs/discord.js/commit/cc25455d2c75177e3eddc880b7fd53cb122387c4))
|
||||
- Make constants enums top level and `PascalCase` (#7379) ([d8184f9](https://github.com/discordjs/discord.js/commit/d8184f94dd08daab37195f52828e06af5ed1c1e0))
|
||||
- **`Bitfield`:** Use discord-api-types enums instead (#7313) ([fbb1d03](https://github.com/discordjs/discord.js/commit/fbb1d0328bcd517027ad2eedb8753d17489ed851))
|
||||
- Use `@discordjs/rest` (#7298) ([ec0fba1](https://github.com/discordjs/discord.js/commit/ec0fba1ed0d3c5b1bb18171ece6fe5ee42d48497))
|
||||
- Switch to /builders `Embed` (#7067) ([d2d3a80](https://github.com/discordjs/discord.js/commit/d2d3a80c556a104099a1ddb1b24f1b921c553257))
|
||||
- Remove transformPermissions (#7303) ([b4ed8fd](https://github.com/discordjs/discord.js/commit/b4ed8fd3ed953085cd908b2845d4384c8555d3a2))
|
||||
- Remove VoiceChannel#editable (#7291) ([164589c](https://github.com/discordjs/discord.js/commit/164589c5516a847457444d11098981d557b6778b))
|
||||
- Remove boolean option for `Webhook#fetchMessage` (#7293) ([347ff80](https://github.com/discordjs/discord.js/commit/347ff80bbc9bc5243b7f68ba5d745782eadeba21))
|
||||
- **subcommandgroup:** Required default to false (#7217) ([6112767](https://github.com/discordjs/discord.js/commit/6112767128a664f32205425f52ba52220d57834f))
|
||||
- **invite:** Make `channel` and `inviter` getters (#7278) ([18b0ed4](https://github.com/discordjs/discord.js/commit/18b0ed4cbe8285637a971c7c99ee49d18060a403))
|
||||
- Remove required from getMember (#7188) ([c90e47f](https://github.com/discordjs/discord.js/commit/c90e47f90403e5b1b3499b213dcdf2704fd96b66))
|
||||
- Remove djs components and use /builders components instead (#7252) ([101d7c5](https://github.com/discordjs/discord.js/commit/101d7c5ffa03edcf8cb8a0647b77d5c9a38e4bdd))
|
||||
- Default \*URL methods to animated hash (#7149) ([7c07976](https://github.com/discordjs/discord.js/commit/7c07976018728154be0ce0314d3e8dfe8eb9ed5b))
|
||||
- Use setPosition inside edit (#7263) ([0b23b7f](https://github.com/discordjs/discord.js/commit/0b23b7f0394a20596c8d85b82870c3f35ea6b0e0))
|
||||
- Don't disable import order lint (#7262) ([0a5d5f3](https://github.com/discordjs/discord.js/commit/0a5d5f38c0b1a249fa2efe16f3b601c90622a4d5))
|
||||
- Remove discord.js enums and use discord-api-types enums instead (#7077) ([aa6d1c7](https://github.com/discordjs/discord.js/commit/aa6d1c74de01dd9a8f020c43fb2c193c4729df8d))
|
||||
- **application:** Remove fetchAssets (#7250) ([1479e40](https://github.com/discordjs/discord.js/commit/1479e40bcecc4c28ecb9f05fa4fbbdfe3bd387e1))
|
||||
- PresenceUpdate and demuxProbe (#7248) ([1745973](https://github.com/discordjs/discord.js/commit/174597302408f13c5bb685e2fb02ae2137cb481d))
|
||||
- **embeds:** Don't create new embed instances when unnecessary (#7227) ([822dc67](https://github.com/discordjs/discord.js/commit/822dc678da626de7b4fb22a747cd3cd2e8376732))
|
||||
- **GuildMember:** Throw better errors on #kickable and #bannable (#7137) ([4fd127e](https://github.com/discordjs/discord.js/commit/4fd127e79edfa1851f8a10242838f9d7aa68c8c3))
|
||||
- **SnowflakeUtil:** Switch to `@sapphire/snowflake` (#7079) ([e082dfb](https://github.com/discordjs/discord.js/commit/e082dfb1584926e4c05face5966d16e4a2921bc5))
|
||||
- **InteractionCreate:** Remove interaction event (#6326) ([ae876d9](https://github.com/discordjs/discord.js/commit/ae876d962453ccf843f8e6f70666a98a3173bb75))
|
||||
- **MessageCreate:** Remove message event (#6324) ([171e917](https://github.com/discordjs/discord.js/commit/171e917fb96b6bf39a6ad70e83be646f72fe451e))
|
||||
- **integration:** Turn undefined into null and consistency (#7209) ([13eb782](https://github.com/discordjs/discord.js/commit/13eb78256da901e6c3c405f546f36617ef5e8239))
|
||||
- Remove `deleted` field (#7092) ([cee7fd1](https://github.com/discordjs/discord.js/commit/cee7fd181c464e44eabf20b511d12589f2453722))
|
||||
- **Dates:** Save timestamps everywhere and use Date.parse (#7108) ([55e21f5](https://github.com/discordjs/discord.js/commit/55e21f53663a91863c63b6d9f3a8c35564664061))
|
||||
- **RoleManager:** Remove `comparePositions()` (#7201) ([fbbac27](https://github.com/discordjs/discord.js/commit/fbbac279789427b2c36869dc47b65fb08431e14d))
|
||||
- Better Command Terminology (#7197) ([b7856e7](https://github.com/discordjs/discord.js/commit/b7856e7809ff6fa21fe00286f885808535624f7c))
|
||||
- **Actions:** Remove deleted maps (#7076) ([5022b14](https://github.com/discordjs/discord.js/commit/5022b14da09e9b421f947e9bc385a0574cbf07d1))
|
||||
- **Client:** Remove applicationCommand events (#6492) ([6085b4f](https://github.com/discordjs/discord.js/commit/6085b4f72723d4ff82f7fea504241d14c94af21e))
|
||||
- Remove `Util.removeMentions()` (#6530) ([0c24cc8](https://github.com/discordjs/discord.js/commit/0c24cc8ec0d818315cc8f8bcf74fce060847ac79))
|
||||
- **Constants:** Change APPLICATION_COMMAND -> CHAT_INPUT_COMMAND (#7018) ([75616a3](https://github.com/discordjs/discord.js/commit/75616a305f9af33013486b13a872a39212101ce7))
|
||||
- **Guild:** Remove deprecated setXPositions methods (#6897) ([43e5e3c](https://github.com/discordjs/discord.js/commit/43e5e3c339a96fa895267d4538eee1d5e5843d05))
|
||||
- **UserFlags:** Update flag names (#6938) ([b246fc4](https://github.com/discordjs/discord.js/commit/b246fc4101b8e4957ffd1af8e2e4986a020ca211))
|
||||
|
||||
## Styling
|
||||
|
||||
- Cleanup tests and tsup configs ([6b8ef20](https://github.com/discordjs/discord.js/commit/6b8ef20cb3af5b5cfd176dd0aa0a1a1e98551629))
|
||||
|
||||
## Typings
|
||||
|
||||
- **GuildFeature:** Allow feature strings to be passed (#8264) ([b7d4e55](https://github.com/discordjs/discord.js/commit/b7d4e55419207d4e25f5c40cab221c7c04a617bf))
|
||||
- **CategoryChannelChildManager:** Fix Holds type (#8288) ([33a7a5c](https://github.com/discordjs/discord.js/commit/33a7a5cbdc00d2a5034dc1ec91fec5da7042f9d0))
|
||||
- Remove `MemberMention` (#8292) ([bf65b37](https://github.com/discordjs/discord.js/commit/bf65b37d1a9ea8417e26ad4afacea1eb45a0ff5a))
|
||||
- **GuildMemberManager:** Fix placement for `fetchMe()` (#8258) ([7525615](https://github.com/discordjs/discord.js/commit/75256153a9923d94ca709a37aaccc48dfb43c153))
|
||||
- Convert `Events` to an enum (#8246) ([feb3bdd](https://github.com/discordjs/discord.js/commit/feb3bdda0a3c3da80378c8cbcafca2968551eef9))
|
||||
- **GuildMemberManager:** Non-void return of `edit()` (#8186) ([c7a205f](https://github.com/discordjs/discord.js/commit/c7a205f7b992eea43af13a4638e2a03db7bc0d8a))
|
||||
- Add missing shard types (#8180) ([27d8deb](https://github.com/discordjs/discord.js/commit/27d8deb4716a87704370a95103b16fa1b763de18))
|
||||
- Implement `GuildChannelEditOptions` (#8184) ([b83e0c0](https://github.com/discordjs/discord.js/commit/b83e0c0caffc2b767aa1ba4412580970a6901899))
|
||||
- **Status:** Add missing members (#8179) ([8421f92](https://github.com/discordjs/discord.js/commit/8421f9203bd2d85ef8e64c3fb9a991c74223a75d))
|
||||
- **GuildScheduledEvent#scheduledStartAt:** Should be nullish (#8111) ([65dc8d6](https://github.com/discordjs/discord.js/commit/65dc8d677ee81469c0eeb4ecdd83fe2f68cc8982))
|
||||
- Fix modal builder constructor data type (#8143) ([7279f9c](https://github.com/discordjs/discord.js/commit/7279f9c31b14bc1e78c63b7298e80e37ca5dfe0c))
|
||||
- Use `ThreadAutoArchiveDuration` from discord-api-types (#8145) ([a3799f9](https://github.com/discordjs/discord.js/commit/a3799f9ebb027904830457119708d550e2009200))
|
||||
- **Shard#reconnecting:** Fix event name (#8118) ([95e6d6e](https://github.com/discordjs/discord.js/commit/95e6d6ede03c4fb92a8d8027a085e84b043fd895))
|
||||
- **ApplicationCommand:** Fix typo in setDMPermission (#8097) ([4df491c](https://github.com/discordjs/discord.js/commit/4df491ce8578a1b01ee8412a4df8137a302e7202))
|
||||
- Fix `setType()` parameter and `ChannelData.type` (#8089) ([b4e28a8](https://github.com/discordjs/discord.js/commit/b4e28a8ff6bf165c54a8726d3bc3a3cc0c1e469b))
|
||||
- Fix `ApplicationCommandPermissionsUpdate` event typings (#8071) ([9964454](https://github.com/discordjs/discord.js/commit/9964454c2944a0523399481a5f609144486e549b))
|
||||
- **AutocompleteOption:** Fix and improve types (#8069) ([476b7d5](https://github.com/discordjs/discord.js/commit/476b7d519c719152ea04e207f6dd09bb23e733db))
|
||||
- **ThreadMemberManager:** Fix return type of fetching members with no arguments (#8060) ([2392a6f](https://github.com/discordjs/discord.js/commit/2392a6f5de2efcf6b326173d26295c928b94adb6))
|
||||
- Remove isAutocomplete typeguard from typings (#8063) ([c0f079d](https://github.com/discordjs/discord.js/commit/c0f079d2325a636c83ac676c525bfa89ce308b3c))
|
||||
- **AttachmentBuilder:** Fix data type (#8016) ([7fa698d](https://github.com/discordjs/discord.js/commit/7fa698d23e548987762c4c66c96c510d9ea56eb4))
|
||||
- **modal:** Fix `showModal()` typings (#8014) ([0ccc243](https://github.com/discordjs/discord.js/commit/0ccc243c8ffbf852660c899cc2ad47bd5ebb65cb))
|
||||
- Fix some attachment related typings (#8013) ([6aa6232](https://github.com/discordjs/discord.js/commit/6aa623240ee94b117c7e69c1d09b50923a8f7a4c))
|
||||
- **AttachmentBuilder:** Remove name parameter from constructor (#8008) ([6266b0c](https://github.com/discordjs/discord.js/commit/6266b0c1e323f9522010f90f34ce6f17fcb6e769))
|
||||
- Add types to `EventEmitter` static methods (#7986) ([d60c464](https://github.com/discordjs/discord.js/commit/d60c464e618e4159d2656e7832798909832f33cd))
|
||||
- Nullify `guildScheduledEventUpdate`'s old parameter (#7955) ([fdeac9d](https://github.com/discordjs/discord.js/commit/fdeac9d9fba06c532eca296ddd8479047bc732bf))
|
||||
- Make `CacheType` generic more accurate for return values (#7868) ([e07b910](https://github.com/discordjs/discord.js/commit/e07b910e684bc3cf71fb93417951ad42351bace4))
|
||||
- **guildScheduledEvent:** Mark `entityMetadata` as nullable (#7908) ([64bdf53](https://github.com/discordjs/discord.js/commit/64bdf53116945ffb51764bb8ec539d530aefcfb1))
|
||||
- **discord.js:** Export missing enums (#7864) ([5eeef3f](https://github.com/discordjs/discord.js/commit/5eeef3f708eb900ec994d837fb4cd414a4f4b437))
|
||||
- Fix return type of `toString()` on channels (#7836) ([ece6289](https://github.com/discordjs/discord.js/commit/ece628986c7eb1a66f46076d8f8518c9ff00aaf3))
|
||||
- **Message#activity:** Make `partyId` optional and use enum for `type` (#7845) ([bfeaf85](https://github.com/discordjs/discord.js/commit/bfeaf856f76eb7cb756ac55aac13636ccdb345b6))
|
||||
- Cleanup \*Data type definitions (#7716) ([585169f](https://github.com/discordjs/discord.js/commit/585169f2f097ffb1940d17f549e4290aa55acde2))
|
||||
- Fix BooleanCache never resolving to true (#7809) ([440ac24](https://github.com/discordjs/discord.js/commit/440ac243ca1d6f8cd04603e63e3f2f6ea1722ee8))
|
||||
- **CommandInteraction:** Add awaitModalSubmit (#7811) ([a6d9ce5](https://github.com/discordjs/discord.js/commit/a6d9ce57c6cae90d0afc60010cad44fdc2c2d06c))
|
||||
- **ThreadChannel:** Fix autoArchiveDuration types (#7816) ([0857476](https://github.com/discordjs/discord.js/commit/08574763eb665b5a43ccfb826929f1e3f0d1c3a7))
|
||||
- Add missing typing (#7781) ([f094e33](https://github.com/discordjs/discord.js/commit/f094e338617a1a3c9f48a325e4b8e9b5a405aa91))
|
||||
- **VoiceChannel:** Nullify property (#7793) ([446eb39](https://github.com/discordjs/discord.js/commit/446eb390ce58b7e7f60e297b25f53773a55f7fb9))
|
||||
- **ModalSubmitInteraction:** Message (#7705) ([b577bcc](https://github.com/discordjs/discord.js/commit/b577bcc1df5c6424fef9984e19a5f11c77371cf3))
|
||||
- **Embed:** Add missing getters and add video to EmbedData (#7728) ([fd1dc72](https://github.com/discordjs/discord.js/commit/fd1dc72c0a77dbe18753d8db22972dfa5fe4ab36))
|
||||
- **ModalSubmitInteraction:** Fix `components` type (#7732) ([6f4e97b](https://github.com/discordjs/discord.js/commit/6f4e97bfafe4a058f6ec85d321676401d701ee55))
|
||||
- **interactionCollector:** Filter should have a collected argument (#7753) ([e4f2705](https://github.com/discordjs/discord.js/commit/e4f27051ca921d299c302b600a8c2917e9356ef6))
|
||||
- Fix regressions (#7649) ([5748dbe](https://github.com/discordjs/discord.js/commit/5748dbe08783beb80c526de38ccd105eb0e82664))
|
||||
- **Constants:** Add `NonSystemMessageTypes` (#7678) ([9afc030](https://github.com/discordjs/discord.js/commit/9afc03054e4c8973702d6c18e618643f76382dd9))
|
||||
- Fix auto archive duration type (#7688) ([8e3b2d7](https://github.com/discordjs/discord.js/commit/8e3b2d7abd38136534969cf77c6a748ee3a20355))
|
||||
- **InteractionResponseFields:** Add webhook (#7597) ([daf2829](https://github.com/discordjs/discord.js/commit/daf2829cb58d1a44cb1f1ece21e428d1a23e99c9))
|
||||
- **Embed:** Add forgotten `footer` type (#7665) ([8fb9816](https://github.com/discordjs/discord.js/commit/8fb98165a9d098ab316475d6baacb015783eb638))
|
||||
- **ColorResolvable:** Simplify string types (#7643) ([2297c2b](https://github.com/discordjs/discord.js/commit/2297c2b9479ace16f5f7155479605a4ac2718e3d))
|
||||
- Allow component classes in action row data (#7614) ([230c0c4](https://github.com/discordjs/discord.js/commit/230c0c4cb137882ff7bab783a4aeaa83ae941de5))
|
||||
- **ActionRow:** Allow components to be passed to constructors (#7531) ([e71c76c](https://github.com/discordjs/discord.js/commit/e71c76c7f795837dbcc3576e507bd286640b4296))
|
||||
- **showModal:** Align types with the documentation (#7600) ([0d7e4ed](https://github.com/discordjs/discord.js/commit/0d7e4edd969513692c061c107be4bbe7e4b54321))
|
||||
- Modals type and doc fixes (#7608) ([93854a8](https://github.com/discordjs/discord.js/commit/93854a8013d07234cb849bfcbfa99f74a4c3cdb4))
|
||||
- **InteractionResponseFields:** Add boolean properties (#7565) ([53defb8](https://github.com/discordjs/discord.js/commit/53defb82e36108468e35077b887ee28b811891ab))
|
||||
- Allow raw components for reply and message options (#7573) ([2d4971b](https://github.com/discordjs/discord.js/commit/2d4971b032a01c05b55c93d6475e61b0d25d69d3))
|
||||
- Fix component \*Data types (#7536) ([a8321d8](https://github.com/discordjs/discord.js/commit/a8321d8026df2e6a09d867939986bf77f894f3a8))
|
||||
- Use discord-api-types `Locale` (#7541) ([8346003](https://github.com/discordjs/discord.js/commit/83460037be840ba623f3b02a3e6f218943f9d2b7))
|
||||
- **anychannel:** Add PartialGroupDMChannel (#7472) ([cf66930](https://github.com/discordjs/discord.js/commit/cf669301c7be8eaecf91d7f764eccc67d7a5b4c6))
|
||||
- Remove `ApplicationCommandInteractionOptionResolver` (#7491) ([71f4fa8](https://github.com/discordjs/discord.js/commit/71f4fa82ed6206d6843345a5394119f2a728aa35))
|
||||
- **embed:** Fix timestamp allowed types (#7470) ([7959a68](https://github.com/discordjs/discord.js/commit/7959a68d8ec600af248f5506f39871cae7eeeb04))
|
||||
- Remove duplicate rate limit for thread creation (#7465) ([2d2de1d](https://github.com/discordjs/discord.js/commit/2d2de1d3fd15a098d69e09710e9a7a3352234fef))
|
||||
- Correct types for InteractionCollector guild and channel (#7452) ([6ce906a](https://github.com/discordjs/discord.js/commit/6ce906a02fcb051cb6df3e9f453ba9f53db03bd0))
|
||||
- Fix `GuildAuditLogsTypes` keys & typos (#7423) ([3d8c776](https://github.com/discordjs/discord.js/commit/3d8c77600be51a86a99b526078bb1b1fcb9a0811))
|
||||
- Remove duplicate `GuildChannelOverwriteOptions` interface (#7428) ([83458ff](https://github.com/discordjs/discord.js/commit/83458ff7c782b8efdaaac931d2dee1764dad25bf))
|
||||
- Use `GuildFeature` enum from `discord-api-types` (#7397) ([a7b80b9](https://github.com/discordjs/discord.js/commit/a7b80b9d9bf4902bd85b592986771eadf7a765dc))
|
||||
- Fix \*BitField.Flags properties (#7363) ([e6a26d2](https://github.com/discordjs/discord.js/commit/e6a26d25b3cf8dfcc8aa8997b021f1774f3b754b))
|
||||
- Fix MessageMentions channel types (#7316) ([c05b388](https://github.com/discordjs/discord.js/commit/c05b38873bb3c37c6e4ebcb6b6373a8858cc03de))
|
||||
- Fix channel create overloads (#7294) ([1c6c944](https://github.com/discordjs/discord.js/commit/1c6c9449ad68601c6c98748d73be8114401d38ef))
|
||||
- Fix regressions and inconsistencies (#7260) ([26a9dc3](https://github.com/discordjs/discord.js/commit/26a9dc32062cd071917bbe7264050315b4d6dd3c))
|
||||
- **interaction:** Remove renamed typeguards (#7220) ([68b9564](https://github.com/discordjs/discord.js/commit/68b9564f1821726377a1e929a3ca1fc65b4ad598))
|
||||
- AssertType -> expectType ([3f36746](https://github.com/discordjs/discord.js/commit/3f36746561a40cd61a7cd2e054b7ef80d58fc707))
|
||||
- Fix cache types resolving to `never` (#7164) ([c978dbb](https://github.com/discordjs/discord.js/commit/c978dbb6233bcd85408caf0bca7619c9c5d508f0))
|
||||
|
||||
# [13.9.0](https://github.com/discordjs/discord.js/compare/13.8.1...13.9.0) - (2022-07-17)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
<div align="center">
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
|
||||
<a href="https://www.npmjs.com/package/discord.js"><img src="https://img.shields.io/npm/v/discord.js.svg?maxAge=3600" alt="npm version" /></a>
|
||||
<a href="https://www.npmjs.com/package/discord.js"><img src="https://img.shields.io/npm/dt/discord.js.svg?maxAge=3600" alt="npm downloads" /></a>
|
||||
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/test.yml/badge.svg" alt="Tests status" /></a>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
|
||||
<a href="https://www.npmjs.com/package/discord.js"><img src="https://img.shields.io/npm/v/discord.js.svg?maxAge=3600" alt="npm version" /></a>
|
||||
<a href="https://www.npmjs.com/package/discord.js"><img src="https://img.shields.io/npm/dt/discord.js.svg?maxAge=3600" alt="npm downloads" /></a>
|
||||
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/test.yml/badge.svg" alt="Tests status" /></a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"><img src="https://raw.githubusercontent.com/discordjs/discord.js/main/.github/powered-by-vercel.svg" alt="Vercel" /></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
## About
|
||||
@@ -104,7 +107,7 @@ client.login('token');
|
||||
- [Website](https://discord.js.org/) ([source](https://github.com/discordjs/discord.js/tree/main/packages/website))
|
||||
- [Documentation](https://discord.js.org/#/docs)
|
||||
- [Guide](https://discordjs.guide/) ([source](https://github.com/discordjs/guide))
|
||||
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v13.html), including updated and removed items in the library.
|
||||
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v14.html), including updated and removed items in the library.
|
||||
- [discord.js Discord server](https://discord.gg/djs)
|
||||
- [Discord API Discord server](https://discord.gg/discord-api)
|
||||
- [GitHub](https://github.com/discordjs/discord.js/tree/main/packages/discord.js)
|
||||
|
||||
@@ -58,7 +58,7 @@ commit_parsers = [
|
||||
]
|
||||
filter_commits = true
|
||||
tag_pattern = "[0-9]*"
|
||||
skip_tags = "v[0-9]*|11|12|@discordjs"
|
||||
skip_tags = "v[0-9]*|9*|11*|12*|@discordjs*"
|
||||
ignore_tags = ""
|
||||
topo_order = false
|
||||
sort_commits = "newest"
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
{
|
||||
"name": "discord.js",
|
||||
"version": "14.0.0-dev",
|
||||
"version": "14.0.3",
|
||||
"description": "A powerful library for interacting with the Discord API",
|
||||
"scripts": {
|
||||
"test": "yarn docs:test && yarn test:typescript",
|
||||
"test:typescript": "tsc --noEmit && tsd",
|
||||
"lint": "prettier --check . && eslint src && tslint typings/index.d.ts",
|
||||
"format": "prettier --write . && eslint src --fix",
|
||||
"fmt": "yarn format",
|
||||
"docs": "docgen -i './src/*.js' './src/**/*.js' -c ./docs/index.json -r ../../ -o ./docs/docs.json",
|
||||
"docs:test": "docgen -i './src/*.js' './src/**/*.js' -c ./docs/index.json -r ../../",
|
||||
"prepack": "yarn lint && yarn test",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/discord.js/*'",
|
||||
"release": "cliff-jumper --skip-tag --verbose"
|
||||
"release": "cliff-jumper --skip-tag"
|
||||
},
|
||||
"main": "./src/index.js",
|
||||
"types": "./typings/index.d.ts",
|
||||
@@ -53,11 +54,11 @@
|
||||
"@discordjs/rest": "workspace:^",
|
||||
"@sapphire/snowflake": "^3.2.2",
|
||||
"@types/ws": "^8.5.3",
|
||||
"discord-api-types": "^0.36.2",
|
||||
"discord-api-types": "^0.36.3",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"lodash.snakecase": "^4.1.1",
|
||||
"tslib": "^2.4.0",
|
||||
"undici": "^5.7.0",
|
||||
"undici": "^5.8.0",
|
||||
"ws": "^8.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -63,7 +63,7 @@ class BaseClient extends EventEmitter {
|
||||
}
|
||||
|
||||
toJSON(...props) {
|
||||
return flatten(this, { domain: false }, ...props);
|
||||
return flatten(this, ...props);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ class Client extends BaseClient {
|
||||
this.application = null;
|
||||
|
||||
/**
|
||||
* Timestamp of the time the client was last `READY` at
|
||||
* Timestamp of the time the client was last {@link Status.Ready} at
|
||||
* @type {?number}
|
||||
*/
|
||||
this.readyTimestamp = null;
|
||||
@@ -185,7 +185,7 @@ class Client extends BaseClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* Time at which the client was last regarded as being in the `READY` state
|
||||
* Time at which the client was last regarded as being in the {@link Status.Ready} state
|
||||
* (each time the client disconnects and successfully reconnects, this will be overwritten)
|
||||
* @type {?Date}
|
||||
* @readonly
|
||||
@@ -195,7 +195,7 @@ class Client extends BaseClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* How long it has been since the client last entered the `READY` state in milliseconds
|
||||
* How long it has been since the client last entered the {@link Status.Ready} state in milliseconds
|
||||
* @type {?number}
|
||||
* @readonly
|
||||
*/
|
||||
@@ -454,7 +454,8 @@ class Client extends BaseClient {
|
||||
|
||||
toJSON() {
|
||||
return super.toJSON({
|
||||
readyAt: false,
|
||||
actions: false,
|
||||
presence: false,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -12,16 +12,33 @@ const { parseWebhookURL } = require('../util/Util');
|
||||
*/
|
||||
class WebhookClient extends BaseClient {
|
||||
/**
|
||||
* The data for the webhook client containing either an id and token or just a URL
|
||||
* @typedef {Object} WebhookClientData
|
||||
* @property {Snowflake} [id] The id of the webhook
|
||||
* @property {string} [token] The token of the webhook
|
||||
* @property {string} [url] The full URL for the webhook client
|
||||
* Represents the credentials used for a webhook in the form of its id and token.
|
||||
* @typedef {Object} WebhookClientDataIdWithToken
|
||||
* @property {Snowflake} id The webhook's id
|
||||
* @property {string} token The webhook's token
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the credentials used for a webhook in the form of a URL.
|
||||
* @typedef {Object} WebhookClientDataURL
|
||||
* @property {string} url The full URL for the webhook
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the credentials used for a webhook.
|
||||
* @typedef {WebhookClientDataIdWithToken|WebhookClientDataURL} WebhookClientData
|
||||
*/
|
||||
|
||||
/**
|
||||
* Options for a webhook client.
|
||||
* @typedef {Object} WebhookClientOptions
|
||||
* @property {MessageMentionOptions} [allowedMentions] Default value for {@link WebhookMessageOptions#allowedMentions}
|
||||
* @property {RESTOptions} [rest] Options for the REST manager
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {WebhookClientData} data The data of the webhook
|
||||
* @param {ClientOptions} [options] Options for the client
|
||||
* @param {WebhookClientOptions} [options] Options for the webhook client
|
||||
*/
|
||||
constructor(data, options) {
|
||||
super(options);
|
||||
@@ -41,13 +58,39 @@ class WebhookClient extends BaseClient {
|
||||
Object.defineProperty(this, 'token', { value: token, writable: true, configurable: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* The options the webhook client was instantiated with.
|
||||
* @type {WebhookClientOptions}
|
||||
* @name WebhookClient#options
|
||||
*/
|
||||
|
||||
// These are here only for documentation purposes - they are implemented by Webhook
|
||||
/* eslint-disable no-empty-function */
|
||||
/* eslint-disable no-empty-function, valid-jsdoc */
|
||||
/**
|
||||
* Sends a message with this webhook.
|
||||
* @param {string|MessagePayload|WebhookMessageOptions} options The content for the reply
|
||||
* @returns {Promise<APIMessage>}
|
||||
*/
|
||||
send() {}
|
||||
sendSlackMessage() {}
|
||||
|
||||
/**
|
||||
* Gets a message that was sent by this webhook.
|
||||
* @param {Snowflake} message The id of the message to fetch
|
||||
* @param {WebhookFetchMessageOptions} [options={}] The options to provide to fetch the message.
|
||||
* @returns {Promise<APIMessage>} Returns the message sent by this webhook
|
||||
*/
|
||||
fetchMessage() {}
|
||||
edit() {}
|
||||
|
||||
/**
|
||||
* Edits a message that was sent by this webhook.
|
||||
* @param {MessageResolvable} message The message to edit
|
||||
* @param {string|MessagePayload|WebhookEditMessageOptions} options The options to provide
|
||||
* @returns {Promise<APIMessage>} Returns the message edited by this webhook
|
||||
*/
|
||||
editMessage() {}
|
||||
|
||||
sendSlackMessage() {}
|
||||
edit() {}
|
||||
delete() {}
|
||||
deleteMessage() {}
|
||||
get createdTimestamp() {}
|
||||
|
||||
@@ -15,8 +15,8 @@ class InviteCreateAction extends Action {
|
||||
|
||||
/**
|
||||
* Emitted when an invite is created.
|
||||
* <info> This event only triggers if the client has `MANAGE_GUILD` permissions for the guild,
|
||||
* or `MANAGE_CHANNELS` permissions for the channel.</info>
|
||||
* <info>This event requires either the {@link PermissionFlagsBits.ManageGuild} permission or the
|
||||
* {@link PermissionFlagsBits.ManageChannels} permission for the channel.</info>
|
||||
* @event Client#inviteCreate
|
||||
* @param {Invite} invite The invite that was created
|
||||
*/
|
||||
|
||||
@@ -17,8 +17,8 @@ class InviteDeleteAction extends Action {
|
||||
|
||||
/**
|
||||
* Emitted when an invite is deleted.
|
||||
* <info> This event only triggers if the client has `MANAGE_GUILD` permissions for the guild,
|
||||
* or `MANAGE_CHANNELS` permissions for the channel.</info>
|
||||
* <info>This event requires either the {@link PermissionFlagsBits.ManageGuild} permission or the
|
||||
* {@link PermissionFlagsBits.ManageChannels} permission for the channel.</info>
|
||||
* @event Client#inviteDelete
|
||||
* @param {Invite} invite The invite that was deleted
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,8 @@ class ThreadMembersUpdateAction extends Action {
|
||||
}
|
||||
|
||||
/**
|
||||
* Emitted whenever members are added or removed from a thread. Requires `GUILD_MEMBERS` privileged intent
|
||||
* Emitted whenever members are added or removed from a thread.
|
||||
* <info>This event requires the {@link GatewayIntentBits.GuildMembers} privileged gateway intent.</info>
|
||||
* @event Client#threadMembersUpdate
|
||||
* @param {Collection<Snowflake, ThreadMember>} addedMembers The members that were added
|
||||
* @param {Collection<Snowflake, ThreadMember>} removedMembers The members that were removed
|
||||
|
||||
@@ -13,7 +13,8 @@ class UserUpdateAction extends Action {
|
||||
if (!oldUser.equals(newUser)) {
|
||||
/**
|
||||
* Emitted whenever a user's details (e.g. username) are changed.
|
||||
* Triggered by the Discord gateway events USER_UPDATE, GUILD_MEMBER_UPDATE, and PRESENCE_UPDATE.
|
||||
* Triggered by the Discord gateway events {@link Events.UserUpdate},
|
||||
* {@link Events.GuildMemberUpdate}, and {@link Events.PresenceUpdate}.
|
||||
* @event Client#userUpdate
|
||||
* @param {User} oldUser The user before the update
|
||||
* @param {User} newUser The user after the update
|
||||
|
||||
@@ -242,9 +242,10 @@ class ApplicationCommandManager extends CachedManager {
|
||||
}
|
||||
|
||||
if ('defaultMemberPermissions' in command) {
|
||||
default_member_permissions = command.defaultMemberPermissions
|
||||
? new PermissionsBitField(command.defaultMemberPermissions).bitfield.toString()
|
||||
: command.defaultMemberPermissions;
|
||||
default_member_permissions =
|
||||
command.defaultMemberPermissions !== null
|
||||
? new PermissionsBitField(command.defaultMemberPermissions).bitfield.toString()
|
||||
: command.defaultMemberPermissions;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -267,7 +267,7 @@ class GuildChannelManager extends CachedManager {
|
||||
nsfw: data.nsfw,
|
||||
bitrate: data.bitrate ?? channel.bitrate,
|
||||
user_limit: data.userLimit ?? channel.userLimit,
|
||||
rtc_region: data.rtcRegion ?? channel.rtcRegion,
|
||||
rtc_region: 'rtcRegion' in data ? data.rtcRegion : channel.rtcRegion,
|
||||
video_quality_mode: data.videoQualityMode,
|
||||
parent_id: parent,
|
||||
lock_permissions: data.lockPermissions,
|
||||
|
||||
@@ -74,19 +74,23 @@ class GuildMemberManager extends CachedManager {
|
||||
/**
|
||||
* Options used to add a user to a guild using OAuth2.
|
||||
* @typedef {Object} AddGuildMemberOptions
|
||||
* @property {string} accessToken An OAuth2 access token for the user with the `guilds.join` scope granted to the
|
||||
* bot's application
|
||||
* @property {string} [nick] The nickname to give to the member (requires `MANAGE_NICKNAMES`)
|
||||
* @property {string} accessToken An OAuth2 access token for the user with the {@link OAuth2Scopes.GuildsJoin}
|
||||
* scope granted to the bot's application
|
||||
* @property {string} [nick] The nickname to give to the member
|
||||
* <info>This property requires the {@link PermissionFlagsBits.ManageNicknames} permission.</info>
|
||||
* @property {Collection<Snowflake, Role>|RoleResolvable[]} [roles] The roles to add to the member
|
||||
* (requires `MANAGE_ROLES`)
|
||||
* @property {boolean} [mute] Whether the member should be muted (requires `MUTE_MEMBERS`)
|
||||
* @property {boolean} [deaf] Whether the member should be deafened (requires `DEAFEN_MEMBERS`)
|
||||
* @property {boolean} [force] Whether to skip the cache check and call the API directly
|
||||
* <info>This property requires the {@link PermissionFlagsBits.ManageRoles} permission.</info>
|
||||
* @property {boolean} [mute] Whether the member should be muted
|
||||
* <info>This property requires the {@link PermissionFlagsBits.MuteMembers} permission.</info>
|
||||
* @property {boolean} [deaf] Whether the member should be deafened
|
||||
* <info>This property requires the {@link PermissionFlagsBits.MuteMembers} permission.</info>
|
||||
* @property {boolean} [force] Whether to skip the cache check and request the API directly
|
||||
* @property {boolean} [fetchWhenExisting=true] Whether to fetch the user if not cached and already a member
|
||||
*/
|
||||
|
||||
/**
|
||||
* Adds a user to the guild using OAuth2. Requires the `CREATE_INSTANT_INVITE` permission.
|
||||
* Adds a user to the guild using OAuth2.
|
||||
* <info>This method requires the {@link PermissionFlagsBits.CreateInstantInvite} permission.
|
||||
* @param {UserResolvable} user The user to add to the guild
|
||||
* @param {AddGuildMemberOptions} options Options for adding the user to the guild
|
||||
* @returns {Promise<GuildMember|null>}
|
||||
@@ -299,11 +303,13 @@ class GuildMemberManager extends CachedManager {
|
||||
}
|
||||
data.roles &&= data.roles.map(role => (role instanceof Role ? role.id : role));
|
||||
|
||||
data.communication_disabled_until =
|
||||
// eslint-disable-next-line eqeqeq
|
||||
data.communicationDisabledUntil != null
|
||||
? new Date(data.communicationDisabledUntil).toISOString()
|
||||
: data.communicationDisabledUntil;
|
||||
if (typeof data.communicationDisabledUntil !== 'undefined') {
|
||||
data.communication_disabled_until =
|
||||
// eslint-disable-next-line eqeqeq
|
||||
data.communicationDisabledUntil != null
|
||||
? new Date(data.communicationDisabledUntil).toISOString()
|
||||
: data.communicationDisabledUntil;
|
||||
}
|
||||
|
||||
let endpoint;
|
||||
if (id === this.client.user.id) {
|
||||
|
||||
@@ -72,11 +72,11 @@ class PermissionOverwriteManager extends CachedManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extra information about the overwrite
|
||||
* Extra information about the overwrite.
|
||||
* @typedef {Object} GuildChannelOverwriteOptions
|
||||
* @property {string} [reason] Reason for creating/editing this overwrite
|
||||
* @property {number} [type] The type of overwrite, either `0` for a role or `1` for a member. Use this to bypass
|
||||
* automatic resolution of type that results in an error for uncached structure
|
||||
* @property {string} [reason] The reason for creating/editing this overwrite
|
||||
* @property {OverwriteType} [type] The type of overwrite. Use this to bypass automatic resolution of `type`
|
||||
* that results in an error for an uncached structure
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -115,7 +115,7 @@ class PermissionOverwriteManager extends CachedManager {
|
||||
* @example
|
||||
* // Create or Replace permission overwrites for a message author
|
||||
* message.channel.permissionOverwrites.create(message.author, {
|
||||
* SEND_MESSAGES: false
|
||||
* SendMessages: false
|
||||
* })
|
||||
* .then(channel => console.log(channel.permissionOverwrites.cache.get(message.author.id)))
|
||||
* .catch(console.error);
|
||||
@@ -133,7 +133,7 @@ class PermissionOverwriteManager extends CachedManager {
|
||||
* @example
|
||||
* // Edit or Create permission overwrites for a message author
|
||||
* message.channel.permissionOverwrites.edit(message.author, {
|
||||
* SEND_MESSAGES: false
|
||||
* SendMessages: false
|
||||
* })
|
||||
* .then(channel => console.log(channel.permissionOverwrites.cache.get(message.author.id)))
|
||||
* .catch(console.error);
|
||||
|
||||
@@ -177,11 +177,12 @@ class ThreadManager extends CachedManager {
|
||||
/**
|
||||
* The options used to fetch archived threads.
|
||||
* @typedef {Object} FetchArchivedThreadOptions
|
||||
* @property {string} [type='public'] The type of threads to fetch, either `public` or `private`
|
||||
* @property {boolean} [fetchAll=false] Whether to fetch **all** archived threads when type is `private`.
|
||||
* Requires `MANAGE_THREADS` if true
|
||||
* @property {string} [type='public'] The type of threads to fetch (`public` or `private`)
|
||||
* @property {boolean} [fetchAll=false] Whether to fetch **all** archived threads when `type` is `private`
|
||||
* <info>This property requires the {@link PermissionFlagsBits.ManageThreads} permission if `true`.</info>
|
||||
* @property {DateResolvable|ThreadChannelResolvable} [before] Only return threads that were created before this Date
|
||||
* or Snowflake. <warn>Must be a {@link ThreadChannelResolvable} when type is `private` and fetchAll is `false`</warn>
|
||||
* or Snowflake
|
||||
* <warn>Must be a {@link ThreadChannelResolvable} when `type` is `private` and `fetchAll` is `false`.</warn>
|
||||
* @property {number} [limit] Maximum number of threads to return
|
||||
*/
|
||||
|
||||
@@ -193,7 +194,9 @@ class ThreadManager extends CachedManager {
|
||||
*/
|
||||
|
||||
/**
|
||||
* Obtains a set of archived threads from Discord, requires `READ_MESSAGE_HISTORY` in the parent channel.
|
||||
* Obtains a set of archived threads from Discord.
|
||||
* <info>This method requires the {@link PermissionFlagsBits.ReadMessageHistory} permission
|
||||
* in the parent channel.</info>
|
||||
* @param {FetchArchivedThreadOptions} [options] The options to fetch archived threads
|
||||
* @param {boolean} [cache=true] Whether to cache the new thread objects if they aren't already
|
||||
* @returns {Promise<FetchedThreads>}
|
||||
@@ -231,7 +234,9 @@ class ThreadManager extends CachedManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the accessible active threads from Discord, requires `READ_MESSAGE_HISTORY` in the parent channel.
|
||||
* Obtains the accessible active threads from Discord.
|
||||
* <info>This method requires the {@link PermissionFlagsBits.ReadMessageHistory} permission
|
||||
* in the parent channel.</info>
|
||||
* @param {boolean} [cache=true] Whether to cache the new thread objects if they aren't already
|
||||
* @returns {Promise<FetchedThreads>}
|
||||
*/
|
||||
|
||||
@@ -122,7 +122,8 @@ class ThreadMemberManager extends CachedManager {
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fetches thread member(s) from Discord. Requires the `GUILD_MEMBERS` gateway intent.
|
||||
* Fetches thread member(s) from Discord.
|
||||
* <info>This method requires the {@link GatewayIntentBits.GuildMembers} privileged gateway intent.</info>
|
||||
* @param {ThreadMemberResolvable|FetchThreadMemberOptions|FetchThreadMembersOptions} [options]
|
||||
* Options for fetching thread member(s)
|
||||
* @returns {Promise<ThreadMember|Collection<Snowflake, ThreadMember>>}
|
||||
|
||||
@@ -206,7 +206,7 @@ class ShardClientUtil {
|
||||
*/
|
||||
_respond(type, message) {
|
||||
this.send(message).catch(err => {
|
||||
const error = new Error(`Error when sending ${type} response to master process: ${err.message}`);
|
||||
const error = new globalThis.Error(`Error when sending ${type} response to master process: ${err.message}`);
|
||||
error.stack = err.stack;
|
||||
/**
|
||||
* Emitted when the client encounters an error.
|
||||
|
||||
@@ -8,7 +8,7 @@ const { setTimeout: sleep } = require('node:timers/promises');
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const Shard = require('./Shard');
|
||||
const { Error, TypeError, RangeError, ErrorCodes } = require('../errors');
|
||||
const { mergeDefault, fetchRecommendedShards } = require('../util/Util');
|
||||
const { mergeDefault, fetchRecommendedShardCount } = require('../util/Util');
|
||||
|
||||
/**
|
||||
* This is a utility class that makes multi-process sharding of a bot an easy and painless experience.
|
||||
@@ -187,7 +187,7 @@ class ShardingManager extends EventEmitter {
|
||||
async spawn({ amount = this.totalShards, delay = 5500, timeout = 30_000 } = {}) {
|
||||
// Obtain/verify the number of shards to spawn
|
||||
if (amount === 'auto') {
|
||||
amount = await fetchRecommendedShards(this.token);
|
||||
amount = await fetchRecommendedShardCount(this.token);
|
||||
} else {
|
||||
if (typeof amount !== 'number' || isNaN(amount)) {
|
||||
throw new TypeError(ErrorCodes.ClientInvalidOption, 'Amount of shards', 'a number.');
|
||||
|
||||
@@ -365,9 +365,10 @@ class ApplicationCommand extends Base {
|
||||
}
|
||||
|
||||
if ('defaultMemberPermissions' in command) {
|
||||
defaultMemberPermissions = command.defaultMemberPermissions
|
||||
? new PermissionsBitField(command.defaultMemberPermissions).bitfield
|
||||
: null;
|
||||
defaultMemberPermissions =
|
||||
command.defaultMemberPermissions !== null
|
||||
? new PermissionsBitField(command.defaultMemberPermissions).bitfield
|
||||
: null;
|
||||
}
|
||||
|
||||
// Check top level parameters
|
||||
|
||||
@@ -193,6 +193,22 @@ class BaseInteraction extends Base {
|
||||
return Boolean(this.guildId && !this.guild && this.member);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this interaction is an {@link AutocompleteInteraction}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isAutocomplete() {
|
||||
return this.type === InteractionType.ApplicationCommandAutocomplete;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this interaction is a {@link CommandInteraction}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isCommand() {
|
||||
return this.type === InteractionType.ApplicationCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this interaction is a {@link ChatInputCommandInteraction}.
|
||||
* @returns {boolean}
|
||||
@@ -212,6 +228,22 @@ class BaseInteraction extends Base {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this interaction is a {@link MessageComponentInteraction}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isMessageComponent() {
|
||||
return this.type === InteractionType.MessageComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this interaction is a {@link ModalSubmitInteraction}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isModalSubmit() {
|
||||
return this.type === InteractionType.ModalSubmit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this interaction is a {@link UserContextMenuCommandInteraction}
|
||||
* @returns {boolean}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const { ButtonBuilder: BuildersButton, isJSONEncodable } = require('@discordjs/builders');
|
||||
const { toSnakeCase } = require('../util/Transformers');
|
||||
const { parseEmoji } = require('../util/Util');
|
||||
const { resolvePartialEmoji } = require('../util/Util');
|
||||
|
||||
/**
|
||||
* Represents a button builder.
|
||||
@@ -10,7 +10,7 @@ const { parseEmoji } = require('../util/Util');
|
||||
*/
|
||||
class ButtonBuilder extends BuildersButton {
|
||||
constructor({ emoji, ...data } = {}) {
|
||||
super(toSnakeCase({ ...data, emoji: emoji && typeof emoji === 'string' ? parseEmoji(emoji) : emoji }));
|
||||
super(toSnakeCase({ ...data, emoji: emoji && typeof emoji === 'string' ? resolvePartialEmoji(emoji) : emoji }));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -20,7 +20,7 @@ class ButtonBuilder extends BuildersButton {
|
||||
*/
|
||||
setEmoji(emoji) {
|
||||
if (typeof emoji === 'string') {
|
||||
return super.setEmoji(parseEmoji(emoji));
|
||||
return super.setEmoji(resolvePartialEmoji(emoji));
|
||||
}
|
||||
return super.setEmoji(emoji);
|
||||
}
|
||||
|
||||
@@ -6,11 +6,6 @@ const isEqual = require('fast-deep-equal');
|
||||
* Represents a component
|
||||
*/
|
||||
class Component {
|
||||
/**
|
||||
* Creates a new component from API data
|
||||
* @param {APIMessageComponent} data The API component data
|
||||
* @private
|
||||
*/
|
||||
constructor(data) {
|
||||
/**
|
||||
* The API data associated with this component
|
||||
|
||||
@@ -6,14 +6,9 @@ const isEqual = require('fast-deep-equal');
|
||||
* Represents an embed.
|
||||
*/
|
||||
class Embed {
|
||||
/**
|
||||
* Creates a new embed object
|
||||
* @param {APIEmbed} data API embed data
|
||||
* @private
|
||||
*/
|
||||
constructor(data) {
|
||||
/**
|
||||
* The API embed data
|
||||
* The API embed data.
|
||||
* @type {APIEmbed}
|
||||
* @readonly
|
||||
*/
|
||||
@@ -21,16 +16,16 @@ class Embed {
|
||||
}
|
||||
|
||||
/**
|
||||
* An array of fields of this embed
|
||||
* @type {?Array<APIEmbedField>}
|
||||
* An array of fields of this embed.
|
||||
* @type {Array<APIEmbedField>}
|
||||
* @readonly
|
||||
*/
|
||||
get fields() {
|
||||
return this.data.fields ?? null;
|
||||
return this.data.fields ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* The embed title
|
||||
* The title of this embed.
|
||||
* @type {?string}
|
||||
* @readonly
|
||||
*/
|
||||
@@ -39,7 +34,7 @@ class Embed {
|
||||
}
|
||||
|
||||
/**
|
||||
* The embed description
|
||||
* The description of this embed.
|
||||
* @type {?string}
|
||||
* @readonly
|
||||
*/
|
||||
@@ -48,7 +43,7 @@ class Embed {
|
||||
}
|
||||
|
||||
/**
|
||||
* The embed URL
|
||||
* The URL of this embed.
|
||||
* @type {?string}
|
||||
* @readonly
|
||||
*/
|
||||
@@ -57,7 +52,7 @@ class Embed {
|
||||
}
|
||||
|
||||
/**
|
||||
* The embed color
|
||||
* The color of this embed.
|
||||
* @type {?number}
|
||||
* @readonly
|
||||
*/
|
||||
@@ -66,7 +61,7 @@ class Embed {
|
||||
}
|
||||
|
||||
/**
|
||||
* The timestamp of the embed in an ISO 8601 format
|
||||
* The timestamp of this embed. This is in an ISO 8601 format.
|
||||
* @type {?string}
|
||||
* @readonly
|
||||
*/
|
||||
@@ -75,8 +70,16 @@ class Embed {
|
||||
}
|
||||
|
||||
/**
|
||||
* The embed thumbnail data
|
||||
* @type {?EmbedImageData}
|
||||
* @typedef {Object} EmbedAssetData
|
||||
* @property {?string} url The URL of the image
|
||||
* @property {?string} proxyURL The proxy URL of the image
|
||||
* @property {?string} height The height of the image
|
||||
* @property {?string} width The width of the image
|
||||
*/
|
||||
|
||||
/**
|
||||
* The thumbnail of this embed.
|
||||
* @type {?EmbedAssetData}
|
||||
* @readonly
|
||||
*/
|
||||
get thumbnail() {
|
||||
@@ -90,8 +93,8 @@ class Embed {
|
||||
}
|
||||
|
||||
/**
|
||||
* The embed image data
|
||||
* @type {?EmbedImageData}
|
||||
* The image of this embed.
|
||||
* @type {?EmbedAssetData}
|
||||
* @readonly
|
||||
*/
|
||||
get image() {
|
||||
@@ -105,16 +108,30 @@ class Embed {
|
||||
}
|
||||
|
||||
/**
|
||||
* Received video data
|
||||
* @type {?EmbedVideoData}
|
||||
* The video of this embed.
|
||||
* @type {?EmbedAssetData}
|
||||
* @readonly
|
||||
*/
|
||||
get video() {
|
||||
return this.data.video ?? null;
|
||||
if (!this.data.video) return null;
|
||||
return {
|
||||
url: this.data.image.url,
|
||||
proxyURL: this.data.image.proxy_url,
|
||||
height: this.data.image.height,
|
||||
width: this.data.image.width,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The embed author data
|
||||
* @typedef {Object} EmbedAuthorData
|
||||
* @property {string} name The name of the author
|
||||
* @property {?string} url The URL of the author
|
||||
* @property {?string} iconURL The icon URL of the author
|
||||
* @property {?string} proxyIconURL The proxy icon URL of the author
|
||||
*/
|
||||
|
||||
/**
|
||||
* The author of this embed.
|
||||
* @type {?EmbedAuthorData}
|
||||
* @readonly
|
||||
*/
|
||||
@@ -129,8 +146,8 @@ class Embed {
|
||||
}
|
||||
|
||||
/**
|
||||
* Received data about the embed provider
|
||||
* @type {?EmbedProvider}
|
||||
* The provider of this embed.
|
||||
* @type {?APIEmbedProvider}
|
||||
* @readonly
|
||||
*/
|
||||
get provider() {
|
||||
@@ -138,7 +155,14 @@ class Embed {
|
||||
}
|
||||
|
||||
/**
|
||||
* The embed footer data
|
||||
* @typedef {Object} EmbedFooterData
|
||||
* @property {string} text The text of the footer
|
||||
* @property {?string} iconURL The URL of the icon
|
||||
* @property {?string} proxyIconURL The proxy URL of the icon
|
||||
*/
|
||||
|
||||
/**
|
||||
* The footer of this embed.
|
||||
* @type {?EmbedFooterData}
|
||||
* @readonly
|
||||
*/
|
||||
@@ -152,7 +176,7 @@ class Embed {
|
||||
}
|
||||
|
||||
/**
|
||||
* The accumulated length for the embed title, description, fields, footer text, and author name
|
||||
* The accumulated length for the embed title, description, fields, footer text, and author name.
|
||||
* @type {number}
|
||||
* @readonly
|
||||
*/
|
||||
@@ -167,7 +191,7 @@ class Embed {
|
||||
}
|
||||
|
||||
/**
|
||||
* The hex color of the current color of the embed
|
||||
* The hex color of this embed.
|
||||
* @type {?string}
|
||||
* @readonly
|
||||
*/
|
||||
@@ -178,7 +202,7 @@ class Embed {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the API-compatible JSON for this embed
|
||||
* Returns the API-compatible JSON for this embed.
|
||||
* @returns {APIEmbed}
|
||||
*/
|
||||
toJSON() {
|
||||
@@ -186,7 +210,7 @@ class Embed {
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not the given embeds are equal
|
||||
* Whether the given embeds are equal.
|
||||
* @param {Embed|APIEmbed} other The embed to compare against
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const { DiscordSnowflake } = require('@sapphire/snowflake');
|
||||
const { OverwriteType, AuditLogEvent } = require('discord-api-types/v10');
|
||||
const { AuditLogOptionsType, AuditLogEvent } = require('discord-api-types/v10');
|
||||
const { GuildScheduledEvent } = require('./GuildScheduledEvent');
|
||||
const Integration = require('./Integration');
|
||||
const Invite = require('./Invite');
|
||||
@@ -189,18 +189,18 @@ class GuildAuditLogsEntry {
|
||||
case AuditLogEvent.ChannelOverwriteUpdate:
|
||||
case AuditLogEvent.ChannelOverwriteDelete:
|
||||
switch (data.options.type) {
|
||||
case OverwriteType.Role:
|
||||
case AuditLogOptionsType.Role:
|
||||
this.extra = guild.roles.cache.get(data.options.id) ?? {
|
||||
id: data.options.id,
|
||||
name: data.options.role_name,
|
||||
type: OverwriteType.Role,
|
||||
type: AuditLogOptionsType.Role,
|
||||
};
|
||||
break;
|
||||
|
||||
case OverwriteType.Member:
|
||||
case AuditLogOptionsType.Member:
|
||||
this.extra = guild.members.cache.get(data.options.id) ?? {
|
||||
id: data.options.id,
|
||||
type: OverwriteType.Member,
|
||||
type: AuditLogOptionsType.Member,
|
||||
};
|
||||
break;
|
||||
|
||||
|
||||
@@ -151,7 +151,8 @@ class GuildChannel extends BaseChannel {
|
||||
/**
|
||||
* Gets the overall set of permissions for a member or role in this channel, taking into account channel overwrites.
|
||||
* @param {GuildMemberResolvable|RoleResolvable} memberOrRole The member or role to obtain the overall permissions for
|
||||
* @param {boolean} [checkAdmin=true] Whether having `ADMINISTRATOR` will return all permissions
|
||||
* @param {boolean} [checkAdmin=true] Whether having the {@link PermissionFlagsBits.Administrator} permission
|
||||
* will return all permissions
|
||||
* @returns {?Readonly<PermissionsBitField>}
|
||||
*/
|
||||
permissionsFor(memberOrRole, checkAdmin = true) {
|
||||
@@ -190,7 +191,8 @@ class GuildChannel extends BaseChannel {
|
||||
/**
|
||||
* Gets the overall set of permissions for a member in this channel, taking into account channel overwrites.
|
||||
* @param {GuildMember} member The member to obtain the overall permissions for
|
||||
* @param {boolean} checkAdmin=true Whether having `ADMINISTRATOR` will return all permissions
|
||||
* @param {boolean} checkAdmin Whether having the {@link PermissionFlagsBits.Administrator} permission
|
||||
* will return all permissions
|
||||
* @returns {Readonly<PermissionsBitField>}
|
||||
* @private
|
||||
*/
|
||||
@@ -221,7 +223,8 @@ class GuildChannel extends BaseChannel {
|
||||
/**
|
||||
* Gets the overall set of permissions for a role in this channel, taking into account channel overwrites.
|
||||
* @param {Role} role The role to obtain the overall permissions for
|
||||
* @param {boolean} checkAdmin Whether having `ADMINISTRATOR` will return all permissions
|
||||
* @param {boolean} checkAdmin Whether having the {@link PermissionFlagsBits.Administrator} permission
|
||||
* will return all permissions
|
||||
* @returns {Readonly<PermissionsBitField>}
|
||||
* @private
|
||||
*/
|
||||
|
||||
@@ -210,6 +210,15 @@ class GuildMember extends Base {
|
||||
return this.user.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* The DM between the client's user and this member
|
||||
* @type {?DMChannel}
|
||||
* @readonly
|
||||
*/
|
||||
get dmChannel() {
|
||||
return this.client.users.dmChannel(this.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* The nickname of this member, or their username if they don't have one
|
||||
* @type {?string}
|
||||
|
||||
@@ -7,11 +7,6 @@ const { ErrorCodes } = require('../errors');
|
||||
* Represents an interaction's response
|
||||
*/
|
||||
class InteractionResponse {
|
||||
/**
|
||||
* @param {BaseInteraction} interaction The interaction associated with this response
|
||||
* @param {Snowflake?} id The interaction id associated with the original response
|
||||
* @private
|
||||
*/
|
||||
constructor(interaction, id) {
|
||||
/**
|
||||
* The interaction associated with the interaction response
|
||||
|
||||
@@ -81,7 +81,9 @@ class Message extends Base {
|
||||
|
||||
if ('content' in data) {
|
||||
/**
|
||||
* The content of the message
|
||||
* The content of the message.
|
||||
* <info>This property requires the {@link GatewayIntentBits.MessageContent} privileged intent
|
||||
* in a guild for messages that do not mention the client.</info>
|
||||
* @type {?string}
|
||||
*/
|
||||
this.content = data.content;
|
||||
@@ -133,7 +135,9 @@ class Message extends Base {
|
||||
|
||||
if ('embeds' in data) {
|
||||
/**
|
||||
* A list of embeds in the message - e.g. YouTube Player
|
||||
* An array of embeds in the message - e.g. YouTube Player.
|
||||
* <info>This property requires the {@link GatewayIntentBits.MessageContent} privileged intent
|
||||
* in a guild for messages that do not mention the client.</info>
|
||||
* @type {Embed[]}
|
||||
*/
|
||||
this.embeds = data.embeds.map(e => new Embed(e));
|
||||
@@ -143,7 +147,9 @@ class Message extends Base {
|
||||
|
||||
if ('components' in data) {
|
||||
/**
|
||||
* A list of MessageActionRows in the message
|
||||
* An array of of action rows in the message.
|
||||
* <info>This property requires the {@link GatewayIntentBits.MessageContent} privileged intent
|
||||
* in a guild for messages that do not mention the client.</info>
|
||||
* @type {ActionRow[]}
|
||||
*/
|
||||
this.components = data.components.map(c => createComponent(c));
|
||||
@@ -153,7 +159,9 @@ class Message extends Base {
|
||||
|
||||
if ('attachments' in data) {
|
||||
/**
|
||||
* A collection of attachments in the message - e.g. Pictures - mapped by their ids
|
||||
* A collection of attachments in the message - e.g. Pictures - mapped by their ids.
|
||||
* <info>This property requires the {@link GatewayIntentBits.MessageContent} privileged intent
|
||||
* in a guild for messages that do not mention the client.</info>
|
||||
* @type {Collection<Snowflake, Attachment>}
|
||||
*/
|
||||
this.attachments = new Collection();
|
||||
@@ -641,8 +649,8 @@ class Message extends Base {
|
||||
* @property {?string} [content] Content to be edited
|
||||
* @property {Embed[]|APIEmbed[]} [embeds] Embeds to be added/edited
|
||||
* @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content
|
||||
* @property {MessageFlags} [flags] Which flags to set for the message.
|
||||
* Only `MessageFlags.SuppressEmbeds` can be edited.
|
||||
* @property {MessageFlags} [flags] Which flags to set for the message
|
||||
* <info>Only the {@link MessageFlags.SuppressEmbeds} flag can be modified.</info>
|
||||
* @property {Attachment[]} [attachments] An array of attachments to keep,
|
||||
* all attachments will be kept if omitted
|
||||
* @property {Array<JSONEncodable<AttachmentPayload>>|BufferResolvable[]|Attachment[]|AttachmentBuilder[]} [files]
|
||||
|
||||
@@ -65,7 +65,7 @@ class PermissionOverwrites extends Base {
|
||||
* @example
|
||||
* // Update permission overwrites
|
||||
* permissionOverwrites.edit({
|
||||
* SEND_MESSAGES: false
|
||||
* SendMessages: false
|
||||
* })
|
||||
* .then(channel => console.log(channel.permissionOverwrites.get(message.author.id)))
|
||||
* .catch(console.error);
|
||||
|
||||
@@ -238,7 +238,7 @@ class Activity {
|
||||
* Creation date of the activity
|
||||
* @type {number}
|
||||
*/
|
||||
this.createdTimestamp = Date.parse(data.created_at);
|
||||
this.createdTimestamp = data.created_at;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,7 +268,7 @@ class Activity {
|
||||
}
|
||||
|
||||
/**
|
||||
* When concatenated with a string, this automatically returns the activities' name instead of the Activity object.
|
||||
* When concatenated with a string, this automatically returns the activity's name instead of the Activity object.
|
||||
* @returns {string}
|
||||
*/
|
||||
toString() {
|
||||
|
||||
@@ -223,7 +223,8 @@ class Role extends Base {
|
||||
* Returns `channel.permissionsFor(role)`. Returns permissions for a role in a guild channel,
|
||||
* taking into account permission overwrites.
|
||||
* @param {GuildChannel|Snowflake} channel The guild channel to use as context
|
||||
* @param {boolean} [checkAdmin=true] Whether having `ADMINISTRATOR` will return all permissions
|
||||
* @param {boolean} [checkAdmin=true] Whether having the {@link PermissionFlagsBits.Administrator} permission
|
||||
* will return all permissions
|
||||
* @returns {Readonly<PermissionsBitField>}
|
||||
*/
|
||||
permissionsIn(channel, checkAdmin = true) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const { SelectMenuBuilder: BuildersSelectMenu, isJSONEncodable, normalizeArray } = require('@discordjs/builders');
|
||||
const { toSnakeCase } = require('../util/Transformers');
|
||||
const { parseEmoji } = require('../util/Util');
|
||||
const { resolvePartialEmoji } = require('../util/Util');
|
||||
|
||||
/**
|
||||
* Class used to build select menu components to be sent through the API
|
||||
@@ -15,7 +15,7 @@ class SelectMenuBuilder extends BuildersSelectMenu {
|
||||
...data,
|
||||
options: options?.map(({ emoji, ...option }) => ({
|
||||
...option,
|
||||
emoji: emoji && typeof emoji === 'string' ? parseEmoji(emoji) : emoji,
|
||||
emoji: emoji && typeof emoji === 'string' ? resolvePartialEmoji(emoji) : emoji,
|
||||
})),
|
||||
}),
|
||||
);
|
||||
@@ -35,7 +35,7 @@ class SelectMenuBuilder extends BuildersSelectMenu {
|
||||
const { emoji, ...option } = selectMenuOption;
|
||||
return {
|
||||
...option,
|
||||
emoji: typeof emoji === 'string' ? parseEmoji(emoji) : emoji,
|
||||
emoji: typeof emoji === 'string' ? resolvePartialEmoji(emoji) : emoji,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const { SelectMenuOptionBuilder: BuildersSelectMenuOption, isJSONEncodable } = require('@discordjs/builders');
|
||||
const { toSnakeCase } = require('../util/Transformers');
|
||||
const { parseEmoji } = require('../util/Util');
|
||||
const { resolvePartialEmoji } = require('../util/Util');
|
||||
|
||||
/**
|
||||
* Represents a select menu option builder.
|
||||
@@ -13,7 +13,7 @@ class SelectMenuOptionBuilder extends BuildersSelectMenuOption {
|
||||
super(
|
||||
toSnakeCase({
|
||||
...data,
|
||||
emoji: emoji && typeof emoji === 'string' ? parseEmoji(emoji) : emoji,
|
||||
emoji: emoji && typeof emoji === 'string' ? resolvePartialEmoji(emoji) : emoji,
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -24,7 +24,7 @@ class SelectMenuOptionBuilder extends BuildersSelectMenuOption {
|
||||
*/
|
||||
setEmoji(emoji) {
|
||||
if (typeof emoji === 'string') {
|
||||
return super.setEmoji(parseEmoji(emoji));
|
||||
return super.setEmoji(resolvePartialEmoji(emoji));
|
||||
}
|
||||
return super.setEmoji(emoji);
|
||||
}
|
||||
|
||||
@@ -75,8 +75,9 @@ class ThreadChannel extends BaseChannel {
|
||||
this.locked = data.thread_metadata.locked ?? false;
|
||||
|
||||
/**
|
||||
* Whether members without `MANAGE_THREADS` can invite other members without `MANAGE_THREADS`
|
||||
* <info>Always `null` in public threads</info>
|
||||
* Whether members without the {@link PermissionFlagsBits.ManageThreads} permission
|
||||
* can invite other members to this thread.
|
||||
* <info>This property is always `null` in public threads.</info>
|
||||
* @type {?boolean}
|
||||
*/
|
||||
this.invitable = this.type === ChannelType.GuildPrivateThread ? data.thread_metadata.invitable ?? false : null;
|
||||
@@ -252,7 +253,8 @@ class ThreadChannel extends BaseChannel {
|
||||
* Gets the overall set of permissions for a member or role in this thread's parent channel, taking overwrites into
|
||||
* account.
|
||||
* @param {GuildMemberResolvable|RoleResolvable} memberOrRole The member or role to obtain the overall permissions for
|
||||
* @param {boolean} [checkAdmin=true] Whether having `ADMINISTRATOR` will return all permissions
|
||||
* @param {boolean} [checkAdmin=true] Whether having the {@link PermissionFlagsBits.Administrator} permission
|
||||
* will return all permissions
|
||||
* @returns {?Readonly<PermissionsBitField>}
|
||||
*/
|
||||
permissionsFor(memberOrRole, checkAdmin) {
|
||||
@@ -361,8 +363,8 @@ class ThreadChannel extends BaseChannel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether members without the `MANAGE_THREADS` permission can invite other members without the
|
||||
* `MANAGE_THREADS` permission to this thread.
|
||||
* Sets whether members without the {@link PermissionFlagsBits.ManageThreads} permission
|
||||
* can invite other members to this thread.
|
||||
* @param {boolean} [invitable=true] Whether non-moderators can invite non-moderators to this thread
|
||||
* @param {string} [reason] Reason for changing invite
|
||||
* @returns {Promise<ThreadChannel>}
|
||||
@@ -375,8 +377,9 @@ class ThreadChannel extends BaseChannel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the thread can be **unarchived** by anyone with `SEND_MESSAGES` permission.
|
||||
* When a thread is locked only members with `MANAGE_THREADS` can unarchive it.
|
||||
* Sets whether the thread can be **unarchived** by anyone with the
|
||||
* {@link PermissionFlagsBits.SendMessages} permission. When a thread is locked, only members with the
|
||||
* {@link PermissionFlagsBits.ManageThreads} permission can unarchive it.
|
||||
* @param {boolean} [locked=true] Whether the thread is locked
|
||||
* @param {string} [reason] Reason for locking or unlocking the thread
|
||||
* @returns {Promise<ThreadChannel>}
|
||||
@@ -541,6 +544,6 @@ class ThreadChannel extends BaseChannel {
|
||||
// Doesn't work on Thread channels; setNSFW() {}
|
||||
}
|
||||
|
||||
TextBasedChannel.applyToClass(ThreadChannel, true, ['setRateLimitPerUser', 'setNSFW']);
|
||||
TextBasedChannel.applyToClass(ThreadChannel, true, ['fetchWebhooks', 'setRateLimitPerUser', 'setNSFW']);
|
||||
|
||||
module.exports = ThreadChannel;
|
||||
|
||||
@@ -127,7 +127,8 @@ class Webhook {
|
||||
* @property {string} [avatarURL] Avatar URL override for the message
|
||||
* @property {Snowflake} [threadId] The id of the thread in the channel to send to.
|
||||
* <info>For interaction webhooks, this property is ignored</info>
|
||||
* @property {MessageFlags} [flags] Which flags to set for the message. Only `SUPPRESS_EMBEDS` can be set.
|
||||
* @property {MessageFlags} [flags] Which flags to set for the message.
|
||||
* <info>Only the {@link MessageFlags.SuppressEmbeds} flag can be set.</info>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -148,7 +149,7 @@ class Webhook {
|
||||
/**
|
||||
* Sends a message with this webhook.
|
||||
* @param {string|MessagePayload|WebhookMessageOptions} options The options to provide
|
||||
* @returns {Promise<APIMessage>}
|
||||
* @returns {Promise<Message>}
|
||||
* @example
|
||||
* // Send a basic message
|
||||
* webhook.send('hello!')
|
||||
@@ -288,7 +289,7 @@ class Webhook {
|
||||
* Gets a message that was sent by this webhook.
|
||||
* @param {Snowflake|'@original'} message The id of the message to fetch
|
||||
* @param {WebhookFetchMessageOptions} [options={}] The options to provide to fetch the message.
|
||||
* @returns {Promise<APIMessage>} Returns the message sent by this webhook
|
||||
* @returns {Promise<Message>} Returns the message sent by this webhook
|
||||
*/
|
||||
async fetchMessage(message, { threadId } = {}) {
|
||||
if (!this.token) throw new Error(ErrorCodes.WebhookTokenUnavailable);
|
||||
@@ -309,7 +310,7 @@ class Webhook {
|
||||
* Edits a message that was sent by this webhook.
|
||||
* @param {MessageResolvable|'@original'} message The message to edit
|
||||
* @param {string|MessagePayload|WebhookEditMessageOptions} options The options to provide
|
||||
* @returns {Promise<APIMessage>} Returns the message edited by this webhook
|
||||
* @returns {Promise<Message>} Returns the message edited by this webhook
|
||||
*/
|
||||
async editMessage(message, options) {
|
||||
if (!this.token) throw new Error(ErrorCodes.WebhookTokenUnavailable);
|
||||
|
||||
@@ -238,6 +238,7 @@ class InteractionResponses {
|
||||
/**
|
||||
* Shows a modal component
|
||||
* @param {APIModal|ModalData|Modal} modal The modal to show
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async showModal(modal) {
|
||||
if (this.deferred || this.replied) throw new Error(ErrorCodes.InteractionAlreadyReplied);
|
||||
|
||||
@@ -48,6 +48,11 @@
|
||||
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIEmbedField}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @external APIEmbedProvider
|
||||
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIEmbedProvider}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @external APIEmoji
|
||||
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIEmoji}
|
||||
|
||||
@@ -66,7 +66,7 @@ class DataResolver extends null {
|
||||
return image;
|
||||
}
|
||||
const file = await this.resolveFile(image);
|
||||
return this.resolveBase64(file);
|
||||
return this.resolveBase64(file.data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @typedef {Object} EmbedData
|
||||
* @property {?string} title The title of the embed
|
||||
* @property {?EmbedType} type The type of the embed
|
||||
* @property {?string} description The description of the embed
|
||||
* @property {?string} url The URL of the embed
|
||||
* @property {?string} timestamp The timestamp on the embed
|
||||
* @property {?number} color The color of the embed
|
||||
* @property {?EmbedFooterData} footer The footer of the embed
|
||||
* @property {?EmbedImageData} image The image of the embed
|
||||
* @property {?EmbedImageData} thumbnail The thumbnail of the embed
|
||||
* @property {?EmbedProviderData} provider The provider of the embed
|
||||
* @property {?EmbedAuthorData} author The author in the embed
|
||||
* @property {?EmbedFieldData[]} fields The fields in this embed
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} EmbedFooterData
|
||||
* @property {string} text The text of the footer
|
||||
* @property {?string} iconURL The URL of the icon
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} EmbedImageData
|
||||
* @property {?string} url The URL of the image
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} EmbedProviderData
|
||||
* @property {?string} name The name of the provider
|
||||
* @property {?string} url The URL of the provider
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} EmbedAuthorData
|
||||
* @property {string} name The name of the author
|
||||
* @property {?string} url The URL of the author
|
||||
* @property {?string} iconURL The icon URL of the author
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} EmbedFieldData
|
||||
* @property {string} name The name of the field
|
||||
* @property {string} value The value of the field
|
||||
* @property {?boolean} inline Whether to inline this field
|
||||
*/
|
||||
@@ -1,5 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { deprecate } = require('node:util');
|
||||
const {
|
||||
blockQuote,
|
||||
bold,
|
||||
@@ -20,160 +21,337 @@ const {
|
||||
userMention,
|
||||
} = require('@discordjs/builders');
|
||||
|
||||
/**
|
||||
* Wraps the content inside a code block with an optional language.
|
||||
* @method codeBlock
|
||||
* @param {string} contentOrLanguage The language to use or content if a second parameter isn't provided
|
||||
* @param {string} [content] The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wraps the content inside \`backticks\`, which formats it as inline code.
|
||||
* @method inlineCode
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content into italic text.
|
||||
* @method italic
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content into bold text.
|
||||
* @method bold
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content into underscored text.
|
||||
* @method underscore
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content into strike-through text.
|
||||
* @method strikethrough
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content into a quote.
|
||||
* <info>This needs to be at the start of the line for Discord to format it.</info>
|
||||
* @method quote
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content into a block quote.
|
||||
* <info>This needs to be at the start of the line for Discord to format it.</info>
|
||||
* @method blockQuote
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wraps the URL into `<>`, which stops it from embedding.
|
||||
* @method hideLinkEmbed
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content and the URL into a masked URL with an optional title.
|
||||
* @method hyperlink
|
||||
* @param {string} content The content to display
|
||||
* @param {string} url The URL the content links to
|
||||
* @param {string} [title] The title shown when hovering on the masked link
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats the content into spoiler text.
|
||||
* @method spoiler
|
||||
* @param {string} content The content to spoiler
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats a user id into a user mention.
|
||||
* @method userMention
|
||||
* @param {Snowflake} userId The user id to format
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats a channel id into a channel mention.
|
||||
* @method channelMention
|
||||
* @param {Snowflake} channelId The channel id to format
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats a role id into a role mention.
|
||||
* @method roleMention
|
||||
* @param {Snowflake} roleId The role id to format
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats an emoji id into a fully qualified emoji identifier.
|
||||
* @method formatEmoji
|
||||
* @param {Snowflake} emojiId The emoji id to format
|
||||
* @param {boolean} [animated=false] Whether the emoji is animated
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* A message formatting timestamp style, as defined in
|
||||
* [here](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles).
|
||||
* * `t` Short time format, consisting of hours and minutes, e.g. 16:20.
|
||||
* * `T` Long time format, consisting of hours, minutes, and seconds, e.g. 16:20:30.
|
||||
* * `d` Short date format, consisting of day, month, and year, e.g. 20/04/2021.
|
||||
* * `D` Long date format, consisting of day, month, and year, e.g. 20 April 2021.
|
||||
* * `f` Short date-time format, consisting of short date and short time formats, e.g. 20 April 2021 16:20.
|
||||
* * `F` Long date-time format, consisting of long date and short time formats, e.g. Tuesday, 20 April 2021 16:20.
|
||||
* * `R` Relative time format, consisting of a relative duration format, e.g. 2 months ago.
|
||||
* @typedef {string} TimestampStylesString
|
||||
*/
|
||||
|
||||
/**
|
||||
* Formats a date into a short date-time string.
|
||||
* @method time
|
||||
* @param {number|Date} [date] The date to format
|
||||
* @param {TimestampStylesString} [style] The style to use
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains various Discord-specific functions for formatting messages.
|
||||
* @deprecated This class is redundant as all methods of the class can be imported from discord.js directly.
|
||||
*/
|
||||
class Formatters extends null {
|
||||
/**
|
||||
* Formats the content into a block quote. This needs to be at the start of the line for Discord to format it.
|
||||
* Formats the content into a block quote.
|
||||
* <info>This needs to be at the start of the line for Discord to format it.</info>
|
||||
* @method blockQuote
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap.
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static blockQuote = blockQuote;
|
||||
static blockQuote = deprecate(
|
||||
blockQuote,
|
||||
'Formatters.blockQuote() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats the content into bold text.
|
||||
* @method bold
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap.
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static bold = bold;
|
||||
static bold = deprecate(
|
||||
bold,
|
||||
'Formatters.bold() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats a channel id into a channel mention.
|
||||
* @method channelMention
|
||||
* @memberof Formatters
|
||||
* @param {string} channelId The channel id to format.
|
||||
* @param {Snowflake} channelId The channel id to format
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static channelMention = channelMention;
|
||||
static channelMention = deprecate(
|
||||
channelMention,
|
||||
'Formatters.channelMention() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Wraps the content inside a code block with an optional language.
|
||||
* @method codeBlock
|
||||
* @memberof Formatters
|
||||
* @param {string} contentOrLanguage The language to use, content if a second parameter isn't provided.
|
||||
* @param {string} [content] The content to wrap.
|
||||
* @param {string} contentOrLanguage The language to use or content if a second parameter isn't provided
|
||||
* @param {string} [content] The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static codeBlock = codeBlock;
|
||||
static codeBlock = deprecate(
|
||||
codeBlock,
|
||||
'Formatters.codeBlock() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats an emoji id into a fully qualified emoji identifier
|
||||
* Formats an emoji id into a fully qualified emoji identifier.
|
||||
* @method formatEmoji
|
||||
* @memberof Formatters
|
||||
* @memberof Formatters
|
||||
* @param {string} emojiId The emoji id to format.
|
||||
* @param {boolean} [animated] Whether the emoji is animated or not. Defaults to `false`
|
||||
* @param {string} emojiId The emoji id to format
|
||||
* @param {boolean} [animated=false] Whether the emoji is animated
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static formatEmoji = formatEmoji;
|
||||
static formatEmoji = deprecate(
|
||||
formatEmoji,
|
||||
'Formatters.formatEmoji() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Wraps the URL into `<>`, which stops it from embedding.
|
||||
* @method hideLinkEmbed
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap.
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static hideLinkEmbed = hideLinkEmbed;
|
||||
static hideLinkEmbed = deprecate(
|
||||
hideLinkEmbed,
|
||||
'Formatters.hideLinkEmbed() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats the content and the URL into a masked URL with an optional title.
|
||||
* @method hyperlink
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to display.
|
||||
* @param {string} url The URL the content links to.
|
||||
* @param {string} [title] The title shown when hovering on the masked link.
|
||||
* @param {string} content The content to display
|
||||
* @param {string} url The URL the content links to
|
||||
* @param {string} [title] The title shown when hovering on the masked link
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static hyperlink = hyperlink;
|
||||
static hyperlink = deprecate(
|
||||
hyperlink,
|
||||
'Formatters.hyperlink() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Wraps the content inside \`backticks\`, which formats it as inline code.
|
||||
* @method inlineCode
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap.
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static inlineCode = inlineCode;
|
||||
static inlineCode = deprecate(
|
||||
inlineCode,
|
||||
'Formatters.inlineCode() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats the content into italic text.
|
||||
* @method italic
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap.
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static italic = italic;
|
||||
static italic = deprecate(
|
||||
italic,
|
||||
'Formatters.italic() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats the content into a quote. This needs to be at the start of the line for Discord to format it.
|
||||
* @method quote
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap.
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static quote = quote;
|
||||
static quote = deprecate(
|
||||
quote,
|
||||
'Formatters.quote() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats a role id into a role mention.
|
||||
* @method roleMention
|
||||
* @memberof Formatters
|
||||
* @param {string} roleId The role id to format.
|
||||
* @param {Snowflake} roleId The role id to format
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static roleMention = roleMention;
|
||||
static roleMention = deprecate(
|
||||
roleMention,
|
||||
'Formatters.roleMention() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats the content into spoiler text.
|
||||
* @method spoiler
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to spoiler.
|
||||
* @param {string} content The content to spoiler
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static spoiler = spoiler;
|
||||
static spoiler = deprecate(
|
||||
spoiler,
|
||||
'Formatters.spoiler() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats the content into strike-through text.
|
||||
* @method strikethrough
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap.
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static strikethrough = strikethrough;
|
||||
static strikethrough = deprecate(
|
||||
strikethrough,
|
||||
'Formatters.strikethrough() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats a date into a short date-time string.
|
||||
* @method time
|
||||
* @memberof Formatters
|
||||
* @param {number|Date} [date] The date to format.
|
||||
* @param {TimestampStylesString} [style] The style to use.
|
||||
* @param {number|Date} [date] The date to format
|
||||
* @param {TimestampStylesString} [style] The style to use
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static time = time;
|
||||
|
||||
/**
|
||||
* A message formatting timestamp style, as defined in
|
||||
* [here](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles).
|
||||
* * `t` Short time format, consisting of hours and minutes, e.g. 16:20.
|
||||
* * `T` Long time format, consisting of hours, minutes, and seconds, e.g. 16:20:30.
|
||||
* * `d` Short date format, consisting of day, month, and year, e.g. 20/04/2021.
|
||||
* * `D` Long date format, consisting of day, month, and year, e.g. 20 April 2021.
|
||||
* * `f` Short date-time format, consisting of short date and short time formats, e.g. 20 April 2021 16:20.
|
||||
* * `F` Long date-time format, consisting of long date and short time formats, e.g. Tuesday, 20 April 2021 16:20.
|
||||
* * `R` Relative time format, consisting of a relative duration format, e.g. 2 months ago.
|
||||
* @typedef {string} TimestampStylesString
|
||||
*/
|
||||
static time = deprecate(
|
||||
time,
|
||||
'Formatters.time() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* The message formatting timestamp
|
||||
* [styles](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles) supported by Discord.
|
||||
* @type {Object<string, TimestampStylesString>}
|
||||
* @memberof Formatters
|
||||
* @deprecated Import this property directly from discord.js instead.
|
||||
*/
|
||||
static TimestampStyles = TimestampStyles;
|
||||
|
||||
@@ -181,19 +359,27 @@ class Formatters extends null {
|
||||
* Formats the content into underscored text.
|
||||
* @method underscore
|
||||
* @memberof Formatters
|
||||
* @param {string} content The content to wrap.
|
||||
* @param {string} content The content to wrap
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static underscore = underscore;
|
||||
static underscore = deprecate(
|
||||
underscore,
|
||||
'Formatters.underscore() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* Formats a user id into a user mention.
|
||||
* @method userMention
|
||||
* @memberof Formatters
|
||||
* @param {string} userId The user id to format.
|
||||
* @param {Snowflake} userId The user id to format
|
||||
* @returns {string}
|
||||
* @deprecated Import this method directly from discord.js instead.
|
||||
*/
|
||||
static userMention = userMention;
|
||||
static userMention = deprecate(
|
||||
userMention,
|
||||
'Formatters.userMention() is deprecated. Import this method directly from discord.js instead.',
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = Formatters;
|
||||
|
||||
@@ -33,8 +33,8 @@ const { toSnakeCase } = require('./Transformers');
|
||||
* @property {boolean} [failIfNotExists=true] Default value for {@link ReplyMessageOptions#failIfNotExists}
|
||||
* @property {PresenceData} [presence={}] Presence data to use upon login
|
||||
* @property {IntentsResolvable} intents Intents to enable for this connection
|
||||
* @property {number} [waitGuildTimeout=15_000] Time in milliseconds that Clients with the GUILDS intent should wait for
|
||||
* missing guilds to be received before starting the bot. If not specified, the default is 15 seconds.
|
||||
* @property {number} [waitGuildTimeout=15_000] Time in milliseconds that clients with the
|
||||
* {@link GatewayIntentBits.Guilds} gateway intent should wait for missing guilds to be received before being ready.
|
||||
* @property {SweeperOptions} [sweepers={}] Options for cache sweeping
|
||||
* @property {WebsocketOptions} [ws] Options for the WebSocket
|
||||
* @property {RESTOptions} [rest] Options for the REST manager
|
||||
|
||||
@@ -211,7 +211,7 @@ function escapeSpoiler(text) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} FetchRecommendedShardsOptions
|
||||
* @typedef {Object} FetchRecommendedShardCountOptions
|
||||
* @property {number} [guildsPerShard=1000] Number of guilds assigned per shard
|
||||
* @property {number} [multipleOf=1] The multiple the shard count should round up to. (16 for large bot sharding)
|
||||
*/
|
||||
@@ -219,10 +219,10 @@ function escapeSpoiler(text) {
|
||||
/**
|
||||
* Gets the recommended shard count from Discord.
|
||||
* @param {string} token Discord auth token
|
||||
* @param {FetchRecommendedShardsOptions} [options] Options for fetching the recommended shard count
|
||||
* @param {FetchRecommendedShardCountOptions} [options] Options for fetching the recommended shard count
|
||||
* @returns {Promise<number>} The recommended number of shards
|
||||
*/
|
||||
async function fetchRecommendedShards(token, { guildsPerShard = 1_000, multipleOf = 1 } = {}) {
|
||||
async function fetchRecommendedShardCount(token, { guildsPerShard = 1_000, multipleOf = 1 } = {}) {
|
||||
if (!token) throw new DiscordError(ErrorCodes.TokenMissing);
|
||||
const response = await fetch(RouteBases.api + Routes.gatewayBot(), {
|
||||
method: 'GET',
|
||||
@@ -520,16 +520,9 @@ function lazy(cb) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the credentials used for a given webhook
|
||||
* @typedef {Object} WebhookCredentials
|
||||
* @property {string} id The webhook's id
|
||||
* @property {string} token The webhook's token
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parses a webhook URL for the id and token
|
||||
* Parses a webhook URL for the id and token.
|
||||
* @param {string} url The URL to parse
|
||||
* @returns {?WebhookCredentials} Null if the URL is invalid, otherwise the id and the token
|
||||
* @returns {?WebhookClientDataIdWithToken} `null` if the URL is invalid, otherwise the id and the token
|
||||
*/
|
||||
function parseWebhookURL(url) {
|
||||
const matches = url.match(
|
||||
@@ -555,7 +548,7 @@ module.exports = {
|
||||
escapeUnderline,
|
||||
escapeStrikethrough,
|
||||
escapeSpoiler,
|
||||
fetchRecommendedShards,
|
||||
fetchRecommendedShardCount,
|
||||
parseEmoji,
|
||||
resolvePartialEmoji,
|
||||
mergeDefault,
|
||||
|
||||
107
packages/discord.js/typings/index.d.ts
vendored
107
packages/discord.js/typings/index.d.ts
vendored
@@ -113,7 +113,6 @@ import {
|
||||
APIEmbedAuthor,
|
||||
APIEmbedFooter,
|
||||
APIEmbedImage,
|
||||
APIEmbedVideo,
|
||||
VideoQualityMode,
|
||||
LocalizationMap,
|
||||
LocaleString,
|
||||
@@ -122,6 +121,8 @@ import {
|
||||
APIChannel,
|
||||
ThreadAutoArchiveDuration,
|
||||
FormattingPatterns,
|
||||
APIEmbedProvider,
|
||||
AuditLogOptionsType,
|
||||
} from 'discord-api-types/v10';
|
||||
import { ChildProcess } from 'node:child_process';
|
||||
import { EventEmitter } from 'node:events';
|
||||
@@ -494,7 +495,7 @@ export abstract class BaseGuild extends Base {
|
||||
protected constructor(client: Client, data: RawBaseGuildData);
|
||||
public get createdAt(): Date;
|
||||
public get createdTimestamp(): number;
|
||||
public features: GuildFeature[];
|
||||
public features: `${GuildFeature}`[];
|
||||
public icon: string | null;
|
||||
public id: Snowflake;
|
||||
public name: string;
|
||||
@@ -667,12 +668,12 @@ export interface EmbedData {
|
||||
timestamp?: string | number | Date;
|
||||
color?: number;
|
||||
footer?: EmbedFooterData;
|
||||
image?: EmbedImageData;
|
||||
thumbnail?: EmbedImageData;
|
||||
provider?: EmbedProviderData;
|
||||
image?: EmbedAssetData;
|
||||
thumbnail?: EmbedAssetData;
|
||||
provider?: APIEmbedProvider;
|
||||
author?: EmbedAuthorData;
|
||||
fields?: EmbedFieldData[];
|
||||
video?: EmbedVideoData;
|
||||
fields?: APIEmbedField[];
|
||||
video?: EmbedAssetData;
|
||||
}
|
||||
|
||||
export interface IconData {
|
||||
@@ -684,16 +685,7 @@ export type EmbedAuthorData = Omit<APIEmbedAuthor, 'icon_url' | 'proxy_icon_url'
|
||||
|
||||
export type EmbedFooterData = Omit<APIEmbedFooter, 'icon_url' | 'proxy_icon_url'> & IconData;
|
||||
|
||||
export interface EmbedProviderData {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface EmbedImageData extends Omit<APIEmbedImage, 'proxy_url'> {
|
||||
proxyURL?: string;
|
||||
}
|
||||
|
||||
export interface EmbedVideoData extends Omit<APIEmbedVideo, 'proxy_url'> {
|
||||
export interface EmbedAssetData extends Omit<APIEmbedImage, 'proxy_url'> {
|
||||
proxyURL?: string;
|
||||
}
|
||||
|
||||
@@ -706,7 +698,7 @@ export class EmbedBuilder extends BuildersEmbed {
|
||||
export class Embed {
|
||||
private constructor(data: APIEmbed);
|
||||
public readonly data: Readonly<APIEmbed>;
|
||||
public get fields(): APIEmbedField[] | null;
|
||||
public get fields(): APIEmbedField[];
|
||||
public get footer(): EmbedFooterData | null;
|
||||
public get title(): string | null;
|
||||
public get description(): string | null;
|
||||
@@ -714,11 +706,11 @@ export class Embed {
|
||||
public get color(): number | null;
|
||||
public get hexColor(): string | null;
|
||||
public get timestamp(): string | null;
|
||||
public get thumbnail(): EmbedImageData | null;
|
||||
public get image(): EmbedImageData | null;
|
||||
public get thumbnail(): EmbedAssetData | null;
|
||||
public get image(): EmbedAssetData | null;
|
||||
public get author(): EmbedAuthorData | null;
|
||||
public get provider(): EmbedProviderData | null;
|
||||
public get video(): EmbedVideoData | null;
|
||||
public get provider(): APIEmbedProvider | null;
|
||||
public get video(): EmbedAssetData | null;
|
||||
public get length(): number;
|
||||
public equals(other: Embed | APIEmbed): boolean;
|
||||
public toJSON(): APIEmbed;
|
||||
@@ -1291,6 +1283,7 @@ export class GuildMember extends PartialTextBasedChannel(Base) {
|
||||
private constructor(client: Client, data: RawGuildMemberData, guild: Guild);
|
||||
public avatar: string | null;
|
||||
public get bannable(): boolean;
|
||||
public get dmChannel(): DMChannel | null;
|
||||
public get displayColor(): number;
|
||||
public get displayHexColor(): HexColorString;
|
||||
public get displayName(): string;
|
||||
@@ -1344,7 +1337,7 @@ export class GuildPreview extends Base {
|
||||
public discoverySplash: string | null;
|
||||
public emojis: Collection<Snowflake, GuildPreviewEmoji>;
|
||||
public stickers: Collection<Snowflake, Sticker>;
|
||||
public features: GuildFeature[];
|
||||
public features: `${GuildFeature}`[];
|
||||
public icon: string | null;
|
||||
public id: Snowflake;
|
||||
public name: string;
|
||||
@@ -1534,9 +1527,13 @@ export class BaseInteraction<Cached extends CacheType = CacheType> extends Base
|
||||
public inCachedGuild(): this is BaseInteraction<'cached'>;
|
||||
public inRawGuild(): this is BaseInteraction<'raw'>;
|
||||
public isButton(): this is ButtonInteraction<Cached>;
|
||||
public isAutocomplete(): this is AutocompleteInteraction<Cached>;
|
||||
public isChatInputCommand(): this is ChatInputCommandInteraction<Cached>;
|
||||
public isCommand(): this is CommandInteraction<Cached>;
|
||||
public isContextMenuCommand(): this is ContextMenuCommandInteraction<Cached>;
|
||||
public isMessageComponent(): this is MessageComponentInteraction<Cached>;
|
||||
public isMessageContextMenuCommand(): this is MessageContextMenuCommandInteraction<Cached>;
|
||||
public isModalSubmit(): this is ModalSubmitInteraction<Cached>;
|
||||
public isUserContextMenuCommand(): this is UserContextMenuCommandInteraction<Cached>;
|
||||
public isSelectMenu(): this is SelectMenuInteraction<Cached>;
|
||||
public isRepliable(): this is this & InteractionResponseFields<Cached>;
|
||||
@@ -1579,10 +1576,10 @@ export class InteractionWebhook extends PartialWebhookMixin() {
|
||||
public token: string;
|
||||
public send(options: string | MessagePayload | InteractionReplyOptions): Promise<Message>;
|
||||
public editMessage(
|
||||
message: MessageResolvable,
|
||||
message: MessageResolvable | '@original',
|
||||
options: string | MessagePayload | WebhookEditMessageOptions,
|
||||
): Promise<Message>;
|
||||
public fetchMessage(message: string): Promise<Message>;
|
||||
public fetchMessage(message: Snowflake | '@original'): Promise<Message>;
|
||||
}
|
||||
|
||||
export class Invite extends Base {
|
||||
@@ -2299,7 +2296,7 @@ export class ShardingManager extends EventEmitter {
|
||||
public once(event: 'shardCreate', listener: (shard: Shard) => Awaitable<void>): this;
|
||||
}
|
||||
|
||||
export interface FetchRecommendedShardsOptions {
|
||||
export interface FetchRecommendedShardCountOptions {
|
||||
guildsPerShard?: number;
|
||||
multipleOf?: number;
|
||||
}
|
||||
@@ -2649,7 +2646,7 @@ export function escapeUnderline(text: string): string;
|
||||
export function escapeStrikethrough(text: string): string;
|
||||
export function escapeSpoiler(text: string): string;
|
||||
export function cleanCodeBlockContent(text: string): string;
|
||||
export function fetchRecommendedShards(token: string, options?: FetchRecommendedShardsOptions): Promise<number>;
|
||||
export function fetchRecommendedShardCount(token: string, options?: FetchRecommendedShardCountOptions): Promise<number>;
|
||||
export function flatten(obj: unknown, ...props: Record<string, boolean | string>[]): unknown;
|
||||
export function makeError(obj: MakeErrorOptions): Error;
|
||||
export function makePlainError(err: Error): MakeErrorOptions;
|
||||
@@ -2702,24 +2699,41 @@ export function createComponentBuilder<T extends keyof MappedComponentBuilderTyp
|
||||
export function createComponentBuilder<C extends ComponentBuilder>(data: C): C;
|
||||
export function createComponentBuilder(data: APIMessageComponent | ComponentBuilder): ComponentBuilder;
|
||||
|
||||
/** @deprecated This class is redundant as all methods of the class can be imported from discord.js directly. */
|
||||
export class Formatters extends null {
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static blockQuote: typeof blockQuote;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static bold: typeof bold;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static channelMention: typeof channelMention;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static codeBlock: typeof codeBlock;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static formatEmoji: typeof formatEmoji;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static hideLinkEmbed: typeof hideLinkEmbed;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static hyperlink: typeof hyperlink;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static inlineCode: typeof inlineCode;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static italic: typeof italic;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static quote: typeof quote;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static roleMention: typeof roleMention;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static spoiler: typeof spoiler;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static strikethrough: typeof strikethrough;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static time: typeof time;
|
||||
/** @deprecated Import this property directly from discord.js instead. */
|
||||
public static TimestampStyles: typeof TimestampStyles;
|
||||
public static TimestampStylesString: TimestampStylesString;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static underscore: typeof underscore;
|
||||
/** @deprecated Import this method directly from discord.js instead. */
|
||||
public static userMention: typeof userMention;
|
||||
}
|
||||
|
||||
@@ -2813,6 +2827,13 @@ export class Webhook extends WebhookMixin() {
|
||||
applicationId: null;
|
||||
owner: User | APIUser;
|
||||
};
|
||||
|
||||
public editMessage(
|
||||
message: MessageResolvable,
|
||||
options: string | MessagePayload | WebhookEditMessageOptions,
|
||||
): Promise<Message>;
|
||||
public fetchMessage(message: Snowflake, options?: WebhookFetchMessageOptions): Promise<Message>;
|
||||
public send(options: string | MessagePayload | Omit<WebhookMessageOptions, 'flags'>): Promise<Message>;
|
||||
}
|
||||
|
||||
export class WebhookClient extends WebhookMixin(BaseClient) {
|
||||
@@ -3284,11 +3305,7 @@ export class BaseGuildEmojiManager extends CachedManager<Snowflake, GuildEmoji,
|
||||
public resolveIdentifier(emoji: EmojiIdentifierResolvable): string | null;
|
||||
}
|
||||
|
||||
export class CategoryChannelChildManager extends DataManager<
|
||||
Snowflake,
|
||||
NonCategoryGuildBasedChannel,
|
||||
GuildChannelResolvable
|
||||
> {
|
||||
export class CategoryChannelChildManager extends DataManager<Snowflake, CategoryChildChannel, GuildChannelResolvable> {
|
||||
private constructor(channel: CategoryChannel);
|
||||
|
||||
public channel: CategoryChannel;
|
||||
@@ -4417,12 +4434,6 @@ export interface EmbedField {
|
||||
inline: boolean;
|
||||
}
|
||||
|
||||
export interface EmbedFieldData {
|
||||
name: string;
|
||||
value: string;
|
||||
inline?: boolean;
|
||||
}
|
||||
|
||||
export type EmojiIdentifierResolvable = string | EmojiResolvable;
|
||||
|
||||
export type EmojiResolvable = Snowflake | GuildEmoji | ReactionEmoji;
|
||||
@@ -4630,18 +4641,18 @@ export interface GuildAuditLogsEntryExtraField {
|
||||
[AuditLogEvent.ChannelOverwriteCreate]:
|
||||
| Role
|
||||
| GuildMember
|
||||
| { id: Snowflake; name: string; type: 'Role' }
|
||||
| { id: Snowflake; type: 'Member' };
|
||||
| { id: Snowflake; name: string; type: AuditLogOptionsType.Role }
|
||||
| { id: Snowflake; type: AuditLogOptionsType.Member };
|
||||
[AuditLogEvent.ChannelOverwriteUpdate]:
|
||||
| Role
|
||||
| GuildMember
|
||||
| { id: Snowflake; name: string; type: 'Role' }
|
||||
| { id: Snowflake; type: 'Member' };
|
||||
| { id: Snowflake; name: string; type: AuditLogOptionsType.Role }
|
||||
| { id: Snowflake; type: AuditLogOptionsType.Member };
|
||||
[AuditLogEvent.ChannelOverwriteDelete]:
|
||||
| Role
|
||||
| GuildMember
|
||||
| { id: Snowflake; name: string; type: OverwriteType.Role }
|
||||
| { id: Snowflake; type: OverwriteType.Member };
|
||||
| { id: Snowflake; name: string; type: AuditLogOptionsType.Role }
|
||||
| { id: Snowflake; type: AuditLogOptionsType.Member };
|
||||
[AuditLogEvent.StageInstanceCreate]: StageChannel | { id: Snowflake };
|
||||
[AuditLogEvent.StageInstanceDelete]: StageChannel | { id: Snowflake };
|
||||
[AuditLogEvent.StageInstanceUpdate]: StageChannel | { id: Snowflake };
|
||||
@@ -4718,7 +4729,7 @@ export interface GuildChannelEditOptions {
|
||||
|
||||
export interface GuildChannelOverwriteOptions {
|
||||
reason?: string;
|
||||
type?: number;
|
||||
type?: OverwriteType;
|
||||
}
|
||||
|
||||
export interface GuildCreateOptions {
|
||||
@@ -4759,7 +4770,7 @@ export interface GuildEditData {
|
||||
preferredLocale?: Locale | null;
|
||||
premiumProgressBarEnabled?: boolean;
|
||||
description?: string | null;
|
||||
features?: GuildFeature[];
|
||||
features?: `${GuildFeature}`[];
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
@@ -5436,7 +5447,7 @@ export type VoiceBasedChannel = Extract<Channel, { bitrate: number }>;
|
||||
|
||||
export type GuildBasedChannel = Extract<Channel, { guild: Guild }>;
|
||||
|
||||
export type NonCategoryGuildBasedChannel = Exclude<GuildBasedChannel, CategoryChannel>;
|
||||
export type CategoryChildChannel = Exclude<Extract<Channel, { parent: CategoryChannel | null }>, CategoryChannel>;
|
||||
|
||||
export type NonThreadGuildBasedChannel = Exclude<GuildBasedChannel, AnyThreadChannel>;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
APITextInputComponent,
|
||||
APIEmbed,
|
||||
ApplicationCommandType,
|
||||
APIMessage,
|
||||
} from 'discord-api-types/v10';
|
||||
import {
|
||||
ApplicationCommand,
|
||||
@@ -130,6 +131,9 @@ import {
|
||||
ThreadMemberManager,
|
||||
CollectedMessageInteraction,
|
||||
ShardEvents,
|
||||
Webhook,
|
||||
WebhookClient,
|
||||
InteractionWebhook,
|
||||
} from '.';
|
||||
import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd';
|
||||
import type { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders';
|
||||
@@ -1691,3 +1695,20 @@ expectType<ChannelMention>(partialGroupDMChannel.toString());
|
||||
expectType<UserMention>(dmChannel.toString());
|
||||
expectType<UserMention>(user.toString());
|
||||
expectType<UserMention>(guildMember.toString());
|
||||
|
||||
declare const webhook: Webhook;
|
||||
declare const webhookClient: WebhookClient;
|
||||
declare const interactionWebhook: InteractionWebhook;
|
||||
declare const snowflake: Snowflake;
|
||||
|
||||
expectType<Promise<Message>>(webhook.send('content'));
|
||||
expectType<Promise<Message>>(webhook.editMessage(snowflake, 'content'));
|
||||
expectType<Promise<Message>>(webhook.fetchMessage(snowflake));
|
||||
|
||||
expectType<Promise<APIMessage>>(webhookClient.send('content'));
|
||||
expectType<Promise<APIMessage>>(webhookClient.editMessage(snowflake, 'content'));
|
||||
expectType<Promise<APIMessage>>(webhookClient.fetchMessage(snowflake));
|
||||
|
||||
expectType<Promise<Message>>(interactionWebhook.send('content'));
|
||||
expectType<Promise<Message>>(interactionWebhook.editMessage(snowflake, 'content'));
|
||||
expectType<Promise<Message>>(interactionWebhook.fetchMessage(snowflake));
|
||||
|
||||
1
packages/docgen/.lintstagedrc.js
Normal file
1
packages/docgen/.lintstagedrc.js
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('../../.lintstagedrc.json');
|
||||
@@ -4,10 +4,13 @@
|
||||
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<p>
|
||||
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
|
||||
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/test.yml/badge.svg" alt="Build status" /></a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"><img src="https://raw.githubusercontent.com/discordjs/discord.js/main/.github/powered-by-vercel.svg" alt="Vercel" /></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
## Links
|
||||
@@ -15,7 +18,7 @@
|
||||
- [Website](https://discord.js.org/) ([source](https://github.com/discordjs/discord.js/tree/main/packages/website))
|
||||
- [Documentation](https://discord.js.org/#/docs)
|
||||
- [Guide](https://discordjs.guide/) ([source](https://github.com/discordjs/guide))
|
||||
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v13.html), including updated and removed items in the library.
|
||||
See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v14.html), including updated and removed items in the library.
|
||||
- [discord.js Discord server](https://discord.gg/djs)
|
||||
- [Discord API Discord server](https://discord.gg/discord-api)
|
||||
- [GitHub](https://github.com/discordjs/discord.js/tree/main/packages/scripts)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user