• Stars
    star
    135
  • Rank 269,297 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

a Slack bot that kicks asses (roundhouse-kicks to be accurate...)

norrisbot

CircleCI npm version codecov Known Vulnerabilities

Make your team hyper-productive with cutting Chuck Norris jokes

The NorrisBot is a Slack bot that kicks asses, roundhouse-kicks to be precise... It's super-powered with Chuck Norris jokes and it aims to make your Slack channel even more "slacker" and enjoyable.

Chuck Norris face

NorrisBot is loaded with guns and jokes about Chuck Norris and it will tell a random joke every time that someone says “Chuck Norris” or "norrisbot" in a slack channel.

Norrisbot in action

Installation

As simple as installing any other global node package. Be sure to have npm and node (>= 4.3.2 version) installed and launch:

$ npm install -g norrisbot

Alternative Installation (binaries)

From release 2.0.3, every release comes also with dependency-free binaries for linux, mac and windows that can be downloaded in the Releases page on GitHub.

Running the NorrisBot

To run the NorrisBot you must have a valid Slack BOT token to authenticate the bot on your slack organization. Once you get it (instructions on the next paragraph) you just have to run:

NORRISBOT_TOKEN=somesecretkey norrisbot

Once the bot is up and running, you need to invite him into the channels you want it to be available in.

Getting the BOT token for your Slack channel

To allow the NorrisBot to connect your Slack channel you must provide him a BOT token. To retrieve it you need to add a new Bot in your Slack organization by visiting the following url: https://yourorganization.slack.com/services/new/bot, where yourorganization must be substituted with the name of your organization (e.g. https://loige.slack.com/services/new/bot). Ensure you are logged to your Slack organization in your browser and you have the admin rights to add a new bot.

You will find your BOT token under the field API Token, copy it in a safe place and get ready to use it.

As an alternative you can create a bot by creating a custom application in the Slack developer portal. Inside the application settings you will be able to add a bot user and retrieve a OAUTH BOT token for it.

Configuration

The NorrisBot is configurable through environment variables. There are several variable available:

Environment variable Description
NORRISBOT_TOKEN The Slack Bot User OAuth Access Token for your organisation/team (mandatory)
NORRISBOT_TRIGGERS A coma separated list of words that triggers the bot to reply with a joke (default: "Chuck Norris,norrisbot")
NORRISBOT_CATEGORIES A coma separated list to enable special joke categories like "explicit" and "nerdy" (default: "nerdy")
NORRISBOT_NO_PICTURES If set to TRUE will disable pictures in jokes (default: FALSE)
NORRISBOT_MESSAGE_COLOR The hex color used by the bot to mark it's messages (default: "#590088")

Installing on Heroku

A great place where to deploy our lovely NorrisBot is Heroku. We can go reasonably well with their free worker tier and the deploy process is reasonably easy and convenient. Let’s see how we can do that.

I am assuming you already have and account on Heroku and that you have installed and configured the Heroku toolbelt on your machine.

1. Create a new Heroku app

Create a local folder and install norrisbot on it:

mkdir norrisbot-myorg
cd norrisbot-myorg
npm init -y
npm i --save norrisbot

Then create a new app on heroku:

heroku create norrisbot-myorg

2. Configure your Heroku app:

heroku config:set --app norrisbot-myorg NORRISBOT_TOKEN=xoxb-YOUR-AWESOME-BOT-TOKEN

(of course you need to replace xoxb-YOUR-AWESOME-BOT-TOKEN with your actual token).

You can add extra configuration by defining values for the other supported environment variables if you want to customize the behavior of the bot.

3. Initialize your Heroku app

Create an Heroku Procfile (service definition)

echo "worker: node_modules/.bin/norrisbot" >> Procfile

Then prepare the project to be published through git:

git init
echo "node_modules/" >> .gitignore
git add --all
git commit -am "first version"
heroku git:remote --app norrisbot-myorg

4. Publish and launch the Heroku app

Through heroku git

git push heroku master

Stop the web app (not present but started by default by Heroku) and run the worker:

heroku ps:scale web=0 worker=1

That's it, now go on your Slack organization and start enjoying Chuck Norris jokes! 😂

Building the bot from source

If you downloaded the source code of the bot you can build the bot with

npm run build

Then you can run it with:

$ npm start

Don't forget to set your NORRISBOT_TOKEN environment variable bedore doing so and to install all the dependencies (including dev ones with NPM or Yarn).

Bugs and improvements

If you find a bug or have an idea about how to improve the NorrisBot you can open an issue or submit a pull request, it will definitely make you a better person! :P

The Making of

Version 1 of NorrisBot has been developed in collaboration with Scotch.io. A very detailed article has been published to explain every single line of code. It also explains you how to deploy the bot on a free Heroku instance, so you should give it a shot!

Building a Slack Bot with Node.js and Chuck Norris Super Powers

Enjoy your reading!

License

Licensed under MIT License. © Luciano Mammino.

More Repositories

1

jwt-cracker

Simple HS256 JWT token brute force cracker
JavaScript
825
star
2

financial

A Zero-dependency TypeScript/JavaScript financial library (based on numpy-financial) for Node.js, Deno and the browser
TypeScript
695
star
3

awesome-learn-by-playing

A collection of tech resources that allow you to learn new things by playing games
677
star
4

judo-heroes

A React application to showcase rendering with Universal JavaScript
JavaScript
371
star
5

streams-workshop

A workshop on Node.js Streams
JavaScript
195
star
6

judo-heroes-2

Universal Javascript sample application with React Router 4 and Express 5 (Enhanced version of https://github.com/lmammino/judo-heroes)
JavaScript
179
star
7

iteration-protocols-workshop

A FREE and open-source workshop about JavaScript iteration protocols: iterator, iterable, async iterator, async iterable
JavaScript
112
star
8

godaddy-dns

A Node.js script to programmatically update GoDaddy DNS records
JavaScript
77
star
9

jwtinfo

A command-line tool to get information about JWTs (Json Web Tokens)
Rust
72
star
10

s3st

A command line utility that allows you to stream data from multiple S3 objects directly into your terminal
JavaScript
72
star
11

tall

Promise-based, No-dependency URL unshortner (expander) module for Node.js
TypeScript
66
star
12

webhook-tunnel

A little HTTP proxy suitable to create tunnels for webhook endpoints protected behind a firewall or a VPN
JavaScript
63
star
13

flickr-set-get

A simple command line app to download photos from a flickr set
JavaScript
59
star
14

distributed-jwt-cracker

An experimental distributed JWT token cracker built using Node.js and ZeroMQ
JavaScript
51
star
15

rust-advent

Learning Rust by solving advent of code challenges (Streaming live on Twitch every Monday)
Rust
43
star
16

terraform-openvpn

A sample terraform setup for OpenVPN using Let's Encrypt and Certbot to generate certificates
HCL
43
star
17

fastify-preact-htm-boilerplate

Quickly bootstrap your next web app with Fastify, Preact and htm
JavaScript
39
star
18

oidc-authorizer

A high-performance Lambda authorizer for API Gateway that can validate OIDC tokens
Rust
37
star
19

mongo-uri-builder

A node.js module to easily create mongodb connection strings using configuration objects
JavaScript
30
star
20

earthquake-notifier

Lambda in Rust to monitor for earthquakes and generate EventBridge events
Rust
28
star
21

public-transport-ireland

Node.js module with utility functions to get real time data for Irish public transport (Irish Rail, Luas, Dublin Bus)
TypeScript
24
star
22

realtime-transport-dashboards

Serverless APIs for AWS to build and display public transports real time data (Serverless application example)
JavaScript
23
star
23

vtt-creator

Very basic Node.js/JavaScript library to generate VTT open subtitles files
JavaScript
22
star
24

node-js-race-conditions

A series of examples illustrating race conditions in Node.js and potential solutions
JavaScript
20
star
25

swagger-jsdoc-generator

Command line script that generates a swagger file based on jsdoc comments
JavaScript
20
star
26

advent-of-solidjs

TypeScript
19
star
27

json-dynamo-putrequest

Converts an arbitrary JSON into a DynamoDB PutRequest JSON to simplify the import of the raw data
JavaScript
18
star
28

not-one-link

A simple Node.js library that allows you to re-map Amazon links from one country to another (Like Amazon OneLink™️ but simpler to use)
JavaScript
18
star
29

indexed-string-variation

Experimental JavaScript module to generate all possible variations of strings over an alphabet using an n-ary virtual tree
JavaScript
17
star
30

loige.co

Personal blog, built with Gatsby 😇
JavaScript
16
star
31

slack-shorturl-integration

A slack slash command server to shorten URLs using Rebrandly API
JavaScript
15
star
32

the-senior-dev

Slides for an opinionated talk about what it means to be a senior software engineer
CSS
14
star
33

dotfiles

my dotfiles
Shell
14
star
34

rust-lambda-workshop

A simple workshop to learn how to write, test and deploy AWS Lambda functions using the Rust programming language
Rust
14
star
35

lambda-currency-exchange-sms

An AWS lambda function that sends you an SMS (using Twilio) with today exchange rate for a give currency pair
JavaScript
13
star
36

scrobbles

A Node.js library to fetch last.fm "scrobbled" songs for a given user
JavaScript
13
star
37

univ

Universal JavaScript application example without server side transpilation (React + Fastify)
JavaScript
13
star
38

async-iteration-http-requests

Playing around with async iterators with HTTP servers
JavaScript
13
star
39

s3-presigned-urls-examples

Code examples on how to generate and use S3 pre-signed URLs using the JavaScript SDK v3
JavaScript
13
star
40

secret-pizza-party

A sample Next.js website to showcase how you can make invite-only SPAs with Next.js, AirTable & Vercel
TypeScript
13
star
41

prerender-daemon

Installer to have prerender/prerender running as daemon on a ubuntu/debian machine
Shell
12
star
42

streams-examples

A bunch of examples on how to use Node.js streams
JavaScript
11
star
43

nodeconfeu2022-notes

My notes from NodeConfEU 2022
11
star
44

mvp-contributions

CLI tool to review and submit your Microsoft MVP contributions using a YAML file
TypeScript
11
star
45

whisper-rs-example

An example of how to use Whisper.cpp bindings for Rust to perform speech-to-text
Rust
11
star
46

gulp-cozy

Manage your gulp tasks in a cozier way
JavaScript
10
star
47

react-sca

A super simple scaffold for React projects for those who believe CreateReactApp is bloated
JavaScript
10
star
48

lastfm

An async client to fetch your Last.fm listening history or the track you are currently playing
Rust
10
star
49

sample-jwt-webapp

A sample JWT web app that can be use to demonstrate how to escalate permissions by cracking and forging JWT tokens
JavaScript
10
star
50

cdk-ubuntu-ec2

An example of how to provision an Ubuntu-based EC2 instance using AWS CDK
TypeScript
9
star
51

solidjs-template

A dead simple Solid.js starter template (using npm, ESLint, StandardJS, and TypeScript)
JavaScript
9
star
52

stream-accumulator

Accumulate all the data flowing through a stream and emit it as a single chunk or as a promise
JavaScript
9
star
53

allwords

A Rust crate that allows you to generate words over a given alphabet.
Rust
8
star
54

11ty-sample-project

An example project to illustrate the main features of Eleventy 🎈🐁
JavaScript
8
star
55

mega-match-vs-phf

Benchmark to compare performance of a big (100s items) match statement against Perfect Hash Function (phf)
Rust
8
star
56

expenses

A CLI tool that takes a folder with receipts and invoices and outputs a catalog in CSV also taking care of currency conversion where needed
JavaScript
8
star
57

md-article-template

A ready-made setup to write articles in Markdown and be able to see live preview and export the article in HTML
8
star
58

javascript-iteration-protocols

Some examples regarding JavaScript powerful iteration protocols enabling `for..of` and `for await...of` syntax
JavaScript
8
star
59

not-one-link-lambda

An AWS lambda that allows you to host your own alternative of Amazon OneLink™️ to rewrite Amazon URLs
JavaScript
7
star
60

lexicoid

Rust crate implementing short & stable ids based on timestamps
Rust
7
star
61

tinykit

A tiny FREE and open-source alternative to ConvertKit for lead generation. Built with Serverless Rust on AWS
Rust
7
star
62

obs-countdown

A CLI tool to write countdown timer files for OBS Studio
Rust
7
star
63

JsMin4Assetic

Optimized PHP implementation of JsMin ready to work with assetic jsmin filter
PHP
7
star
64

next-sample-file-upload-app

Playing with Next.js and building a sample file upload app for educational purposes
JavaScript
7
star
65

lambda-image-colors

An example AWS Lambda written in GoLang to tag a picture with its prominent colors
Python
6
star
66

fib-it

6 ways to generate a fibonacci sequence in JavaScript
JavaScript
6
star
67

SymfonyConsolePimple

A sample Symfony Console app using Pimple
PHP
6
star
68

bevy-fuel-tank

A simple asteroid-like game build in Rust with Bevy
Rust
6
star
69

invok

Command line tool to Invoke Go lambda functions locally
Go
6
star
70

metrica

Event Emitter based node library that emits process metrics (uptime, memory, cpu) at given intervals
JavaScript
6
star
71

microfeat

A super simple and wildly incomplete do-it-yourself feature flag server
Rust
6
star
72

http-check

A simple Lambda to demonstrate some best practices for Node.js Lambdas
JavaScript
6
star
73

s3-list-bucket-stream

Node.js stream library that allows you to stream a list of objects from an S3 bucket
JavaScript
5
star
74

xmas

A tiny rusty Xmas tree without bells and whistles
Rust
5
star
75

aws-application-composer-demo

An AWS Application Composer project created during a LIVE demo at the AWS User Group Roma
TypeScript
5
star
76

ghost2hexo

A command line tool to convert Ghost json export to a set of source posts for Hexo
JavaScript
5
star
77

capnp-stream

A Node.js readable stream for Cap’n Proto encoded binary input
JavaScript
4
star
78

rollz

A super-simple Rust crate that allows you to... roll dice! What else would you need from a crate?
Rust
4
star
79

tapo-l920-on-off

Very simple Rust binary that can turn on/off a TP-Link L920 led light strip in your local network
Rust
4
star
80

reddit-random-image-server

A simple web server that returns a random picture from a Subreddit
JavaScript
4
star
81

lumpy

A lumpy and dummy JavaScript module bundler for those who are stuck in the past
JavaScript
4
star
82

playing-with-neon

Some simple experiment with Neon bindings: generating Node.js libraries with Rust
Rust
4
star
83

svg-invert

CLI utility and a library to invert colors in an SVG image
Rust
4
star
84

stranded-in-space

Work in progress game made with Rust and Bevy
Rust
4
star
85

js-iter-examples

Code examples from my talk "JavaScript iteration protocols"
JavaScript
4
star
86

etna-facts

Random facts about Mount Etna 🌋
JavaScript
4
star
87

nannou-sand-simulation

Simulation of sand falling down in a cave built using nannou (Rust)
Rust
4
star
88

rustlings

random exercises to learn rust (mostly to entertain myself on long plane flights ✈️)
Rust
4
star
89

x2j-cli

Node.js command line script to convert xml input into json output (can be piped easily)
JavaScript
4
star
90

bevy-wrapping-square

A simple example showcasing how to use Bevy to display a square with acceleration (controllable with your keyboard) that wraps around the screen!
Rust
3
star
91

zig-python-experiment

Trying to write a python module in zig (in a live stream)! Crazy stuff 😅
Zig
3
star
92

gmaps-static

A Rust crate to build URLs for Google Maps Static APIs
Rust
3
star
93

simple-react-universal-demo

A simple demo to demonstrate Universal JavaScript with React
JavaScript
3
star
94

mvp-activities

A simple client to interact with the Microsoft MVP activities API (not official).
JavaScript
3
star
95

paint-shop-problem

My attempt at solving the "Paint Shop Problem", a problem commonly used in interviews or coding challenges.
JavaScript
3
star
96

node-async-iterators-talk-examples

Examples from a talk about Node.js Async Iterators
JavaScript
3
star
97

LuceneNewsgroups

A simple university exercise with Apache Lucene 3.1 - This application performs indexing and search on a series of files that represent the post of some newsgroups
Java
3
star
98

opinionated-intro-to-node

Code examples for the talk "An opinionated intro to Node.js" - https://loige.link/devrupt-node
JavaScript
3
star
99

docker-web-server-test-app

A super simple web server application used to test http configuration in different dockerized environments (e.g. Kubernetes)
JavaScript
2
star
100

unzip-and-resize-images

A simple rust-based CLI that can read images from a zip file, resize them and save the resulting images in a local folder
Rust
2
star