diff --git a/source/Groups/GroupConfigurationHandler.ts b/source/Groups/GroupConfigurationHandler.ts index 2cd4286..f18dcc7 100644 --- a/source/Groups/GroupConfigurationHandler.ts +++ b/source/Groups/GroupConfigurationHandler.ts @@ -9,7 +9,7 @@ import {Nullable} from "../types/Nullable"; import {isPlainObject} from "is-plain-object"; export class GroupConfigurationHandler { - private static DEFAULT_CONFIGURATION: RuntimeGroupConfiguration = { + static DEFAULT_CONFIGURATION: RuntimeGroupConfiguration = { channels: null, locale: new Intl.Locale('en-GB'), permissions: { diff --git a/source/Groups/GroupConfigurationRenderer.ts b/source/Groups/GroupConfigurationRenderer.ts index c53f424..17478be 100644 --- a/source/Groups/GroupConfigurationRenderer.ts +++ b/source/Groups/GroupConfigurationRenderer.ts @@ -8,8 +8,8 @@ import { ButtonStyle, channelMention, ChannelSelectMenuBuilder, ChannelSelectMenuInteraction, ChannelType, - ChatInputCommandInteraction, - EmbedBuilder, + ChatInputCommandInteraction, codeBlock, + EmbedBuilder, inlineCode, InteractionCallbackResponse, InteractionEditReplyOptions, InteractionReplyOptions, @@ -217,7 +217,7 @@ export class GroupConfigurationRenderer { private getCurrentValueAsUI(): string { const path = this.breadcrumbs.join("."); - const value = this.configurationHandler.getConfigurationByPath(path); + let value = this.configurationHandler.getConfigurationByPath(path); if (value === undefined) return italic("None"); @@ -229,10 +229,17 @@ export class GroupConfigurationRenderer { const displaynames = new Intl.DisplayNames(["en"], { type: "language" }); + switch (type) { case TransformerType.Locale: - return displaynames.of((value).baseName) ?? "Unknown"; + if (!value) { + return inlineCode("Default"); + } + return displaynames.of((value)?.baseName) ?? "Unknown"; case TransformerType.Channel: + if (!value) { + return inlineCode("None"); + } return channelMention(value); case TransformerType.PermissionBoolean: return value ? "Allowed" : "Disallowed"