Skip to content

Commit

Permalink
Ensure message is a string and not a number
Browse files Browse the repository at this point in the history
Numbers cause problems with some adapters (like slack)
#1
  • Loading branch information
Christopher Porter committed Sep 20, 2014
1 parent e9cfa78 commit 3b8163a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/calculator.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ mathjs = require("mathjs")
module.exports = (robot) ->
robot.respond /(calc|calculate|calculator|convert|math|maths)( me)? (.*)/i, (msg) ->
try
msg.send mathjs.eval msg.match[3]
result = mathjs.eval msg.match[3]
msg.send "#{result}"
catch error
msg.send error.message || 'Could not compute.'

0 comments on commit 3b8163a

Please sign in to comment.