Clean improvements#1989
Conversation
All clean commands now use the clean limit (message, time delta, ISO datetime) instead of `traverse`. Consequently, `clean all` has been removed as `clean until` now effectively fulfills that role.
Removes the cache usage argument from the clean commands. Cache usage is now an implementation detail. The cache will be used if the age of the oldest message requested for cleaning is younger than the oldest message in the cache. Additionally fixes the logger to the one used in the rest of the bot (caused by a faulty merge).
ChrisLovering
left a comment
There was a problem hiding this comment.
Some very nice code Zig 👍 I really like the change you made to the cache, should make this much nicer to use :D
|
Just noticed a bug this PR is going to introduce, will fix soon. |
Previously the cache was only used to delete from all channels. I didn't add a channels check when I changed it.
When specifying all channels, the command now skips private channels to optimize for speed.
ChrisLovering
left a comment
There was a problem hiding this comment.
Tested latest changes 👍
| channels = { | ||
| channel for channel in ctx.guild.channels | ||
| if isinstance(channel, TextChannel) | ||
| # Assume that non-public channels are not needed to optimize for speed. |
There was a problem hiding this comment.
I understand why it's done, but what happens if we have "public" channels that are still locked behind a role such as during codejams.
There was a problem hiding this comment.
The participants channel stays public, just not writeable. If we get to the point of cleaning a user from the team leaders channel, I think a more focused action will be made anyway, likely including the disqualification of the participant. Specifying such a channel explicitly in that case seems like an acceptable edge case. And if it stops being acceptable we can consider adding another shortcut for actually-all channels.

This PR follows observations of how the new clean features were being used.
Changes:
traverse.clean allhas been removed asclean untilnow effectively fulfills that role."*"for the channels the command will now delete only from public channels for further speed-up.Fixes: