Update pkg/utils/message.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
82a2faed9d
commit
dfc3dffd06
1 changed files with 2 additions and 1 deletions
|
|
@ -9,7 +9,8 @@ const defaultCodeBlockBuffer = 500
|
||||||
// SplitMessage splits long messages into chunks, preserving code block integrity.
|
// SplitMessage splits long messages into chunks, preserving code block integrity.
|
||||||
// The function prefers to split at maxLen - defaultCodeBlockBuffer to leave room for code blocks,
|
// 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.
|
// 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 {
|
func SplitMessage(content string, maxLen int) []string {
|
||||||
var messages []string
|
var messages []string
|
||||||
codeBlockBuffer := defaultCodeBlockBuffer
|
codeBlockBuffer := defaultCodeBlockBuffer
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue