mirror of
https://github.com/discordjs/discord.js.git
synced 2026-05-27 14:00:08 +00:00
Compare commits
21 Commits
@discordjs
...
14.7.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
322cb99049 | ||
|
|
11d195d04f | ||
|
|
f13ff5c6d3 | ||
|
|
5e4331062b | ||
|
|
fff3602a8a | ||
|
|
72c30d1578 | ||
|
|
2cb1000a3a | ||
|
|
8a39c14921 | ||
|
|
4ae029dfe2 | ||
|
|
2849af0118 | ||
|
|
90d192078f | ||
|
|
b0f9b9c344 | ||
|
|
6bcebd4867 | ||
|
|
1efa95337f | ||
|
|
2f4bdf7394 | ||
|
|
4b9b62416b | ||
|
|
208378b214 | ||
|
|
6e65b45b31 | ||
|
|
2b260bd4bb | ||
|
|
cab692409d | ||
|
|
0fe503b516 |
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -16,9 +16,9 @@ body:
|
||||
- builders
|
||||
- collection
|
||||
- core
|
||||
- rest
|
||||
- proxy
|
||||
- proxy-container
|
||||
- rest
|
||||
- voice
|
||||
- ws
|
||||
validations:
|
||||
|
||||
3
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
3
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
@@ -14,12 +14,13 @@ body:
|
||||
label: Which package is the feature request for?
|
||||
options:
|
||||
- discord.js
|
||||
- brokers
|
||||
- builders
|
||||
- collection
|
||||
- core
|
||||
- rest
|
||||
- proxy
|
||||
- proxy-container
|
||||
- rest
|
||||
- voice
|
||||
- ws
|
||||
validations:
|
||||
|
||||
7
.github/labeler.yml
vendored
7
.github/labeler.yml
vendored
@@ -4,7 +4,6 @@ apps:guide:
|
||||
apps:website:
|
||||
- apps/website/*
|
||||
- apps/website/**/*
|
||||
|
||||
packages:brokers:
|
||||
- packages/brokers/*
|
||||
- packages/brokers/**/*
|
||||
@@ -32,9 +31,9 @@ packages:proxy-container:
|
||||
packages:rest:
|
||||
- packages/rest/*
|
||||
- packages/rest/**/*
|
||||
packages/ui:
|
||||
- packages:ui/*
|
||||
- packages:ui/**/*
|
||||
packages:ui:
|
||||
- packages/ui/*
|
||||
- packages/ui/**/*
|
||||
packages:util:
|
||||
- packages/util/*
|
||||
- packages/util/**/*
|
||||
|
||||
8
.github/labels.yml
vendored
8
.github/labels.yml
vendored
@@ -20,10 +20,10 @@
|
||||
color: 0075ca
|
||||
- name: dependencies
|
||||
color: 276bd1
|
||||
- name: discussion
|
||||
color: b6b1f9
|
||||
- name: discord
|
||||
color: '5663e9'
|
||||
- name: discussion
|
||||
color: b6b1f9
|
||||
- name: documentation
|
||||
color: 0075ca
|
||||
- name: duplicate
|
||||
@@ -40,12 +40,12 @@
|
||||
color: 4b1f8e
|
||||
- name: help wanted
|
||||
color: '008672'
|
||||
- name: interactions
|
||||
color: 80c042
|
||||
- name: in progress
|
||||
color: ffccd7
|
||||
- name: in review
|
||||
color: aed5fc
|
||||
- name: interactions
|
||||
color: 80c042
|
||||
- name: invalid
|
||||
color: e4e669
|
||||
- name: need repro
|
||||
|
||||
1
apps/website/.gitignore
vendored
1
apps/website/.gitignore
vendored
@@ -21,6 +21,7 @@ typings/
|
||||
build/
|
||||
src/styles/unocss.css
|
||||
.next/
|
||||
src/assets/readme/
|
||||
|
||||
# Miscellaneous
|
||||
.tmp/
|
||||
|
||||
@@ -14,7 +14,12 @@ export default withBundleAnalyzer({
|
||||
eslint: {
|
||||
ignoreDuringBuilds: true,
|
||||
},
|
||||
// Until Next.js fixes their type issues
|
||||
typescript: {
|
||||
ignoreBuildErrors: true,
|
||||
},
|
||||
cleanDistDir: true,
|
||||
outputFileTracing: true,
|
||||
experimental: {
|
||||
appDir: true,
|
||||
serverComponentsExternalPackages: ['@microsoft/api-extractor-model', 'jju', 'shiki'],
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build:local": "yarn run --top-level docs --force && cross-env-shell NEXT_PUBLIC_LOCAL_DEV=true yarn build:prod",
|
||||
"build:prod": "yarn workspaces foreach -ptR run build && yarn build:css && yarn build:next",
|
||||
"build:copy_readme": "cpy '../../packages/*/README.md' 'src/assets/readme' --rename='home-{{basename}}'",
|
||||
"build:local": "yarn run --top-level docs --force && yarn build:copy_readme && cross-env-shell NEXT_PUBLIC_LOCAL_DEV=true yarn build:prod",
|
||||
"build:prod": "yarn workspaces foreach -ptR run build && yarn build:copy_readme && yarn build:css && yarn build:next",
|
||||
"build:next": "next build",
|
||||
"build:css": "yarn generate:css",
|
||||
"build:search_indicies": "yarn node scripts/generateAllIndicies.js",
|
||||
@@ -53,10 +54,9 @@
|
||||
"ariakit": "^2.0.0-next.41",
|
||||
"cmdk": "^0.1.20",
|
||||
"meilisearch": "^0.30.0",
|
||||
"next": "^13.0.5",
|
||||
"next": "^13.0.6-canary.1",
|
||||
"next-mdx-remote": "^4.2.0",
|
||||
"next-progress": "^2.2.0",
|
||||
"next-themes": "^0.2.1",
|
||||
"next-themes": "npm:@wits/next-themes@latest",
|
||||
"react": "^18.2.0",
|
||||
"react-custom-scrollbars-2": "^4.5.0",
|
||||
"react-dom": "^18.2.0",
|
||||
@@ -84,6 +84,7 @@
|
||||
"@vitejs/plugin-react": "^2.2.0",
|
||||
"@vitest/coverage-c8": "^0.25.3",
|
||||
"concurrently": "^7.6.0",
|
||||
"cpy-cli": "^4.2.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.28.0",
|
||||
"eslint-config-neon": "^0.1.40",
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import type { PropsWithChildren } from 'react';
|
||||
import { CmdKProvider } from '~/contexts/cmdK';
|
||||
import { NavProvider } from '~/contexts/nav';
|
||||
|
||||
export function Providers({ children }: PropsWithChildren) {
|
||||
return (
|
||||
<NavProvider>
|
||||
<CmdKProvider>{children}</CmdKProvider>
|
||||
</NavProvider>
|
||||
);
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import { Providers } from './providers';
|
||||
import { CmdKDialog } from '~/components/CmdK';
|
||||
import { Header } from '~/components/Header';
|
||||
|
||||
export default function SidebarLayout({ children }: PropsWithChildren<any>) {
|
||||
export default function SidebarLayout({ children }: PropsWithChildren) {
|
||||
return (
|
||||
<Providers>
|
||||
<Header />
|
||||
@@ -30,7 +30,7 @@ import shikiLangJavascript from 'shiki/languages/javascript.tmLanguage.json';
|
||||
import shikiLangTypescript from 'shiki/languages/typescript.tmLanguage.json';
|
||||
import shikiThemeDarkPlus from 'shiki/themes/dark-plus.json';
|
||||
import shikiThemeLightPlus from 'shiki/themes/light-plus.json';
|
||||
import vercelLogo from '../../../assets/powered-by-vercel.svg';
|
||||
import vercelLogo from '../../../../../assets/powered-by-vercel.svg';
|
||||
import { MDXRemote } from '~/components/MDXRemote';
|
||||
import { Nav } from '~/components/Nav';
|
||||
import { Class } from '~/components/model/Class';
|
||||
@@ -44,90 +44,93 @@ import { DESCRIPTION, PACKAGES } from '~/util/constants';
|
||||
import { findMember, findMemberByKey } from '~/util/model.server';
|
||||
import { tryResolveDescription } from '~/util/summary';
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return (
|
||||
await Promise.all(
|
||||
PACKAGES.map(async (packageName) => {
|
||||
try {
|
||||
let data: any[] = [];
|
||||
let versions: string[] = [];
|
||||
if (process.env.NEXT_PUBLIC_LOCAL_DEV) {
|
||||
const res = await readFile(
|
||||
join(cwd(), '..', '..', 'packages', packageName, 'docs', 'docs.api.json'),
|
||||
'utf8',
|
||||
);
|
||||
data = JSON.parse(res);
|
||||
} else {
|
||||
const response = await fetch(`https://docs.discordjs.dev/api/info?package=${packageName}`);
|
||||
versions = await response.json();
|
||||
versions = versions.slice(-2);
|
||||
export async function generateStaticParams({ params }: { params?: { package: string } }) {
|
||||
const packageName = params?.package ?? 'builders';
|
||||
|
||||
for (const version of versions) {
|
||||
const res = await fetch(`https://docs.discordjs.dev/docs/${packageName}/${version}.api.json`);
|
||||
data = [...data, await res.json()];
|
||||
try {
|
||||
let data: any[] = [];
|
||||
let versions: string[] = [];
|
||||
if (process.env.NEXT_PUBLIC_LOCAL_DEV) {
|
||||
const res = await readFile(join(cwd(), '..', '..', 'packages', packageName, 'docs', 'docs.api.json'), 'utf8');
|
||||
data = JSON.parse(res);
|
||||
} else {
|
||||
const response = await fetch(`https://docs.discordjs.dev/api/info?package=${packageName}`);
|
||||
versions = await response.json();
|
||||
versions = versions.slice(-2);
|
||||
|
||||
for (const version of versions) {
|
||||
const res = await fetch(`https://docs.discordjs.dev/docs/${packageName}/${version}.api.json`);
|
||||
data = [...data, await res.json()];
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(data)) {
|
||||
const models = data.map((innerData) => createApiModel(innerData));
|
||||
const pkgs = models.map((model) => findPackage(model, packageName)) as ApiPackage[];
|
||||
|
||||
return [
|
||||
...versions.map((version) => ({ slug: [version] })),
|
||||
...pkgs.flatMap((pkg, idx) =>
|
||||
getMembers(pkg, versions[idx] ?? 'main').map((member) => {
|
||||
if (member.kind === ApiItemKind.Function && member.overloadIndex && member.overloadIndex > 1) {
|
||||
return {
|
||||
slug: [versions[idx] ?? 'main', `${member.name}:${member.overloadIndex}:${member.kind}`],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(data)) {
|
||||
const models = data.map((innerData) => createApiModel(innerData));
|
||||
const pkgs = models.map((model) => findPackage(model, packageName)) as ApiPackage[];
|
||||
return {
|
||||
slug: [versions[idx] ?? 'main', `${member.name}:${member.kind}`],
|
||||
};
|
||||
}),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
...versions.map((version) => ({ slug: ['packages', packageName, version] })),
|
||||
...pkgs.flatMap((pkg, idx) =>
|
||||
getMembers(pkg, versions[idx] ?? 'main').map((member) => {
|
||||
if (member.kind === ApiItemKind.Function && member.overloadIndex && member.overloadIndex > 1) {
|
||||
return {
|
||||
slug: [
|
||||
'packages',
|
||||
packageName,
|
||||
versions[idx] ?? 'main',
|
||||
`${member.name}:${member.overloadIndex}:${member.kind}`,
|
||||
],
|
||||
};
|
||||
}
|
||||
const model = createApiModel(data);
|
||||
const pkg = findPackage(model, packageName)!;
|
||||
|
||||
return {
|
||||
slug: ['packages', packageName, versions[idx] ?? 'main', `${member.name}:${member.kind}`],
|
||||
};
|
||||
}),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
const model = createApiModel(data);
|
||||
const pkg = findPackage(model, packageName)!;
|
||||
|
||||
return [
|
||||
{ slug: ['packages', packageName, 'main'] },
|
||||
...getMembers(pkg, 'main').map((member) => {
|
||||
if (member.kind === ApiItemKind.Function && member.overloadIndex && member.overloadIndex > 1) {
|
||||
return {
|
||||
slug: ['packages', packageName, 'main', `${member.name}:${member.overloadIndex}:${member.kind}`],
|
||||
};
|
||||
}
|
||||
|
||||
return { slug: ['packages', packageName, 'main', `${member.name}:${member.kind}`] };
|
||||
}),
|
||||
];
|
||||
} catch {
|
||||
return { slug: [] };
|
||||
return [
|
||||
{ slug: ['main'] },
|
||||
...getMembers(pkg, 'main').map((member) => {
|
||||
if (member.kind === ApiItemKind.Function && member.overloadIndex && member.overloadIndex > 1) {
|
||||
return {
|
||||
slug: ['main', `${member.name}:${member.overloadIndex}:${member.kind}`],
|
||||
};
|
||||
}
|
||||
|
||||
return { slug: ['main', `${member.name}:${member.kind}`] };
|
||||
}),
|
||||
)
|
||||
).flat();
|
||||
];
|
||||
} catch {
|
||||
return [{ slug: ['main'] }];
|
||||
}
|
||||
}
|
||||
|
||||
async function getData(slug: string[]) {
|
||||
const [path, packageName = 'builders', branchName = 'main', member] = slug;
|
||||
async function getData(packageName: string, slug: string[]) {
|
||||
const [branchName = 'main', member] = slug;
|
||||
|
||||
if (path !== 'packages' || !PACKAGES.includes(packageName)) {
|
||||
if (!PACKAGES.includes(packageName)) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
let data;
|
||||
try {
|
||||
if (process.env.NEXT_PUBLIC_LOCAL_DEV) {
|
||||
const res = await readFile(join(cwd(), '..', '..', 'packages', packageName, 'docs', 'docs.api.json'), 'utf8');
|
||||
data = JSON.parse(res);
|
||||
} else {
|
||||
const res = await fetch(`https://docs.discordjs.dev/docs/${packageName}/${branchName}.api.json`, {
|
||||
next: { revalidate: 3_600 },
|
||||
});
|
||||
data = await res.json();
|
||||
}
|
||||
} catch {
|
||||
notFound();
|
||||
}
|
||||
|
||||
const [memberName, overloadIndex] = member?.split('%3A') ?? [];
|
||||
|
||||
const readme = await readFile(join(cwd(), '..', '..', 'packages', packageName, 'README.md'), 'utf8');
|
||||
const readme = await readFile(join(cwd(), 'src', 'assets', 'readme', packageName, 'home-README.md'), 'utf8');
|
||||
|
||||
const mdxSource = await serialize(readme, {
|
||||
mdxOptions: {
|
||||
@@ -161,17 +164,6 @@ async function getData(slug: string[]) {
|
||||
},
|
||||
});
|
||||
|
||||
let data;
|
||||
if (process.env.NEXT_PUBLIC_LOCAL_DEV) {
|
||||
const res = await readFile(join(cwd(), '..', '..', 'packages', packageName, 'docs', 'docs.api.json'), 'utf8');
|
||||
data = JSON.parse(res);
|
||||
} else {
|
||||
const res = await fetch(`https://docs.discordjs.dev/docs/${packageName}/${branchName}.api.json`, {
|
||||
next: { revalidate: 3_600 },
|
||||
});
|
||||
data = await res.json();
|
||||
}
|
||||
|
||||
const model = createApiModel(data);
|
||||
const pkg = findPackage(model, packageName);
|
||||
|
||||
@@ -257,8 +249,8 @@ function member(props?: ApiItemJSON | undefined) {
|
||||
}
|
||||
}
|
||||
|
||||
export default async function Page({ params }: { params: { slug: string[] } }) {
|
||||
const data = await getData(params.slug);
|
||||
export default async function Page({ params }: { params: { package: string; slug: string[] } }) {
|
||||
const data = await getData(params.package, params.slug);
|
||||
|
||||
// const name = useMemo(
|
||||
// () => `discord.js${params.data?.member?.name ? ` | ${params.data.member.name}` : ''}`,
|
||||
@@ -388,7 +380,3 @@ export default async function Page({ params }: { params: { slug: string[] } }) {
|
||||
</MemberProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export const config = {
|
||||
unstable_includeFiles: [`../../packages/{brokers,builders,collection,core,proxy,rest,util,voice,ws}/README.md`],
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
'use client';
|
||||
|
||||
// import { ThemeProvider } from 'next-themes';
|
||||
import type { PropsWithChildren } from 'react';
|
||||
import { CmdKProvider } from '~/contexts/cmdK';
|
||||
import { NavProvider } from '~/contexts/nav';
|
||||
|
||||
export function Providers({ children }: PropsWithChildren) {
|
||||
return (
|
||||
<NavProvider>
|
||||
<CmdKProvider>
|
||||
{/* <ThemeProvider
|
||||
attribute="class"
|
||||
cookieName="theme"
|
||||
defaultTheme="system"
|
||||
disableTransitionOnChange
|
||||
value={{
|
||||
light: 'light',
|
||||
dark: 'dark',
|
||||
}}
|
||||
> */}
|
||||
{children}
|
||||
{/* </ThemeProvider> */}
|
||||
</CmdKProvider>
|
||||
</NavProvider>
|
||||
);
|
||||
}
|
||||
10
apps/website/src/app/docs/packages/[package]/layout.tsx
Normal file
10
apps/website/src/app/docs/packages/[package]/layout.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { PropsWithChildren } from 'react';
|
||||
import { PACKAGES } from '~/util/constants';
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return PACKAGES.map((packageName) => ({ package: packageName }));
|
||||
}
|
||||
|
||||
export default function PackageLayout({ children }: PropsWithChildren) {
|
||||
return children;
|
||||
}
|
||||
@@ -5,12 +5,6 @@ import Link from 'next/link';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { PACKAGES } from '~/util/constants';
|
||||
|
||||
export const dynamicParams = false;
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return PACKAGES.map((packageName) => ({ package: packageName }));
|
||||
}
|
||||
|
||||
async function getData(pkg: string) {
|
||||
if (!PACKAGES.includes(pkg)) {
|
||||
notFound();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ServerThemeProvider } from 'next-themes';
|
||||
import type { PropsWithChildren } from 'react';
|
||||
import { Providers } from './providers';
|
||||
|
||||
import '@unocss/reset/tailwind.css';
|
||||
import '../styles/inter.css';
|
||||
@@ -9,11 +9,19 @@ import '../styles/main.css';
|
||||
|
||||
export default function RootLayout({ children }: PropsWithChildren) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<head />
|
||||
<body className="dark:bg-dark-800 bg-white">
|
||||
<Providers>{children}</Providers>
|
||||
</body>
|
||||
</html>
|
||||
<ServerThemeProvider
|
||||
attribute="class"
|
||||
defaultTheme="system"
|
||||
disableTransitionOnChange
|
||||
value={{
|
||||
light: 'light',
|
||||
dark: 'dark',
|
||||
}}
|
||||
>
|
||||
<html lang="en">
|
||||
<head />
|
||||
<body className="dark:bg-dark-800 bg-white">{children}</body>
|
||||
</html>
|
||||
</ServerThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ export default function Page() {
|
||||
<Link
|
||||
className="bg-blurple focus:ring-width-2 flex h-11 transform-gpu cursor-pointer select-none appearance-none flex-row place-items-center rounded border-0 px-6 text-base font-semibold leading-none text-white no-underline outline-0 focus:ring focus:ring-white active:translate-y-px"
|
||||
href="/docs"
|
||||
prefetch={false}
|
||||
>
|
||||
Docs
|
||||
</Link>
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { ThemeProvider } from 'next-themes';
|
||||
import type { PropsWithChildren } from 'react';
|
||||
|
||||
export function Providers({ children }: PropsWithChildren) {
|
||||
return (
|
||||
<ThemeProvider
|
||||
attribute="class"
|
||||
defaultTheme="system"
|
||||
disableTransitionOnChange
|
||||
value={{
|
||||
light: 'light',
|
||||
dark: 'dark',
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
'use client';
|
||||
|
||||
import { FiCommand } from '@react-icons/all-files/fi/FiCommand';
|
||||
import { VscColorMode } from '@react-icons/all-files/vsc/VscColorMode';
|
||||
// import { VscColorMode } from '@react-icons/all-files/vsc/VscColorMode';
|
||||
import { VscGithubInverted } from '@react-icons/all-files/vsc/VscGithubInverted';
|
||||
import { VscMenu } from '@react-icons/all-files/vsc/VscMenu';
|
||||
import { VscSearch } from '@react-icons/all-files/vsc/VscSearch';
|
||||
import { Button } from 'ariakit/button';
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import { useTheme } from 'next-themes';
|
||||
// import { useTheme } from 'next-themes';
|
||||
import { Fragment, useEffect, useMemo, useState } from 'react';
|
||||
import { useCmdK } from '~/contexts/cmdK';
|
||||
import { useNav } from '~/contexts/nav';
|
||||
@@ -17,9 +17,9 @@ export function Header() {
|
||||
const pathname = usePathname();
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
const { setOpened } = useNav();
|
||||
const { resolvedTheme, setTheme } = useTheme();
|
||||
// const { resolvedTheme, setTheme } = useTheme();
|
||||
const dialog = useCmdK();
|
||||
const toggleTheme = () => setTheme(resolvedTheme === 'light' ? 'dark' : 'light');
|
||||
// const toggleTheme = () => setTheme(resolvedTheme === 'light' ? 'dark' : 'light');
|
||||
const [asPathWithoutQueryAndAnchor, setAsPathWithoutQueryAndAnchor] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
@@ -111,13 +111,13 @@ export function Header() {
|
||||
>
|
||||
<VscGithubInverted size={24} />
|
||||
</Button>
|
||||
<Button
|
||||
{/* <Button
|
||||
aria-label="Toggle theme"
|
||||
className="focus:ring-width-2 focus:ring-blurple flex h-6 w-6 transform-gpu cursor-pointer select-none appearance-none flex-row place-items-center rounded-full rounded border-0 bg-transparent p-0 text-sm font-semibold leading-none no-underline outline-0 focus:ring active:translate-y-px"
|
||||
onClick={() => toggleTheme()}
|
||||
>
|
||||
<VscColorMode size={24} />
|
||||
</Button>
|
||||
</Button> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,7 @@ export default async function middleware(request: NextRequest) {
|
||||
}
|
||||
|
||||
if (PACKAGES.some((pkg) => request.nextUrl.pathname.includes(pkg))) {
|
||||
// eslint-disable-next-line prefer-named-capture-group
|
||||
const packageName = /\/docs\/packages\/([^/]+)\/.*/.exec(request.nextUrl.pathname)?.[1] ?? 'builders';
|
||||
const res = await fetch(`https://docs.discordjs.dev/api/info?package=${packageName}`);
|
||||
const data: string[] = await res.json();
|
||||
|
||||
@@ -2,6 +2,51 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
# [14.7.1](https://github.com/discordjs/discord.js/compare/14.7.0...14.7.1) - (2022-12-01)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Prevent crash on no select menu option (#8881) ([11d195d](https://github.com/discordjs/discord.js/commit/11d195d04ff57d51adb0f0d3a0a7342f9e34aba0))
|
||||
|
||||
# [14.7.0](https://github.com/discordjs/discord.js/compare/14.6.0...14.7.0) - (2022-11-28)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **MessageMentions:** Add `InGuild` generic (#8828) ([f982803](https://github.com/discordjs/discord.js/commit/f9828034cd21e6f702762a46923e0f42115596f6))
|
||||
- **Activity:** Fix equals() not checking for differing emoji (#8841) ([7e06f68](https://github.com/discordjs/discord.js/commit/7e06f68185423ba7cb310220b213f445b6571e29))
|
||||
- Fixed react/astro/guide/discord.js build, updated dependencies, fix crawlvatar (#8861) ([d0c8256](https://github.com/discordjs/discord.js/commit/d0c82561b8a1765a1daa362ca903f3ffb3fa33ee))
|
||||
- **escapeMarkdown:** Fix double escaping (#8798) ([d6873b7](https://github.com/discordjs/discord.js/commit/d6873b7159352479475b3a0daa215bddbdd3a79b))
|
||||
- **Transfomers:** Call `.toJSON` in `toSnakeCase` (#8790) ([017f9b1](https://github.com/discordjs/discord.js/commit/017f9b1ed4014dc1db0b78c1a77e463b4403de5d))
|
||||
- Censor token in debug output (#8764) ([53d8e87](https://github.com/discordjs/discord.js/commit/53d8e87d7f3a329608250656950bd0a200adb1c7))
|
||||
- Pin @types/node version ([9d8179c](https://github.com/discordjs/discord.js/commit/9d8179c6a78e1c7f9976f852804055964d5385d4))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Describe InteractionEditReplyOptions (#8840) ([cb77fd0](https://github.com/discordjs/discord.js/commit/cb77fd02d083438de2aff6f0769baf7d1797bc65))
|
||||
- **AutoModerationRuleManager:** Describe cache (#8848) ([d275480](https://github.com/discordjs/discord.js/commit/d2754802cc3479e6288cdbfcd48c76bf57e09a07))
|
||||
- Fix message action row components (#8819) ([65bc0ad](https://github.com/discordjs/discord.js/commit/65bc0adbf4d7870d33b92585ca18f964f24bc84e))
|
||||
- Specify `ActionRowBuilder` for `components` (#8834) ([8ed5c1b](https://github.com/discordjs/discord.js/commit/8ed5c1beb622f71ce0bd89e4cbeff50e464da8fe))
|
||||
- Add `@extends` for select menu classes (#8824) ([09f65b7](https://github.com/discordjs/discord.js/commit/09f65b724b0d2f36bbe89b83570c0d18093b5126))
|
||||
- Make WebSocketShard.lastPingTimestamp public (#8768) ([68c9cb3](https://github.com/discordjs/discord.js/commit/68c9cb37bc3df6326b720291827ea477e421faf2))
|
||||
- **MessageReplyOptions:** Remove duplicate stickers field (#8766) ([6e348ff](https://github.com/discordjs/discord.js/commit/6e348ffd1d8db8d8ad2da7823460814695e01a43))
|
||||
|
||||
## Features
|
||||
|
||||
- **Webhook:** Add `channel` property (#8812) ([decbce4](https://github.com/discordjs/discord.js/commit/decbce401062af75f633e6acacc88207b115a719))
|
||||
- Auto Moderation (#7938) ([fd4ba5e](https://github.com/discordjs/discord.js/commit/fd4ba5eaba66898699127fc0d5f0ab52c18e3db0))
|
||||
- **SelectMenuInteractions:** Add `values` property (#8805) ([b2fabd1](https://github.com/discordjs/discord.js/commit/b2fabd130a76ea54cfbfa1b871ef8659513c2c7a))
|
||||
- **ThreadChannel:** Add a helper for pin and unpin (#8786) ([e74aa7f](https://github.com/discordjs/discord.js/commit/e74aa7f6b0fe04e3473fc4a62a73a7db87307685))
|
||||
- Add `Message#bulkDeletable` (#8760) ([ff85481](https://github.com/discordjs/discord.js/commit/ff85481d3e7cd6f7c5e38edbe43b27b104e82fba))
|
||||
- New select menus (#8793) ([5152abf](https://github.com/discordjs/discord.js/commit/5152abf7285581abf7689e9050fdc56c4abb1e2b))
|
||||
- **InteractionResponses:** Add message parameter (#8773) ([8b400ca](https://github.com/discordjs/discord.js/commit/8b400ca975c6bad00060b9c67068f42bd53524ba))
|
||||
- Support resume urls (#8784) ([88cd9d9](https://github.com/discordjs/discord.js/commit/88cd9d906074eb79e85df0ef49287f11133d2e0d))
|
||||
- Allow deletion of ephemeral messages (#8774) ([fc10774](https://github.com/discordjs/discord.js/commit/fc107744618857bf28c2167f204253baf690ede8))
|
||||
- **GuildChannelManager:** Add `.addFollower()` method (#8567) ([caeb1cb](https://github.com/discordjs/discord.js/commit/caeb1cbfdb2f2f007252c4d7e9f47a575c24bcb5))
|
||||
|
||||
## Refactor
|
||||
|
||||
- **Embed:** Use `embedLength` function from builders (#8735) ([cb3826c](https://github.com/discordjs/discord.js/commit/cb3826ce6dbcd3cf7ab639af6cdfcea80336aa1d))
|
||||
|
||||
# [14.6.0](https://github.com/discordjs/discord.js/compare/14.5.0...14.6.0) - (2022-10-10)
|
||||
|
||||
## Bug Fixes
|
||||
@@ -230,7 +275,7 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
- **DataResolver#resolveImage:** Adjust to updated resolveFile (#8308) ([3a7e93d](https://github.com/discordjs/discord.js/commit/3a7e93df576172c797f1d8bd6483234bb6af2d00))
|
||||
|
||||
# [14.0.0](https://github.com/discordjs/discord.js/tree/14.0.0) - (2022-07-17)
|
||||
# [14.0.0](https://github.com/discordjs/discord.js/compare/13.12.0...14.0.0) - (2022-07-17)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "discord.js",
|
||||
"version": "14.6.0",
|
||||
"version": "14.7.1",
|
||||
"description": "A powerful library for interacting with the Discord API",
|
||||
"scripts": {
|
||||
"test": "yarn docs:test && yarn test:typescript",
|
||||
|
||||
@@ -10,19 +10,21 @@ const MessageComponentInteraction = require('./MessageComponentInteraction');
|
||||
class ChannelSelectMenuInteraction extends MessageComponentInteraction {
|
||||
constructor(client, data) {
|
||||
super(client, data);
|
||||
const { resolved, values } = data.data;
|
||||
|
||||
/**
|
||||
* An array of the selected channel ids
|
||||
* @type {Snowflake[]}
|
||||
*/
|
||||
this.values = data.data.values ?? [];
|
||||
this.values = values ?? [];
|
||||
|
||||
/**
|
||||
* Collection of the selected channels
|
||||
* @type {Collection<Snowflake, Channel|APIChannel>}
|
||||
*/
|
||||
this.channels = new Collection();
|
||||
for (const channel of Object.values(data.data.resolved.channels)) {
|
||||
|
||||
for (const channel of Object.values(resolved?.channels ?? {})) {
|
||||
this.channels.set(channel.id, this.client.channels._add(channel, this.guild) ?? channel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,14 +11,14 @@ const Events = require('../util/Events');
|
||||
class MentionableSelectMenuInteraction extends MessageComponentInteraction {
|
||||
constructor(client, data) {
|
||||
super(client, data);
|
||||
const { resolved, values } = data.data;
|
||||
const { members, users, roles } = resolved ?? {};
|
||||
|
||||
/**
|
||||
* An array of the selected user and role ids
|
||||
* @type {Snowflake[]}
|
||||
*/
|
||||
this.values = data.data.values ?? [];
|
||||
|
||||
const { members, users, roles } = data.data.resolved ?? {};
|
||||
this.values = values ?? [];
|
||||
|
||||
/**
|
||||
* Collection of the selected users
|
||||
|
||||
@@ -10,19 +10,21 @@ const MessageComponentInteraction = require('./MessageComponentInteraction');
|
||||
class RoleSelectMenuInteraction extends MessageComponentInteraction {
|
||||
constructor(client, data) {
|
||||
super(client, data);
|
||||
const { resolved, values } = data.data;
|
||||
|
||||
/**
|
||||
* An array of the selected role ids
|
||||
* @type {Snowflake[]}
|
||||
*/
|
||||
this.values = data.data.values ?? [];
|
||||
this.values = values ?? [];
|
||||
|
||||
/**
|
||||
* Collection of the selected roles
|
||||
* @type {Collection<Snowflake, Role|APIRole>}
|
||||
*/
|
||||
this.roles = new Collection();
|
||||
for (const role of Object.values(data.data.resolved.roles)) {
|
||||
|
||||
for (const role of Object.values(resolved?.roles ?? {})) {
|
||||
this.roles.set(role.id, this.guild?.roles._add(role) ?? role);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,12 +11,13 @@ const Events = require('../util/Events');
|
||||
class UserSelectMenuInteraction extends MessageComponentInteraction {
|
||||
constructor(client, data) {
|
||||
super(client, data);
|
||||
const { resolved, values } = data.data;
|
||||
|
||||
/**
|
||||
* An array of the selected user ids
|
||||
* @type {Snowflake[]}
|
||||
*/
|
||||
this.values = data.data.values ?? [];
|
||||
this.values = values ?? [];
|
||||
|
||||
/**
|
||||
* Collection of the selected users
|
||||
@@ -30,24 +31,19 @@ class UserSelectMenuInteraction extends MessageComponentInteraction {
|
||||
*/
|
||||
this.members = new Collection();
|
||||
|
||||
for (const user of Object.values(data.data.resolved.users)) {
|
||||
for (const user of Object.values(resolved?.users ?? {})) {
|
||||
this.users.set(user.id, this.client.users._add(user));
|
||||
}
|
||||
|
||||
if (data.data.resolved.members) {
|
||||
for (const [id, member] of Object.entries(data.data.resolved.members)) {
|
||||
const user = data.data.resolved.users[id];
|
||||
if (!user) {
|
||||
this.client.emit(
|
||||
Events.Debug,
|
||||
`[UserSelectMenuInteraction] Received a member without a user, skipping ${id}`,
|
||||
);
|
||||
for (const [id, member] of Object.entries(resolved?.members ?? {})) {
|
||||
const user = resolved.users[id];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
this.members.set(id, this.guild?.members._add({ user, ...member }) ?? { user, ...member });
|
||||
if (!user) {
|
||||
this.client.emit(Events.Debug, `[UserSelectMenuInteraction] Received a member without a user, skipping ${id}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
this.members.set(id, this.guild?.members._add({ user, ...member }) ?? { user, ...member });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@
|
||||
},
|
||||
"homepage": "https://discord.js.org",
|
||||
"dependencies": {
|
||||
"@discordjs/proxy": "^1.2.0",
|
||||
"@discordjs/rest": "^1.3.0",
|
||||
"@discordjs/proxy": "^1.2.1",
|
||||
"@discordjs/rest": "^1.4.0",
|
||||
"tslib": "^2.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -58,12 +58,19 @@ export async function createPackage(packageName: string, packageDescription?: st
|
||||
const labelsYAML = parseYAML(await readFile('labels.yml', 'utf8')) as LabelerData[];
|
||||
labelsYAML.push({ name: `packages:${packageName}`, color: 'fbca04' });
|
||||
|
||||
labelsYAML.sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
await writeFile('labels.yml', stringifyYAML(labelsYAML));
|
||||
|
||||
const labelerYAML = parseYAML(await readFile('labeler.yml', 'utf8')) as Record<string, string[]>;
|
||||
labelerYAML[`packages/${packageName}`] = [`packages:${packageName}/*`, `packages:${packageName}/**/*`];
|
||||
labelerYAML[`packages:${packageName}`] = [`packages/${packageName}/*`, `packages/${packageName}/**/*`];
|
||||
|
||||
await writeFile('labeler.yml', stringifyYAML(labelerYAML));
|
||||
const sortedLabelerYAML: Record<string, string[]> = {};
|
||||
for (const key of Object.keys(labelerYAML).sort((a, b) => a.localeCompare(b))) {
|
||||
sortedLabelerYAML[key] = labelerYAML[key]!;
|
||||
}
|
||||
|
||||
await writeFile('labeler.yml', stringifyYAML(sortedLabelerYAML));
|
||||
|
||||
// Move back to root
|
||||
chdir('..');
|
||||
|
||||
@@ -28,7 +28,7 @@ export interface MemberJSON {
|
||||
summary: string | null;
|
||||
}
|
||||
|
||||
export const PACKAGES = ['builders', 'collection', 'core', 'proxy', 'rest', 'util', 'voice', 'ws'];
|
||||
export const PACKAGES = ['brokers', 'builders', 'collection', 'core', 'proxy', 'rest', 'util', 'voice', 'ws'];
|
||||
let idx = 0;
|
||||
|
||||
export function createApiModel(data: any) {
|
||||
|
||||
@@ -2,6 +2,17 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
# [@discordjs/voice@0.14.0](https://github.com/discordjs/discord.js/compare/@discordjs/voice@0.13.0...@discordjs/voice@0.14.0) - (2022-11-28)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Voice postbuild script (#8741) ([5ffabb1](https://github.com/discordjs/discord.js/commit/5ffabb119fa3a35266ab31545a4a4b9a049eacce))
|
||||
- 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))
|
||||
|
||||
# [@discordjs/voice@0.13.0](https://github.com/discordjs/discord.js/compare/@discordjs/voice@0.11.0...@discordjs/voice@0.13.0) - (2022-10-08)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@discordjs/voice",
|
||||
"version": "0.13.0",
|
||||
"version": "0.14.0",
|
||||
"description": "Implementation of the Discord Voice API for node.js",
|
||||
"scripts": {
|
||||
"build": "tsup && node scripts/postbuild.mjs",
|
||||
|
||||
@@ -2,6 +2,20 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
# [@discordjs/ws@0.5.0](https://github.com/discordjs/discord.js/compare/@discordjs/ws@0.4.1...@discordjs/ws@0.5.0) - (2022-11-28)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Pin @types/node version ([9d8179c](https://github.com/discordjs/discord.js/commit/9d8179c6a78e1c7f9976f852804055964d5385d4))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Remove unused imports (#8744) ([179392d](https://github.com/discordjs/discord.js/commit/179392d6d7d634c6d10f6abb20c072516c1c1d43))
|
||||
|
||||
## Features
|
||||
|
||||
- New select menus (#8793) ([5152abf](https://github.com/discordjs/discord.js/commit/5152abf7285581abf7689e9050fdc56c4abb1e2b))
|
||||
|
||||
# [@discordjs/ws@0.4.1](https://github.com/discordjs/discord.js/compare/@discordjs/ws@0.4.0...@discordjs/ws@0.4.1) - (2022-10-10)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@discordjs/ws",
|
||||
"version": "0.4.1",
|
||||
"version": "0.5.0",
|
||||
"description": "Wrapper around Discord's gateway",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
|
||||
Reference in New Issue
Block a user