Skip to content

Commit

Permalink
Merge branch 'main' into fix/options-required
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] committed May 5, 2023
2 parents 81ac0c3 + 166c961 commit 3a6265c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 22 deletions.
39 changes: 22 additions & 17 deletions apps/guide/src/components/DocsLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface DocsLinkOptions {
*
* @example `'Client'`
*/
parent: string;
parent?: string;
/**
* Whether to reference a static property.
*
Expand All @@ -40,7 +40,7 @@ interface DocsLinkOptions {
* @example `'class'`
* @example `'Function'`
*/
type: string;
type?: string;
}

export function DocsLink({
Expand All @@ -51,23 +51,28 @@ export function DocsLink({
brackets,
static: staticReference,
}: DocsLinkOptions) {
const bracketText = brackets || type.toUpperCase() === 'FUNCTION' ? '()' : '';
const trimmedSymbol = symbol;
let url;
let text;
// In the case of no type and no parent, this will default to the entry point of the respective documentation.
let url = docs === PACKAGES[0] ? `${BASE_URL_LEGACY}/${VERSION}/general/welcome` : `${BASE_URL}/${docs}/stable`;
let text = `${docs === PACKAGES[0] ? '' : '@discordjs/'}${docs}`;

if (docs === PACKAGES[0]) {
url = `${BASE_URL_LEGACY}/${VERSION}/${type}/${parent}`;
if (trimmedSymbol) url += `?scrollTo=${trimmedSymbol}`;
// If there is a type and parent, we need to do some parsing.
if (type && parent) {
const bracketText = brackets || type?.toUpperCase() === 'FUNCTION' ? '()' : '';

text = `${parent}${trimmedSymbol ? (trimmedSymbol.startsWith('s-') ? '.' : '#') : ''}${
// eslint-disable-next-line prefer-named-capture-group
trimmedSymbol ? `${trimmedSymbol.replace(/(e|s)-/, '')}` : ''
}${bracketText}`;
} else {
url = `${BASE_URL}/${docs}/stable/${parent}:${type}`;
if (trimmedSymbol) url += `#${trimmedSymbol}`;
text = `${parent}${trimmedSymbol ? `${staticReference ? '.' : '#'}${trimmedSymbol}` : ''}${bracketText}`;
// Legacy discord.js documentation parsing.
if (docs === PACKAGES[0]) {
url = `${BASE_URL_LEGACY}/${VERSION}/${type}/${parent}`;
if (symbol) url += `?scrollTo=${symbol}`;

text = `${parent}${symbol ? (symbol.startsWith('s-') ? '.' : '#') : ''}${
// eslint-disable-next-line prefer-named-capture-group
symbol ? `${symbol.replace(/(e|s)-/, '')}` : ''
}${bracketText}`;
} else {
url += `/${parent}:${type}`;
if (symbol) url += `#${symbol}`;
text = `${parent}${symbol ? `${staticReference ? '.' : '#'}${symbol}` : ''}${bracketText}`;
}
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ The base interaction class is now <DocsLink type="class" parent="BaseInteraction

### MessageManager

The second parameter of <DocsLink type="class" parent="MessageManager" symbol="fetch" brackets /> has been removed. The <DocsLink type="class" parent="BaseFetchOptions" /> the second parameter once was is now merged into the first parameter.
The second parameter of <DocsLink type="class" parent="MessageManager" symbol="fetch" brackets /> has been removed. The <DocsLink type="typedef" parent="BaseFetchOptions" /> the second parameter once was is now merged into the first parameter.

<CH.Code>

Expand Down Expand Up @@ -807,7 +807,7 @@ Added the _`threadName`_ property in <DocsLink type="typedef" parent="WebhookMes

### WebSocketManager

discord.js uses <PackageLink name="ws" /> internally.
discord.js uses <DocsLink package="ws" /> internally.

[^1]: https://github.com/discordjs/discord.js/pull/7188
[^2]: https://github.com/discordjs/discord.js/pull/6492
Expand Down
2 changes: 1 addition & 1 deletion apps/guide/src/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ export const PACKAGES = [
/**
* The stable version of discord.js.
*/
export const VERSION = '14.10.0' as const;
export const VERSION = '14.10.2' as const;
4 changes: 2 additions & 2 deletions packages/core/src/api/roleConnections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Routes,
type RESTGetAPIApplicationRoleConnectionMetadataResult,
type RESTPutAPIApplicationRoleConnectionMetadataResult,
type RESTPutAPIApplicationCommandPermissionsJSONBody,
type RESTPutAPIApplicationRoleConnectionMetadataJSONBody,
type Snowflake,
} from 'discord-api-types/v10';

Expand Down Expand Up @@ -35,7 +35,7 @@ export class RoleConnectionsAPI {
*/
public async updateMetadataRecords(
applicationId: Snowflake,
body: RESTPutAPIApplicationCommandPermissionsJSONBody,
body: RESTPutAPIApplicationRoleConnectionMetadataJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {},
) {
return this.rest.put(Routes.applicationRoleConnectionMetadata(applicationId), {
Expand Down

0 comments on commit 3a6265c

Please sign in to comment.