From 5e71ed286e714bb98daad44c1badc16cde4f45d9 Mon Sep 17 00:00:00 2001 From: V Date: Sun, 25 Jun 2023 19:08:18 +0200 Subject: [PATCH] PronounDB: Strip newlines from Discord Pronouns (Discord is stupid) --- src/plugins/pronoundb/pronoundbUtils.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/pronoundb/pronoundbUtils.ts b/src/plugins/pronoundb/pronoundbUtils.ts index b6c44703..bded46bb 100644 --- a/src/plugins/pronoundb/pronoundbUtils.ts +++ b/src/plugins/pronoundb/pronoundbUtils.ts @@ -86,8 +86,13 @@ export function useProfilePronouns(id: string, discordPronouns: string) { } +const NewLineRe = /\n+/g; + // Gets the cached pronouns, if you're too impatient for a promise! export function getCachedPronouns(id: string, discordPronouns: string): string | null { + // Discord is so stupid you can put tons of newlines in pronouns + discordPronouns = discordPronouns?.trim().replace(NewLineRe, " "); + if (settings.store.pronounSource === PronounSource.PreferDiscord && discordPronouns) return discordPronouns;