mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
feat: Slash command localization for builders (#7683)
* feat: add slash command localizations * chore: make requested changes * chore: make requested changes * fix: prevent unnecessary spread * chore: make requested changes * chore: don't allow maps
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import type { APIApplicationCommandOption, RESTPostAPIApplicationCommandsJSONBody } from 'discord-api-types/v10';
|
||||
import type {
|
||||
APIApplicationCommandOption,
|
||||
LocalizationMap,
|
||||
RESTPostAPIApplicationCommandsJSONBody,
|
||||
} from 'discord-api-types/v10';
|
||||
import { mix } from 'ts-mixer';
|
||||
import {
|
||||
assertReturnOfBuilder,
|
||||
@@ -17,11 +21,21 @@ export class SlashCommandBuilder {
|
||||
*/
|
||||
public readonly name: string = undefined!;
|
||||
|
||||
/**
|
||||
* The localized names for this command
|
||||
*/
|
||||
public readonly name_localizations?: LocalizationMap;
|
||||
|
||||
/**
|
||||
* The description of this slash command
|
||||
*/
|
||||
public readonly description: string = undefined!;
|
||||
|
||||
/**
|
||||
* The localized descriptions for this command
|
||||
*/
|
||||
public readonly description_localizations?: LocalizationMap;
|
||||
|
||||
/**
|
||||
* The options of this slash command
|
||||
*/
|
||||
@@ -44,7 +58,9 @@ export class SlashCommandBuilder {
|
||||
|
||||
return {
|
||||
name: this.name,
|
||||
name_localizations: this.name_localizations,
|
||||
description: this.description,
|
||||
description_localizations: this.description_localizations,
|
||||
options: this.options.map((option) => option.toJSON()),
|
||||
default_permission: this.defaultPermission,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user