bot
bot copied to clipboard
Updates to nomination review system posting conditions
Edited to take into account comments below
Updates to nomination review system posting conditions
There are a few changes we'd like to make to the nominations review system.
Features we want:
- A limit to the maximum number of reviews active in the channel at once.
- A limit on the frequency reviews are posted (e.g. one a day).
- A check to ensure the user has been active recently, to hold off the review if they haven't and possibly unnominate after a while (e.g. 10 messages in the past 7 days)
Implementation:
General Idea:
These changes don't fit in that easily with the current scheduler based system, so I propose removing the scheduler, and replacing it with a discord.ext.tasks.loop
that runs every hour and checks a) that it's been 24 hours since the last vote; and b) that the number of active votes is below the maximum. If these are true then it will try and pick a user to review.
To pick a user, we'll loop over users awaiting review (probably ordered by first nominated) until we find one who has been in for the minium length of time (30 days currently) and has message activity, and then post their review.
Details:
For keeping track of the number of active votes, the message ID(s) of each vote should be stored on the nomination in postgres. When a user is unnominated the bot can use this to automatically delete the message(s) and archive it.
Storing the message IDs with the user would help for archiving the vote as we know which messages are part of which review so we don't need to try and work it out by seeing which message timestamps are close etc.
To handle reviews posted manually, we'll replace manual posting with a bot command where you pass the user and the content you want the bot to put in the review, so the bot can handle updating the db with the message ID. We probably won't support multiple messages here for now.
I can try implementing this, although would probably need somebody else to implement the site side of things.
Thinking about this a bit more, it would probably make more sense to remove the current scheduler completely and add another check that they've been in the pool long enough along with the check for recent activity.
I agree we should remove the current scheduler entirely. The hourly task you mention can then run the two checks you mention, and if they pass it should just make an API request to the site api to get the next one to review, which then does the required calcs to work out which user to return (as the site has all the message history & nomination details). No need for a scheduler at all then.
A check to ensure the user has been active recently, to hold off the review if they haven't and possibly unnominate after a while.
This may seem like an innocent thing to add, but how do you propose to actually track user activity. Doesn't that also get into privacy issues?
This may seem like an innocent thing to add, but how do you propose to actually track user activity. Doesn't that also get into privacy issues?
By user activity I mean something like "has at least 10 messages in the past week", which we already track through metricity, which is integrated with site https://github.com/python-discord/site/blob/d038076b5034d14ce2b8dabcb929eacb0e837540/pydis_site/apps/api/models/bot/metricity.py, so would just require another query there.
I'm going to work on a slightly simplified version of this.