This bot is configurable through environmental variables that can be defined like so:
PREFIX=! node index.js
These are the following variables that you are required to set:
Config | Default | Description |
---|---|---|
TLURL |
"localhost" | Base URL to your own LibreTranslate |
PORT |
"80" | Used for a translator api if it is hosted locally on your computer. Used with default TLURL and if it was not previously defined. |
PREFIX |
"!" | The prefix used to interact with the discord bot. |
DISCORD_TOKEN |
"" | A discord token for running a discord bot. Refer here. Not an optional variable. |
DATABASE_URL |
"" | A database URL used for Prisma to store a guild's config. Not an optional variable. |
Hold onto your environmental variables, there are some prerequisites to using this discord bot.
- A selfhosted LibreTranslate API
- NodeJS
- NPM
- A database that Prisma supports.
- A Discord Account.
Everything checks out? Ok, now to get with setting this mayhem up!
-
Initial setup
Install all dependencies
npm install
Generate Prisma Client
npx prisma generate
-
Prepare your environemtnal variables!
Run the bot!
TLURL="https://libretranslate.com" PREFIX="tl!" DISCORD_TOKEN="totallylegittoken" DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public" node index.js