prashantagarwal / RunJS-Slackbot

A Slack bot that runs javascript (es6) in slack chat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RunJS-Slackbot

A Slack bot that runs javascript (es6) in slack chat.

It is built using Botikit by Howdy. https://howdy.ai/botkit/

Installation

git clone https://github.com/prashantagarwal/RunJS-Slackbot.git
cd RunJS-Slackbot
npm install

Setup

  1. First make a bot integration inside of your Slack channel. Go here: https://my.slack.com/services/new/bot

Enter a name for your bot. Make it something fun and friendly, but avoid a single task specific name. Bots can do lots! Let's not pigeonhole them.

  1. When you click "Add Bot Integration", you are taken to a page where you can add additional details about your bot, like an avatar, as well as customize its name & description.

  2. Run the example bot app, using the token you just copied: ​

token=REPLACE_THIS_WITH_YOUR_TOKEN node bot.js
  1. Invite bot to a channel Type: /invite @<botname> to invite your bot into channel.

  2. Your bot should be online! Within Slack, send it a quick direct message to say hello. It should say hello back! Hello @<botname>.

Running Javascript in Slack

Type: js mode @<botname>

And that's it you are good to go. You can run js in slack now (es6 too) E.g

var a=[1,2,3];
a.map(n=>n*2);

Output

[2,4,6]

Exiting from JS mode

Type: exit

Demo

alt tag

TODO:

  1. Run attatched js files.

  2. save code as snippet.

Feel free to suggest how can we can improve this bot.

About

A Slack bot that runs javascript (es6) in slack chat


Languages

Language:JavaScript 100.0%