diff --git a/backend/src/plugins/Starboard/types.ts b/backend/src/plugins/Starboard/types.ts index b2118f55..1fbe3de5 100644 --- a/backend/src/plugins/Starboard/types.ts +++ b/backend/src/plugins/Starboard/types.ts @@ -12,7 +12,7 @@ const StarboardOpts = t.type({ copy_full_embed: tNullable(t.boolean), enabled: tNullable(t.boolean), show_star_count: t.boolean, - color: t.number, + color: tNullable(t.number), }); export type TStarboardOpts = t.TypeOf; @@ -28,7 +28,7 @@ export const defaultStarboardOpts: Partial = { star_emoji: ["⭐"], enabled: true, show_star_count: true, - color: 0, + color: null, }; export interface StarboardPluginType extends BasePluginType { diff --git a/backend/src/plugins/Starboard/util/createStarboardEmbedFromMessage.ts b/backend/src/plugins/Starboard/util/createStarboardEmbedFromMessage.ts index 8ea900e2..9625556c 100644 --- a/backend/src/plugins/Starboard/util/createStarboardEmbedFromMessage.ts +++ b/backend/src/plugins/Starboard/util/createStarboardEmbedFromMessage.ts @@ -8,7 +8,11 @@ const videoAttachmentExtensions = ["mp4", "mkv", "mov"]; type StarboardEmbed = EmbedWith<"footer" | "author" | "fields" | "timestamp">; -export function createStarboardEmbedFromMessage(msg: Message, copyFullEmbed: boolean, color: number): StarboardEmbed { +export function createStarboardEmbedFromMessage( + msg: Message, + copyFullEmbed: boolean, + color?: number | null, +): StarboardEmbed { const embed: StarboardEmbed = { footer: { text: `#${(msg.channel as GuildChannel).name}`, @@ -18,9 +22,12 @@ export function createStarboardEmbedFromMessage(msg: Message, copyFullEmbed: boo }, fields: [], timestamp: new Date(msg.timestamp).toISOString(), - color, }; + if (color != null) { + embed.color = color; + } + if (msg.author.avatarURL) { embed.author.icon_url = msg.author.avatarURL; }