Skip to main content
This guide walks you through writing scripts for Flume, from basic event handling to advanced patterns like custom commands with help text, persistent config, buffer management, and more.
Vault access: Autoload scripts run after the vault is unlocked, so flume.vault.get() works at module load time. You can safely read secrets at the top level of your script.
Script errors: Load failures and runtime errors are displayed as system messages in the flume buffer with full tracebacks — no need to check log files.

Script Structure

Every script follows the same pattern:
  1. Import the flume module (Python only — Lua has it globally)
  2. Register event handlers and/or custom commands
  3. Flume calls your handlers when events occur
Lua:
Python:

Custom Commands with Help

The third argument to flume.command.register is the help text shown when users type /help <command>: Lua:
Python:
Now /help weather shows: /weather — Check weather for a city. Usage: /weather <city>

Printing to Buffers

flume.buffer.print(server, buffer, text) prints a message to a specific buffer. Use empty strings "" for the active server/buffer:

Switching Buffers

Sending Messages

Persistent Script Config

Scripts can store and retrieve configuration values that persist across sessions using flume.config.get/set. Each script gets its own config file at ~/.local/share/flume/scripts/data/<scriptname>/config.toml. Lua:
Python:

Reading Vault Secrets

Scripts can read secrets stored in the encrypted vault via flume.vault.get(name). This is useful for scripts that need API keys, passwords, or tokens without hardcoding them. Store secrets first:
Lua:
Python:
Returns nil (Lua) or None (Python) if the secret doesn’t exist.
Vault secrets are read-only from scripts. Use /secure set to store them. Be careful not to print secrets to buffers — other users can see channel messages.

Sending Desktop Notifications

Sending Raw IRC Commands

For anything not covered by the API, send raw IRC protocol lines:

Event Cancellation

Scripts can cancel events to prevent them from being displayed: Lua:
Python:

Practical Examples

Auto-Reply When Away

Channel Logger

Nick Highlighter with Sound

Python: URL Title Fetcher (with pip packages)

Python scripts have full import access — use any pip package:

Managing Autoload

Debugging Tips

  • Use flume.buffer.print("", "", "debug: " .. variable) to print debug info
  • Check /script list to verify your script loaded
  • Check the Flume log at ~/.local/share/flume/logs/flume.log for errors
  • Reload after changes: /script reload myscript
  • Python import errors show as load failures — check that deps are installed