Discord: Remove extra newlines around links

Since links are converted into embeds, links put on their own line often
lead to extra newlines that looks pretty weird. They should now be
stripped.
discord
Harvey Tindall 3 years ago
parent e98c9b46f1
commit 44558b8109
No known key found for this signature in database
GPG Key ID: BBC65952848FB1A2

@ -44,6 +44,16 @@ func StripAltText(md string, links bool) (string, []*dg.MessageEmbed) {
out += md[URLStart : URLEnd+1]
}
previousURLEnd = URLEnd
// Removing links often leaves a load of extra newlines which look weird, this removes them.
if links {
next := 2
for md[URLEnd+next] == '\n' {
next++
}
if next >= 3 {
previousURLEnd += next - 2
}
}
altTextStart, URLStart, URLEnd = -1, -1, -1
continue
}

Loading…
Cancel
Save