add embed images

This commit is contained in:
Jack Merrill 2023-10-23 10:48:35 -04:00
parent 41eec1f536
commit 40f286f29d
No known key found for this signature in database
GPG Key ID: 2FD365A1E0C8E3C8
2 changed files with 18 additions and 0 deletions

View File

@ -38,6 +38,14 @@ func (l *MessageDeleteListener) Exec(s *discordgo.Session, e *discordgo.MessageD
Inline: true,
})
var image *discordgo.MessageEmbedImage
if len(msg.Attachments) > 0 {
image = &discordgo.MessageEmbedImage{
URL: msg.Attachments[0].URL,
}
}
_, err := s.ChannelMessageSendComplex(CHANNEL_ID, &discordgo.MessageSend{
Content: "Message deleted",
Embed: &discordgo.MessageEmbed{
@ -45,6 +53,7 @@ func (l *MessageDeleteListener) Exec(s *discordgo.Session, e *discordgo.MessageD
Description: msg.Content,
Fields: fields,
Color: 0xff0000,
Image: image,
},
})
if err != nil {

View File

@ -43,11 +43,20 @@ func (l *MessageEditListener) Exec(s *discordgo.Session, e *discordgo.MessageUpd
Inline: false,
})
var image *discordgo.MessageEmbedImage
if len(e.Attachments) > 0 {
image = &discordgo.MessageEmbedImage{
URL: e.Attachments[0].URL,
}
}
_, err := s.ChannelMessageSendComplex(CHANNEL_ID, &discordgo.MessageSend{
Embed: &discordgo.MessageEmbed{
Title: "Message edited",
Fields: fields,
Color: 0xffff00,
Image: image,
},
})