Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(APIApplicationCommand): add command localization #370

Merged
merged 2 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions deno/payloads/common.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { LocaleString } from '../v10.ts';

/**
* https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags
*
Expand Down Expand Up @@ -54,3 +56,5 @@ export const PermissionFlagsBits = {
* @internal
*/
Object.freeze(PermissionFlagsBits);

export type LocalizationMap = Partial<Record<LocaleString, string>>;
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import type { LocalizationMap } from '../../../../../v10.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';

export interface APIApplicationCommandOptionBase<Type extends ApplicationCommandOptionType> {
type: Type;
name: string;
name_localizations?: LocalizationMap;
description: string;
description_localizations?: LocalizationMap;
required?: boolean;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { LocalizationMap } from '../../../../../v10.ts';

/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
Expand All @@ -20,5 +22,6 @@ export enum ApplicationCommandOptionType {
*/
export interface APIApplicationCommandOptionChoice<ValueType = string | number> {
name: string;
name_localizations?: LocalizationMap;
value: ValueType;
}
9 changes: 9 additions & 0 deletions deno/payloads/v10/_interactions/applicationCommands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { LocalizationMap } from '../../../v10.ts';
import type { APIPartialChannel, APIThreadMetadata } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIBaseInteraction } from './base.ts';
Expand Down Expand Up @@ -45,10 +46,18 @@ export interface APIApplicationCommand {
* 1-32 character name; `CHAT_INPUT` command names must be all lowercase matching `^[\w-]{1,32}$`
*/
name: string;
/**
* Localization dictionary for the name field. Values follow the same restrictions as name
*/
name_localizations?: LocalizationMap;
/**
* 1-100 character description for `CHAT_INPUT` commands, empty string for `USER` and `MESSAGE` commands
*/
description: string;
/**
* Localization dictionary for the description field. Values follow the same restrictions as description
*/
description_localizations?: LocalizationMap;
/**
* The parameters for the `CHAT_INPUT` command, max 25
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import type { LocalizationMap } from '../../../../../v9.ts';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared.ts';

export interface APIApplicationCommandOptionBase<Type extends ApplicationCommandOptionType> {
type: Type;
name: string;
name_localizations?: LocalizationMap;
description: string;
description_localizations?: LocalizationMap;
required?: boolean;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { LocalizationMap } from '../../../../../v9.ts';

/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
Expand All @@ -20,5 +22,6 @@ export enum ApplicationCommandOptionType {
*/
export interface APIApplicationCommandOptionChoice<ValueType = string | number> {
name: string;
name_localizations?: LocalizationMap;
value: ValueType;
}
9 changes: 9 additions & 0 deletions deno/payloads/v9/_interactions/applicationCommands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Permissions, Snowflake } from '../../../globals.ts';
import type { LocalizationMap } from '../../../v9.ts';
import type { APIPartialChannel, APIThreadMetadata } from '../channel.ts';
import type { APIGuildMember } from '../guild.ts';
import type { APIBaseInteraction } from './base.ts';
Expand Down Expand Up @@ -45,10 +46,18 @@ export interface APIApplicationCommand {
* 1-32 character name; `CHAT_INPUT` command names must be all lowercase matching `^[\w-]{1,32}$`
*/
name: string;
/**
* Localization dictionary for the name field. Values follow the same restrictions as name
*/
name_localizations?: LocalizationMap;
/**
* 1-100 character description for `CHAT_INPUT` commands, empty string for `USER` and `MESSAGE` commands
*/
description: string;
/**
* Localization dictionary for the description field. Values follow the same restrictions as description
*/
description_localizations?: LocalizationMap;
/**
* The parameters for the `CHAT_INPUT` command, max 25
*/
Expand Down
4 changes: 4 additions & 0 deletions payloads/common.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { LocaleString } from '../v10';

/**
* https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags
*
Expand Down Expand Up @@ -54,3 +56,5 @@ export const PermissionFlagsBits = {
* @internal
*/
Object.freeze(PermissionFlagsBits);

export type LocalizationMap = Partial<Record<LocaleString, string>>;
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import type { LocalizationMap } from '../../../../../v10';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared';

export interface APIApplicationCommandOptionBase<Type extends ApplicationCommandOptionType> {
type: Type;
name: string;
name_localizations?: LocalizationMap;
description: string;
description_localizations?: LocalizationMap;
required?: boolean;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { LocalizationMap } from '../../../../../v10';

/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
Expand All @@ -20,5 +22,6 @@ export enum ApplicationCommandOptionType {
*/
export interface APIApplicationCommandOptionChoice<ValueType = string | number> {
name: string;
name_localizations?: LocalizationMap;
value: ValueType;
}
9 changes: 9 additions & 0 deletions payloads/v10/_interactions/applicationCommands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Permissions, Snowflake } from '../../../globals';
import type { LocalizationMap } from '../../../v10';
import type { APIPartialChannel, APIThreadMetadata } from '../channel';
import type { APIGuildMember } from '../guild';
import type { APIBaseInteraction } from './base';
Expand Down Expand Up @@ -45,10 +46,18 @@ export interface APIApplicationCommand {
* 1-32 character name; `CHAT_INPUT` command names must be all lowercase matching `^[\w-]{1,32}$`
*/
name: string;
/**
* Localization dictionary for the name field. Values follow the same restrictions as name
*/
name_localizations?: LocalizationMap;
/**
* 1-100 character description for `CHAT_INPUT` commands, empty string for `USER` and `MESSAGE` commands
*/
description: string;
/**
* Localization dictionary for the description field. Values follow the same restrictions as description
*/
description_localizations?: LocalizationMap;
/**
* The parameters for the `CHAT_INPUT` command, max 25
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import type { LocalizationMap } from '../../../../../v9';
import type { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from './shared';

export interface APIApplicationCommandOptionBase<Type extends ApplicationCommandOptionType> {
type: Type;
name: string;
name_localizations?: LocalizationMap;
description: string;
description_localizations?: LocalizationMap;
required?: boolean;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { LocalizationMap } from '../../../../../v9';

/**
* https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
*/
Expand All @@ -20,5 +22,6 @@ export enum ApplicationCommandOptionType {
*/
export interface APIApplicationCommandOptionChoice<ValueType = string | number> {
name: string;
name_localizations?: LocalizationMap;
value: ValueType;
}
9 changes: 9 additions & 0 deletions payloads/v9/_interactions/applicationCommands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Permissions, Snowflake } from '../../../globals';
import type { LocalizationMap } from '../../../v9';
import type { APIPartialChannel, APIThreadMetadata } from '../channel';
import type { APIGuildMember } from '../guild';
import type { APIBaseInteraction } from './base';
Expand Down Expand Up @@ -45,10 +46,18 @@ export interface APIApplicationCommand {
* 1-32 character name; `CHAT_INPUT` command names must be all lowercase matching `^[\w-]{1,32}$`
*/
name: string;
/**
* Localization dictionary for the name field. Values follow the same restrictions as name
*/
name_localizations?: LocalizationMap;
/**
* 1-100 character description for `CHAT_INPUT` commands, empty string for `USER` and `MESSAGE` commands
*/
description: string;
/**
* Localization dictionary for the description field. Values follow the same restrictions as description
*/
description_localizations?: LocalizationMap;
/**
* The parameters for the `CHAT_INPUT` command, max 25
*/
Expand Down