Publishing a plugin¶
At the end of this page, other people can install your plugin on their own teabot, from the plugin hub or from its own repository.
A plugin in your instance's plugins/ folder is yours alone. To share it, publish it as a Python package, on PyPI or in a git repository. Operators then add it with one command, as in Adding plugins.
1. Move it to its own repository¶
Copy plugins/<id>/ into a repository of its own. It is already a complete package: pyproject.toml, the code, the migrations, the tests and the README.
Add a LICENSE file, such as the MIT licence, which says others may use it. The plugin hub lists open-source plugins only.
Name yourself as its author in pyproject.toml. The plugin hub shows it on the plugin's card, and refuses a listing without one:
2. Depend on a range of teabot¶
In pyproject.toml, depend on the teabot versions your plugin works with. The scaffold writes the range of the teabot it was made with:
teabot keeps plugins working across a major version, so <2 is safe. Raise the lower bound when you use something new; the release notes say what each release added for plugins.
3. List what it contacts¶
The README's External connections says every server outside Discord your plugin contacts, or "none". Operators read it before they install a plugin, and teabot check refuses a README without it.
- External connections: api.example.org, to look up player scores. The same hosts go in `Plugin(..., hosts=["api.example.org"])`, which `ctx.http` keeps to.
A plugin that streams media, such as music, may reach its media hosts through its media library instead of ctx.http. List those hosts too, and say which library contacts them. See Reaching the web.
4. Check it¶
In the plugin's repository, with your instance's Postgres running:
The tests run teabot check too. It refuses imports from teabot's internals, reading the clock directly, SET in SQL, and a README without its "External connections".
5. Publish it¶
Give it a version in pyproject.toml, then build and upload it with uv:
uv publish needs a PyPI token, or trusted publishing from GitHub Actions. Name the package teabot-<id>, so operators can find it.
To publish from git instead, tag a release, and operators add it by its URL and tag.
6. List it on the hub¶
The plugin hub lists plugins that teabot's maintainers have reviewed, and every instance can install them with teabot hub add. To list yours, add one file to the hub's repository, in a pull request:
repository=https://github.com/you/teabot-raffles.git
commit=9db374fc205c5aae1f99bd5fd127266076f40ec8
- The file is named for the plugin's id, and the commit is the full hash of the commit to list.
- The pull request's checks install the plugin at that commit, run
teabot checkand its tests, and post a report. Fix anything they find in your repository, then changecommit=in the same pull request. - Every package your plugin installs beyond teabot's own must be on the hub's allowlist, a file for each package in
allowed-dependencies/. To add one, open a pull request addingallowed-dependencies/<name>, named as PyPI normalises the package, such asyt-dlp, and saying what your plugin needs it for. One package a pull request. Fewer is better: prefer what teabot already brings, such asctx.httpfor web requests and pydantic for models. - A maintainer reads the code at that commit and merges it. The plugin then appears on the hub's page within minutes.
- To release an update, change
commit=in a new pull request. The report links the changes since the listed commit, which is what the maintainer reviews.
The hub's README has the steps in full, and what review looks for.
Keeping it working¶
- Never edit a migration you have released. Add a new numbered file for each change.
- Change settings only in ways older settings still fit: add new ones with defaults, and keep old names working.
- The snapshot test catches a renamed option or job argument, which would break queued jobs and the commands members know.