A simple Slack bot built with Node.js and Slack Bolt. It runs in Socket Mode and provides fun slash commands for pinging, jokes, facts, dice rolls, choices, quotes, and Magic 8 Ball answers.
Clone the repository:
git clone https://github.com/declanwhchan/Slack-Bot.git
cd Slack-BotInstall dependencies:
npm installCreate a .env file in the project root:
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_APP_TOKEN=xapp-your-app-tokenRun the bot:
node index.jsIf it starts successfully, the terminal will show:
bot is running!
| Command | Description |
|---|---|
/pp-ping |
Check bot latency |
/pp-catfact |
Get a cat fact |
/pp-joke |
Get a random joke |
/pp-coinflip |
Flip a coin |
/pp-roll |
Roll a die, like /pp-roll 20 |
/pp-choose |
Pick from options, like /pp-choose pizza, sushi, tacos |
/pp-quote |
Get a random quote |
/pp-8ball |
Ask the magic 8 ball a question |
/pp-pi |
Show pi to 0-500 decimal places, like /pp-pi 50 |
/pp-help |
Show all commands |
To add new commands edit index.js and ensure to update the "Slash Commands" in https://api.slack.com/apps.
Do not commit your .env file. It contains private Slack tokens and is ignored by Git.