chore: add AddPrefix method

This commit is contained in:
Siwoo Jeon 2025-05-24 15:52:16 +09:00
parent 35347edb85
commit 6fd272ef5f
Signed by: migan
GPG key ID: 036E9A8C5E8E48DA
3 changed files with 12 additions and 9 deletions

View file

@ -44,7 +44,7 @@ var DeleteLearnedDataCommand *Command = &Command{
}, },
{ {
Name: "예시", Name: "예시",
Value: utils.CodeBlock("md", strings.Join(addPrefix(ctx.Command.DetailedDescription.Examples), "\n")), Value: utils.CodeBlock("md", strings.Join(utils.AddPrefix("- ", ctx.Command.DetailedDescription.Examples), "\n")),
}, },
}, },
Color: utils.EmbedFail, Color: utils.EmbedFail,

View file

@ -76,7 +76,7 @@ var LearnCommand *Command = &Command{
}, },
{ {
Name: "예시", Name: "예시",
Value: utils.CodeBlock("md", strings.Join(addPrefix(ctx.Command.DetailedDescription.Examples), "\n")), Value: utils.CodeBlock("md", strings.Join(utils.AddPrefix("- ", ctx.Command.DetailedDescription.Examples), "\n")),
}, },
}, },
Color: utils.EmbedFail, Color: utils.EmbedFail,
@ -107,13 +107,6 @@ var LearnCommand *Command = &Command{
}, },
} }
func addPrefix(arr []string) (newArr []string) {
for _, item := range arr {
newArr = append(newArr, fmt.Sprintf("- %s", item))
}
return
}
func learnRun(m any, userId, command, result string) { func learnRun(m any, userId, command, result string) {
igCommands := []string{} igCommands := []string{}

10
utils/strings.go Normal file
View file

@ -0,0 +1,10 @@
package utils
import "fmt"
func AddPrefix(prefix string, arr []string) (newArr []string) {
for _, item := range arr {
newArr = append(newArr, fmt.Sprintf("%s%s", prefix, item))
}
return
}