feat: add length limit in learnedDataList command
This commit is contained in:
parent
e3722101b1
commit
351bf86908
2 changed files with 15 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
|
||||
|
|
Loading…
Reference in a new issue