Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion services/webhook/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@
redColor = color("ff3232")
)

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

type discordConvertor struct {
Username string
AvatarURL string
Expand Down Expand Up @@ -307,7 +314,7 @@
Embeds: []DiscordEmbed{
{
Title: title,
Description: text,
Description: util.TruncateRunes(text, discordDescriptionCharactersLimit),

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / lint-backend

undefined: util.TruncateRunes) (typecheck)

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / lint-backend

undefined: util.TruncateRunes) (typecheck)

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / lint-backend

undefined: util.TruncateRunes) (typecheck)

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / lint-backend

undefined: util.TruncateRunes) (typecheck)

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / lint-backend

undefined: util.TruncateRunes) (typecheck)

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / checks-backend

undefined: util.TruncateRunes

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

undefined: util.TruncateRunes) (typecheck)

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

undefined: util.TruncateRunes) (typecheck)

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

undefined: util.TruncateRunes) (typecheck)

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

undefined: util.TruncateRunes) (typecheck)

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

undefined: util.TruncateRunes) (typecheck)

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / backend

undefined: util.TruncateRunes

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

undefined: util.TruncateRunes) (typecheck)

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

undefined: util.TruncateRunes) (typecheck)

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

undefined: util.TruncateRunes) (typecheck)

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

undefined: util.TruncateRunes) (typecheck)

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

undefined: util.TruncateRunes) (typecheck)

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / test-sqlite

undefined: util.TruncateRunes

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / test-pgsql

undefined: util.TruncateRunes

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / test-mysql

undefined: util.TruncateRunes

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / test-unit

undefined: util.TruncateRunes

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / test-mssql

undefined: util.TruncateRunes

Check failure on line 317 in services/webhook/discord.go

View workflow job for this annotation

GitHub Actions / test-e2e

undefined: util.TruncateRunes
URL: url,
Color: color,
Author: DiscordEmbedAuthor{
Expand Down
Loading