Skip to content
This repository was archived by the owner on Jun 2, 2023. It is now read-only.
Ptolemy Brooks-Johnson edited this page Feb 20, 2019 · 7 revisions

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

Contents

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 an ssh client installed (On Windows you can use Putty, on Mac you can use the ssh command from the command line).

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_10.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 continue to the setup step.

Windows

Download and install the latest 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 navigate to a folder to install the bot using cd folder
Now run git clone https://github.com/TolleyB-J/ChatBot

Now you are ready to continue to the installing step.

Mac

I don't own a mac so sorry if this is wrong Download and install the latest 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 navigate to a folder to install the bot using cd foldername
Now run git clone https://github.com/TolleyB-J/ChatBot

Now you are ready to continue to the setup step.

Setup

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 YOUR TOKEN COULD HAVE BEEN COMPROMISED REGENERATE IT IMMEDIATELY
Rename exampleconfig.toml to config.toml Edit the config.toml file and place your token in the appropriate slot.

Don't use Notepad (or mac equivalent) as this will mess up the toml file. I recommend Notepad++

Back on the website click 'Generate OAuth2 Url'
From the list tick the administrator box
Paste the generated link into your browser, this will 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 config.toml
Fill in the rest of the options, to obtain a role id type @rolename then copy the ONLY THE NUMBER and paste in the id box.
You are done setting up! Now you are ready to start the bot.

Now run pm2 start app.js --name ChatBot
Now check in Discord, your bot should be online. To automatically run the bot on startup do pm2 startup follow the on-screen instructions then run pm2 save

If you get an error when starting the bot check your config.toml file for any errors, if you can't find any errors yourself raise an issue here

Clone this wiki locally