diff --git a/commands/deleteLearnedData.go b/commands/deleteLearnedData.go index fd4cd87..b7fce7f 100644 --- a/commands/deleteLearnedData.go +++ b/commands/deleteLearnedData.go @@ -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, diff --git a/commands/learn.go b/commands/learn.go index 4d9d798..c7bd63c 100644 --- a/commands/learn.go +++ b/commands/learn.go @@ -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{} diff --git a/utils/strings.go b/utils/strings.go new file mode 100644 index 0000000..d0e5566 --- /dev/null +++ b/utils/strings.go @@ -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 +}