Skip to content

Commit

Permalink
fix MessageUpdateBuilder.RetainAttachments not removing all attachmen…
Browse files Browse the repository at this point in the history
…ts when not proving any params
  • Loading branch information
topi314 committed Apr 12, 2024
1 parent c13ef9f commit 1254a6c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions discord/message_update_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (b *MessageUpdateBuilder) RemoveFile(i int) *MessageUpdateBuilder {
// RetainAttachments removes all Attachment(s) from this Message except the ones provided
func (b *MessageUpdateBuilder) RetainAttachments(attachments ...Attachment) *MessageUpdateBuilder {
if b.Attachments == nil {
b.Attachments = new([]AttachmentUpdate)
b.Attachments = &[]AttachmentUpdate{}
}
for _, attachment := range attachments {
*b.Attachments = append(*b.Attachments, AttachmentKeep{ID: attachment.ID})
Expand All @@ -188,7 +188,7 @@ func (b *MessageUpdateBuilder) RetainAttachments(attachments ...Attachment) *Mes
// RetainAttachmentsByID removes all Attachment(s) from this Message except the ones provided
func (b *MessageUpdateBuilder) RetainAttachmentsByID(attachmentIDs ...snowflake.ID) *MessageUpdateBuilder {
if b.Attachments == nil {
b.Attachments = new([]AttachmentUpdate)
b.Attachments = &[]AttachmentUpdate{}
}
for _, attachmentID := range attachmentIDs {
*b.Attachments = append(*b.Attachments, AttachmentKeep{ID: attachmentID})
Expand Down

0 comments on commit 1254a6c

Please sign in to comment.