git clone git@github.com:reactivepixel/Max-Bot.git
If working on the official team, contact your Release Manager for the Dev Bot Token and plug that into the file max.config.js.
Otherwise if you are setting up your own Discord Bot follow the Bot Token directions:
To run the bot locally ensure that you have followed the installation instructions above.
Use docker-compose to start the container with the bot client.
docker-compose up --build
To Stop the bot run the command:
docker-compose stop
Note: Any changes to the codebase will require you to close the Docker container and re 'up'.
If all went well, and your DEBUG_MODE is set properly (See the chart below) you will see a logged message of Bot Online and Ready!:
Hop onto your discord server and find a room with the bot and run the command !help to see a display of optional commands.
The AirBnB javascript style guide has been put in place and will be enforced through active and passive linting.
Ensure your local IDE has the ability to add eslint plugins. Atom is recommended.
Locally install the style guide dependancies for Atom's IDE
npm install
Install the linter-eslint package for Atom.
npm install linter-eslint
Removing a semi-colon from any line of Javascript will trigger the linter to automatically flag the edited line.
Instead of console.log() require the tool.js file and call the .debug() method passing in three arguments (title, output, level)
[code] to call a debug() [code] to activate debug_mode
Should be a string that will prefix the output argument in the resulting console.log()
Any object that will be suffixed onto the title argument in the resulting console.log()
A number that indicates how fine grained the output of this particular output should be. Reference the Debug Level Chart
- Production Environment Level Output
- Staging Environment Level Output
- General Debug Information for Development
- Very Detailed and in-depth Output.
- Highly Fine Grained Detailed and in-depth Output.
Official Node Container used.
There are three routes that can be hit when a email is sent. The email is sent and the link that is in that email is a url with the route /welcome:code on the end. The :code is the UUID code that was sent to the user. When the email is sent and the UUID code isn't in the database the /success page will be hit because the user was verified. If the UUID code is in the database the user will be redirected to the /error page.
/welcome/:code
/error
/success
To test this you can follow the commands below:
git fetch origin
git checkout web
npm i
docker-compose down -v && docker-compose up --build
You must have experience in Node.js. You will install the dependency Nodemailer. This package is great because it has no dependencies other than Node itself. Theoretically, this package will work for more than gmail.
Note: We will create two objects: transporter and mailoptions: name, html, etc...
We will then call the sendmail method of the transporter and pass the mailoptions as an argument to the function.
Install the nodemailer dependency into your node server.
npm install nodemailer -S
Add your account credentials as variables to your environment config. They should look like this.
ACCOUNT_USERNAME: 'XXXXXXX@gmail.com'
ACCOUNT_PASSWORD: 'XXXXXXX'
Add the nodemailer.js file to your project. Copy the attached gist below.
Edit the mailoptions variable to your liking. This variable is the email to be sent to the user. There are more options than needed on nodemailer if needed. For example, you can specify the watchText option which is the text that displays on the watch.