Skip to content

Commit

Permalink
Limit description to 250 characters
Browse files Browse the repository at this point in the history
Should failed to embed in Discord
  • Loading branch information
Wikidepia committed Dec 5, 2023
1 parent 932a1ca commit 74163f6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions handlers/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ func Embed() fiber.Handler {

viewsData.Title = "@" + utils.B2S(item.Username)
viewsData.Description = utils.B2S(item.Caption)
if len(viewsData.Description) > 255 {
viewsData.Description = viewsData.Description[:250] + "..."
}

typename := item.Medias[max(1, mediaNum)-1].TypeName
isImage := bytes.Contains(typename, []byte("Image")) || bytes.Contains(typename, []byte("StoryVideo"))
Expand Down

0 comments on commit 74163f6

Please sign in to comment.