From 0c1d30010371e5c9fb14f1774abd55d9a6acb06c Mon Sep 17 00:00:00 2001 From: MindLated Date: Fri, 9 May 2025 00:39:22 +0200 Subject: [PATCH] fix(discord): restore Hangul Filler patch for short fields in Rich Presence Re-added the original workaround that pads title, artist, and album fields with the Hangul Filler character (\u3164) if their length is less than 2. This prevents Discord Rich Presence from displaying empty or missing fields when song info is very short. --- src/plugins/discord/main.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/plugins/discord/main.ts b/src/plugins/discord/main.ts index e0fd9a1f..342f0d0d 100644 --- a/src/plugins/discord/main.ts +++ b/src/plugins/discord/main.ts @@ -139,6 +139,19 @@ function sendActivityToDiscord(songInfo: SongInfo, config: DiscordPluginConfig) if (!info.rpc || !info.ready) { return; } + // Song information changed, so lets update the rich presence + // @see https://discord.com/developers/docs/topics/gateway#activity-object + // not all options are transfered through https://github.com/discordjs/RPC/blob/6f83d8d812c87cb7ae22064acd132600407d7d05/src/client.js#L518-530 + const hangulFillerUnicodeCharacter = '\u3164'; // This is an empty character + const paddedInfoKeys: (keyof SongInfo)[] = ['title', 'artist', 'album']; + for (const key of paddedInfoKeys) { + const keyLength = (songInfo[key] as string)?.length; + if (keyLength < 2) { + (songInfo[key] as string) += hangulFillerUnicodeCharacter.repeat( + 2 - keyLength, + ); + } + } let buttons: GatewayActivityButton[] | undefined = []; if (config.playOnYouTubeMusic) { buttons.push({