feat: information command componentsV2

This commit is contained in:
Siwoo Jeon 2025-05-24 14:33:28 +09:00
parent b6ac950f2e
commit 35347edb85
Signed by: migan
GPG key ID: 036E9A8C5E8E48DA

View file

@ -2,7 +2,6 @@ package commands
import (
"fmt"
"runtime"
"git.wh64.net/muffin/goMuffin/configs"
"git.wh64.net/muffin/goMuffin/utils"
@ -29,37 +28,35 @@ var InformationCommand *Command = &Command{
func informationRun(s *discordgo.Session, m any) {
owner, _ := s.User(configs.Config.Bot.OwnerId)
utils.NewMessageSender(m).
AddEmbeds(&discordgo.MessageEmbed{
Title: fmt.Sprintf("%s의 정보", s.State.User.Username),
Fields: []*discordgo.MessageEmbedField{
{
Name: "운영 체제",
Value: utils.InlineCode(fmt.Sprintf("%s %s", runtime.GOARCH, runtime.GOOS)),
},
{
Name: "제작자",
Value: utils.InlineCode(owner.Username),
},
{
Name: "버전",
Value: utils.InlineCode(configs.MUFFIN_VERSION),
},
{
Name: "최근에 업데이트된 날짜",
Value: utils.Time(configs.UpdatedAt, utils.RelativeTime),
Inline: true,
},
{
Name: "시작한 시각",
Value: utils.Time(configs.StartedAt, utils.RelativeTime),
Inline: true,
},
},
Color: utils.EmbedDefault,
Thumbnail: &discordgo.MessageEmbedThumbnail{
AddComponents(discordgo.Container{
Components: []discordgo.MessageComponent{
discordgo.Section{
Accessory: discordgo.Thumbnail{
Media: discordgo.UnfurledMediaItem{
URL: s.State.User.AvatarURL("512"),
},
},
Components: []discordgo.MessageComponent{
discordgo.TextDisplay{
Content: fmt.Sprintf("### %s의 정보", s.State.User.Username),
},
discordgo.TextDisplay{
Content: fmt.Sprintf("- **제작자**\n> %s", owner.Username),
},
discordgo.TextDisplay{
Content: fmt.Sprintf("- **버전**\n> %s", configs.MUFFIN_VERSION),
},
},
},
discordgo.TextDisplay{
Content: fmt.Sprintf("- **최근에 업데이트된 날짜**\n> %s", utils.Time(configs.UpdatedAt, utils.RelativeTime)),
},
discordgo.TextDisplay{
Content: fmt.Sprintf("- **봇이 시작한 시각**\n> %s", utils.Time(configs.StartedAt, utils.RelativeTime)),
},
},
}).
SetComponentsV2(true).
SetReply(true).
Send()
}