Skip to content

Delete last X messages from user for moderation #912

Description

@ankitsmt211

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.

Activity

  1. Zabuzard commented on Oct 16, 2023

    @Zabuzard
    Member

    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 😆

  2. ankitsmt211 commented on Oct 19, 2023

    @ankitsmt211
    MemberAuthor

    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?

  3. Tais993 commented on Oct 19, 2023

    @Tais993
    Member

    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

  4. Tais993 commented on Oct 19, 2023

    @Tais993
    Member

    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.

  5. ankitsmt211 commented on Oct 19, 2023

    @ankitsmt211
    MemberAuthor

    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.

  6. ankitsmt211 commented on Nov 3, 2023

    @ankitsmt211
    MemberAuthor

    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.

  7. self-assigned this
    on Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions