Skip to content

Commit

Permalink
Reply messages (type 19) should be deleted too
Browse files Browse the repository at this point in the history
  • Loading branch information
cedws committed May 6, 2021
1 parent 4216353 commit ab1c257
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Relationships:
for _, channel := range channels {
// If the relation is the sole recipient in one of the channels we found
// earlier, skip it.
if channel.Type == PrivateChannel && channel.Recipients[0].ID == relation.ID {
if channel.Type == DirectChannel && channel.Recipients[0].ID == relation.ID {
log.Debugf("Skipping resolving relation %v because the user already has the channel open", relation.ID)
continue Relationships
}
Expand Down Expand Up @@ -193,8 +193,8 @@ func (c *Client) DeleteMessages(messages *Messages, seek *int) error {

// The message might be an action rather than text. Actions aren't deletable.
// An example of an action is a call request.
if msg.Type != UserMessage {
log.Debugf("Found message of non-zero type, incrementing seek index")
if msg.Type != UserMessage && msg.Type != UserReply {
log.Debugf("Found message of type %v, seeking ahead", msg.Type)
(*seek)++
continue
}
Expand Down Expand Up @@ -328,12 +328,15 @@ func (c *Client) wait(res *http.Response, mult int) error {
return nil
}

// https://discord.com/developers/docs/resources/channel#message-object-message-types
const (
UserMessage = 0
UserReply = 19
)

// https://discord.com/developers/docs/resources/channel#channel-object-channel-types
const (
PrivateChannel = 1
DirectChannel = 1
)

type Me struct {
Expand Down

0 comments on commit ab1c257

Please sign in to comment.