Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit a8506fc

Browse files
author
Tom Bell
committed
Merge pull request #738 from Intelliplan/fuzz
Fuzz
2 parents 5a99f57 + 4afff5d commit a8506fc

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/scripts/46elks.coffee

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,18 @@ module.exports = (robot) ->
4848
else
4949
to = user.phone
5050
to = to.toString().replace(/\d/, '+46')
51-
else
52-
msg.send 'Me cant find ' + to + ', are you sure that person is born?'
53-
return
51+
else
52+
users = robot.brain.usersForFuzzyName(to)
53+
if users.length is 1
54+
user = users[0]
55+
to = user.phone
56+
to = to.toString().replace(/\d/, '+46')
57+
else if users.length > 1
58+
msg.send getAmbiguousUserText users
59+
return
60+
else
61+
msg.send 'Me cant find ' + to + ', are you sure that person is born?'
62+
return
5463

5564
data = QS.stringify from: from, to: to, message: bahdy
5665

0 commit comments

Comments
 (0)