GithubHelp home page GithubHelp logo

slackathon's Introduction

Slackoff

The Friday-fun-time bot. Born of beer.

What is it?

This is the simple slack chat bot that a few of us put together one epic Friday. Unlike other beer fueled ideas, this one actually works pretty well and didn't require a trip to the hospital.

How do I use it?

It's nodejs, so if you do node, you'll be pretty at home here. You probably want a pretty recent version of node. Might I also suggest nvm and yarn? To get the ball rolling

Install the dependencies

yarn install

You'll need to get a slack bot token (https://my.slack.com/services/new/bot). Then create a file called config.json in the root of the project and add something like this to it

{
  "token": "xoxb-8657309-X0DEADBEEFCAFE-crossfitp90xpaleobaconator",
  "name": "dbcbot"
}

Run the thing

yarn start

With any luck, your bot is now connected to Slack. Good for you! I'd suggest joining the #test- channel on the elastic slack and inviting your bot to it by @mentioning it.

Now you can interact with it by @mentioning. Try

@dbcbot help

Now what?

Well, the bot does some simple stuff, but I bet you have ideas for more! Adding commands is pretty trivial. Drop into the commands/ directory and take a look around. I'd suggest copying the random.js and working off of that. That will teach you how arguments work and get you simple string replies.

If you want todo more than string replies (you do), then you probably want to return something more complex from your function. If you want to upload files take a look at kitten.js for an example.

Once you've created your function, import it to index.js and add it to the object that is exported. Whatever you export it as becomes the command name.

But I want to use an entirely different API

Now we're talking! Slackathon can do that. See the types/ directory. Each of these maps to an object type that is returned from a command. See file.js. That maps up to the {type: 'file'} that is returned from kitten.js.

As you can see, file.js is the bit that actually does the uploading to slack.

Annnnd GO!

That should be everything you need to hack on this.

The future

  • Allow the bot to connect to networks aside from slack. This should be pretty simple, you just need another layer and a bit more config. Commands wouldn't change, but you'd need a type handler for each kind of network
  • Your totally excellent idea here.

slackathon's People

Contributors

rashidkpc avatar simianhacker avatar w33ble avatar

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.