From 2a828df0d705f43f2f5b936d5aef7d263d0320a5 Mon Sep 17 00:00:00 2001 From: developomp Date: Tue, 24 Aug 2021 23:05:33 +0900 Subject: [PATCH] changed bot from python to javscript --- docs/3-bot/2-setting-up.md | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/docs/3-bot/2-setting-up.md b/docs/3-bot/2-setting-up.md index e90903b..0288e6b 100644 --- a/docs/3-bot/2-setting-up.md +++ b/docs/3-bot/2-setting-up.md @@ -4,6 +4,8 @@ sidebar_position: 2 # Setting up +> Use the [dev branch](https://github.com/llama-bot/llama-bot/tree/dev) (javascript) instead of the master branch (python). + This page will teach you how to set up the [llama discord bot](https://github.com/llama-bot/llama-bot). Result:
@@ -13,9 +15,10 @@ Result:
### Pre-requirements -- Python version 3.9 or greater -- Discord account -- Google Firebase account +- Node.js 16.6.0+ +- [yarn](https://yarnpkg.com) +- A Discord account +- A Google Firebase account - ~~A sacrifice to be given to the llama gods~~ (no longer needed) ### Discord @@ -33,7 +36,7 @@ Result:
2. Create firestore database (production mode is highly recommended). 3. [Generate and download](https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk) the service account key. This will be used during the [Server](#server) setup. -### Server +### Bot :::info Assumes UNIX-like environment (Linux, BSD, Mac, etc.) @@ -49,29 +52,28 @@ Assumes UNIX-like environment (Linux, BSD, Mac, etc.) cd llama-bot ``` -2. Install python dependencies. +2. Install dependencies. ```bash - pip install -r requirements.txt + yarn install ``` -3. Create `secrets` directory in the `bot` directory. -4. In the `secrets` directory, create `secret.json` and put the discord bot token generated during the [Discord](#discord) setup. +3. Create `.env` file in the project root and put the discord bot token generated during the [Discord](#discord) setup. - ```json title="bot/secret.json" - { - "token": "" - } + ```text title=".env" + TOKEN=PUT_YOUR_DISCORD_BOT_TOKEN_HERE ``` -5. Rename firebase admin key generated during the [Firebase](#firebase) setup to `firebase-adminsdk.json`, and put it in the `secrets` directory. +4. Create `secret` directory in the `src` directory, rename firebase admin key generated during the [Firebase](#firebase) setup to `firebase-adminsdk.json`, and put it in the `secret` directory. + +TODO: systemd and/or auto restart/reload pm2? ## Testing -After following all the [steps](#steps), `cd` into the `bot` directory and run the following command: +After following all the [steps](#steps), run the following command to start the bot: ```bash -python llama.py +yarn start ``` If everything is set up correctly, this should start the bot and load all the cogs. [Web Interface](/docs/web-interface/overview) will not work if the [API](/docs/api/overview) is not set up. @@ -79,5 +81,5 @@ If everything is set up correctly, this should start the bot and load all the co ## More info - discord developers documentation: https://discord.com/developers/docs -- [discord python API](https://github.com/Rapptz/discord.py) documentation: https://discordpy.readthedocs.io +- discord API's javascript implementation [documentation](https://discord.js.org/#/docs), [guide](https://discordjs.guide), and bot [framework documentation](https://sapphiredev.github.io/framework) - firebase admin sdk documentation: https://firebase.google.com/docs