Code Monkey home page Code Monkey logo

hubot-yelp's People

Contributors

jvarness avatar wataru420 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

hubot-yelp's Issues

Add configuration for a default category

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.

TypeError: params.then is not a function

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)

Bot script newbie question

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?

ERROR TypeError: params.then is not a function

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:
image

Would it be possible to put those all in a single message before sending it?
Thanks!

JS and Unit Tests

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.

The errors need to be nicer

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.

Response messages come in out of order

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:
image

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:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.