Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.
/ GoalBot Public archive

A small Discord bot created to create and manage any type of money goal and display them through messages

License

Notifications You must be signed in to change notification settings

ZixeSea/GoalBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoalBot

Creating and managing goals made easy!
discord server Eris Badge Version Badge Version Badge

General information

Author

ZixeSea#1234 - Lead developer - github: ZixeSea

The project

This project has been created after a request from Brasscoin, he needed a simple to use goal bot that working without linking platforms like Patreon. The requirements for the bot were that people could create, update and delete goals, there would also be a show command that can show the process of a goal including a progress bar.

Required dependencies

eris - A Node.js wrapper for interfacing with Discord.
mongoose - A MongoDB object modeling tool designed to work in an asynchronous environment.
asciiart-logo - renders a splash screen in text console with logo from ASCII characters.

Optional dependencies

bufferutil - Makes ws requests faster and adds some utilities to efficiently perform.
eventemitter3 - it's a high performance EventEmitter.
pako - zlib port to javascript, very fast!

License

This project is licensed under the MIT License - see the LICENSE file for details (deleting and/or modifying the license file after forking isn't allowed).


Table of contents

1. Preparations
    1.1. Requirements
    1.2. Get code

2. Config
    2.1. Bot config
    2.2. PM2 config

3. Linux
    3.1. Update system (L)
    3.2. Install Node.js (L)
    3.3. Install PM2 (L)
    3.4. Install MongoDB (L)
    3.5. Start the bot (L)

4. Windows
    4.1. Install Node.js (W)
    4.2. Install PM2 (W)
    4.3. Install MongoDB (W)
    4.4. Start the bot (W)


Preparations

Requirements

git command line (Windows|Linux|MacOS)
node version 14.17.3 or higher (expained later)
mongodb DB used by the bot (expained later)
token required to start the bot get here

The bot also only requests minimal permissions, this means you can use 84992 and that should be enough.
Example link: https://discord.com/oauth2/authorize?client_id=(bot-ID)&permissions=84992&scope=bot+applications.commands\

⚠️ WARNING ⚠️
MongoDB and Node.js are required to run the bot but the installation of them are explained under "Linux" and "Windows".

Get code

Run the following command in a CMD/terminal window in the location where you want the folder to be.

git clone https://github.com/ZixeSea/GoalBot.git

⚠️ WARNING ⚠️
Remember to change the config file after getting the code otherwise, it won't work (more info here).


Config

Bot config

You can find the config file in the folder that was created in the previous step ("this one"), it should be in the folder "config" and there change the file "production.json".\

In the bot config file, there are 5 really important things that must be changed first, here is what they mean
token The token you got from the discord dashboard
modRole A list of role IDs that can create, update and delete goals
showForEveryone If you set this to false, only mod roles can use /show
guild The guild ID you're going to use the bot in
db Any lower case name (can't be changed afterward)
host IP or hostname where the Mongo DB is hosted (if on the same system use 127.0.0.1)
mongoOptions Don't change stuff here (it will break stuff if you do)\

Hereunder is an example config:

{
	"bot": {
		"token": "123",
		"modRole": [ "123", "123" ],
		"showForEveryone": true,
		"guild": "123"
	},
	"db": {
		"db": "goalbot",
		"host": "127.0.0.1",
		"mongoOptions": {
			"useNewUrlParser": true,
			"useUnifiedTopology": true
		}
	}
}

PM2 config

You can find the config file in the folder that was created in the previous step ("this one").\

In the PM2 config file there are only 2 things you should change to make sure PM2 can find the code and does are
script Should be the path to "src/index.js" (in windows use something like this: "c:\GoalBot\src\start.js")
cwd Should be the path to "src" folder (in windows use something like this: "c:\GoalBot\src")\

Hereunder is an example config:

{
	"apps": [
		{
			"name": "GoalBot",
			"script": "/root/GoalBot/src/start.js",
			"cwd": "/root/GoalBot/src",
			"instances": "1",
			"exec_mode": "fork",
			"max_memory_restart": "1G",
			"autorestart": true
		}
	]
}

Linux

⚠️ WARNING ⚠️
Everything in this section is based on a server running Ubuntu 18.04 without GUI, this bot and all commands mentioned here can be performed on another distro but the commands or steps may be slightly different.

Update system (L)

To make you get the most recent versions of any software you download, update your system first with the following command in a terminal window.

sudo apt update && sudo apt upgrade -y

Install Node.js (L)

Run the following 2 commands in a terminal window to install Node.js.

curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs

Install PM2 (L)

Run the following 2 commands in a terminal window to install PM2.

sudo npm i pm2 -g
pm2 startup

Install MongoDB (L)

Run the following 5 commands in a terminal window to install MongoDB and autostart it on reboot.

wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
sudo apt update
sudo apt install -y mongodb-org
sudo systemctl enable mongod

Start the bot (L)

Open the folder you downloaded in the previous step ("this one"), and open a terminal window there and run the following 3 commands.

npm i
pm2 start pm2.json
pm2 save

Windows

⚠️ WARNING ⚠️
Everything in this section is based on a server running Windows 10, this bot and all commands mentioned here can be performed on another Windows version but the commands or steps may be slightly different.

Install Node.js (W)

Installing Node.js on windows is really easy, they have a normal installer for it and you can download it on their website (so it's simply clicking "next" and "ok").
Link: https://nodejs.org/en

Install PM2 (W)

Run the following 2 commands in a CMD window to install PM2.

npm i pm2 -g

Install MongoDB (W)

Installing MongoDB on windows is really easy again, it's also a normal installer like Node.js (so it's simply clicking "next" and "ok").
Link: https://www.mongodb.com/try/download/community

⚠️ WARNING ⚠️
Make sure you install "MongoDB Community Server", the version is less important so pick the default selected one.

Start the bot (W)

Open the folder you downloaded in the previous step ("this one"), and open a CMD window there and run the following 3 commands.

npm i
pm2 start pm2.json
pm2 save

About

A small Discord bot created to create and manage any type of money goal and display them through messages

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published