mirror of
https://github.com/discordjs/discord.js.git
synced 2026-05-26 05:20:08 +00:00
Compare commits
15 Commits
@discordjs
...
14.19.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
096cd92b87 | ||
|
|
37ef57b880 | ||
|
|
e3c247e423 | ||
|
|
5f3fc170fb | ||
|
|
20fade2a87 | ||
|
|
e827644b5a | ||
|
|
62815928ab | ||
|
|
7fb6630c02 | ||
|
|
737b80b5f2 | ||
|
|
481ccd228b | ||
|
|
a3fff7b8be | ||
|
|
8cdbe23766 | ||
|
|
d920933dc5 | ||
|
|
2d817df3b5 | ||
|
|
1605a2c289 |
2
.github/workflows/cleanup-cache.yml
vendored
2
.github/workflows/cleanup-cache.yml
vendored
@@ -1,4 +1,4 @@
|
||||
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries
|
||||
# https://docs.github.com/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries
|
||||
name: Cleanup caches
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
48
.github/workflows/documentation.yml
vendored
48
.github/workflows/documentation.yml
vendored
@@ -103,7 +103,15 @@ jobs:
|
||||
if: ${{ env.REF_TYPE == 'tag' && (!inputs.ref || inputs.ref == 'main') }}
|
||||
env:
|
||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||
CF_D1_DOCS_API_KEY: ${{ secrets.CF_D1_DOCS_API_KEY }}
|
||||
CF_D1_DOCS_ID: ${{ secrets.CF_D1_DOCS_ID }}
|
||||
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
|
||||
BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}
|
||||
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
|
||||
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
|
||||
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
|
||||
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
|
||||
CF_R2_DOCS_BUCKET_URL: ${{ secrets.CF_R2_DOCS_BUCKET_URL }}
|
||||
uses: ./packages/actions/src/uploadDocumentation
|
||||
with:
|
||||
package: ${{ steps.extract-tag.outputs.package }}
|
||||
@@ -113,7 +121,15 @@ jobs:
|
||||
if: ${{ env.REF_TYPE == 'tag' && inputs.ref && inputs.ref != 'main' }}
|
||||
env:
|
||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||
CF_D1_DOCS_API_KEY: ${{ secrets.CF_D1_DOCS_API_KEY }}
|
||||
CF_D1_DOCS_ID: ${{ secrets.CF_D1_DOCS_ID }}
|
||||
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
|
||||
BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}
|
||||
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
|
||||
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
|
||||
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
|
||||
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
|
||||
CF_R2_DOCS_BUCKET_URL: ${{ secrets.CF_R2_DOCS_BUCKET_URL }}
|
||||
uses: ./main/packages/actions/src/uploadDocumentation
|
||||
with:
|
||||
package: ${{ steps.extract-tag.outputs.package }}
|
||||
@@ -123,6 +139,10 @@ jobs:
|
||||
if: ${{ env.REF_TYPE == 'tag' && (!inputs.ref || inputs.ref == 'main') }}
|
||||
env:
|
||||
BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}
|
||||
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
|
||||
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
|
||||
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
|
||||
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
|
||||
uses: ./packages/actions/src/uploadSplitDocumentation
|
||||
with:
|
||||
package: ${{ steps.extract-tag.outputs.package }}
|
||||
@@ -132,6 +152,10 @@ jobs:
|
||||
if: ${{ env.REF_TYPE == 'tag' && inputs.ref && inputs.ref != 'main' }}
|
||||
env:
|
||||
BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}
|
||||
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
|
||||
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
|
||||
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
|
||||
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
|
||||
uses: ./main/packages/actions/src/uploadSplitDocumentation
|
||||
with:
|
||||
package: ${{ steps.extract-tag.outputs.package }}
|
||||
@@ -155,26 +179,50 @@ jobs:
|
||||
if: ${{ env.REF_TYPE == 'branch' && (!inputs.ref || inputs.ref == 'main') }}
|
||||
env:
|
||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||
CF_D1_DOCS_API_KEY: ${{ secrets.CF_D1_DOCS_API_KEY }}
|
||||
CF_D1_DOCS_ID: ${{ secrets.CF_D1_DOCS_ID }}
|
||||
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
|
||||
BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}
|
||||
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
|
||||
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
|
||||
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
|
||||
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
|
||||
CF_R2_DOCS_BUCKET_URL: ${{ secrets.CF_R2_DOCS_BUCKET_URL }}
|
||||
uses: ./packages/actions/src/uploadDocumentation
|
||||
|
||||
- name: Upload documentation to database
|
||||
if: ${{ env.REF_TYPE == 'branch' && inputs.ref && inputs.ref != 'main' }}
|
||||
env:
|
||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||
CF_D1_DOCS_API_KEY: ${{ secrets.CF_D1_DOCS_API_KEY }}
|
||||
CF_D1_DOCS_ID: ${{ secrets.CF_D1_DOCS_ID }}
|
||||
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
|
||||
BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}
|
||||
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
|
||||
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
|
||||
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
|
||||
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
|
||||
CF_R2_DOCS_BUCKET_URL: ${{ secrets.CF_R2_DOCS_BUCKET_URL }}
|
||||
uses: ./main/packages/actions/src/uploadDocumentation
|
||||
|
||||
- name: Upload split documentation to blob storage
|
||||
if: ${{ env.REF_TYPE == 'branch' && (!inputs.ref || inputs.ref == 'main') }}
|
||||
env:
|
||||
BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}
|
||||
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
|
||||
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
|
||||
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
|
||||
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
|
||||
uses: ./packages/actions/src/uploadSplitDocumentation
|
||||
|
||||
- name: Upload split documentation to blob storage
|
||||
if: ${{ env.REF_TYPE == 'branch' && inputs.ref && inputs.ref != 'main' }}
|
||||
env:
|
||||
BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}
|
||||
CF_R2_DOCS_URL: ${{ secrets.CF_R2_DOCS_URL }}
|
||||
CF_R2_DOCS_ACCESS_KEY_ID: ${{ secrets.CF_R2_DOCS_ACCESS_KEY_ID }}
|
||||
CF_R2_DOCS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_DOCS_SECRET_ACCESS_KEY }}
|
||||
CF_R2_DOCS_BUCKET: ${{ secrets.CF_R2_DOCS_BUCKET }}
|
||||
uses: ./main/packages/actions/src/uploadSplitDocumentation
|
||||
|
||||
- name: Move docs to correct directory
|
||||
|
||||
@@ -41,28 +41,32 @@
|
||||
"homepage": "https://discord.js.org",
|
||||
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.1",
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/glob": "^0.5.0",
|
||||
"@aws-sdk/client-s3": "^3.787.0",
|
||||
"@discordjs/scripts": "workspace:^",
|
||||
"@vercel/blob": "^0.23.4",
|
||||
"@vercel/blob": "^0.27.3",
|
||||
"@vercel/postgres": "^0.9.0",
|
||||
"cloudflare": "^4.2.0",
|
||||
"meilisearch": "^0.38.0",
|
||||
"p-limit": "^6.1.0",
|
||||
"tslib": "^2.6.3",
|
||||
"undici": "6.21.1"
|
||||
"p-limit": "^6.2.0",
|
||||
"p-queue": "^8.1.0",
|
||||
"tslib": "^2.8.1",
|
||||
"undici": "7.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.19.45",
|
||||
"@vitest/coverage-v8": "^2.0.5",
|
||||
"@types/node": "^22.14.0",
|
||||
"@vitest/coverage-v8": "^3.1.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-neon": "^0.1.62",
|
||||
"eslint-formatter-pretty": "^6.0.1",
|
||||
"prettier": "^3.3.3",
|
||||
"tsup": "^8.2.4",
|
||||
"turbo": "^2.0.14",
|
||||
"typescript": "~5.5.4",
|
||||
"vitest": "^2.0.5"
|
||||
"prettier": "^3.5.3",
|
||||
"terser": "^5.37.0",
|
||||
"tsup": "^8.4.0",
|
||||
"turbo": "^2.5.0",
|
||||
"typescript": "~5.8.3",
|
||||
"vitest": "^3.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
@@ -9,7 +9,7 @@ runs:
|
||||
with:
|
||||
swap-size-gb: 10
|
||||
|
||||
- uses: pnpm/action-setup@v4.0.0
|
||||
- uses: pnpm/action-setup@v4.1.0
|
||||
name: Install pnpm
|
||||
with:
|
||||
run_install: false
|
||||
|
||||
@@ -1,13 +1,26 @@
|
||||
/* eslint-disable @typescript-eslint/no-loop-func */
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import process from 'node:process';
|
||||
import { getInput, setFailed } from '@actions/core';
|
||||
import { create } from '@actions/glob';
|
||||
import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3';
|
||||
import { put } from '@vercel/blob';
|
||||
import { createPool } from '@vercel/postgres';
|
||||
import Cloudflare from 'cloudflare';
|
||||
import pLimit from 'p-limit';
|
||||
|
||||
if (!process.env.DATABASE_URL) {
|
||||
setFailed('DATABASE_URL is not set');
|
||||
if (
|
||||
!process.env.DATABASE_URL ||
|
||||
!process.env.CF_R2_DOCS_URL ||
|
||||
!process.env.CF_R2_DOCS_ACCESS_KEY_ID ||
|
||||
!process.env.CF_R2_DOCS_SECRET_ACCESS_KEY ||
|
||||
!process.env.CF_R2_DOCS_BUCKET ||
|
||||
!process.env.CF_R2_DOCS_BUCKET_URL ||
|
||||
!process.env.CF_D1_DOCS_API_KEY ||
|
||||
!process.env.CF_D1_DOCS_ID ||
|
||||
!process.env.CF_ACCOUNT_ID
|
||||
) {
|
||||
setFailed('Missing environment variables');
|
||||
}
|
||||
|
||||
const pkg = getInput('package') || '*';
|
||||
@@ -17,6 +30,21 @@ const pool = createPool({
|
||||
connectionString: process.env.DATABASE_URL,
|
||||
});
|
||||
|
||||
const S3 = new S3Client({
|
||||
region: 'auto',
|
||||
endpoint: process.env.CF_R2_DOCS_URL!,
|
||||
credentials: {
|
||||
accessKeyId: process.env.CF_R2_DOCS_ACCESS_KEY_ID!,
|
||||
secretAccessKey: process.env.CF_R2_DOCS_SECRET_ACCESS_KEY!,
|
||||
},
|
||||
requestChecksumCalculation: 'WHEN_REQUIRED',
|
||||
responseChecksumValidation: 'WHEN_REQUIRED',
|
||||
});
|
||||
|
||||
const client = new Cloudflare({
|
||||
apiToken: process.env.CF_D1_DOCS_API_KEY,
|
||||
});
|
||||
|
||||
const limit = pLimit(10);
|
||||
const promises = [];
|
||||
|
||||
@@ -26,12 +54,14 @@ for await (const file of globber.globGenerator()) {
|
||||
const data = await readFile(file, 'utf8');
|
||||
try {
|
||||
promises.push(
|
||||
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
||||
limit(async () => {
|
||||
console.log(`Uploading ${file} with ${version}...`);
|
||||
const json = JSON.parse(data);
|
||||
const name = json.name ?? json.n;
|
||||
const { url } = await put(`${name.replace('@discordjs/', '')}/${version}.json`, data, {
|
||||
|
||||
const key = `${name.replace('@discordjs/', '')}/${version}.json`;
|
||||
|
||||
const { url } = await put(key, data, {
|
||||
access: 'public',
|
||||
addRandomSuffix: false,
|
||||
});
|
||||
@@ -39,6 +69,19 @@ for await (const file of globber.globGenerator()) {
|
||||
'@discordjs/',
|
||||
'',
|
||||
)}, ${version}, ${url}) on conflict (name, version) do update set url = EXCLUDED.url`;
|
||||
|
||||
await S3.send(
|
||||
new PutObjectCommand({
|
||||
Bucket: process.env.CF_R2_DOCS_BUCKET,
|
||||
Key: key,
|
||||
Body: data,
|
||||
}),
|
||||
);
|
||||
await client.d1.database.raw(process.env.CF_D1_DOCS_ID!, {
|
||||
account_id: process.env.CF_ACCOUNT_ID!,
|
||||
sql: `insert into documentation (name, version, url) values (?, ?, ?) on conflict (name, version) do update set url = excluded.url;`,
|
||||
params: [name.replace('@discordjs/', ''), version, process.env.CF_R2_DOCS_BUCKET_URL + '/' + key],
|
||||
});
|
||||
}),
|
||||
);
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,32 +1,82 @@
|
||||
/* eslint-disable @typescript-eslint/no-loop-func */
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { basename, dirname, relative, sep } from 'node:path';
|
||||
import { cwd } from 'node:process';
|
||||
import { getInput } from '@actions/core';
|
||||
import process from 'node:process';
|
||||
import { setTimeout as sleep } from 'node:timers/promises';
|
||||
import { setFailed, getInput } from '@actions/core';
|
||||
import { create } from '@actions/glob';
|
||||
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
|
||||
import { put } from '@vercel/blob';
|
||||
import pLimit from 'p-limit';
|
||||
import PQueue from 'p-queue';
|
||||
|
||||
if (
|
||||
!process.env.CF_R2_DOCS_URL ||
|
||||
!process.env.CF_R2_DOCS_ACCESS_KEY_ID ||
|
||||
!process.env.CF_R2_DOCS_SECRET_ACCESS_KEY ||
|
||||
!process.env.CF_R2_DOCS_BUCKET
|
||||
) {
|
||||
setFailed('Missing environment variables');
|
||||
}
|
||||
|
||||
const pkg = getInput('package') || '*';
|
||||
const version = getInput('version') || 'main';
|
||||
|
||||
const limit = pLimit(10);
|
||||
const queue = new PQueue({ concurrency: 10, interval: 60_000, intervalCap: 1_000 });
|
||||
const promises = [];
|
||||
const failedUploads: string[] = [];
|
||||
|
||||
const S3 = new S3Client({
|
||||
region: 'auto',
|
||||
endpoint: process.env.CF_R2_DOCS_URL!,
|
||||
credentials: {
|
||||
accessKeyId: process.env.CF_R2_DOCS_ACCESS_KEY_ID!,
|
||||
secretAccessKey: process.env.CF_R2_DOCS_SECRET_ACCESS_KEY!,
|
||||
},
|
||||
requestChecksumCalculation: 'WHEN_REQUIRED',
|
||||
responseChecksumValidation: 'WHEN_REQUIRED',
|
||||
});
|
||||
|
||||
const globber = await create(`packages/${pkg}/docs/${pkg}/split/*.api.json`);
|
||||
console.log('Glob: ', await globber.glob());
|
||||
for await (const file of globber.globGenerator()) {
|
||||
const data = await readFile(file, 'utf8');
|
||||
const pkgName = dirname(relative(cwd(), file)).split(sep)[1];
|
||||
const pkgName = dirname(relative(process.cwd(), file)).split(sep)[1];
|
||||
try {
|
||||
promises.push(
|
||||
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
||||
limit(async () => {
|
||||
queue.add(async () => {
|
||||
console.log(`Uploading ${file} with ${version} from ${pkgName}...`);
|
||||
const name = basename(file).replace('main.', '');
|
||||
await put(`rewrite/${pkgName}/${version}.${name}`, data, {
|
||||
access: 'public',
|
||||
addRandomSuffix: false,
|
||||
});
|
||||
async function upload(retries = 0) {
|
||||
try {
|
||||
await put(`rewrite/${pkgName}/${version}.${name}`, data, {
|
||||
access: 'public',
|
||||
addRandomSuffix: false,
|
||||
});
|
||||
await S3.send(
|
||||
new PutObjectCommand({
|
||||
Bucket: process.env.CF_R2_DOCS_BUCKET,
|
||||
Key: `${pkgName}/${version}.${name}`,
|
||||
Body: data,
|
||||
}),
|
||||
);
|
||||
} catch (error) {
|
||||
if (retries > 3) {
|
||||
console.error(`Could not upload ${file} after 3 retries`, error);
|
||||
failedUploads.push(name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof error === 'object' && error && 'retryAfter' in error && typeof error.retryAfter === 'number') {
|
||||
await sleep(error.retryAfter * 1_000);
|
||||
return upload(retries + 1);
|
||||
} else {
|
||||
console.error(`Could not upload ${file}`, error);
|
||||
failedUploads.push(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await upload();
|
||||
}),
|
||||
);
|
||||
} catch (error) {
|
||||
@@ -36,6 +86,9 @@ for await (const file of globber.globGenerator()) {
|
||||
|
||||
try {
|
||||
await Promise.all(promises);
|
||||
if (failedUploads.length) {
|
||||
setFailed(`Failed to upload ${failedUploads.length} files: ${failedUploads.join(', ')}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
10
packages/actions/tsconfig.test.json
Normal file
10
packages/actions/tsconfig.test.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig.json",
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["__tests__/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@@ -2,6 +2,46 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
# [14.19.2](https://github.com/discordjs/discord.js/compare/14.19.1...14.19.2) - (2025-04-28)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **WebSocketManager:** Always emit shardDisconnect on unresumable close (#10826) ([37ef57b](https://github.com/discordjs/discord.js/commit/37ef57b88079db2f87036dfd9d57af9a2e5d1b9f))
|
||||
- **SoundboardSound:** Wrong emoji comparison in `equals` (#10861) ([5f3fc17](https://github.com/discordjs/discord.js/commit/5f3fc170fbfd49fa4f117901578c309f00f65d0b))
|
||||
- AllowedMentions, container, media item `toJSON()` for components v2 (#10852) ([20fade2](https://github.com/discordjs/discord.js/commit/20fade2a875695aa677e32b983320e746fd4d69c))
|
||||
- **Guild:** Cache soundboard sounds when patching (#10857) ([e827644](https://github.com/discordjs/discord.js/commit/e827644b5aecf05f7551e4e31a620894cc7aa71f))
|
||||
- **GuildSoundboardSoundManager:** Value "undefined" is not snowflake (#10854) ([6281592](https://github.com/discordjs/discord.js/commit/62815928aba0baa96b3422a4a7f1c4321c123dc7))
|
||||
|
||||
## Typings
|
||||
|
||||
- **GuildSoundboardSoundEditOptions:** Add missing `reason` (#10863) ([e3c247e](https://github.com/discordjs/discord.js/commit/e3c247e423c91b9d9e1d40d0521b6eddf0bc53c9))
|
||||
|
||||
# [14.19.1](https://github.com/discordjs/discord.js/compare/14.19.0...14.19.1) - (2025-04-26)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Add in `withComponents` to Webhook ([481ccd2](https://github.com/discordjs/discord.js/commit/481ccd228bc240e32ac552475f8427a8042e1add))
|
||||
|
||||
# [14.19.0](https://github.com/discordjs/discord.js/compare/14.18.0...14.19.0) - (2025-04-26)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Set `with_components` when sending components through webhooks ([8cdbe23](https://github.com/discordjs/discord.js/commit/8cdbe23766c6e5fe1e0acc040120e839511fea2c))
|
||||
- **GuildAuditLogEntry:** Fix some incorrect types and runtime logic (#10849) ([d920933](https://github.com/discordjs/discord.js/commit/d920933dc5b3c518754f526a9864582fc2c92a43))
|
||||
- Spread out section components next to accessory ([1605a2c](https://github.com/discordjs/discord.js/commit/1605a2c2894c4bb834c604f13a5a91cdbffac3a8))
|
||||
- Correctly extend CachedManager in GuildSoundboardSoundManager ([532c384](https://github.com/discordjs/discord.js/commit/532c3842bc293c965dd9fee846257c9e0bbb450a))
|
||||
- **MessagePayload:** Preserve existing flags when editing (#10766) ([ebfd526](https://github.com/discordjs/discord.js/commit/ebfd52695e205bccda3ae6f4ec39d4e5e8891ab0))
|
||||
|
||||
## Features
|
||||
|
||||
- Soundboard missing things (#10850) ([2d817df](https://github.com/discordjs/discord.js/commit/2d817df3b5894da84a1990cb4e0cfded8a925e75))
|
||||
- Components v2 in v14 (#10781) ([edace17](https://github.com/discordjs/discord.js/commit/edace17a131f857547163a3acf4bb6fec0c1e415))
|
||||
- Add soundboard in v14 (#10843) ([d3154cf](https://github.com/discordjs/discord.js/commit/d3154cf8f1eb027b5b4921d4048a32f464a3cd85))
|
||||
|
||||
## Typings
|
||||
|
||||
- Make `Client.on()` compatible with esnext.disposable in TS5.6+ (#10773) ([45552fa](https://github.com/discordjs/discord.js/commit/45552faf02c67b5079f34567c0214203cd927d2e))
|
||||
|
||||
# [14.18.0](https://github.com/discordjs/discord.js/compare/14.17.3...14.18.0) - (2025-02-10)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "discord.js",
|
||||
"version": "14.18.0",
|
||||
"version": "14.19.2",
|
||||
"description": "A powerful library for interacting with the Discord API",
|
||||
"scripts": {
|
||||
"test": "pnpm run docs:test && pnpm run test:typescript",
|
||||
|
||||
@@ -36,10 +36,13 @@ const BeforeReadyWhitelist = [
|
||||
|
||||
const WaitingForGuildEvents = [GatewayDispatchEvents.GuildCreate, GatewayDispatchEvents.GuildDelete];
|
||||
|
||||
const UNRESUMABLE_CLOSE_CODES = [
|
||||
CloseCodes.Normal,
|
||||
GatewayCloseCodes.AlreadyAuthenticated,
|
||||
GatewayCloseCodes.InvalidSeq,
|
||||
const UNRECOVERABLE_CLOSE_CODES = [
|
||||
GatewayCloseCodes.AuthenticationFailed,
|
||||
GatewayCloseCodes.InvalidShard,
|
||||
GatewayCloseCodes.ShardingRequired,
|
||||
GatewayCloseCodes.InvalidAPIVersion,
|
||||
GatewayCloseCodes.InvalidIntents,
|
||||
GatewayCloseCodes.DisallowedIntents,
|
||||
];
|
||||
|
||||
const reasonIsDeprecated = 'the reason property is deprecated, use the code property to determine the reason';
|
||||
@@ -242,7 +245,7 @@ class WebSocketManager extends EventEmitter {
|
||||
this._ws.on(WSWebSocketShardEvents.Closed, ({ code, shardId }) => {
|
||||
const shard = this.shards.get(shardId);
|
||||
shard.emit(WebSocketShardEvents.Close, { code, reason: reasonIsDeprecated, wasClean: true });
|
||||
if (UNRESUMABLE_CLOSE_CODES.includes(code) && this.destroyed) {
|
||||
if (UNRECOVERABLE_CLOSE_CODES.includes(code)) {
|
||||
shard.status = Status.Disconnected;
|
||||
/**
|
||||
* Emitted when a shard's WebSocket disconnects and will no longer reconnect.
|
||||
@@ -251,7 +254,7 @@ class WebSocketManager extends EventEmitter {
|
||||
* @param {number} id The shard id that disconnected
|
||||
*/
|
||||
this.client.emit(Events.ShardDisconnect, { code, reason: reasonIsDeprecated, wasClean: true }, shardId);
|
||||
this.debug([`Shard not resumable: ${code} (${GatewayCloseCodes[code] ?? CloseCodes[code]})`], shardId);
|
||||
this.debug([`Shard not recoverable: ${code} (${GatewayCloseCodes[code] ?? CloseCodes[code]})`], shardId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ class GuildSoundboardSoundManager extends CachedManager {
|
||||
* Data for editing a soundboard sound.
|
||||
* @typedef {Object} GuildSoundboardSoundEditOptions
|
||||
* @property {string} [name] The name of the soundboard sound
|
||||
* @property {?number} [volume] The volume of the soundboard sound, from 0 to 1
|
||||
* @property {?number} [volume] The volume (a double) of the soundboard sound, from 0 (inclusive) to 1
|
||||
* @property {?Snowflake} [emojiId] The emoji id of the soundboard sound
|
||||
* @property {?string} [emojiName] The emoji name of the soundboard sound
|
||||
* @property {string} [reason] The reason for editing the soundboard sound
|
||||
@@ -157,35 +157,57 @@ class GuildSoundboardSoundManager extends CachedManager {
|
||||
await this.client.rest.delete(Routes.guildSoundboardSound(this.guild.id, soundId), { reason });
|
||||
}
|
||||
|
||||
/**
|
||||
* Options used to fetch a soundboard sound.
|
||||
* @typedef {BaseFetchOptions} FetchSoundboardSoundOptions
|
||||
* @property {SoundboardSoundResolvable} soundboardSound The soundboard sound to fetch
|
||||
*/
|
||||
|
||||
/**
|
||||
* Options used to fetch soundboard sounds from Discord
|
||||
* @typedef {Object} FetchGuildSoundboardSoundsOptions
|
||||
* @property {boolean} [cache] Whether to cache the fetched soundboard sounds
|
||||
*/
|
||||
|
||||
/* eslint-disable max-len */
|
||||
/**
|
||||
* Obtains one or more soundboard sounds from Discord, or the soundboard sound cache if they're already available.
|
||||
* @param {Snowflake} [id] The soundboard sound's id
|
||||
* @param {BaseFetchOptions} [options] Additional options for this fetch
|
||||
* @param {SoundboardSoundResolvable|FetchSoundboardSoundOptions|FetchGuildSoundboardSoundsOptions} [options] Options for fetching soundboard sound(s)
|
||||
* @returns {Promise<SoundboardSound|Collection<Snowflake, SoundboardSound>>}
|
||||
* @example
|
||||
* // Fetch all soundboard sounds from the guild
|
||||
* guild.soundboardSounds.fetch()
|
||||
* .then(sounds => console.log(`There are ${sounds.size} soundboard sounds.`))
|
||||
* .catch(console.error);
|
||||
* @example
|
||||
* // Fetch a single soundboard sound
|
||||
* guild.soundboardSounds.fetch('222078108977594368')
|
||||
* .then(sound => console.log(`The soundboard sound name is: ${sound.name}`))
|
||||
* .catch(console.error);
|
||||
* @example
|
||||
* // Fetch all soundboard sounds from the guild
|
||||
* guild.soundboardSounds.fetch()
|
||||
* .then(sounds => console.log(`There are ${sounds.size} soundboard sounds.`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
async fetch(id, { cache = true, force = false } = {}) {
|
||||
if (id) {
|
||||
if (!force) {
|
||||
const existing = this.cache.get(id);
|
||||
if (existing) return existing;
|
||||
}
|
||||
/* eslint-enable max-len */
|
||||
async fetch(options) {
|
||||
if (!options) return this._fetchMany();
|
||||
const { cache, force, soundboardSound } = options;
|
||||
const resolvedSoundboardSound = this.resolveId(soundboardSound ?? options);
|
||||
if (resolvedSoundboardSound) return this._fetchSingle({ cache, force, soundboardSound: resolvedSoundboardSound });
|
||||
return this._fetchMany({ cache });
|
||||
}
|
||||
|
||||
const sound = await this.client.rest.get(Routes.guildSoundboardSound(this.guild.id, id));
|
||||
return this._add(sound, cache);
|
||||
async _fetchSingle({ cache, force, soundboardSound } = {}) {
|
||||
if (!force) {
|
||||
const existing = this.cache.get(soundboardSound);
|
||||
if (existing) return existing;
|
||||
}
|
||||
|
||||
const data = await this.client.rest.get(Routes.guildSoundboardSound(this.guild.id, soundboardSound));
|
||||
return this._add(data, cache);
|
||||
}
|
||||
|
||||
async _fetchMany({ cache } = {}) {
|
||||
const data = await this.client.rest.get(Routes.guildSoundboardSounds(this.guild.id));
|
||||
return new Collection(data.map(sound => [sound.sound_id, this._add(sound, cache)]));
|
||||
|
||||
return data.items.reduce((coll, sound) => coll.set(sound.sound_id, this._add(sound, cache)), new Collection());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -499,6 +499,13 @@ class Guild extends AnonymousGuild {
|
||||
} else {
|
||||
this.incidentsData ??= null;
|
||||
}
|
||||
|
||||
if (data.soundboard_sounds) {
|
||||
this.soundboardSounds.cache.clear();
|
||||
for (const soundboardSound of data.soundboard_sounds) {
|
||||
this.soundboardSounds._add(soundboardSound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,6 +32,7 @@ const Targets = {
|
||||
AutoModeration: 'AutoModeration',
|
||||
GuildOnboarding: 'GuildOnboarding',
|
||||
GuildOnboardingPrompt: 'GuildOnboardingPrompt',
|
||||
SoundboardSound: 'SoundboardSound',
|
||||
Unknown: 'Unknown',
|
||||
};
|
||||
|
||||
@@ -87,6 +88,8 @@ const Targets = {
|
||||
* * ApplicationCommandPermission
|
||||
* * GuildOnboarding
|
||||
* * GuildOnboardingPrompt
|
||||
* * SoundboardSound
|
||||
* * AutoModeration
|
||||
* * Unknown
|
||||
* @typedef {string} AuditLogTargetType
|
||||
*/
|
||||
@@ -200,7 +203,6 @@ class GuildAuditLogsEntry {
|
||||
|
||||
case AuditLogEvent.MemberMove:
|
||||
case AuditLogEvent.MessageDelete:
|
||||
case AuditLogEvent.MessageBulkDelete:
|
||||
this.extra = {
|
||||
channel: guild.channels.cache.get(data.options.channel_id) ?? { id: data.options.channel_id },
|
||||
count: Number(data.options.count),
|
||||
@@ -215,6 +217,7 @@ class GuildAuditLogsEntry {
|
||||
};
|
||||
break;
|
||||
|
||||
case AuditLogEvent.MessageBulkDelete:
|
||||
case AuditLogEvent.MemberDisconnect:
|
||||
this.extra = {
|
||||
count: Number(data.options.count),
|
||||
@@ -366,12 +369,14 @@ class GuildAuditLogsEntry {
|
||||
data.action_type === AuditLogEvent.OnboardingPromptCreate
|
||||
? new GuildOnboardingPrompt(guild.client, changesReduce(this.changes, { id: data.target_id }), guild.id)
|
||||
: changesReduce(this.changes, { id: data.target_id });
|
||||
} else if (targetType === Targets.GuildOnboarding) {
|
||||
this.target = changesReduce(this.changes, { id: data.target_id });
|
||||
} else if (targetType === Targets.Role) {
|
||||
this.target = guild.roles.cache.get(data.target_id) ?? { id: data.target_id };
|
||||
} else if (targetType === Targets.Emoji) {
|
||||
this.target = guild.emojis.cache.get(data.target_id) ?? { id: data.target_id };
|
||||
} else if (targetType === Targets.SoundboardSound) {
|
||||
this.target = guild.soundboardSounds.cache.get(data.target_id) ?? { id: data.target_id };
|
||||
} else if (data.target_id) {
|
||||
this.target = guild[`${targetType.toLowerCase()}s`]?.cache.get(data.target_id) ?? { id: data.target_id };
|
||||
this.target = { id: data.target_id };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,7 +400,9 @@ class GuildAuditLogsEntry {
|
||||
if (target < 110) return Targets.GuildScheduledEvent;
|
||||
if (target < 120) return Targets.Thread;
|
||||
if (target < 130) return Targets.ApplicationCommand;
|
||||
if (target >= 140 && target < 150) return Targets.AutoModeration;
|
||||
if (target < 140) return Targets.SoundboardSound;
|
||||
if (target < 143) return Targets.AutoModeration;
|
||||
if (target < 146) return Targets.User;
|
||||
if (target >= 163 && target <= 165) return Targets.GuildOnboardingPrompt;
|
||||
if (target >= 160 && target < 170) return Targets.GuildOnboarding;
|
||||
return Targets.Unknown;
|
||||
@@ -423,6 +430,7 @@ class GuildAuditLogsEntry {
|
||||
AuditLogEvent.StickerCreate,
|
||||
AuditLogEvent.GuildScheduledEventCreate,
|
||||
AuditLogEvent.ThreadCreate,
|
||||
AuditLogEvent.SoundboardSoundCreate,
|
||||
AuditLogEvent.AutoModerationRuleCreate,
|
||||
AuditLogEvent.AutoModerationBlockMessage,
|
||||
AuditLogEvent.OnboardingPromptCreate,
|
||||
@@ -452,6 +460,7 @@ class GuildAuditLogsEntry {
|
||||
AuditLogEvent.StickerDelete,
|
||||
AuditLogEvent.GuildScheduledEventDelete,
|
||||
AuditLogEvent.ThreadDelete,
|
||||
AuditLogEvent.SoundboardSoundDelete,
|
||||
AuditLogEvent.AutoModerationRuleDelete,
|
||||
AuditLogEvent.OnboardingPromptDelete,
|
||||
].includes(action)
|
||||
@@ -476,8 +485,12 @@ class GuildAuditLogsEntry {
|
||||
AuditLogEvent.StickerUpdate,
|
||||
AuditLogEvent.GuildScheduledEventUpdate,
|
||||
AuditLogEvent.ThreadUpdate,
|
||||
AuditLogEvent.SoundboardSoundUpdate,
|
||||
AuditLogEvent.ApplicationCommandPermissionUpdate,
|
||||
AuditLogEvent.AutoModerationRuleUpdate,
|
||||
AuditLogEvent.AutoModerationBlockMessage,
|
||||
AuditLogEvent.AutoModerationFlagToChannel,
|
||||
AuditLogEvent.AutoModerationUserCommunicationDisabled,
|
||||
AuditLogEvent.OnboardingPromptUpdate,
|
||||
AuditLogEvent.OnboardingUpdate,
|
||||
].includes(action)
|
||||
|
||||
@@ -248,7 +248,8 @@ class MessagePayload {
|
||||
components,
|
||||
username,
|
||||
avatar_url: avatarURL,
|
||||
allowed_mentions: content === undefined && message_reference === undefined ? undefined : allowedMentions,
|
||||
allowed_mentions:
|
||||
this.isMessage && this.target.author.id !== this.target.client.user.id ? undefined : allowedMentions,
|
||||
flags,
|
||||
message_reference,
|
||||
attachments: this.options.attachments,
|
||||
|
||||
@@ -181,8 +181,8 @@ class SoundboardSound extends Base {
|
||||
this.available === other.available &&
|
||||
this.name === other.name &&
|
||||
this.volume === other.volume &&
|
||||
this.emojiId === other.emojiId &&
|
||||
this.emojiName === other.emojiName &&
|
||||
this._emoji?.id === other._emoji?.id &&
|
||||
this._emoji?.name === other._emoji?.name &&
|
||||
this.guildId === other.guildId &&
|
||||
this.user?.id === other.user?.id
|
||||
);
|
||||
@@ -193,8 +193,8 @@ class SoundboardSound extends Base {
|
||||
this.available === other.available &&
|
||||
this.name === other.name &&
|
||||
this.volume === other.volume &&
|
||||
this.emojiId === other.emoji_id &&
|
||||
this.emojiName === other.emoji_name &&
|
||||
(this._emoji?.id ?? null) === other.emoji_id &&
|
||||
(this._emoji?.name ?? null) === other.emoji_name &&
|
||||
this.guildId === other.guild_id &&
|
||||
this.user?.id === other.user?.id
|
||||
);
|
||||
|
||||
@@ -20,6 +20,14 @@ class UnfurledMediaItem {
|
||||
get url() {
|
||||
return this.data.url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the API-compatible JSON for this media item
|
||||
* @returns {APIUnfurledMediaItem}
|
||||
*/
|
||||
toJSON() {
|
||||
return { ...this.data };
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = UnfurledMediaItem;
|
||||
|
||||
@@ -137,6 +137,8 @@ class Webhook {
|
||||
* @property {string} [threadName] Name of the thread to create (only available if the webhook is in a forum channel)
|
||||
* @property {Snowflake[]} [appliedTags]
|
||||
* The tags to apply to the created thread (only available if the webhook is in a forum channel)
|
||||
* @property {boolean} [withComponents] Whether to allow sending non-interactive components in the message.
|
||||
* <info>For application-owned webhooks, this property is ignored</info>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -214,12 +216,14 @@ class Webhook {
|
||||
messagePayload = MessagePayload.create(this, options).resolveBody();
|
||||
}
|
||||
|
||||
const { body, files } = await messagePayload.resolveFiles();
|
||||
|
||||
const query = makeURLSearchParams({
|
||||
wait: true,
|
||||
thread_id: messagePayload.options.threadId,
|
||||
with_components: messagePayload.options.withComponents,
|
||||
});
|
||||
|
||||
const { body, files } = await messagePayload.resolveFiles();
|
||||
const d = await this.client.rest.post(Routes.webhook(this.id, this.token), {
|
||||
body,
|
||||
files,
|
||||
@@ -298,6 +302,8 @@ class Webhook {
|
||||
* @property {boolean} [cache=true] Whether to cache the message.
|
||||
* @property {Snowflake} [threadId] The id of the thread this message belongs to.
|
||||
* <info>For interaction webhooks, this property is ignored</info>
|
||||
* @property {boolean} [withComponents] Whether to allow sending non-interactive components in the message.
|
||||
* <info>For application-owned webhooks, this property is ignored</info>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -337,14 +343,17 @@ class Webhook {
|
||||
|
||||
const { body, files } = await messagePayload.resolveBody().resolveFiles();
|
||||
|
||||
const query = makeURLSearchParams({
|
||||
thread_id: messagePayload.options.threadId,
|
||||
with_components: messagePayload.options.withComponents,
|
||||
});
|
||||
|
||||
const d = await this.client.rest.patch(
|
||||
Routes.webhookMessage(this.id, this.token, typeof message === 'string' ? message : message.id),
|
||||
{
|
||||
body,
|
||||
files,
|
||||
query: messagePayload.options.threadId
|
||||
? makeURLSearchParams({ thread_id: messagePayload.options.threadId })
|
||||
: undefined,
|
||||
query,
|
||||
auth: false,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -214,25 +214,36 @@ function createComponentBuilder(data) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts all interactive components from the component tree
|
||||
* @param {Component|APIMessageComponent} component The component to find all interactive components in
|
||||
* @returns {Array<Component|APIMessageComponent>}
|
||||
* @ignore
|
||||
*/
|
||||
function extractInteractiveComponents(component) {
|
||||
switch (component.type) {
|
||||
case ComponentType.ActionRow:
|
||||
return component.components;
|
||||
case ComponentType.Section:
|
||||
return [...component.components, component.accessory];
|
||||
case ComponentType.Container:
|
||||
return component.components.flatMap(extractInteractiveComponents);
|
||||
default:
|
||||
return [component];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a component by customId in nested components
|
||||
* @param {Array<Component|APIMessageComponent>} components The components to search in
|
||||
* @param {string} customId The customId to search for
|
||||
* @returns {Component|APIMessageComponent}
|
||||
* @ignore
|
||||
*/
|
||||
function findComponentByCustomId(components, customId) {
|
||||
return (
|
||||
components
|
||||
.flatMap(component => {
|
||||
switch (component.type) {
|
||||
case ComponentType.ActionRow:
|
||||
return component.components;
|
||||
case ComponentType.Section:
|
||||
return [component.accessory];
|
||||
default:
|
||||
return [component];
|
||||
}
|
||||
})
|
||||
.flatMap(extractInteractiveComponents)
|
||||
.find(component => (component.customId ?? component.custom_id) === customId) ?? null
|
||||
);
|
||||
}
|
||||
|
||||
73
packages/discord.js/typings/index.d.ts
vendored
73
packages/discord.js/typings/index.d.ts
vendored
@@ -1607,9 +1607,9 @@ export class Guild extends AnonymousGuild {
|
||||
public editOnboarding(options: GuildOnboardingEditOptions): Promise<GuildOnboarding>;
|
||||
public editWelcomeScreen(options: WelcomeScreenEditOptions): Promise<WelcomeScreen>;
|
||||
public equals(guild: Guild): boolean;
|
||||
public fetchAuditLogs<Event extends GuildAuditLogsResolvable = null>(
|
||||
public fetchAuditLogs<Event extends GuildAuditLogsResolvable = AuditLogEvent>(
|
||||
options?: GuildAuditLogsFetchOptions<Event>,
|
||||
): Promise<GuildAuditLogs<Event>>;
|
||||
): Promise<GuildAuditLogs<Event extends null ? AuditLogEvent : Event>>;
|
||||
public fetchIntegrations(): Promise<Collection<Snowflake | string, Integration>>;
|
||||
public fetchOnboarding(): Promise<GuildOnboarding>;
|
||||
public fetchOwner(options?: BaseFetchOptions): Promise<GuildMember>;
|
||||
@@ -1666,7 +1666,7 @@ export class FileComponent extends Component<APIFileComponent> {
|
||||
public get spoiler(): boolean;
|
||||
}
|
||||
|
||||
export class GuildAuditLogs<Event extends GuildAuditLogsResolvable = AuditLogEvent> {
|
||||
export class GuildAuditLogs<Event extends AuditLogEvent = AuditLogEvent> {
|
||||
private constructor(guild: Guild, data: RawGuildAuditLogData);
|
||||
private applicationCommands: Collection<Snowflake, ApplicationCommand>;
|
||||
private webhooks: Collection<Snowflake, Webhook<WebhookType.ChannelFollower | WebhookType.Incoming>>;
|
||||
@@ -1678,33 +1678,30 @@ export class GuildAuditLogs<Event extends GuildAuditLogsResolvable = AuditLogEve
|
||||
}
|
||||
|
||||
export class GuildAuditLogsEntry<
|
||||
TAction extends GuildAuditLogsResolvable = AuditLogEvent,
|
||||
TAction extends AuditLogEvent = AuditLogEvent,
|
||||
TActionType extends GuildAuditLogsActionType = TAction extends keyof GuildAuditLogsTypes
|
||||
? GuildAuditLogsTypes[TAction][1]
|
||||
: GuildAuditLogsActionType,
|
||||
: 'All',
|
||||
TTargetType extends GuildAuditLogsTargetType = TAction extends keyof GuildAuditLogsTypes
|
||||
? GuildAuditLogsTypes[TAction][0]
|
||||
: GuildAuditLogsTargetType,
|
||||
TResolvedType = TAction extends null ? AuditLogEvent : TAction,
|
||||
: 'Unknown',
|
||||
> {
|
||||
private constructor(guild: Guild, data: RawGuildAuditLogEntryData, logs?: GuildAuditLogs);
|
||||
public static Targets: GuildAuditLogsTargets;
|
||||
public action: TResolvedType;
|
||||
public action: TAction;
|
||||
public actionType: TActionType;
|
||||
public changes: AuditLogChange[];
|
||||
public get createdAt(): Date;
|
||||
public get createdTimestamp(): number;
|
||||
public executorId: Snowflake | null;
|
||||
public executor: User | null;
|
||||
public extra: TResolvedType extends keyof GuildAuditLogsEntryExtraField
|
||||
? GuildAuditLogsEntryExtraField[TResolvedType]
|
||||
: null;
|
||||
public executor: User | PartialUser | null;
|
||||
public extra: TAction extends keyof GuildAuditLogsEntryExtraField ? GuildAuditLogsEntryExtraField[TAction] : null;
|
||||
public id: Snowflake;
|
||||
public reason: string | null;
|
||||
public targetId: Snowflake | null;
|
||||
public target: TTargetType extends keyof GuildAuditLogsEntryTargetField<TActionType>
|
||||
? GuildAuditLogsEntryTargetField<TActionType>[TTargetType]
|
||||
: Role | GuildEmoji | { id: Snowflake } | null;
|
||||
public target: TTargetType extends keyof GuildAuditLogsEntryTargetField<TAction>
|
||||
? GuildAuditLogsEntryTargetField<TAction>[TTargetType]
|
||||
: { id: Snowflake | undefined; [x: string]: unknown } | null;
|
||||
public targetType: TTargetType;
|
||||
public static actionType(action: AuditLogEvent): GuildAuditLogsActionType;
|
||||
public static targetType(target: AuditLogEvent): GuildAuditLogsTargetType;
|
||||
@@ -4860,8 +4857,15 @@ export interface GuildSoundboardSoundEditOptions {
|
||||
volume?: number | null;
|
||||
emojiId?: Snowflake | null;
|
||||
emojiName?: string | null;
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
export interface FetchGuildSoundboardSoundOptions extends BaseFetchOptions {
|
||||
soundboardSound: SoundboardSoundResolvable;
|
||||
}
|
||||
|
||||
export interface FetchGuildSoundboardSoundsOptions extends Pick<BaseFetchOptions, 'cache'> {}
|
||||
|
||||
export class GuildSoundboardSoundManager extends CachedManager<Snowflake, SoundboardSound, SoundboardSoundResolvable> {
|
||||
private constructor(guild: Guild, iterable?: Iterable<APISoundboardSound>);
|
||||
public guild: Guild;
|
||||
@@ -4871,8 +4875,8 @@ export class GuildSoundboardSoundManager extends CachedManager<Snowflake, Soundb
|
||||
options: GuildSoundboardSoundEditOptions,
|
||||
): Promise<GuildSoundboardSound>;
|
||||
public delete(soundboardSound: SoundboardSoundResolvable): Promise<void>;
|
||||
public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<GuildSoundboardSound>;
|
||||
public fetch(options?: BaseFetchOptions): Promise<Collection<Snowflake, GuildSoundboardSound>>;
|
||||
public fetch(options: SoundboardSoundResolvable | FetchGuildSoundboardSoundOptions): Promise<GuildSoundboardSound>;
|
||||
public fetch(options?: FetchGuildSoundboardSoundsOptions): Promise<Collection<Snowflake, GuildSoundboardSound>>;
|
||||
}
|
||||
|
||||
export class GuildStickerManager extends CachedManager<Snowflake, Sticker, StickerResolvable> {
|
||||
@@ -6334,12 +6338,15 @@ interface GuildAuditLogsTypes {
|
||||
[AuditLogEvent.ThreadUpdate]: ['Thread', 'Update'];
|
||||
[AuditLogEvent.ThreadDelete]: ['Thread', 'Delete'];
|
||||
[AuditLogEvent.ApplicationCommandPermissionUpdate]: ['ApplicationCommand', 'Update'];
|
||||
[AuditLogEvent.SoundboardSoundCreate]: ['SoundboardSound', 'Create'];
|
||||
[AuditLogEvent.SoundboardSoundUpdate]: ['SoundboardSound', 'Update'];
|
||||
[AuditLogEvent.SoundboardSoundDelete]: ['SoundboardSound', 'Delete'];
|
||||
[AuditLogEvent.AutoModerationRuleCreate]: ['AutoModeration', 'Create'];
|
||||
[AuditLogEvent.AutoModerationRuleUpdate]: ['AutoModeration', 'Update'];
|
||||
[AuditLogEvent.AutoModerationRuleDelete]: ['AutoModeration', 'Delete'];
|
||||
[AuditLogEvent.AutoModerationBlockMessage]: ['AutoModeration', 'Create'];
|
||||
[AuditLogEvent.AutoModerationFlagToChannel]: ['AutoModeration', 'Create'];
|
||||
[AuditLogEvent.AutoModerationUserCommunicationDisabled]: ['AutoModeration', 'Create'];
|
||||
[AuditLogEvent.AutoModerationBlockMessage]: ['User', 'Update'];
|
||||
[AuditLogEvent.AutoModerationFlagToChannel]: ['User', 'Update'];
|
||||
[AuditLogEvent.AutoModerationUserCommunicationDisabled]: ['User', 'Update'];
|
||||
[AuditLogEvent.OnboardingPromptCreate]: ['GuildOnboardingPrompt', 'Create'];
|
||||
[AuditLogEvent.OnboardingPromptUpdate]: ['GuildOnboardingPrompt', 'Update'];
|
||||
[AuditLogEvent.OnboardingPromptDelete]: ['GuildOnboardingPrompt', 'Delete'];
|
||||
@@ -6355,7 +6362,7 @@ export interface GuildAuditLogsEntryExtraField {
|
||||
[AuditLogEvent.MemberPrune]: { removed: number; days: number };
|
||||
[AuditLogEvent.MemberMove]: { channel: VoiceBasedChannel | { id: Snowflake }; count: number };
|
||||
[AuditLogEvent.MessageDelete]: { channel: GuildTextBasedChannel | { id: Snowflake }; count: number };
|
||||
[AuditLogEvent.MessageBulkDelete]: { channel: GuildTextBasedChannel | { id: Snowflake }; count: number };
|
||||
[AuditLogEvent.MessageBulkDelete]: { count: number };
|
||||
[AuditLogEvent.MessagePin]: { channel: GuildTextBasedChannel | { id: Snowflake }; messageId: Snowflake };
|
||||
[AuditLogEvent.MessageUnpin]: { channel: GuildTextBasedChannel | { id: Snowflake }; messageId: Snowflake };
|
||||
[AuditLogEvent.MemberDisconnect]: { count: number };
|
||||
@@ -6395,12 +6402,14 @@ export interface GuildAuditLogsEntryExtraField {
|
||||
};
|
||||
}
|
||||
|
||||
export interface GuildAuditLogsEntryTargetField<TActionType extends GuildAuditLogsActionType> {
|
||||
User: User | null;
|
||||
export interface GuildAuditLogsEntryTargetField<TAction extends AuditLogEvent> {
|
||||
User: User | PartialUser | null;
|
||||
Guild: Guild;
|
||||
Webhook: Webhook<WebhookType.ChannelFollower | WebhookType.Incoming>;
|
||||
Invite: Invite;
|
||||
Message: TActionType extends AuditLogEvent.MessageBulkDelete ? Guild | { id: Snowflake } : User;
|
||||
Emoji: GuildEmoji | { id: Snowflake };
|
||||
Role: Role | { id: Snowflake };
|
||||
Message: TAction extends AuditLogEvent.MessageBulkDelete ? GuildTextBasedChannel | { id: Snowflake } : User | null;
|
||||
Integration: Integration;
|
||||
Channel: NonThreadGuildBasedChannel | { id: Snowflake; [x: string]: unknown };
|
||||
Thread: AnyThreadChannel | { id: Snowflake; [x: string]: unknown };
|
||||
@@ -6409,7 +6418,8 @@ export interface GuildAuditLogsEntryTargetField<TActionType extends GuildAuditLo
|
||||
GuildScheduledEvent: GuildScheduledEvent;
|
||||
ApplicationCommand: ApplicationCommand | { id: Snowflake };
|
||||
AutoModerationRule: AutoModerationRule;
|
||||
GuildOnboardingPrompt: GuildOnboardingPrompt;
|
||||
GuildOnboardingPrompt: GuildOnboardingPrompt | { id: Snowflake; [x: string]: unknown };
|
||||
SoundboardSound: SoundboardSound | { id: Snowflake };
|
||||
}
|
||||
|
||||
export interface GuildAuditLogsFetchOptions<Event extends GuildAuditLogsResolvable> {
|
||||
@@ -6422,10 +6432,10 @@ export interface GuildAuditLogsFetchOptions<Event extends GuildAuditLogsResolvab
|
||||
|
||||
export type GuildAuditLogsResolvable = AuditLogEvent | null;
|
||||
|
||||
export type GuildAuditLogsTargetType = GuildAuditLogsTypes[keyof GuildAuditLogsTypes][0] | 'All' | 'Unknown';
|
||||
export type GuildAuditLogsTargetType = GuildAuditLogsTypes[keyof GuildAuditLogsTypes][0] | 'Unknown';
|
||||
|
||||
export type GuildAuditLogsTargets = {
|
||||
[Key in GuildAuditLogsTargetType]: GuildAuditLogsTargetType;
|
||||
[Key in GuildAuditLogsTargetType]: Key;
|
||||
};
|
||||
|
||||
export type GuildBanResolvable = GuildBan | UserResolvable;
|
||||
@@ -7034,7 +7044,12 @@ export interface MessageEditAttachmentData {
|
||||
export interface MessageEditOptions extends Omit<BaseMessageOptions, 'content'> {
|
||||
content?: string | null;
|
||||
attachments?: readonly (Attachment | MessageEditAttachmentData)[];
|
||||
flags?: BitFieldResolvable<Extract<MessageFlagsString, 'SuppressEmbeds'>, MessageFlags.SuppressEmbeds> | undefined;
|
||||
flags?:
|
||||
| BitFieldResolvable<
|
||||
Extract<MessageFlagsString, 'SuppressEmbeds' | 'IsComponentsV2'>,
|
||||
MessageFlags.SuppressEmbeds | MessageFlags.IsComponentsV2
|
||||
>
|
||||
| undefined;
|
||||
}
|
||||
|
||||
export type MessageReactionResolvable = MessageReaction | Snowflake | string;
|
||||
@@ -7550,6 +7565,7 @@ export interface WebhookEditOptions {
|
||||
|
||||
export interface WebhookMessageEditOptions extends MessageEditOptions {
|
||||
threadId?: Snowflake;
|
||||
withComponents?: boolean;
|
||||
}
|
||||
|
||||
export interface InteractionEditReplyOptions
|
||||
@@ -7569,6 +7585,7 @@ export interface WebhookMessageCreateOptions
|
||||
threadId?: Snowflake;
|
||||
threadName?: string;
|
||||
appliedTags?: readonly Snowflake[];
|
||||
withComponents?: boolean;
|
||||
}
|
||||
|
||||
export interface WebSocketOptions {
|
||||
|
||||
@@ -2272,7 +2272,7 @@ expectType<Promise<GuildAuditLogs<AuditLogEvent.IntegrationUpdate>>>(
|
||||
guild.fetchAuditLogs({ type: AuditLogEvent.IntegrationUpdate }),
|
||||
);
|
||||
|
||||
expectType<Promise<GuildAuditLogs<null>>>(guild.fetchAuditLogs({ type: null }));
|
||||
expectType<Promise<GuildAuditLogs<AuditLogEvent>>>(guild.fetchAuditLogs({ type: null }));
|
||||
expectType<Promise<GuildAuditLogs<AuditLogEvent>>>(guild.fetchAuditLogs());
|
||||
|
||||
expectType<Promise<GuildAuditLogsEntry<AuditLogEvent.MemberKick, 'Delete', 'User'> | undefined>>(
|
||||
@@ -2282,10 +2282,10 @@ expectAssignable<Promise<GuildAuditLogsEntry<AuditLogEvent.MemberKick, 'Delete',
|
||||
guild.fetchAuditLogs({ type: AuditLogEvent.MemberKick }).then(al => al.entries.first()),
|
||||
);
|
||||
|
||||
expectType<Promise<GuildAuditLogsEntry<null, GuildAuditLogsActionType, GuildAuditLogsTargetType> | undefined>>(
|
||||
expectType<Promise<GuildAuditLogsEntry<AuditLogEvent, GuildAuditLogsActionType, GuildAuditLogsTargetType> | undefined>>(
|
||||
guild.fetchAuditLogs({ type: null }).then(al => al.entries.first()),
|
||||
);
|
||||
expectType<Promise<GuildAuditLogsEntry<null, GuildAuditLogsActionType, GuildAuditLogsTargetType> | undefined>>(
|
||||
expectType<Promise<GuildAuditLogsEntry<AuditLogEvent, GuildAuditLogsActionType, GuildAuditLogsTargetType> | undefined>>(
|
||||
guild.fetchAuditLogs().then(al => al.entries.first()),
|
||||
);
|
||||
|
||||
@@ -2304,15 +2304,18 @@ expectType<Promise<{ channel: GuildTextBasedChannel | { id: Snowflake }; count:
|
||||
guild.fetchAuditLogs({ type: AuditLogEvent.MessageDelete }).then(al => al.entries.first()?.extra),
|
||||
);
|
||||
|
||||
expectType<Promise<User | null | undefined>>(
|
||||
expectType<Promise<User | PartialUser | null | undefined>>(
|
||||
guild.fetchAuditLogs({ type: AuditLogEvent.MemberKick }).then(al => al.entries.first()?.target),
|
||||
);
|
||||
expectType<Promise<StageInstance | undefined>>(
|
||||
guild.fetchAuditLogs({ type: AuditLogEvent.StageInstanceCreate }).then(al => al.entries.first()?.target),
|
||||
);
|
||||
expectType<Promise<User | undefined>>(
|
||||
expectType<Promise<User | null | undefined>>(
|
||||
guild.fetchAuditLogs({ type: AuditLogEvent.MessageDelete }).then(al => al.entries.first()?.target),
|
||||
);
|
||||
expectType<Promise<GuildTextBasedChannel | { id: string } | undefined>>(
|
||||
guild.fetchAuditLogs({ type: AuditLogEvent.MessageBulkDelete }).then(al => al.entries.first()?.target),
|
||||
);
|
||||
|
||||
declare const AuditLogChange: AuditLogChange;
|
||||
// @ts-expect-error
|
||||
|
||||
3266
pnpm-lock.yaml
generated
3266
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user