feat: add length limit in learnedDataList command

This commit is contained in:
Siwoo Jeon 2025-05-12 19:34:56 +09:00
parent e3722101b1
commit 351bf86908
Signed by: migan
GPG key ID: 036E9A8C5E8E48DA
2 changed files with 15 additions and 2 deletions

View file

@ -50,8 +50,21 @@ var LearnedDataListCommand *Command = &Command{
}
func getDescriptions(data *[]databases.Learn) (descriptions []string) {
MAX_LENGTH := 100
for _, data := range *data {
descriptions = append(descriptions, fmt.Sprintf("- %s: %s", data.Command, data.Result))
command := data.Command
result := data.Result
if runeCommand := []rune(command); len(runeCommand) >= MAX_LENGTH {
command = string(runeCommand)[:MAX_LENGTH] + "..."
}
if runeResult := []rune(result); len(runeResult) >= MAX_LENGTH {
result = string(runeResult[:MAX_LENGTH]) + "..."
}
descriptions = append(descriptions, fmt.Sprintf("- %s: %s", command, result))
}
return
}

View file

@ -7,7 +7,7 @@ import (
"git.wh64.net/muffin/goMuffin/utils"
)
const MUFFIN_VERSION = "5.1.0-gopher_dev.250510a"
const MUFFIN_VERSION = "5.1.0-gopher_dev.250512a"
var updatedString string = utils.Decimals.FindAllStringSubmatch(MUFFIN_VERSION, -1)[3][0]