feat: add knowledge length limit

This commit is contained in:
Siwoo Jeon 2025-05-22 19:07:39 +09:00
parent b573016d0e
commit dc57303dfa
Signed by: migan
GPG key ID: 036E9A8C5E8E48DA

View file

@ -173,6 +173,23 @@ func learnRun(c *Command, s *discordgo.Session, m any, args *[]string) {
}
}
if len([]rune(command)) > 100 {
embed := &discordgo.MessageEmbed{
Title: "❌ 오류",
Description: "단어는 100글자를 못 넘ㅇ어가요.",
Color: utils.EmbedFail,
}
switch m := m.(type) {
case *discordgo.MessageCreate:
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
case *utils.InteractionCreate:
m.EditReply(&discordgo.WebhookEdit{
Embeds: &[]*discordgo.MessageEmbed{embed},
})
}
}
_, err := databases.Database.Learns.InsertOne(context.TODO(), databases.InsertLearn{
Command: command,
Result: result,