Skip to content
This repository was archived by the owner on Sep 4, 2019. It is now read-only.

Commit 258e96b

Browse files
committed
Make the is alive check the user list before reporting
Signed-off-by: Adam Jimerson <[email protected]>
1 parent 290ba4a commit 258e96b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

isalive.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ import (
1212

1313
var isAliveHandler = hear(`is ([A-Za-z0-9\-_\{\}\[\]\\\s]+) alive`, "is (name) alive", "Find out if a user is alive", func(res *hal.Response) error {
1414
name := res.Match[1]
15-
res.Send(fmt.Sprintf("I can't find %s's heartbeat..", name))
16-
res.Send("But let's not jump to conclusions")
15+
_, err := res.Robot.Users.Get(name)
16+
if err != nil {
17+
res.Send(fmt.Sprintf("I can't find %s's heartbeat..", name))
18+
res.Send("But let's not jump to conclusions")
19+
} else {
20+
res.Reply(fmt.Sprintf("I found %s's heartbeat, all is good", name))
21+
}
22+
1723
return nil
1824
})

0 commit comments

Comments
 (0)