Skip to content
This repository was archived by the owner on Jun 2, 2023. It is now read-only.
TolleyB-J edited this page May 19, 2018 · 7 revisions

Setup

These instructions will help you get ChatBot up and running on your system.

Installing Prerequisites

To run ChatBot you need: Node.js, NPM Package Manager and PM2.

Raspberry Pi

WARNING: BACKUP YOUR SD CARD BEFORE INSTALLING, THERE IS A LOW CHANCE THAT THIS WILL CORUPT YOUR SD CARD You will need: Raspberry Pi 2/3/3B+ with the latest Raspbian (get here) installed A Windows/Mac with Putty or somesort of other ssh client installed.

Once connected via ssh run the following commands:

#Removing NodeRed
sudo apt purge node* npm*

#Installing Node
cd ~
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt install -y nodejs

#Check if node and npm are installed
node --version
npm --version

#Clone repo
cd ~
sudo apt install git
git clone https://github.com/TolleyB-J/ChatBot
cd ChatBot

Now contine to the installing step.

Windows

Download and install the LTS version of Node.JS from https://nodejs.org/en/ Now Download and install git from https://git-scm.com/downloads Open a command prompt and navagate to a folder to install the bot using cd foldername Now run git clone https://github.com/TolleyB-J/ChatBot

Now your ready to continue to the installing step.

Mac

I dont't own a mac so it would be much appreciated if someone could tell me how to do it on a mac so I can write a guide

Installing

Now we've finished with the prerequisites now we need to install and configure the bot.

Open a command line a navigate to the cloned folder and run the following commands

npm install -g pm2
npm install

Note: During npm install you may get some warnings just ignore them.

Go to https://discordapp.com/developers/applications/me Click on 'New App Give your bot a name and press 'Create App' Scroll down and click 'Create Bot User' Tick Public Bot Then next to token click 'Click to reveal' WARNING: DO NOT SHOW YOUR TOKEN TO ANYONE, IF YOU ACCIDENTLY SHOW SOMEONE REGENERATE IT IMMEDIATELY Edit your settings.json file and place your token in the appropriate slot.

Windows Users: Don't use notepad as this will mess up the json file. I recommend Notepad++

Back on the website click 'Generate OAuth2 Url' From the list tick the administrator box Click copy then paste in the join link box of settings.json Also paste the link into your browser, this wil invite the bot to your server. Your bot will appear offline, don't worry this is normal. In the discord app, open your user settings then select appearance and turn on developer mode. Go back to a text channel. Next to the chat there is a list of names, right click yours and click 'Copy ID' Paste this in the owner id section of settings.json Fill in the rest of the options, to obtain a role id type @rolename then copy the NUMBER ONLY and paste in the id box. Your done! Now your ready to start the bot.

Now run pm2 start app.js --name ChatBot To automaticly run the bot on start up do pm2 startup follow the on screen instuctions then run pm2 save

If you get an error check your settings.json with this if its not json related raise an issue on github

Clone this wiki locally