Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sends a DM to the user on thread create #7

Open
EthanThatOneKid opened this issue Sep 27, 2023 · 3 comments · Fixed by #8
Open

Sends a DM to the user on thread create #7

EthanThatOneKid opened this issue Sep 27, 2023 · 3 comments · Fixed by #8
Assignees
Labels
bug Something isn't working

Comments

@EthanThatOneKid
Copy link
Contributor

Unexpected behavior

The Sendlimiter bot sends DMs to the individual if their message is deleted. However, Sendlimiter tries to send DMs for some message that are not deleted.

Desired behavior

Only send DMs of a deleted message.

Strategy

Attempt to execute the message delete operation before attempting to send a DM.

Relevant code location

sendlimiter/main.go

Lines 51 to 73 in 0d28108

// Send a DM to the user.
channel, err := s.CreatePrivateChannel(m.Author.ID)
if err != nil {
log.Println("Failed to create private channel:", err)
return
}
if _, err := s.SendMessageComplex(channel.ID, api.SendMessageData{
Content: "Please attach an image or a link to a showcase channel.",
}); err != nil {
log.Println("Failed to send message:", err)
}
if _, err := s.SendMessageComplex(channel.ID, api.SendMessageData{
Content: m.Content,
}); err != nil {
log.Println("Failed to send message:", err)
}
// Delete the message.
if err := s.DeleteMessage(m.ChannelID, m.ID, "No attachments"); err != nil {
log.Println("Failed to delete message:", err)
}

@EthanThatOneKid EthanThatOneKid added the bug Something isn't working label Sep 27, 2023
@EthanThatOneKid EthanThatOneKid self-assigned this Sep 27, 2023
@EthanThatOneKid
Copy link
Contributor Author

Suggested PR title: Attempt message delete before DM.

@EthanThatOneKid EthanThatOneKid changed the title Attempt message delete before DM DMs on thread creation Sep 27, 2023
@EthanThatOneKid EthanThatOneKid changed the title DMs on thread creation Sends a DM to the user on thread create Sep 27, 2023
@EthanThatOneKid
Copy link
Contributor Author

The suggested strategy was implemented as part of #8, but unfortunately did not work as expected and is now deleting messages without our consent.

image

image

cc @karnikaavelumani

@EthanThatOneKid
Copy link
Contributor Author

The suggested strategy was implemented as part of #8, but unfortunately did not work as expected and is now deleting messages without our consent.

image

image

cc @karnikaavelumani

As a result, we've rolled back the merge in ef74f8e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant