File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -154,15 +154,14 @@ export const backend = createBackend<
154154 // @see https://discord.com/developers/docs/topics/gateway#activity-object
155155 // not all options are transfered through https://github.com/discordjs/RPC/blob/6f83d8d812c87cb7ae22064acd132600407d7d05/src/client.js#L518-530
156156 const hangulFillerUnicodeCharacter = '\u3164' ; // This is an empty character
157- if ( songInfo . title . length < 2 ) {
158- songInfo . title += hangulFillerUnicodeCharacter . repeat (
159- 2 - songInfo . title . length ,
160- ) ;
161- }
162- if ( songInfo . artist . length < 2 ) {
163- songInfo . artist += hangulFillerUnicodeCharacter . repeat (
164- 2 - songInfo . title . length ,
165- ) ;
157+ const paddedInfoKeys : ( keyof SongInfo ) [ ] = [ 'title' , 'artist' , 'album' ] ;
158+ for ( const key of paddedInfoKeys ) {
159+ const keyLength = ( songInfo [ key ] as string ) ?. length ;
160+ if ( keyLength < 2 ) {
161+ ( songInfo [ key ] as string ) += hangulFillerUnicodeCharacter . repeat (
162+ 2 - keyLength ,
163+ ) ;
164+ }
166165 }
167166
168167 // see https://github.com/th-ch/youtube-music/issues/1664
You can’t perform that action at this time.
0 commit comments