1
0
Fork 0

changed bot from python to javscript

This commit is contained in:
Kim, Jimin 2021-08-24 23:05:33 +09:00
parent f5d30843bf
commit 2a828df0d7

View file

@ -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:<br />
@ -13,9 +15,10 @@ Result:<br />
### 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:<br />
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": "<DISCORD_BOT_TOKEN_HERE>"
}
```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