mirror of
https://github.com/discordjs/discord.js.git
synced 2024-08-21 17:54:44 +12:00
Merge branch 'main' into chore/label-enhancements
This commit is contained in:
commit
a055170a57
37 changed files with 2303 additions and 350 deletions
|
@ -5,7 +5,7 @@
|
||||||
"type-enum": [
|
"type-enum": [
|
||||||
2,
|
2,
|
||||||
"always",
|
"always",
|
||||||
["chore", "build", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test", "types", "typings"]
|
["chore", "build", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test", "types"]
|
||||||
],
|
],
|
||||||
"scope-case": [0]
|
"scope-case": [0]
|
||||||
}
|
}
|
||||||
|
|
2
.github/COMMIT_CONVENTION.md
vendored
2
.github/COMMIT_CONVENTION.md
vendored
|
@ -7,7 +7,7 @@
|
||||||
Messages must be matched by the following regex:
|
Messages must be matched by the following regex:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|types|wip)(\(.+\))?: .{1,72}/;
|
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|build|ci|chore|types)(\(.+\))?: .{1,72}/;
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
5
.github/workflows/pr-triage.yml
vendored
5
.github/workflows/pr-triage.yml
vendored
|
@ -23,9 +23,10 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Validate pull request title
|
- name: Validate pull request title
|
||||||
|
env:
|
||||||
|
TITLE: ${{ github.event.pull_request.title }}
|
||||||
run: |
|
run: |
|
||||||
TITLE="${{ github.event.pull_request.title }}"
|
REGEX="^(revert: )?(feat|fix|docs|style|refactor|perf|test|build|ci|chore|types)(\\(.+\\))?: .{1,72}$"
|
||||||
REGEX="^(revert: )?(feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|types|wip)(\\(.+\\))?: .{1,72}$"
|
|
||||||
|
|
||||||
echo "Title: \"$TITLE\""
|
echo "Title: \"$TITLE\""
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ export async function DocNode({ node, version }: { readonly node?: any; readonly
|
||||||
rel="external noreferrer noopener"
|
rel="external noreferrer noopener"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
{`${node.text}${node.members}`}
|
{`${node.text}${node.members ?? ''}`}
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,6 +115,7 @@ export class ModelReferenceResolver {
|
||||||
if (memberSelector === undefined) {
|
if (memberSelector === undefined) {
|
||||||
if (foundMembers.length > 1) {
|
if (foundMembers.length > 1) {
|
||||||
const foundClass: ApiItem | undefined = foundMembers.find((member) => member.kind === ApiItemKind.Class);
|
const foundClass: ApiItem | undefined = foundMembers.find((member) => member.kind === ApiItemKind.Class);
|
||||||
|
const foundEvent: ApiItem | undefined = foundMembers.find((member) => member.kind === ApiItemKind.Event);
|
||||||
if (
|
if (
|
||||||
foundClass &&
|
foundClass &&
|
||||||
foundMembers.filter((member) => member.kind === ApiItemKind.Interface).length === foundMembers.length - 1
|
foundMembers.filter((member) => member.kind === ApiItemKind.Interface).length === foundMembers.length - 1
|
||||||
|
@ -124,6 +125,11 @@ export class ModelReferenceResolver {
|
||||||
foundMembers.every((member) => member.kind === ApiItemKind.Method && (member as ApiMethod).overloadIndex)
|
foundMembers.every((member) => member.kind === ApiItemKind.Method && (member as ApiMethod).overloadIndex)
|
||||||
) {
|
) {
|
||||||
currentItem = foundMembers.find((member) => (member as ApiMethod).overloadIndex === 1)!;
|
currentItem = foundMembers.find((member) => (member as ApiMethod).overloadIndex === 1)!;
|
||||||
|
} else if (
|
||||||
|
foundEvent &&
|
||||||
|
foundMembers.filter((member) => member.kind === ApiItemKind.Method).length === foundMembers.length - 1
|
||||||
|
) {
|
||||||
|
currentItem = foundEvent;
|
||||||
} else {
|
} else {
|
||||||
result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`;
|
result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`;
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { PermissionFlagsBits } from 'discord-api-types/v10';
|
import { ApplicationIntegrationType, InteractionContextType, PermissionFlagsBits } from 'discord-api-types/v10';
|
||||||
import { describe, test, expect } from 'vitest';
|
import { describe, test, expect } from 'vitest';
|
||||||
import { ContextMenuCommandAssertions, ContextMenuCommandBuilder } from '../../src/index.js';
|
import { ContextMenuCommandAssertions, ContextMenuCommandBuilder } from '../../src/index.js';
|
||||||
|
|
||||||
|
@ -144,5 +144,51 @@ describe('Context Menu Commands', () => {
|
||||||
expect(() => getBuilder().setDefaultMemberPermissions(1.1)).toThrowError();
|
expect(() => getBuilder().setDefaultMemberPermissions(1.1)).toThrowError();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('contexts', () => {
|
||||||
|
test('GIVEN a builder with valid contexts THEN does not throw an error', () => {
|
||||||
|
expect(() =>
|
||||||
|
getBuilder().setContexts([InteractionContextType.Guild, InteractionContextType.BotDM]),
|
||||||
|
).not.toThrowError();
|
||||||
|
|
||||||
|
expect(() =>
|
||||||
|
getBuilder().setContexts(InteractionContextType.Guild, InteractionContextType.BotDM),
|
||||||
|
).not.toThrowError();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('GIVEN a builder with invalid contexts THEN does throw an error', () => {
|
||||||
|
// @ts-expect-error: Invalid contexts
|
||||||
|
expect(() => getBuilder().setContexts(999)).toThrowError();
|
||||||
|
|
||||||
|
// @ts-expect-error: Invalid contexts
|
||||||
|
expect(() => getBuilder().setContexts([999, 998])).toThrowError();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('integration types', () => {
|
||||||
|
test('GIVEN a builder with valid integraton types THEN does not throw an error', () => {
|
||||||
|
expect(() =>
|
||||||
|
getBuilder().setIntegrationTypes([
|
||||||
|
ApplicationIntegrationType.GuildInstall,
|
||||||
|
ApplicationIntegrationType.UserInstall,
|
||||||
|
]),
|
||||||
|
).not.toThrowError();
|
||||||
|
|
||||||
|
expect(() =>
|
||||||
|
getBuilder().setIntegrationTypes(
|
||||||
|
ApplicationIntegrationType.GuildInstall,
|
||||||
|
ApplicationIntegrationType.UserInstall,
|
||||||
|
),
|
||||||
|
).not.toThrowError();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('GIVEN a builder with invalid integration types THEN does throw an error', () => {
|
||||||
|
// @ts-expect-error: Invalid integration types
|
||||||
|
expect(() => getBuilder().setIntegrationTypes(999)).toThrowError();
|
||||||
|
|
||||||
|
// @ts-expect-error: Invalid integration types
|
||||||
|
expect(() => getBuilder().setIntegrationTypes([999, 998])).toThrowError();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
import { ChannelType, PermissionFlagsBits, type APIApplicationCommandOptionChoice } from 'discord-api-types/v10';
|
import {
|
||||||
|
ApplicationIntegrationType,
|
||||||
|
ChannelType,
|
||||||
|
InteractionContextType,
|
||||||
|
PermissionFlagsBits,
|
||||||
|
type APIApplicationCommandOptionChoice,
|
||||||
|
} from 'discord-api-types/v10';
|
||||||
import { describe, test, expect } from 'vitest';
|
import { describe, test, expect } from 'vitest';
|
||||||
import {
|
import {
|
||||||
SlashCommandAssertions,
|
SlashCommandAssertions,
|
||||||
|
@ -532,5 +538,51 @@ describe('Slash Commands', () => {
|
||||||
expect(() => getBuilder().addChannelOption(getChannelOption()).setDMPermission(false)).not.toThrowError();
|
expect(() => getBuilder().addChannelOption(getChannelOption()).setDMPermission(false)).not.toThrowError();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('contexts', () => {
|
||||||
|
test('GIVEN a builder with valid contexts THEN does not throw an error', () => {
|
||||||
|
expect(() =>
|
||||||
|
getBuilder().setContexts([InteractionContextType.Guild, InteractionContextType.BotDM]),
|
||||||
|
).not.toThrowError();
|
||||||
|
|
||||||
|
expect(() =>
|
||||||
|
getBuilder().setContexts(InteractionContextType.Guild, InteractionContextType.BotDM),
|
||||||
|
).not.toThrowError();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('GIVEN a builder with invalid contexts THEN does throw an error', () => {
|
||||||
|
// @ts-expect-error: Invalid contexts
|
||||||
|
expect(() => getBuilder().setContexts(999)).toThrowError();
|
||||||
|
|
||||||
|
// @ts-expect-error: Invalid contexts
|
||||||
|
expect(() => getBuilder().setContexts([999, 998])).toThrowError();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('integration types', () => {
|
||||||
|
test('GIVEN a builder with valid integraton types THEN does not throw an error', () => {
|
||||||
|
expect(() =>
|
||||||
|
getBuilder().setIntegrationTypes([
|
||||||
|
ApplicationIntegrationType.GuildInstall,
|
||||||
|
ApplicationIntegrationType.UserInstall,
|
||||||
|
]),
|
||||||
|
).not.toThrowError();
|
||||||
|
|
||||||
|
expect(() =>
|
||||||
|
getBuilder().setIntegrationTypes(
|
||||||
|
ApplicationIntegrationType.GuildInstall,
|
||||||
|
ApplicationIntegrationType.UserInstall,
|
||||||
|
),
|
||||||
|
).not.toThrowError();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('GIVEN a builder with invalid integration types THEN does throw an error', () => {
|
||||||
|
// @ts-expect-error: Invalid integration types
|
||||||
|
expect(() => getBuilder().setIntegrationTypes(999)).toThrowError();
|
||||||
|
|
||||||
|
// @ts-expect-error: Invalid integration types
|
||||||
|
expect(() => getBuilder().setIntegrationTypes([999, 998])).toThrowError();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
"@discordjs/formatters": "workspace:^",
|
"@discordjs/formatters": "workspace:^",
|
||||||
"@discordjs/util": "workspace:^",
|
"@discordjs/util": "workspace:^",
|
||||||
"@sapphire/shapeshift": "^3.9.7",
|
"@sapphire/shapeshift": "^3.9.7",
|
||||||
"discord-api-types": "0.37.87",
|
"discord-api-types": "0.37.90",
|
||||||
"fast-deep-equal": "^3.1.3",
|
"fast-deep-equal": "^3.1.3",
|
||||||
"ts-mixer": "^6.0.4",
|
"ts-mixer": "^6.0.4",
|
||||||
"tslib": "^2.6.2"
|
"tslib": "^2.6.2"
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import {
|
import {
|
||||||
ComponentType,
|
ComponentType,
|
||||||
type APIMessageComponentEmoji,
|
|
||||||
type APIButtonComponent,
|
type APIButtonComponent,
|
||||||
type APIButtonComponentWithURL,
|
|
||||||
type APIButtonComponentWithCustomId,
|
type APIButtonComponentWithCustomId,
|
||||||
|
type APIButtonComponentWithSKUId,
|
||||||
|
type APIButtonComponentWithURL,
|
||||||
|
type APIMessageComponentEmoji,
|
||||||
type ButtonStyle,
|
type ButtonStyle,
|
||||||
} from 'discord-api-types/v10';
|
} from 'discord-api-types/v10';
|
||||||
import {
|
import {
|
||||||
|
@ -94,7 +95,7 @@ export class ButtonBuilder extends ComponentBuilder<APIButtonComponent> {
|
||||||
* @param emoji - The emoji to use
|
* @param emoji - The emoji to use
|
||||||
*/
|
*/
|
||||||
public setEmoji(emoji: APIMessageComponentEmoji) {
|
public setEmoji(emoji: APIMessageComponentEmoji) {
|
||||||
this.data.emoji = emojiValidator.parse(emoji);
|
(this.data as Exclude<APIButtonComponent, APIButtonComponentWithSKUId>).emoji = emojiValidator.parse(emoji);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +115,7 @@ export class ButtonBuilder extends ComponentBuilder<APIButtonComponent> {
|
||||||
* @param label - The label to use
|
* @param label - The label to use
|
||||||
*/
|
*/
|
||||||
public setLabel(label: string) {
|
public setLabel(label: string) {
|
||||||
this.data.label = buttonLabelValidator.parse(label);
|
(this.data as Exclude<APIButtonComponent, APIButtonComponentWithSKUId>).label = buttonLabelValidator.parse(label);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,8 +125,8 @@ export class ButtonBuilder extends ComponentBuilder<APIButtonComponent> {
|
||||||
public toJSON(): APIButtonComponent {
|
public toJSON(): APIButtonComponent {
|
||||||
validateRequiredButtonParameters(
|
validateRequiredButtonParameters(
|
||||||
this.data.style,
|
this.data.style,
|
||||||
this.data.label,
|
(this.data as Exclude<APIButtonComponent, APIButtonComponentWithSKUId>).label,
|
||||||
this.data.emoji,
|
(this.data as Exclude<APIButtonComponent, APIButtonComponentWithSKUId>).emoji,
|
||||||
(this.data as APIButtonComponentWithCustomId).custom_id,
|
(this.data as APIButtonComponentWithCustomId).custom_id,
|
||||||
(this.data as APIButtonComponentWithURL).url,
|
(this.data as APIButtonComponentWithURL).url,
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { s } from '@sapphire/shapeshift';
|
import { s } from '@sapphire/shapeshift';
|
||||||
import { ApplicationCommandType } from 'discord-api-types/v10';
|
import { ApplicationCommandType, ApplicationIntegrationType, InteractionContextType } from 'discord-api-types/v10';
|
||||||
import { isValidationEnabled } from '../../util/validation.js';
|
import { isValidationEnabled } from '../../util/validation.js';
|
||||||
import type { ContextMenuCommandType } from './ContextMenuCommandBuilder.js';
|
import type { ContextMenuCommandType } from './ContextMenuCommandBuilder.js';
|
||||||
|
|
||||||
|
@ -49,3 +49,11 @@ const memberPermissionPredicate = s.union(
|
||||||
export function validateDefaultMemberPermissions(permissions: unknown) {
|
export function validateDefaultMemberPermissions(permissions: unknown) {
|
||||||
return memberPermissionPredicate.parse(permissions);
|
return memberPermissionPredicate.parse(permissions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const contextsPredicate = s.array(
|
||||||
|
s.nativeEnum(InteractionContextType).setValidationEnabled(isValidationEnabled),
|
||||||
|
);
|
||||||
|
|
||||||
|
export const integrationTypesPredicate = s.array(
|
||||||
|
s.nativeEnum(ApplicationIntegrationType).setValidationEnabled(isValidationEnabled),
|
||||||
|
);
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
import type {
|
import type {
|
||||||
ApplicationCommandType,
|
ApplicationCommandType,
|
||||||
|
ApplicationIntegrationType,
|
||||||
|
InteractionContextType,
|
||||||
LocaleString,
|
LocaleString,
|
||||||
LocalizationMap,
|
LocalizationMap,
|
||||||
Permissions,
|
Permissions,
|
||||||
RESTPostAPIContextMenuApplicationCommandsJSONBody,
|
RESTPostAPIContextMenuApplicationCommandsJSONBody,
|
||||||
} from 'discord-api-types/v10';
|
} from 'discord-api-types/v10';
|
||||||
|
import type { RestOrArray } from '../../util/normalizeArray.js';
|
||||||
|
import { normalizeArray } from '../../util/normalizeArray.js';
|
||||||
import { validateLocale, validateLocalizationMap } from '../slashCommands/Assertions.js';
|
import { validateLocale, validateLocalizationMap } from '../slashCommands/Assertions.js';
|
||||||
import {
|
import {
|
||||||
validateRequiredParameters,
|
validateRequiredParameters,
|
||||||
|
@ -13,6 +17,8 @@ import {
|
||||||
validateDefaultPermission,
|
validateDefaultPermission,
|
||||||
validateDefaultMemberPermissions,
|
validateDefaultMemberPermissions,
|
||||||
validateDMPermission,
|
validateDMPermission,
|
||||||
|
contextsPredicate,
|
||||||
|
integrationTypesPredicate,
|
||||||
} from './Assertions.js';
|
} from './Assertions.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,6 +45,11 @@ export class ContextMenuCommandBuilder {
|
||||||
*/
|
*/
|
||||||
public readonly type: ContextMenuCommandType = undefined!;
|
public readonly type: ContextMenuCommandType = undefined!;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The contexts for this command.
|
||||||
|
*/
|
||||||
|
public readonly contexts?: InteractionContextType[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether this command is enabled by default when the application is added to a guild.
|
* Whether this command is enabled by default when the application is added to a guild.
|
||||||
*
|
*
|
||||||
|
@ -59,6 +70,33 @@ export class ContextMenuCommandBuilder {
|
||||||
*/
|
*/
|
||||||
public readonly dm_permission: boolean | undefined = undefined;
|
public readonly dm_permission: boolean | undefined = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The integration types for this command.
|
||||||
|
*/
|
||||||
|
public readonly integration_types?: ApplicationIntegrationType[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the contexts of this command.
|
||||||
|
*
|
||||||
|
* @param contexts - The contexts
|
||||||
|
*/
|
||||||
|
public setContexts(...contexts: RestOrArray<InteractionContextType>) {
|
||||||
|
Reflect.set(this, 'contexts', contextsPredicate.parse(normalizeArray(contexts)));
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets integration types of this command.
|
||||||
|
*
|
||||||
|
* @param integrationTypes - The integration types
|
||||||
|
*/
|
||||||
|
public setIntegrationTypes(...integrationTypes: RestOrArray<ApplicationIntegrationType>) {
|
||||||
|
Reflect.set(this, 'integration_types', integrationTypesPredicate.parse(normalizeArray(integrationTypes)));
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the name of this command.
|
* Sets the name of this command.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
import { s } from '@sapphire/shapeshift';
|
import { s } from '@sapphire/shapeshift';
|
||||||
import { Locale, type APIApplicationCommandOptionChoice, type LocalizationMap } from 'discord-api-types/v10';
|
import {
|
||||||
|
ApplicationIntegrationType,
|
||||||
|
InteractionContextType,
|
||||||
|
Locale,
|
||||||
|
type APIApplicationCommandOptionChoice,
|
||||||
|
type LocalizationMap,
|
||||||
|
} from 'discord-api-types/v10';
|
||||||
import { isValidationEnabled } from '../../util/validation.js';
|
import { isValidationEnabled } from '../../util/validation.js';
|
||||||
import type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder.js';
|
import type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder.js';
|
||||||
import type { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands.js';
|
import type { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands.js';
|
||||||
|
@ -98,3 +104,11 @@ export function validateDefaultMemberPermissions(permissions: unknown) {
|
||||||
export function validateNSFW(value: unknown): asserts value is boolean {
|
export function validateNSFW(value: unknown): asserts value is boolean {
|
||||||
booleanPredicate.parse(value);
|
booleanPredicate.parse(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const contextsPredicate = s.array(
|
||||||
|
s.nativeEnum(InteractionContextType).setValidationEnabled(isValidationEnabled),
|
||||||
|
);
|
||||||
|
|
||||||
|
export const integrationTypesPredicate = s.array(
|
||||||
|
s.nativeEnum(ApplicationIntegrationType).setValidationEnabled(isValidationEnabled),
|
||||||
|
);
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
import type { APIApplicationCommandOption, LocalizationMap, Permissions } from 'discord-api-types/v10';
|
import type {
|
||||||
|
APIApplicationCommandOption,
|
||||||
|
ApplicationIntegrationType,
|
||||||
|
InteractionContextType,
|
||||||
|
LocalizationMap,
|
||||||
|
Permissions,
|
||||||
|
} from 'discord-api-types/v10';
|
||||||
import { mix } from 'ts-mixer';
|
import { mix } from 'ts-mixer';
|
||||||
import { SharedNameAndDescription } from './mixins/NameAndDescription.js';
|
import { SharedNameAndDescription } from './mixins/NameAndDescription.js';
|
||||||
import { SharedSlashCommand } from './mixins/SharedSlashCommand.js';
|
import { SharedSlashCommand } from './mixins/SharedSlashCommand.js';
|
||||||
|
@ -35,6 +41,11 @@ export class SlashCommandBuilder {
|
||||||
*/
|
*/
|
||||||
public readonly options: ToAPIApplicationCommandOptions[] = [];
|
public readonly options: ToAPIApplicationCommandOptions[] = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The contexts for this command.
|
||||||
|
*/
|
||||||
|
public readonly contexts?: InteractionContextType[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether this command is enabled by default when the application is added to a guild.
|
* Whether this command is enabled by default when the application is added to a guild.
|
||||||
*
|
*
|
||||||
|
@ -55,6 +66,11 @@ export class SlashCommandBuilder {
|
||||||
*/
|
*/
|
||||||
public readonly dm_permission: boolean | undefined = undefined;
|
public readonly dm_permission: boolean | undefined = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The integration types for this command.
|
||||||
|
*/
|
||||||
|
public readonly integration_types?: ApplicationIntegrationType[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether this command is NSFW.
|
* Whether this command is NSFW.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
import type {
|
import type {
|
||||||
|
ApplicationIntegrationType,
|
||||||
|
InteractionContextType,
|
||||||
LocalizationMap,
|
LocalizationMap,
|
||||||
Permissions,
|
Permissions,
|
||||||
RESTPostAPIChatInputApplicationCommandsJSONBody,
|
RESTPostAPIChatInputApplicationCommandsJSONBody,
|
||||||
} from 'discord-api-types/v10';
|
} from 'discord-api-types/v10';
|
||||||
|
import type { RestOrArray } from '../../../util/normalizeArray.js';
|
||||||
|
import { normalizeArray } from '../../../util/normalizeArray.js';
|
||||||
import {
|
import {
|
||||||
|
contextsPredicate,
|
||||||
|
integrationTypesPredicate,
|
||||||
validateDMPermission,
|
validateDMPermission,
|
||||||
validateDefaultMemberPermissions,
|
validateDefaultMemberPermissions,
|
||||||
validateDefaultPermission,
|
validateDefaultPermission,
|
||||||
|
@ -27,6 +33,8 @@ export class SharedSlashCommand {
|
||||||
|
|
||||||
public readonly options: ToAPIApplicationCommandOptions[] = [];
|
public readonly options: ToAPIApplicationCommandOptions[] = [];
|
||||||
|
|
||||||
|
public readonly contexts?: InteractionContextType[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link SharedSlashCommand.setDefaultMemberPermissions} or {@link SharedSlashCommand.setDMPermission} instead.
|
* @deprecated Use {@link SharedSlashCommand.setDefaultMemberPermissions} or {@link SharedSlashCommand.setDMPermission} instead.
|
||||||
*/
|
*/
|
||||||
|
@ -36,8 +44,32 @@ export class SharedSlashCommand {
|
||||||
|
|
||||||
public readonly dm_permission: boolean | undefined = undefined;
|
public readonly dm_permission: boolean | undefined = undefined;
|
||||||
|
|
||||||
|
public readonly integration_types?: ApplicationIntegrationType[];
|
||||||
|
|
||||||
public readonly nsfw: boolean | undefined = undefined;
|
public readonly nsfw: boolean | undefined = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the contexts of this command.
|
||||||
|
*
|
||||||
|
* @param contexts - The contexts
|
||||||
|
*/
|
||||||
|
public setContexts(...contexts: RestOrArray<InteractionContextType>) {
|
||||||
|
Reflect.set(this, 'contexts', contextsPredicate.parse(normalizeArray(contexts)));
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the integration types of this command.
|
||||||
|
*
|
||||||
|
* @param integrationTypes - The integration types
|
||||||
|
*/
|
||||||
|
public setIntegrationTypes(...integrationTypes: RestOrArray<ApplicationIntegrationType>) {
|
||||||
|
Reflect.set(this, 'integration_types', integrationTypesPredicate.parse(normalizeArray(integrationTypes)));
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the command is enabled by default when the application is added to a guild.
|
* Sets whether the command is enabled by default when the application is added to a guild.
|
||||||
*
|
*
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
"@discordjs/ws": "workspace:^",
|
"@discordjs/ws": "workspace:^",
|
||||||
"@sapphire/snowflake": "^3.5.3",
|
"@sapphire/snowflake": "^3.5.3",
|
||||||
"@vladfrangu/async_event_emitter": "^2.2.4",
|
"@vladfrangu/async_event_emitter": "^2.2.4",
|
||||||
"discord-api-types": "0.37.87"
|
"discord-api-types": "0.37.90"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@discordjs/api-extractor": "workspace:^",
|
"@discordjs/api-extractor": "workspace:^",
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
"@discordjs/util": "workspace:^",
|
"@discordjs/util": "workspace:^",
|
||||||
"@discordjs/ws": "workspace:^",
|
"@discordjs/ws": "workspace:^",
|
||||||
"@sapphire/snowflake": "3.5.3",
|
"@sapphire/snowflake": "3.5.3",
|
||||||
"discord-api-types": "0.37.87",
|
"discord-api-types": "0.37.90",
|
||||||
"fast-deep-equal": "3.1.3",
|
"fast-deep-equal": "3.1.3",
|
||||||
"lodash.snakecase": "4.1.1",
|
"lodash.snakecase": "4.1.1",
|
||||||
"tslib": "2.6.2",
|
"tslib": "2.6.2",
|
||||||
|
|
|
@ -117,14 +117,14 @@ class WebSocketManager extends EventEmitter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emits a debug message.
|
* Emits a debug message.
|
||||||
* @param {string} message The debug message
|
* @param {string[]} messages The debug message
|
||||||
* @param {?number} [shardId] The id of the shard that emitted this message, if any
|
* @param {?number} [shardId] The id of the shard that emitted this message, if any
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
debug(message, shardId) {
|
debug(messages, shardId) {
|
||||||
this.client.emit(
|
this.client.emit(
|
||||||
Events.Debug,
|
Events.Debug,
|
||||||
`[WS => ${typeof shardId === 'number' ? `Shard ${shardId}` : 'Manager'}] ${message}`,
|
`[WS => ${typeof shardId === 'number' ? `Shard ${shardId}` : 'Manager'}] ${messages.join('\n\t')}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,15 +170,8 @@ class WebSocketManager extends EventEmitter {
|
||||||
});
|
});
|
||||||
|
|
||||||
const { total, remaining } = sessionStartLimit;
|
const { total, remaining } = sessionStartLimit;
|
||||||
|
this.debug(['Fetched Gateway Information', `URL: ${gatewayURL}`, `Recommended Shards: ${recommendedShards}`]);
|
||||||
this.debug(`Fetched Gateway Information
|
this.debug(['Session Limit Information', `Total: ${total}`, `Remaining: ${remaining}`]);
|
||||||
URL: ${gatewayURL}
|
|
||||||
Recommended Shards: ${recommendedShards}`);
|
|
||||||
|
|
||||||
this.debug(`Session Limit Information
|
|
||||||
Total: ${total}
|
|
||||||
Remaining: ${remaining}`);
|
|
||||||
|
|
||||||
this.gateway = `${gatewayURL}/`;
|
this.gateway = `${gatewayURL}/`;
|
||||||
|
|
||||||
this.client.options.shardCount = await this._ws.getShardCount();
|
this.client.options.shardCount = await this._ws.getShardCount();
|
||||||
|
@ -231,7 +224,7 @@ class WebSocketManager extends EventEmitter {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
attachEvents() {
|
attachEvents() {
|
||||||
this._ws.on(WSWebSocketShardEvents.Debug, ({ message, shardId }) => this.debug(message, shardId));
|
this._ws.on(WSWebSocketShardEvents.Debug, ({ message, shardId }) => this.debug([message], shardId));
|
||||||
this._ws.on(WSWebSocketShardEvents.Dispatch, ({ data, shardId }) => {
|
this._ws.on(WSWebSocketShardEvents.Dispatch, ({ data, shardId }) => {
|
||||||
this.client.emit(Events.Raw, data, shardId);
|
this.client.emit(Events.Raw, data, shardId);
|
||||||
this.emit(data.t, data.d, shardId);
|
this.emit(data.t, data.d, shardId);
|
||||||
|
@ -258,7 +251,7 @@ class WebSocketManager extends EventEmitter {
|
||||||
* @param {number} id The shard id that disconnected
|
* @param {number} id The shard id that disconnected
|
||||||
*/
|
*/
|
||||||
this.client.emit(Events.ShardDisconnect, { code, reason: reasonIsDeprecated, wasClean: true }, shardId);
|
this.client.emit(Events.ShardDisconnect, { code, reason: reasonIsDeprecated, wasClean: true }, shardId);
|
||||||
this.debug(`Shard not resumable: ${code} (${GatewayCloseCodes[code] ?? CloseCodes[code]})`, shardId);
|
this.debug([`Shard not resumable: ${code} (${GatewayCloseCodes[code] ?? CloseCodes[code]})`], shardId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +284,7 @@ class WebSocketManager extends EventEmitter {
|
||||||
});
|
});
|
||||||
|
|
||||||
this._ws.on(WSWebSocketShardEvents.HeartbeatComplete, ({ heartbeatAt, latency, shardId }) => {
|
this._ws.on(WSWebSocketShardEvents.HeartbeatComplete, ({ heartbeatAt, latency, shardId }) => {
|
||||||
this.debug(`Heartbeat acknowledged, latency of ${latency}ms.`, shardId);
|
this.debug([`Heartbeat acknowledged, latency of ${latency}ms.`], shardId);
|
||||||
const shard = this.shards.get(shardId);
|
const shard = this.shards.get(shardId);
|
||||||
shard.lastPingTimestamp = heartbeatAt;
|
shard.lastPingTimestamp = heartbeatAt;
|
||||||
shard.ping = latency;
|
shard.ping = latency;
|
||||||
|
@ -324,7 +317,7 @@ class WebSocketManager extends EventEmitter {
|
||||||
async destroy() {
|
async destroy() {
|
||||||
if (this.destroyed) return;
|
if (this.destroyed) return;
|
||||||
// TODO: Make a util for getting a stack
|
// TODO: Make a util for getting a stack
|
||||||
this.debug(Object.assign(new Error(), { name: 'Manager was destroyed:' }).stack);
|
this.debug([Object.assign(new Error(), { name: 'Manager was destroyed:' }).stack]);
|
||||||
this.destroyed = true;
|
this.destroyed = true;
|
||||||
await this._ws?.destroy({ code: CloseCodes.Normal, reason: 'Manager was destroyed' });
|
await this._ws?.destroy({ code: CloseCodes.Normal, reason: 'Manager was destroyed' });
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,11 +85,11 @@ class WebSocketShard extends EventEmitter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emits a debug event.
|
* Emits a debug event.
|
||||||
* @param {string} message The debug message
|
* @param {string[]} messages The debug message
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
debug(message) {
|
debug(messages) {
|
||||||
this.manager.debug(message, this.id);
|
this.manager.debug(messages, this.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,10 +110,13 @@ class WebSocketShard extends EventEmitter {
|
||||||
wasClean: false,
|
wasClean: false,
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
this.debug(`[CLOSE]
|
this.debug([
|
||||||
Event Code: ${event.code}
|
'[CLOSE]',
|
||||||
Clean : ${event.wasClean}
|
`Event Code: ${event.code}`,
|
||||||
Reason : ${event.reason ?? 'No reason received'}`);
|
`Clean : ${event.wasClean}`,
|
||||||
|
`Reason : ${event.reason ?? 'No reason received'}`,
|
||||||
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted when a shard's WebSocket closes.
|
* Emitted when a shard's WebSocket closes.
|
||||||
* @private
|
* @private
|
||||||
|
@ -130,7 +133,7 @@ class WebSocketShard extends EventEmitter {
|
||||||
*/
|
*/
|
||||||
onReadyPacket(packet) {
|
onReadyPacket(packet) {
|
||||||
if (!packet) {
|
if (!packet) {
|
||||||
this.debug(`Received broken packet: '${packet}'.`);
|
this.debug([`Received broken packet: '${packet}'.`]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +170,7 @@ class WebSocketShard extends EventEmitter {
|
||||||
}
|
}
|
||||||
// Step 1. If we don't have any other guilds pending, we are ready
|
// Step 1. If we don't have any other guilds pending, we are ready
|
||||||
if (!this.expectedGuilds.size) {
|
if (!this.expectedGuilds.size) {
|
||||||
this.debug('Shard received all its guilds. Marking as fully ready.');
|
this.debug(['Shard received all its guilds. Marking as fully ready.']);
|
||||||
this.status = Status.Ready;
|
this.status = Status.Ready;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -191,12 +194,12 @@ class WebSocketShard extends EventEmitter {
|
||||||
|
|
||||||
this.readyTimeout = setTimeout(
|
this.readyTimeout = setTimeout(
|
||||||
() => {
|
() => {
|
||||||
this.debug(
|
this.debug([
|
||||||
`Shard ${hasGuildsIntent ? 'did' : 'will'} not receive any more guild packets` +
|
hasGuildsIntent
|
||||||
`${hasGuildsIntent ? ` in ${waitGuildTimeout} ms` : ''}.\nUnavailable guild count: ${
|
? `Shard did not receive any guild packets in ${waitGuildTimeout} ms.`
|
||||||
this.expectedGuilds.size
|
: 'Shard will not receive anymore guild packets.',
|
||||||
}`,
|
`Unavailable guild count: ${this.expectedGuilds.size}`,
|
||||||
);
|
]);
|
||||||
|
|
||||||
this.readyTimeout = null;
|
this.readyTimeout = null;
|
||||||
this.status = Status.Ready;
|
this.status = Status.Ready;
|
||||||
|
|
|
@ -128,8 +128,9 @@ class GuildMemberManager extends CachedManager {
|
||||||
resolvedOptions.roles = resolvedRoles;
|
resolvedOptions.roles = resolvedRoles;
|
||||||
}
|
}
|
||||||
const data = await this.client.rest.put(Routes.guildMember(this.guild.id, userId), { body: resolvedOptions });
|
const data = await this.client.rest.put(Routes.guildMember(this.guild.id, userId), { body: resolvedOptions });
|
||||||
// Data is an empty Uint8Array if the member is already part of the guild.
|
|
||||||
return data instanceof Uint8Array
|
// Data is an empty array buffer if the member is already part of the guild.
|
||||||
|
return data instanceof ArrayBuffer
|
||||||
? options.fetchWhenExisting === false
|
? options.fetchWhenExisting === false
|
||||||
? null
|
? null
|
||||||
: this.fetch(userId)
|
: this.fetch(userId)
|
||||||
|
|
6
packages/discord.js/typings/index.d.ts
vendored
6
packages/discord.js/typings/index.d.ts
vendored
|
@ -3653,7 +3653,7 @@ export class WebSocketManager extends EventEmitter {
|
||||||
public on(event: GatewayDispatchEvents, listener: (data: any, shardId: number) => void): this;
|
public on(event: GatewayDispatchEvents, listener: (data: any, shardId: number) => void): this;
|
||||||
public once(event: GatewayDispatchEvents, listener: (data: any, shardId: number) => void): this;
|
public once(event: GatewayDispatchEvents, listener: (data: any, shardId: number) => void): this;
|
||||||
|
|
||||||
private debug(message: string, shardId?: number): void;
|
private debug(messages: readonly string[], shardId?: number): void;
|
||||||
private connect(): Promise<void>;
|
private connect(): Promise<void>;
|
||||||
private broadcast(packet: unknown): void;
|
private broadcast(packet: unknown): void;
|
||||||
private destroy(): Promise<void>;
|
private destroy(): Promise<void>;
|
||||||
|
@ -3684,7 +3684,7 @@ export class WebSocketShard extends EventEmitter {
|
||||||
public status: Status;
|
public status: Status;
|
||||||
public ping: number;
|
public ping: number;
|
||||||
|
|
||||||
private debug(message: string): void;
|
private debug(messages: readonly string[]): void;
|
||||||
private onReadyPacket(packet: unknown): void;
|
private onReadyPacket(packet: unknown): void;
|
||||||
private gotGuild(guildId: Snowflake): void;
|
private gotGuild(guildId: Snowflake): void;
|
||||||
private checkReady(): void;
|
private checkReady(): void;
|
||||||
|
@ -4069,7 +4069,7 @@ export class ApplicationCommandManager<
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
options: FetchApplicationCommandOptions & { guildId: Snowflake },
|
options: FetchApplicationCommandOptions & { guildId: Snowflake },
|
||||||
): Promise<ApplicationCommand>;
|
): Promise<ApplicationCommand>;
|
||||||
public fetch(options: FetchApplicationCommandOptions): Promise<Collection<string, ApplicationCommandScope>>;
|
public fetch(options: FetchApplicationCommandOptions): Promise<Collection<Snowflake, ApplicationCommandScope>>;
|
||||||
public fetch(id: Snowflake, options?: FetchApplicationCommandOptions): Promise<ApplicationCommandScope>;
|
public fetch(id: Snowflake, options?: FetchApplicationCommandOptions): Promise<ApplicationCommandScope>;
|
||||||
public fetch(
|
public fetch(
|
||||||
id?: Snowflake,
|
id?: Snowflake,
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
"homepage": "https://discord.js.org",
|
"homepage": "https://discord.js.org",
|
||||||
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord-api-types": "0.37.87"
|
"discord-api-types": "0.37.90"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@discordjs/api-extractor": "workspace:^",
|
"@discordjs/api-extractor": "workspace:^",
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
"@discordjs/rest": "workspace:^",
|
"@discordjs/rest": "workspace:^",
|
||||||
"@discordjs/util": "workspace:^",
|
"@discordjs/util": "workspace:^",
|
||||||
"@discordjs/ws": "workspace:^",
|
"@discordjs/ws": "workspace:^",
|
||||||
"discord-api-types": "0.37.87"
|
"discord-api-types": "0.37.90"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@discordjs/api-extractor": "workspace:^",
|
"@discordjs/api-extractor": "workspace:^",
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
"@sapphire/async-queue": "^1.5.2",
|
"@sapphire/async-queue": "^1.5.2",
|
||||||
"@sapphire/snowflake": "^3.5.3",
|
"@sapphire/snowflake": "^3.5.3",
|
||||||
"@vladfrangu/async_event_emitter": "^2.2.4",
|
"@vladfrangu/async_event_emitter": "^2.2.4",
|
||||||
"discord-api-types": "0.37.87",
|
"discord-api-types": "0.37.90",
|
||||||
"magic-bytes.js": "^1.10.0",
|
"magic-bytes.js": "^1.10.0",
|
||||||
"tslib": "^2.6.2",
|
"tslib": "^2.6.2",
|
||||||
"undici": "6.18.2"
|
"undici": "6.18.2"
|
||||||
|
|
|
@ -240,7 +240,12 @@ function itemExcerptText(excerpt: Excerpt, apiPackage: ApiPackage) {
|
||||||
// dapi-types doesn't have routes for class members
|
// dapi-types doesn't have routes for class members
|
||||||
// so we can assume this member is for an enum
|
// so we can assume this member is for an enum
|
||||||
if (meaning === 'member' && path && 'parent' in path) {
|
if (meaning === 'member' && path && 'parent' in path) {
|
||||||
|
// unless it's a variable like FormattingPatterns.Role
|
||||||
|
if (path.parent.toString() === '__type') {
|
||||||
|
href += `#${token.text.split('.')[0]}`;
|
||||||
|
} else {
|
||||||
href += `/enum/${path.parent}#${path.component}`;
|
href += `/enum/${path.parent}#${path.component}`;
|
||||||
|
}
|
||||||
} else if (meaning === 'type' || meaning === 'var') {
|
} else if (meaning === 'type' || meaning === 'var') {
|
||||||
href += `#${token.text}`;
|
href += `#${token.text}`;
|
||||||
} else {
|
} else {
|
||||||
|
@ -951,11 +956,16 @@ export async function generateSplitDocumentation({
|
||||||
|
|
||||||
const members = entry.members
|
const members = entry.members
|
||||||
.filter((item) => {
|
.filter((item) => {
|
||||||
if (item.kind !== 'Function') {
|
switch (item.kind) {
|
||||||
|
case ApiItemKind.Function:
|
||||||
|
return (item as ApiFunction).overloadIndex === 1;
|
||||||
|
case ApiItemKind.Interface:
|
||||||
|
return !entry.members.some(
|
||||||
|
(innerItem) => innerItem.kind === ApiItemKind.Class && innerItem.displayName === item.displayName,
|
||||||
|
);
|
||||||
|
default:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (item as ApiFunction).overloadIndex === 1;
|
|
||||||
})
|
})
|
||||||
.map((item) => ({
|
.map((item) => ({
|
||||||
kind: item.kind,
|
kind: item.kind,
|
||||||
|
|
|
@ -41,14 +41,15 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
|
||||||
{
|
{
|
||||||
type: 'addMany',
|
type: 'addMany',
|
||||||
destination: `${plop.getDestBasePath()}/../{{name}}`,
|
destination: `${plop.getDestBasePath()}/../{{name}}`,
|
||||||
templateFiles: ['templates/**'],
|
// plop doesn't like our cliff.toml file since it tries to parse it. we add it manually later
|
||||||
|
templateFiles: ['templates/**', '!templates/default/cliff.toml'],
|
||||||
globOptions: { dot: true },
|
globOptions: { dot: true },
|
||||||
base: 'templates/default/',
|
base: 'templates/default/',
|
||||||
stripExtensions: ['hbs'],
|
stripExtensions: ['hbs'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'modify',
|
type: 'modify',
|
||||||
path: `${plop.getDestBasePath()}/turbo/generators/templates/cliff.toml`,
|
path: `${plop.getDestBasePath()}/turbo/generators/templates/default/cliff.toml`,
|
||||||
async transform(content, answers) {
|
async transform(content, answers) {
|
||||||
const cliffTOML = content.replace('{{name}}', answers.name);
|
const cliffTOML = content.replace('{{name}}', answers.name);
|
||||||
await writeFile(`${plop.getDestBasePath()}/../${answers.name}/cliff.toml`, cliffTOML);
|
await writeFile(`${plop.getDestBasePath()}/../${answers.name}/cliff.toml`, cliffTOML);
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/ws": "^8.5.10",
|
"@types/ws": "^8.5.10",
|
||||||
"discord-api-types": "0.37.87",
|
"discord-api-types": "0.37.90",
|
||||||
"prism-media": "^1.3.5",
|
"prism-media": "^1.3.5",
|
||||||
"tslib": "^2.6.2",
|
"tslib": "^2.6.2",
|
||||||
"ws": "^8.17.0"
|
"ws": "^8.17.0"
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
"@sapphire/async-queue": "^1.5.2",
|
"@sapphire/async-queue": "^1.5.2",
|
||||||
"@types/ws": "^8.5.10",
|
"@types/ws": "^8.5.10",
|
||||||
"@vladfrangu/async_event_emitter": "^2.2.4",
|
"@vladfrangu/async_event_emitter": "^2.2.4",
|
||||||
"discord-api-types": "0.37.87",
|
"discord-api-types": "0.37.90",
|
||||||
"tslib": "^2.6.2",
|
"tslib": "^2.6.2",
|
||||||
"ws": "^8.17.0"
|
"ws": "^8.17.0"
|
||||||
},
|
},
|
||||||
|
|
|
@ -915,15 +915,6 @@ export class WebSocketShard extends AsyncEventEmitter<WebSocketShardEventsMap> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private debug(messages: [string, ...string[]]) {
|
private debug(messages: [string, ...string[]]) {
|
||||||
const message = `${messages[0]}${
|
this.emit(WebSocketShardEvents.Debug, { message: messages.join('\n\t') });
|
||||||
messages.length > 1
|
|
||||||
? `\n${messages
|
|
||||||
.slice(1)
|
|
||||||
.map((message) => ` ${message}`)
|
|
||||||
.join('\n')}`
|
|
||||||
: ''
|
|
||||||
}`;
|
|
||||||
|
|
||||||
this.emit(WebSocketShardEvents.Debug, { message });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2284
pnpm-lock.yaml
generated
2284
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue