Skip to content

Latest commit

 

History

History
84 lines (55 loc) · 3.89 KB

README.md

File metadata and controls

84 lines (55 loc) · 3.89 KB

Welcome to ShoutBot 👋

Version License: GPL--3.0

This project is a bridge between TI-Planet shoutbox and Discord

Contribute:

If you find a bug, or want some feature you can open an issue. Otherwise you could create a pull request, and if the pull request is good we can think about merging it.

Setup:

Requirements

Use Python 3.13 or 3.14 and Poetry 2.5.2. The Docker image uses Python 3.13.

Install

Initialize the parser submodule and install the locked dependencies from the checkout. Use python3.14 in the environment command if that is your installed version.

git submodule update --init --recursive
poetry env use python3.13
poetry sync

Native install on Debian 11

Debian 11 ships Python 3.9. Install a separate Python 3.13 interpreter for ShoutBot with uv. Run the setup as the service account from the checkout. Install uv

git submodule update --init --recursive
uv python install --no-bin 3.13
shoutbot_python="$(uv python find --managed-python 3.13)"
export POETRY_VIRTUALENVS_IN_PROJECT=true
uv tool run --python "$shoutbot_python" --from 'poetry==2.5.2' poetry env use "$shoutbot_python"
uv tool run --python "$shoutbot_python" --from 'poetry==2.5.2' poetry sync --only main

Run .venv/bin/python main.py from the checkout. For a systemd service, set WorkingDirectory to the checkout and use the absolute paths to .venv/bin/python and main.py in ExecStart. Keep config_override.json and lastId.json in the checkout across updates.

Config

For setting up the bot, you need :

  • A Discord bot with Message Content Intent enabled under Bot → Privileged Gateway Intents in the Discord Developer Portal
  • A TI-Planet account
  • A webhook in your shoutbox Discord channel

The defaults are in config.json. Copy config_override.json.default to config_override.json before entering your credentials.

Enter the Discord bot token, webhook ID and token, and TI-Planet account credentials in config_override.json. Values in this file override config.json.

The LaTeX cog renders $$…$$ formulas with the third-party CodeCogs service. It only reads the shoutbox channel unless DISCORD.cogs.latex.channels lists other channel IDs. Set DISCORD.cogs.latex.enable to false to turn it off.

Deploy the matching AJAXChat reaction support and ShoutBot together. Reactions use the ordinary AJAXChat message and deletion flow. In AJAXChat, set reactionBridgeUserID to the forum account ShoutBot uses. In Discord, grant Add Reactions and Read Message History in the shoutbox channel. ShoutBot syncs reactions for messages in its existing message-ID mapping. Standard Discord emoji are shown directly in AJAXChat, and TIPLANET.emojis supplies the mappings for custom emoji and AJAXChat smileys. Forum reactions are represented by ShoutBot's single reaction per emoji.

Usage

To run the server, run in your terminal :

poetry run python main.py

Docker

Build from the checkout after initializing the submodule and creating config_override.json. Create the state file before starting Compose so Docker can mount it as a file.

touch lastId.json
docker compose up --build -d

Use docker compose logs -f bot to follow the bridge logs.

Licence

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. See license for details.