fix: list error container
This commit is contained in:
parent
9bfc53bf37
commit
b6e9350e73
2 changed files with 10 additions and 35 deletions
|
@ -82,28 +82,12 @@ var LearnedDataListCommand *Command = &Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
if match := utils.RegexpLearnQueryLength.FindStringSubmatch(query); match != nil {
|
if match := utils.RegexpLearnQueryLength.FindStringSubmatch(query); match != nil {
|
||||||
var err error
|
length, _ = strconv.Atoi(match[1])
|
||||||
length, err := strconv.Atoi(match[1])
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
utils.NewMessageSender(ctx.Msg).
|
|
||||||
AddEmbeds(&discordgo.MessageEmbed{
|
|
||||||
Title: "❌ 오류",
|
|
||||||
Description: "개수의 값은 숫자여야해요.",
|
|
||||||
Color: utils.EmbedFail,
|
|
||||||
}).
|
|
||||||
SetReply(true).
|
|
||||||
Send()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if float64(length) < LIST_MIN_VALUE {
|
if float64(length) < LIST_MIN_VALUE {
|
||||||
utils.NewMessageSender(ctx.Msg).
|
utils.NewMessageSender(ctx.Msg).
|
||||||
AddEmbeds(&discordgo.MessageEmbed{
|
AddComponents(utils.GetErrorContainer(discordgo.TextDisplay{Content: fmt.Sprintf("개수의 값은 %d보다 커야해요.", int(LIST_MIN_VALUE))})).
|
||||||
Title: "❌ 오류",
|
SetComponentsV2(true).
|
||||||
Description: fmt.Sprintf("개수의 값은 %d보다 커야해요.", int(LIST_MIN_VALUE)),
|
|
||||||
Color: utils.EmbedFail,
|
|
||||||
}).
|
|
||||||
SetReply(true).
|
SetReply(true).
|
||||||
Send()
|
Send()
|
||||||
return
|
return
|
||||||
|
@ -111,11 +95,8 @@ var LearnedDataListCommand *Command = &Command{
|
||||||
|
|
||||||
if float64(length) > LIST_MAX_VALUE {
|
if float64(length) > LIST_MAX_VALUE {
|
||||||
utils.NewMessageSender(ctx.Msg).
|
utils.NewMessageSender(ctx.Msg).
|
||||||
AddEmbeds(&discordgo.MessageEmbed{
|
AddComponents(utils.GetErrorContainer(discordgo.TextDisplay{Content: fmt.Sprintf("개수의 값은 %d보다 작아야해요.", int(LIST_MAX_VALUE))})).
|
||||||
Title: "❌ 오류",
|
SetComponentsV2(true).
|
||||||
Description: fmt.Sprintf("개수의 값은 %d보다 작아야해요.", int(LIST_MAX_VALUE)),
|
|
||||||
Color: utils.EmbedFail,
|
|
||||||
}).
|
|
||||||
SetReply(true).
|
SetReply(true).
|
||||||
Send()
|
Send()
|
||||||
return
|
return
|
||||||
|
@ -241,11 +222,8 @@ func learnedDataListRun(m any, globalName, avatarUrl string, filter bson.D, leng
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == mongo.ErrNoDocuments {
|
if err == mongo.ErrNoDocuments {
|
||||||
utils.NewMessageSender(m).
|
utils.NewMessageSender(m).
|
||||||
AddEmbeds(&discordgo.MessageEmbed{
|
AddComponents(utils.GetErrorContainer(discordgo.TextDisplay{Content: "당신은 지식ㅇ을 가르쳐준 적이 없어요!"})).
|
||||||
Title: "❌ 오류",
|
SetComponentsV2(true).
|
||||||
Description: "당신은 지식ㅇ을 가르쳐준 적이 없어요!",
|
|
||||||
Color: utils.EmbedFail,
|
|
||||||
}).
|
|
||||||
SetReply(true).
|
SetReply(true).
|
||||||
Send()
|
Send()
|
||||||
return
|
return
|
||||||
|
@ -254,11 +232,8 @@ func learnedDataListRun(m any, globalName, avatarUrl string, filter bson.D, leng
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
|
||||||
utils.NewMessageSender(m).
|
utils.NewMessageSender(m).
|
||||||
AddEmbeds(&discordgo.MessageEmbed{
|
AddComponents(utils.GetErrorContainer(discordgo.TextDisplay{Content: "데이터를 가져오는데 실패했어요."})).
|
||||||
Title: "❌ 오류",
|
SetComponentsV2(true).
|
||||||
Description: "데이터를 가져오는데 실패했어요.",
|
|
||||||
Color: utils.EmbedFail,
|
|
||||||
}).
|
|
||||||
SetReply(true).
|
SetReply(true).
|
||||||
Send()
|
Send()
|
||||||
return
|
return
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"git.wh64.net/muffin/goMuffin/utils"
|
"git.wh64.net/muffin/goMuffin/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
const MUFFIN_VERSION = "0.0.0-souffle_canary.250525a-componentsv2"
|
const MUFFIN_VERSION = "0.0.0-souffle_canary.250525a"
|
||||||
|
|
||||||
var updatedString string = utils.RegexpDecimals.FindAllStringSubmatch(MUFFIN_VERSION, -1)[3][0]
|
var updatedString string = utils.RegexpDecimals.FindAllStringSubmatch(MUFFIN_VERSION, -1)[3][0]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue