My word is your command; everything I command, I will empower you to fulfill. Make this pact with me now.
Mercury's Charge is a Slack chatbot built in Node.js to act as a development platform for custom tooling.
This is a generic purpose chatbot that takes user input and executes pre-designated javascript files. I have tried to make it:
- Modular - for development ease
- Stateless - philosophical development approach
- Modern - utilize latest language features
I imagine that a task runner with access to multiple input channels could be developed into something much more complex, therefore I want to build in modularity from the beginning. I think this is a good approach even from the start as it has eased my transition to Mercury and my development of cron functionality with the Sundial.
I have found stateless programming to make handling asynchronous web development relatively easier and more complex interactions can be accommodated using CLI-style input parsing. I am not sure if I can truly say this application is stateless, as it does have memory utilizing MongooseDB, but I digress!
This is a learning tool as much as it is a professional tool. I want to learn modern coding practices, especially transitioning my asynchronous code to fully Promise-based and afterwards weigh the pros/cons of Async/Await. I also want to develop out chatbot technologies and see if I can integrate bleeding-edge development into this project!
Create a new Slack Bot, give it a name and copy its API token. The token will start with xoxb-
.
Install MongoDB. Then:
git clone https://github.com/mstraughan86/Mercurys-Charge.git
cd Mercurys-Charge
npm install
npm --prefix ./lib/Mercury install ./lib/Mercury
npm --prefix ./lib/Mercurys-Sundial install ./lib/Mercurys-Sundial
npm --prefix ./lib/Example-Library install ./lib/Example-Library
Open the file in root named .env
and insert Bot API Token:
SLACK_API_TOKEN=xoxb-example
npm start
- MongoDB
- Mongoose
- NodeJS
- Mercury
- Make
./commands/example_command.js
- Add example_command to
./config/commands.json
- Make
./commands/example_library.js
- Add example_library to
./config/commands.json
- Make
./lib/Example-Library directory
- Add example_library to
./lib/index.js
I have created this project so that it utilizes git's subtree functionality, to allow for a "project" within a "project" design. This enables me to keep each subtree within its own repository and the ability to update/upgrade individual subtree modules segregated away from my main application. This goes hand-in-hand with making this project as modular as possible.
This is how Mercury's Sundial is imported for development:
git remote add -f Mercurys-Sundial [email protected]:mstraughan86/Mercurys-Sundial.git
git merge -s ours --no-commit --allow-unrelated-histories Mercurys-Sundial/master
git read-tree --prefix=lib/Mercurys-Sundial -u Mercurys-Sundial/master
git commit -m "Subtree merged in Mercurys-Sundial"
We push and pull to the subtree repository from within our main project repository. For Mercury's Sundial, it would look like:
git subtree push --prefix=lib/Mercurys-Sundial Mercurys-Sundial master
git push Mercurys-Sundial $(git subtree split --prefix=lib/Mercurys-Sundial --onto=Mercurys-Sundial/master):master
git subtree pull --prefix=lib/Mercurys-Sundial Mercurys-Sundial master
- Config
.env
files are locked down using a git command. If you want to update the file for development, try these:
git update-index --skip-worktree .env
git update-index --no-skip-worktree .env
Remember, if the subtree module also uses an .env
file, please do the same.
- Mercury's Sundial: Cron for Slack
-
Mercury Fork -
Cron - Advanced Message Management
- Advanced User Profiles
- Automatic Archive Mode
- Free Tier Enhancements
- Continuous Integration with Github
- Self-Join Channels Hack
- Refactor ./util.js and ./utilities
- Raspberry Pi Deployment Instructions
- Dockerfile
- SMS via Twilio
- FB Messenger Integration
- IRC Integration
- Intercomm Integration
- Rocket.Chat Compatibility
- Legend of the Green Dragon
- Other BBS Games