Giter VIP home page Giter VIP logo

bravobot's Introduction

Bravo, you!

Send bravos, little pictorial congratulations, in slack.com.

In a channel, type…

/bravo @bobby for getting bravobot up and running!

…then Bravo Bot will come along, mention the person, and post a custom image for you.

First, in Slack…

You need to do two things in Slack: set up a new slash command and set up an incoming webhook. Open the Integrations tab, then…

  • Add an Incoming WebHook. Copy the Webhook Url to your config file. Give it a name, description, and an emoji (the clap emoji works best, imo.) The channel won’t matter.

  • Add a new Slash Command with the command “/bravo”. Add the URL from which you will serve bravobot. Use “Post” for the method. Add “/bravo” as the command. Copy the token to your config file.

Add a config.json file

BravoBot will send your bravo picture to s3. Get a Key from AWS and the other s3 information. Be sure to add a policy that makes your bucket public.

Add a config.json file in the root of your project with all your secrets. You config.json file will look something like this:

{
  "webhookUrl": "https://hooks.slack.com/services/123456/123456/123456",
  "token": "123456",
  "awsAccessKeyId": "123456",
  "awsSecretKey": "123456",
  "s3bucket": "bravobot",
  "s3region": "us-west-2"
}

Don't share your config file, obviously.

Then, set up your server…

To get the app up and running:

  • Add a config.json file like above. ☝️
  • brew install phantomjs (or download)
  • npm install
  • coffee app.coffee

Have you heard of ngrok? It’s great.

Just so you know…

You’ll want to add Open Sans Condensed to your system. Webfonts don’t work with Phantom.js.

bravobot's People

Contributors

bobbygrace avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

nitrocode

bravobot's Issues

Stacktrace dumped when bravos sent without a message

Hi. I noticed a stacktrace was dumped when I sent bravos without a message. The bravos were removed from my balance and I'm unsure if the bravee received said bravos.

Maybe replace line 100 with this:

  if text.split(' ').length > 1
    msg = text.split(' ')[1...].join(' ')
  else
    msg = 'Bravo!'

Trace:

{
  "stackTrace": [
    [
      "/var/task/yoon.py",
      536,
      "handleYoonCommand",
      "result = handleMultiGiftText(fromUser, words, dynamo)"
    ],
    [
      "/var/task/yoon.py",
      478,
      "handleMultiGiftText",
      "result = gift(fromUser, user[Username], amount, messageText, dynamodb)"
    ],
    [
      "/var/task/yoon.py",
      314,
      "gift",
      "addGiftRecord(fromUser, toUser, amount, message, dynamodb)"
    ],
    [
      "/var/task/yoon.py",
      73,
      "addGiftRecord",
      "GiftId: str(uuid.uuid1())"
    ],
    [
      "/var/runtime/boto3/resources/factory.py",
      520,
      "do_action",
      "response = action(self, *args, **kwargs)"
    ],
    [
      "/var/runtime/boto3/resources/action.py",
      83,
      "__call__",
      "response = getattr(parent.meta.client, operation_name)(**params)"
    ],
    [
      "/var/runtime/botocore/client.py",
      314,
      "_api_call",
      "return self._make_api_call(operation_name, kwargs)"
    ],
    [
      "/var/runtime/botocore/client.py",
      612,
      "_make_api_call",
      "raise error_class(parsed_response, operation_name)"
    ]
  ],
  "errorType": "ClientError",
  "errorMessage": "An error occurred (ValidationException) when calling the PutItem operation: One or more parameter values were invalid: An AttributeValue may not contain an empty string"
}

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.