Update pkg/utils/message.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Hua Audio
2026-02-18 22:43:49 +01:00
committed by GitHub
parent 82a2faed9d
commit dfc3dffd06
+2 -1
View File
@@ -9,7 +9,8 @@ const defaultCodeBlockBuffer = 500
// SplitMessage splits long messages into chunks, preserving code block integrity.
// The function prefers to split at maxLen - defaultCodeBlockBuffer to leave room for code blocks,
// but may extend up to maxLen when needed to avoid breaking incomplete code blocks.
// Please refer to pkg/channels/discord.go for usage.
// Call SplitMessage with the full text content and the maximum allowed length of a single message;
// it returns a slice of message chunks that each respect maxLen and avoid splitting fenced code blocks.
func SplitMessage(content string, maxLen int) []string {
var messages []string
codeBlockBuffer := defaultCodeBlockBuffer