MODiX icon indicating copy to clipboard operation
MODiX copied to clipboard

Gracefully handle !clean requests for old messages

Open Scott-Caldwell opened this issue 5 years ago • 4 comments

Discord's bulk message delete API won't delete messages older than 2 weeks and will throw an error if you try. It might be nice to limit the messages we try to delete with !clean to messages within the past 2 weeks so that we don't end up bumping into that error.

Scott-Caldwell avatar Feb 13 '20 22:02 Scott-Caldwell

what if we fall back to the non-bulk api if older than 2 weeks, and just slowly churn through the messages until done?

Cisien avatar Feb 13 '20 22:02 Cisien

Discord doesn't like that, AFAIK. The best option IMHO would be to filter the message IDs based on whether their snowflake is greater than or equal to this:

var minimum = SnowflakeUtils.ToSnowflake(DateTimeOffset.UtcNow.Subtract(TimeSpan.FromDays(14)));

FiniteReality avatar Feb 13 '20 23:02 FiniteReality

Discord doesn't like deleting old messages?

I'm guessing this is in reference to deleting an archive channel?

JakenVeina avatar Feb 14 '20 05:02 JakenVeina

@JakenVeina This is in reference to deleting messages from any channel where the message is older than two weeks.

The restriction was put there in the first place because it was slowing down their database queries - I imagine deleting a single message does the same thing, but much slower.

FiniteReality avatar Feb 14 '20 14:02 FiniteReality

As part of a new effort to refocus on priorities, I will close this. If you feel this is imperative to the bot, a new issue can be opened to supersede this.

patrickklaeren avatar Mar 26 '24 14:03 patrickklaeren