Skip to content

Commit

Permalink
More standup admin commands
Browse files Browse the repository at this point in the history
  • Loading branch information
area committed Apr 25, 2022
1 parent 256f5f3 commit 7478514
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion scripts/daily-standup.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ module.exports = robot => {
res.send(`OK, I removed this excuse: ${res.match[1]}`)
})

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

robot.hear('standup admin excuse list (.+)', res => {

const { user } = res.message
if (!isPrivateDiscordMessage(robot.client, res) || !isAdmin(user, brain)) return
const userId = res.match[1]

const map = getMap(`excuses-${userId}`, brain)
const excuses = Object.keys(map).map(excuse => `• ${excuse}`)
if (!excuses.length) {
return res.send('No excuses found! 🤙')
}
res.send(
`OK, here's a list of all the days they're excused:\n${excuses.join(
'\n'
)}`
)
})


// These lines are for debugging. Please leave in and commented for now
robot.hear('blame', res => {
if (!isPrivateDiscordMessage(robot.client, res)) return
Expand Down

0 comments on commit 7478514

Please sign in to comment.