Git Product home page Git Product logo

slackbot-botkit-es6-example's Introduction

slackbot-botkit-es6-example

SlackBot example using botkit but with ES6 syntax (compiled to ES5 ondemand by using Babel).

Usage

You need Node installed with npm.

You will also need to have a bot setup in your Slack integrations (use https://my.slack.com/services/new/bot) and export the API TOKEN in your shell environment before you start the bot.

npm install

export slackbotapitoken=<YOUR-BOTS-API-TOKEN-HERE>

# either
npm run start
# or
node server.js

Enjoy.

Available commands

Admins

There are no admins in the database by default. However, there is a super admin password that can be used to add users to the admin list.

You can set superadmin password via the superadminpassword environment variable. If you do not set it, it will take the default from the configuration.es6 file, which sets it to friend.

You add users to the admin list via (direct) messages to your bot, like so

@botname admin add @username

You can remove users from the admin list in the same way

@botname admin rm @username

You can also see the complete list of admins with this command

@botname admin list

Facts

Admin users can add, edit and remove Facts from the fact database. The fact database can be queried via the fact command.

@botname fact list  # list all facts
@botname fact random  # list a random fact from the list
@botname fact add <new fact text>  # add a fact to the list, needs admin user
@botname fact delete <factid>  # remove a fact from the list, needs admin user
@botname fact update <factid> <updated fact text>  # edit a fact in the list, needs admin user

Random Number

You can get a random number (range 0 to 100) via this command

@botname rndnum

Git Information

You can see the latest commit message for the current active branch that the bot is run on.

@botname git info

Karma

Try help karma to see what's available. And have a look at the configuration.es6 file to get an idea on how it works. If you want to see the details, please look at src/commands/KarmaCommand.es6.

Help

The help command will display a help text for all available commands (if they provide a help text that is).

TODO

  • add a catch all command that catches all direct messages that are not actively handled by an assigned/specialized command and return a message ala "sorry, command unknown - try again" message (or use fuzzy logic to suggest a more sutable command)

  • ...

Copyright

Copyright (c) 2015-2016 by Daniel Kurashige-Gollub, [email protected]

License

MIT

See LICENSE file.

slackbot-botkit-es6-example's People

Contributors

dgollub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.