Skip to content

Commit 0916ac6

Browse files
committed
Improve comment
1 parent a97413c commit 0916ac6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

services/webhook/discord.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ var (
101101
redColor = color("ff3232")
102102
)
103103

104+
// https://discord.com/developers/docs/resources/message#embed-object-embed-limits
105+
// Discord has some limits in place for the embeds.
106+
// According to some tests, there is no consistent limit for different characet sets.
107+
// For example: 4096 ASCII letters are allowed, but only 2490 emoji characters are allowed.
108+
// To keep it simple, we currently truncate at 2000.
104109
const discordDescriptionCharactersLimit = 2000
105110

106111
type discordConvertor struct {
@@ -315,7 +320,7 @@ func (d discordConvertor) createPayload(s *api.User, title, text, url string, co
315320
Embeds: []DiscordEmbed{
316321
{
317322
Title: title,
318-
Description: util.TruncateRunes(text, discordDescriptionCharactersLimit), // Discord has some limits in place for the embeds, to keep it simple we currently truncate at 2000
323+
Description: util.TruncateRunes(text, discordDescriptionCharactersLimit),
319324
URL: url,
320325
Color: color,
321326
Author: DiscordEmbedAuthor{

0 commit comments

Comments
 (0)