1
0
Fork 0
llama-bot-docs/docs/3-bot/2-setting-up.md

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

  1. Create a new application from the Discord Developer Portal. Select one if you already have it.
  2. Go to the Bot tab and convert your application to a discord bot. Be cautious since this operation is NOT REVERSIBLE.
  3. Copy the bot token. This will be used during the Server setup.

Firebase

  1. Create a firebase project.

    https://console.firebase.google.com

  2. Enable firestore database (usage of production mode is highly recommended).

  3. 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.) :::

  1. Clone the llama bot repository and open it.

    git clone https://github.com/llama-bot/llama-bot.git
    
    cd llama-bot
    
  2. Install dependencies.

    yarn install
    
  3. 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,...
    
  4. Create secret directory in the src directory, rename the firebase admin key generated during the Firebase setup to firebase-adminsdk.json, and put it in the secret directory.

  5. Build the bot.

    yarn build
    
  6. Install pm2 globally.

    yarn global add pm2
    
  7. 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
  8. Make the process automatically start on boot.

    pm2 startup
    

More info