Skip to content

Commit 7478514

Browse files
committed
More standup admin commands
1 parent 256f5f3 commit 7478514

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

scripts/daily-standup.js

+20-1
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ module.exports = robot => {
485485
res.send(`OK, I removed this excuse: ${res.match[1]}`)
486486
})
487487

488-
robot.hear('standup excuse list', res => {
488+
robot.hear(/^standup excuse list$/, res => {
489489
const { user } = res.message
490490
if (!isPrivateDiscordMessage(robot.client, res) || !isStandupper(user, brain)) return
491491
const map = getMap(`excuses-${user.id}`, brain)
@@ -500,6 +500,25 @@ module.exports = robot => {
500500
)
501501
})
502502

503+
robot.hear('standup admin excuse list (.+)', res => {
504+
505+
const { user } = res.message
506+
if (!isPrivateDiscordMessage(robot.client, res) || !isAdmin(user, brain)) return
507+
const userId = res.match[1]
508+
509+
const map = getMap(`excuses-${userId}`, brain)
510+
const excuses = Object.keys(map).map(excuse => `• ${excuse}`)
511+
if (!excuses.length) {
512+
return res.send('No excuses found! 🤙')
513+
}
514+
res.send(
515+
`OK, here's a list of all the days they're excused:\n${excuses.join(
516+
'\n'
517+
)}`
518+
)
519+
})
520+
521+
503522
// These lines are for debugging. Please leave in and commented for now
504523
robot.hear('blame', res => {
505524
if (!isPrivateDiscordMessage(robot.client, res)) return

0 commit comments

Comments
 (0)