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(Locales): add discord supported locales #1484

Merged
merged 7 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 42 additions & 9 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ declare namespace Eris {
/** @deprecated */
defaultPermission?: boolean;
description?: U extends Constants["ApplicationCommandTypes"]["CHAT_INPUT"] ? string : "" | void;
descriptionLocalizations?: U extends Constants["ApplicationCommandTypes"]["CHAT_INPUT"] ? { [s: string]: string } | null : null;
descriptionLocalizations?: U extends Constants["ApplicationCommandTypes"]["CHAT_INPUT"] ? Record<Constants["Locales"][keyof Constants["Locales"]], string> | null : null;
dmPermission?: T extends true ? never : boolean | null;
name?: string;
nameLocalizations?: { [s: string]: string } | null;
nameLocalizations?: Record<Constants["Locales"][keyof Constants["Locales"]], string> | null;
nsfw?: boolean;
options?: ApplicationCommandOptions[];
}
Expand Down Expand Up @@ -702,7 +702,7 @@ declare namespace Eris {
nsfw: boolean;
nsfwLevel: NSFWLevel;
ownerID: string;
preferredLocale?: string;
preferredLocale?: Constants["Locales"][keyof Constants["Locales"]];
premiumProgressBarEnabled: boolean;
premiumSubscriptionCount?: number;
premiumTier: PremiumTier;
Expand Down Expand Up @@ -993,7 +993,7 @@ declare namespace Eris {
is_primary: boolean;
name: {
default: string;
localizations?: { [lang: string]: string };
localizations?: Record<Constants["Locales"][keyof Constants["Locales"]], string>;
};
}
interface DiscoveryMetadata {
Expand Down Expand Up @@ -1104,7 +1104,7 @@ declare namespace Eris {
icon?: string | null;
name?: string;
ownerID?: string;
preferredLocale?: string | null;
preferredLocale?: Constants["Locales"][keyof Constants["Locales"]] | null;
publicUpdatesChannelID?: string | null;
rulesChannelID?: string | null;
safetyAlertsChannelID?: string | null;
Expand Down Expand Up @@ -2084,6 +2084,39 @@ declare namespace Eris {
STREAM: 1;
EMBEDDED_APPLICATION: 2;
};
Locales: {
INDONESIAN: "id";
DANISH: "da";
GERMAN: "de";
ENGLISH_UK: "en-GB";
ENGLISH_US: "en-US";
SPANISH: "es-ES";
FRENCH: "fr";
CROATIAN: "hr";
ITALIAN: "it";
LITHUANIAN: "lt";
HUNGARIAN: "hu";
DUTCH: "nl";
NORWEGIAN: "no";
POLISH: "pl";
PORTUGUESE_BRAZILIAN: "pt-BR";
ROMANIAN_ROMANIA: "ro";
FINNISH: "fi";
SWEDISH: "sv-SE";
VIETNAMESE: "vi";
TURKISH: "tr";
CZECH: "cs";
GREEK: "el";
BULGARIAN: "bg";
RUSSIAN: "ru";
UKRAINIAN: "uk";
HINDI: "hi";
THAI: "th";
CHINESE_CHINA: "zh-CN";
JAPANESE: "ja";
CHINESE_TAIWAN: "zh-TW";
KOREAN: "ko";
};
MemberFlags: {
DID_REJOIN: 1;
COMPLETED_ONBOARDING: 2;
Expand Down Expand Up @@ -2468,7 +2501,7 @@ declare namespace Eris {
inline_attachment_media: boolean;
inline_embed_media: boolean;
guild_positions: string[];
locale: string;
locale: Constants["Locales"][keyof Constants["Locales"]];
message_display_compact: boolean;
render_embeds: boolean;
render_reactions: boolean;
Expand All @@ -2486,11 +2519,11 @@ declare namespace Eris {
/** @deprecated */
defaultPermission?: boolean | null;
description: U extends Constants["ApplicationCommandTypes"]["CHAT_INPUT"] ? string : "";
descriptionLocalizations?: U extends "CHAT_INPUT" ? Record<string, string> | null : null;
descriptionLocalizations?: U extends "CHAT_INPUT" ? Record<Constants["Locales"][keyof Constants["Locales"]], string> | null : null;
dmPermission?: boolean;
guild: T extends true ? PossiblyUncachedGuild : never;
name: string;
nameLocalizations?: Record<string, string> | null;
nameLocalizations?: Record<Constants["Locales"][keyof Constants["Locales"]], string> | null;
nsfw?: boolean;
options?: ApplicationCommandOptions[];
type?: U;
Expand Down Expand Up @@ -3064,7 +3097,7 @@ declare namespace Eris {
nsfw: boolean;
nsfwLevel: NSFWLevel;
ownerID: string;
preferredLocale: string;
preferredLocale: Constants["Locales"][keyof Constants["Locales"]];
premiumProgressBarEnabled: boolean;
premiumSubscriptionCount?: number;
premiumTier: PremiumTier;
Expand Down
34 changes: 34 additions & 0 deletions lib/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,40 @@ module.exports.InviteTargetTypes = {
EMBEDDED_APPLICATION: 2
};

module.exports.Locales = {
INDONESIAN: "id",
DANISH: "da",
GERMAN: "de",
ENGLISH_UK: "en-GB",
ENGLISH_US: "en-US",
SPANISH: "es-ES",
FRENCH: "fr",
CROATIAN: "hr",
ITALIAN: "it",
LITHUANIAN: "lt",
HUNGARIAN: "hu",
DUTCH: "nl",
NORWEGIAN: "no",
POLISH: "pl",
PORTUGUESE_BRAZILIAN: "pt-BR",
ROMANIAN_ROMANIA: "ro",
FINNISH: "fi",
SWEDISH: "sv-SE",
VIETNAMESE: "vi",
TURKISH: "tr",
CZECH: "cs",
GREEK: "el",
BULGARIAN: "bg",
RUSSIAN: "ru",
UKRAINIAN: "uk",
HINDI: "hi",
THAI: "th",
CHINESE_CHINA: "zh-CN",
JAPANESE: "ja",
CHINESE_TAIWAN: "zh-TW",
KOREAN: "ko"
};

module.exports.MemberFlags = {
DID_REJOIN: 1 << 0,
COMPLETED_ONBOARDING: 1 << 1,
Expand Down