Kalimah — Arabic Vocabulary Discord Bot

A Discord bot for learning Arabic vocabulary through spaced repetition and daily challenges, written in Rust. Built to explore async Rust and the Serenity Discord framework.

RustDiscord BotSerenityAsync RustTokioOpen Source
2024-05GitHub ↗

Overview

Kalimah (كلمة, Arabic for "word") is a Discord bot that helps learners build Arabic vocabulary through daily word challenges, spaced-repetition quizzes, and a simple streak system. It runs entirely in Rust.

Motivation

I wanted to learn async Rust — tokio, async/await, and how to manage concurrent Discord event handlers without the runtime eating itself. Arabic vocabulary cards were a topic I actually cared about, which made the project easy to stay motivated on.

Technical Stack

  • Serenity — async Rust Discord framework
  • Tokio — async runtime
  • SQLite via rusqlite — stores user progress, streak counts, word review history
  • Spaced repetition — a simple SM-2 variant implemented in pure Rust to schedule when each word re-surfaces for each user

Features

  • /word — shows the daily Arabic word with transliteration, meaning, and an example sentence
  • /quiz — spaced-repetition quiz: the bot shows the Arabic script, the user types the meaning (or vice versa)
  • /streak — displays the user's current and longest learning streak
  • /stats — per-user word mastery statistics

What I Learned

Async Rust has a steeper curve than async in most other languages because lifetimes and Send/Sync constraints interact with async. A few things I had to understand properly:

  • Why async fn in Serenity event handlers requires Send bounds on futures
  • How to share state (the SQLite connection pool) safely across async handlers using Arc<Mutex<_>>
  • Rust's trait objects and dynamic dispatch — Serenity's event system uses them heavily
  • Structuring a multi-file Rust project with clear module boundaries

Kalimah is where Rust stopped feeling hostile and started feeling like a tool I understood.


← BACK TO RUST SYSTEMS