chore: add AddPrefix method
This commit is contained in:
parent
35347edb85
commit
6fd272ef5f
3 changed files with 12 additions and 9 deletions
|
@ -44,7 +44,7 @@ var DeleteLearnedDataCommand *Command = &Command{
|
|||
},
|
||||
{
|
||||
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,
|
||||
|
|
|
@ -76,7 +76,7 @@ var LearnCommand *Command = &Command{
|
|||
},
|
||||
{
|
||||
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,
|
||||
|
@ -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) {
|
||||
igCommands := []string{}
|
||||
|
||||
|
|
10
utils/strings.go
Normal file
10
utils/strings.go
Normal 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
|
||||
}
|
Loading…
Reference in a new issue