Skip to content
Niko is a Slack bot; Niko tells you are mentioned on GitHub💡
Common Lisp Dockerfile CSS Shell TSQL
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
db Add migration files Dec 8, 2018
lib Split port for webhook and admin Aug 21, 2019
roswell Error Dec 10, 2018
views
.gitignore
Dockerfile
LICENSE Licensed under the LLGPL Jul 20, 2018
README.md
main.lisp
niko.asd Fix a bug: crashes by remaining old codes Sep 5, 2019
qlfile
qlfile.lock
release.sh Fix dockerfile Dec 5, 2018
setup.sh
util.lisp Split port for webhook and admin Aug 21, 2019
webhook.lisp

README.md

💡Niko - Not-a-cat Slack bot

"I'm not a cat!"

Niko is a Slack bot; Niko tells you are mentioned on GitHub.

Niko stores a mapping between GitHub users and Slack users. When the GitHub users are mentioned on issues, issue comments or pull requests, then Niko mentiones corresponding Slack users by a post on a Slack channel specified by the envorinment variable SLACK_CHANNEL.

By a managing console, the mapping between GitHub/Slack users can be edit on the browser. Run this app and access the path like /.

Requirements

  • libssl
  • libev
  • PostgreSQL
    • a database called inventory
  • Redis
    • it should be configured as notify-keyspace-events Ex

Installation

Clone this repository into ASDF registry and run in REPL like this:

CL-USER> (ql:quickload :niko)

Or if you use Roswell, simply do this in your shell:

$ ros install t-sin/niko

Usage

Configuration

Niko has some parameter for execution like DB password, auth tokens, etc. You can set them via environment variables described below:

  • DB_HOST: DB hostname ex) localhost
  • DB_USER: DB username
  • DB_PASS: DB password
  • REDIS_HOST: Redis hostname
  • REDIS_PORT: Redis port
  • GITHUB_TOKEN: GitHub auth token to get user info
  • SLACK_TOKEN: Slack auth token to get user info and post message
  • SLACK_CHANNEL: Slack channel name where Niko posts message

Don't forget to set them! ;3

Running

In REPL, like this:

CL-USER> (niko:start "localhost" 5000)
Hi, I'm Niko!
Woo server is started.
Listening on localhost:5000.
#S(CLACK.HANDLER::HANDLER :SERVER :WOO :ACCEPTOR #<SB-THREAD:THREAD "clack-handler-woo" RUNNING {1006D287C3}>)

Or you can run with Roswell script like this:

$ niko start localhost 5000
Hi, I'm Niko!
Woo server is started.
Listening on localhost:5000.

How to Use

First, you have to add a pair of users (GitHub/Slack). After niko start, you can access Niko console via HTTP, by default localhost:5001/. On the path /user/add, you can add the pair.

Second, you have to set a webhook on GitHub. Expose Niko to the internet, and a path for the webhook is /github/webhook. You have to set the path to the Settings->Webhooks page on a repository/organization you want to notify.

Build

For simplicity and easy deployment, You can create single executable binary of Niko. This requires building feature of Roswell, but you can build Niko executable file on Docker container.

Simply build

If you already installed Roswell, just type it:

$ cd niko/
$ qlot install
$ qlot exec ros build ./roswell/niko.ros

Building on Docker container

If you don't know about Roswell, try to bulid on Docker container.

$ sudo docker build .
$ sudo docker cp "$(sudo docker -q -f ancestor=niko:latest):/usr/bin/niko" .

Author

License

Niko is licensed under the Lisp Lesser GNU General Public License (LLGPL). For more detail, see LICENSE.

You can’t perform that action at this time.