diff --git a/deno/payloads/common.ts b/deno/payloads/common.ts index 8b20b4f6..3fb90995 100644 --- a/deno/payloads/common.ts +++ b/deno/payloads/common.ts @@ -1,4 +1,4 @@ -import type { LocaleString } from '../rest/common.ts'; +import type { Locale } from '../rest/common.ts'; /** * https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags @@ -297,7 +297,7 @@ export const PermissionFlagsBits = { */ Object.freeze(PermissionFlagsBits); -export type LocalizationMap = Partial>; +export type LocalizationMap = Partial>; /** * https://discord.com/developers/docs/topics/opcodes-and-status-codes#json diff --git a/deno/payloads/v10/_interactions/base.ts b/deno/payloads/v10/_interactions/base.ts index 03a8f683..eabbcfe1 100644 --- a/deno/payloads/v10/_interactions/base.ts +++ b/deno/payloads/v10/_interactions/base.ts @@ -1,5 +1,5 @@ import type { Permissions, Snowflake } from '../../../globals.ts'; -import type { APIRole, ApplicationIntegrationType, InteractionContextType, LocaleString } from '../../../v10.ts'; +import type { APIRole, ApplicationIntegrationType, InteractionContextType, Locale } from '../../../v10.ts'; import type { APIAttachment, APIChannel, @@ -160,11 +160,11 @@ export interface APIBaseInteraction { /** * The selected language of the invoking user */ - locale: LocaleString; + locale: Locale; /** * The guild's preferred locale, if invoked in a guild */ - guild_locale?: LocaleString; + guild_locale?: Locale; /** * For monetized apps, any entitlements for the invoking user, representing access to premium SKUs */ diff --git a/deno/payloads/v10/guild.ts b/deno/payloads/v10/guild.ts index 645657c0..2fa93714 100644 --- a/deno/payloads/v10/guild.ts +++ b/deno/payloads/v10/guild.ts @@ -3,6 +3,7 @@ */ import type { Permissions, Snowflake } from '../../globals.ts'; +import type { Locale } from '../../rest/common.ts'; import type { APIEmoji, APIPartialEmoji } from './emoji.ts'; import type { PresenceUpdateReceiveStatus } from './gateway.ts'; import type { OAuth2Scopes } from './oauth2.ts'; @@ -227,7 +228,7 @@ export interface APIGuild extends APIPartialGuild { * * @default "en-US" */ - preferred_locale: string; + preferred_locale: Locale; /** * The id of the channel where admins and moderators of Community guilds receive notices from Discord */ diff --git a/deno/payloads/v10/template.ts b/deno/payloads/v10/template.ts index 4dd7533a..7381b0c0 100644 --- a/deno/payloads/v10/template.ts +++ b/deno/payloads/v10/template.ts @@ -3,6 +3,7 @@ */ import type { Snowflake } from '../../globals.ts'; +import type { Locale } from '../../rest/common.ts'; import type { RESTPostAPIGuildsJSONBody } from '../../rest/v10/mod.ts'; import type { APIUser } from './user.ts'; @@ -60,6 +61,6 @@ export interface APITemplate { export interface APITemplateSerializedSourceGuild extends Omit { description: string | null; - preferred_locale: string; + preferred_locale: Locale; icon_hash: string | null; } diff --git a/deno/payloads/v9/_interactions/base.ts b/deno/payloads/v9/_interactions/base.ts index f20670ea..2a6778a9 100644 --- a/deno/payloads/v9/_interactions/base.ts +++ b/deno/payloads/v9/_interactions/base.ts @@ -1,5 +1,5 @@ import type { Permissions, Snowflake } from '../../../globals.ts'; -import type { APIRole, ApplicationIntegrationType, InteractionContextType, LocaleString } from '../../../v9.ts'; +import type { APIRole, ApplicationIntegrationType, InteractionContextType, Locale } from '../../../v9.ts'; import type { APIAttachment, APIChannel, @@ -160,11 +160,11 @@ export interface APIBaseInteraction { /** * The selected language of the invoking user */ - locale: LocaleString; + locale: Locale; /** * The guild's preferred locale, if invoked in a guild */ - guild_locale?: LocaleString; + guild_locale?: Locale; /** * For monetized apps, any entitlements for the invoking user, representing access to premium SKUs */ diff --git a/deno/payloads/v9/guild.ts b/deno/payloads/v9/guild.ts index b8bfe5a2..4a3d1639 100644 --- a/deno/payloads/v9/guild.ts +++ b/deno/payloads/v9/guild.ts @@ -3,6 +3,7 @@ */ import type { Permissions, Snowflake } from '../../globals.ts'; +import type { Locale } from '../../rest/common.ts'; import type { APIEmoji, APIPartialEmoji } from './emoji.ts'; import type { PresenceUpdateReceiveStatus } from './gateway.ts'; import type { OAuth2Scopes } from './oauth2.ts'; @@ -227,7 +228,7 @@ export interface APIGuild extends APIPartialGuild { * * @default "en-US" */ - preferred_locale: string; + preferred_locale: Locale; /** * The id of the channel where admins and moderators of Community guilds receive notices from Discord */ diff --git a/deno/payloads/v9/template.ts b/deno/payloads/v9/template.ts index 06b410fc..90d664f8 100644 --- a/deno/payloads/v9/template.ts +++ b/deno/payloads/v9/template.ts @@ -3,6 +3,7 @@ */ import type { Snowflake } from '../../globals.ts'; +import type { Locale } from '../../rest/common.ts'; import type { RESTPostAPIGuildsJSONBody } from '../../rest/v9/mod.ts'; import type { APIUser } from './user.ts'; @@ -60,6 +61,6 @@ export interface APITemplate { export interface APITemplateSerializedSourceGuild extends Omit { description: string | null; - preferred_locale: string; + preferred_locale: Locale; icon_hash: string | null; } diff --git a/deno/rest/common.ts b/deno/rest/common.ts index 22339bde..320801bc 100644 --- a/deno/rest/common.ts +++ b/deno/rest/common.ts @@ -362,4 +362,7 @@ export enum Locale { Vietnamese = 'vi', } +/** + * @deprecated Use {@apilink Locale} instead. + */ export type LocaleString = `${Locale}`; diff --git a/deno/rest/v10/guild.ts b/deno/rest/v10/guild.ts index ccd7f13d..2739f716 100644 --- a/deno/rest/v10/guild.ts +++ b/deno/rest/v10/guild.ts @@ -35,6 +35,7 @@ import type { StrictPartial, StrictRequired, } from '../../utils/internals.ts'; +import type { Locale } from '../common.ts'; import type { RESTPutAPIChannelPermissionJSONBody } from './channel.ts'; export interface RESTAPIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody { @@ -315,7 +316,7 @@ export interface RESTPatchAPIGuildJSONBody { * * @default "en-US" (if the value is set to `null`) */ - preferred_locale?: string | null | undefined; + preferred_locale?: Locale | null | undefined; /** * Enabled guild features * diff --git a/deno/rest/v9/guild.ts b/deno/rest/v9/guild.ts index b8d9dd84..f7499b57 100644 --- a/deno/rest/v9/guild.ts +++ b/deno/rest/v9/guild.ts @@ -35,6 +35,7 @@ import type { StrictPartial, StrictRequired, } from '../../utils/internals.ts'; +import type { Locale } from '../common.ts'; import type { RESTPutAPIChannelPermissionJSONBody } from './channel.ts'; export interface RESTAPIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody { @@ -315,7 +316,7 @@ export interface RESTPatchAPIGuildJSONBody { * * @default "en-US" (if the value is set to `null`) */ - preferred_locale?: string | null | undefined; + preferred_locale?: Locale | null | undefined; /** * Enabled guild features * diff --git a/payloads/common.ts b/payloads/common.ts index 5b320d86..51ff363e 100644 --- a/payloads/common.ts +++ b/payloads/common.ts @@ -1,4 +1,4 @@ -import type { LocaleString } from '../rest/common'; +import type { Locale } from '../rest/common'; /** * https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags @@ -297,7 +297,7 @@ export const PermissionFlagsBits = { */ Object.freeze(PermissionFlagsBits); -export type LocalizationMap = Partial>; +export type LocalizationMap = Partial>; /** * https://discord.com/developers/docs/topics/opcodes-and-status-codes#json diff --git a/payloads/v10/_interactions/base.ts b/payloads/v10/_interactions/base.ts index 922fc968..4015e070 100644 --- a/payloads/v10/_interactions/base.ts +++ b/payloads/v10/_interactions/base.ts @@ -1,5 +1,5 @@ import type { Permissions, Snowflake } from '../../../globals'; -import type { APIRole, ApplicationIntegrationType, InteractionContextType, LocaleString } from '../../../v10'; +import type { APIRole, ApplicationIntegrationType, InteractionContextType, Locale } from '../../../v10'; import type { APIAttachment, APIChannel, @@ -160,11 +160,11 @@ export interface APIBaseInteraction { /** * The selected language of the invoking user */ - locale: LocaleString; + locale: Locale; /** * The guild's preferred locale, if invoked in a guild */ - guild_locale?: LocaleString; + guild_locale?: Locale; /** * For monetized apps, any entitlements for the invoking user, representing access to premium SKUs */ diff --git a/payloads/v10/guild.ts b/payloads/v10/guild.ts index bdf83dcb..4ba806a3 100644 --- a/payloads/v10/guild.ts +++ b/payloads/v10/guild.ts @@ -3,6 +3,7 @@ */ import type { Permissions, Snowflake } from '../../globals'; +import type { Locale } from '../../rest/common'; import type { APIEmoji, APIPartialEmoji } from './emoji'; import type { PresenceUpdateReceiveStatus } from './gateway'; import type { OAuth2Scopes } from './oauth2'; @@ -227,7 +228,7 @@ export interface APIGuild extends APIPartialGuild { * * @default "en-US" */ - preferred_locale: string; + preferred_locale: Locale; /** * The id of the channel where admins and moderators of Community guilds receive notices from Discord */ diff --git a/payloads/v10/template.ts b/payloads/v10/template.ts index 7488a6d6..af658434 100644 --- a/payloads/v10/template.ts +++ b/payloads/v10/template.ts @@ -3,6 +3,7 @@ */ import type { Snowflake } from '../../globals'; +import type { Locale } from '../../rest/common'; import type { RESTPostAPIGuildsJSONBody } from '../../rest/v10/index'; import type { APIUser } from './user'; @@ -60,6 +61,6 @@ export interface APITemplate { export interface APITemplateSerializedSourceGuild extends Omit { description: string | null; - preferred_locale: string; + preferred_locale: Locale; icon_hash: string | null; } diff --git a/payloads/v9/_interactions/base.ts b/payloads/v9/_interactions/base.ts index 0bd8dd89..091a17fc 100644 --- a/payloads/v9/_interactions/base.ts +++ b/payloads/v9/_interactions/base.ts @@ -1,5 +1,5 @@ import type { Permissions, Snowflake } from '../../../globals'; -import type { APIRole, ApplicationIntegrationType, InteractionContextType, LocaleString } from '../../../v9'; +import type { APIRole, ApplicationIntegrationType, InteractionContextType, Locale } from '../../../v9'; import type { APIAttachment, APIChannel, @@ -160,11 +160,11 @@ export interface APIBaseInteraction { /** * The selected language of the invoking user */ - locale: LocaleString; + locale: Locale; /** * The guild's preferred locale, if invoked in a guild */ - guild_locale?: LocaleString; + guild_locale?: Locale; /** * For monetized apps, any entitlements for the invoking user, representing access to premium SKUs */ diff --git a/payloads/v9/guild.ts b/payloads/v9/guild.ts index ef083786..525052a0 100644 --- a/payloads/v9/guild.ts +++ b/payloads/v9/guild.ts @@ -3,6 +3,7 @@ */ import type { Permissions, Snowflake } from '../../globals'; +import type { Locale } from '../../rest/common'; import type { APIEmoji, APIPartialEmoji } from './emoji'; import type { PresenceUpdateReceiveStatus } from './gateway'; import type { OAuth2Scopes } from './oauth2'; @@ -227,7 +228,7 @@ export interface APIGuild extends APIPartialGuild { * * @default "en-US" */ - preferred_locale: string; + preferred_locale: Locale; /** * The id of the channel where admins and moderators of Community guilds receive notices from Discord */ diff --git a/payloads/v9/template.ts b/payloads/v9/template.ts index dbd07c09..013533b7 100644 --- a/payloads/v9/template.ts +++ b/payloads/v9/template.ts @@ -3,6 +3,7 @@ */ import type { Snowflake } from '../../globals'; +import type { Locale } from '../../rest/common'; import type { RESTPostAPIGuildsJSONBody } from '../../rest/v9/index'; import type { APIUser } from './user'; @@ -60,6 +61,6 @@ export interface APITemplate { export interface APITemplateSerializedSourceGuild extends Omit { description: string | null; - preferred_locale: string; + preferred_locale: Locale; icon_hash: string | null; } diff --git a/rest/common.ts b/rest/common.ts index 22339bde..320801bc 100644 --- a/rest/common.ts +++ b/rest/common.ts @@ -362,4 +362,7 @@ export enum Locale { Vietnamese = 'vi', } +/** + * @deprecated Use {@apilink Locale} instead. + */ export type LocaleString = `${Locale}`; diff --git a/rest/v10/guild.ts b/rest/v10/guild.ts index 2003f6da..53fc29ee 100644 --- a/rest/v10/guild.ts +++ b/rest/v10/guild.ts @@ -35,6 +35,7 @@ import type { StrictPartial, StrictRequired, } from '../../utils/internals'; +import type { Locale } from '../common'; import type { RESTPutAPIChannelPermissionJSONBody } from './channel'; export interface RESTAPIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody { @@ -315,7 +316,7 @@ export interface RESTPatchAPIGuildJSONBody { * * @default "en-US" (if the value is set to `null`) */ - preferred_locale?: string | null | undefined; + preferred_locale?: Locale | null | undefined; /** * Enabled guild features * diff --git a/rest/v9/guild.ts b/rest/v9/guild.ts index 18a908f7..ac8258ab 100644 --- a/rest/v9/guild.ts +++ b/rest/v9/guild.ts @@ -35,6 +35,7 @@ import type { StrictPartial, StrictRequired, } from '../../utils/internals'; +import type { Locale } from '../common'; import type { RESTPutAPIChannelPermissionJSONBody } from './channel'; export interface RESTAPIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody { @@ -315,7 +316,7 @@ export interface RESTPatchAPIGuildJSONBody { * * @default "en-US" (if the value is set to `null`) */ - preferred_locale?: string | null | undefined; + preferred_locale?: Locale | null | undefined; /** * Enabled guild features *