From 6112f6c240cf8f210a4c31d9d88a2d95906bd853 Mon Sep 17 00:00:00 2001 From: krau <71133316+krau@users.noreply.github.com> Date: Fri, 22 Aug 2025 15:00:09 +0800 Subject: [PATCH] feat: truncate item description to 233 characters in parsed text --- client/bot/handlers/utils/msgelem/parse.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/bot/handlers/utils/msgelem/parse.go b/client/bot/handlers/utils/msgelem/parse.go index 1211227..0ad058a 100644 --- a/client/bot/handlers/utils/msgelem/parse.go +++ b/client/bot/handlers/utils/msgelem/parse.go @@ -3,6 +3,7 @@ package msgelem import ( "fmt" + "github.com/duke-git/lancet/v2/strutil" "github.com/gotd/td/telegram/message/entity" "github.com/gotd/td/telegram/message/styling" "github.com/gotd/td/tg" @@ -18,7 +19,7 @@ func BuildParsedTextEntity(item parser.Item) (string, []tg.MessageEntityClass, e styling.Plain("\n作者: "), styling.Code(item.Author), styling.Plain("\n描述: "), - styling.Code(item.Description), + styling.Code(strutil.Ellipsis(item.Description, 233)), styling.Plain("\n文件数量: "), styling.Code(fmt.Sprintf("%d", len(item.Resources))), styling.Plain("\n预计总大小: "),