Compare commits
No commits in common. "9b32aaf5814d1c238b024867484a023ebd8f6d50" and "a6b42b79dfb276d9b0d1ea4b9372747a6e01a042" have entirely different histories.
9b32aaf581
...
a6b42b79df
17 changed files with 201 additions and 240 deletions
|
@ -66,6 +66,8 @@ func getLength(data dataType, coll *mongo.Collection, filter bson.D) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func dataLengthRun(s *discordgo.Session, m any) {
|
func dataLengthRun(s *discordgo.Session, m any) {
|
||||||
|
var i *discordgo.Interaction
|
||||||
|
var referance *discordgo.MessageReference
|
||||||
var username, userId, channelId string
|
var username, userId, channelId string
|
||||||
var textLength,
|
var textLength,
|
||||||
muffinLength,
|
muffinLength,
|
||||||
|
@ -78,11 +80,19 @@ func dataLengthRun(s *discordgo.Session, m any) {
|
||||||
username = m.Author.Username
|
username = m.Author.Username
|
||||||
userId = m.Author.ID
|
userId = m.Author.ID
|
||||||
channelId = m.ChannelID
|
channelId = m.ChannelID
|
||||||
case *utils.InteractionCreate:
|
referance = m.Reference()
|
||||||
m.DeferReply(true)
|
case *discordgo.InteractionCreate:
|
||||||
username = m.Member.User.Username
|
username = m.Member.User.Username
|
||||||
userId = m.Member.User.ID
|
userId = m.Member.User.ID
|
||||||
channelId = m.ChannelID
|
channelId = m.ChannelID
|
||||||
|
i = m.Interaction
|
||||||
|
s.InteractionRespond(i,
|
||||||
|
&discordgo.InteractionResponse{
|
||||||
|
Type: discordgo.InteractionResponseDeferredChannelMessageWithSource,
|
||||||
|
Data: &discordgo.InteractionResponseData{
|
||||||
|
Flags: discordgo.MessageFlagsEphemeral,
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
go getLength(text, databases.Texts, bson.D{{}})
|
go getLength(text, databases.Texts, bson.D{{}})
|
||||||
|
@ -122,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: utils.EmbedDefault,
|
Color: int(utils.EDefault),
|
||||||
Fields: []*discordgo.MessageEmbedField{
|
Fields: []*discordgo.MessageEmbedField{
|
||||||
{
|
{
|
||||||
Name: "총 채팅 데이터량",
|
Name: "총 채팅 데이터량",
|
||||||
|
@ -151,11 +161,11 @@ func dataLengthRun(s *discordgo.Session, m any) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
switch m := m.(type) {
|
switch m.(type) {
|
||||||
case *discordgo.MessageCreate:
|
case *discordgo.MessageCreate:
|
||||||
s.ChannelMessageSendEmbedReply(channelId, embed, m.Reference())
|
s.ChannelMessageSendEmbedReply(channelId, embed, referance)
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.EditReply(&discordgo.WebhookEdit{
|
s.InteractionResponseEdit(i, &discordgo.WebhookEdit{
|
||||||
Embeds: &[]*discordgo.MessageEmbed{embed},
|
Embeds: &[]*discordgo.MessageEmbed{embed},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"git.wh64.net/muffin/goMuffin/utils"
|
"git.wh64.net/muffin/goMuffin/utils"
|
||||||
"github.com/bwmarrin/discordgo"
|
"github.com/bwmarrin/discordgo"
|
||||||
"go.mongodb.org/mongo-driver/v2/bson"
|
"go.mongodb.org/mongo-driver/v2/bson"
|
||||||
|
"go.mongodb.org/mongo-driver/v2/mongo"
|
||||||
)
|
)
|
||||||
|
|
||||||
var DeleteLearnedDataCommand *Command = &Command{
|
var DeleteLearnedDataCommand *Command = &Command{
|
||||||
|
@ -60,16 +61,25 @@ func deleteLearnedDataRun(c *Command, s *discordgo.Session, m any, args *[]strin
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "예시",
|
Name: "예시",
|
||||||
Value: utils.CodeBlock("md", strings.Join(addPrefix(c.DetailedDescription.Examples), "\n")),
|
Value: utils.CodeBlockWithLanguage("md", strings.Join(addPrefix(c.DetailedDescription.Examples), "\n")),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Color: utils.EmbedFail,
|
Color: int(utils.EFail),
|
||||||
}, m.Reference())
|
}, m.Reference())
|
||||||
}
|
}
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.DeferReply(true)
|
s.InteractionRespond(m.Interaction, &discordgo.InteractionResponse{
|
||||||
|
Type: discordgo.InteractionResponseDeferredChannelMessageWithSource,
|
||||||
|
Data: &discordgo.InteractionResponseData{
|
||||||
|
Flags: discordgo.MessageFlagsEphemeral,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
if opt, ok := m.Options["단어"]; ok {
|
optsMap := map[string]*discordgo.ApplicationCommandInteractionDataOption{}
|
||||||
|
for _, opt := range m.ApplicationCommandData().Options {
|
||||||
|
optsMap[opt.Name] = opt
|
||||||
|
}
|
||||||
|
if opt, ok := optsMap["단어"]; ok {
|
||||||
command = opt.StringValue()
|
command = opt.StringValue()
|
||||||
}
|
}
|
||||||
userId = m.Member.User.ID
|
userId = m.Member.User.ID
|
||||||
|
@ -78,16 +88,28 @@ func deleteLearnedDataRun(c *Command, s *discordgo.Session, m any, args *[]strin
|
||||||
cur, err := databases.Learns.Find(context.TODO(), bson.M{"user_id": userId, "command": command})
|
cur, err := databases.Learns.Find(context.TODO(), bson.M{"user_id": userId, "command": command})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
embed := &discordgo.MessageEmbed{
|
embed := &discordgo.MessageEmbed{
|
||||||
Title: "❌ 오류",
|
Title: "❌ 오류",
|
||||||
Description: "데이터를 가져오는데 실패했어요.",
|
Color: int(utils.EFail),
|
||||||
Color: utils.EmbedFail,
|
}
|
||||||
|
if err == mongo.ErrNoDocuments {
|
||||||
|
embed.Description = "해당 하는 지식ㅇ을 찾을 수 없어요."
|
||||||
|
switch m := m.(type) {
|
||||||
|
case *discordgo.MessageCreate:
|
||||||
|
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
||||||
|
case *discordgo.InteractionCreate:
|
||||||
|
s.InteractionResponseEdit(m.Interaction, &discordgo.WebhookEdit{
|
||||||
|
Embeds: &[]*discordgo.MessageEmbed{embed},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
embed.Description = "데이터를 가져오는데 실패했어요."
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
case *discordgo.MessageCreate:
|
case *discordgo.MessageCreate:
|
||||||
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.EditReply(&discordgo.WebhookEdit{
|
s.InteractionResponseEdit(m.Interaction, &discordgo.WebhookEdit{
|
||||||
Embeds: &[]*discordgo.MessageEmbed{embed},
|
Embeds: &[]*discordgo.MessageEmbed{embed},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -96,24 +118,6 @@ func deleteLearnedDataRun(c *Command, s *discordgo.Session, m any, args *[]strin
|
||||||
|
|
||||||
cur.All(context.TODO(), &datas)
|
cur.All(context.TODO(), &datas)
|
||||||
|
|
||||||
if len(datas) < 1 {
|
|
||||||
embed := &discordgo.MessageEmbed{
|
|
||||||
Title: "❌ 오류",
|
|
||||||
Description: "해당 하는 지식ㅇ을 찾을 수 없어요.",
|
|
||||||
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},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := range len(datas) {
|
for i := range len(datas) {
|
||||||
data := datas[i]
|
data := datas[i]
|
||||||
|
|
||||||
|
@ -127,8 +131,8 @@ 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.CodeBlock("md", fmt.Sprintf("# %s에 대한 대답 중 하나를 선ㅌ택하여 삭제해주세요.\n%s", command, description)),
|
Description: utils.CodeBlockWithLanguage("md", fmt.Sprintf("# %s에 대한 대답 중 하나를 선ㅌ택하여 삭제해주세요.\n%s", command, description)),
|
||||||
Color: utils.EmbedDefault,
|
Color: int(utils.EDefault),
|
||||||
}
|
}
|
||||||
|
|
||||||
components := []discordgo.MessageComponent{
|
components := []discordgo.MessageComponent{
|
||||||
|
@ -161,8 +165,8 @@ func deleteLearnedDataRun(c *Command, s *discordgo.Session, m any, args *[]strin
|
||||||
Components: components,
|
Components: components,
|
||||||
Reference: m.Reference(),
|
Reference: m.Reference(),
|
||||||
})
|
})
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.EditReply(&discordgo.WebhookEdit{
|
s.InteractionResponseEdit(m.Interaction, &discordgo.WebhookEdit{
|
||||||
Embeds: &[]*discordgo.MessageEmbed{embed},
|
Embeds: &[]*discordgo.MessageEmbed{embed},
|
||||||
Components: &components,
|
Components: &components,
|
||||||
})
|
})
|
||||||
|
|
|
@ -3,7 +3,6 @@ package commands
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"git.wh64.net/muffin/goMuffin/utils"
|
|
||||||
"github.com/bwmarrin/discordgo"
|
"github.com/bwmarrin/discordgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -43,13 +42,13 @@ type MsgContext struct {
|
||||||
|
|
||||||
type ChatInputContext struct {
|
type ChatInputContext struct {
|
||||||
Session *discordgo.Session
|
Session *discordgo.Session
|
||||||
Inter *utils.InteractionCreate
|
Inter *discordgo.InteractionCreate
|
||||||
Command *Command
|
Command *Command
|
||||||
}
|
}
|
||||||
|
|
||||||
type ComponentContext struct {
|
type ComponentContext struct {
|
||||||
Session *discordgo.Session
|
Session *discordgo.Session
|
||||||
Inter *utils.InteractionCreate
|
Inter *discordgo.InteractionCreate
|
||||||
Component *Component
|
Component *Component
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,27 +104,16 @@ func (d *DiscommandStruct) ChatInputRun(name string, s *discordgo.Session, i *di
|
||||||
if command == nil {
|
if command == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
command.ChatInputRun(&ChatInputContext{s, &utils.InteractionCreate{
|
command.ChatInputRun(&ChatInputContext{s, i, command})
|
||||||
InteractionCreate: i,
|
|
||||||
Session: s,
|
|
||||||
Options: utils.GetInteractionOptions(i),
|
|
||||||
}, command})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DiscommandStruct) ComponentRun(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
func (d *DiscommandStruct) ComponentRun(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
for _, c := range d.Components {
|
for _, c := range d.Components {
|
||||||
if (!c.Parse(&ComponentContext{s, &utils.InteractionCreate{
|
if (!c.Parse(&ComponentContext{s, i, c})) {
|
||||||
InteractionCreate: i,
|
return
|
||||||
Session: s,
|
|
||||||
}, c})) {
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Run(&ComponentContext{s, &utils.InteractionCreate{
|
c.Run(&ComponentContext{s, i, c})
|
||||||
InteractionCreate: i,
|
|
||||||
Session: s,
|
|
||||||
}, c})
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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: utils.EmbedDefault,
|
Color: int(utils.EDefault),
|
||||||
Footer: &discordgo.MessageEmbedFooter{
|
Footer: &discordgo.MessageEmbedFooter{
|
||||||
Text: fmt.Sprintf("버전: %s", configs.MUFFIN_VERSION),
|
Text: fmt.Sprintf("버전: %s", configs.MUFFIN_VERSION),
|
||||||
},
|
},
|
||||||
|
@ -72,17 +72,19 @@ func helpRun(c *Command, s *discordgo.Session, m any, args *[]string) {
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
case *discordgo.MessageCreate:
|
case *discordgo.MessageCreate:
|
||||||
commandName = Discommand.Aliases[strings.Join(*args, " ")]
|
commandName = Discommand.Aliases[strings.Join(*args, " ")]
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
if opt, ok := m.Options["도움말"]; ok {
|
optsMap := map[string]*discordgo.ApplicationCommandInteractionDataOption{}
|
||||||
|
for _, opt := range m.ApplicationCommandData().Options {
|
||||||
|
optsMap[opt.Name] = opt
|
||||||
|
}
|
||||||
|
if opt, ok := optsMap["명령어"]; ok {
|
||||||
commandName = opt.StringValue()
|
commandName = opt.StringValue()
|
||||||
} else {
|
|
||||||
commandName = ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if commandName == "" || Discommand.Commands[commandName] == nil {
|
if commandName == "" || Discommand.Commands[commandName] == nil {
|
||||||
embed.Title = fmt.Sprintf("%s의 도움말", s.State.User.Username)
|
embed.Title = fmt.Sprintf("%s의 도움말", s.State.User.Username)
|
||||||
embed.Description = utils.CodeBlock(
|
embed.Description = utils.CodeBlockWithLanguage(
|
||||||
"md",
|
"md",
|
||||||
fmt.Sprintf("# 일반\n%s\n\n# 채팅\n%s",
|
fmt.Sprintf("# 일반\n%s\n\n# 채팅\n%s",
|
||||||
strings.Join(getCommandsByCategory(Discommand, Generals), "\n"),
|
strings.Join(getCommandsByCategory(Discommand, Generals), "\n"),
|
||||||
|
@ -92,9 +94,12 @@ func helpRun(c *Command, s *discordgo.Session, m any, args *[]string) {
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
case *discordgo.MessageCreate:
|
case *discordgo.MessageCreate:
|
||||||
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.Reply(&discordgo.InteractionResponseData{
|
s.InteractionRespond(m.Interaction, &discordgo.InteractionResponse{
|
||||||
Embeds: []*discordgo.MessageEmbed{embed},
|
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||||
|
Data: &discordgo.InteractionResponseData{
|
||||||
|
Embeds: []*discordgo.MessageEmbed{embed},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -119,7 +124,7 @@ func helpRun(c *Command, s *discordgo.Session, m any, args *[]string) {
|
||||||
if command.Aliases != nil {
|
if command.Aliases != nil {
|
||||||
embed.Fields = append(embed.Fields, &discordgo.MessageEmbedField{
|
embed.Fields = append(embed.Fields, &discordgo.MessageEmbedField{
|
||||||
Name: "별칭",
|
Name: "별칭",
|
||||||
Value: utils.CodeBlock("md", strings.Join(addPrefix(command.Aliases), "\n")),
|
Value: utils.CodeBlockWithLanguage("md", strings.Join(addPrefix(command.Aliases), "\n")),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
embed.Fields = append(embed.Fields, &discordgo.MessageEmbedField{
|
embed.Fields = append(embed.Fields, &discordgo.MessageEmbedField{
|
||||||
|
@ -131,7 +136,7 @@ func helpRun(c *Command, s *discordgo.Session, m any, args *[]string) {
|
||||||
if command.DetailedDescription.Examples != nil {
|
if command.DetailedDescription.Examples != nil {
|
||||||
embed.Fields = append(embed.Fields, &discordgo.MessageEmbedField{
|
embed.Fields = append(embed.Fields, &discordgo.MessageEmbedField{
|
||||||
Name: "예시",
|
Name: "예시",
|
||||||
Value: utils.CodeBlock("md", strings.Join(addPrefix(c.DetailedDescription.Examples), "\n")),
|
Value: utils.CodeBlockWithLanguage("md", strings.Join(addPrefix(c.DetailedDescription.Examples), "\n")),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
embed.Fields = append(embed.Fields, &discordgo.MessageEmbedField{
|
embed.Fields = append(embed.Fields, &discordgo.MessageEmbedField{
|
||||||
|
@ -143,9 +148,12 @@ func helpRun(c *Command, s *discordgo.Session, m any, args *[]string) {
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
case *discordgo.MessageCreate:
|
case *discordgo.MessageCreate:
|
||||||
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.Reply(&discordgo.InteractionResponseData{
|
s.InteractionRespond(m.Interaction, &discordgo.InteractionResponse{
|
||||||
Embeds: []*discordgo.MessageEmbed{embed},
|
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||||
|
Data: &discordgo.InteractionResponseData{
|
||||||
|
Embeds: []*discordgo.MessageEmbed{embed},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,16 +45,16 @@ func informationRun(s *discordgo.Session, m any) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "최근에 업데이트된 날짜",
|
Name: "최근에 업데이트된 날짜",
|
||||||
Value: utils.Time(configs.UpdatedAt, utils.RelativeTime),
|
Value: utils.TimeWithStyle(configs.UpdatedAt, utils.RelativeTime),
|
||||||
Inline: true,
|
Inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "업타임",
|
Name: "업타임",
|
||||||
Value: utils.Time(configs.StartedAt, utils.RelativeTime),
|
Value: utils.TimeWithStyle(configs.StartedAt, utils.RelativeTime),
|
||||||
Inline: true,
|
Inline: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Color: utils.EmbedDefault,
|
Color: int(utils.EDefault),
|
||||||
Thumbnail: &discordgo.MessageEmbedThumbnail{
|
Thumbnail: &discordgo.MessageEmbedThumbnail{
|
||||||
URL: s.State.User.AvatarURL("512"),
|
URL: s.State.User.AvatarURL("512"),
|
||||||
},
|
},
|
||||||
|
@ -63,9 +63,12 @@ func informationRun(s *discordgo.Session, m any) {
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
case *discordgo.MessageCreate:
|
case *discordgo.MessageCreate:
|
||||||
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.Reply(&discordgo.InteractionResponseData{
|
s.InteractionRespond(m.Interaction, &discordgo.InteractionResponse{
|
||||||
Embeds: []*discordgo.MessageEmbed{embed},
|
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||||
|
Data: &discordgo.InteractionResponseData{
|
||||||
|
Embeds: []*discordgo.MessageEmbed{embed},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,26 +97,36 @@ func learnRun(c *Command, s *discordgo.Session, m any, args *[]string) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "예시",
|
Name: "예시",
|
||||||
Value: utils.CodeBlock("md", strings.Join(addPrefix(c.DetailedDescription.Examples), "\n")),
|
Value: utils.CodeBlockWithLanguage("md", strings.Join(addPrefix(c.DetailedDescription.Examples), "\n")),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Color: utils.EmbedFail,
|
Color: int(utils.EFail),
|
||||||
}, m.Reference())
|
}, m.Reference())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
command = strings.ReplaceAll((*args)[0], "_", " ")
|
command = strings.ReplaceAll((*args)[0], "_", " ")
|
||||||
result = strings.ReplaceAll((*args)[1], "_", " ")
|
result = strings.ReplaceAll((*args)[1], "_", " ")
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.DeferReply(true)
|
s.InteractionRespond(m.Interaction, &discordgo.InteractionResponse{
|
||||||
|
Type: discordgo.InteractionResponseDeferredChannelMessageWithSource,
|
||||||
|
Data: &discordgo.InteractionResponseData{
|
||||||
|
Flags: discordgo.MessageFlagsEphemeral,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
userId = m.Member.User.ID
|
userId = m.Member.User.ID
|
||||||
|
|
||||||
if opt, ok := m.Options["단어"]; ok {
|
optsMap := map[string]*discordgo.ApplicationCommandInteractionDataOption{}
|
||||||
|
for _, opt := range m.ApplicationCommandData().Options {
|
||||||
|
optsMap[opt.Name] = opt
|
||||||
|
}
|
||||||
|
|
||||||
|
if opt, ok := optsMap["단어"]; ok {
|
||||||
command = opt.StringValue()
|
command = opt.StringValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
if opt, ok := m.Options["대답"]; ok {
|
if opt, ok := optsMap["대답"]; ok {
|
||||||
result = opt.StringValue()
|
result = opt.StringValue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,14 +150,14 @@ func learnRun(c *Command, s *discordgo.Session, m any, args *[]string) {
|
||||||
embed := &discordgo.MessageEmbed{
|
embed := &discordgo.MessageEmbed{
|
||||||
Title: "❌ 오류",
|
Title: "❌ 오류",
|
||||||
Description: "해ㄷ당 단어는 배우기 껄끄ㄹ럽네요.",
|
Description: "해ㄷ당 단어는 배우기 껄끄ㄹ럽네요.",
|
||||||
Color: utils.EmbedFail,
|
Color: int(utils.EFail),
|
||||||
}
|
}
|
||||||
|
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
case *discordgo.MessageCreate:
|
case *discordgo.MessageCreate:
|
||||||
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.EditReply(&discordgo.WebhookEdit{
|
s.InteractionResponseEdit(m.Interaction, &discordgo.WebhookEdit{
|
||||||
Embeds: &[]*discordgo.MessageEmbed{embed},
|
Embeds: &[]*discordgo.MessageEmbed{embed},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -160,14 +170,14 @@ func learnRun(c *Command, s *discordgo.Session, m any, args *[]string) {
|
||||||
embed := &discordgo.MessageEmbed{
|
embed := &discordgo.MessageEmbed{
|
||||||
Title: "❌ 오류",
|
Title: "❌ 오류",
|
||||||
Description: "해당 단ㅇ어의 대답으로 하기 좀 그렇ㄴ네요.",
|
Description: "해당 단ㅇ어의 대답으로 하기 좀 그렇ㄴ네요.",
|
||||||
Color: utils.EmbedFail,
|
Color: int(utils.EFail),
|
||||||
}
|
}
|
||||||
|
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
case *discordgo.MessageCreate:
|
case *discordgo.MessageCreate:
|
||||||
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.EditReply(&discordgo.WebhookEdit{
|
s.InteractionResponseEdit(m.Interaction, &discordgo.WebhookEdit{
|
||||||
Embeds: &[]*discordgo.MessageEmbed{embed},
|
Embeds: &[]*discordgo.MessageEmbed{embed},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -185,14 +195,14 @@ func learnRun(c *Command, s *discordgo.Session, m any, args *[]string) {
|
||||||
embed := &discordgo.MessageEmbed{
|
embed := &discordgo.MessageEmbed{
|
||||||
Title: "❌ 오류",
|
Title: "❌ 오류",
|
||||||
Description: "단어를 배우는데 오류가 생겼어요.",
|
Description: "단어를 배우는데 오류가 생겼어요.",
|
||||||
Color: utils.EmbedFail,
|
Color: int(utils.EFail),
|
||||||
}
|
}
|
||||||
|
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
case *discordgo.MessageCreate:
|
case *discordgo.MessageCreate:
|
||||||
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.EditReply(&discordgo.WebhookEdit{
|
s.InteractionResponseEdit(m.Interaction, &discordgo.WebhookEdit{
|
||||||
Embeds: &[]*discordgo.MessageEmbed{embed},
|
Embeds: &[]*discordgo.MessageEmbed{embed},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -202,14 +212,14 @@ 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: utils.EmbedSuccess,
|
Color: int(utils.ESuccess),
|
||||||
}
|
}
|
||||||
|
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
case *discordgo.MessageCreate:
|
case *discordgo.MessageCreate:
|
||||||
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.EditReply(&discordgo.WebhookEdit{
|
s.InteractionResponseEdit(m.Interaction, &discordgo.WebhookEdit{
|
||||||
Embeds: &[]*discordgo.MessageEmbed{embed},
|
Embeds: &[]*discordgo.MessageEmbed{embed},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,8 +47,13 @@ func learnedDataListRun(s *discordgo.Session, m any) {
|
||||||
userId = m.Author.ID
|
userId = m.Author.ID
|
||||||
globalName = m.Author.GlobalName
|
globalName = m.Author.GlobalName
|
||||||
avatarUrl = m.Author.AvatarURL("512")
|
avatarUrl = m.Author.AvatarURL("512")
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.DeferReply(true)
|
s.InteractionRespond(m.Interaction, &discordgo.InteractionResponse{
|
||||||
|
Type: discordgo.InteractionResponseDeferredChannelMessageWithSource,
|
||||||
|
Data: &discordgo.InteractionResponseData{
|
||||||
|
Flags: discordgo.MessageFlagsEphemeral,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
userId = m.Member.User.ID
|
userId = m.Member.User.ID
|
||||||
globalName = m.Member.User.GlobalName
|
globalName = m.Member.User.GlobalName
|
||||||
|
@ -61,14 +66,14 @@ func learnedDataListRun(s *discordgo.Session, m any) {
|
||||||
embed := &discordgo.MessageEmbed{
|
embed := &discordgo.MessageEmbed{
|
||||||
Title: "❌ 오류",
|
Title: "❌ 오류",
|
||||||
Description: "당신은 지식ㅇ을 가르쳐준 적이 없어요!",
|
Description: "당신은 지식ㅇ을 가르쳐준 적이 없어요!",
|
||||||
Color: utils.EmbedFail,
|
Color: int(utils.EFail),
|
||||||
}
|
}
|
||||||
|
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
case *discordgo.MessageCreate:
|
case *discordgo.MessageCreate:
|
||||||
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.EditReply(&discordgo.WebhookEdit{
|
s.InteractionResponseEdit(m.Interaction, &discordgo.WebhookEdit{
|
||||||
Embeds: &[]*discordgo.MessageEmbed{embed},
|
Embeds: &[]*discordgo.MessageEmbed{embed},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -79,14 +84,14 @@ func learnedDataListRun(s *discordgo.Session, m any) {
|
||||||
embed := &discordgo.MessageEmbed{
|
embed := &discordgo.MessageEmbed{
|
||||||
Title: "❌ 오류",
|
Title: "❌ 오류",
|
||||||
Description: "데이터를 가져오는데 실패했어요.",
|
Description: "데이터를 가져오는데 실패했어요.",
|
||||||
Color: utils.EmbedFail,
|
Color: int(utils.EFail),
|
||||||
}
|
}
|
||||||
|
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
case *discordgo.MessageCreate:
|
case *discordgo.MessageCreate:
|
||||||
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.EditReply(&discordgo.WebhookEdit{
|
s.InteractionResponseEdit(m.Interaction, &discordgo.WebhookEdit{
|
||||||
Embeds: &[]*discordgo.MessageEmbed{embed},
|
Embeds: &[]*discordgo.MessageEmbed{embed},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -99,8 +104,8 @@ 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.CodeBlock("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: utils.EmbedDefault,
|
Color: int(utils.EDefault),
|
||||||
Thumbnail: &discordgo.MessageEmbedThumbnail{
|
Thumbnail: &discordgo.MessageEmbedThumbnail{
|
||||||
URL: avatarUrl,
|
URL: avatarUrl,
|
||||||
},
|
},
|
||||||
|
@ -109,8 +114,8 @@ func learnedDataListRun(s *discordgo.Session, m any) {
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
case *discordgo.MessageCreate:
|
case *discordgo.MessageCreate:
|
||||||
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
s.ChannelMessageSendEmbedReply(m.ChannelID, embed, m.Reference())
|
||||||
case *utils.InteractionCreate:
|
case *discordgo.InteractionCreate:
|
||||||
m.EditReply(&discordgo.WebhookEdit{
|
s.InteractionResponseEdit(m.Interaction, &discordgo.WebhookEdit{
|
||||||
Embeds: &[]*discordgo.MessageEmbed{embed},
|
Embeds: &[]*discordgo.MessageEmbed{embed},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ var DeleteLearnedDataComponent *commands.Component = &commands.Component{
|
||||||
Parse: func(ctx *commands.ComponentContext) bool {
|
Parse: func(ctx *commands.ComponentContext) bool {
|
||||||
var userId string
|
var userId string
|
||||||
i := ctx.Inter
|
i := ctx.Inter
|
||||||
|
s := ctx.Session
|
||||||
customId := i.MessageComponentData().CustomID
|
customId := i.MessageComponentData().CustomID
|
||||||
|
|
||||||
if i.MessageComponentData().ComponentType == discordgo.ButtonComponent {
|
if i.MessageComponentData().ComponentType == discordgo.ButtonComponent {
|
||||||
|
@ -24,18 +25,6 @@ var DeleteLearnedDataComponent *commands.Component = &commands.Component{
|
||||||
}
|
}
|
||||||
|
|
||||||
userId = customId[len(utils.DeleteLearnedDataCancel):]
|
userId = customId[len(utils.DeleteLearnedDataCancel):]
|
||||||
if i.Member.User.ID == userId {
|
|
||||||
i.Update(&discordgo.InteractionResponseData{
|
|
||||||
Embeds: []*discordgo.MessageEmbed{
|
|
||||||
{
|
|
||||||
Title: "❌ 취소",
|
|
||||||
Description: "지식 삭제 작업ㅇ을 취소했어요.",
|
|
||||||
Color: utils.EmbedFail,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if !strings.HasPrefix(customId, utils.DeleteLearnedDataUserId) {
|
if !strings.HasPrefix(customId, utils.DeleteLearnedDataUserId) {
|
||||||
return false
|
return false
|
||||||
|
@ -45,38 +34,43 @@ var DeleteLearnedDataComponent *commands.Component = &commands.Component{
|
||||||
}
|
}
|
||||||
|
|
||||||
if i.Member.User.ID != userId {
|
if i.Member.User.ID != userId {
|
||||||
i.Reply(&discordgo.InteractionResponseData{
|
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||||
Flags: discordgo.MessageFlagsEphemeral,
|
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||||
Embeds: []*discordgo.MessageEmbed{
|
Data: &discordgo.InteractionResponseData{
|
||||||
{
|
Flags: discordgo.MessageFlagsEphemeral,
|
||||||
Title: "❌ 오류",
|
Embeds: []*discordgo.MessageEmbed{
|
||||||
Description: "당신은 해당 권한이 없ㅇ어요.",
|
{
|
||||||
Color: utils.EmbedFail,
|
Title: "❌ 오류",
|
||||||
|
Description: "당신은 해당 권한이 없ㅇ어요.",
|
||||||
|
Color: int(utils.EFail),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
Components: []discordgo.MessageComponent{},
|
||||||
},
|
},
|
||||||
Components: []discordgo.MessageComponent{},
|
})
|
||||||
},
|
|
||||||
)
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
Run: func(ctx *commands.ComponentContext) {
|
Run: func(ctx *commands.ComponentContext) {
|
||||||
i := ctx.Inter
|
i := ctx.Inter
|
||||||
|
s := ctx.Session
|
||||||
|
|
||||||
i.DeferUpdate()
|
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||||
|
Type: discordgo.InteractionResponseDeferredMessageUpdate,
|
||||||
|
})
|
||||||
|
|
||||||
id, _ := bson.ObjectIDFromHex(strings.ReplaceAll(utils.ItemIdRegexp.ReplaceAllString(i.MessageComponentData().Values[0][len(utils.DeleteLearnedData):], ""), "&", ""))
|
id, _ := bson.ObjectIDFromHex(strings.ReplaceAll(utils.ItemIdRegexp.ReplaceAllString(i.MessageComponentData().Values[0][len(utils.DeleteLearnedData):], ""), "&", ""))
|
||||||
itemId := strings.ReplaceAll(utils.ItemIdRegexp.FindAllString(i.MessageComponentData().Values[0], 1)[0], "No.", "")
|
itemId := strings.ReplaceAll(utils.ItemIdRegexp.FindAllString(i.MessageComponentData().Values[0], 1)[0], "No.", "")
|
||||||
|
|
||||||
databases.Learns.DeleteOne(context.TODO(), bson.D{{Key: "_id", Value: id}})
|
databases.Learns.DeleteOne(context.TODO(), bson.D{{Key: "_id", Value: id}})
|
||||||
|
|
||||||
i.EditReply(&discordgo.WebhookEdit{
|
s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{
|
||||||
Embeds: &[]*discordgo.MessageEmbed{
|
Embeds: &[]*discordgo.MessageEmbed{
|
||||||
{
|
{
|
||||||
Title: "✅ 삭제 완료",
|
Title: "✅ 삭제 완료",
|
||||||
Description: fmt.Sprintf("%s번을 삭ㅈ제했어요.", itemId),
|
Description: fmt.Sprintf("%s번을 삭ㅈ제했어요.", itemId),
|
||||||
Color: utils.EmbedSuccess,
|
Color: int(utils.ESuccess),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Components: &[]discordgo.MessageComponent{},
|
Components: &[]discordgo.MessageComponent{},
|
||||||
|
|
|
@ -4,7 +4,7 @@ import "time"
|
||||||
|
|
||||||
var StartedAt *time.Time
|
var StartedAt *time.Time
|
||||||
|
|
||||||
func init() {
|
func TimeStart() {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
StartedAt = &now
|
StartedAt = &now
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"git.wh64.net/muffin/goMuffin/utils"
|
"git.wh64.net/muffin/goMuffin/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
const MUFFIN_VERSION = "5.0.0-gopher_preview.250405a"
|
const MUFFIN_VERSION = "5.0.0-gopher_dev.250404a"
|
||||||
|
|
||||||
var updatedString string = utils.Decimals.FindAllStringSubmatch(MUFFIN_VERSION, -1)[3][0]
|
var updatedString string = utils.Decimals.FindAllStringSubmatch(MUFFIN_VERSION, -1)[3][0]
|
||||||
|
|
||||||
|
|
14
go.mod
14
go.mod
|
@ -10,15 +10,15 @@ require (
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/golang/snappy v1.0.0 // indirect
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
github.com/gorilla/websocket v1.5.3 // indirect
|
github.com/gorilla/websocket v1.4.2 // indirect
|
||||||
github.com/klauspost/compress v1.18.0 // indirect
|
github.com/klauspost/compress v1.16.7 // indirect
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||||
github.com/xdg-go/scram v1.1.2 // indirect
|
github.com/xdg-go/scram v1.1.2 // indirect
|
||||||
github.com/xdg-go/stringprep v1.0.4 // indirect
|
github.com/xdg-go/stringprep v1.0.4 // indirect
|
||||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
|
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
|
||||||
golang.org/x/crypto v0.36.0 // indirect
|
golang.org/x/crypto v0.33.0 // indirect
|
||||||
golang.org/x/sync v0.12.0 // indirect
|
golang.org/x/sync v0.11.0 // indirect
|
||||||
golang.org/x/sys v0.31.0 // indirect
|
golang.org/x/sys v0.30.0 // indirect
|
||||||
golang.org/x/text v0.23.0 // indirect
|
golang.org/x/text v0.22.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
27
go.sum
27
go.sum
|
@ -4,17 +4,16 @@ github.com/bwmarrin/discordgo v0.28.1 h1:gXsuo2GBO7NbR6uqmrrBDplPUx2T3nzu775q/Rd
|
||||||
github.com/bwmarrin/discordgo v0.28.1/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY=
|
github.com/bwmarrin/discordgo v0.28.1/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs=
|
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||||
github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
|
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
|
||||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
|
||||||
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||||
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||||
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
|
||||||
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||||
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
|
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
|
||||||
|
@ -29,31 +28,31 @@ go.mongodb.org/mongo-driver/v2 v2.1.0/go.mod h1:AWiLRShSrk5RHQS3AEn3RL19rqOzVq49
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
|
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
|
||||||
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
|
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
|
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
|
||||||
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||||
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||||
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
|
||||||
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
|
|
|
@ -36,12 +36,12 @@ func resultParser(content string, s *discordgo.Session, m *discordgo.MessageCrea
|
||||||
result = strings.ReplaceAll(result, "{user.mention}", m.Author.Mention())
|
result = strings.ReplaceAll(result, "{user.mention}", m.Author.Mention())
|
||||||
result = strings.ReplaceAll(result, "{user.globalName}", m.Author.GlobalName)
|
result = strings.ReplaceAll(result, "{user.globalName}", m.Author.GlobalName)
|
||||||
result = strings.ReplaceAll(result, "{user.id}", m.Author.ID)
|
result = strings.ReplaceAll(result, "{user.id}", m.Author.ID)
|
||||||
result = strings.ReplaceAll(result, "{user.createdAt}", utils.Time(&userCreatedAt, utils.RelativeTime))
|
result = strings.ReplaceAll(result, "{user.createdAt}", utils.TimeWithStyle(&userCreatedAt, utils.RelativeTime))
|
||||||
result = strings.ReplaceAll(result, "{user.joinedAt}", utils.Time(&m.Member.JoinedAt, utils.RelativeTime))
|
result = strings.ReplaceAll(result, "{user.joinedAt}", utils.TimeWithStyle(&m.Member.JoinedAt, utils.RelativeTime))
|
||||||
|
|
||||||
result = strings.ReplaceAll(result, "{muffin.version}", configs.MUFFIN_VERSION)
|
result = strings.ReplaceAll(result, "{muffin.version}", configs.MUFFIN_VERSION)
|
||||||
result = strings.ReplaceAll(result, "{muffin.updatedAt}", utils.Time(configs.UpdatedAt, utils.RelativeTime))
|
result = strings.ReplaceAll(result, "{muffin.updatedAt}", utils.TimeWithStyle(configs.UpdatedAt, utils.RelativeTime))
|
||||||
result = strings.ReplaceAll(result, "{muffin.startedAt}", utils.Time(configs.StartedAt, utils.RelativeTime))
|
result = strings.ReplaceAll(result, "{muffin.startedAt}", utils.TimeWithStyle(configs.StartedAt, utils.RelativeTime))
|
||||||
result = strings.ReplaceAll(result, "{muffin.name}", s.State.User.Username)
|
result = strings.ReplaceAll(result, "{muffin.name}", s.State.User.Username)
|
||||||
result = strings.ReplaceAll(result, "{muffin.id}", s.State.User.ID)
|
result = strings.ReplaceAll(result, "{muffin.id}", s.State.User.ID)
|
||||||
return result
|
return result
|
||||||
|
|
12
main.go
12
main.go
|
@ -16,6 +16,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
configs.TimeStart()
|
||||||
config := configs.Config
|
config := configs.Config
|
||||||
|
|
||||||
dg, err := discordgo.New("Bot " + config.Bot.Token)
|
dg, err := discordgo.New("Bot " + config.Bot.Token)
|
||||||
|
@ -38,17 +39,16 @@ func main() {
|
||||||
|
|
||||||
dg.Open()
|
dg.Open()
|
||||||
|
|
||||||
for _, cmd := range commands.Discommand.Commands {
|
|
||||||
go dg.ApplicationCommandCreate(dg.State.User.ID, "", cmd.ApplicationCommand)
|
|
||||||
}
|
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
dg.Close()
|
if err := databases.Client.Disconnect(context.TODO()); err != nil {
|
||||||
databases.Client.Disconnect(context.TODO())
|
panic(err)
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
log.Println("[goMuffin] 봇이 실행되고 있어요. 버전:", configs.MUFFIN_VERSION)
|
log.Println("[goMuffin] 봇이 실행되고 있어요. 버전:", configs.MUFFIN_VERSION)
|
||||||
sc := make(chan os.Signal, 1)
|
sc := make(chan os.Signal, 1)
|
||||||
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt)
|
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt)
|
||||||
<-sc
|
<-sc
|
||||||
|
|
||||||
|
dg.Close()
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,16 +22,18 @@ func InlineCode(content string) string {
|
||||||
return fmt.Sprintf("`%s`", content)
|
return fmt.Sprintf("`%s`", content)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CodeBlock(language string, content string) string {
|
func CodeBlockWithLanguage(language string, content string) string {
|
||||||
if content == "" {
|
|
||||||
return fmt.Sprintf("```\n%s\n```", language)
|
|
||||||
}
|
|
||||||
return fmt.Sprintf("```%s\n%s\n```", language, content)
|
return fmt.Sprintf("```%s\n%s\n```", language, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Time(time *time.Time, style string) string {
|
func CodeBlock(content string) string {
|
||||||
if style == "" {
|
return fmt.Sprintf("```\n%s\n```", content)
|
||||||
return fmt.Sprintf("<t:%d>", time.Unix())
|
}
|
||||||
}
|
|
||||||
|
func Time(time *time.Time) string {
|
||||||
|
return fmt.Sprintf("<t:%d>", time.Unix())
|
||||||
|
}
|
||||||
|
|
||||||
|
func TimeWithStyle(time *time.Time, style string) string {
|
||||||
return fmt.Sprintf("<t:%d:%s>", time.Unix(), style)
|
return fmt.Sprintf("<t:%d:%s>", time.Unix(), style)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package utils
|
package utils
|
||||||
|
|
||||||
|
type EmbedColorType int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
EmbedDefault int = 0xaddb87
|
EDefault EmbedColorType = 0xaddb87
|
||||||
EmbedFail int = 0xff0000
|
EFail EmbedColorType = 0xff0000
|
||||||
EmbedSuccess int = 0x00ff00
|
ESuccess EmbedColorType = 0x00ff00
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
package utils
|
|
||||||
|
|
||||||
import "github.com/bwmarrin/discordgo"
|
|
||||||
|
|
||||||
// InteractionCreate custom data of discordgo.InteractionCreate
|
|
||||||
type InteractionCreate struct {
|
|
||||||
*discordgo.InteractionCreate
|
|
||||||
Session *discordgo.Session
|
|
||||||
// NOTE: It's only can ApplicationCommand
|
|
||||||
Options map[string]*discordgo.ApplicationCommandInteractionDataOption
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reply to this interaction.
|
|
||||||
func (i *InteractionCreate) Reply(data *discordgo.InteractionResponseData) {
|
|
||||||
i.Session.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
|
||||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
|
||||||
Data: data,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetInteractionOptions to this interaction.
|
|
||||||
// NOTE: It's only can ApplicationCommand
|
|
||||||
func GetInteractionOptions(i *discordgo.InteractionCreate) map[string]*discordgo.ApplicationCommandInteractionDataOption {
|
|
||||||
optsMap := map[string]*discordgo.ApplicationCommandInteractionDataOption{}
|
|
||||||
for _, opt := range i.ApplicationCommandData().Options {
|
|
||||||
optsMap[opt.Name] = opt
|
|
||||||
}
|
|
||||||
return optsMap
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeferReply to this interaction.
|
|
||||||
func (i *InteractionCreate) DeferReply(ephemeral bool) {
|
|
||||||
var flags discordgo.MessageFlags
|
|
||||||
if ephemeral {
|
|
||||||
flags = discordgo.MessageFlagsEphemeral
|
|
||||||
}
|
|
||||||
|
|
||||||
i.Session.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
|
||||||
Type: discordgo.InteractionResponseDeferredChannelMessageWithSource,
|
|
||||||
Data: &discordgo.InteractionResponseData{
|
|
||||||
Flags: flags,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeferUpdate to this interaction.
|
|
||||||
func (i *InteractionCreate) DeferUpdate() {
|
|
||||||
i.Session.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
|
||||||
Type: discordgo.InteractionResponseDeferredMessageUpdate,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// EditReply to this interaction.
|
|
||||||
func (i *InteractionCreate) EditReply(data *discordgo.WebhookEdit) {
|
|
||||||
i.Session.InteractionResponseEdit(i.Interaction, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update to this interaction.
|
|
||||||
func (i *InteractionCreate) Update(data *discordgo.InteractionResponseData) {
|
|
||||||
i.Session.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
|
||||||
Type: discordgo.InteractionResponseUpdateMessage,
|
|
||||||
Data: data,
|
|
||||||
})
|
|
||||||
}
|
|
Loading…
Reference in a new issue