Add cronjob to notify admin about missing solvers (#314) - #563
Add cronjob to notify admin about missing solvers (#314)#563doitwithnotepad wants to merge 5 commits into
Conversation
- Schedule a daily job at midnight to check for solvers using `node-schedule`. - Implement `checkSolvers(bot)` to send a message to the community admin if no solvers are found. - Increment the count of messages sent to the admin in the database. - Add logic to disable the community if no solvers are added after a specified number of notifications. Fixes lnp2pBot#314
Catrya
left a comment
There was a problem hiding this comment.
Hi @doitwithnotepad when it has to check if there are solvers it shows this in the logs :
error: Unhandled Rejection: TypeError: checkSolvers is not a function
It should now, 28360d2. |
| const calculateEarnings = require('./calculate_community_earnings'); | ||
| const deleteCommunity = require('./communities'); | ||
| const nodeInfo = require('./node_info'); | ||
| const checkSolvers = require('./check_solvers'); |
There was a problem hiding this comment.
Hi @doitwithnotepad please test the code before push a commit, that way you'll see if it works or not
we are getting the same error
error: Unhandled Rejection: TypeError: checkSolvers is not a functionthis is because the function checkSolvers() is not well imported, please replace with:
const { checkSolvers } = require('./check_solvers');| logger.info(`Community ${community._id} has been disabled due to lack of solvers.`); | ||
| } else { | ||
| await community.save(); | ||
| const admin = await User.findOne({ tg_id: community.creator_id, admin: true }); |
There was a problem hiding this comment.
user.admin is only used for global admin, not community admins, we don't need to add it on this findOne() request
|
Hi @doitwithnotepad which is the status of this PR? are you able to finish it? |
|
Hi @doitwithnotepad, are you able to finish this PR? The issue #314 is on the reward board , if you don't finish it, we should allow another dev to do it, and move it to status: looking for dev, what do you think? |
|
I can't do it right now, maybe later, sorry for the delay in answering. |
|
close in favor #618 |
Schedule a daily job at midnight to check for solvers using
node-schedule.Implement
checkSolvers(bot)to send a message to the community admin if no solvers are found.Increment the count of messages sent to the admin in the database.
Add logic to disable the community if no solvers are added after a specified number of notifications.
Fixes #314