Beispiel #1
0
def add_to_lunch(bot_input, bot_output):
    username = bot_input.nick
    email = bot_output.get_user_by_name(username)["email"]
    restaurant_name = bot_input.groupdict()["rest"]

    rests = web.get_json("http://lunchpad.hq.daptiv.com:3000/restaurants")
    restId = 0
    for it in rests:
        if it["name"] == restaurant_name:
            restId = it["_id"]

    url = "http://lunchpad.hq.daptiv.com:3000/restaurant/{0}/add/{1}".format(restId,email)
    result = web.get_json(url)
    bot_output.say('added you to %s.  Enjoy your lunch, sir.' % restaurant_name)
    bot_output.say("Just kidding. I hope they poison you.")
Beispiel #2
0
    def get_users(self):
        endpoint = "users"
        url = "https://api.flowdock.com/v1/%s"

        user_endpoint = url % endpoint
        logger.log("hitting endpoint: %s" % user_endpoint)
        self.users = web.get_json(user_endpoint, self.username, self.password)
        return self.users
Beispiel #3
0
def lunchbot(bot_input, bot_output):
    rests = web.get_json("http://lunchpad.hq.daptiv.com:3000/restaurants/trending")
    to_say = []

    for rest in rests:
        to_say.append(rest["name"])
        for user in rest["users"]:
            flowuser = bot_output.get_user_by_email(user)["nick"]
            to_say.append("- " + flowuser)

    joined = '\n'.join(to_say)
    bot_output.say(joined)