3.1 KiB
Setting up
:::info This documentation uses the dev branch (javascript) instead of the master branch (python). :::
In this documentation, you will learn how to set up the llama discord bot.
Steps
Pre-requirements
- Node.js 16.6.0+
- yarn
- A Discord account
- A Google Firebase account
A sacrifice to be given to the llama gods(no longer needed)
Discord
- Create a new application from the Discord Developer Portal. Select one if you already have it.
- Go to the
Bot
tab and convert your application to a discord bot. Be cautious since this operation is NOT REVERSIBLE. - Copy the bot token. This will be used during the Server setup.
Firebase
-
Create a firebase project.
-
Enable firestore database (usage of production mode is highly recommended).
-
Generate and download the service account key. This will be used during the Server setup.
Server
:::info Assumes UNIX-like environment (Linux, BSD, Mac, etc.) :::
-
Clone the llama bot repository and open it.
git clone https://github.com/llama-bot/llama-bot.git
cd llama-bot
-
Install dependencies.
yarn install
-
Create
.env
file in the project root and put the discord bot token generated during the Discord setup.TOKEN=PUT_YOUR_DISCORD_BOT_TOKEN_HERE TESTING=true # set it to false on production PREFIX_PROD=PUT_PRODUCTION_DEFAULT_PREFIX_HERE PREFIX_DEV=PUT_DEVELOPMENT_DEFAULT_PREFIX_HERE OWNER_IDS=ID1,ID2,ID3,...
-
Create
secret
directory in thesrc
directory, rename the firebase admin key generated during the Firebase setup tofirebase-adminsdk.json
, and put it in thesecret
directory. -
Build the bot.
yarn build
-
Install pm2 globally.
yarn global add pm2
-
Start the bot.
pm2 start build/index.js --watch --name "Llama Bot"
Option Explanation --watch
Auto restart bot if bot files have been changed --name "Llama Bot"
Set the name of the process so it can be easily recognized -
Make the process automatically start on boot.
pm2 startup
More info
- discord developers documentation
- discord API's javascript implementation documentation, guide, and bot framework documentation
- firebase admin sdk documentation
- pm2 documentation