jvarness / hubot-yelp Goto Github PK
View Code? Open in Web Editor NEWEnables your hubot to suggest places to eat lunch. Powered by Yelp
License: MIT License
Enables your hubot to suggest places to eat lunch. Powered by Yelp
License: MIT License
If a default location is specified, the script might randomly select a place that isn't meant for food, like home depot.
Need to add a configuration that allows a category to be added along with any other categories that the user specifies.
Saw that #14 also had this problem. But I installed the latest npm package for hubot-yelp so your fix should have worked. Tried removing the parens around "params" but that still says error. Any ideas?
ERROR TypeError: params.then is not a function at queryYelp (/home/ec2-user/hiphubot/node_modules/hubot-yelp/src/lunchtime.coffee:41:3, <js>:27:31) at TextListener.callback (/home/ec2-user/hiphubot/node_modules/hubot-yelp/src/lunchtime.coffee:59:5, <js>:50:14) at executeListener (/home/ec2-user/hiphubot/node_modules/hubot/src/listener.coffee:65:11, <js>:53:19) at allDone (/home/ec2-user/hiphubot/node_modules/hubot/src/middleware.coffee:44:37, <js>:34:16) at /home/ec2-user/hiphubot/node_modules/async/lib/async.js:274:13 at Object.async.eachSeries (/home/ec2-user/hiphubot/node_modules/async/lib/async.js:142:20) at Object.async.reduce (/home/ec2-user/hiphubot/node_modules/async/lib/async.js:268:15) at /home/ec2-user/hiphubot/node_modules/hubot/src/middleware.coffee:49:7, <js>:37:22 at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback (internal/process/next_tick.js:180:9)
When no results, it gives this:
Give this place a shot:
I'll tell you:
pharmbot lunchtime thats kung furry
Give this place a shot:
Well.... That's a bug
Hi
Being a newbie to hubot script. I managed to do npm install as per the readme, and added hubot-yelp to the external script list. I can see "lunchtime" has been listed under the hubot help (bot's response). However the command itself "lunchtime" is not responding.
I am sure I am missing a step because I am not sure where to add in the config for HUBOT_YELP_CONSUMER_KEY. Am I suppose to clone this script under the hubot/script folder?
The user should be able to use hubot lunchtime
without any other params.
Hey there,
I tried using the new code and it looks like it's not happy about how the method is being called:
Jul 23 13:46:56 n7-z01-0a2a1068 hubot: [Sun Jul 23 2017 13:46:56 GMT-0700 (PDT)] DEBUG Received message: '@mybot lunchtime' in channel: mybot-testing, from: ian.ward
Jul 23 13:46:56 n7-z01-0a2a1068 hubot: [Sun Jul 23 2017 13:46:56 GMT-0700 (PDT)]
DEBUG Message '@mybot lunchtime' matched regex //^\s*[@]?mybot[:,]?\s*(?:lunchtime\W*(near (.*) thats (.*)|near (.*)|thats (.*))?)/i/; listener.options = { id: null }
Jul 23 13:46:56 n7-z01-0a2a1068 hubot: [Sun Jul 23 2017 13:46:56 GMT-0700 (PDT)] DEBUG Executing listener callback for Message '@mybot lunchtime'
Jul 23 13:46:56 n7-z01-0a2a1068 hubot: [Sun Jul 23 2017 13:46:56 GMT-0700 (PDT)] ERROR TypeError: params.then is not a function
Jul 23 13:46:56 n7-z01-0a2a1068 hubot: at queryYelp (/home/hubot/mybot/node_modules/hubot-yelp/src/lunchtime.coffee:41:3, <js>:27:31)
Jul 23 13:46:56 n7-z01-0a2a1068 hubot: at TextListener.callback (/home/hubot/mybot/node_modules/hubot-yelp/src/lunchtime.coffee:63:5, <js>:54:14)
Jul 23 13:46:56 n7-z01-0a2a1068 hubot: at executeListener (/home/hubot/mybot/node_modules/hubot/src/listener.coffee:65:11, <js>:53:19)
Jul 23 13:46:56 n7-z01-0a2a1068 hubot: at allDone (/home/hubot/mybot/node_modules/hubot/src/middleware.coffee:44:37, <js>:34:16)
Jul 23 13:46:56 n7-z01-0a2a1068 hubot: at /home/hubot/mybot/node_modules/async/lib/async.js:274:13
Jul 23 13:46:56 n7-z01-0a2a1068 hubot: at Object.async.eachSeries (/home/hubot/mybot/node_modules/async/lib/async.js:142:20)
Jul 23 13:46:56 n7-z01-0a2a1068 hubot: at Object.async.reduce (/home/hubot/mybot/node_modules/async/lib/async.js:268:15)
Jul 23 13:46:56 n7-z01-0a2a1068 hubot: at /home/hubot/mybot/node_modules/hubot/src/middleware.coffee:49:7, <js>:37:22
Jul 23 13:46:56 n7-z01-0a2a1068 hubot: at _combinedTickCallback (internal/process/next_tick.js:73:7)
Jul 23 13:46:56 n7-z01-0a2a1068 hubot: at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:128:9)
I tried putting params
in parentheses and it seems to be happier that way (no errors), but it seems like the messages came in out of order:
Would it be possible to put those all in a single message before sending it?
Thanks!
It looks like Yelp is telling folks to sign up for Yelp Fusion: https://engineeringblog.yelp.com/2017/02/recent-improvements-to-the-fusion-api.html
Can this be updated to support the Yelp Fusion API instead?
Hubot scripts support JavaScript now, which might make unit testing a little easier to do.
Update this hubot package to not use CoffeeScript, and write more tests.
They're always all like:
Error :( statusCode 400 body {"error": {"text": "API unavailable in this location", "id": "UNAVAILABLE_FOR_LOCATION"}}
And you're all like... wut
And cookie monster is sad because there are no locations, and you're sad because there are no APIs.
It's giving us animal hospitals and home depot.
When trying out v0.2.0 with the Fusion API, I noticed that the response messages were coming in out of order, probably due to them being handled asynchronously by NodeJS:
Maybe instead of https://github.com/jvarness/hubot-yelp/blob/master/src/lunchtime.coffee#L45-L50 a heredoc would be a bit easier?
if data.businesses.length > 0
randomBusiness = msg.random data.businesses
message = """
Give this place a shot:
#{ randomBusiness.name }
Yelp rating: #{ randomBusiness.rating }
Total reviews: #{ randomBusiness.review_count }
#{ randomBusiness.url }
"""
msg.send message
That seems to keep things in order and also has the added benefit of using a single message for the response:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.