mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
* feat: inital user-installable apps support * docs: add deprecation warnings * feat: add equality checks * fix: possibly `null` cases * docs: tweaks * docs: add deprecations * fix(ApplicationCommandManager): amend transform command * feat: properly support `integration_types_config` * docs: add . * docs: minor changes * featBaseApplicationCommandData): update type * style: prettier * chore: fix issues * fix: correct casing Co-authored-by: Superchupu <53496941+SuperchupuDev@users.noreply.github.com> * refactor: remove console log * fix: use case that satisfies `/core` and the API * fix: `oauth2InstallParams` property is not nullable * fix: do not convert keys into strings * feat: update transforer to return the full map * feat: update transformers * feat: add `PartialGroupDMMessageManager ` Hope this is not a breaking change * docs: fix type * feat: add approximate count of users property * fix: messageCreate doesn't emit in PartialGroupDMChannel * fix: add GroupDM to TextBasedChannelTypes * feat: add NonPartialGroupDMChannel helper * fix: expect PartialGroupDMChannel * feat: narrow generic type * test: exclude PartialGroupDMChannel * feat: use structure's channel type * docs: narrow type * feat: remove transformer * refactor: remove unnecessary parse * feat: add APIAutoModerationAction transformer * fix: use the right transformer during recursive parsing of interaction metadata * docs: add external types * docs: add `Message#interactionMetadata` property docs * docs: make nullable * docs: add d-docs link * docs: use optional * fix: make `oauth2InstallParams` nullable * types: update `IntegrationTypesConfiguration` Co-authored-by: Almeida <github@almeidx.dev> * docs: update `IntegrationTypesConfigurationParameters` Co-authored-by: Almeida <github@almeidx.dev> * types: update `IntegrationTypesConfigurationParameters` * refactor: improve readability * docs: mark integrationTypesConfig nullable * refactor: requested changes --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: Superchupu <53496941+SuperchupuDev@users.noreply.github.com> Co-authored-by: Vlad Frangu <me@vladfrangu.dev> Co-authored-by: Almeida <github@almeidx.dev>
111 lines
3.2 KiB
TypeScript
111 lines
3.2 KiB
TypeScript
import type {
|
|
APIApplicationCommandOption,
|
|
ApplicationIntegrationType,
|
|
InteractionContextType,
|
|
LocalizationMap,
|
|
Permissions,
|
|
} from 'discord-api-types/v10';
|
|
import { mix } from 'ts-mixer';
|
|
import { SharedNameAndDescription } from './mixins/NameAndDescription.js';
|
|
import { SharedSlashCommand } from './mixins/SharedSlashCommand.js';
|
|
import { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions.js';
|
|
import { SharedSlashCommandSubcommands } from './mixins/SharedSubcommands.js';
|
|
|
|
/**
|
|
* A builder that creates API-compatible JSON data for slash commands.
|
|
*/
|
|
@mix(SharedSlashCommandOptions, SharedNameAndDescription, SharedSlashCommandSubcommands, SharedSlashCommand)
|
|
export class SlashCommandBuilder {
|
|
/**
|
|
* The name of this command.
|
|
*/
|
|
public readonly name: string = undefined!;
|
|
|
|
/**
|
|
* The name localizations of this command.
|
|
*/
|
|
public readonly name_localizations?: LocalizationMap;
|
|
|
|
/**
|
|
* The description of this command.
|
|
*/
|
|
public readonly description: string = undefined!;
|
|
|
|
/**
|
|
* The description localizations of this command.
|
|
*/
|
|
public readonly description_localizations?: LocalizationMap;
|
|
|
|
/**
|
|
* The options of this command.
|
|
*/
|
|
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.
|
|
*
|
|
* @deprecated Use {@link SharedSlashCommand.setDefaultMemberPermissions} or {@link SharedSlashCommand.setDMPermission} instead.
|
|
*/
|
|
public readonly default_permission: boolean | undefined = undefined;
|
|
|
|
/**
|
|
* The set of permissions represented as a bit set for the command.
|
|
*/
|
|
public readonly default_member_permissions: Permissions | null | undefined = undefined;
|
|
|
|
/**
|
|
* Indicates whether the command is available in direct messages with the application.
|
|
*
|
|
* @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;
|
|
|
|
/**
|
|
* The integration types for this command.
|
|
*/
|
|
public readonly integration_types?: ApplicationIntegrationType[];
|
|
|
|
/**
|
|
* Whether this command is NSFW.
|
|
*/
|
|
public readonly nsfw: boolean | undefined = undefined;
|
|
}
|
|
|
|
export interface SlashCommandBuilder
|
|
extends SharedNameAndDescription,
|
|
SharedSlashCommandOptions<SlashCommandOptionsOnlyBuilder>,
|
|
SharedSlashCommandSubcommands<SlashCommandSubcommandsOnlyBuilder>,
|
|
SharedSlashCommand {}
|
|
|
|
/**
|
|
* An interface specifically for slash command subcommands.
|
|
*/
|
|
export interface SlashCommandSubcommandsOnlyBuilder
|
|
extends SharedNameAndDescription,
|
|
SharedSlashCommandSubcommands<SlashCommandSubcommandsOnlyBuilder>,
|
|
SharedSlashCommand {}
|
|
|
|
/**
|
|
* An interface specifically for slash command options.
|
|
*/
|
|
export interface SlashCommandOptionsOnlyBuilder
|
|
extends SharedNameAndDescription,
|
|
SharedSlashCommandOptions<SlashCommandOptionsOnlyBuilder>,
|
|
SharedSlashCommand {}
|
|
|
|
/**
|
|
* An interface that ensures the `toJSON()` call will return something
|
|
* that can be serialized into API-compatible data.
|
|
*/
|
|
export interface ToAPIApplicationCommandOptions {
|
|
toJSON(): APIApplicationCommandOption;
|
|
}
|