Logo Lanfrica

ayoubanlouf/NoDarijaBot

Domaine:

natural language processing

Type de record:

softwaretools
Créateur:
ayo
HĂ´te:
Reaction triggered Darija-to-English translation Discord Bot # NoDarija 🇲🇦→🇺🇸 A Discord bot that translates **Darija (Moroccan Arabic)** messages into **English**. When an allow-listed member reacts to a message with the **US flag (🇺🇸)**, the bot replies with the English translation. ## Why an AI model? Darija has **no standard spelling** — it's written in Arabic script, Latin script ("Arabizi", e.g. `kifash`, `wach`, `daba`), or a messy mix of both. Traditional translation engines (like Google Translate) handle it poorly or not at all. This bot uses **Groq's free tier** to run **`groq/compound`**, a high-accuracy LLM with **no daily token limit**. If it hits a rate limit, the bot automatically falls back to **`openai/gpt-oss-120b`**. Both understand the dialect, slang, and mixed scripts far better than traditional engines. Groq is free to use — **no payment or credit card required**. ## How it works - `on_raw_reaction_add` listens for 🇺🇸 reactions on every message. - Only members added by the bot owner (via `!add`) trigger a translation. - The reacted message is translated by the AI model on Groq (`groq/compound`, with automatic fallback to `openai/gpt-oss-120b`). - The bot **replies directly to the message** (proper Discord reply box) with `mention_author=False` plus a bot-wide `AllowedMentions(replied_user=False)` — the author is **never pinged or notified**. - The allow-list is stored in a local **SQLite** database (`data/nodarija.db`) using `aiosqlite`. ## Commands (owner only) | Command | Description | | -------------------- | ---------------------------------------------- | | `!add @user` | Allow the user to request translations. | | `!remove @user` | Remove the user from the allow-list. | > **Note:** The bot owner is resolved automatically by Discord from the > application the token belongs to. Add **your account as the application > owner** in the Discord Developer Portal. ## Setup ### 1 …