Back to projects
Oct 07, 2023
2 min read

Moodle Mate

A Python-based tool for Moodle notifications, using LLMs for summaries and cross-platform integrations

What It Does

  • Polls Moodle for new notifications and forwards them to providers (Discord, Pushbullet, NTFY)
  • Optional AI summarization via OpenAI‑compatible endpoints (configurable model/endpoint)
  • Lightweight (~50 MB RAM), suitable for 24/7 operation or low-end hardware

Quick Start

  1. Clone and install:
git clone https://github.com/EvickaStudio/Moodle-Mate
cd Moodle-Mate
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
  1. Generate config:
python main.py --gen-config
  1. Run:
python main.py

Docker alternative:

docker compose build
docker compose up -d

Configuration (config.ini)

  • [moodle]: url, username, password
  • [ai]: enabled, api_key, model, temperature, max_tokens, system_prompt, endpoint
  • [discord]: enabled, webhook_url, bot_name, thumbnail_url
  • [pushbullet]: enabled, api_key
  • [notification]: fetch_interval, max_retries

Use --gen-config to generate and validate this file interactively.

Architecture Overview

  • CLI entrypoint (main.py): parses args, generates config, initializes services, runs main loop
  • Config loader: singleton that reads config.ini into typed sections
  • Moodle API wrapper: handles login, token/session, and REST calls
  • Notification pipeline: fetch newest notification → convert HTML→Markdown → optional LLM TL;DR → send to providers
  • Providers: Discord (webhook embed), Pushbullet, with room for custom providers

Processing Workflow

  1. Fetch newest Moodle popup notification
  2. Extract subject and HTML message; convert to Markdown
  3. If AI enabled, call LLM to produce a concise summary
  4. Send subject/message/optional summary to each enabled provider

Notes

  • Supports custom OpenAI‑compatible endpoints (e.g., self‑hosted) for summaries
  • Backoff and retries are applied in the main loop; keep fetch_interval reasonable