Logo Lanfrica

BacemGarrouch/derja-discord-bot

Domaine:

natural language processing

Type de record:

software
Créateur:
Bac
Hôte:
# Discord Derja Translate + Meaning Bot Translates messages posted in Tunisian Derja and answers `/meaning ` lookups, checking a local glossary first and falling back to a web search (Tavily) + LLM (via OpenRouter) explanation. ## 1. Push to GitHub ```bash git init git add . git commit -m "Initial commit" git branch -M main git remote add origin github.com / .git git push -u origin main ``` `.env` is git-ignored on purpose — never commit real tokens. Use `.env.example` as the template for what's needed. ## 2. Deploy on Koyeb 1. Go to koyeb.com → **Create Service** → **GitHub**, and pick this repo. 2. **Service type: `Worker`** (not `Web`). A Discord bot doesn't listen on a port, so it doesn't need a health-checked web service — Worker skips that entirely. 3. Builder: Koyeb auto-detects Node.js from `package.json`, runs `npm install`, and starts it with `npm start`. No Dockerfile needed. 4. Under **Environment variables**, add each of these (see `.env.example` for what they are): - `DISCORD_TOKEN` - `DISCORD_CLIENT_ID` - `OPENROUTER_API_KEY` - `OPENROUTER_MODEL` (optional, has a default) - `TAVILY_API_KEY` - `TARGET_LANGUAGE`, `TRANSLATE_CHANNEL_IDS`, `MIN_LENGTH` (optional) 5. Deploy. Check the **Logs** tab for `Logged in as #1234` to confirm it's connected. 6. From now on, every `git push` to `main` auto-redeploys the bot. ## 3. Register the `/meaning` slash command This only needs to be run once (and again any time you change the command definition in `deploy-commands.js`) — it's not something the running bot needs to do on every boot. Easiest is to run it locally, once, with the same `.env` values: ```bash npm install npm run deploy ``` If you'd rather not run anything locally, you can instead open a **one-off job** on Koyeb (or temporarily add `&& npm run deploy` to the start command for a single deploy, then remove it) — but local is simplest since it's a one-time action.