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

Delete last X messages from user for moderation #912

Open
ankitsmt211 opened this issue Oct 15, 2023 · 6 comments · May be fixed by #982
Open

Delete last X messages from user for moderation #912

ankitsmt211 opened this issue Oct 15, 2023 · 6 comments · May be fixed by #982
Assignees
Labels
enhancement New feature or request

Comments

@ankitsmt211
Copy link
Member

Problem:
Sometimes you have a lot of messages from a user, that might not be appropriate or against the rules. Folks who write texts in smaller lengths, it can pile up to an "annoying no of deletes"

Possible solution:
Introduction of new command "/delete user nNoOfMessages", which deletes the most n messages from given user.

@ankitsmt211 ankitsmt211 added the enhancement New feature or request label Oct 15, 2023
@Zabuzard
Copy link
Member

Zabuzard commented Oct 16, 2023

In most cases that warrant mass-message-deletion, a (temporary) ban is warranted as well. Bans (including temp bans) already provide the functionality to purge messages.

But I still see how the command could be useful. Id advice to instead follow the UX of /ban and add options to purge messages based on time, not amount. For example:

  • last hour
  • last day
  • last 7 days

And to rename it to /purge, which is more idiomatic. In fact, there are some duplicates already: #17 #218 #238 #330
As you see, this command has been attempted thrice already 😆

@ankitsmt211
Copy link
Member Author

Interesting, I wonder what prevented the completion maybe too complex or scope not defined clearly?

Btw i was wondering about the implementation part, I have explored it a bit. I don't have exact implementation ideas atm but I think i might need to work with

image

I suppose I can get current instance of time and pull messages in bulk then filter based on a particular user and upto a certain interval . And finally do the delete operation. Thoughts?

@Tais993
Copy link
Member

Tais993 commented Oct 19, 2023

The issue is that you have to retrieve hundreds if not thousands of messages from every channel, this command never got added because of rate limits.

There is no way to delete all messages sent in the last week, last hour already sounds overkill.

When implementing this, make sure to only retrieve from channels that the user has access to & can write to, otherwise you're wasting the limited history we can retrieve

@Tais993
Copy link
Member

Tais993 commented Oct 19, 2023

Personally I'd say that the best implementation is to forward EVERY message to an SQL database, and then retrieve what messages have to be deleted from that.

But even then, deleting messages also got rate limited pretty harshly a year ago, I don't know how the current situation is. You can attempt this, but you really need to benchmark the rate limits before implementing.

@ankitsmt211
Copy link
Member Author

Well in that case it might be unnecessary to delete messages upto a day or week , like zabu mentioned "deleting that many messages might require a ban instead". But i totally see how "upto 1 hour" mark can be useful.

@ankitsmt211
Copy link
Member Author

ankitsmt211 commented Nov 3, 2023

This is what i have atm, as per suggestions i have decided to only to delete messages upto an hour.

  • Listener which writes all message records to DB when recieved
  • Routine that clears message records from DB if it's older than an hour or so
  • /purge command which has two options user and reason, reads ID's from DB, stores into a list.

For bulk deletion, this seems good.

image

Thoughts?

Edit: deleting messages from every channel seems pointless, since if someone is being a problem in more than one channel i don't think they're human and if they are they deserve a temp ban at that point. So this command will purge messages from the channel where it's used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants