Skip to main content

A simple Matrix bot that fetches Bible verses

Project description

Matrix BibleBot

A simple Matrix bot that fetches Bible verses using APIs from bible-api.com & esv.org

PyPI version Python Tests

Supported Translations

  • King James Version (KJV)
  • English Standard Version (ESV) - requires an API key
  • Easily extensible to support additional translations

Installation

Install from PyPI (Recommended)

pip install matrix-biblebot

For an isolated installation, you can use pipx:

pipx install matrix-biblebot

Install from Source

Clone the repository:

git clone https://github.com/jeremiah-k/matrix-biblebot.git
cd matrix-biblebot
pip install .

For development:

pip install -e .

Configuration

1. Create a .env file

Create a .env file in the same directory as your config file (e.g., ~/.config/matrix-biblebot/.env) with your Matrix access token and any API keys:

MATRIX_ACCESS_TOKEN="your_bots_matrix_access_token_here"
ESV_API_KEY="your_esv_api_key_here"  # Optional

The bot will first look for a .env file in the same directory as your config file. If not found, it will fall back to looking in the current working directory.

2. Create a config.yaml file

The bot looks for a configuration file at ~/.config/matrix-biblebot/config.yaml by default. You can generate a template configuration file with:

biblebot --generate-config

This will create a sample config file with the following structure:

matrix_homeserver: "https://your_homeserver_url_here"
matrix_user: "@your_bot_username:your_homeserver_domain"
matrix_room_ids:
  - "!your_room_id:your_homeserver_domain"
  - "!your_other_room_id:your_homeserver_domain"

Edit this file with your Matrix credentials and room IDs.

You can also specify a custom config location:

biblebot --config /path/to/your/config.yaml

Or generate a config at a custom location:

biblebot --generate-config --config /path/to/your/config.yaml

Usage

Running the Bot

After installation and configuration, you can run the bot with:

biblebot

Or with custom options:

biblebot --config /path/to/config.yaml --log-level debug

Command-line Options

usage: biblebot [-h] [--config CONFIG] [--log-level {error,warning,info,debug}] [--generate-config] [--version]

BibleBot for Matrix

options:
  -h, --help            show this help message and exit
  --config CONFIG       Path to config file (default: ~/.config/matrix-biblebot/config.yaml)
  --log-level {error,warning,info,debug}
                        Set logging level (default: info)
  --generate-config     Generate a sample config file at the specified path
  --version             show program's version number and exit

Interacting with the Bot

Invite the bot to rooms that are listed in the config.yaml file. The bot will respond to messages that match Bible verse references:

  • Simple reference: John 3:16
  • Range reference: 1 Cor 15:1-4
  • With translation: John 3:16 esv

Development

Contributions are welcome! Feel free to open issues or submit pull requests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

matrix_biblebot-0.1.1.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

matrix_biblebot-0.1.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file matrix_biblebot-0.1.1.tar.gz.

File metadata

  • Download URL: matrix_biblebot-0.1.1.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for matrix_biblebot-0.1.1.tar.gz
Algorithm Hash digest
SHA256 97f65dd0ccadd4f829327ea41774a7b41f7ad78b7f406c769d9bc9ef22bb52fd
MD5 98dd1a1ee3704733c33971d7c7dc329c
BLAKE2b-256 da47084d95808bd4c9e1528d83cacad8ab58da77092a03a09fac9a393558a26e

See more details on using hashes here.

Provenance

The following attestation bundles were made for matrix_biblebot-0.1.1.tar.gz:

Publisher: pypi-publish.yml on jeremiah-k/matrix-biblebot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file matrix_biblebot-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for matrix_biblebot-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b2290154eae53f5eea7f699020265f38465acd55595dd066051f7e5950d7e470
MD5 13089dee485ebed157e1978646ffd57c
BLAKE2b-256 a7681fe96dde3694012468276ab4918b9c0c4066ff0d03419ba5806b849c976f

See more details on using hashes here.

Provenance

The following attestation bundles were made for matrix_biblebot-0.1.1-py3-none-any.whl:

Publisher: pypi-publish.yml on jeremiah-k/matrix-biblebot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page