LXMF bot framework
Find a file
2025-11-12 18:45:52 -06:00
.github/workflows Update Dockerfile paths in CI workflows to reflect new directory structure 2025-11-03 11:58:12 -06:00
docker move docker files to a folder 2025-11-03 11:47:24 -06:00
lxmfy Bump version to 1.0.3 2025-11-03 16:56:42 -06:00
tests Fix signature hashing in SignatureManager to use hex representation 2025-09-28 22:41:28 -05:00
.deepsource.toml Update DeepSource configuration to exclude test files from analysis 2025-09-27 03:37:52 -05:00
.dockerignore add 2025-07-14 12:53:49 -05:00
.gitignore Update 2025-09-27 03:35:11 -05:00
CHANGELOG.md Update CHANGELOG.md 2025-11-03 16:56:49 -06:00
LICENSE License update 2025-04-29 02:25:03 -05:00
Makefile Update Makefile to reference Docker files in the new directory structure 2025-11-03 11:47:34 -06:00
poetry.lock Bump lxmf and rns versions to 0.9.2 and 1.0.2 respectively in poetry.lock, pyproject.toml, requirements.txt, and uv.lock 2025-11-12 18:45:52 -06:00
pyproject.toml Bump lxmf and rns versions to 0.9.2 and 1.0.2 respectively in poetry.lock, pyproject.toml, requirements.txt, and uv.lock 2025-11-12 18:45:52 -06:00
README.md Update README.md 2025-11-03 11:54:49 -06:00
requirements.txt Bump lxmf and rns versions to 0.9.2 and 1.0.2 respectively in poetry.lock, pyproject.toml, requirements.txt, and uv.lock 2025-11-12 18:45:52 -06:00
SECURITY.md Update 2025-07-14 01:56:29 -05:00
setup.py Refactor versioning to use a single source of truth in lxmfy/__version__.py and update to 0.7.6. 2025-07-05 22:53:19 -05:00
uv.lock Bump lxmf and rns versions to 0.9.2 and 1.0.2 respectively in poetry.lock, pyproject.toml, requirements.txt, and uv.lock 2025-11-12 18:45:52 -06:00

LXMFy

Socket Badge DeepSource Build Test Publish Python distribution to PyPI Safety Test

Easily create LXMF bots for the Reticulum Network with this extensible framework.

Docs | Road to V1

Features

  • Spam protection (rate limiting, command cooldown, warnings, banning)
  • Command prefix (set to None to process all messages as commands)
  • Announcements (announce in seconds, set to 0 to disable)
  • Extensible Storage Backend (JSON, SQLite)
  • Permission System (Role-based)
  • Middleware System
  • Task Scheduler (Cron-style)
  • Event System
  • Help on first message
  • LXMF Attachments (File, Image, Audio)
  • Customizable Bot Icon (via LXMF Icon Appearance field)
  • Threading support for commands.
  • Cryptographic Message Signing & Verification

Installation

pip install lxmfy

or pipx:

pipx install lxmfy

or uv:

uv sync

or via git

pipx install git+https://github.com/lxmfy/LXMFy.git

or temporary environment with uv:

uvx --from git+https://github.com/lxmfy/LXMFy.git lxmfy

Usage

lxmfy

or with uv:

uv run lxmfy

Create bots:

lxmfy create

Docker

Building Manually

To build the Docker image, navigate to the root of the project and run:

docker build -t lxmfy-test .

Once built, you can run the Docker image:

docker run -d \
    --name lxmfy-test-bot \
    -v $(pwd)/config:/bot/config \
    -v $(pwd)/.reticulum:/root/.reticulum \
    --restart unless-stopped \
    lxmfy-test

Auto-Interface support (network host):

docker run -d \
    --name lxmfy-test-bot \
    --network host \
    -v $(pwd)/config:/bot/config \
    -v $(pwd)/.reticulum:/root/.reticulum \
    --restart unless-stopped \
    lxmfy-test

Building Wheels with docker/Dockerfile.Build

The docker/Dockerfile.Build is used to build the lxmfy Python package into a wheel file within a Docker image.

docker build -f docker/Dockerfile.Build -t lxmfy-wheel-builder .

This will create an image named lxmfy-wheel-builder. To extract the built wheel file from the image, you can run a container from this image and copy the dist directory:

docker run --rm -v "$(pwd)/dist_output:/output" lxmfy-wheel-builder

This command will create a dist_output directory in your current working directory and copy the built wheel file into it.

Example

from lxmfy import LXMFBot, load_cogs_from_directory

bot = LXMFBot(
    name="LXMFy Test Bot", # Name of the bot that appears on the network.
    announce=600, # Announce every 600 seconds, set to 0 to disable.
    announce_enabled=True, # Set to False to disable all announces (both initial and periodic)
    announce_immediately=True, # Set to False to disable initial announce
    admins=["your_lxmf_hash_here"], # List of admin hashes.
    hot_reloading=True, # Enable hot reloading.
    command_prefix="/", # Set to None to process all messages as commands.
    cogs_dir="cogs", # Specify cogs directory name.
    rate_limit=5, # 5 messages per minute
    cooldown=5, # 5 seconds cooldown
    max_warnings=3, # 3 warnings before ban
    warning_timeout=300, # Warnings reset after 5 minutes
    signature_verification_enabled=True, # Enable cryptographic signature verification
    require_message_signatures=False, # Allow unsigned messages but log them
)

# Dynamically load all cogs
load_cogs_from_directory(bot)

@bot.command(name="ping", description="Test if bot is responsive")
def ping(ctx):
    ctx.reply("Pong!")

# Admin Only Command
@bot.command(name="echo", description="Echo a message", admin_only=True)
def echo(ctx, message: str):
    ctx.reply(message)

bot.run()

Cryptographic Message Signing

LXMFy supports cryptographic signing and verification of messages for enhanced security:

bot = LXMFBot(
    name="SecureBot",
    signature_verification_enabled=True,  # Enable signature verification
    require_message_signatures=False,     # Allow unsigned messages but log them
    # ... other config
)

CLI Commands for Signatures

# Test signature functionality
lxmfy signatures test

# Get enable instructions
lxmfy signatures enable

# Get disable instructions
lxmfy signatures disable

Development

  • poetry or uv
  • python 3.11 or higher

With poetry:

poetry install
poetry run lxmfy run echo

With uv:

uv sync
uv run lxmfy run echo

Contributing

Pull requests are welcome.

Part of Quad4

LXMFy is a Quad4 project.

License

MIT