Skip to content

Commit b892cde

Browse files
committed
Add command to set daily standup count to number
1 parent aafcb6c commit b892cde

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

scripts/daily-standup.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ const setupCronJob = robot => {
322322
timeZone: 'Pacific/Niue'
323323
})
324324
leaderboardJob.start()
325-
326-
325+
326+
327327
const holidayJob = new CronJob({
328328
// Every sunday at 23:47h, in Pacific/Niue - monday for most people.
329329
cronTime: '0 47 23 * * 0',
@@ -620,6 +620,19 @@ module.exports = robot => {
620620
res.send("It's like they never did a standup (or more accurately, it's like they missed yesterday).");
621621
})
622622

623+
robot.hear(/standup admin leaderboard set (.+) ([0-9]*)/, res => {
624+
const { user } = res.message
625+
if (!isPrivateDiscordMessage(robot.client, res) || !isAdmin(user, brain)) return
626+
const standuppers = Object.values(getMap('standuppers', brain))
627+
standuppers
628+
.filter(user => getUserName(user, brain) == res.match[1])
629+
.forEach(user => {
630+
user.currentCount = parseInt(res.match[2])
631+
updateMap('standuppers', user.id, user, brain)
632+
})
633+
res.send("I've set them as you desired");
634+
});
635+
623636
robot.hear(/standup admin days off reset (.+)/, res => {
624637
const { user } = res.message
625638
if (!isPrivateDiscordMessage(robot.client, res) || !isAdmin(user, brain)) return

0 commit comments

Comments
 (0)