-
Notifications
You must be signed in to change notification settings - Fork 5.7k
add new predefined filter 'Filters.Date' to filter on message age. #1978
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
Conversation
…ased on the date they were send by specifying the maximum time difference between 'now' and when the message was sent.
Just found this in the GH actions logs:
Found this. will push the change. |
Hey, just a quick question: Can you tell me a real "life" usecase for a bot, where it makes sense to only handle an update when it was send X seconds ago? |
I'm experiencing issues with users sending commands when they don't have an internet connection, the bot/server was restarted and myself during development (send commands when test bot was down -> flooding test bot once back up). So i just want to ignore everything that's older than x seconds in my bots. I currently have this implemented by creating my own filter class but thought it might be useful for others as well. edit: re-reading your question it looks like you're under the impression is want to do the opposite: only handle old commands. well... i don't :) i have this |
@ikkemaniac Oh, and starting clear is not what you want to aim for? Thats what I do. If someone sends an update during a downtime and it was important, they will resend it later. |
Uhhh... facepalm... never really thought about it. Nevertheless they won't get informed would they? |
@ikkemaniac "they won't get informed" You mean that the bot was down? No. I normally have a support channel for that stuff, or I could iterate over the recently used by user ids, if I want that. But thats not really the point now ;P I personally don't really see the usecase for this filter, but your example is okay. If it is well implemented, its just another filter, so I would personally be fine with it. The maintainers stance currently though is that its too much of a specific case to be worth included in our library. I will ping the other ones and see if your example changed that; if not, we might have a different solution coming in the future for these kind of special cases :) |
ok |
Hi @ikkemaniac , We've discussed this PR and the proposal you're making in the developers group, and we decided to reject your PR. I'm closing this PR. |
This allows for filtering messages based on the date they were send by specifying the maximum time difference between 'now' and when the message was send.
I've added some basis tests. Pls verify these as I'm not familiar with pytest and can't seem to get them to fail (ex. change 'seconds_ago' to 15 in test_filters_date_init doesn't throw an error in testing)