fix: Embed color's type

This commit is contained in:
Siwoo Jeon 2025-04-05 11:34:31 +09:00
parent fbad3130c8
commit eb13bb4379
Signed by: migan
GPG key ID: 036E9A8C5E8E48DA
8 changed files with 19 additions and 21 deletions

View file

@ -132,7 +132,7 @@ func dataLengthRun(s *discordgo.Session, m any) {
embed := &discordgo.MessageEmbed{ embed := &discordgo.MessageEmbed{
Title: "저장된 데이터량", Title: "저장된 데이터량",
Description: fmt.Sprintf("총합: %s개", utils.InlineCode(strconv.Itoa(sum))), Description: fmt.Sprintf("총합: %s개", utils.InlineCode(strconv.Itoa(sum))),
Color: int(utils.EDefault), Color: utils.EmbedDefault,
Fields: []*discordgo.MessageEmbedField{ Fields: []*discordgo.MessageEmbedField{
{ {
Name: "총 채팅 데이터량", Name: "총 채팅 데이터량",

View file

@ -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")), Value: utils.CodeBlockWithLanguage("md", strings.Join(addPrefix(c.DetailedDescription.Examples), "\n")),
}, },
}, },
Color: int(utils.EFail), Color: utils.EmbedFail,
}, m.Reference()) }, m.Reference())
} }
case *discordgo.InteractionCreate: case *discordgo.InteractionCreate:
@ -89,7 +89,7 @@ func deleteLearnedDataRun(c *Command, s *discordgo.Session, m any, args *[]strin
if err != nil { if err != nil {
embed := &discordgo.MessageEmbed{ embed := &discordgo.MessageEmbed{
Title: "❌ 오류", Title: "❌ 오류",
Color: int(utils.EFail), Color: utils.EmbedFail,
} }
if err == mongo.ErrNoDocuments { if err == mongo.ErrNoDocuments {
embed.Description = "해당 하는 지식ㅇ을 찾을 수 없어요." embed.Description = "해당 하는 지식ㅇ을 찾을 수 없어요."
@ -132,7 +132,7 @@ func deleteLearnedDataRun(c *Command, s *discordgo.Session, m any, args *[]strin
embed := &discordgo.MessageEmbed{ embed := &discordgo.MessageEmbed{
Title: fmt.Sprintf("%s 삭제", command), Title: fmt.Sprintf("%s 삭제", command),
Description: utils.CodeBlockWithLanguage("md", fmt.Sprintf("# %s에 대한 대답 중 하나를 선ㅌ택하여 삭제해주세요.\n%s", command, description)), Description: utils.CodeBlockWithLanguage("md", fmt.Sprintf("# %s에 대한 대답 중 하나를 선ㅌ택하여 삭제해주세요.\n%s", command, description)),
Color: int(utils.EDefault), Color: utils.EmbedDefault,
} }
components := []discordgo.MessageComponent{ components := []discordgo.MessageComponent{

View file

@ -60,7 +60,7 @@ func getCommandsByCategory(d *DiscommandStruct, category Category) []string {
func helpRun(c *Command, s *discordgo.Session, m any, args *[]string) { func helpRun(c *Command, s *discordgo.Session, m any, args *[]string) {
var commandName string var commandName string
embed := &discordgo.MessageEmbed{ embed := &discordgo.MessageEmbed{
Color: int(utils.EDefault), Color: utils.EmbedDefault,
Footer: &discordgo.MessageEmbedFooter{ Footer: &discordgo.MessageEmbedFooter{
Text: fmt.Sprintf("버전: %s", configs.MUFFIN_VERSION), Text: fmt.Sprintf("버전: %s", configs.MUFFIN_VERSION),
}, },

View file

@ -54,7 +54,7 @@ func informationRun(s *discordgo.Session, m any) {
Inline: true, Inline: true,
}, },
}, },
Color: int(utils.EDefault), Color: utils.EmbedDefault,
Thumbnail: &discordgo.MessageEmbedThumbnail{ Thumbnail: &discordgo.MessageEmbedThumbnail{
URL: s.State.User.AvatarURL("512"), URL: s.State.User.AvatarURL("512"),
}, },

View file

@ -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")), Value: utils.CodeBlockWithLanguage("md", strings.Join(addPrefix(c.DetailedDescription.Examples), "\n")),
}, },
}, },
Color: int(utils.EFail), Color: utils.EmbedFail,
}, m.Reference()) }, m.Reference())
return return
} }
@ -150,7 +150,7 @@ func learnRun(c *Command, s *discordgo.Session, m any, args *[]string) {
embed := &discordgo.MessageEmbed{ embed := &discordgo.MessageEmbed{
Title: "❌ 오류", Title: "❌ 오류",
Description: "해ㄷ당 단어는 배우기 껄끄ㄹ럽네요.", Description: "해ㄷ당 단어는 배우기 껄끄ㄹ럽네요.",
Color: int(utils.EFail), Color: utils.EmbedFail,
} }
switch m := m.(type) { switch m := m.(type) {
@ -170,7 +170,7 @@ func learnRun(c *Command, s *discordgo.Session, m any, args *[]string) {
embed := &discordgo.MessageEmbed{ embed := &discordgo.MessageEmbed{
Title: "❌ 오류", Title: "❌ 오류",
Description: "해당 단ㅇ어의 대답으로 하기 좀 그렇ㄴ네요.", Description: "해당 단ㅇ어의 대답으로 하기 좀 그렇ㄴ네요.",
Color: int(utils.EFail), Color: utils.EmbedFail,
} }
switch m := m.(type) { switch m := m.(type) {
@ -195,7 +195,7 @@ func learnRun(c *Command, s *discordgo.Session, m any, args *[]string) {
embed := &discordgo.MessageEmbed{ embed := &discordgo.MessageEmbed{
Title: "❌ 오류", Title: "❌ 오류",
Description: "단어를 배우는데 오류가 생겼어요.", Description: "단어를 배우는데 오류가 생겼어요.",
Color: int(utils.EFail), Color: utils.EmbedFail,
} }
switch m := m.(type) { switch m := m.(type) {
@ -212,7 +212,7 @@ func learnRun(c *Command, s *discordgo.Session, m any, args *[]string) {
embed := &discordgo.MessageEmbed{ embed := &discordgo.MessageEmbed{
Title: "✅ 성공", Title: "✅ 성공",
Description: fmt.Sprintf("%s 배웠어요.", hangul.GetJosa(command, hangul.EUL_REUL)), Description: fmt.Sprintf("%s 배웠어요.", hangul.GetJosa(command, hangul.EUL_REUL)),
Color: int(utils.ESuccess), Color: utils.EmbedSuccess,
} }
switch m := m.(type) { switch m := m.(type) {

View file

@ -66,7 +66,7 @@ func learnedDataListRun(s *discordgo.Session, m any) {
embed := &discordgo.MessageEmbed{ embed := &discordgo.MessageEmbed{
Title: "❌ 오류", Title: "❌ 오류",
Description: "당신은 지식ㅇ을 가르쳐준 적이 없어요!", Description: "당신은 지식ㅇ을 가르쳐준 적이 없어요!",
Color: int(utils.EFail), Color: utils.EmbedFail,
} }
switch m := m.(type) { switch m := m.(type) {
@ -84,7 +84,7 @@ func learnedDataListRun(s *discordgo.Session, m any) {
embed := &discordgo.MessageEmbed{ embed := &discordgo.MessageEmbed{
Title: "❌ 오류", Title: "❌ 오류",
Description: "데이터를 가져오는데 실패했어요.", Description: "데이터를 가져오는데 실패했어요.",
Color: int(utils.EFail), Color: utils.EmbedFail,
} }
switch m := m.(type) { switch m := m.(type) {
@ -105,7 +105,7 @@ func learnedDataListRun(s *discordgo.Session, m any) {
embed := &discordgo.MessageEmbed{ embed := &discordgo.MessageEmbed{
Title: fmt.Sprintf("%s님이 알려주신 지식", globalName), Title: fmt.Sprintf("%s님이 알려주신 지식", globalName),
Description: utils.CodeBlockWithLanguage("md", fmt.Sprintf("# 총 %d개에요.\n%s", len(datas), strings.Join(getDescriptions(&datas), "\n"))), 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{ Thumbnail: &discordgo.MessageEmbedThumbnail{
URL: avatarUrl, URL: avatarUrl,
}, },

View file

@ -42,7 +42,7 @@ var DeleteLearnedDataComponent *commands.Component = &commands.Component{
{ {
Title: "❌ 오류", Title: "❌ 오류",
Description: "당신은 해당 권한이 없ㅇ어요.", Description: "당신은 해당 권한이 없ㅇ어요.",
Color: int(utils.EFail), Color: int(utils.EmbedFail),
}, },
}, },
Components: []discordgo.MessageComponent{}, Components: []discordgo.MessageComponent{},
@ -70,7 +70,7 @@ var DeleteLearnedDataComponent *commands.Component = &commands.Component{
{ {
Title: "✅ 삭제 완료", Title: "✅ 삭제 완료",
Description: fmt.Sprintf("%s번을 삭ㅈ제했어요.", itemId), Description: fmt.Sprintf("%s번을 삭ㅈ제했어요.", itemId),
Color: int(utils.ESuccess), Color: int(utils.EmbedSuccess),
}, },
}, },
Components: &[]discordgo.MessageComponent{}, Components: &[]discordgo.MessageComponent{},

View file

@ -1,9 +1,7 @@
package utils package utils
type EmbedColorType int
const ( const (
EDefault EmbedColorType = 0xaddb87 EmbedDefault int = 0xaddb87
EFail EmbedColorType = 0xff0000 EmbedFail int = 0xff0000
ESuccess EmbedColorType = 0x00ff00 EmbedSuccess int = 0x00ff00
) )