From eb13bb4379b585eeafa4d2096f8155dce7a19c74 Mon Sep 17 00:00:00 2001 From: Siwoo Jeon Date: Sat, 5 Apr 2025 11:34:31 +0900 Subject: [PATCH] fix: Embed color's type --- commands/dataLength.go | 2 +- commands/deleteLearnedData.go | 6 +++--- commands/help.go | 2 +- commands/information.go | 2 +- commands/learn.go | 10 +++++----- commands/learnedDataList.go | 6 +++--- components/deleteLearnedData.go | 4 ++-- utils/embedColor.go | 8 +++----- 8 files changed, 19 insertions(+), 21 deletions(-) diff --git a/commands/dataLength.go b/commands/dataLength.go index fcb056f..d5870a2 100644 --- a/commands/dataLength.go +++ b/commands/dataLength.go @@ -132,7 +132,7 @@ func dataLengthRun(s *discordgo.Session, m any) { embed := &discordgo.MessageEmbed{ Title: "저장된 데이터량", Description: fmt.Sprintf("총합: %s개", utils.InlineCode(strconv.Itoa(sum))), - Color: int(utils.EDefault), + Color: utils.EmbedDefault, Fields: []*discordgo.MessageEmbedField{ { Name: "총 채팅 데이터량", diff --git a/commands/deleteLearnedData.go b/commands/deleteLearnedData.go index 8abadb9..5c84815 100644 --- a/commands/deleteLearnedData.go +++ b/commands/deleteLearnedData.go @@ -64,7 +64,7 @@ func deleteLearnedDataRun(c *Command, s *discordgo.Session, m any, args *[]strin Value: utils.CodeBlockWithLanguage("md", strings.Join(addPrefix(c.DetailedDescription.Examples), "\n")), }, }, - Color: int(utils.EFail), + Color: utils.EmbedFail, }, m.Reference()) } case *discordgo.InteractionCreate: @@ -89,7 +89,7 @@ func deleteLearnedDataRun(c *Command, s *discordgo.Session, m any, args *[]strin if err != nil { embed := &discordgo.MessageEmbed{ Title: "❌ 오류", - Color: int(utils.EFail), + Color: utils.EmbedFail, } if err == mongo.ErrNoDocuments { embed.Description = "해당 하는 지식ㅇ을 찾을 수 없어요." @@ -132,7 +132,7 @@ func deleteLearnedDataRun(c *Command, s *discordgo.Session, m any, args *[]strin embed := &discordgo.MessageEmbed{ Title: fmt.Sprintf("%s 삭제", command), Description: utils.CodeBlockWithLanguage("md", fmt.Sprintf("# %s에 대한 대답 중 하나를 선ㅌ택하여 삭제해주세요.\n%s", command, description)), - Color: int(utils.EDefault), + Color: utils.EmbedDefault, } components := []discordgo.MessageComponent{ diff --git a/commands/help.go b/commands/help.go index 83b66ca..6e69261 100644 --- a/commands/help.go +++ b/commands/help.go @@ -60,7 +60,7 @@ func getCommandsByCategory(d *DiscommandStruct, category Category) []string { func helpRun(c *Command, s *discordgo.Session, m any, args *[]string) { var commandName string embed := &discordgo.MessageEmbed{ - Color: int(utils.EDefault), + Color: utils.EmbedDefault, Footer: &discordgo.MessageEmbedFooter{ Text: fmt.Sprintf("버전: %s", configs.MUFFIN_VERSION), }, diff --git a/commands/information.go b/commands/information.go index 450305e..61b6934 100644 --- a/commands/information.go +++ b/commands/information.go @@ -54,7 +54,7 @@ func informationRun(s *discordgo.Session, m any) { Inline: true, }, }, - Color: int(utils.EDefault), + Color: utils.EmbedDefault, Thumbnail: &discordgo.MessageEmbedThumbnail{ URL: s.State.User.AvatarURL("512"), }, diff --git a/commands/learn.go b/commands/learn.go index f8ea705..51aafc5 100644 --- a/commands/learn.go +++ b/commands/learn.go @@ -100,7 +100,7 @@ func learnRun(c *Command, s *discordgo.Session, m any, args *[]string) { Value: utils.CodeBlockWithLanguage("md", strings.Join(addPrefix(c.DetailedDescription.Examples), "\n")), }, }, - Color: int(utils.EFail), + Color: utils.EmbedFail, }, m.Reference()) return } @@ -150,7 +150,7 @@ func learnRun(c *Command, s *discordgo.Session, m any, args *[]string) { embed := &discordgo.MessageEmbed{ Title: "❌ 오류", Description: "해ㄷ당 단어는 배우기 껄끄ㄹ럽네요.", - Color: int(utils.EFail), + Color: utils.EmbedFail, } switch m := m.(type) { @@ -170,7 +170,7 @@ func learnRun(c *Command, s *discordgo.Session, m any, args *[]string) { embed := &discordgo.MessageEmbed{ Title: "❌ 오류", Description: "해당 단ㅇ어의 대답으로 하기 좀 그렇ㄴ네요.", - Color: int(utils.EFail), + Color: utils.EmbedFail, } switch m := m.(type) { @@ -195,7 +195,7 @@ func learnRun(c *Command, s *discordgo.Session, m any, args *[]string) { embed := &discordgo.MessageEmbed{ Title: "❌ 오류", Description: "단어를 배우는데 오류가 생겼어요.", - Color: int(utils.EFail), + Color: utils.EmbedFail, } switch m := m.(type) { @@ -212,7 +212,7 @@ func learnRun(c *Command, s *discordgo.Session, m any, args *[]string) { embed := &discordgo.MessageEmbed{ Title: "✅ 성공", Description: fmt.Sprintf("%s 배웠어요.", hangul.GetJosa(command, hangul.EUL_REUL)), - Color: int(utils.ESuccess), + Color: utils.EmbedSuccess, } switch m := m.(type) { diff --git a/commands/learnedDataList.go b/commands/learnedDataList.go index 9dfda3a..2952cfd 100644 --- a/commands/learnedDataList.go +++ b/commands/learnedDataList.go @@ -66,7 +66,7 @@ func learnedDataListRun(s *discordgo.Session, m any) { embed := &discordgo.MessageEmbed{ Title: "❌ 오류", Description: "당신은 지식ㅇ을 가르쳐준 적이 없어요!", - Color: int(utils.EFail), + Color: utils.EmbedFail, } switch m := m.(type) { @@ -84,7 +84,7 @@ func learnedDataListRun(s *discordgo.Session, m any) { embed := &discordgo.MessageEmbed{ Title: "❌ 오류", Description: "데이터를 가져오는데 실패했어요.", - Color: int(utils.EFail), + Color: utils.EmbedFail, } switch m := m.(type) { @@ -105,7 +105,7 @@ func learnedDataListRun(s *discordgo.Session, m any) { embed := &discordgo.MessageEmbed{ Title: fmt.Sprintf("%s님이 알려주신 지식", globalName), Description: utils.CodeBlockWithLanguage("md", fmt.Sprintf("# 총 %d개에요.\n%s", len(datas), strings.Join(getDescriptions(&datas), "\n"))), - Color: int(utils.EDefault), + Color: utils.EmbedDefault, Thumbnail: &discordgo.MessageEmbedThumbnail{ URL: avatarUrl, }, diff --git a/components/deleteLearnedData.go b/components/deleteLearnedData.go index 5a6b476..16855ac 100644 --- a/components/deleteLearnedData.go +++ b/components/deleteLearnedData.go @@ -42,7 +42,7 @@ var DeleteLearnedDataComponent *commands.Component = &commands.Component{ { Title: "❌ 오류", Description: "당신은 해당 권한이 없ㅇ어요.", - Color: int(utils.EFail), + Color: int(utils.EmbedFail), }, }, Components: []discordgo.MessageComponent{}, @@ -70,7 +70,7 @@ var DeleteLearnedDataComponent *commands.Component = &commands.Component{ { Title: "✅ 삭제 완료", Description: fmt.Sprintf("%s번을 삭ㅈ제했어요.", itemId), - Color: int(utils.ESuccess), + Color: int(utils.EmbedSuccess), }, }, Components: &[]discordgo.MessageComponent{}, diff --git a/utils/embedColor.go b/utils/embedColor.go index 29ff357..acbaa91 100644 --- a/utils/embedColor.go +++ b/utils/embedColor.go @@ -1,9 +1,7 @@ package utils -type EmbedColorType int - const ( - EDefault EmbedColorType = 0xaddb87 - EFail EmbedColorType = 0xff0000 - ESuccess EmbedColorType = 0x00ff00 + EmbedDefault int = 0xaddb87 + EmbedFail int = 0xff0000 + EmbedSuccess int = 0x00ff00 )