mirror of
https://github.com/discordjs/discord.js.git
synced 2026-05-23 12:00:09 +00:00
Compare commits
32 Commits
@discordjs
...
@discordjs
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f65ff060ae | ||
|
|
835c4496ab | ||
|
|
a589c6d492 | ||
|
|
fdf0b8455c | ||
|
|
3f9c3dc497 | ||
|
|
437b2d459d | ||
|
|
5b8a08ebb6 | ||
|
|
22e013b3e9 | ||
|
|
e133aa9a1e | ||
|
|
c1b5242d2f | ||
|
|
9779baea84 | ||
|
|
a5437a41f3 | ||
|
|
11dd1c0666 | ||
|
|
95fae30606 | ||
|
|
93eeaeb56b | ||
|
|
886a701251 | ||
|
|
6dc0b7c18a | ||
|
|
c4eba873ea | ||
|
|
5c023bd64b | ||
|
|
e7cc754fd3 | ||
|
|
6e32ee565f | ||
|
|
c6710e56cc | ||
|
|
5761f2cbfd | ||
|
|
dd9ba1ad9d | ||
|
|
0b0abfa283 | ||
|
|
419266d839 | ||
|
|
5e7ba2a016 | ||
|
|
efd6b36227 | ||
|
|
66774c1b53 | ||
|
|
728c2686bd | ||
|
|
1bafba3fff | ||
|
|
a193147f96 |
@@ -7,7 +7,6 @@
|
||||
"always",
|
||||
["chore", "build", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test", "types"]
|
||||
],
|
||||
"scope-case": [0],
|
||||
"subject-exclamation-mark": [0]
|
||||
"scope-case": [0]
|
||||
}
|
||||
}
|
||||
|
||||
3
.github/COMMIT_CONVENTION.md
vendored
3
.github/COMMIT_CONVENTION.md
vendored
@@ -7,7 +7,7 @@
|
||||
Messages must be matched by the following regex:
|
||||
|
||||
```js
|
||||
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|build|ci|chore|types)(\(.+\))?!?: .{1,72}/;
|
||||
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|build|ci|chore|types)(\(.+\))?: .{1,72}/;
|
||||
```
|
||||
|
||||
#### Examples
|
||||
@@ -55,7 +55,6 @@ A commit message consists of a **header**, **body** and **footer**. The header h
|
||||
```
|
||||
|
||||
The **header** is mandatory and the **scope** of the header is optional.
|
||||
If the commit contains **Breaking Changes**, a `!` can be added before the `:` as an indicator.
|
||||
|
||||
### Revert
|
||||
|
||||
|
||||
2
.github/workflows/documentation.yml
vendored
2
.github/workflows/documentation.yml
vendored
@@ -75,7 +75,7 @@ jobs:
|
||||
|
||||
- name: Apply tag to api-extractor config
|
||||
if: ${{ env.REF_TYPE == 'tag' && !inputs.ref }}
|
||||
run: sed -i 's!https://github.com/discordjs/discord.js/tree/main!https://github.com/discordjs/discord.js/tree/${{ github.ref_name }}!' "packages/${{ steps.extract-tag.outputs.package}}/api-extractor.json"
|
||||
run: sed -i 's!https://github.com/discordjs/discord.js/tree/main!https://github.com/discordjs/discord.js/tree/${{ steps.extract-tag.outputs.semver }}!' "packages/${{ steps.extract-tag.outputs.package}}/api-extractor.json"
|
||||
|
||||
- name: Build docs
|
||||
run: pnpm run docs
|
||||
|
||||
2
.github/workflows/pr-triage.yml
vendored
2
.github/workflows/pr-triage.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
env:
|
||||
TITLE: ${{ github.event.pull_request.title }}
|
||||
run: |
|
||||
REGEX="^(revert: )?(feat|fix|docs|style|refactor|perf|test|build|ci|chore|types)(\\(.+\\))?!?: .{1,72}$"
|
||||
REGEX="^(revert: )?(feat|fix|docs|style|refactor|perf|test|build|ci|chore|types)(\\(.+\\))?: .{1,72}$"
|
||||
|
||||
echo "Title: \"$TITLE\""
|
||||
|
||||
|
||||
2
.github/workflows/publish-dev.yml
vendored
2
.github/workflows/publish-dev.yml
vendored
@@ -72,7 +72,7 @@ jobs:
|
||||
- name: Publish package
|
||||
if: steps.release-check.outputs.release == '1'
|
||||
run: |
|
||||
pnpm --filter=${{ matrix.package }} run release --preid "dev.$(date +%s)-$(git rev-parse --short HEAD)" --skip-changelog
|
||||
pnpm --filter=${{ matrix.package }} run release --preid "dev.$(date +%s)-$(git rev-parse --short HEAD)"
|
||||
pnpm --filter=${{ matrix.package }} publish --provenance --no-git-checks --tag dev || true
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
<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://github.com/discordjs/discord.js/commits/main"><img src="https://img.shields.io/github/last-commit/discordjs/discord.js.svg?logo=github&logoColor=ffffff" alt="Last commit." /></a>
|
||||
<a href="https://github.com/discordjs/discord.js/graphs/contributors"><img src="https://img.shields.io/github/contributors/discordjs/discord.js.svg?maxAge=3600&logo=github&logoColor=fff&color=00c7be" alt="contributors" /></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>
|
||||
<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>
|
||||
|
||||
@@ -69,14 +69,14 @@
|
||||
"@testing-library/react": "^15.0.7",
|
||||
"@testing-library/user-event": "^14.5.2",
|
||||
"@types/html-escaper": "^3.0.2",
|
||||
"@types/node": "^18.19.45",
|
||||
"@types/node": "18.18.8",
|
||||
"@types/react": "^18.3.3",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@unocss/eslint-plugin": "^0.60.4",
|
||||
"@unocss/postcss": "^0.60.4",
|
||||
"@unocss/reset": "^0.60.4",
|
||||
"@vitejs/plugin-react": "^4.3.0",
|
||||
"@vitest/coverage-v8": "^2.0.5",
|
||||
"@vitest/coverage-v8": "^1.6.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-neon": "^0.1.62",
|
||||
@@ -86,12 +86,12 @@
|
||||
"hastscript": "^8.0.0",
|
||||
"html-escaper": "^3.0.3",
|
||||
"postcss": "^8.4.38",
|
||||
"prettier": "^3.3.3",
|
||||
"turbo": "^2.0.14",
|
||||
"typescript": "~5.5.4",
|
||||
"prettier": "^3.3.0",
|
||||
"turbo": "^1.13.3",
|
||||
"typescript": "^5.4.5",
|
||||
"unocss": "^0.60.4",
|
||||
"vercel": "^37.0.0",
|
||||
"vitest": "^2.0.5"
|
||||
"vercel": "^34.2.4",
|
||||
"vitest": "^1.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
@@ -50,9 +50,10 @@
|
||||
"@radix-ui/react-collapsible": "^1.0.3",
|
||||
"@react-icons/all-files": "^4.1.0",
|
||||
"@vercel/analytics": "^1.3.1",
|
||||
"@vercel/blob": "^0.23.3",
|
||||
"@vercel/edge-config": "^1.1.1",
|
||||
"@vercel/og": "^0.6.2",
|
||||
"@vercel/postgres": "^0.9.0",
|
||||
"@vercel/postgres": "^0.8.0",
|
||||
"cmdk": "^1.0.0",
|
||||
"geist": "^1.3.0",
|
||||
"jotai": "^2.8.2",
|
||||
@@ -75,11 +76,11 @@
|
||||
"@tailwindcss/typography": "^0.5.13",
|
||||
"@testing-library/react": "^15.0.7",
|
||||
"@testing-library/user-event": "^14.5.2",
|
||||
"@types/node": "^18.19.45",
|
||||
"@types/node": "18.18.8",
|
||||
"@types/react": "^18.3.3",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@vitejs/plugin-react": "^4.3.0",
|
||||
"@vitest/coverage-v8": "^2.0.5",
|
||||
"@vitest/coverage-v8": "^1.6.0",
|
||||
"autoprefixer": "^10.4.19",
|
||||
"babel-plugin-react-compiler": "0.0.0-experimental-592953e-20240517",
|
||||
"cpy-cli": "^5.0.0",
|
||||
@@ -89,16 +90,16 @@
|
||||
"eslint-formatter-pretty": "^6.0.1",
|
||||
"happy-dom": "^14.12.0",
|
||||
"postcss": "^8.4.38",
|
||||
"prettier": "^3.3.3",
|
||||
"prettier": "^3.3.0",
|
||||
"prettier-plugin-tailwindcss": "^0.5.14",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"remark-rehype": "^11.1.0",
|
||||
"shiki": "^1.6.2",
|
||||
"tailwindcss": "^3.4.3",
|
||||
"turbo": "^2.0.14",
|
||||
"typescript": "~5.5.4",
|
||||
"vercel": "^37.0.0",
|
||||
"vitest": "^2.0.5"
|
||||
"turbo": "^1.13.3",
|
||||
"typescript": "^5.4.5",
|
||||
"vercel": "^34.2.4",
|
||||
"vitest": "^1.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
@@ -18,9 +18,8 @@ export async function Badges({ node }: { readonly node: any }) {
|
||||
const isAbstract = node.isAbstract;
|
||||
const isReadonly = node.isReadonly;
|
||||
const isOptional = node.isOptional;
|
||||
const isExternal = node.isExternal;
|
||||
|
||||
const isAny = isDeprecated || isProtected || isStatic || isAbstract || isReadonly || isOptional || isExternal;
|
||||
const isAny = isDeprecated || isProtected || isStatic || isAbstract || isReadonly || isOptional;
|
||||
|
||||
return isAny ? (
|
||||
<div className="mb-1 flex gap-3">
|
||||
@@ -34,7 +33,6 @@ export async function Badges({ node }: { readonly node: any }) {
|
||||
{isAbstract ? <Badge className="bg-cyan-500/20 text-cyan-500">abstract</Badge> : null}
|
||||
{isReadonly ? <Badge className="bg-purple-500/20 text-purple-500">readonly</Badge> : null}
|
||||
{isOptional ? <Badge className="bg-cyan-500/20 text-cyan-500">optional</Badge> : null}
|
||||
{isExternal ? <Badge className="bg-purple-500/20 text-purple-500">external</Badge> : null}
|
||||
</div>
|
||||
) : null;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { BuiltinDocumentationLinks } from '~/util/builtinDocumentationLinks';
|
||||
|
||||
export async function ExcerptNode({ node, version }: { readonly node?: any; readonly version: string }) {
|
||||
const createExcerpt = (excerpts: any) => {
|
||||
const excerpt = Array.isArray(excerpts) ? excerpts : (excerpts.excerpts ?? [excerpts]);
|
||||
const excerpt = Array.isArray(excerpts) ? excerpts : excerpts.excerpts ?? [excerpts];
|
||||
|
||||
return (
|
||||
<span
|
||||
|
||||
@@ -29,7 +29,6 @@ export async function ParameterNode({
|
||||
{description ? <Badges node={parameter} /> : null}
|
||||
{parameter.name}
|
||||
{parameter.isOptional ? '?' : ''}: <ExcerptNode node={parameter.typeExcerpt} version={version} />
|
||||
{parameter.defaultValue ? ` = ${parameter.defaultValue}` : ''}
|
||||
</span>
|
||||
{description && parameter.description?.length ? (
|
||||
<div className="mt-4 pl-4">
|
||||
|
||||
@@ -51,13 +51,7 @@ export async function PropertyNode({
|
||||
<LinkIcon aria-hidden size={16} />
|
||||
</Link>
|
||||
{property.displayName}
|
||||
{property.isOptional ? '?' : ''} : <ExcerptNode node={property.typeExcerpt} version={version} />{' '}
|
||||
{property.summary?.defaultValueBlock.length
|
||||
? `= ${property.summary.defaultValueBlock.reduce(
|
||||
(acc: string, def: { kind: string; text: string }) => `${acc}${def.text}`,
|
||||
'',
|
||||
)}`
|
||||
: ''}
|
||||
{property.isOptional ? '?' : ''} : <ExcerptNode node={property.typeExcerpt} version={version} />
|
||||
</span>
|
||||
</h3>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ export async function fetchDependencies({
|
||||
|
||||
return Object.entries<string>(parsedDependencies)
|
||||
.filter(([key]) => key.startsWith('@discordjs/') && !key.includes('api-extractor'))
|
||||
.map(([key, value]) => `${key.replace('@discordjs/', '').replaceAll('.', '-')}-${sanitizeVersion(value)}`);
|
||||
.map(([key, value]) => `${key.replace('@discordjs/', '').replaceAll('.', '-')}-${value.replaceAll('.', '-')}`);
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
@@ -36,12 +36,8 @@ export async function fetchDependencies({
|
||||
|
||||
return Object.entries<string>(parsedDependencies)
|
||||
.filter(([key]) => key.startsWith('@discordjs/') && !key.includes('api-extractor'))
|
||||
.map(([key, value]) => `${key.replace('@discordjs/', '').replaceAll('.', '-')}-${sanitizeVersion(value)}`);
|
||||
.map(([key, value]) => `${key.replace('@discordjs/', '').replaceAll('.', '-')}-${value.replaceAll('.', '-')}`);
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
function sanitizeVersion(version: string) {
|
||||
return version.replaceAll('.', '-').replace(/^[\^~]/, '');
|
||||
}
|
||||
|
||||
42
package.json
42
package.json
@@ -6,19 +6,19 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "turbo run build --concurrency=4",
|
||||
"build:affected": "turbo run build --filter=...[origin/v14] --concurrency=4",
|
||||
"build:affected": "turbo run build --filter=...[origin/main] --concurrency=4",
|
||||
"build:apps": "turbo run build:local --filter=...{apps/*} --concurrency=4",
|
||||
"build:apps:affected": "turbo run build:local --filter=...{apps/*}[origin/v14] --concurrency=4",
|
||||
"build:apps:affected": "turbo run build:local --filter=...{apps/*}[origin/main] --concurrency=4",
|
||||
"test": "turbo run test --concurrency=4",
|
||||
"test:affected": "turbo run test --filter=...[origin/v14] --concurrency=4",
|
||||
"test:affected": "turbo run test --filter=...[origin/main] --concurrency=4",
|
||||
"lint": "turbo run lint --concurrency=4",
|
||||
"lint:affected": "turbo run lint --filter=...[origin/v14] --concurrency=4",
|
||||
"lint:affected": "turbo run lint --filter=...[origin/main] --concurrency=4",
|
||||
"format": "turbo run format --concurrency=4",
|
||||
"format:affected": "turbo run format --filter=...[origin/v14] --concurrency=4",
|
||||
"format:affected": "turbo run format --filter=...[origin/main] --concurrency=4",
|
||||
"fmt": "turbo run format --concurrency=4",
|
||||
"fmt:affected": "turbo run format --filter=...[origin/v14] --concurrency=4",
|
||||
"fmt:affected": "turbo run format --filter=...[origin/main] --concurrency=4",
|
||||
"docs": "turbo run docs --concurrency=4",
|
||||
"docs:affected": "turbo run docs --filter=...[origin/v14] --concurrency=4",
|
||||
"docs:affected": "turbo run docs --filter=...[origin/main] --concurrency=4",
|
||||
"prepare": "is-ci || husky",
|
||||
"update": "pnpm --recursive update --interactive",
|
||||
"update:latest": "pnpm --recursive update --interactive --latest",
|
||||
@@ -28,7 +28,7 @@
|
||||
"contributors": [
|
||||
"Crawl <icrawltogo@gmail.com>",
|
||||
"Amish Shah <amishshah.2k@gmail.com>",
|
||||
"Vlad Frangu <me@vladfrangu.dev>",
|
||||
"Vlad Frangu <kingdgrizzle@gmail.com>",
|
||||
"SpaceEEC <spaceeec@yahoo.com>",
|
||||
"Aura Román <kyradiscord@gmail.com>"
|
||||
],
|
||||
@@ -50,28 +50,28 @@
|
||||
"homepage": "https://discord.js.org",
|
||||
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^19.4.0",
|
||||
"@commitlint/cli": "^19.3.0",
|
||||
"@commitlint/config-angular": "^19.3.0",
|
||||
"@favware/cliff-jumper": "^4.1.0",
|
||||
"@favware/cliff-jumper": "^3.0.3",
|
||||
"@favware/npm-deprecate": "^1.0.7",
|
||||
"@types/lodash.merge": "^4.6.9",
|
||||
"@unocss/eslint-plugin": "^0.59.4",
|
||||
"@vitest/coverage-v8": "^2.0.5",
|
||||
"@vitest/coverage-v8": "^1.6.0",
|
||||
"conventional-changelog-cli": "^4.1.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-neon": "^0.1.62",
|
||||
"husky": "^9.1.5",
|
||||
"husky": "^9.0.11",
|
||||
"is-ci": "^3.0.1",
|
||||
"lint-staged": "^15.2.9",
|
||||
"lint-staged": "^15.2.5",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"prettier": "^3.3.3",
|
||||
"tsup": "^8.2.4",
|
||||
"turbo": "^2.0.14",
|
||||
"typescript": "~5.5.4",
|
||||
"typescript-eslint": "^8.2.0",
|
||||
"prettier": "^3.3.0",
|
||||
"tsup": "^8.1.0",
|
||||
"turbo": "^1.13.3",
|
||||
"typescript": "^5.4.5",
|
||||
"typescript-eslint": "^7.11.0",
|
||||
"unocss": "^0.60.4",
|
||||
"vercel": "^37.0.0",
|
||||
"vitest": "^2.0.5"
|
||||
"vercel": "^34.2.4",
|
||||
"vitest": "^1.6.0"
|
||||
},
|
||||
"pnpm": {
|
||||
"peerDependencyRules": {
|
||||
@@ -97,5 +97,5 @@
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"packageManager": "pnpm@9.8.0"
|
||||
"packageManager": "pnpm@9.1.4"
|
||||
}
|
||||
|
||||
@@ -42,27 +42,27 @@
|
||||
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.1",
|
||||
"@actions/glob": "^0.5.0",
|
||||
"@actions/glob": "^0.4.0",
|
||||
"@discordjs/scripts": "workspace:^",
|
||||
"@vercel/blob": "^0.23.4",
|
||||
"@vercel/postgres": "^0.9.0",
|
||||
"@vercel/blob": "^0.22.3",
|
||||
"@vercel/postgres": "^0.8.0",
|
||||
"meilisearch": "^0.38.0",
|
||||
"p-limit": "^6.1.0",
|
||||
"tslib": "^2.6.3",
|
||||
"undici": "6.21.1"
|
||||
"p-limit": "^5.0.0",
|
||||
"tslib": "^2.6.2",
|
||||
"undici": "6.18.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.19.45",
|
||||
"@vitest/coverage-v8": "^2.0.5",
|
||||
"@types/node": "18.18.8",
|
||||
"@vitest/coverage-v8": "^1.6.0",
|
||||
"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.3.0",
|
||||
"tsup": "^8.1.0",
|
||||
"turbo": "^1.13.3",
|
||||
"typescript": "^5.4.5",
|
||||
"vitest": "^1.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
@@ -4,7 +4,7 @@ export function formatTag(tag: string) {
|
||||
|
||||
if (parsed?.groups) {
|
||||
const isSubpackage = typeof parsed.groups.package === 'string';
|
||||
const pkg = isSubpackage ? parsed.groups.package : (parsedPackage?.groups?.package ?? 'discord.js');
|
||||
const pkg = isSubpackage ? parsed.groups.package : parsedPackage?.groups?.package ?? 'discord.js';
|
||||
const semver = parsed.groups.semver;
|
||||
|
||||
return {
|
||||
|
||||
@@ -8,7 +8,6 @@ runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Upload Guide Coverage
|
||||
if: ${{ hashFiles('apps/guide/coverage/cobertura-coverage.xml') != '' }}
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./apps/guide/coverage/cobertura-coverage.xml
|
||||
@@ -17,7 +16,6 @@ runs:
|
||||
token: ${{ inputs.CODECOV_TOKEN }}
|
||||
|
||||
- name: Upload Website Coverage
|
||||
if: ${{ hashFiles('apps/website/coverage/cobertura-coverage.xml') != '' }}
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./apps/website/coverage/cobertura-coverage.xml
|
||||
@@ -26,7 +24,6 @@ runs:
|
||||
token: ${{ inputs.CODECOV_TOKEN }}
|
||||
|
||||
- name: Upload Brokers Coverage
|
||||
if: ${{ hashFiles('packages/brokers/coverage/cobertura-coverage.xml') != '' }}
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./packages/brokers/coverage/cobertura-coverage.xml
|
||||
@@ -35,7 +32,6 @@ runs:
|
||||
token: ${{ inputs.CODECOV_TOKEN }}
|
||||
|
||||
- name: Upload Builders Coverage
|
||||
if: ${{ hashFiles('packages/builders/coverage/cobertura-coverage.xml') != '' }}
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./packages/builders/coverage/cobertura-coverage.xml
|
||||
@@ -44,7 +40,6 @@ runs:
|
||||
token: ${{ inputs.CODECOV_TOKEN }}
|
||||
|
||||
- name: Upload Collection Coverage
|
||||
if: ${{ hashFiles('packages/collection/coverage/cobertura-coverage.xml') != '' }}
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./packages/collection/coverage/cobertura-coverage.xml
|
||||
@@ -53,7 +48,6 @@ runs:
|
||||
token: ${{ inputs.CODECOV_TOKEN }}
|
||||
|
||||
- name: Upload Discord.js Coverage
|
||||
if: ${{ hashFiles('packages/discord.js/coverage/cobertura-coverage.xml') != '' }}
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./packages/discord.js/coverage/cobertura-coverage.xml
|
||||
@@ -62,7 +56,6 @@ runs:
|
||||
token: ${{ inputs.CODECOV_TOKEN }}
|
||||
|
||||
- name: Upload Formatters Coverage
|
||||
if: ${{ hashFiles('packages/formatters/coverage/cobertura-coverage.xml') != '' }}
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./packages/formatters/coverage/cobertura-coverage.xml
|
||||
@@ -71,7 +64,6 @@ runs:
|
||||
token: ${{ inputs.CODECOV_TOKEN }}
|
||||
|
||||
- name: Upload Next Coverage
|
||||
if: ${{ hashFiles('packages/next/coverage/cobertura-coverage.xml') != '' }}
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./packages/next/coverage/cobertura-coverage.xml
|
||||
@@ -80,7 +72,6 @@ runs:
|
||||
token: ${{ inputs.CODECOV_TOKEN }}
|
||||
|
||||
- name: Upload Proxy Coverage
|
||||
if: ${{ hashFiles('packages/proxy/coverage/cobertura-coverage.xml') != '' }}
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./packages/proxy/coverage/cobertura-coverage.xml
|
||||
@@ -89,7 +80,6 @@ runs:
|
||||
token: ${{ inputs.CODECOV_TOKEN }}
|
||||
|
||||
- name: Upload Rest Coverage
|
||||
if: ${{ hashFiles('packages/rest/coverage/cobertura-coverage.xml') != '' }}
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./packages/rest/coverage/cobertura-coverage.xml
|
||||
@@ -98,7 +88,6 @@ runs:
|
||||
token: ${{ inputs.CODECOV_TOKEN }}
|
||||
|
||||
- name: Upload Voice Coverage
|
||||
if: ${{ hashFiles('packages/voice/coverage/cobertura-coverage.xml') != '' }}
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./packages/voice/coverage/cobertura-coverage.xml
|
||||
@@ -107,7 +96,6 @@ runs:
|
||||
token: ${{ inputs.CODECOV_TOKEN }}
|
||||
|
||||
- name: Upload WS Coverage
|
||||
if: ${{ hashFiles('packages/ws/coverage/cobertura-coverage.xml') != '' }}
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./packages/ws/coverage/cobertura-coverage.xml
|
||||
@@ -116,7 +104,6 @@ runs:
|
||||
token: ${{ inputs.CODECOV_TOKEN }}
|
||||
|
||||
- name: Upload Util Coverage
|
||||
if: ${{ hashFiles('packages/util/coverage/cobertura-coverage.xml') != '' }}
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./packages/util/coverage/cobertura-coverage.xml
|
||||
@@ -125,7 +112,6 @@ runs:
|
||||
token: ${{ inputs.CODECOV_TOKEN }}
|
||||
|
||||
- name: Upload Utilities Coverage
|
||||
if: ${{ hashFiles('packages/actions/coverage/cobertura-coverage.xml') != '' || hashFiles('packages/scripts/coverage/cobertura-coverage.xml') != '' }}
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./packages/actions/coverage/cobertura-coverage.xml, ./packages/scripts/coverage/cobertura-coverage.xml
|
||||
|
||||
@@ -53,6 +53,7 @@ try {
|
||||
console.log('Uploading indices...');
|
||||
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
promises = indices.map(async (index) =>
|
||||
limit(async () => {
|
||||
console.log(`Uploading ${index.index}...`);
|
||||
|
||||
@@ -37,15 +37,14 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/node": "^18.19.45",
|
||||
"@types/node": "^18.19.33",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-neon": "^0.1.62",
|
||||
"eslint-formatter-pretty": "^6.0.1",
|
||||
"jest": "^29.7.0",
|
||||
"prettier": "^3.3.3",
|
||||
"tsup": "^8.2.4",
|
||||
"turbo": "^2.0.14",
|
||||
"typescript": "~5.5.4"
|
||||
"prettier": "^3.3.0",
|
||||
"tsup": "^8.1.0",
|
||||
"turbo": "^1.13.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import type { IExcerptTokenRange } from './Excerpt.js';
|
||||
* @public
|
||||
*/
|
||||
export interface IApiParameterOptions {
|
||||
defaultValue: string | undefined;
|
||||
isOptional: boolean;
|
||||
isRest: boolean;
|
||||
parameterName: string;
|
||||
@@ -125,7 +124,6 @@ export function ApiParameterListMixin<TBaseClass extends IApiItemConstructor>(
|
||||
isOptional: Boolean(parameterOptions.isOptional),
|
||||
isRest: Boolean(parameterOptions.isRest),
|
||||
parent: this,
|
||||
defaultValue: parameterOptions.defaultValue,
|
||||
});
|
||||
|
||||
this[_parameters].push(parameter);
|
||||
@@ -173,7 +171,6 @@ export function ApiParameterListMixin<TBaseClass extends IApiItemConstructor>(
|
||||
parameterTypeTokenRange: parameter.parameterTypeExcerpt.tokenRange,
|
||||
isOptional: parameter.isOptional,
|
||||
isRest: parameter.isRest,
|
||||
defaultValue: parameter.defaultValue,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ const MinifyJSONMapping = {
|
||||
constraintTokenRange: 'ctr',
|
||||
dependencies: 'dp',
|
||||
defaultTypeTokenRange: 'dtr',
|
||||
defaultValue: 'dv',
|
||||
docComment: 'd',
|
||||
endIndex: 'en',
|
||||
excerptTokens: 'ex',
|
||||
@@ -381,7 +380,7 @@ export class ApiPackage extends ApiItemContainerMixin(ApiNameMixin(ApiDocumented
|
||||
toolPackage: ioptions.toolPackage ?? packageJson.name,
|
||||
// In test mode, we don't write the real version, since that would cause spurious diffs whenever
|
||||
// the version is bumped. Instead we write a placeholder string.
|
||||
toolVersion: ioptions.testMode ? '[test mode]' : (ioptions.toolVersion ?? packageJson.version),
|
||||
toolVersion: ioptions.testMode ? '[test mode]' : ioptions.toolVersion ?? packageJson.version,
|
||||
schemaVersion: ApiJsonSchemaVersion.LATEST,
|
||||
oldestForwardsCompatibleVersion: ApiJsonSchemaVersion.OLDEST_FORWARDS_COMPATIBLE,
|
||||
tsdocConfig,
|
||||
|
||||
@@ -182,9 +182,7 @@ export interface DocgenJson {
|
||||
}
|
||||
|
||||
function formatVarType(type: DocgenVarTypeJson): string {
|
||||
return (Array.isArray(type) ? type : (type.types ?? []))
|
||||
.map((t1) => t1.map((t2) => t2.join('')).join(''))
|
||||
.join(' | ');
|
||||
return (Array.isArray(type) ? type : type.types ?? []).map((t1) => t1.map((t2) => t2.join('')).join('')).join(' | ');
|
||||
}
|
||||
|
||||
function getFirstType(type: DocgenVarTypeJson): string {
|
||||
@@ -194,7 +192,7 @@ function getFirstType(type: DocgenVarTypeJson): string {
|
||||
// function mapEvent(_event: DocgenEventJson, _package: string, _parent: DocgenClassJson): void {}
|
||||
|
||||
function mapVarType(type: DocgenVarTypeJson, _package: string): IExcerptToken[] {
|
||||
const mapper = Array.isArray(type) ? type : (type.types ?? []);
|
||||
const mapper = Array.isArray(type) ? type : type.types ?? [];
|
||||
return mapper.flatMap((typ) =>
|
||||
typ.reduce<IExcerptToken[]>(
|
||||
(arr, [_class, symbol]) => [
|
||||
@@ -262,7 +260,6 @@ function mapParam(
|
||||
startIndex: 1 + index + paramTokens.slice(0, index).reduce((akk, num) => akk + num, 0),
|
||||
endIndex: 1 + index + paramTokens.slice(0, index + 1).reduce((akk, num) => akk + num, 0),
|
||||
},
|
||||
defaultValue: param.default,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import type { Excerpt } from '../mixins/Excerpt.js';
|
||||
* @public
|
||||
*/
|
||||
export interface IParameterOptions {
|
||||
defaultValue: string | undefined;
|
||||
isOptional: boolean;
|
||||
isRest: boolean;
|
||||
name: string;
|
||||
@@ -57,11 +56,6 @@ export class Parameter {
|
||||
*/
|
||||
public isRest: boolean;
|
||||
|
||||
/**
|
||||
* The default value for this parameter if optional
|
||||
*/
|
||||
public defaultValue: string | undefined;
|
||||
|
||||
private readonly _parent: ApiParameterListMixin;
|
||||
|
||||
public constructor(options: IParameterOptions) {
|
||||
@@ -70,7 +64,6 @@ export class Parameter {
|
||||
this.isOptional = options.isOptional;
|
||||
this.isRest = options.isRest;
|
||||
this._parent = options.parent;
|
||||
this.defaultValue = options.defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,15 +50,15 @@
|
||||
"@microsoft/tsdoc": "0.14.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.19.45",
|
||||
"@types/node": "18.18.8",
|
||||
"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"
|
||||
"prettier": "^3.3.0",
|
||||
"tsup": "^8.1.0",
|
||||
"turbo": "^1.13.3",
|
||||
"typescript": "^5.4.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
@@ -199,7 +199,7 @@ export function genToken(model: ApiModel, token: ExcerptToken, version: string)
|
||||
}
|
||||
|
||||
const item = token.canonicalReference
|
||||
? (model.resolveDeclarationReference(token.canonicalReference, undefined).resolvedApiItem ?? null)
|
||||
? model.resolveDeclarationReference(token.canonicalReference, undefined).resolvedApiItem ?? null
|
||||
: null;
|
||||
|
||||
return {
|
||||
|
||||
@@ -61,12 +61,12 @@
|
||||
"resolve": "~1.22.1",
|
||||
"semver": "~7.5.4",
|
||||
"source-map": "0.6.1",
|
||||
"typescript": "~5.5.4"
|
||||
"typescript": "^5.4.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/lodash": "^4.17.4",
|
||||
"@types/node": "^18.19.45",
|
||||
"@types/node": "^18.19.33",
|
||||
"@types/resolve": "^1.20.6",
|
||||
"@types/semver": "^7.5.8",
|
||||
"cpy-cli": "^5.0.0",
|
||||
@@ -75,8 +75,8 @@
|
||||
"eslint-config-neon": "^0.1.62",
|
||||
"eslint-formatter-pretty": "^6.0.1",
|
||||
"jest": "^29.7.0",
|
||||
"prettier": "^3.3.3",
|
||||
"tsup": "^8.2.4",
|
||||
"turbo": "^2.0.14"
|
||||
"prettier": "^3.3.0",
|
||||
"tsup": "^8.1.0",
|
||||
"turbo": "^1.13.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ interface DocgenEventJson {
|
||||
}
|
||||
|
||||
interface DocgenParamJson {
|
||||
default?: boolean | number | string;
|
||||
default?: string;
|
||||
description: string;
|
||||
name: string;
|
||||
nullable?: boolean;
|
||||
@@ -155,7 +155,7 @@ interface DocgenMethodJson {
|
||||
interface DocgenPropertyJson {
|
||||
abstract?: boolean;
|
||||
access?: DocgenAccess;
|
||||
default?: boolean | number | string;
|
||||
default?: string;
|
||||
deprecated?: DocgenDeprecated;
|
||||
description: string;
|
||||
meta: DocgenMetaJson;
|
||||
@@ -843,7 +843,6 @@ export class ApiModelGenerator {
|
||||
const parameters: IApiParameterOptions[] = this._captureParameters(
|
||||
nodesToCapture,
|
||||
functionDeclaration.parameters,
|
||||
jsDoc?.params,
|
||||
);
|
||||
|
||||
const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture);
|
||||
@@ -1044,7 +1043,6 @@ export class ApiModelGenerator {
|
||||
const parameters: IApiParameterOptions[] = this._captureParameters(
|
||||
nodesToCapture,
|
||||
methodDeclaration.parameters,
|
||||
jsDoc?.params,
|
||||
);
|
||||
|
||||
const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture);
|
||||
@@ -1139,11 +1137,7 @@ export class ApiModelGenerator {
|
||||
methodSignature.typeParameters,
|
||||
);
|
||||
|
||||
const parameters: IApiParameterOptions[] = this._captureParameters(
|
||||
nodesToCapture,
|
||||
methodSignature.parameters,
|
||||
jsDoc?.params,
|
||||
);
|
||||
const parameters: IApiParameterOptions[] = this._captureParameters(nodesToCapture, methodSignature.parameters);
|
||||
|
||||
const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture);
|
||||
const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
||||
@@ -1270,7 +1264,7 @@ export class ApiModelGenerator {
|
||||
const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
||||
const docComment: tsdoc.DocComment | undefined = jsDoc
|
||||
? this._tsDocParser.parseString(
|
||||
`/**\n * ${this._fixLinkTags(jsDoc.description) ?? ''}${jsDoc.default ? ` (default: ${this._escapeSpecialChars(jsDoc.default)})` : ''}\n${
|
||||
`/**\n * ${this._fixLinkTags(jsDoc.description) ?? ''}\n${
|
||||
'see' in jsDoc ? jsDoc.see.map((see) => ` * @see ${see}\n`).join('') : ''
|
||||
}${'readonly' in jsDoc && jsDoc.readonly ? ' * @readonly\n' : ''}${
|
||||
'deprecated' in jsDoc && jsDoc.deprecated
|
||||
@@ -1348,7 +1342,7 @@ export class ApiModelGenerator {
|
||||
const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
||||
const docComment: tsdoc.DocComment | undefined = jsDoc
|
||||
? this._tsDocParser.parseString(
|
||||
`/**\n * ${this._fixLinkTags(jsDoc.description) ?? ''}${jsDoc.default ? `\n * @defaultValue ${this._escapeSpecialChars(jsDoc.default)}` : ''}\n${
|
||||
`/**\n * ${this._fixLinkTags(jsDoc.description) ?? ''}\n${
|
||||
'see' in jsDoc ? jsDoc.see.map((see) => ` * @see ${see}\n`).join('') : ''
|
||||
}${'readonly' in jsDoc && jsDoc.readonly ? ' * @readonly\n' : ''}${
|
||||
'deprecated' in jsDoc && jsDoc.deprecated
|
||||
@@ -1429,9 +1423,7 @@ export class ApiModelGenerator {
|
||||
}${
|
||||
'returns' in jsDoc
|
||||
? jsDoc.returns
|
||||
.map(
|
||||
(ret) => ` * @returns ${Array.isArray(ret) ? '' : (this._fixLinkTags(ret.description) ?? '')}\n`,
|
||||
)
|
||||
.map((ret) => ` * @returns ${Array.isArray(ret) ? '' : this._fixLinkTags(ret.description) ?? ''}\n`)
|
||||
.join('')
|
||||
: ''
|
||||
} */`,
|
||||
@@ -1516,17 +1508,15 @@ export class ApiModelGenerator {
|
||||
const excerptTokens: IExcerptToken[] = [
|
||||
{
|
||||
kind: ExcerptTokenKind.Content,
|
||||
text: `public on(eventName: '${name}', listener: (${
|
||||
jsDoc.params?.length
|
||||
? `${jsDoc.params[0]?.name}${jsDoc.params[0]?.optional ? '?' : ''}: `
|
||||
: ') => void): this;'
|
||||
text: `on('${name}', (${
|
||||
jsDoc.params?.length ? `${jsDoc.params[0]?.name}${jsDoc.params[0]?.nullable ? '?' : ''}: ` : ') => {})'
|
||||
}`,
|
||||
},
|
||||
];
|
||||
const parameters: IApiParameterOptions[] = [];
|
||||
for (let index = 0; index < (jsDoc.params?.length ?? 0) - 1; index++) {
|
||||
const parameter = jsDoc.params![index]!;
|
||||
const newTokens = this._mapVarType(parameter.type, parameter.nullable);
|
||||
const newTokens = this._mapVarType(parameter.type);
|
||||
parameters.push({
|
||||
parameterName: parameter.name,
|
||||
parameterTypeTokenRange: {
|
||||
@@ -1535,7 +1525,6 @@ export class ApiModelGenerator {
|
||||
},
|
||||
isOptional: Boolean(parameter.optional),
|
||||
isRest: parameter.name.startsWith('...'),
|
||||
defaultValue: parameter.default?.toString(),
|
||||
});
|
||||
excerptTokens.push(...newTokens);
|
||||
excerptTokens.push({
|
||||
@@ -1546,7 +1535,7 @@ export class ApiModelGenerator {
|
||||
|
||||
if (jsDoc.params?.length) {
|
||||
const parameter = jsDoc.params![jsDoc.params.length - 1]!;
|
||||
const newTokens = this._mapVarType(parameter.type, parameter.nullable);
|
||||
const newTokens = this._mapVarType(parameter.type);
|
||||
parameters.push({
|
||||
parameterName: parameter.name,
|
||||
parameterTypeTokenRange: {
|
||||
@@ -1555,12 +1544,11 @@ export class ApiModelGenerator {
|
||||
},
|
||||
isOptional: Boolean(parameter.optional),
|
||||
isRest: parameter.name.startsWith('...'),
|
||||
defaultValue: parameter.default?.toString(),
|
||||
});
|
||||
excerptTokens.push(...newTokens);
|
||||
excerptTokens.push({
|
||||
kind: ExcerptTokenKind.Content,
|
||||
text: `) => void): this;`,
|
||||
text: `) => {})`,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1648,7 +1636,6 @@ export class ApiModelGenerator {
|
||||
private _captureParameters(
|
||||
nodesToCapture: IExcerptBuilderNodeToCapture[],
|
||||
parameterNodes: ts.NodeArray<ts.ParameterDeclaration>,
|
||||
jsDoc?: DocgenParamJson[] | undefined,
|
||||
): IApiParameterOptions[] {
|
||||
const parameters: IApiParameterOptions[] = [];
|
||||
for (const parameter of parameterNodes) {
|
||||
@@ -1659,9 +1646,6 @@ export class ApiModelGenerator {
|
||||
parameterTypeTokenRange,
|
||||
isOptional: this._collector.typeChecker.isOptionalParameter(parameter),
|
||||
isRest: Boolean(parameter.dotDotDotToken),
|
||||
defaultValue:
|
||||
parameter.initializer?.getText() ??
|
||||
jsDoc?.find((param) => param.name === parameter.name.getText().trim())?.default?.toString(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1760,14 +1744,6 @@ export class ApiModelGenerator {
|
||||
return sourceLocation;
|
||||
}
|
||||
|
||||
private _escapeSpecialChars(input: boolean | number | string) {
|
||||
if (typeof input !== 'string') {
|
||||
return input;
|
||||
}
|
||||
|
||||
return input.replaceAll(/(?<char>[@{}])/g, '\\$<char>');
|
||||
}
|
||||
|
||||
private _fixLinkTags(input?: string): string | undefined {
|
||||
return input
|
||||
?.replaceAll(linkRegEx, (_match, _p1, _p2, _p3, _p4, _p5, _offset, _string, groups) => {
|
||||
@@ -1787,8 +1763,8 @@ export class ApiModelGenerator {
|
||||
.replaceAll('* ', '\n * * ');
|
||||
}
|
||||
|
||||
private _mapVarType(typey: DocgenVarTypeJson, nullable?: boolean): IExcerptToken[] {
|
||||
const mapper = Array.isArray(typey) ? typey : (typey.types ?? []);
|
||||
private _mapVarType(typey: DocgenVarTypeJson): IExcerptToken[] {
|
||||
const mapper = Array.isArray(typey) ? typey : typey.types ?? [];
|
||||
const lookup: { [K in ts.SyntaxKind]?: string } = {
|
||||
[ts.SyntaxKind.ClassDeclaration]: 'class',
|
||||
[ts.SyntaxKind.EnumDeclaration]: 'enum',
|
||||
@@ -1812,40 +1788,23 @@ export class ApiModelGenerator {
|
||||
{
|
||||
kind: type?.includes("'") ? ExcerptTokenKind.Content : ExcerptTokenKind.Reference,
|
||||
text: fixPrimitiveTypes(type ?? 'unknown', symbol),
|
||||
canonicalReference:
|
||||
type?.includes("'") || !astEntity
|
||||
? undefined
|
||||
: DeclarationReference.package(pkg)
|
||||
.addNavigationStep(
|
||||
Navigation.Members as any,
|
||||
DeclarationReference.parseComponent(type ?? 'unknown'),
|
||||
)
|
||||
.withMeaning(
|
||||
(lookup[
|
||||
astSymbol?.astDeclarations.at(-1)?.declaration.kind ?? ts.SyntaxKind.ClassDeclaration
|
||||
] ?? 'class') as Meaning,
|
||||
)
|
||||
.toString(),
|
||||
canonicalReference: type?.includes("'")
|
||||
? undefined
|
||||
: DeclarationReference.package(pkg)
|
||||
.addNavigationStep(
|
||||
Navigation.Members as any,
|
||||
DeclarationReference.parseComponent(type ?? 'unknown'),
|
||||
)
|
||||
.withMeaning(
|
||||
(lookup[astSymbol?.astDeclarations.at(-1)?.declaration.kind ?? ts.SyntaxKind.ClassDeclaration] ??
|
||||
'class') as Meaning,
|
||||
)
|
||||
.toString(),
|
||||
},
|
||||
{ kind: ExcerptTokenKind.Content, text: symbol ?? '' },
|
||||
];
|
||||
}, []);
|
||||
return index === 0
|
||||
? mapper.length === 1 && (nullable || ('nullable' in typey && typey.nullable))
|
||||
? [
|
||||
...result,
|
||||
{ kind: ExcerptTokenKind.Content, text: ' | ' },
|
||||
{ kind: ExcerptTokenKind.Reference, text: 'null' },
|
||||
]
|
||||
: result
|
||||
: index === mapper.length - 1 && (nullable || ('nullable' in typey && typey.nullable))
|
||||
? [
|
||||
{ kind: ExcerptTokenKind.Content, text: ' | ' },
|
||||
...result,
|
||||
{ kind: ExcerptTokenKind.Content, text: ' | ' },
|
||||
{ kind: ExcerptTokenKind.Reference, text: 'null' },
|
||||
]
|
||||
: [{ kind: ExcerptTokenKind.Content, text: ' | ' }, ...result];
|
||||
return index === 0 ? result : [{ kind: ExcerptTokenKind.Content, text: ' | ' }, ...result];
|
||||
})
|
||||
.filter((excerpt) => excerpt.text.length);
|
||||
}
|
||||
@@ -1860,7 +1819,7 @@ export class ApiModelGenerator {
|
||||
isOptional: Boolean(prop.nullable),
|
||||
isReadonly: Boolean(prop.readonly),
|
||||
docComment: this._tsDocParser.parseString(
|
||||
`/**\n * ${this._fixLinkTags(prop.description) ?? ''}\n${prop.default ? ` * @defaultValue ${this._escapeSpecialChars(prop.default)}\n` : ''}${
|
||||
`/**\n * ${this._fixLinkTags(prop.description) ?? ''}\n${
|
||||
prop.see?.map((see) => ` * @see ${see}\n`).join('') ?? ''
|
||||
}${prop.readonly ? ' * @readonly\n' : ''} */`,
|
||||
).docComment,
|
||||
@@ -1872,7 +1831,7 @@ export class ApiModelGenerator {
|
||||
}${prop.name} :`,
|
||||
},
|
||||
...mappedVarType,
|
||||
{ kind: ExcerptTokenKind.Content, text: `${prop.default ? ` = ${prop.default}` : ''};` },
|
||||
{ kind: ExcerptTokenKind.Content, text: ';' },
|
||||
],
|
||||
propertyTypeTokenRange: { startIndex: 1, endIndex: 1 + mappedVarType.length },
|
||||
releaseTag: prop.access === 'private' ? ReleaseTag.Internal : ReleaseTag.Public,
|
||||
@@ -1895,7 +1854,6 @@ export class ApiModelGenerator {
|
||||
startIndex: 1 + index + paramTokens.slice(0, index).reduce((akk, num) => akk + num, 0),
|
||||
endIndex: 1 + index + paramTokens.slice(0, index + 1).reduce((akk, num) => akk + num, 0),
|
||||
},
|
||||
defaultValue: param.default?.toString(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1909,7 +1867,7 @@ export class ApiModelGenerator {
|
||||
: `${method.access ? `${method.access} ` : ''}${method.scope === 'static' ? 'static ' : ''}${method.name}(`
|
||||
}${
|
||||
method.params?.length
|
||||
? `${method.params[0]!.name}${method.params[0]!.nullable || method.params[0]!.optional ? '?' : ''}: `
|
||||
? `${method.params[0]!.name}${method.params[0]!.nullable || method.params[0]!.optional ? '?' : ''}`
|
||||
: '): '
|
||||
}`,
|
||||
});
|
||||
@@ -1920,7 +1878,7 @@ export class ApiModelGenerator {
|
||||
excerptTokens.push(...newTokens);
|
||||
excerptTokens.push({
|
||||
kind: ExcerptTokenKind.Content,
|
||||
text: `${method.params![index]!.default ? ` = ${method.params![index]!.default}` : ''}, ${method.params![index + 1]!.name}${
|
||||
text: `, ${method.params![index + 1]!.name}${
|
||||
method.params![index + 1]!.nullable || method.params![index + 1]!.optional ? '?' : ''
|
||||
}: `,
|
||||
});
|
||||
@@ -1930,10 +1888,7 @@ export class ApiModelGenerator {
|
||||
const newTokens = this._mapVarType(method.params[method.params.length - 1]!.type);
|
||||
paramTokens.push(newTokens.length);
|
||||
excerptTokens.push(...newTokens);
|
||||
excerptTokens.push({
|
||||
kind: ExcerptTokenKind.Content,
|
||||
text: `${method.params![method.params.length - 1]!.default ? ` = ${method.params![method.params.length - 1]!.default}` : ''}): `,
|
||||
});
|
||||
excerptTokens.push({ kind: ExcerptTokenKind.Content, text: `): ` });
|
||||
}
|
||||
|
||||
const returnTokens = this._mapVarType(method.returns?.[0] ?? []);
|
||||
|
||||
@@ -2,14 +2,6 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
# [@discordjs/brokers@1.0.0](https://github.com/discordjs/discord.js/compare/@discordjs/brokers@0.3.0...@discordjs/brokers@1.0.0) - (2024-09-01)
|
||||
|
||||
## Refactor
|
||||
|
||||
- **brokers:** Re-design API to make groups a constructor option (#10297) ([38a37b5](https://github.com/discordjs/discord.js/commit/38a37b5caf06913131c6dc2dc5cc258aecfe2266))
|
||||
- **brokers:** Make option props more correct (#10242) ([393ded4](https://github.com/discordjs/discord.js/commit/393ded4ea14e73b2bb42226f57896130329f88ca))
|
||||
- **BREAKING CHANGE:** Classes now take redis client as standalone parameter, various props from the base option interface moved to redis options
|
||||
|
||||
# [@discordjs/brokers@0.3.0](https://github.com/discordjs/discord.js/compare/@discordjs/brokers@0.2.3...@discordjs/brokers@0.3.0) - (2024-05-04)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
<a href="https://www.npmjs.com/package/@discordjs/brokers"><img src="https://img.shields.io/npm/v/@discordjs/brokers.svg?maxAge=3600" alt="npm version" /></a>
|
||||
<a href="https://www.npmjs.com/package/@discordjs/brokers"><img src="https://img.shields.io/npm/dt/@discordjs/brokers.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://github.com/discordjs/discord.js/commits/main/packages/brokers"><img alt="Last commit." src="https://img.shields.io/github/last-commit/discordjs/discord.js?logo=github&logoColor=ffffff&path=packages%2Fbrokers"></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=brokers" alt="Code coverage" /></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=brokers" 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>
|
||||
@@ -24,7 +23,7 @@
|
||||
|
||||
## Installation
|
||||
|
||||
**Node.js 20 or newer is required.**
|
||||
**Node.js 18 or newer is required.**
|
||||
|
||||
```sh
|
||||
npm install @discordjs/brokers
|
||||
|
||||
@@ -5,16 +5,13 @@ header = """
|
||||
All notable changes to this project will be documented in this file.\n
|
||||
"""
|
||||
body = """
|
||||
{%- macro remote_url() -%}
|
||||
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
|
||||
{%- endmacro -%}
|
||||
{% if version %}\
|
||||
# [{{ version | trim_start_matches(pat="v") }}]\
|
||||
{% if previous %}\
|
||||
{% if previous.version %}\
|
||||
({{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }})\
|
||||
(https://github.com/discordjs/discord.js/compare/{{ previous.version }}...{{ version }})\
|
||||
{% else %}\
|
||||
({{ self::remote_url() }}/tree/{{ version }})\
|
||||
(https://github.com/discordjs/discord.js/tree/{{ version }})\
|
||||
{% endif %}\
|
||||
{% endif %} \
|
||||
- ({{ timestamp | date(format="%Y-%m-%d") }})
|
||||
@@ -27,23 +24,14 @@ body = """
|
||||
- {% if commit.scope %}\
|
||||
**{{commit.scope}}:** \
|
||||
{% endif %}\
|
||||
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
|
||||
{% if commit.github.username %} by @{{ commit.github.username }}{%- endif %}\
|
||||
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/discordjs/discord.js/commit/{{ commit.id }}))\
|
||||
{% if commit.breaking %}\
|
||||
{% for footer in commit.footers %}\
|
||||
{% if footer.breaking %}\
|
||||
\n{% raw %} {% endraw %}- **{{ footer.token }}{{ footer.separator }}** {{ footer.value }}\
|
||||
{% endif %}\
|
||||
{% for breakingChange in commit.footers %}\
|
||||
\n{% raw %} {% endraw %}- **{{ breakingChange.token }}{{ breakingChange.separator }}** {{ breakingChange.value }}\
|
||||
{% endfor %}\
|
||||
{% endif %}\
|
||||
{% endfor %}
|
||||
{% endfor %}\
|
||||
{% if github.contributors | filter(attribute="is_first_time", value=true) | length %}\
|
||||
\n### New Contributors\n
|
||||
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}\
|
||||
* @{{ contributor.username }} made their first contribution in #{{ contributor.pr_number }}
|
||||
{% endfor %}\
|
||||
{% endif %}\n
|
||||
{% endfor %}\n
|
||||
"""
|
||||
trim = true
|
||||
footer = ""
|
||||
@@ -71,9 +59,5 @@ commit_parsers = [
|
||||
filter_commits = true
|
||||
tag_pattern = "@discordjs/brokers@[0-9]*"
|
||||
ignore_tags = ""
|
||||
topo_order = false
|
||||
topo_order = true
|
||||
sort_commits = "newest"
|
||||
|
||||
[remote.github]
|
||||
owner = "discordjs"
|
||||
repo = "discord.js"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "@discordjs/brokers",
|
||||
"version": "1.0.0",
|
||||
"version": "0.3.0",
|
||||
"description": "Powerful set of message brokers",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
@@ -42,7 +42,7 @@
|
||||
"Crawl <icrawltogo@gmail.com>",
|
||||
"Amish Shah <amishshah.2k@gmail.com>",
|
||||
"SpaceEEC <spaceeec@yahoo.com>",
|
||||
"Vlad Frangu <me@vladfrangu.dev>",
|
||||
"Vlad Frangu <kingdgrizzle@gmail.com>",
|
||||
"Aura Roman <kyradiscord@gmail.com>",
|
||||
"DD <didinele.dev@gmail.com>"
|
||||
],
|
||||
@@ -68,28 +68,28 @@
|
||||
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
||||
"dependencies": {
|
||||
"@msgpack/msgpack": "^3.0.0-beta2",
|
||||
"@vladfrangu/async_event_emitter": "^2.4.6",
|
||||
"@vladfrangu/async_event_emitter": "^2.2.4",
|
||||
"ioredis": "^5.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@discordjs/api-extractor": "workspace:^",
|
||||
"@discordjs/scripts": "workspace:^",
|
||||
"@favware/cliff-jumper": "^4.1.0",
|
||||
"@types/node": "^18.19.45",
|
||||
"@vitest/coverage-v8": "^2.0.5",
|
||||
"@favware/cliff-jumper": "^3.0.3",
|
||||
"@types/node": "18.18.8",
|
||||
"@vitest/coverage-v8": "^1.6.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild-plugin-version-injector": "^1.2.1",
|
||||
"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.3.0",
|
||||
"tsup": "^8.1.0",
|
||||
"turbo": "^1.13.3",
|
||||
"typescript": "^5.4.5",
|
||||
"vitest": "^1.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
"node": ">=18"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
|
||||
@@ -30,17 +30,17 @@ export const DefaultBrokerOptions = {
|
||||
} as const satisfies Required<BaseBrokerOptions>;
|
||||
|
||||
export type ToEventMap<
|
||||
TRecord extends Record<string, any[]>,
|
||||
TRecord extends Record<string, any>,
|
||||
TResponses extends Record<keyof TRecord, any> | undefined = undefined,
|
||||
> = {
|
||||
[TKey in keyof TRecord]: [
|
||||
event: TResponses extends Record<keyof TRecord, any>
|
||||
? { ack(): Promise<void>; reply(data: TResponses[TKey]): Promise<void> }
|
||||
: { ack(): Promise<void>; data: TRecord[TKey] },
|
||||
: { ack(): Promise<void> } & { data: TRecord[TKey] },
|
||||
];
|
||||
};
|
||||
} & { [K: string]: any };
|
||||
|
||||
export interface IBaseBroker<TEvents extends {}> {
|
||||
export interface IBaseBroker<TEvents extends Record<string, any>> {
|
||||
/**
|
||||
* Subscribes to the given events
|
||||
*/
|
||||
@@ -51,7 +51,7 @@ export interface IBaseBroker<TEvents extends {}> {
|
||||
unsubscribe(events: (keyof TEvents)[]): Promise<void>;
|
||||
}
|
||||
|
||||
export interface IPubSubBroker<TEvents extends {}>
|
||||
export interface IPubSubBroker<TEvents extends Record<string, any>>
|
||||
extends IBaseBroker<TEvents>,
|
||||
AsyncEventEmitter<ToEventMap<TEvents>> {
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ export interface IPubSubBroker<TEvents extends {}>
|
||||
publish<Event extends keyof TEvents>(event: Event, data: TEvents[Event]): Promise<void>;
|
||||
}
|
||||
|
||||
export interface IRPCBroker<TEvents extends Record<string, any[]>, TResponses extends Record<keyof TEvents, any>>
|
||||
export interface IRPCBroker<TEvents extends Record<string, any>, TResponses extends Record<keyof TEvents, any>>
|
||||
extends IBaseBroker<TEvents>,
|
||||
AsyncEventEmitter<ToEventMap<TEvents, TResponses>> {
|
||||
/**
|
||||
|
||||
@@ -57,11 +57,8 @@ export const DefaultRedisBrokerOptions = {
|
||||
/**
|
||||
* Helper class with shared Redis logic
|
||||
*/
|
||||
export abstract class BaseRedisBroker<
|
||||
TEvents extends Record<string, any[]>,
|
||||
TResponses extends Record<keyof TEvents, any> | undefined = undefined,
|
||||
>
|
||||
extends AsyncEventEmitter<ToEventMap<TEvents, TResponses>>
|
||||
export abstract class BaseRedisBroker<TEvents extends Record<string, any>>
|
||||
extends AsyncEventEmitter<ToEventMap<TEvents>>
|
||||
implements IBaseBroker<TEvents>
|
||||
{
|
||||
/**
|
||||
@@ -185,7 +182,6 @@ export abstract class BaseRedisBroker<
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
// @ts-expect-error: Intended
|
||||
this.emit('error', error);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ export class PubSubRedisBroker<TEvents extends Record<string, any>>
|
||||
},
|
||||
};
|
||||
|
||||
// @ts-expect-error: Intended
|
||||
this.emit(event, payload);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@ export const DefaultRPCRedisBrokerOptions = {
|
||||
* await broker.subscribe('responders', ['testcall']);
|
||||
* ```
|
||||
*/
|
||||
export class RPCRedisBroker<TEvents extends Record<string, any[]>, TResponses extends Record<keyof TEvents, any>>
|
||||
extends BaseRedisBroker<TEvents, TResponses>
|
||||
export class RPCRedisBroker<TEvents extends Record<string, any>, TResponses extends Record<keyof TEvents, any>>
|
||||
extends BaseRedisBroker<TEvents>
|
||||
implements IRPCBroker<TEvents, TResponses>
|
||||
{
|
||||
/**
|
||||
@@ -125,7 +125,6 @@ export class RPCRedisBroker<TEvents extends Record<string, any[]>, TResponses ex
|
||||
},
|
||||
};
|
||||
|
||||
// @ts-expect-error: Intended
|
||||
this.emit(event, payload);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,6 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
# [@discordjs/builders@1.9.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@1.8.2...@discordjs/builders@1.9.0) - (2024-09-01)
|
||||
|
||||
## Features
|
||||
|
||||
- User-installable apps (#10227) ([fc0b6f7](https://github.com/discordjs/discord.js/commit/fc0b6f7f8ebd94a4a05fac0c76e49b23752a8e65))
|
||||
- **builders:** Update to @sapphire/shapeshift v4 (#10291) ([2d5531f](https://github.com/discordjs/discord.js/commit/2d5531f35c6b4d70f83e46b99c284030108dcf5c))
|
||||
- **SlashCommandBuilder:** Add explicit command type when building (#10395) ([b2970bb](https://github.com/discordjs/discord.js/commit/b2970bb2dddf70d2d918fda825059315f35d23f3))
|
||||
- Premium buttons (#10353) ([4f59b74](https://github.com/discordjs/discord.js/commit/4f59b740d01b9ff2213949708a36e17da32b89c3))
|
||||
- Add user-installable apps support (#10348) ([9c76bbe](https://github.com/discordjs/discord.js/commit/9c76bbea172d49320f7fdac19ec1a43a49d05116))
|
||||
|
||||
# [@discordjs/builders@1.8.2](https://github.com/discordjs/discord.js/compare/@discordjs/builders@1.8.1...@discordjs/builders@1.8.2) - (2024-06-02)
|
||||
|
||||
## Bug Fixes
|
||||
@@ -280,6 +270,261 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
- Cleanup tests and tsup configs ([6b8ef20](https://github.com/discordjs/discord.js/commit/6b8ef20cb3af5b5cfd176dd0aa0a1a1e98551629))
|
||||
|
||||
# [@discordjs/builders@1.6.5](https://github.com/discordjs/discord.js/compare/@discordjs/builders@1.6.4...@discordjs/builders@1.6.5) - (2023-08-17)
|
||||
|
||||
## Documentation
|
||||
|
||||
- Update Node.js requirement to 16.11.0 (#9764) ([188877c](https://github.com/discordjs/discord.js/commit/188877c50af70f0d5cffb246620fa277435c6ce6))
|
||||
|
||||
# [@discordjs/builders@1.6.3](https://github.com/discordjs/discord.js/compare/@discordjs/builders@1.6.2...@discordjs/builders@1.6.3) - (2023-05-01)
|
||||
|
||||
## Refactor
|
||||
|
||||
- Remove `@discordjs/util` re-export (#9488) ([54ceedf](https://github.com/discordjs/discord.js/commit/54ceedf6c535d4641643d4106b6286cbef09de4a))
|
||||
|
||||
# [@discordjs/builders@1.6.2](https://github.com/discordjs/discord.js/compare/@discordjs/builders@1.6.1...@discordjs/builders@1.6.2) - (2023-05-01)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **BaseSelectMenuBuilder:** Modify class to be `abstract` (#9358) ([ca4de2d](https://github.com/discordjs/discord.js/commit/ca4de2d9c6bc204e85d1b7eae7eabd23dbeb4475))
|
||||
- Correct `@link` tags that involve parents (#9351) ([fbbce3e](https://github.com/discordjs/discord.js/commit/fbbce3eb4ba20bc0c4806ca2259d1f86001594be))
|
||||
- Fix external links (#9313) ([a7425c2](https://github.com/discordjs/discord.js/commit/a7425c29c4f23f1b31f4c6a463107ca9eb7fd7e2))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Reference package names properly (#9426) ([d6bca9b](https://github.com/discordjs/discord.js/commit/d6bca9bb4d976dc069a5039250db7d5b3e9142ef))
|
||||
- Generate static imports for types with api-extractor ([98a76db](https://github.com/discordjs/discord.js/commit/98a76db482879f79d6bb2fb2e5fc65ac2c34e2d9))
|
||||
- **builders:** Add some basic documentation (#9359) ([8073561](https://github.com/discordjs/discord.js/commit/8073561824f911d1a18d0b4f1de39f452bc69fa9))
|
||||
- Use `@link` in `@see` (#9348) ([d66d113](https://github.com/discordjs/discord.js/commit/d66d1133331b81563588db4500c63a18c3c3dfae))
|
||||
|
||||
# [@discordjs/builders@1.6.3](https://github.com/discordjs/discord.js/compare/@discordjs/builders@1.6.2...@discordjs/builders@1.6.3) - (2023-05-01)
|
||||
|
||||
## Refactor
|
||||
|
||||
- Remove `@discordjs/util` re-export (#9488) ([54ceedf](https://github.com/discordjs/discord.js/commit/54ceedf6c535d4641643d4106b6286cbef09de4a))
|
||||
|
||||
# [@discordjs/builders@1.6.2](https://github.com/discordjs/discord.js/compare/@discordjs/builders@1.6.1...@discordjs/builders@1.6.2) - (2023-05-01)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **BaseSelectMenuBuilder:** Modify class to be `abstract` (#9358) ([ca4de2d](https://github.com/discordjs/discord.js/commit/ca4de2d9c6bc204e85d1b7eae7eabd23dbeb4475))
|
||||
- Correct `@link` tags that involve parents (#9351) ([fbbce3e](https://github.com/discordjs/discord.js/commit/fbbce3eb4ba20bc0c4806ca2259d1f86001594be))
|
||||
- Fix external links (#9313) ([a7425c2](https://github.com/discordjs/discord.js/commit/a7425c29c4f23f1b31f4c6a463107ca9eb7fd7e2))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Reference package names properly (#9426) ([d6bca9b](https://github.com/discordjs/discord.js/commit/d6bca9bb4d976dc069a5039250db7d5b3e9142ef))
|
||||
- Generate static imports for types with api-extractor ([98a76db](https://github.com/discordjs/discord.js/commit/98a76db482879f79d6bb2fb2e5fc65ac2c34e2d9))
|
||||
- **builders:** Add some basic documentation (#9359) ([8073561](https://github.com/discordjs/discord.js/commit/8073561824f911d1a18d0b4f1de39f452bc69fa9))
|
||||
- Use `@link` in `@see` (#9348) ([d66d113](https://github.com/discordjs/discord.js/commit/d66d1133331b81563588db4500c63a18c3c3dfae))
|
||||
|
||||
# [@discordjs/builders@1.6.3](https://github.com/discordjs/discord.js/compare/@discordjs/builders@1.6.2...@discordjs/builders@1.6.3) - (2023-05-01)
|
||||
|
||||
## Refactor
|
||||
|
||||
- Remove `@discordjs/util` re-export (#9488) ([54ceedf](https://github.com/discordjs/discord.js/commit/54ceedf6c535d4641643d4106b6286cbef09de4a))
|
||||
|
||||
# [@discordjs/builders@1.6.2](https://github.com/discordjs/discord.js/compare/@discordjs/builders@1.6.1...@discordjs/builders@1.6.2) - (2023-05-01)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **BaseSelectMenuBuilder:** Modify class to be `abstract` (#9358) ([ca4de2d](https://github.com/discordjs/discord.js/commit/ca4de2d9c6bc204e85d1b7eae7eabd23dbeb4475))
|
||||
- Correct `@link` tags that involve parents (#9351) ([fbbce3e](https://github.com/discordjs/discord.js/commit/fbbce3eb4ba20bc0c4806ca2259d1f86001594be))
|
||||
- Fix external links (#9313) ([a7425c2](https://github.com/discordjs/discord.js/commit/a7425c29c4f23f1b31f4c6a463107ca9eb7fd7e2))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Reference package names properly (#9426) ([d6bca9b](https://github.com/discordjs/discord.js/commit/d6bca9bb4d976dc069a5039250db7d5b3e9142ef))
|
||||
- Generate static imports for types with api-extractor ([98a76db](https://github.com/discordjs/discord.js/commit/98a76db482879f79d6bb2fb2e5fc65ac2c34e2d9))
|
||||
- **builders:** Add some basic documentation (#9359) ([8073561](https://github.com/discordjs/discord.js/commit/8073561824f911d1a18d0b4f1de39f452bc69fa9))
|
||||
- Use `@link` in `@see` (#9348) ([d66d113](https://github.com/discordjs/discord.js/commit/d66d1133331b81563588db4500c63a18c3c3dfae))
|
||||
|
||||
# [@discordjs/builders@1.6.2](https://github.com/discordjs/discord.js/compare/@discordjs/builders@1.6.1...@discordjs/builders@1.6.2) - (2023-05-01)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **BaseSelectMenuBuilder:** Modify class to be `abstract` (#9358) ([ca4de2d](https://github.com/discordjs/discord.js/commit/ca4de2d9c6bc204e85d1b7eae7eabd23dbeb4475))
|
||||
- Correct `@link` tags that involve parents (#9351) ([fbbce3e](https://github.com/discordjs/discord.js/commit/fbbce3eb4ba20bc0c4806ca2259d1f86001594be))
|
||||
- Fix external links (#9313) ([a7425c2](https://github.com/discordjs/discord.js/commit/a7425c29c4f23f1b31f4c6a463107ca9eb7fd7e2))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Reference package names properly (#9426) ([d6bca9b](https://github.com/discordjs/discord.js/commit/d6bca9bb4d976dc069a5039250db7d5b3e9142ef))
|
||||
- Generate static imports for types with api-extractor ([98a76db](https://github.com/discordjs/discord.js/commit/98a76db482879f79d6bb2fb2e5fc65ac2c34e2d9))
|
||||
- **builders:** Add some basic documentation (#9359) ([8073561](https://github.com/discordjs/discord.js/commit/8073561824f911d1a18d0b4f1de39f452bc69fa9))
|
||||
- Use `@link` in `@see` (#9348) ([d66d113](https://github.com/discordjs/discord.js/commit/d66d1133331b81563588db4500c63a18c3c3dfae))
|
||||
|
||||
# [@discordjs/builders@1.6.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@1.5.0...@discordjs/builders@1.6.0) - (2023-04-01)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **scripts:** Accessing tsComment ([d8d5f31](https://github.com/discordjs/discord.js/commit/d8d5f31d3927fd1de62f1fa3a1a6e454243ad87b))
|
||||
|
||||
## Features
|
||||
|
||||
- **website:** Render syntax and mdx on the server (#9086) ([ee5169e](https://github.com/discordjs/discord.js/commit/ee5169e0aadd7bbfcd752aae614ec0f69602b68b))
|
||||
|
||||
# [@discordjs/builders@1.5.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@1.4.0...@discordjs/builders@1.5.0) - (2023-03-12)
|
||||
|
||||
## Documentation
|
||||
|
||||
- **EmbedBuilder#spliceFields:** Fix a typo (#9159) ([4367ab9](https://github.com/discordjs/discord.js/commit/4367ab930227048868db3ed8437f6c4507ff32e1))
|
||||
- Fix version export (#9049) ([8b70f49](https://github.com/discordjs/discord.js/commit/8b70f497a1207e30edebdecd12b926c981c13d28))
|
||||
|
||||
## Features
|
||||
|
||||
- **website:** Add support for source file links (#9048) ([f6506e9](https://github.com/discordjs/discord.js/commit/f6506e99c496683ee0ab67db0726b105b929af38))
|
||||
- **StringSelectMenu:** Add `spliceOptions()` (#8937) ([a6941d5](https://github.com/discordjs/discord.js/commit/a6941d536ce24ed2b5446a154cbc886b2b97c63a))
|
||||
- Add support for nsfw commands (#7976) ([7a51344](https://github.com/discordjs/discord.js/commit/7a5134459c5f06864bf74631d83b96d9c21b72d8))
|
||||
- Add `@discordjs/formatters` (#8889) ([3fca638](https://github.com/discordjs/discord.js/commit/3fca638a8470dcea2f79ddb9f18526dbc0017c88))
|
||||
|
||||
## Styling
|
||||
|
||||
- Run prettier (#9041) ([2798ba1](https://github.com/discordjs/discord.js/commit/2798ba1eb3d734f0cf2eeccd2e16cfba6804873b))
|
||||
|
||||
# [@discordjs/builders@1.4.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@1.3.0...@discordjs/builders@1.4.0) - (2022-11-28)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Pin @types/node version ([9d8179c](https://github.com/discordjs/discord.js/commit/9d8179c6a78e1c7f9976f852804055964d5385d4))
|
||||
|
||||
## Features
|
||||
|
||||
- New select menus (#8793) ([5152abf](https://github.com/discordjs/discord.js/commit/5152abf7285581abf7689e9050fdc56c4abb1e2b))
|
||||
- Allow punctuation characters in context menus (#8783) ([b521366](https://github.com/discordjs/discord.js/commit/b5213664fa66746daab1673ebe2adf2db3d1522c))
|
||||
|
||||
## Typings
|
||||
|
||||
- **Formatters:** Allow boolean in `formatEmoji` (#8823) ([ec37f13](https://github.com/discordjs/discord.js/commit/ec37f137fd4fca0fdbdb8a5c83abf32362a8f285))
|
||||
|
||||
# [@discordjs/builders@1.3.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@1.2.0...@discordjs/builders@1.3.0) - (2022-10-08)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Allow adding forums to `channelTypes` (#8658) ([b1e190c](https://github.com/discordjs/discord.js/commit/b1e190c4f0773a1a739625f5b41026f593515370))
|
||||
- **SlashCommandBuilder:** Missing methods in subcommand builder (#8583) ([1c5b78f](https://github.com/discordjs/discord.js/commit/1c5b78fd2130f09c951459cf4c2d637f46c3c2c9))
|
||||
- Footer / sidebar / deprecation alert ([ba3e0ed](https://github.com/discordjs/discord.js/commit/ba3e0ed348258fe8e51eefb4aa7379a1230616a9))
|
||||
|
||||
## Documentation
|
||||
|
||||
- **builders/components:** Document constructors (#8636) ([8444576](https://github.com/discordjs/discord.js/commit/8444576f45da5fdddbf8ba2d91b4cb31a3b51c04))
|
||||
- Change name (#8604) ([dd5a089](https://github.com/discordjs/discord.js/commit/dd5a08944c258a847fc4377f1d5e953264ab47d0))
|
||||
- Use remarks instead of `Note` in descriptions (#8597) ([f3ce4a7](https://github.com/discordjs/discord.js/commit/f3ce4a75d0c4eafc89a1f0ce9f4964bcbcdae6da))
|
||||
|
||||
## Features
|
||||
|
||||
- Web-components (#8715) ([0ac3e76](https://github.com/discordjs/discord.js/commit/0ac3e766bd9dbdeb106483fa4bb085d74de346a2))
|
||||
- Add `@discordjs/util` (#8591) ([b2ec865](https://github.com/discordjs/discord.js/commit/b2ec865765bf94181473864a627fb63ea8173fd3))
|
||||
- Add `chatInputApplicationCommandMention` formatter (#8546) ([d08a57c](https://github.com/discordjs/discord.js/commit/d08a57cadd9d69a734077cc1902d931ab10336db))
|
||||
|
||||
## Refactor
|
||||
|
||||
- Replace usage of deprecated `ChannelType`s (#8625) ([669c3cd](https://github.com/discordjs/discord.js/commit/669c3cd2566eac68ef38ab522dd6378ba761e8b3))
|
||||
- Website components (#8600) ([c334157](https://github.com/discordjs/discord.js/commit/c3341570d983aea9ecc419979d5a01de658c9d67))
|
||||
- Use `eslint-config-neon` for packages. (#8579) ([edadb9f](https://github.com/discordjs/discord.js/commit/edadb9fe5dfd9ff51a3cfc9b25cb242d3f9f5241))
|
||||
|
||||
## Testing
|
||||
|
||||
- Rename incorrect test (#8596) ([ce991dd](https://github.com/discordjs/discord.js/commit/ce991dd1d883f6785b5f4b4b3ac80ef21cb304e7))
|
||||
|
||||
## Typings
|
||||
|
||||
- **interactions:** Fix `{Slash,ContextMenu}CommandBuilder#toJSON` (#8568) ([b7eb96d](https://github.com/discordjs/discord.js/commit/b7eb96d45670616521fbcca28a657793d91605c7))
|
||||
|
||||
# [@discordjs/builders@1.2.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@1.1.0...@discordjs/builders@1.2.0) - (2022-08-22)
|
||||
|
||||
## Features
|
||||
|
||||
- **website:** Show `constructor` information (#8540) ([e42fd16](https://github.com/discordjs/discord.js/commit/e42fd1636973b10dd7ed6fb4280ee1a4a8f82007))
|
||||
- **website:** Show descriptions for `@typeParam` blocks (#8523) ([e475b63](https://github.com/discordjs/discord.js/commit/e475b63f257f6261d73cb89fee9ecbcdd84e2a6b))
|
||||
- **website:** Show parameter descriptions (#8519) ([7f415a2](https://github.com/discordjs/discord.js/commit/7f415a2502bf7ce2025dbcfed9017b0635a19966))
|
||||
- **WebSocketShard:** Support new resume url (#8480) ([bc06cc6](https://github.com/discordjs/discord.js/commit/bc06cc638d2f57ab5c600e8cdb6afc8eb2180166))
|
||||
|
||||
## Refactor
|
||||
|
||||
- Docs design (#8487) ([4ab1d09](https://github.com/discordjs/discord.js/commit/4ab1d09997a18879a9eb9bda39df6f15aa22557e))
|
||||
|
||||
# [@discordjs/builders@1.1.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@0.16.0...@discordjs/builders@1.1.0) - (2022-07-29)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Use proper format for `@link` text (#8384) ([2655639](https://github.com/discordjs/discord.js/commit/26556390a3800e954974a00c1328ff47d3e67e9a))
|
||||
- **Formatters:** Add newline in `codeBlock` (#8369) ([5d8bd03](https://github.com/discordjs/discord.js/commit/5d8bd030d60ef364de3ef5f9963da8bda5c4efd4))
|
||||
- **selectMenu:** Allow json to be used for select menu options (#8322) ([6a2d0d8](https://github.com/discordjs/discord.js/commit/6a2d0d8e96d157d5b85cee7f17bffdfff4240074))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Use link tags (#8382) ([5494791](https://github.com/discordjs/discord.js/commit/549479131318c659f86f0eb18578d597e22522d3))
|
||||
|
||||
## Features
|
||||
|
||||
- Add channel & message URL formatters (#8371) ([a7deb8f](https://github.com/discordjs/discord.js/commit/a7deb8f89830ead6185c5fb46a49688b6d209ed1))
|
||||
|
||||
## Testing
|
||||
|
||||
- **builders:** Improve coverage (#8274) ([b7e6238](https://github.com/discordjs/discord.js/commit/b7e62380f2e6b9324d6bba9b9eaa5315080bf66a))
|
||||
|
||||
# [@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
|
||||
|
||||
- Slash command name regex (#8265) ([32f9056](https://github.com/discordjs/discord.js/commit/32f9056b15edede3bab07de96afb4b56d3a9ecca))
|
||||
- **TextInputBuilder:** Parse `custom_id`, `label`, and `style` (#8216) ([2d9dfa3](https://github.com/discordjs/discord.js/commit/2d9dfa3c6ea4bb972da2f7e088d148b798c866d9))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Add codecov coverage badge to readmes (#8226) ([f6db285](https://github.com/discordjs/discord.js/commit/f6db285c073898a749fe4591cbd4463d1896daf5))
|
||||
|
||||
## Features
|
||||
|
||||
- **builder:** Add max min length in string option (#8214) ([96c8d21](https://github.com/discordjs/discord.js/commit/96c8d21f95eb366c46ae23505ba9054f44821b25))
|
||||
- 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))
|
||||
|
||||
## Refactor
|
||||
|
||||
- **builder:** Remove `unsafe*Builder`s (#8074) ([a4d1862](https://github.com/discordjs/discord.js/commit/a4d18629828234f43f03d1bd4851d4b727c6903b))
|
||||
- Remove @sindresorhus/is as it's now esm only (#8133) ([c6f285b](https://github.com/discordjs/discord.js/commit/c6f285b7b089b004776fbeb444fe973a68d158d8))
|
||||
- Move all the config files to root (#8033) ([769ea0b](https://github.com/discordjs/discord.js/commit/769ea0bfe78c4f1d413c6b397c604ffe91e39c6a))
|
||||
|
||||
## Typings
|
||||
|
||||
- Remove expect error (#8242) ([7e6dbaa](https://github.com/discordjs/discord.js/commit/7e6dbaaed900c07d1a04e23bbbf9cd0d1b0501c5))
|
||||
- **builder:** Remove casting (#8241) ([8198da5](https://github.com/discordjs/discord.js/commit/8198da5cd0898e06954615a2287853321e7ebbd4))
|
||||
|
||||
# [@discordjs/builders@0.15.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@0.14.0...@discordjs/builders@0.15.0) - (2022-06-06)
|
||||
|
||||
## Features
|
||||
|
||||
- Allow builders to accept rest params and arrays (#7874) ([ad75be9](https://github.com/discordjs/discord.js/commit/ad75be9a9cf90c8624495df99b75177e6c24022f))
|
||||
- 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))
|
||||
|
||||
# [@discordjs/builders@0.14.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@0.13.0...@discordjs/builders@0.14.0) - (2022-06-04)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **builders:** Leftover invalid null type ([8a7cd10](https://github.com/discordjs/discord.js/commit/8a7cd10554a2a71cd2fe7f6a177b5f4f43464348))
|
||||
- **SlashCommandBuilder:** Import `Permissions` correctly (#7921) ([7ce641d](https://github.com/discordjs/discord.js/commit/7ce641d33a4af6586d5e7beffbe7d38619dcf1a2))
|
||||
- Add localizations for subcommand builders and option choices (#7862) ([c1b5e73](https://github.com/discordjs/discord.js/commit/c1b5e731daa9cbbfca03a046e47cb1221ee1ed7c))
|
||||
|
||||
## Features
|
||||
|
||||
- Export types from `interactions/slashCommands/mixins` (#7942) ([68d5169](https://github.com/discordjs/discord.js/commit/68d5169f66c96f8fe5be17a1c01cdd5155607ab2))
|
||||
- **builders:** Add new command permissions v2 (#7861) ([de3f157](https://github.com/discordjs/discord.js/commit/de3f1573f07dda294cc0fbb1ca4b659eb2388a12))
|
||||
- **builders:** Improve embed errors and predicates (#7795) ([ec8d87f](https://github.com/discordjs/discord.js/commit/ec8d87f93272cc9987f9613735c0361680c4ed1e))
|
||||
|
||||
## Refactor
|
||||
|
||||
- Use arrays instead of rest parameters for builders (#7759) ([29293d7](https://github.com/discordjs/discord.js/commit/29293d7bbb5ed463e52e5a5853817e5a09cf265b))
|
||||
|
||||
## Styling
|
||||
|
||||
- Cleanup tests and tsup configs ([6b8ef20](https://github.com/discordjs/discord.js/commit/6b8ef20cb3af5b5cfd176dd0aa0a1a1e98551629))
|
||||
|
||||
# [@discordjs/builders@0.13.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@0.12.0...@discordjs/builders@0.13.0) - (2022-04-17)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
<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://github.com/discordjs/discord.js/commits/main/packages/builders"><img alt="Last commit." src="https://img.shields.io/github/last-commit/discordjs/discord.js?logo=github&logoColor=ffffff&path=packages%2Fbuilders"></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>
|
||||
<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>
|
||||
@@ -24,7 +23,7 @@
|
||||
|
||||
## Installation
|
||||
|
||||
**Node.js 18 or newer is required.**
|
||||
**Node.js 16.11.0 or newer is required.**
|
||||
|
||||
```sh
|
||||
npm install @discordjs/builders
|
||||
|
||||
@@ -166,7 +166,7 @@ describe('Context Menu Commands', () => {
|
||||
});
|
||||
|
||||
describe('integration types', () => {
|
||||
test('GIVEN a builder with valid integration types THEN does not throw an error', () => {
|
||||
test('GIVEN a builder with valid integraton types THEN does not throw an error', () => {
|
||||
expect(() =>
|
||||
getBuilder().setIntegrationTypes([
|
||||
ApplicationIntegrationType.GuildInstall,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
ApplicationCommandType,
|
||||
ApplicationIntegrationType,
|
||||
ChannelType,
|
||||
InteractionContextType,
|
||||
@@ -134,10 +133,6 @@ describe('Slash Commands', () => {
|
||||
});
|
||||
|
||||
describe('Builder with simple options', () => {
|
||||
test('GIVEN valid builder THEN returns type included', () => {
|
||||
expect(getNamedBuilder().toJSON()).includes({ type: ApplicationCommandType.ChatInput });
|
||||
});
|
||||
|
||||
test('GIVEN valid builder with options THEN does not throw error', () => {
|
||||
expect(() =>
|
||||
getBuilder()
|
||||
|
||||
@@ -5,16 +5,13 @@ header = """
|
||||
All notable changes to this project will be documented in this file.\n
|
||||
"""
|
||||
body = """
|
||||
{%- macro remote_url() -%}
|
||||
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
|
||||
{%- endmacro -%}
|
||||
{% if version %}\
|
||||
# [{{ version | trim_start_matches(pat="v") }}]\
|
||||
{% if previous %}\
|
||||
{% if previous.version %}\
|
||||
({{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }})\
|
||||
(https://github.com/discordjs/discord.js/compare/{{ previous.version }}...{{ version }})\
|
||||
{% else %}\
|
||||
({{ self::remote_url() }}/tree/{{ version }})\
|
||||
(https://github.com/discordjs/discord.js/tree/{{ version }})\
|
||||
{% endif %}\
|
||||
{% endif %} \
|
||||
- ({{ timestamp | date(format="%Y-%m-%d") }})
|
||||
@@ -27,23 +24,14 @@ body = """
|
||||
- {% if commit.scope %}\
|
||||
**{{commit.scope}}:** \
|
||||
{% endif %}\
|
||||
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
|
||||
{% if commit.github.username %} by @{{ commit.github.username }}{%- endif %}\
|
||||
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/discordjs/discord.js/commit/{{ commit.id }}))\
|
||||
{% if commit.breaking %}\
|
||||
{% for footer in commit.footers %}\
|
||||
{% if footer.breaking %}\
|
||||
\n{% raw %} {% endraw %}- **{{ footer.token }}{{ footer.separator }}** {{ footer.value }}\
|
||||
{% endif %}\
|
||||
{% for breakingChange in commit.footers %}\
|
||||
\n{% raw %} {% endraw %}- **{{ breakingChange.token }}{{ breakingChange.separator }}** {{ breakingChange.value }}\
|
||||
{% endfor %}\
|
||||
{% endif %}\
|
||||
{% endfor %}
|
||||
{% endfor %}\
|
||||
{% if github.contributors | filter(attribute="is_first_time", value=true) | length %}\
|
||||
\n### New Contributors\n
|
||||
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}\
|
||||
* @{{ contributor.username }} made their first contribution in #{{ contributor.pr_number }}
|
||||
{% endfor %}\
|
||||
{% endif %}\n
|
||||
{% endfor %}\n
|
||||
"""
|
||||
trim = true
|
||||
footer = ""
|
||||
@@ -71,9 +59,5 @@ commit_parsers = [
|
||||
filter_commits = true
|
||||
tag_pattern = "@discordjs/builders@[0-9]*"
|
||||
ignore_tags = ""
|
||||
topo_order = false
|
||||
topo_order = true
|
||||
sort_commits = "newest"
|
||||
|
||||
[remote.github]
|
||||
owner = "discordjs"
|
||||
repo = "discord.js"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "@discordjs/builders",
|
||||
"version": "1.9.0",
|
||||
"version": "1.8.2",
|
||||
"description": "A set of builders that you can use when creating your bot",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
@@ -38,7 +38,7 @@
|
||||
"dist"
|
||||
],
|
||||
"contributors": [
|
||||
"Vlad Frangu <me@vladfrangu.dev>",
|
||||
"Vlad Frangu <kingdgrizzle@gmail.com>",
|
||||
"Crawl <icrawltogo@gmail.com>",
|
||||
"Amish Shah <amishshah.2k@gmail.com>",
|
||||
"SpaceEEC <spaceeec@yahoo.com>",
|
||||
@@ -67,31 +67,31 @@
|
||||
"dependencies": {
|
||||
"@discordjs/formatters": "workspace:^",
|
||||
"@discordjs/util": "workspace:^",
|
||||
"@sapphire/shapeshift": "^4.0.0",
|
||||
"discord-api-types": "^0.37.119",
|
||||
"@sapphire/shapeshift": "^3.9.7",
|
||||
"discord-api-types": "^0.37.114",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"ts-mixer": "^6.0.4",
|
||||
"tslib": "^2.6.3"
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@discordjs/api-extractor": "workspace:^",
|
||||
"@discordjs/scripts": "workspace:^",
|
||||
"@favware/cliff-jumper": "^4.1.0",
|
||||
"@types/node": "^16.18.105",
|
||||
"@vitest/coverage-v8": "^2.0.5",
|
||||
"@favware/cliff-jumper": "^3.0.3",
|
||||
"@types/node": "16.18.60",
|
||||
"@vitest/coverage-v8": "^1.6.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild-plugin-version-injector": "^1.2.1",
|
||||
"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.3.0",
|
||||
"tsup": "^8.1.0",
|
||||
"turbo": "^1.13.3",
|
||||
"typescript": "^5.4.5",
|
||||
"vitest": "^1.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
"node": ">=16.11.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
|
||||
@@ -3,42 +3,35 @@ import { ButtonStyle, ChannelType, type APIMessageComponentEmoji } from 'discord
|
||||
import { isValidationEnabled } from '../util/validation.js';
|
||||
import { StringSelectMenuOptionBuilder } from './selectMenu/StringSelectMenuOption.js';
|
||||
|
||||
export const customIdValidator = s
|
||||
.string()
|
||||
export const customIdValidator = s.string
|
||||
.lengthGreaterThanOrEqual(1)
|
||||
.lengthLessThanOrEqual(100)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const emojiValidator = s
|
||||
.object({
|
||||
id: s.string(),
|
||||
name: s.string(),
|
||||
animated: s.boolean(),
|
||||
id: s.string,
|
||||
name: s.string,
|
||||
animated: s.boolean,
|
||||
})
|
||||
.partial()
|
||||
.strict()
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
.partial.strict.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const disabledValidator = s.boolean();
|
||||
export const disabledValidator = s.boolean;
|
||||
|
||||
export const buttonLabelValidator = s
|
||||
.string()
|
||||
export const buttonLabelValidator = s.string
|
||||
.lengthGreaterThanOrEqual(1)
|
||||
.lengthLessThanOrEqual(80)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const buttonStyleValidator = s.nativeEnum(ButtonStyle);
|
||||
|
||||
export const placeholderValidator = s.string().lengthLessThanOrEqual(150).setValidationEnabled(isValidationEnabled);
|
||||
export const minMaxValidator = s
|
||||
.number()
|
||||
.int()
|
||||
export const placeholderValidator = s.string.lengthLessThanOrEqual(150).setValidationEnabled(isValidationEnabled);
|
||||
export const minMaxValidator = s.number.int
|
||||
.greaterThanOrEqual(0)
|
||||
.lessThanOrEqual(25)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const labelValueDescriptionValidator = s
|
||||
.string()
|
||||
export const labelValueDescriptionValidator = s.string
|
||||
.lengthGreaterThanOrEqual(1)
|
||||
.lengthLessThanOrEqual(100)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
@@ -47,21 +40,18 @@ export const jsonOptionValidator = s
|
||||
.object({
|
||||
label: labelValueDescriptionValidator,
|
||||
value: labelValueDescriptionValidator,
|
||||
description: labelValueDescriptionValidator.optional(),
|
||||
emoji: emojiValidator.optional(),
|
||||
default: s.boolean().optional(),
|
||||
description: labelValueDescriptionValidator.optional,
|
||||
emoji: emojiValidator.optional,
|
||||
default: s.boolean.optional,
|
||||
})
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const optionValidator = s.instance(StringSelectMenuOptionBuilder).setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const optionsValidator = optionValidator
|
||||
.array()
|
||||
export const optionsValidator = optionValidator.array
|
||||
.lengthGreaterThanOrEqual(0)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
export const optionsLengthValidator = s
|
||||
.number()
|
||||
.int()
|
||||
export const optionsLengthValidator = s.number.int
|
||||
.greaterThanOrEqual(0)
|
||||
.lessThanOrEqual(25)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
@@ -71,17 +61,16 @@ export function validateRequiredSelectMenuParameters(options: StringSelectMenuOp
|
||||
optionsValidator.parse(options);
|
||||
}
|
||||
|
||||
export const defaultValidator = s.boolean();
|
||||
export const defaultValidator = s.boolean;
|
||||
|
||||
export function validateRequiredSelectMenuOptionParameters(label?: string, value?: string) {
|
||||
labelValueDescriptionValidator.parse(label);
|
||||
labelValueDescriptionValidator.parse(value);
|
||||
}
|
||||
|
||||
export const channelTypesValidator = s.nativeEnum(ChannelType).array().setValidationEnabled(isValidationEnabled);
|
||||
export const channelTypesValidator = s.nativeEnum(ChannelType).array.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const urlValidator = s
|
||||
.string()
|
||||
export const urlValidator = s.string
|
||||
.url({
|
||||
allowedProtocols: ['http:', 'https:', 'discord:'],
|
||||
})
|
||||
|
||||
@@ -4,23 +4,18 @@ import { isValidationEnabled } from '../../util/validation.js';
|
||||
import { customIdValidator } from '../Assertions.js';
|
||||
|
||||
export const textInputStyleValidator = s.nativeEnum(TextInputStyle);
|
||||
export const minLengthValidator = s
|
||||
.number()
|
||||
.int()
|
||||
export const minLengthValidator = s.number.int
|
||||
.greaterThanOrEqual(0)
|
||||
.lessThanOrEqual(4_000)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
export const maxLengthValidator = s
|
||||
.number()
|
||||
.int()
|
||||
export const maxLengthValidator = s.number.int
|
||||
.greaterThanOrEqual(1)
|
||||
.lessThanOrEqual(4_000)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
export const requiredValidator = s.boolean();
|
||||
export const valueValidator = s.string().lengthLessThanOrEqual(4_000).setValidationEnabled(isValidationEnabled);
|
||||
export const placeholderValidator = s.string().lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);
|
||||
export const labelValidator = s
|
||||
.string()
|
||||
export const requiredValidator = s.boolean;
|
||||
export const valueValidator = s.string.lengthLessThanOrEqual(4_000).setValidationEnabled(isValidationEnabled);
|
||||
export const placeholderValidator = s.string.lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);
|
||||
export const labelValidator = s.string
|
||||
.lengthGreaterThanOrEqual(1)
|
||||
.lengthLessThanOrEqual(45)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
@@ -3,17 +3,16 @@ import { ApplicationCommandType, ApplicationIntegrationType, InteractionContextT
|
||||
import { isValidationEnabled } from '../../util/validation.js';
|
||||
import type { ContextMenuCommandType } from './ContextMenuCommandBuilder.js';
|
||||
|
||||
const namePredicate = s
|
||||
.string()
|
||||
const namePredicate = s.string
|
||||
.lengthGreaterThanOrEqual(1)
|
||||
.lengthLessThanOrEqual(32)
|
||||
// eslint-disable-next-line prefer-named-capture-group
|
||||
.regex(/^( *[\p{P}\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}]+ *)+$/u)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
const typePredicate = s
|
||||
.union([s.literal(ApplicationCommandType.User), s.literal(ApplicationCommandType.Message)])
|
||||
.union(s.literal(ApplicationCommandType.User), s.literal(ApplicationCommandType.Message))
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
const booleanPredicate = s.boolean();
|
||||
const booleanPredicate = s.boolean;
|
||||
|
||||
export function validateDefaultPermission(value: unknown): asserts value is boolean {
|
||||
booleanPredicate.parse(value);
|
||||
@@ -35,22 +34,17 @@ export function validateRequiredParameters(name: string, type: number) {
|
||||
validateType(type);
|
||||
}
|
||||
|
||||
const dmPermissionPredicate = s.boolean().nullish();
|
||||
const dmPermissionPredicate = s.boolean.nullish;
|
||||
|
||||
export function validateDMPermission(value: unknown): asserts value is boolean | null | undefined {
|
||||
dmPermissionPredicate.parse(value);
|
||||
}
|
||||
|
||||
const memberPermissionPredicate = s
|
||||
.union([
|
||||
s.bigint().transform((value) => value.toString()),
|
||||
s
|
||||
.number()
|
||||
.safeInt()
|
||||
.transform((value) => value.toString()),
|
||||
s.string().regex(/^\d+$/),
|
||||
])
|
||||
.nullish();
|
||||
const memberPermissionPredicate = s.union(
|
||||
s.bigint.transform((value) => value.toString()),
|
||||
s.number.safeInt.transform((value) => value.toString()),
|
||||
s.string.regex(/^\d+$/),
|
||||
).nullish;
|
||||
|
||||
export function validateDefaultMemberPermissions(permissions: unknown) {
|
||||
return memberPermissionPredicate.parse(permissions);
|
||||
|
||||
@@ -67,8 +67,6 @@ export class ContextMenuCommandBuilder {
|
||||
*
|
||||
* @remarks
|
||||
* By default, commands are visible. This property is only for global commands.
|
||||
* @deprecated
|
||||
* Use {@link ContextMenuCommandBuilder.contexts} instead.
|
||||
*/
|
||||
public readonly dm_permission: boolean | undefined = undefined;
|
||||
|
||||
@@ -169,7 +167,6 @@ export class ContextMenuCommandBuilder {
|
||||
* By default, commands are visible. This method is only for global commands.
|
||||
* @param enabled - Whether the command should be enabled in direct messages
|
||||
* @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions}
|
||||
* @deprecated Use {@link ContextMenuCommandBuilder.setContexts} instead.
|
||||
*/
|
||||
public setDMPermission(enabled: boolean | null | undefined) {
|
||||
// Assert the value matches the conditions
|
||||
|
||||
@@ -3,15 +3,13 @@ import { ActionRowBuilder, type ModalActionRowComponentBuilder } from '../../com
|
||||
import { customIdValidator } from '../../components/Assertions.js';
|
||||
import { isValidationEnabled } from '../../util/validation.js';
|
||||
|
||||
export const titleValidator = s
|
||||
.string()
|
||||
export const titleValidator = s.string
|
||||
.lengthGreaterThanOrEqual(1)
|
||||
.lengthLessThanOrEqual(45)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
export const componentsValidator = s
|
||||
.instance(ActionRowBuilder)
|
||||
.array()
|
||||
.lengthGreaterThanOrEqual(1)
|
||||
.array.lengthGreaterThanOrEqual(1)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export function validateRequiredParameters(
|
||||
|
||||
@@ -11,8 +11,7 @@ import type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder.js';
|
||||
import type { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands.js';
|
||||
import type { ApplicationCommandOptionBase } from './mixins/ApplicationCommandOptionBase.js';
|
||||
|
||||
const namePredicate = s
|
||||
.string()
|
||||
const namePredicate = s.string
|
||||
.lengthGreaterThanOrEqual(1)
|
||||
.lengthLessThanOrEqual(32)
|
||||
.regex(/^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u)
|
||||
@@ -22,8 +21,7 @@ export function validateName(name: unknown): asserts name is string {
|
||||
namePredicate.parse(name);
|
||||
}
|
||||
|
||||
const descriptionPredicate = s
|
||||
.string()
|
||||
const descriptionPredicate = s.string
|
||||
.lengthGreaterThanOrEqual(1)
|
||||
.lengthLessThanOrEqual(100)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
@@ -33,7 +31,7 @@ export function validateDescription(description: unknown): asserts description i
|
||||
descriptionPredicate.parse(description);
|
||||
}
|
||||
|
||||
const maxArrayLengthPredicate = s.unknown().array().lengthLessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
||||
const maxArrayLengthPredicate = s.unknown.array.lengthLessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
||||
export function validateLocale(locale: unknown) {
|
||||
return localePredicate.parse(locale);
|
||||
}
|
||||
@@ -57,7 +55,7 @@ export function validateRequiredParameters(
|
||||
validateMaxOptionsLength(options);
|
||||
}
|
||||
|
||||
const booleanPredicate = s.boolean();
|
||||
const booleanPredicate = s.boolean;
|
||||
|
||||
export function validateDefaultPermission(value: unknown): asserts value is boolean {
|
||||
booleanPredicate.parse(value);
|
||||
@@ -67,7 +65,7 @@ export function validateRequired(required: unknown): asserts required is boolean
|
||||
booleanPredicate.parse(required);
|
||||
}
|
||||
|
||||
const choicesLengthPredicate = s.number().lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
||||
const choicesLengthPredicate = s.number.lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export function validateChoicesLength(amountAdding: number, choices?: APIApplicationCommandOptionChoice[]): void {
|
||||
choicesLengthPredicate.parse((choices?.length ?? 0) + amountAdding);
|
||||
@@ -80,31 +78,24 @@ export function assertReturnOfBuilder<
|
||||
}
|
||||
|
||||
export const localizationMapPredicate = s
|
||||
.object<LocalizationMap>(Object.fromEntries(Object.values(Locale).map((locale) => [locale, s.string().nullish()])))
|
||||
.strict()
|
||||
.nullish()
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
.object<LocalizationMap>(Object.fromEntries(Object.values(Locale).map((locale) => [locale, s.string.nullish])))
|
||||
.strict.nullish.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export function validateLocalizationMap(value: unknown): asserts value is LocalizationMap {
|
||||
localizationMapPredicate.parse(value);
|
||||
}
|
||||
|
||||
const dmPermissionPredicate = s.boolean().nullish();
|
||||
const dmPermissionPredicate = s.boolean.nullish;
|
||||
|
||||
export function validateDMPermission(value: unknown): asserts value is boolean | null | undefined {
|
||||
dmPermissionPredicate.parse(value);
|
||||
}
|
||||
|
||||
const memberPermissionPredicate = s
|
||||
.union([
|
||||
s.bigint().transform((value) => value.toString()),
|
||||
s
|
||||
.number()
|
||||
.safeInt()
|
||||
.transform((value) => value.toString()),
|
||||
s.string().regex(/^\d+$/),
|
||||
])
|
||||
.nullish();
|
||||
const memberPermissionPredicate = s.union(
|
||||
s.bigint.transform((value) => value.toString()),
|
||||
s.number.safeInt.transform((value) => value.toString()),
|
||||
s.string.regex(/^\d+$/),
|
||||
).nullish;
|
||||
|
||||
export function validateDefaultMemberPermissions(permissions: unknown) {
|
||||
return memberPermissionPredicate.parse(permissions);
|
||||
|
||||
@@ -63,8 +63,6 @@ export class SlashCommandBuilder {
|
||||
*
|
||||
* @remarks
|
||||
* By default, commands are visible. This property is only for global commands.
|
||||
* @deprecated
|
||||
* Use {@link SlashCommandBuilder.contexts} instead.
|
||||
*/
|
||||
public readonly dm_permission: boolean | undefined = undefined;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ const allowedChannelTypes = [
|
||||
*/
|
||||
export type ApplicationCommandOptionAllowedChannelTypes = (typeof allowedChannelTypes)[number];
|
||||
|
||||
const channelTypesPredicate = s.array(s.union(allowedChannelTypes.map((type) => s.literal(type))));
|
||||
const channelTypesPredicate = s.array(s.union(...allowedChannelTypes.map((type) => s.literal(type))));
|
||||
|
||||
/**
|
||||
* This mixin holds channel type symbols used for options.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { s } from '@sapphire/shapeshift';
|
||||
import type { ApplicationCommandOptionType } from 'discord-api-types/v10';
|
||||
|
||||
const booleanPredicate = s.boolean();
|
||||
const booleanPredicate = s.boolean;
|
||||
|
||||
/**
|
||||
* This mixin holds choices and autocomplete symbols used for options.
|
||||
|
||||
@@ -3,15 +3,13 @@ import { ApplicationCommandOptionType, type APIApplicationCommandOptionChoice }
|
||||
import { normalizeArray, type RestOrArray } from '../../../util/normalizeArray.js';
|
||||
import { localizationMapPredicate, validateChoicesLength } from '../Assertions.js';
|
||||
|
||||
const stringPredicate = s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
|
||||
const numberPredicate = s.number().greaterThan(Number.NEGATIVE_INFINITY).lessThan(Number.POSITIVE_INFINITY);
|
||||
const choicesPredicate = s
|
||||
.object({
|
||||
name: stringPredicate,
|
||||
name_localizations: localizationMapPredicate,
|
||||
value: s.union([stringPredicate, numberPredicate]),
|
||||
})
|
||||
.array();
|
||||
const stringPredicate = s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
|
||||
const numberPredicate = s.number.greaterThan(Number.NEGATIVE_INFINITY).lessThan(Number.POSITIVE_INFINITY);
|
||||
const choicesPredicate = s.object({
|
||||
name: stringPredicate,
|
||||
name_localizations: localizationMapPredicate,
|
||||
value: s.union(stringPredicate, numberPredicate),
|
||||
}).array;
|
||||
|
||||
/**
|
||||
* This mixin holds choices and autocomplete symbols used for options.
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import {
|
||||
ApplicationCommandType,
|
||||
type ApplicationIntegrationType,
|
||||
type InteractionContextType,
|
||||
type LocalizationMap,
|
||||
type Permissions,
|
||||
type RESTPostAPIChatInputApplicationCommandsJSONBody,
|
||||
import type {
|
||||
ApplicationIntegrationType,
|
||||
InteractionContextType,
|
||||
LocalizationMap,
|
||||
Permissions,
|
||||
RESTPostAPIChatInputApplicationCommandsJSONBody,
|
||||
} from 'discord-api-types/v10';
|
||||
import type { RestOrArray } from '../../../util/normalizeArray.js';
|
||||
import { normalizeArray } from '../../../util/normalizeArray.js';
|
||||
@@ -43,9 +42,6 @@ export class SharedSlashCommand {
|
||||
|
||||
public readonly default_member_permissions: Permissions | null | undefined = undefined;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link SharedSlashCommand.contexts} instead.
|
||||
*/
|
||||
public readonly dm_permission: boolean | undefined = undefined;
|
||||
|
||||
public readonly integration_types?: ApplicationIntegrationType[];
|
||||
@@ -116,8 +112,6 @@ export class SharedSlashCommand {
|
||||
* By default, commands are visible. This method is only for global commands.
|
||||
* @param enabled - Whether the command should be enabled in direct messages
|
||||
* @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions}
|
||||
* @deprecated
|
||||
* Use {@link SharedSlashCommand.setContexts} instead.
|
||||
*/
|
||||
public setDMPermission(enabled: boolean | null | undefined) {
|
||||
// Assert the value matches the conditions
|
||||
@@ -155,7 +149,6 @@ export class SharedSlashCommand {
|
||||
|
||||
return {
|
||||
...this,
|
||||
type: ApplicationCommandType.ChatInput,
|
||||
options: this.options.map((option) => option.toJSON()),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOption
|
||||
import { ApplicationCommandOptionWithAutocompleteMixin } from '../mixins/ApplicationCommandOptionWithAutocompleteMixin.js';
|
||||
import { ApplicationCommandOptionWithChoicesMixin } from '../mixins/ApplicationCommandOptionWithChoicesMixin.js';
|
||||
|
||||
const numberValidator = s.number().int();
|
||||
const numberValidator = s.number.int;
|
||||
|
||||
/**
|
||||
* A slash command integer option.
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOption
|
||||
import { ApplicationCommandOptionWithAutocompleteMixin } from '../mixins/ApplicationCommandOptionWithAutocompleteMixin.js';
|
||||
import { ApplicationCommandOptionWithChoicesMixin } from '../mixins/ApplicationCommandOptionWithChoicesMixin.js';
|
||||
|
||||
const numberValidator = s.number();
|
||||
const numberValidator = s.number;
|
||||
|
||||
/**
|
||||
* A slash command number option.
|
||||
|
||||
@@ -5,8 +5,8 @@ import { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOption
|
||||
import { ApplicationCommandOptionWithAutocompleteMixin } from '../mixins/ApplicationCommandOptionWithAutocompleteMixin.js';
|
||||
import { ApplicationCommandOptionWithChoicesMixin } from '../mixins/ApplicationCommandOptionWithChoicesMixin.js';
|
||||
|
||||
const minLengthValidator = s.number().greaterThanOrEqual(0).lessThanOrEqual(6_000);
|
||||
const maxLengthValidator = s.number().greaterThanOrEqual(1).lessThanOrEqual(6_000);
|
||||
const minLengthValidator = s.number.greaterThanOrEqual(0).lessThanOrEqual(6_000);
|
||||
const maxLengthValidator = s.number.greaterThanOrEqual(1).lessThanOrEqual(6_000);
|
||||
|
||||
/**
|
||||
* A slash command string option.
|
||||
|
||||
@@ -2,19 +2,17 @@ import { s } from '@sapphire/shapeshift';
|
||||
import type { APIEmbedField } from 'discord-api-types/v10';
|
||||
import { isValidationEnabled } from '../../util/validation.js';
|
||||
|
||||
export const fieldNamePredicate = s
|
||||
.string()
|
||||
export const fieldNamePredicate = s.string
|
||||
.lengthGreaterThanOrEqual(1)
|
||||
.lengthLessThanOrEqual(256)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const fieldValuePredicate = s
|
||||
.string()
|
||||
export const fieldValuePredicate = s.string
|
||||
.lengthGreaterThanOrEqual(1)
|
||||
.lengthLessThanOrEqual(1_024)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const fieldInlinePredicate = s.boolean().optional();
|
||||
export const fieldInlinePredicate = s.boolean.optional;
|
||||
|
||||
export const embedFieldPredicate = s
|
||||
.object({
|
||||
@@ -24,31 +22,27 @@ export const embedFieldPredicate = s
|
||||
})
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const embedFieldsArrayPredicate = embedFieldPredicate.array().setValidationEnabled(isValidationEnabled);
|
||||
export const embedFieldsArrayPredicate = embedFieldPredicate.array.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const fieldLengthPredicate = s.number().lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
||||
export const fieldLengthPredicate = s.number.lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export function validateFieldLength(amountAdding: number, fields?: APIEmbedField[]): void {
|
||||
fieldLengthPredicate.parse((fields?.length ?? 0) + amountAdding);
|
||||
}
|
||||
|
||||
export const authorNamePredicate = fieldNamePredicate.nullable().setValidationEnabled(isValidationEnabled);
|
||||
export const authorNamePredicate = fieldNamePredicate.nullable.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const imageURLPredicate = s
|
||||
.string()
|
||||
export const imageURLPredicate = s.string
|
||||
.url({
|
||||
allowedProtocols: ['http:', 'https:', 'attachment:'],
|
||||
})
|
||||
.nullish()
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
.nullish.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const urlPredicate = s
|
||||
.string()
|
||||
export const urlPredicate = s.string
|
||||
.url({
|
||||
allowedProtocols: ['http:', 'https:'],
|
||||
})
|
||||
.nullish()
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
.nullish.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const embedAuthorPredicate = s
|
||||
.object({
|
||||
@@ -58,34 +52,25 @@ export const embedAuthorPredicate = s
|
||||
})
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const RGBPredicate = s
|
||||
.number()
|
||||
.int()
|
||||
export const RGBPredicate = s.number.int
|
||||
.greaterThanOrEqual(0)
|
||||
.lessThanOrEqual(255)
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
export const colorPredicate = s
|
||||
.number()
|
||||
.int()
|
||||
export const colorPredicate = s.number.int
|
||||
.greaterThanOrEqual(0)
|
||||
.lessThanOrEqual(0xffffff)
|
||||
.or(s.tuple([RGBPredicate, RGBPredicate, RGBPredicate]))
|
||||
.nullable()
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
.nullable.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const descriptionPredicate = s
|
||||
.string()
|
||||
export const descriptionPredicate = s.string
|
||||
.lengthGreaterThanOrEqual(1)
|
||||
.lengthLessThanOrEqual(4_096)
|
||||
.nullable()
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
.nullable.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const footerTextPredicate = s
|
||||
.string()
|
||||
export const footerTextPredicate = s.string
|
||||
.lengthGreaterThanOrEqual(1)
|
||||
.lengthLessThanOrEqual(2_048)
|
||||
.nullable()
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
.nullable.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const embedFooterPredicate = s
|
||||
.object({
|
||||
@@ -94,6 +79,6 @@ export const embedFooterPredicate = s
|
||||
})
|
||||
.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const timestampPredicate = s.union([s.number(), s.date()]).nullable().setValidationEnabled(isValidationEnabled);
|
||||
export const timestampPredicate = s.union(s.number, s.date).nullable.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
export const titlePredicate = fieldNamePredicate.nullable().setValidationEnabled(isValidationEnabled);
|
||||
export const titlePredicate = fieldNamePredicate.nullable.setValidationEnabled(isValidationEnabled);
|
||||
|
||||
@@ -2,20 +2,6 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
# [@discordjs/collection@2.1.1](https://github.com/discordjs/discord.js/compare/@discordjs/collection@2.1.0...@discordjs/collection@2.1.1) - (2024-09-01)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **build:** Update to support strictBuiltinIteratorReturn (#10394) ([bf83db9](https://github.com/discordjs/discord.js/commit/bf83db9480e9f31d5dadee38a2d053a543150776))
|
||||
|
||||
## Testing
|
||||
|
||||
- Complete collection coverage (#10380) ([d8e94d8](https://github.com/discordjs/discord.js/commit/d8e94d8f10367d165d15904f7c7a31165842f9ec))
|
||||
|
||||
## Typings
|
||||
|
||||
- **collection:** Reduce* method signatures (#10405) ([6b38335](https://github.com/discordjs/discord.js/commit/6b383350a6de6d26b62cf62f619c89ffb0d6b0d1))
|
||||
|
||||
# [@discordjs/collection@2.1.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@2.0.0...@discordjs/collection@2.1.0) - (2024-05-04)
|
||||
|
||||
## Bug Fixes
|
||||
@@ -194,6 +180,174 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
- Cleanup tests and tsup configs ([6b8ef20](https://github.com/discordjs/discord.js/commit/6b8ef20cb3af5b5cfd176dd0aa0a1a1e98551629))
|
||||
|
||||
# [@discordjs/collection@1.5.3](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.5.2...@discordjs/collection@1.5.3) - (2023-08-17)
|
||||
|
||||
## Documentation
|
||||
|
||||
- Update Node.js requirement to 16.11.0 (#9764) ([188877c](https://github.com/discordjs/discord.js/commit/188877c50af70f0d5cffb246620fa277435c6ce6))
|
||||
|
||||
# [@discordjs/collection@1.5.2](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.5.1...@discordjs/collection@1.5.2) - (2023-07-31)
|
||||
|
||||
## Refactor
|
||||
|
||||
- **collection:** Reduce `reduce`'s code (#9581) ([b85a3f2](https://github.com/discordjs/discord.js/commit/b85a3f2ddee8fc5974749b95fc07389a03093df2))
|
||||
|
||||
# [@discordjs/collection@1.5.1](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.5.0...@discordjs/collection@1.5.1) - (2023-05-01)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Fix external links (#9313) ([a7425c2](https://github.com/discordjs/discord.js/commit/a7425c29c4f23f1b31f4c6a463107ca9eb7fd7e2))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Generate static imports for types with api-extractor ([98a76db](https://github.com/discordjs/discord.js/commit/98a76db482879f79d6bb2fb2e5fc65ac2c34e2d9))
|
||||
|
||||
# [@discordjs/collection@1.5.2](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.5.1...@discordjs/collection@1.5.2) - (2023-07-31)
|
||||
|
||||
## Refactor
|
||||
|
||||
- **collection:** Reduce `reduce`'s code (#9581) ([b85a3f2](https://github.com/discordjs/discord.js/commit/b85a3f2ddee8fc5974749b95fc07389a03093df2))
|
||||
|
||||
# [@discordjs/collection@1.5.1](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.5.0...@discordjs/collection@1.5.1) - (2023-05-01)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Fix external links (#9313) ([a7425c2](https://github.com/discordjs/discord.js/commit/a7425c29c4f23f1b31f4c6a463107ca9eb7fd7e2))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Generate static imports for types with api-extractor ([98a76db](https://github.com/discordjs/discord.js/commit/98a76db482879f79d6bb2fb2e5fc65ac2c34e2d9))
|
||||
|
||||
# [@discordjs/collection@1.5.1](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.5.0...@discordjs/collection@1.5.1) - (2023-05-01)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Fix external links (#9313) ([a7425c2](https://github.com/discordjs/discord.js/commit/a7425c29c4f23f1b31f4c6a463107ca9eb7fd7e2))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Generate static imports for types with api-extractor ([98a76db](https://github.com/discordjs/discord.js/commit/98a76db482879f79d6bb2fb2e5fc65ac2c34e2d9))
|
||||
|
||||
# [@discordjs/collection@1.5.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.4.0...@discordjs/collection@1.5.0) - (2023-04-01)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **scripts:** Accessing tsComment ([d8d5f31](https://github.com/discordjs/discord.js/commit/d8d5f31d3927fd1de62f1fa3a1a6e454243ad87b))
|
||||
|
||||
## Features
|
||||
|
||||
- **website:** Render syntax and mdx on the server (#9086) ([ee5169e](https://github.com/discordjs/discord.js/commit/ee5169e0aadd7bbfcd752aae614ec0f69602b68b))
|
||||
|
||||
## Refactor
|
||||
|
||||
- **collection:** Fix/silence linter warnings (#9266) ([d6f4e60](https://github.com/discordjs/discord.js/commit/d6f4e60efd1a1796fc84dbbfbac4f9790e480a1c))
|
||||
|
||||
# [@discordjs/collection@1.4.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.3.0...@discordjs/collection@1.4.0) - (2023-03-12)
|
||||
|
||||
## Documentation
|
||||
|
||||
- Fix version export (#9049) ([8b70f49](https://github.com/discordjs/discord.js/commit/8b70f497a1207e30edebdecd12b926c981c13d28))
|
||||
|
||||
## Features
|
||||
|
||||
- **website:** Add support for source file links (#9048) ([f6506e9](https://github.com/discordjs/discord.js/commit/f6506e99c496683ee0ab67db0726b105b929af38))
|
||||
|
||||
## Refactor
|
||||
|
||||
- Compare with `undefined` directly (#9191) ([869153c](https://github.com/discordjs/discord.js/commit/869153c3fdf155783e7c0ecebd3627b087c3a026))
|
||||
|
||||
# [@discordjs/collection@1.3.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.2.0...@discordjs/collection@1.3.0) - (2022-11-28)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Pin @types/node version ([9d8179c](https://github.com/discordjs/discord.js/commit/9d8179c6a78e1c7f9976f852804055964d5385d4))
|
||||
|
||||
## Features
|
||||
|
||||
- Add `Collection#subtract()` (#8393) ([291f36c](https://github.com/discordjs/discord.js/commit/291f36cd736b5dea058145a1335bf7c78ec1d81d))
|
||||
|
||||
# [@discordjs/collection@1.2.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.1.0...@discordjs/collection@1.2.0) - (2022-10-08)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Footer / sidebar / deprecation alert ([ba3e0ed](https://github.com/discordjs/discord.js/commit/ba3e0ed348258fe8e51eefb4aa7379a1230616a9))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Change name (#8604) ([dd5a089](https://github.com/discordjs/discord.js/commit/dd5a08944c258a847fc4377f1d5e953264ab47d0))
|
||||
- Remove xml tag from collection#find (#8550) ([4032457](https://github.com/discordjs/discord.js/commit/40324574ebea9894cadcc967e0db0e4e21d62768))
|
||||
|
||||
## Features
|
||||
|
||||
- Web-components (#8715) ([0ac3e76](https://github.com/discordjs/discord.js/commit/0ac3e766bd9dbdeb106483fa4bb085d74de346a2))
|
||||
|
||||
## Refactor
|
||||
|
||||
- Website components (#8600) ([c334157](https://github.com/discordjs/discord.js/commit/c3341570d983aea9ecc419979d5a01de658c9d67))
|
||||
- Use `eslint-config-neon` for packages. (#8579) ([edadb9f](https://github.com/discordjs/discord.js/commit/edadb9fe5dfd9ff51a3cfc9b25cb242d3f9f5241))
|
||||
|
||||
## Typings
|
||||
|
||||
- **Collection:** Make fn return type unknown (#8676) ([822b7f2](https://github.com/discordjs/discord.js/commit/822b7f234af053c8f917b0a998b82abfccd33801))
|
||||
|
||||
# [@discordjs/collection@1.1.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.0.1...@discordjs/collection@1.1.0) - (2022-08-22)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Use proper format for `@link` text (#8384) ([2655639](https://github.com/discordjs/discord.js/commit/26556390a3800e954974a00c1328ff47d3e67e9a))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Fence examples in codeblocks ([193b252](https://github.com/discordjs/discord.js/commit/193b252672440a860318d3c2968aedd9cb88e0ce))
|
||||
- Use link tags (#8382) ([5494791](https://github.com/discordjs/discord.js/commit/549479131318c659f86f0eb18578d597e22522d3))
|
||||
|
||||
## Features
|
||||
|
||||
- **website:** Show `constructor` information (#8540) ([e42fd16](https://github.com/discordjs/discord.js/commit/e42fd1636973b10dd7ed6fb4280ee1a4a8f82007))
|
||||
- **website:** Show descriptions for `@typeParam` blocks (#8523) ([e475b63](https://github.com/discordjs/discord.js/commit/e475b63f257f6261d73cb89fee9ecbcdd84e2a6b))
|
||||
|
||||
## Refactor
|
||||
|
||||
- **website:** Adjust typography (#8503) ([0f83402](https://github.com/discordjs/discord.js/commit/0f834029850d2448981596cf082ff59917018d66))
|
||||
- Docs design (#8487) ([4ab1d09](https://github.com/discordjs/discord.js/commit/4ab1d09997a18879a9eb9bda39df6f15aa22557e))
|
||||
|
||||
# [@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
|
||||
|
||||
- Cleanup tests and tsup configs ([6b8ef20](https://github.com/discordjs/discord.js/commit/6b8ef20cb3af5b5cfd176dd0aa0a1a1e98551629))
|
||||
|
||||
# [@discordjs/collection@0.6.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@0.5.0...@discordjs/collection@0.6.0) - (2022-04-17)
|
||||
|
||||
## Features
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
<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://github.com/discordjs/discord.js/commits/main/packages/collection"><img alt="Last commit." src="https://img.shields.io/github/last-commit/discordjs/discord.js?logo=github&logoColor=ffffff&path=packages%2Fcollection"></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>
|
||||
<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>
|
||||
|
||||
@@ -713,57 +713,14 @@ describe('reduce() tests', () => {
|
||||
expect<number>(sum).toStrictEqual(6);
|
||||
});
|
||||
|
||||
test('reduce collection into a single value with different accumulator type', () => {
|
||||
const str = coll.reduce((a, x) => a.concat(x.toString()), '');
|
||||
expect<string>(str).toStrictEqual('123');
|
||||
});
|
||||
|
||||
test('reduce empty collection with initial value', () => {
|
||||
const coll = createCollection();
|
||||
expect<number>(coll.reduce((a, x) => a + x, 0)).toStrictEqual(0);
|
||||
expect(coll.reduce((a, x) => a + x, 0)).toStrictEqual(0);
|
||||
});
|
||||
|
||||
test('reduce empty collection without initial value', () => {
|
||||
const coll = createCollection();
|
||||
expect(() => coll.reduce((a, x) => a + x)).toThrowError(
|
||||
new TypeError('Reduce of empty collection with no initial value'),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('reduceRight() tests', () => {
|
||||
const coll = createTestCollection();
|
||||
|
||||
test('throws if fn is not a function', () => {
|
||||
// @ts-expect-error: Invalid function
|
||||
expectInvalidFunctionError(() => coll.reduceRight());
|
||||
// @ts-expect-error: Invalid function
|
||||
expectInvalidFunctionError(() => coll.reduceRight(123), 123);
|
||||
});
|
||||
|
||||
test('reduce collection into a single value with initial value', () => {
|
||||
const sum = coll.reduceRight((a, x) => a + x, 0);
|
||||
expect<number>(sum).toStrictEqual(6);
|
||||
});
|
||||
|
||||
test('reduce collection into a single value without initial value', () => {
|
||||
const sum = coll.reduceRight((a, x) => a + x);
|
||||
expect<number>(sum).toStrictEqual(6);
|
||||
});
|
||||
|
||||
test('reduce collection into a single value with different accumulator type', () => {
|
||||
const str = coll.reduceRight((a, x) => a.concat(x.toString()), '');
|
||||
expect<string>(str).toStrictEqual('321');
|
||||
});
|
||||
|
||||
test('reduce empty collection with initial value', () => {
|
||||
const coll = createCollection();
|
||||
expect<number>(coll.reduceRight((a, x) => a + x, 0)).toStrictEqual(0);
|
||||
});
|
||||
|
||||
test('reduce empty collection without initial value', () => {
|
||||
const coll = createCollection();
|
||||
expect(() => coll.reduceRight((a, x) => a + x)).toThrowError(
|
||||
expect(() => coll.reduce((a: number, x) => a + x)).toThrowError(
|
||||
new TypeError('Reduce of empty collection with no initial value'),
|
||||
);
|
||||
});
|
||||
@@ -1056,3 +1013,31 @@ describe('findLastKey() tests', () => {
|
||||
}, null);
|
||||
});
|
||||
});
|
||||
|
||||
describe('reduceRight() tests', () => {
|
||||
const coll = createTestCollection();
|
||||
|
||||
test('throws if fn is not a function', () => {
|
||||
// @ts-expect-error: Invalid function
|
||||
expectInvalidFunctionError(() => coll.reduceRight());
|
||||
// @ts-expect-error: Invalid function
|
||||
expectInvalidFunctionError(() => coll.reduceRight(123), 123);
|
||||
});
|
||||
|
||||
test('reduce collection into a single value with initial value', () => {
|
||||
const sum = coll.reduceRight((a, x) => a + x, 0);
|
||||
expect(sum).toStrictEqual(6);
|
||||
});
|
||||
|
||||
test('reduce collection into a single value without initial value', () => {
|
||||
const sum = coll.reduceRight<number>((a, x) => a + x);
|
||||
expect(sum).toStrictEqual(6);
|
||||
});
|
||||
|
||||
test('reduce empty collection without initial value', () => {
|
||||
const coll = createCollection();
|
||||
expect(() => coll.reduceRight((a: number, x) => a + x)).toThrowError(
|
||||
new TypeError('Reduce of empty collection with no initial value'),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,16 +5,13 @@ header = """
|
||||
All notable changes to this project will be documented in this file.\n
|
||||
"""
|
||||
body = """
|
||||
{%- macro remote_url() -%}
|
||||
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
|
||||
{%- endmacro -%}
|
||||
{% if version %}\
|
||||
# [{{ version | trim_start_matches(pat="v") }}]\
|
||||
{% if previous %}\
|
||||
{% if previous.version %}\
|
||||
({{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }})\
|
||||
(https://github.com/discordjs/discord.js/compare/{{ previous.version }}...{{ version }})\
|
||||
{% else %}\
|
||||
({{ self::remote_url() }}/tree/{{ version }})\
|
||||
(https://github.com/discordjs/discord.js/tree/{{ version }})\
|
||||
{% endif %}\
|
||||
{% endif %} \
|
||||
- ({{ timestamp | date(format="%Y-%m-%d") }})
|
||||
@@ -27,23 +24,14 @@ body = """
|
||||
- {% if commit.scope %}\
|
||||
**{{commit.scope}}:** \
|
||||
{% endif %}\
|
||||
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
|
||||
{% if commit.github.username %} by @{{ commit.github.username }}{%- endif %}\
|
||||
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/discordjs/discord.js/commit/{{ commit.id }}))\
|
||||
{% if commit.breaking %}\
|
||||
{% for footer in commit.footers %}\
|
||||
{% if footer.breaking %}\
|
||||
\n{% raw %} {% endraw %}- **{{ footer.token }}{{ footer.separator }}** {{ footer.value }}\
|
||||
{% endif %}\
|
||||
{% for breakingChange in commit.footers %}\
|
||||
\n{% raw %} {% endraw %}- **{{ breakingChange.token }}{{ breakingChange.separator }}** {{ breakingChange.value }}\
|
||||
{% endfor %}\
|
||||
{% endif %}\
|
||||
{% endfor %}
|
||||
{% endfor %}\
|
||||
{% if github.contributors | filter(attribute="is_first_time", value=true) | length %}\
|
||||
\n### New Contributors\n
|
||||
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}\
|
||||
* @{{ contributor.username }} made their first contribution in #{{ contributor.pr_number }}
|
||||
{% endfor %}\
|
||||
{% endif %}\n
|
||||
{% endfor %}\n
|
||||
"""
|
||||
trim = true
|
||||
footer = ""
|
||||
@@ -71,9 +59,5 @@ commit_parsers = [
|
||||
filter_commits = true
|
||||
tag_pattern = "@discordjs/collection@[0-9]*"
|
||||
ignore_tags = ""
|
||||
topo_order = false
|
||||
topo_order = true
|
||||
sort_commits = "newest"
|
||||
|
||||
[remote.github]
|
||||
owner = "discordjs"
|
||||
repo = "discord.js"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "@discordjs/collection",
|
||||
"version": "2.1.1",
|
||||
"version": "2.1.0",
|
||||
"description": "Utility data structure used in discord.js",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
@@ -41,7 +41,7 @@
|
||||
"Crawl <icrawltogo@gmail.com>",
|
||||
"Amish Shah <amishshah.2k@gmail.com>",
|
||||
"SpaceEEC <spaceeec@yahoo.com>",
|
||||
"Vlad Frangu <me@vladfrangu.dev>",
|
||||
"Vlad Frangu <kingdgrizzle@gmail.com>",
|
||||
"Aura Román <kyradiscord@gmail.com>"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
@@ -63,19 +63,19 @@
|
||||
"devDependencies": {
|
||||
"@discordjs/api-extractor": "workspace:^",
|
||||
"@discordjs/scripts": "workspace:^",
|
||||
"@favware/cliff-jumper": "^4.1.0",
|
||||
"@types/node": "^18.19.45",
|
||||
"@vitest/coverage-v8": "^2.0.5",
|
||||
"@favware/cliff-jumper": "^3.0.3",
|
||||
"@types/node": "18.18.8",
|
||||
"@vitest/coverage-v8": "^1.6.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild-plugin-version-injector": "^1.2.1",
|
||||
"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.3.0",
|
||||
"tsup": "^8.1.0",
|
||||
"turbo": "^1.13.3",
|
||||
"typescript": "^5.4.5",
|
||||
"vitest": "^1.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
@@ -87,7 +87,7 @@ export class Collection<Key, Value> extends Map<Key, Value> {
|
||||
if (amount < 0) return this.last(amount * -1);
|
||||
amount = Math.min(this.size, amount);
|
||||
const iter = this.values();
|
||||
return Array.from({ length: amount }, (): Value => iter.next().value!);
|
||||
return Array.from({ length: amount }, (): Value => iter.next().value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +104,7 @@ export class Collection<Key, Value> extends Map<Key, Value> {
|
||||
if (amount < 0) return this.lastKey(amount * -1);
|
||||
amount = Math.min(this.size, amount);
|
||||
const iter = this.keys();
|
||||
return Array.from({ length: amount }, (): Key => iter.next().value!);
|
||||
return Array.from({ length: amount }, (): Key => iter.next().value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -512,7 +512,7 @@ export class Collection<Key, Value> extends Map<Key, Value> {
|
||||
if (thisArg !== undefined) fn = fn.bind(thisArg);
|
||||
const iter = this.entries();
|
||||
return Array.from({ length: this.size }, (): NewValue => {
|
||||
const [key, value] = iter.next().value!;
|
||||
const [key, value] = iter.next().value;
|
||||
return fn(value, key, this);
|
||||
});
|
||||
}
|
||||
@@ -616,15 +616,7 @@ export class Collection<Key, Value> extends Map<Key, Value> {
|
||||
* collection.reduce((acc, guild) => acc + guild.memberCount, 0);
|
||||
* ```
|
||||
*/
|
||||
public reduce(
|
||||
fn: (accumulator: Value, value: Value, key: Key, collection: this) => Value,
|
||||
initialValue?: Value,
|
||||
): Value;
|
||||
public reduce<InitialValue>(
|
||||
fn: (accumulator: InitialValue, value: Value, key: Key, collection: this) => InitialValue,
|
||||
initialValue: InitialValue,
|
||||
): InitialValue;
|
||||
public reduce<InitialValue>(
|
||||
public reduce<InitialValue = Value>(
|
||||
fn: (accumulator: InitialValue, value: Value, key: Key, collection: this) => InitialValue,
|
||||
initialValue?: InitialValue,
|
||||
): InitialValue {
|
||||
@@ -634,7 +626,7 @@ export class Collection<Key, Value> extends Map<Key, Value> {
|
||||
const iterator = this.entries();
|
||||
if (initialValue === undefined) {
|
||||
if (this.size === 0) throw new TypeError('Reduce of empty collection with no initial value');
|
||||
accumulator = iterator.next().value![1] as unknown as InitialValue;
|
||||
accumulator = iterator.next().value[1];
|
||||
} else {
|
||||
accumulator = initialValue;
|
||||
}
|
||||
@@ -653,14 +645,6 @@ export class Collection<Key, Value> extends Map<Key, Value> {
|
||||
* @param fn - Function used to reduce, taking four arguments; `accumulator`, `value`, `key`, and `collection`
|
||||
* @param initialValue - Starting value for the accumulator
|
||||
*/
|
||||
public reduceRight(
|
||||
fn: (accumulator: Value, value: Value, key: Key, collection: this) => Value,
|
||||
initialValue?: Value,
|
||||
): Value;
|
||||
public reduceRight<InitialValue>(
|
||||
fn: (accumulator: InitialValue, value: Value, key: Key, collection: this) => InitialValue,
|
||||
initialValue: InitialValue,
|
||||
): InitialValue;
|
||||
public reduceRight<InitialValue>(
|
||||
fn: (accumulator: InitialValue, value: Value, key: Key, collection: this) => InitialValue,
|
||||
initialValue?: InitialValue,
|
||||
|
||||
@@ -2,31 +2,6 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
# [@discordjs/core@2.0.0](https://github.com/discordjs/discord.js/compare/@discordjs/core@1.2.0...@discordjs/core@2.0.0) - (2024-09-01)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **OAuth2API:** Enable token exchange without token (#10312) ([9b07036](https://github.com/discordjs/discord.js/commit/9b07036d707b123709480987d5741d6ba75b148b))
|
||||
|
||||
## Documentation
|
||||
|
||||
- **stageInstances:** Correct reference for stage instance creation (#10333) ([7f60a8f](https://github.com/discordjs/discord.js/commit/7f60a8fc5d412718e269774505b2ed4fc30a83cd))
|
||||
|
||||
## Features
|
||||
|
||||
- Use get sticker pack endpoint (#10445) ([1b1ae2f](https://github.com/discordjs/discord.js/commit/1b1ae2f0cb339170e4c0692eb43fbc966fd64030))
|
||||
- **VoiceState:** Add methods for fetching voice state (#10442) ([9907ff9](https://github.com/discordjs/discord.js/commit/9907ff915e7c72e7e980d68bf005763a3aacad1c))
|
||||
- Application emojis (#10399) ([5d92525](https://github.com/discordjs/discord.js/commit/5d92525596a0193fe65626119bb040c2eb9e945a))
|
||||
- **OAuth2API:** Add `revokeToken` method (#10440) ([69adc6f](https://github.com/discordjs/discord.js/commit/69adc6f4b9eb4fafe4a20b01137a270621f1365f))
|
||||
- Premium buttons (#10353) ([4f59b74](https://github.com/discordjs/discord.js/commit/4f59b740d01b9ff2213949708a36e17da32b89c3))
|
||||
- Add `reason` to `followAnnouncements` method (#10275) ([b36ec98](https://github.com/discordjs/discord.js/commit/b36ec983828c7001e47debcd435592ea026768d5))
|
||||
|
||||
## Refactor
|
||||
|
||||
- Use get guild role endpoint (#10443) ([bba0e72](https://github.com/discordjs/discord.js/commit/bba0e72e2283630b9f84b77d53525397036c6b31))
|
||||
- **ws:** Event layout (#10376) ([bf6761a](https://github.com/discordjs/discord.js/commit/bf6761a44adec1fe5017f6bf5d8bc0734916961f))
|
||||
- **BREAKING CHANGE:** All events now emit shard id as its own param
|
||||
|
||||
# [@discordjs/core@1.2.0](https://github.com/discordjs/discord.js/compare/@discordjs/core@1.1.1...@discordjs/core@1.2.0) - (2024-05-04)
|
||||
|
||||
## Bug Fixes
|
||||
@@ -150,6 +125,126 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
- **ChannelsAPI:** Use correct type for `editMessage` (#9399) ([0a1701b](https://github.com/discordjs/discord.js/commit/0a1701b0463919a895c518e5daa9836760d9b6cf))
|
||||
|
||||
# [@discordjs/core@1.0.0](https://github.com/discordjs/discord.js/compare/@discordjs/core@0.6.0...@discordjs/core@1.0.0) - (2023-07-31)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **core:** Fix inconsistencies on `core` (#9680) ([6d5840c](https://github.com/discordjs/discord.js/commit/6d5840c61e5164c461b821fbd79b71b812aa046e))
|
||||
- **client:** Add missing application command permissions update event (#9639) ([2818d7c](https://github.com/discordjs/discord.js/commit/2818d7cc1d76c06252a5d89dbc48c4340cf23f3f))
|
||||
- **api:** Various fixes for overlooked stuff (#9588) ([6c7a5ed](https://github.com/discordjs/discord.js/commit/6c7a5ed1e7f05ca9350cb84c429c76acf3851fc0))
|
||||
- **GuildsAPI:** Use `level` rather than `mfa_level` when editing MFA (#9584) ([3535321](https://github.com/discordjs/discord.js/commit/3535321b98cec4a715aca19e8fd34e6d3b27975f))
|
||||
- **roleConnections:** Fix `body` type for `updateMetadataRecords()` (#9516) ([166c961](https://github.com/discordjs/discord.js/commit/166c9612611b8665a62d8a5f657f64b5a266d0f4))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Define /core token in example (#9586) ([bc2798b](https://github.com/discordjs/discord.js/commit/bc2798b8ee33895506c4bc684b59bc8acefb615d))
|
||||
|
||||
## Features
|
||||
|
||||
- **WebhooksAPI:** Allow `with token` requests without bot auth (#9715) ([bc83cab](https://github.com/discordjs/discord.js/commit/bc83cabfdad76fec9352ddb9a7d488e058ede180))
|
||||
- Guild onboarding (#9120) ([dc73c93](https://github.com/discordjs/discord.js/commit/dc73c938ff9d04a0d7d57630faeb8e81ea343006))
|
||||
- **ChannelsAPI:** Add permission overwrites (#9651) ([78381a5](https://github.com/discordjs/discord.js/commit/78381a56cf9a122d0a44ab1b0966cb0d7691ad7d))
|
||||
- **api:** Add stage instances (#9578) ([985def3](https://github.com/discordjs/discord.js/commit/985def3f255b37891642172a3c83897c1d2749f6))
|
||||
- **GuildsAPI:** Add `removeMember()` (#9576) ([5d6eed6](https://github.com/discordjs/discord.js/commit/5d6eed64140029837043cf537033b97c40f39607))
|
||||
- **api:** Add `getMemberBans()` query options and `getMemberBan()` (#9569) ([590f5bc](https://github.com/discordjs/discord.js/commit/590f5bc38e6eab09e8d3d6cfd3967390202913c4))
|
||||
- **client:** Support more request member fields (#9475) ([1edd01a](https://github.com/discordjs/discord.js/commit/1edd01a7a494ee7604b81bc2a3ec25a55d957f92))
|
||||
|
||||
## Refactor
|
||||
|
||||
- **rest:** Switch api to fetch-like and provide strategies (#9416) ([cdaa0a3](https://github.com/discordjs/discord.js/commit/cdaa0a36f586459f1e5ede868c4250c7da90455c))
|
||||
- **BREAKING CHANGE:** NodeJS v18+ is required when using node due to the use of global `fetch`
|
||||
- **BREAKING CHANGE:** The raw method of REST now returns a web compatible `Respone` object.
|
||||
- **BREAKING CHANGE:** The `parseResponse` utility method has been updated to operate on a web compatible `Response` object.
|
||||
- **BREAKING CHANGE:** Many underlying internals have changed, some of which were exported.
|
||||
- **BREAKING CHANGE:** `DefaultRestOptions` used to contain a default `agent`, which is now set to `null` instead.
|
||||
|
||||
## Typings
|
||||
|
||||
- Use `Snowflake` instead of `string` for snowflakes (#9583) ([1c4a12c](https://github.com/discordjs/discord.js/commit/1c4a12c7d62d060d655668a81d0ff4f1ae95607a))
|
||||
|
||||
# [@discordjs/core@0.6.0](https://github.com/discordjs/discord.js/compare/@discordjs/core@0.5.2...@discordjs/core@0.6.0) - (2023-05-01)
|
||||
|
||||
## Documentation
|
||||
|
||||
- Update example usage (#9461) ([6212bff](https://github.com/discordjs/discord.js/commit/6212bffa30f4c6bbe6a81dc5b2b037e5b65d493c))
|
||||
- Generate static imports for types with api-extractor ([98a76db](https://github.com/discordjs/discord.js/commit/98a76db482879f79d6bb2fb2e5fc65ac2c34e2d9))
|
||||
|
||||
## Features
|
||||
|
||||
- **core:** Abstract gateway (#9410) ([5d1a4c2](https://github.com/discordjs/discord.js/commit/5d1a4c27d5ee2686c8fab6cad8bd97d8d0876e66))
|
||||
|
||||
# [@discordjs/core@0.5.1](https://github.com/discordjs/discord.js/compare/@discordjs/core@0.5.0...@discordjs/core@0.5.1) - (2023-04-16)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **interactions:** Make `data` parameter optional (#9379) ([66dc401](https://github.com/discordjs/discord.js/commit/66dc4014fe4553f1dd73aaa7c32fd83e10bde263))
|
||||
- **core:** Support attachment editing on interactions (#9356) ([676307f](https://github.com/discordjs/discord.js/commit/676307ff5c6c4ef56a353b6fc74501a1080da869))
|
||||
- **core:** Missed optional options (#9311) ([6912faa](https://github.com/discordjs/discord.js/commit/6912faa9b3852adbacc7d0b002aae81be041f529))
|
||||
|
||||
## Typings
|
||||
|
||||
- **ChannelsAPI:** Use correct type for `editMessage` (#9399) ([0a1701b](https://github.com/discordjs/discord.js/commit/0a1701b0463919a895c518e5daa9836760d9b6cf))
|
||||
|
||||
# [@discordjs/core@0.6.0](https://github.com/discordjs/discord.js/compare/@discordjs/core@0.5.2...@discordjs/core@0.6.0) - (2023-05-01)
|
||||
|
||||
## Documentation
|
||||
|
||||
- Update example usage (#9461) ([6212bff](https://github.com/discordjs/discord.js/commit/6212bffa30f4c6bbe6a81dc5b2b037e5b65d493c))
|
||||
- Generate static imports for types with api-extractor ([98a76db](https://github.com/discordjs/discord.js/commit/98a76db482879f79d6bb2fb2e5fc65ac2c34e2d9))
|
||||
|
||||
## Features
|
||||
|
||||
- **core:** Abstract gateway (#9410) ([5d1a4c2](https://github.com/discordjs/discord.js/commit/5d1a4c27d5ee2686c8fab6cad8bd97d8d0876e66))
|
||||
|
||||
# [@discordjs/core@0.5.1](https://github.com/discordjs/discord.js/compare/@discordjs/core@0.5.0...@discordjs/core@0.5.1) - (2023-04-16)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **interactions:** Make `data` parameter optional (#9379) ([66dc401](https://github.com/discordjs/discord.js/commit/66dc4014fe4553f1dd73aaa7c32fd83e10bde263))
|
||||
- **core:** Support attachment editing on interactions (#9356) ([676307f](https://github.com/discordjs/discord.js/commit/676307ff5c6c4ef56a353b6fc74501a1080da869))
|
||||
- **core:** Missed optional options (#9311) ([6912faa](https://github.com/discordjs/discord.js/commit/6912faa9b3852adbacc7d0b002aae81be041f529))
|
||||
|
||||
## Typings
|
||||
|
||||
- **ChannelsAPI:** Use correct type for `editMessage` (#9399) ([0a1701b](https://github.com/discordjs/discord.js/commit/0a1701b0463919a895c518e5daa9836760d9b6cf))
|
||||
|
||||
# [@discordjs/core@0.5.1](https://github.com/discordjs/discord.js/compare/@discordjs/core@0.4.0...@discordjs/core@0.5.1) - (2023-04-16)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **interactions:** Make `data` parameter optional (#9379) ([66dc401](https://github.com/discordjs/discord.js/commit/66dc4014fe4553f1dd73aaa7c32fd83e10bde263))
|
||||
- **core:** Support attachment editing on interactions (#9356) ([676307f](https://github.com/discordjs/discord.js/commit/676307ff5c6c4ef56a353b6fc74501a1080da869))
|
||||
- **core:** Missed optional options (#9311) ([6912faa](https://github.com/discordjs/discord.js/commit/6912faa9b3852adbacc7d0b002aae81be041f529))
|
||||
|
||||
## Typings
|
||||
|
||||
- **ChannelsAPI:** Use correct type for `editMessage` (#9399) ([0a1701b](https://github.com/discordjs/discord.js/commit/0a1701b0463919a895c518e5daa9836760d9b6cf))
|
||||
|
||||
# [@discordjs/core@0.5.1](https://github.com/discordjs/discord.js/compare/@discordjs/core@0.5.0...@discordjs/core@0.5.1) - (2023-04-16)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **interactions:** Make `data` parameter optional (#9379) ([66dc401](https://github.com/discordjs/discord.js/commit/66dc4014fe4553f1dd73aaa7c32fd83e10bde263))
|
||||
- **core:** Support attachment editing on interactions (#9356) ([676307f](https://github.com/discordjs/discord.js/commit/676307ff5c6c4ef56a353b6fc74501a1080da869))
|
||||
- **core:** Missed optional options (#9311) ([6912faa](https://github.com/discordjs/discord.js/commit/6912faa9b3852adbacc7d0b002aae81be041f529))
|
||||
|
||||
## Typings
|
||||
|
||||
- **ChannelsAPI:** Use correct type for `editMessage` (#9399) ([0a1701b](https://github.com/discordjs/discord.js/commit/0a1701b0463919a895c518e5daa9836760d9b6cf))
|
||||
|
||||
# [@discordjs/core@0.5.0](https://github.com/discordjs/discord.js/compare/@discordjs/core@0.4.0...@discordjs/core@0.5.0) - (2023-04-01)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **core:** Include data for defer (#9284) ([9d69bba](https://github.com/discordjs/discord.js/commit/9d69bba47c73b756086992bc14e57c40fadb34d1))
|
||||
- **scripts:** Accessing tsComment ([d8d5f31](https://github.com/discordjs/discord.js/commit/d8d5f31d3927fd1de62f1fa3a1a6e454243ad87b))
|
||||
|
||||
## Features
|
||||
|
||||
- **core:** Http-only wrapper (#9281) ([11e682c](https://github.com/discordjs/discord.js/commit/11e682cfe388b9a3070388f73ebef3c27555c0dd))
|
||||
- **core:** Add `AbortSignal` support. (#9042) ([907eb1b](https://github.com/discordjs/discord.js/commit/907eb1b4708bdaf30f4e59f4016ef8a717f47a4c))
|
||||
- **website:** Render syntax and mdx on the server (#9086) ([ee5169e](https://github.com/discordjs/discord.js/commit/ee5169e0aadd7bbfcd752aae614ec0f69602b68b))
|
||||
|
||||
# [@discordjs/core@0.4.0](https://github.com/discordjs/discord.js/compare/@discordjs/core@0.3.0...@discordjs/core@0.4.0) - (2023-03-12)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
<a href="https://www.npmjs.com/package/@discordjs/core"><img src="https://img.shields.io/npm/v/@discordjs/core.svg?maxAge=3600" alt="npm version" /></a>
|
||||
<a href="https://www.npmjs.com/package/@discordjs/core"><img src="https://img.shields.io/npm/dt/@discordjs/core.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://github.com/discordjs/discord.js/commits/main/packages/core"><img alt="Last commit." src="https://img.shields.io/github/last-commit/discordjs/discord.js?logo=github&logoColor=ffffff&path=packages%2Fcore"></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=core" alt="Code coverage" /></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=core" 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>
|
||||
@@ -24,7 +23,7 @@
|
||||
|
||||
## Installation
|
||||
|
||||
**Node.js 20 or newer is required.**
|
||||
**Node.js 18 or newer is required.**
|
||||
|
||||
```sh
|
||||
npm install @discordjs/core
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"extends": "../../api-extractor.json",
|
||||
"bundledPackages": ["discord-api-types"],
|
||||
"docModel": {
|
||||
"projectFolderUrl": "https://github.com/discordjs/discord.js/tree/main/packages/core"
|
||||
}
|
||||
|
||||
@@ -5,16 +5,13 @@ header = """
|
||||
All notable changes to this project will be documented in this file.\n
|
||||
"""
|
||||
body = """
|
||||
{%- macro remote_url() -%}
|
||||
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
|
||||
{%- endmacro -%}
|
||||
{% if version %}\
|
||||
# [{{ version | trim_start_matches(pat="v") }}]\
|
||||
{% if previous %}\
|
||||
{% if previous.version %}\
|
||||
({{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }})\
|
||||
(https://github.com/discordjs/discord.js/compare/{{ previous.version }}...{{ version }})\
|
||||
{% else %}\
|
||||
({{ self::remote_url() }}/tree/{{ version }})\
|
||||
(https://github.com/discordjs/discord.js/tree/{{ version }})\
|
||||
{% endif %}\
|
||||
{% endif %} \
|
||||
- ({{ timestamp | date(format="%Y-%m-%d") }})
|
||||
@@ -27,23 +24,14 @@ body = """
|
||||
- {% if commit.scope %}\
|
||||
**{{commit.scope}}:** \
|
||||
{% endif %}\
|
||||
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
|
||||
{% if commit.github.username %} by @{{ commit.github.username }}{%- endif %}\
|
||||
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/discordjs/discord.js/commit/{{ commit.id }}))\
|
||||
{% if commit.breaking %}\
|
||||
{% for footer in commit.footers %}\
|
||||
{% if footer.breaking %}\
|
||||
\n{% raw %} {% endraw %}- **{{ footer.token }}{{ footer.separator }}** {{ footer.value }}\
|
||||
{% endif %}\
|
||||
{% for breakingChange in commit.footers %}\
|
||||
\n{% raw %} {% endraw %}- **{{ breakingChange.token }}{{ breakingChange.separator }}** {{ breakingChange.value }}\
|
||||
{% endfor %}\
|
||||
{% endif %}\
|
||||
{% endfor %}
|
||||
{% endfor %}\
|
||||
{% if github.contributors | filter(attribute="is_first_time", value=true) | length %}\
|
||||
\n### New Contributors\n
|
||||
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}\
|
||||
* @{{ contributor.username }} made their first contribution in #{{ contributor.pr_number }}
|
||||
{% endfor %}\
|
||||
{% endif %}\n
|
||||
{% endfor %}\n
|
||||
"""
|
||||
trim = true
|
||||
footer = ""
|
||||
@@ -71,9 +59,5 @@ commit_parsers = [
|
||||
filter_commits = true
|
||||
tag_pattern = "@discordjs/core@[0-9]*"
|
||||
ignore_tags = ""
|
||||
topo_order = false
|
||||
topo_order = true
|
||||
sort_commits = "newest"
|
||||
|
||||
[remote.github]
|
||||
owner = "discordjs"
|
||||
repo = "discord.js"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "@discordjs/core",
|
||||
"version": "2.0.1",
|
||||
"version": "1.2.0",
|
||||
"description": "A thinly abstracted wrapper around the rest API, and gateway.",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
@@ -48,7 +48,7 @@
|
||||
"contributors": [
|
||||
"Crawl <icrawltogo@gmail.com>",
|
||||
"SpaceEEC <spaceeec@yahoo.com>",
|
||||
"Vlad Frangu <me@vladfrangu.dev>",
|
||||
"Vlad Frangu <kingdgrizzle@gmail.com>",
|
||||
"Aura Román <kyradiscord@gmail.com>",
|
||||
"Suneet Tipirneni <suneettipirneni@icloud.com>"
|
||||
],
|
||||
@@ -69,28 +69,28 @@
|
||||
"@discordjs/util": "workspace:^",
|
||||
"@discordjs/ws": "workspace:^",
|
||||
"@sapphire/snowflake": "^3.5.3",
|
||||
"@vladfrangu/async_event_emitter": "^2.4.6",
|
||||
"discord-api-types": "^0.37.119"
|
||||
"@vladfrangu/async_event_emitter": "^2.2.4",
|
||||
"discord-api-types": "^0.37.114"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@discordjs/api-extractor": "workspace:^",
|
||||
"@discordjs/scripts": "workspace:^",
|
||||
"@favware/cliff-jumper": "^4.1.0",
|
||||
"@types/node": "^18.19.45",
|
||||
"@vitest/coverage-v8": "^2.0.5",
|
||||
"@favware/cliff-jumper": "^3.0.3",
|
||||
"@types/node": "18.18.8",
|
||||
"@vitest/coverage-v8": "^1.6.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild-plugin-version-injector": "^1.2.1",
|
||||
"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.3.0",
|
||||
"tsup": "^8.1.0",
|
||||
"turbo": "^1.13.3",
|
||||
"typescript": "^5.4.5",
|
||||
"vitest": "^1.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
"node": ">=18"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
|
||||
@@ -2,17 +2,10 @@
|
||||
|
||||
import type { RequestData, REST } from '@discordjs/rest';
|
||||
import {
|
||||
Routes,
|
||||
type RESTGetAPIApplicationEmojiResult,
|
||||
type RESTGetAPIApplicationEmojisResult,
|
||||
type RESTGetCurrentApplicationResult,
|
||||
type RESTPatchAPIApplicationEmojiJSONBody,
|
||||
type RESTPatchAPIApplicationEmojiResult,
|
||||
type RESTPatchCurrentApplicationJSONBody,
|
||||
type RESTPatchCurrentApplicationResult,
|
||||
type RESTPostAPIApplicationEmojiJSONBody,
|
||||
type RESTPostAPIApplicationEmojiResult,
|
||||
type Snowflake,
|
||||
Routes,
|
||||
} from 'discord-api-types/v10';
|
||||
|
||||
export class ApplicationsAPI {
|
||||
@@ -41,83 +34,4 @@ export class ApplicationsAPI {
|
||||
signal,
|
||||
}) as Promise<RESTPatchCurrentApplicationResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches all emojis of an application
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/emoji#list-application-emojis}
|
||||
* @param applicationId - The id of the application to fetch the emojis of
|
||||
* @param options - The options for fetching the emojis
|
||||
*/
|
||||
public async getEmojis(applicationId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.applicationEmojis(applicationId), {
|
||||
signal,
|
||||
}) as Promise<RESTGetAPIApplicationEmojisResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches an emoji of an application
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/emoji#get-application-emoji}
|
||||
* @param applicationId - The id of the application to fetch the emoji of
|
||||
* @param emojiId - The id of the emoji to fetch
|
||||
* @param options - The options for fetching the emoji
|
||||
*/
|
||||
public async getEmoji(applicationId: Snowflake, emojiId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.applicationEmoji(applicationId, emojiId), {
|
||||
signal,
|
||||
}) as Promise<RESTGetAPIApplicationEmojiResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new emoji of an application
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/emoji#create-application-emoji}
|
||||
* @param applicationId - The id of the application to create the emoji of
|
||||
* @param body - The data for creating the emoji
|
||||
* @param options - The options for creating the emoji
|
||||
*/
|
||||
public async createEmoji(
|
||||
applicationId: Snowflake,
|
||||
body: RESTPostAPIApplicationEmojiJSONBody,
|
||||
{ signal }: Pick<RequestData, 'signal'> = {},
|
||||
) {
|
||||
return this.rest.post(Routes.applicationEmojis(applicationId), {
|
||||
body,
|
||||
signal,
|
||||
}) as Promise<RESTPostAPIApplicationEmojiResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits an emoji of an application
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/emoji#modify-application-emoji}
|
||||
* @param applicationId - The id of the application to edit the emoji of
|
||||
* @param emojiId - The id of the emoji to edit
|
||||
* @param body - The data for editing the emoji
|
||||
* @param options - The options for editing the emoji
|
||||
*/
|
||||
public async editEmoji(
|
||||
applicationId: Snowflake,
|
||||
emojiId: Snowflake,
|
||||
body: RESTPatchAPIApplicationEmojiJSONBody,
|
||||
{ signal }: Pick<RequestData, 'signal'> = {},
|
||||
) {
|
||||
return this.rest.patch(Routes.applicationEmoji(applicationId, emojiId), {
|
||||
body,
|
||||
signal,
|
||||
}) as Promise<RESTPatchAPIApplicationEmojiResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an emoji of an application
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/emoji#delete-application-emoji}
|
||||
* @param applicationId - The id of the application to delete the emoji of
|
||||
* @param emojiId - The id of the emoji to delete
|
||||
* @param options - The options for deleting the emoji
|
||||
*/
|
||||
public async deleteEmoji(applicationId: Snowflake, emojiId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
await this.rest.delete(Routes.applicationEmoji(applicationId, emojiId), { signal });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ export class ChannelsAPI {
|
||||
/**
|
||||
* Sends a message in a channel
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/message#create-message}
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#create-message}
|
||||
* @param channelId - The id of the channel to send the message in
|
||||
* @param body - The data for sending the message
|
||||
* @param options - The options for sending the message
|
||||
@@ -65,7 +65,7 @@ export class ChannelsAPI {
|
||||
/**
|
||||
* Edits a message
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/message#edit-message}
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#edit-message}
|
||||
* @param channelId - The id of the channel the message is in
|
||||
* @param messageId - The id of the message to edit
|
||||
* @param body - The data for editing the message
|
||||
@@ -87,7 +87,7 @@ export class ChannelsAPI {
|
||||
/**
|
||||
* Fetches the reactions for a message
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/message#get-reactions}
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#get-reactions}
|
||||
* @param channelId - The id of the channel the message is in
|
||||
* @param messageId - The id of the message to get the reactions for
|
||||
* @param emoji - The emoji to get the reactions for
|
||||
@@ -110,7 +110,7 @@ export class ChannelsAPI {
|
||||
/**
|
||||
* Deletes a reaction for the current user
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/message#delete-own-reaction}
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#delete-own-reaction}
|
||||
* @param channelId - The id of the channel the message is in
|
||||
* @param messageId - The id of the message to delete the reaction for
|
||||
* @param emoji - The emoji to delete the reaction for
|
||||
@@ -130,7 +130,7 @@ export class ChannelsAPI {
|
||||
/**
|
||||
* Deletes a reaction for a user
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/message#delete-user-reaction}
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#delete-user-reaction}
|
||||
* @param channelId - The id of the channel the message is in
|
||||
* @param messageId - The id of the message to delete the reaction for
|
||||
* @param emoji - The emoji to delete the reaction for
|
||||
@@ -152,7 +152,7 @@ export class ChannelsAPI {
|
||||
/**
|
||||
* Deletes all reactions for a message
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/message#delete-all-reactions}
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#delete-all-reactions}
|
||||
* @param channelId - The id of the channel the message is in
|
||||
* @param messageId - The id of the message to delete the reactions for
|
||||
* @param options - The options for deleting the reactions
|
||||
@@ -168,7 +168,7 @@ export class ChannelsAPI {
|
||||
/**
|
||||
* Deletes all reactions of an emoji for a message
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/message#delete-all-reactions-for-emoji}
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#delete-all-reactions-for-emoji}
|
||||
* @param channelId - The id of the channel the message is in
|
||||
* @param messageId - The id of the message to delete the reactions for
|
||||
* @param emoji - The emoji to delete the reactions for
|
||||
@@ -186,7 +186,7 @@ export class ChannelsAPI {
|
||||
/**
|
||||
* Adds a reaction to a message
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/message#create-reaction}
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#create-reaction}
|
||||
* @param channelId - The id of the channel the message is in
|
||||
* @param messageId - The id of the message to add the reaction to
|
||||
* @param emoji - The emoji to add the reaction with
|
||||
@@ -242,7 +242,7 @@ export class ChannelsAPI {
|
||||
/**
|
||||
* Fetches the messages of a channel
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/message#get-channel-messages}
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#get-channel-messages}
|
||||
* @param channelId - The id of the channel to fetch messages from
|
||||
* @param query - The query options for fetching messages
|
||||
* @param options - The options for fetching the messages
|
||||
@@ -299,7 +299,7 @@ export class ChannelsAPI {
|
||||
/**
|
||||
* Deletes a message
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/message#delete-message}
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#delete-message}
|
||||
* @param channelId - The id of the channel the message is in
|
||||
* @param messageId - The id of the message to delete
|
||||
* @param options - The options for deleting the message
|
||||
@@ -315,7 +315,7 @@ export class ChannelsAPI {
|
||||
/**
|
||||
* Bulk deletes messages
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/message#bulk-delete-messages}
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#bulk-delete-messages}
|
||||
* @param channelId - The id of the channel the messages are in
|
||||
* @param messageIds - The ids of the messages to delete
|
||||
* @param options - The options for deleting the messages
|
||||
@@ -331,7 +331,7 @@ export class ChannelsAPI {
|
||||
/**
|
||||
* Fetches a message
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/message#get-channel-message}
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#get-channel-message}
|
||||
* @param channelId - The id of the channel the message is in
|
||||
* @param messageId - The id of the message to fetch
|
||||
* @param options - The options for fetching the message
|
||||
@@ -345,7 +345,7 @@ export class ChannelsAPI {
|
||||
/**
|
||||
* Crossposts a message
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/message#crosspost-message}
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#crosspost-message}
|
||||
* @param channelId - The id of the channel the message is in
|
||||
* @param messageId - The id of the message to crosspost
|
||||
* @param options - The options for crossposting the message
|
||||
@@ -452,7 +452,7 @@ export class ChannelsAPI {
|
||||
/**
|
||||
* Creates a new forum post
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel}
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-channel}
|
||||
* @param channelId - The id of the forum channel to start the thread in
|
||||
* @param body - The data for starting the thread
|
||||
* @param options - The options for starting the thread
|
||||
|
||||
@@ -28,7 +28,6 @@ import {
|
||||
type RESTGetAPIGuildPruneCountResult,
|
||||
type RESTGetAPIGuildQuery,
|
||||
type RESTGetAPIGuildResult,
|
||||
type RESTGetAPIGuildRoleResult,
|
||||
type RESTGetAPIGuildRolesResult,
|
||||
type RESTGetAPIGuildScheduledEventQuery,
|
||||
type RESTGetAPIGuildScheduledEventResult,
|
||||
@@ -68,6 +67,7 @@ import {
|
||||
type RESTPatchAPIGuildTemplateJSONBody,
|
||||
type RESTPatchAPIGuildTemplateResult,
|
||||
type RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody,
|
||||
type RESTPatchAPIGuildVoiceStateCurrentMemberResult,
|
||||
type RESTPatchAPIGuildVoiceStateUserJSONBody,
|
||||
type RESTPatchAPIGuildWelcomeScreenJSONBody,
|
||||
type RESTPatchAPIGuildWelcomeScreenResult,
|
||||
@@ -102,7 +102,6 @@ import {
|
||||
type RESTPutAPIGuildTemplateSyncResult,
|
||||
type Snowflake,
|
||||
} from 'discord-api-types/v10';
|
||||
import { VoiceAPI } from './voice';
|
||||
|
||||
export class GuildsAPI {
|
||||
public constructor(private readonly rest: REST) {}
|
||||
@@ -398,18 +397,6 @@ export class GuildsAPI {
|
||||
return this.rest.get(Routes.guildRoles(guildId), { signal }) as Promise<RESTGetAPIGuildRolesResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a role in a guild
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-role}
|
||||
* @param guildId - The id of the guild to fetch the role from
|
||||
* @param roleId - The id of the role to fetch
|
||||
* @param options - The options for fetching the guild role
|
||||
*/
|
||||
public async getRole(guildId: Snowflake, roleId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.guildRole(guildId, roleId), { signal }) as Promise<RESTGetAPIGuildRoleResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a guild role
|
||||
*
|
||||
@@ -700,12 +687,11 @@ export class GuildsAPI {
|
||||
/**
|
||||
* Edits a user's voice state in a guild
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/voice#modify-user-voice-state}
|
||||
* @see {@link https://discord.com/developers/docs/resources/guild#modify-user-voice-state}
|
||||
* @param guildId - The id of the guild to edit the current user's voice state in
|
||||
* @param userId - The id of the user to edit the voice state for
|
||||
* @param body - The data for editing the voice state
|
||||
* @param options - The options for editing the voice state
|
||||
* @deprecated Use {@link VoiceAPI.editUserVoiceState} instead
|
||||
*/
|
||||
public async editUserVoiceState(
|
||||
guildId: Snowflake,
|
||||
@@ -713,7 +699,7 @@ export class GuildsAPI {
|
||||
body: RESTPatchAPIGuildVoiceStateUserJSONBody,
|
||||
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {},
|
||||
) {
|
||||
return new VoiceAPI(this.rest).editUserVoiceState(guildId, userId, body, { reason, signal });
|
||||
await this.rest.patch(Routes.guildVoiceState(guildId, userId), { reason, body, signal });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1312,18 +1298,14 @@ export class GuildsAPI {
|
||||
/**
|
||||
* Sets the voice state for the current user
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/voice#modify-current-user-voice-state}
|
||||
* @see {@link https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state}
|
||||
* @param guildId - The id of the guild
|
||||
* @param body - The data for setting the voice state
|
||||
* @param options - The options for setting the voice state
|
||||
* @deprecated Use {@link VoiceAPI.editVoiceState} instead
|
||||
* @param body - The options for setting the voice state
|
||||
*/
|
||||
public async setVoiceState(
|
||||
guildId: Snowflake,
|
||||
body: RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = {},
|
||||
{ signal }: Pick<RequestData, 'signal'> = {},
|
||||
) {
|
||||
return new VoiceAPI(this.rest).editVoiceState(guildId, body, { signal });
|
||||
public async setVoiceState(guildId: Snowflake, body: RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = {}) {
|
||||
return this.rest.patch(Routes.guildVoiceState(guildId, '@me'), {
|
||||
body,
|
||||
}) as Promise<RESTPatchAPIGuildVoiceStateCurrentMemberResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -258,7 +258,7 @@ export class InteractionsAPI {
|
||||
* @param interactionId - The id of the interaction
|
||||
* @param interactionToken - The token of the interaction
|
||||
* @param options - The options for sending the premium required response
|
||||
* @deprecated Sending a premium-style button is the new Discord behavior.
|
||||
* @deprecated Sending a premium-style button is the new Discord behaviour.
|
||||
*/
|
||||
public async sendPremiumRequired(
|
||||
interactionId: Snowflake,
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
type RESTGetAPIEntitlementsQuery,
|
||||
type RESTGetAPIEntitlementsResult,
|
||||
type RESTGetAPISKUsResult,
|
||||
type RESTPostAPIEntitlementJSONBody,
|
||||
type RESTPostAPIEntitlementBody,
|
||||
type RESTPostAPIEntitlementResult,
|
||||
type Snowflake,
|
||||
} from 'discord-api-types/v10';
|
||||
@@ -53,7 +53,7 @@ export class MonetizationAPI {
|
||||
*/
|
||||
public async createTestEntitlement(
|
||||
applicationId: Snowflake,
|
||||
body: RESTPostAPIEntitlementJSONBody,
|
||||
body: RESTPostAPIEntitlementBody,
|
||||
{ signal }: Pick<RequestData, 'signal'> = {},
|
||||
) {
|
||||
return this.rest.post(Routes.entitlements(applicationId), {
|
||||
|
||||
@@ -13,8 +13,6 @@ import {
|
||||
type RESTGetAPIOAuth2CurrentApplicationResult,
|
||||
type RESTPostOAuth2AccessTokenURLEncodedData,
|
||||
type RESTPostOAuth2AccessTokenResult,
|
||||
type RESTPostOAuth2TokenRevocationQuery,
|
||||
type Snowflake,
|
||||
} from 'discord-api-types/v10';
|
||||
|
||||
export class OAuth2API {
|
||||
@@ -123,31 +121,4 @@ export class OAuth2API {
|
||||
signal,
|
||||
}) as Promise<RESTGetAPIOAuth2CurrentAuthorizationResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Revokes an OAuth2 token
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-token-revocation-example}
|
||||
* @param applicationId - The application id
|
||||
* @param applicationSecret - The application secret
|
||||
* @param body - The body of the token revocation request
|
||||
* @param options - The options for the token revocation request
|
||||
*/
|
||||
public async revokeToken(
|
||||
applicationId: Snowflake,
|
||||
applicationSecret: string,
|
||||
body: RESTPostOAuth2TokenRevocationQuery,
|
||||
{ signal }: Pick<RequestData, 'signal'> = {},
|
||||
) {
|
||||
await this.rest.post(Routes.oauth2TokenRevocation(), {
|
||||
body: makeURLSearchParams(body),
|
||||
passThroughBody: true,
|
||||
headers: {
|
||||
Authorization: `Basic ${btoa(`${applicationId}:${applicationSecret}`)}`,
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
auth: false,
|
||||
signal,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import type { RequestData, REST } from '@discordjs/rest';
|
||||
import {
|
||||
Routes,
|
||||
type RESTGetAPIStickerPackResult,
|
||||
type RESTGetAPIStickerResult,
|
||||
type RESTGetStickerPacksResult,
|
||||
type Snowflake,
|
||||
@@ -12,17 +11,6 @@ import {
|
||||
export class StickersAPI {
|
||||
public constructor(private readonly rest: REST) {}
|
||||
|
||||
/**
|
||||
* Fetches a sticker pack
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/sticker#get-sticker-pack}
|
||||
* @param packId - The id of the sticker pack
|
||||
* @param options - The options for fetching the sticker pack
|
||||
*/
|
||||
public async getStickerPack(packId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.stickerPack(packId), { signal }) as Promise<RESTGetAPIStickerPackResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches all of the sticker packs
|
||||
*
|
||||
|
||||
@@ -1,17 +1,7 @@
|
||||
/* eslint-disable jsdoc/check-param-names */
|
||||
|
||||
import type { RequestData, REST } from '@discordjs/rest';
|
||||
import {
|
||||
Routes,
|
||||
type Snowflake,
|
||||
type RESTGetAPIVoiceRegionsResult,
|
||||
type RESTGetAPIGuildVoiceStateUserResult,
|
||||
type RESTGetAPIGuildVoiceStateCurrentMemberResult,
|
||||
type RESTPatchAPIGuildVoiceStateUserJSONBody,
|
||||
type RESTPatchAPIGuildVoiceStateCurrentMemberResult,
|
||||
type RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody,
|
||||
type RESTPatchAPIGuildVoiceStateUserResult,
|
||||
} from 'discord-api-types/v10';
|
||||
import { Routes, type RESTGetAPIVoiceRegionsResult } from 'discord-api-types/v10';
|
||||
|
||||
export class VoiceAPI {
|
||||
public constructor(private readonly rest: REST) {}
|
||||
@@ -25,69 +15,4 @@ export class VoiceAPI {
|
||||
public async getVoiceRegions({ signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.voiceRegions(), { signal }) as Promise<RESTGetAPIVoiceRegionsResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches voice state of a user by their id
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/voice#get-user-voice-state}
|
||||
* @param options - The options for fetching user voice state
|
||||
*/
|
||||
public async getUserVoiceState(guildId: Snowflake, userId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.guildVoiceState(guildId, userId), {
|
||||
signal,
|
||||
}) as Promise<RESTGetAPIGuildVoiceStateUserResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the current user's voice state
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/voice#get-current-user-voice-state}
|
||||
* @param options - The options for fetching user voice state
|
||||
*/
|
||||
public async getVoiceState(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.guildVoiceState(guildId, '@me'), {
|
||||
signal,
|
||||
}) as Promise<RESTGetAPIGuildVoiceStateCurrentMemberResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits a user's voice state in a guild
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/voice#modify-user-voice-state}
|
||||
* @param guildId - The id of the guild to edit the current user's voice state in
|
||||
* @param userId - The id of the user to edit the voice state for
|
||||
* @param body - The data for editing the voice state
|
||||
* @param options - The options for editing the voice state
|
||||
*/
|
||||
public async editUserVoiceState(
|
||||
guildId: Snowflake,
|
||||
userId: Snowflake,
|
||||
body: RESTPatchAPIGuildVoiceStateUserJSONBody,
|
||||
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {},
|
||||
) {
|
||||
return this.rest.patch(Routes.guildVoiceState(guildId, userId), {
|
||||
reason,
|
||||
body,
|
||||
signal,
|
||||
}) as Promise<RESTPatchAPIGuildVoiceStateUserResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits the voice state for the current user
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/voice#modify-current-user-voice-state}
|
||||
* @param guildId - The id of the guild
|
||||
* @param body - The data for editing the voice state
|
||||
* @param options - The options for editing the voice state
|
||||
*/
|
||||
public async editVoiceState(
|
||||
guildId: Snowflake,
|
||||
body: RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = {},
|
||||
{ signal }: Pick<RequestData, 'signal'> = {},
|
||||
) {
|
||||
return this.rest.patch(Routes.guildVoiceState(guildId, '@me'), {
|
||||
body,
|
||||
signal,
|
||||
}) as Promise<RESTPatchAPIGuildVoiceStateCurrentMemberResult>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,83 +89,87 @@ export interface IntrinsicProps {
|
||||
shardId: number;
|
||||
}
|
||||
|
||||
export interface ToEventProps<Data> extends IntrinsicProps {
|
||||
export interface WithIntrinsicProps<Data> extends IntrinsicProps {
|
||||
data: Data;
|
||||
}
|
||||
|
||||
export interface MappedEvents {
|
||||
[GatewayDispatchEvents.ApplicationCommandPermissionsUpdate]: [
|
||||
ToEventProps<GatewayApplicationCommandPermissionsUpdateDispatchData>,
|
||||
WithIntrinsicProps<GatewayApplicationCommandPermissionsUpdateDispatchData>,
|
||||
];
|
||||
[GatewayDispatchEvents.AutoModerationActionExecution]: [
|
||||
ToEventProps<GatewayAutoModerationActionExecutionDispatchData>,
|
||||
WithIntrinsicProps<GatewayAutoModerationActionExecutionDispatchData>,
|
||||
];
|
||||
[GatewayDispatchEvents.AutoModerationRuleCreate]: [WithIntrinsicProps<GatewayAutoModerationRuleCreateDispatchData>];
|
||||
[GatewayDispatchEvents.AutoModerationRuleDelete]: [WithIntrinsicProps<GatewayAutoModerationRuleDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.AutoModerationRuleUpdate]: [WithIntrinsicProps<GatewayAutoModerationRuleUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.ChannelCreate]: [WithIntrinsicProps<GatewayChannelCreateDispatchData>];
|
||||
[GatewayDispatchEvents.ChannelDelete]: [WithIntrinsicProps<GatewayChannelDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.ChannelPinsUpdate]: [WithIntrinsicProps<GatewayChannelPinsUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.ChannelUpdate]: [WithIntrinsicProps<GatewayChannelUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.EntitlementCreate]: [WithIntrinsicProps<GatewayEntitlementCreateDispatchData>];
|
||||
[GatewayDispatchEvents.EntitlementDelete]: [WithIntrinsicProps<GatewayEntitlementDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.EntitlementUpdate]: [WithIntrinsicProps<GatewayEntitlementUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildAuditLogEntryCreate]: [WithIntrinsicProps<GatewayGuildAuditLogEntryCreateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildBanAdd]: [WithIntrinsicProps<GatewayGuildBanAddDispatchData>];
|
||||
[GatewayDispatchEvents.GuildBanRemove]: [WithIntrinsicProps<GatewayGuildBanRemoveDispatchData>];
|
||||
[GatewayDispatchEvents.GuildCreate]: [WithIntrinsicProps<GatewayGuildCreateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildDelete]: [WithIntrinsicProps<GatewayGuildDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.GuildEmojisUpdate]: [WithIntrinsicProps<GatewayGuildEmojisUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildIntegrationsUpdate]: [WithIntrinsicProps<GatewayGuildIntegrationsUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildMemberAdd]: [WithIntrinsicProps<GatewayGuildMemberAddDispatchData>];
|
||||
[GatewayDispatchEvents.GuildMemberRemove]: [WithIntrinsicProps<GatewayGuildMemberRemoveDispatchData>];
|
||||
[GatewayDispatchEvents.GuildMemberUpdate]: [WithIntrinsicProps<GatewayGuildMemberUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildMembersChunk]: [WithIntrinsicProps<GatewayGuildMembersChunkDispatchData>];
|
||||
[GatewayDispatchEvents.GuildRoleCreate]: [WithIntrinsicProps<GatewayGuildRoleCreateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildRoleDelete]: [WithIntrinsicProps<GatewayGuildRoleDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.GuildRoleUpdate]: [WithIntrinsicProps<GatewayGuildRoleUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildScheduledEventCreate]: [WithIntrinsicProps<GatewayGuildScheduledEventCreateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildScheduledEventDelete]: [WithIntrinsicProps<GatewayGuildScheduledEventDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.GuildScheduledEventUpdate]: [WithIntrinsicProps<GatewayGuildScheduledEventUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildScheduledEventUserAdd]: [
|
||||
WithIntrinsicProps<GatewayGuildScheduledEventUserAddDispatchData>,
|
||||
];
|
||||
[GatewayDispatchEvents.AutoModerationRuleCreate]: [ToEventProps<GatewayAutoModerationRuleCreateDispatchData>];
|
||||
[GatewayDispatchEvents.AutoModerationRuleDelete]: [ToEventProps<GatewayAutoModerationRuleDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.AutoModerationRuleUpdate]: [ToEventProps<GatewayAutoModerationRuleUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.ChannelCreate]: [ToEventProps<GatewayChannelCreateDispatchData>];
|
||||
[GatewayDispatchEvents.ChannelDelete]: [ToEventProps<GatewayChannelDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.ChannelPinsUpdate]: [ToEventProps<GatewayChannelPinsUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.ChannelUpdate]: [ToEventProps<GatewayChannelUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.EntitlementCreate]: [ToEventProps<GatewayEntitlementCreateDispatchData>];
|
||||
[GatewayDispatchEvents.EntitlementDelete]: [ToEventProps<GatewayEntitlementDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.EntitlementUpdate]: [ToEventProps<GatewayEntitlementUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildAuditLogEntryCreate]: [ToEventProps<GatewayGuildAuditLogEntryCreateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildBanAdd]: [ToEventProps<GatewayGuildBanAddDispatchData>];
|
||||
[GatewayDispatchEvents.GuildBanRemove]: [ToEventProps<GatewayGuildBanRemoveDispatchData>];
|
||||
[GatewayDispatchEvents.GuildCreate]: [ToEventProps<GatewayGuildCreateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildDelete]: [ToEventProps<GatewayGuildDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.GuildEmojisUpdate]: [ToEventProps<GatewayGuildEmojisUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildIntegrationsUpdate]: [ToEventProps<GatewayGuildIntegrationsUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildMemberAdd]: [ToEventProps<GatewayGuildMemberAddDispatchData>];
|
||||
[GatewayDispatchEvents.GuildMemberRemove]: [ToEventProps<GatewayGuildMemberRemoveDispatchData>];
|
||||
[GatewayDispatchEvents.GuildMemberUpdate]: [ToEventProps<GatewayGuildMemberUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildMembersChunk]: [ToEventProps<GatewayGuildMembersChunkDispatchData>];
|
||||
[GatewayDispatchEvents.GuildRoleCreate]: [ToEventProps<GatewayGuildRoleCreateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildRoleDelete]: [ToEventProps<GatewayGuildRoleDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.GuildRoleUpdate]: [ToEventProps<GatewayGuildRoleUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildScheduledEventCreate]: [ToEventProps<GatewayGuildScheduledEventCreateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildScheduledEventDelete]: [ToEventProps<GatewayGuildScheduledEventDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.GuildScheduledEventUpdate]: [ToEventProps<GatewayGuildScheduledEventUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildScheduledEventUserAdd]: [ToEventProps<GatewayGuildScheduledEventUserAddDispatchData>];
|
||||
[GatewayDispatchEvents.GuildScheduledEventUserRemove]: [
|
||||
ToEventProps<GatewayGuildScheduledEventUserRemoveDispatchData>,
|
||||
WithIntrinsicProps<GatewayGuildScheduledEventUserRemoveDispatchData>,
|
||||
];
|
||||
[GatewayDispatchEvents.GuildStickersUpdate]: [ToEventProps<GatewayGuildStickersUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildUpdate]: [ToEventProps<GatewayGuildUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.IntegrationCreate]: [ToEventProps<GatewayIntegrationCreateDispatchData>];
|
||||
[GatewayDispatchEvents.IntegrationDelete]: [ToEventProps<GatewayIntegrationDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.IntegrationUpdate]: [ToEventProps<GatewayIntegrationUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.InteractionCreate]: [ToEventProps<GatewayInteractionCreateDispatchData>];
|
||||
[GatewayDispatchEvents.InviteCreate]: [ToEventProps<GatewayInviteCreateDispatchData>];
|
||||
[GatewayDispatchEvents.InviteDelete]: [ToEventProps<GatewayInviteDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.MessageCreate]: [ToEventProps<GatewayMessageCreateDispatchData>];
|
||||
[GatewayDispatchEvents.MessageDelete]: [ToEventProps<GatewayMessageDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.MessageDeleteBulk]: [ToEventProps<GatewayMessageDeleteBulkDispatchData>];
|
||||
[GatewayDispatchEvents.MessagePollVoteAdd]: [ToEventProps<GatewayMessagePollVoteDispatchData>];
|
||||
[GatewayDispatchEvents.MessagePollVoteRemove]: [ToEventProps<GatewayMessagePollVoteDispatchData>];
|
||||
[GatewayDispatchEvents.MessageReactionAdd]: [ToEventProps<GatewayMessageReactionAddDispatchData>];
|
||||
[GatewayDispatchEvents.MessageReactionRemove]: [ToEventProps<GatewayMessageReactionRemoveDispatchData>];
|
||||
[GatewayDispatchEvents.MessageReactionRemoveAll]: [ToEventProps<GatewayMessageReactionRemoveAllDispatchData>];
|
||||
[GatewayDispatchEvents.MessageReactionRemoveEmoji]: [ToEventProps<GatewayMessageReactionRemoveEmojiDispatchData>];
|
||||
[GatewayDispatchEvents.MessageUpdate]: [ToEventProps<GatewayMessageUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.PresenceUpdate]: [ToEventProps<GatewayPresenceUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.Ready]: [ToEventProps<GatewayReadyDispatchData>];
|
||||
[GatewayDispatchEvents.Resumed]: [ToEventProps<never>];
|
||||
[GatewayDispatchEvents.StageInstanceCreate]: [ToEventProps<GatewayStageInstanceCreateDispatchData>];
|
||||
[GatewayDispatchEvents.StageInstanceDelete]: [ToEventProps<GatewayStageInstanceDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.StageInstanceUpdate]: [ToEventProps<GatewayStageInstanceUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.ThreadCreate]: [ToEventProps<GatewayThreadCreateDispatchData>];
|
||||
[GatewayDispatchEvents.ThreadDelete]: [ToEventProps<GatewayThreadDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.ThreadListSync]: [ToEventProps<GatewayThreadListSyncDispatchData>];
|
||||
[GatewayDispatchEvents.ThreadMemberUpdate]: [ToEventProps<GatewayThreadMemberUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.ThreadMembersUpdate]: [ToEventProps<GatewayThreadMembersUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.ThreadUpdate]: [ToEventProps<GatewayThreadUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.TypingStart]: [ToEventProps<GatewayTypingStartDispatchData>];
|
||||
[GatewayDispatchEvents.UserUpdate]: [ToEventProps<GatewayUserUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.VoiceServerUpdate]: [ToEventProps<GatewayVoiceServerUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.VoiceStateUpdate]: [ToEventProps<GatewayVoiceStateUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.WebhooksUpdate]: [ToEventProps<GatewayWebhooksUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildStickersUpdate]: [WithIntrinsicProps<GatewayGuildStickersUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.GuildUpdate]: [WithIntrinsicProps<GatewayGuildUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.IntegrationCreate]: [WithIntrinsicProps<GatewayIntegrationCreateDispatchData>];
|
||||
[GatewayDispatchEvents.IntegrationDelete]: [WithIntrinsicProps<GatewayIntegrationDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.IntegrationUpdate]: [WithIntrinsicProps<GatewayIntegrationUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.InteractionCreate]: [WithIntrinsicProps<GatewayInteractionCreateDispatchData>];
|
||||
[GatewayDispatchEvents.InviteCreate]: [WithIntrinsicProps<GatewayInviteCreateDispatchData>];
|
||||
[GatewayDispatchEvents.InviteDelete]: [WithIntrinsicProps<GatewayInviteDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.MessageCreate]: [WithIntrinsicProps<GatewayMessageCreateDispatchData>];
|
||||
[GatewayDispatchEvents.MessageDelete]: [WithIntrinsicProps<GatewayMessageDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.MessageDeleteBulk]: [WithIntrinsicProps<GatewayMessageDeleteBulkDispatchData>];
|
||||
[GatewayDispatchEvents.MessagePollVoteAdd]: [WithIntrinsicProps<GatewayMessagePollVoteDispatchData>];
|
||||
[GatewayDispatchEvents.MessagePollVoteRemove]: [WithIntrinsicProps<GatewayMessagePollVoteDispatchData>];
|
||||
[GatewayDispatchEvents.MessageReactionAdd]: [WithIntrinsicProps<GatewayMessageReactionAddDispatchData>];
|
||||
[GatewayDispatchEvents.MessageReactionRemove]: [WithIntrinsicProps<GatewayMessageReactionRemoveDispatchData>];
|
||||
[GatewayDispatchEvents.MessageReactionRemoveAll]: [WithIntrinsicProps<GatewayMessageReactionRemoveAllDispatchData>];
|
||||
[GatewayDispatchEvents.MessageReactionRemoveEmoji]: [
|
||||
WithIntrinsicProps<GatewayMessageReactionRemoveEmojiDispatchData>,
|
||||
];
|
||||
[GatewayDispatchEvents.MessageUpdate]: [WithIntrinsicProps<GatewayMessageUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.PresenceUpdate]: [WithIntrinsicProps<GatewayPresenceUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.Ready]: [WithIntrinsicProps<GatewayReadyDispatchData>];
|
||||
[GatewayDispatchEvents.Resumed]: [WithIntrinsicProps<never>];
|
||||
[GatewayDispatchEvents.StageInstanceCreate]: [WithIntrinsicProps<GatewayStageInstanceCreateDispatchData>];
|
||||
[GatewayDispatchEvents.StageInstanceDelete]: [WithIntrinsicProps<GatewayStageInstanceDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.StageInstanceUpdate]: [WithIntrinsicProps<GatewayStageInstanceUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.ThreadCreate]: [WithIntrinsicProps<GatewayThreadCreateDispatchData>];
|
||||
[GatewayDispatchEvents.ThreadDelete]: [WithIntrinsicProps<GatewayThreadDeleteDispatchData>];
|
||||
[GatewayDispatchEvents.ThreadListSync]: [WithIntrinsicProps<GatewayThreadListSyncDispatchData>];
|
||||
[GatewayDispatchEvents.ThreadMemberUpdate]: [WithIntrinsicProps<GatewayThreadMemberUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.ThreadMembersUpdate]: [WithIntrinsicProps<GatewayThreadMembersUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.ThreadUpdate]: [WithIntrinsicProps<GatewayThreadUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.TypingStart]: [WithIntrinsicProps<GatewayTypingStartDispatchData>];
|
||||
[GatewayDispatchEvents.UserUpdate]: [WithIntrinsicProps<GatewayUserUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.VoiceServerUpdate]: [WithIntrinsicProps<GatewayVoiceServerUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.VoiceStateUpdate]: [WithIntrinsicProps<GatewayVoiceStateUpdateDispatchData>];
|
||||
[GatewayDispatchEvents.WebhooksUpdate]: [WithIntrinsicProps<GatewayWebhooksUpdateDispatchData>];
|
||||
}
|
||||
|
||||
export interface ManagerShardEventsMap extends MappedEvents {}
|
||||
@@ -195,8 +199,12 @@ export class Client extends AsyncEventEmitter<MappedEvents> {
|
||||
this.gateway = gateway;
|
||||
this.api = new API(rest);
|
||||
|
||||
this.gateway.on(WebSocketShardEvents.Dispatch, (dispatch, shardId) => {
|
||||
this.emit(dispatch.t, this.toEventProps(dispatch.d, shardId));
|
||||
this.gateway.on(WebSocketShardEvents.Dispatch, ({ data: dispatch, shardId }) => {
|
||||
this.emit(
|
||||
// @ts-expect-error ws/1.1.
|
||||
dispatch.t,
|
||||
this.wrapIntrinsicProps(dispatch.d, shardId),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -237,9 +245,11 @@ export class Client extends AsyncEventEmitter<MappedEvents> {
|
||||
});
|
||||
|
||||
try {
|
||||
const iterator = AsyncEventEmitter.on(this, GatewayDispatchEvents.GuildMembersChunk, {
|
||||
signal: controller.signal,
|
||||
});
|
||||
const iterator = AsyncEventEmitter.on<
|
||||
typeof this,
|
||||
ManagerShardEventsMap,
|
||||
GatewayDispatchEvents.GuildMembersChunk
|
||||
>(this, GatewayDispatchEvents.GuildMembersChunk, { signal: controller.signal });
|
||||
|
||||
for await (const [{ data }] of iterator) {
|
||||
if (data.nonce !== nonce) continue;
|
||||
@@ -332,7 +342,7 @@ export class Client extends AsyncEventEmitter<MappedEvents> {
|
||||
});
|
||||
}
|
||||
|
||||
private toEventProps<ObjectType>(obj: ObjectType, shardId: number): ToEventProps<ObjectType> {
|
||||
private wrapIntrinsicProps<ObjectType>(obj: ObjectType, shardId: number): WithIntrinsicProps<ObjectType> {
|
||||
return {
|
||||
api: this.api,
|
||||
shardId,
|
||||
|
||||
@@ -2,12 +2,6 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
# [create-discord-bot@0.3.1](https://github.com/discordjs/discord.js/compare/create-discord-bot@0.3.0...create-discord-bot@0.3.1) - (2024-09-01)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Failed build in node and bad lints (#10444) ([00accf7](https://github.com/discordjs/discord.js/commit/00accf74708b4ce8a032907005ae81460b79a988))
|
||||
|
||||
# [create-discord-bot@0.3.0](https://github.com/discordjs/discord.js/compare/create-discord-bot@0.2.3...create-discord-bot@0.3.0) - (2024-05-04)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
<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>
|
||||
<a href="https://github.com/discordjs/discord.js/commits/main/packages/create-discord-bot"><img alt="Last commit." src="https://img.shields.io/github/last-commit/discordjs/discord.js?logo=github&logoColor=ffffff&path=packages%2Fcreate-discord-bot"></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>
|
||||
|
||||
@@ -5,16 +5,13 @@ header = """
|
||||
All notable changes to this project will be documented in this file.\n
|
||||
"""
|
||||
body = """
|
||||
{%- macro remote_url() -%}
|
||||
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
|
||||
{%- endmacro -%}
|
||||
{% if version %}\
|
||||
# [{{ version | trim_start_matches(pat="v") }}]\
|
||||
{% if previous %}\
|
||||
{% if previous.version %}\
|
||||
({{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }})\
|
||||
(https://github.com/discordjs/discord.js/compare/{{ previous.version }}...{{ version }})\
|
||||
{% else %}\
|
||||
({{ self::remote_url() }}/tree/{{ version }})\
|
||||
(https://github.com/discordjs/discord.js/tree/{{ version }})\
|
||||
{% endif %}\
|
||||
{% endif %} \
|
||||
- ({{ timestamp | date(format="%Y-%m-%d") }})
|
||||
@@ -27,23 +24,14 @@ body = """
|
||||
- {% if commit.scope %}\
|
||||
**{{commit.scope}}:** \
|
||||
{% endif %}\
|
||||
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
|
||||
{% if commit.github.username %} by @{{ commit.github.username }}{%- endif %}\
|
||||
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/discordjs/discord.js/commit/{{ commit.id }}))\
|
||||
{% if commit.breaking %}\
|
||||
{% for footer in commit.footers %}\
|
||||
{% if footer.breaking %}\
|
||||
\n{% raw %} {% endraw %}- **{{ footer.token }}{{ footer.separator }}** {{ footer.value }}\
|
||||
{% endif %}\
|
||||
{% for breakingChange in commit.footers %}\
|
||||
\n{% raw %} {% endraw %}- **{{ breakingChange.token }}{{ breakingChange.separator }}** {{ breakingChange.value }}\
|
||||
{% endfor %}\
|
||||
{% endif %}\
|
||||
{% endfor %}
|
||||
{% endfor %}\
|
||||
{% if github.contributors | filter(attribute="is_first_time", value=true) | length %}\
|
||||
\n### New Contributors\n
|
||||
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}\
|
||||
* @{{ contributor.username }} made their first contribution in #{{ contributor.pr_number }}
|
||||
{% endfor %}\
|
||||
{% endif %}\n
|
||||
{% endfor %}\n
|
||||
"""
|
||||
trim = true
|
||||
footer = ""
|
||||
@@ -71,9 +59,5 @@ commit_parsers = [
|
||||
filter_commits = true
|
||||
tag_pattern = "create-discord-bot@[0-9]*"
|
||||
ignore_tags = ""
|
||||
topo_order = false
|
||||
topo_order = true
|
||||
sort_commits = "newest"
|
||||
|
||||
[remote.github]
|
||||
owner = "discordjs"
|
||||
repo = "discord.js"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "create-discord-bot",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.0",
|
||||
"description": "A simple way to create a startup Discord bot.",
|
||||
"scripts": {
|
||||
"build": "tsc --noEmit && tsup",
|
||||
@@ -24,9 +24,9 @@
|
||||
"contributors": [
|
||||
"Crawl <icrawltogo@gmail.com>",
|
||||
"SpaceEEC <spaceeec@yahoo.com>",
|
||||
"Vlad Frangu <me@vladfrangu.dev>",
|
||||
"Vlad Frangu <kingdgrizzle@gmail.com>",
|
||||
"Aura Román <kyradiscord@gmail.com>",
|
||||
"Jiralite <me@jiralite.dev>"
|
||||
"Jiralite <jiralite@live.co.uk>"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"keywords": [
|
||||
@@ -57,20 +57,20 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@discordjs/api-extractor": "workspace:^",
|
||||
"@favware/cliff-jumper": "^4.1.0",
|
||||
"@types/node": "^18.19.45",
|
||||
"@favware/cliff-jumper": "^3.0.3",
|
||||
"@types/node": "18.18.8",
|
||||
"@types/prompts": "^2.4.9",
|
||||
"@types/validate-npm-package-name": "^4.0.2",
|
||||
"@vitest/coverage-v8": "^2.0.5",
|
||||
"@vitest/coverage-v8": "^1.6.0",
|
||||
"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",
|
||||
"prettier": "^3.3.0",
|
||||
"terser": "^5.31.0",
|
||||
"tsup": "^8.2.4",
|
||||
"typescript": "~5.5.4",
|
||||
"vitest": "^2.0.5"
|
||||
"tsup": "^8.1.0",
|
||||
"typescript": "^5.4.5",
|
||||
"vitest": "^1.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
@@ -6,7 +6,7 @@ import { URL } from 'node:url';
|
||||
import glob from 'fast-glob';
|
||||
import picocolors from 'picocolors';
|
||||
import type { PackageManager } from './helpers/packageManager.js';
|
||||
import { install, isNodePackageManager } from './helpers/packageManager.js';
|
||||
import { install } from './helpers/packageManager.js';
|
||||
import { GUIDE_URL } from './util/constants.js';
|
||||
|
||||
interface Options {
|
||||
@@ -83,7 +83,7 @@ export async function createDiscordBot({ directory, installPackages, typescript,
|
||||
const globStream = glob.stream('./src/**/*.ts');
|
||||
for await (const file of globStream) {
|
||||
const newData = await readFile(file, { encoding: 'utf8' }).then((str) =>
|
||||
str.replaceAll('[REPLACE_IMPORT_EXT]', typescript && !isNodePackageManager(packageManager) ? 'ts' : 'js'),
|
||||
str.replaceAll('[REPLACE_IMPORT_EXT]', typescript ? 'ts' : 'js'),
|
||||
);
|
||||
await writeFile(file, newData);
|
||||
}
|
||||
@@ -93,10 +93,7 @@ export async function createDiscordBot({ directory, installPackages, typescript,
|
||||
encoding: 'utf8',
|
||||
}).then((str) => {
|
||||
let newStr = str.replace('[REPLACE_ME]', directoryName);
|
||||
newStr = newStr.replaceAll(
|
||||
'[REPLACE_IMPORT_EXT]',
|
||||
typescript && !isNodePackageManager(packageManager) ? 'ts' : 'js',
|
||||
);
|
||||
newStr = newStr.replaceAll('[REPLACE_IMPORT_EXT]', typescript ? 'ts' : 'js');
|
||||
return newStr;
|
||||
});
|
||||
await writeFile('./package.json', newPackageJSON);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { execSync } from 'node:child_process';
|
||||
import process from 'node:process';
|
||||
import picocolors from 'picocolors';
|
||||
import { DEFAULT_PACKAGE_MANAGER, NODE_PACKAGE_MANAGERS } from '../util/constants.js';
|
||||
import { DEFAULT_PACKAGE_MANAGER } from '../util/constants.js';
|
||||
|
||||
/**
|
||||
* A union of supported package managers.
|
||||
@@ -110,12 +110,3 @@ export function install(packageManager: PackageManager) {
|
||||
env,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the provided package manager is a Node package manager.
|
||||
*
|
||||
* @param packageManager - The package manager to check
|
||||
*/
|
||||
export function isNodePackageManager(packageManager: PackageManager): packageManager is 'npm' | 'pnpm' | 'yarn' {
|
||||
return NODE_PACKAGE_MANAGERS.includes(packageManager as any);
|
||||
}
|
||||
|
||||
@@ -13,11 +13,6 @@ export const DEFAULT_PROJECT_NAME = 'my-bot' as const;
|
||||
*/
|
||||
export const PACKAGE_MANAGERS = ['npm', 'pnpm', 'yarn', 'bun', 'deno'] as const;
|
||||
|
||||
/**
|
||||
* The supported Node.js package managers.
|
||||
*/
|
||||
export const NODE_PACKAGE_MANAGERS = ['npm', 'pnpm', 'yarn'] as const;
|
||||
|
||||
/**
|
||||
* The URL to the guide.
|
||||
*/
|
||||
|
||||
@@ -12,13 +12,14 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/core": "^1.2.0",
|
||||
"discord.js": "^14.16.0"
|
||||
"discord.js": "^14.15.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-neon": "^0.1.62",
|
||||
"eslint-formatter-pretty": "^6.0.1",
|
||||
"prettier": "^3.3.3",
|
||||
"zod": "^3.23.8"
|
||||
"@sapphire/ts-config": "^4.0.1",
|
||||
"eslint": "^8.53.0",
|
||||
"eslint-config-neon": "^0.1.57",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.1.0",
|
||||
"zod": "^3.22.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,16 +12,16 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/core": "^1.2.0",
|
||||
"discord.js": "^14.16.0"
|
||||
"discord.js": "^14.15.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sapphire/ts-config": "^5.0.1",
|
||||
"@types/bun": "^1.1.6",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-neon": "^0.1.62",
|
||||
"eslint-formatter-pretty": "^6.0.1",
|
||||
"@sapphire/ts-config": "^5.0.0",
|
||||
"bun-types": "^1.0.9",
|
||||
"eslint": "^8.53.0",
|
||||
"eslint-config-neon": "^0.1.57",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.1.0",
|
||||
"typescript": "~5.5.4",
|
||||
"zod": "^3.23.8"
|
||||
"typescript": "^5.2.2",
|
||||
"zod": "^3.22.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig.json",
|
||||
"extends": ["@sapphire/ts-config", "@sapphire/ts-config/extra-strict"],
|
||||
"extends": "@sapphire/ts-config/extra-strict",
|
||||
"compilerOptions": {
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
@@ -10,6 +10,7 @@
|
||||
"outDir": "dist",
|
||||
"noEmit": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
"types": ["bun-types"],
|
||||
"skipLibCheck": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { RESTPostAPIApplicationCommandsJSONBody, CommandInteraction } from 'npm:discord.js@^14.16.0';
|
||||
import { z } from 'npm:zod@^3.23.8';
|
||||
import type { RESTPostAPIApplicationCommandsJSONBody, CommandInteraction } from 'npm:discord.js@^14.14.1';
|
||||
import { z } from 'npm:zod@^3.22.4';
|
||||
import type { StructurePredicate } from '../util/loaders.ts';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ClientEvents } from 'npm:discord.js@^14.16.0';
|
||||
import { z } from 'npm:zod@^3.23.8';
|
||||
import type { ClientEvents } from 'npm:discord.js@^14.14.1';
|
||||
import { z } from 'npm:zod@^3.22.4';
|
||||
import type { StructurePredicate } from '../util/loaders.ts';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Events } from 'npm:discord.js@^14.16.0';
|
||||
import { Events } from 'npm:discord.js@^14.14.1';
|
||||
import type { Event } from './index.ts';
|
||||
|
||||
export default {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'https://deno.land/std@0.199.0/dotenv/load.ts';
|
||||
import { URL } from 'node:url';
|
||||
import { Client, GatewayIntentBits } from 'npm:discord.js@^14.16.0';
|
||||
import { Client, GatewayIntentBits } from 'npm:discord.js@^14.15.0';
|
||||
import { loadCommands, loadEvents } from './util/loaders.ts';
|
||||
import { registerEvents } from './util/registerEvents.ts';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'https://deno.land/std@0.223.0/dotenv/load.ts';
|
||||
import 'https://deno.land/std@0.199.0/dotenv/load.ts';
|
||||
import { URL } from 'node:url';
|
||||
import { API } from 'npm:@discordjs/core@^1.2.0/http-only';
|
||||
import { REST } from 'npm:discord.js@^14.16.0';
|
||||
import { API } from 'npm:@discordjs/core@^1.1.1/http-only';
|
||||
import { REST } from 'npm:discord.js@^14.14.1';
|
||||
import { loadCommands } from './loaders.ts';
|
||||
|
||||
const commands = await loadCommands(new URL('../commands/', import.meta.url));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Events, type Client } from 'npm:discord.js@^14.16.0';
|
||||
import { Events, type Client } from 'npm:discord.js@^14.14.1';
|
||||
import type { Command } from '../commands/index.ts';
|
||||
import type { Event } from '../events/index.ts';
|
||||
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/core": "^1.2.0",
|
||||
"discord.js": "^14.16.0",
|
||||
"dotenv": "^16.4.5"
|
||||
"discord.js": "^14.15.0",
|
||||
"dotenv": "^16.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-neon": "^0.1.62",
|
||||
"eslint-formatter-pretty": "^6.0.1",
|
||||
"prettier": "^3.3.3",
|
||||
"zod": "^3.23.8"
|
||||
"eslint": "^8.53.0",
|
||||
"eslint-config-neon": "^0.1.57",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.1.0",
|
||||
"zod": "^3.22.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
dist
|
||||
@@ -13,17 +13,17 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/core": "^1.2.0",
|
||||
"discord.js": "^14.16.0",
|
||||
"dotenv": "^16.4.5"
|
||||
"discord.js": "^14.15.0",
|
||||
"dotenv": "^16.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sapphire/ts-config": "^5.0.1",
|
||||
"@types/node": "^18.19.45",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-neon": "^0.1.62",
|
||||
"eslint-formatter-pretty": "^6.0.1",
|
||||
"prettier": "^3.3.3",
|
||||
"typescript": "~5.5.4",
|
||||
"zod": "^3.23.8"
|
||||
"@sapphire/ts-config": "^5.0.0",
|
||||
"@types/node": "^18.18.8",
|
||||
"eslint": "^8.53.0",
|
||||
"eslint-config-neon": "^0.1.57",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.1.0",
|
||||
"typescript": "^5.2.2",
|
||||
"zod": "^3.22.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig.json",
|
||||
"extends": ["@sapphire/ts-config", "@sapphire/ts-config/extra-strict"],
|
||||
"extends": "@sapphire/ts-config/extra-strict",
|
||||
"compilerOptions": {
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
"no-void": "error",
|
||||
"no-warning-comments": "warn",
|
||||
"prefer-promise-reject-errors": "error",
|
||||
"require-await": "off",
|
||||
"require-await": "warn",
|
||||
"wrap-iife": "error",
|
||||
"yoda": "error",
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,8 +9,7 @@
|
||||
<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://github.com/discordjs/discord.js/commits/main/packages/discord.js"><img alt="Last commit." src="https://img.shields.io/github/last-commit/discordjs/discord.js?logo=github&logoColor=ffffff&path=packages%2Fdiscord.js"></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>
|
||||
<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>
|
||||
@@ -30,7 +29,7 @@ discord.js is a powerful [Node.js](https://nodejs.org) module that allows you to
|
||||
|
||||
## Installation
|
||||
|
||||
**Node.js 18 or newer is required.**
|
||||
**Node.js 16.11.0 or newer is required.**
|
||||
|
||||
```sh
|
||||
npm install discord.js
|
||||
@@ -43,6 +42,7 @@ bun add discord.js
|
||||
|
||||
- [zlib-sync](https://www.npmjs.com/package/zlib-sync) for WebSocket data compression and inflation (`npm install zlib-sync`)
|
||||
- [bufferutil](https://www.npmjs.com/package/bufferutil) for a much faster WebSocket connection (`npm install bufferutil`)
|
||||
- [utf-8-validate](https://www.npmjs.com/package/utf-8-validate) in combination with `bufferutil` for much faster WebSocket processing (`npm install utf-8-validate`)
|
||||
- [@discordjs/voice](https://www.npmjs.com/package/@discordjs/voice) for interacting with the Discord Voice API (`npm install @discordjs/voice`)
|
||||
|
||||
## Example usage
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
{
|
||||
"extends": "../../api-extractor.json",
|
||||
"mainEntryPointFilePath": "<projectFolder>/typings/index.d.ts",
|
||||
"bundledPackages": [
|
||||
"discord-api-types",
|
||||
"@discordjs/builders",
|
||||
"@discordjs/formatters",
|
||||
"@discordjs/rest",
|
||||
"@discordjs/util",
|
||||
"@discordjs/ws"
|
||||
],
|
||||
"docModel": {
|
||||
"projectFolderUrl": "https://github.com/discordjs/discord.js/tree/main/packages/discord.js"
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user