teabot
An open-source framework for a general Discord bot built from plugins, in the spirit of Carl-bot. Anyone can run their own teabot for their own servers, write their own plugins for it, and grow it from one process to many. A hosted teabot, for people who just want a bot that works, is planned on the same code.
The Tea clan runs the first instance, on its droplet, and is the source of the first requirements. Staff use it through Discord slash commands, and LLM clients such as Claude Code use it through an authenticated MCP server.
To run your own teabot, follow docs/self-hosting.md; to write plugins for it, docs/plugin-authoring.md. The concrete build plan lives in docs/plan.md, and the order of work in docs/implementation.md.
Goals
- An MIT-licensed framework that anyone can self-host, with first-party plugins, a stable plugin SDK and a template for new instances (D41 to D48).
- One long-running Python process to begin with, with Postgres beside it and a reverse proxy in front. The same code scales out to several processes and hosts when one is no longer enough (D40).
- A small core that holds the Discord connection, the database, plugin config, tokens and permissions, a durable work queue and an audit trail.
- Plugins provide every feature. Whoever runs an instance decides which plugins it runs, including ones they wrote themselves. A plugin hub may list plugins later.
- Three ways in:
- Discord slash commands for members (interacting with what staff set up) and for staff (control).
- An MCP server over HTTPS, so an LLM can do admin work for a staff member in a server that person is authorised for.
- A service API for other programs, such as an event backend that pings a team when something happens.
- The bot holds near-Administrator power in every server it joins. Safety comes from the plugin protocol, the permission checks and the audit trail.
- Over time, plugins replace a server's dependence on other bots (Carl-bot, MEE6 and similar).
Pain points it addresses
- Bulk work hits rate limits. Changing roles on hundreds of members takes hundreds of separate requests. An LLM making one tool call per member is slow, costly and hard to review.
- Event setup and teardown repeat. Team roles, team channels, permission overwrites, feed channels and captain roles are made for every event and archived afterwards. Past event bots rebuilt the same roster and role-gate code each time.
- Discord has hard caps. 250 roles and 500 channels per server, and 50 channels per category. Long-lived event channels hit these unless they are archived.
- Moderation needs a trail. Joins, leaves, kicks, bans and deleted messages need recording. With an LLM acting for staff, the trail must also say which human asked for each action.
- Several bots overlap. Each has its own config, dashboard and permission model, and staff have to know which bot does what.
- Identity across game and Discord is messy. Mains, alts, RSN changes, and clan membership that only partly overlaps with Discord membership. That plugin is out of scope for now, and the core must not make it harder later.
- Timezones vary. Timers, giveaways and event starts are stored in UTC and shown as Discord timestamps.
- Multi-server needs isolation. An action in one server never touches another. A staff member in server A has no rights in server B. A server's admins can switch off any plugin.
- Plugins come and go. A plugin's tables, config and jobs must survive being disabled, survive an upgrade that changes their shape, and be removable completely when the plugin is gone for good.
- Growth must not force a rewrite. Bots that start small and succeed end up rebuilding their storage and sharding. teabot makes the choices that scale before the first plugin is written.
- Hosted bots are closed. A server that outgrows a hosted bot's features has nowhere to go. With teabot, the same bot can be self-hosted and extended.
Decisions
The design targets a framework that many people run and that grows to many servers and large member counts, starting from the Tea clan's instance. The operator in these decisions is whoever runs an instance: the Tea clan for its own, any self-hoster for theirs, and the teabot maintainers for the hosted service. Work that only a later need calls for is listed under deferred work in docs/plan.md, with the trigger that brings it in.
Architecture
- One action registry with several front doors. A plugin registers actions, each with a typed input model, a required permission and a risk level. Slash commands, MCP tools and the service API are thin adapters over that registry. Every call goes through the same permission check and audit log, including the core's own tools.
- Everything is scoped to one server. Every action runs with a context for a single server, and the plugin API hands out nothing that reaches across servers. Every plugin table carries a
guild_idcolumn, which the migration runner checks (D9), and so does every core table that holds a server's data. Bookkeeping tables such ascore.migrationshold none. Plugin config is stored per server. - Installing a plugin and enabling it are separate steps. The operator installs plugins, which is the trusted, code-reviewed step. Each server's admins enable and configure the installed plugins they want. A plugin's commands appear only in servers where it is enabled. The full lifecycle is D7.
- Plugins are Python packages found through entry points and pinned in the instance's lockfile.
- The loader loads every installed package that declares a
teabot.pluginsentry point. Nothing checks a signature or asks the teabot maintainers, so an operator can run plugins they wrote themselves (D44). - A plugin can be a package inside the instance's own repo, a git dependency pinned as
git+<repo>@<commit>, or a release from PyPI. The instance'suv.lockrecords the hashes of all of them. - An update bumps the pin, and the operator reviews the diff between the old and new versions. This is the RuneLite Plugin Hub model, where a plugin is a repository and a pinned commit, and the lockfile plays the part of the hub's signed manifest. A future plugin hub is a catalogue of such pins.
- The loader loads every installed package that declares a
- Plugins run in the bot's process with no sandbox. The operator trusts the plugins they install, so the operator's code review is the security boundary, as it is on the RuneLite Plugin Hub. The database roles of D9 catch mistakes, and they do not replace review. Because nothing is sandboxed, the hosted service runs only plugins the teabot maintainers have reviewed (D47).
- The protocol holds what current plugins use, and grows by addition.
- From the start a plugin can declare:
- actions, which become slash commands, MCP tools and service routes, on all three front doors unless the action narrows its surfaces
- modals for multi-line
LongTextinput (D29) - scheduled jobs
- a config model (D10) and its own tables with migrations (D9)
- the permissions its actions require
- Added when a plugin needs them: Discord event hooks for joins, leaves, messages and reactions (planned for SDK 1.1), buttons and select menus, dependencies on other plugins, autocomplete, context-menu commands, voice hooks, MCP resources, HTTP routes, a per-member store, a hook for deleting a member's data (D11) and a machine-readable list of external hosts (D12).
- Each addition is a manifest field with a default or an optional protocol detected with
hasattr, so existing plugins keep working without changes. The protocol is published asteabot.sdk(D45).
- From the start a plugin can declare:
Plugins and data
- A plugin has six lifecycle steps, and its data is kept until it is purged.
- The operator installs, upgrades, uninstalls, blocks and purges. Server admins enable and disable.
- Disabling, uninstalling and blocking keep the plugin's schema, config and jobs. A reinstall carries on where it left off.
- A plugin a process has not loaded, whether blocked, uninstalled or failed, has one status with a reason. It keeps its data and cannot be enabled. Each process reports its statuses through
/healthzand/plugins list, and holds a shared advisory lock for each plugin it loaded (D40). - Purging is the only step that deletes data, and it is an operator CLI command (D34), because it cannot be undone and affects every server. It runs while the bot is up, and refuses unless it can take that plugin's lock exclusively, which fails while any process has the plugin loaded.
- What each step does is tabled in
docs/plan.md.
- Plugin data lives in config and in the plugin's own tables.
- Config is what a server's admins set: channels, durations, role choices. It is one Pydantic model per plugin and server, stored as JSONB (D10).
- Own tables hold everything the plugin writes itself: giveaway entries, posted message IDs, moderation records. Data that needs queries such as leaderboards needs tables anyway, and a single row of plugin state is a one-row table.
- A per-member store in the style of Red-DiscordBot's
ConfigAPI can come back by addition if several plugins end up writing the same small per-member tables.
- Each plugin owns a Postgres schema and role, and changes it with forward-only numbered SQL migrations.
- Plugin
xgets the schemaplugin_xand the roleteabot_plugin_x. The role can create and use objects in its own schema and nothing else. It has no rights on thecoreschema or on other plugins' schemas, so a stray query or foreign key into another plugin fails at once. - Plugin code reaches Postgres through its own pool, logged in as
teabot_plugins, a role with no rights of its own that is a member of every plugin role.EXECUTEonset_configis revoked fromPUBLIC, and thectx.dbhelpers send every statement as a prepared statement, which runs exactly one statement per call. An SQL injection bug in a plugin therefore cannot change the role, and cannot reachcore, where token hashes live. Reaching another plugin would need that plugin to run dynamic SQL built from untrusted input in a plpgsql function, which the authoring guide forbids and review checks. This matters most for third-party plugins (D44). Spike S1 indocs/spikes.mdhas the evidence. - Each plugin ships
migrations/0001_<name>.sql,0002_<name>.sqland so on.core.migrationsrecords the applied version per plugin, and each plugin's history is independent of every other. - A plugin's migrations run as its role, with
search_pathset to its schema. Each file runs as one script inside its own transaction, which Postgres supports for every DDL statement used here, so a failed migration leaves nothing half applied. The script is sent whole, so functions and triggers with dollar quoting work. - Before the transaction commits, the runner checks that every table in the plugin's schema has a
bigintcolumn namedguild_id. A table without one fails the migration. This is what lets the core delete a server's data with no plugin code (D49). - The core's tables live in the schema
coreand use the same runner. - Migrations only go forward. Keeping the previous release of the plugin working (add first, remove in a later release) is recommended now, and becomes required when shard clusters arrive, because only then do two releases run against one schema (D15). A self-hoster who skips releases gets every file in order.
- Purge is
DROP SCHEMA plugin_x CASCADEandDROP ROLE teabot_plugin_x, so it needs no plugin code. - This replaces Alembic, whose shared revision graph breaks once an uninstalled plugin's scripts are gone.
- Plugin
- Config models evolve through Pydantic alone.
- New fields get defaults.
- Renamed fields keep reading old data through
validation_alias=AliasChoices("new", "old"). - Removed fields are ignored with
extra="ignore". - A reshape that none of these cover goes in a
model_validator(mode="before"). - Config is saved back in the new shape the next time it is written. Plugin tests keep stored samples from earlier versions and check that they still validate.
- Deleting a member's data arrives with the first plugin that keeps it. No plugin keeps per-member data yet. When the first one does,
teabot users deleteand adelete_user_dataplugin hook, as in Red-DiscordBot, land together. Discord's developer policy expects bots to honour deletion requests, and the hosted service (D47) needs this from the start. - External connections are declared for review. Every plugin's README has an "External connections" section listing each host it contacts, and the PR template asks for it. The reviewer checks the list against the code. The hosted service moves the list into the manifest, adds RuneLite-style consent at enable time and adds an HTTP client that refuses undeclared hosts.
- The operator can block a plugin everywhere. Listing it in
TEABOT_DISABLED_PLUGINSinteabot.envand restarting stops it in every server, keeps its data and refuses enabling until it is removed from the list. This plays the part of RuneLite delisting a plugin. - A broken plugin never takes down the bot.
- A plugin that fails to import, fails
setupor fails a migration is not loaded, with the reasonfailed. Everything else starts./healthz,/plugins listand the operator CLI show the failure. - A plugin released outside the teabot monorepo declares its compatible SDK in its
pyproject.toml, for exampleteabot>=1.2,<2, and uv refuses to lock an incompatible combination, so a mismatch shows up before any deploy. First-party plugins are released together with the core and pin it exactly.
- A plugin that fails to import, fails
- Installs and migrations happen at restart. Reloading Python packages inside a running process is fragile, and installs are rare and already reviewed. A starting process takes a Postgres advisory lock and runs pending migrations, so processes starting together migrate once. A one-process instance stops, migrates and starts. Rolling restarts arrive with shard clusters, together with the migration rule of D9 that makes them safe. Per-server enable and disable take effect at once.
Tokens and permissions
- Every token acts as the member who created it.
- A token looks like
teabot_<token id>_<secret>, after GitHub's token format. The id finds the row directly, and the prefix lets secret scanners spot leaked tokens. - The secret is long and random, so it is stored as a SHA-256 hash. Password hashes such as bcrypt are built for low-entropy secrets and are not needed.
- A member creates tokens with
/tokens createin a server. A token is shown once, expires, and can be revoked. Rotating is revoking and creating. - Each call checks the creator's live permissions (D18), so a token never holds more than its creator, and every audit row names a human.
- An event backend uses a token made by a staff member and narrowed to the actions it needs (D20). If that member loses their staff role, the token stops working under the same rule as D18, and a new one is issued.
- Claude Code connects with
--header "Authorization: Bearer teabot_...". OAuth 2.1 can come later as a second way to issue the same token row, once claude.ai or the desktop app need access.
- A token looks like
- Tokens carry a maximum risk. Risks are ordered (
readbelowwritebelowdestructive), and each token holds the highest risk it may use. New tokens default towrite, sodestructiveis always an explicit choice. A monitoring token can be read-only whatever its creator's roles allow, and the check is one comparison. - Permission is checked live on every call. Each call checks the member's current roles in the server, from the bot's member cache with a REST fetch when the member is not cached (D25). Removing a staff role ends access at once, for slash commands and tokens alike.
- The bot's own check is authoritative. Each action declares a default requirement in Discord permissions (for example Manage Roles for role actions), and the core checks it against the member's current permissions. Slash commands also set
default_member_permissions, which only controls who sees them in the Discord UI. Per-server overrides that remap an action to chosen roles come later, likely when event captains need to post in team channels. The call path keeps a place for them. - Each token is bound to one server and can be narrowed to chosen actions.
- The token decides the server, so no tool or route takes a guild id. An LLM cannot target the wrong server, and text injected from one server cannot steer actions in another.
- A staff member who works in two servers holds two tokens.
- A token may carry an allow-list of action names. A Battleships backend's token could allow only
battleships.post_feed, and that action reads its feed channel from the plugin's config, so the backend posts there and nowhere else.
Safety
- Bulk and destructive actions use plan then apply, and the plan is its audit row.
- Called without a
confirmvalue, a destructive action returns a summary of the diff (add 12, remove 3, skip 4 above the bot's role, with a page of entries) and a confirm value. Deletes, bans and mass removals always take two steps. - The plan's audit row stores the action, the input, a hash of the canonical diff and the confirm value, which is random. Nothing is kept in memory, so any process can apply any plan.
- To apply, the client calls the same action again with
confirm. It is an ordinary call, so permission is checked again. The core finds the plan row and refuses unless the actor, guild, action and input match, the plan is younger than 15 minutes, and a freshly computed diff has the stored hash. A changed target refuses the apply, and the response carries the fresh plan. Terraform refuses stale saved plans for the same reason. - The apply's audit row points at the plan's row, so the trail links each change to the plan a human saw.
- An apply runs as a job on the work queue (D31) and reports progress. discord.py already waits out per-route and global rate limits, and the queue runs at most one apply per server at a time.
- The LLM is responsible for judging whether a plan is correct. The MCP server's instructions and every destructive tool description always tell the LLM to show the plan to its user and get their agreement before applying it.
- Called without a
- Risk levels map onto MCP tool annotations.
readOnlyHintanddestructiveHintcome from each action's risk, so clients can run their own confirmation prompts. - Member-written text is marked as untrusted. Message content, nicknames and other text written by members is wrapped in an explicit untrusted marker in every MCP tool output. Together with plan then apply (D21), maximum risk (D17) and single-server tokens (D20), this limits prompt injection through server content.
- Every action is logged, and changes are posted.
- A
WRITEorDESTRUCTIVEaction gets its audit row before it runs, with the outcomestarted, the member who asked, the token if any, the front door, the action and its input. A crash halfway through a side effect therefore leaves a trace. After the action, one transaction records the outcome and queues acore.post_auditjob, which posts the row to the server's log channel. A Discord outage delays posts and never loses them. - A
READaction has no side effects, so it gets a single row after the call and is never posted. An LLM session's lookups then cost one write each and do not flood the log channel. - An action's own database writes happen in its own short transactions (D30), so they are not atomic with the audit row. The
startedrow covers that gap. READrows go tocore.audit_reads, partitioned by day and kept for 30 days by default. Old partitions are dropped whole, so the high-volume table never needs batch deletes. Every other row goes tocore.audit_log, a plain table kept for a year by default and trimmed by a batched delete, which its low volume keeps cheap.
- A
- Reads come from the cache, and the cache stays small.
- Guilds, channels and roles are always cached. Members are cached when they appear in events or are fetched, and the bot never downloads full member lists at startup. A server with 100,000 members then costs memory only for the members who are active.
- A permission check for an uncached member fetches it over REST (D18), and then caches it.
- Member search uses Discord's own search through the gateway, so it works without a full member list.
- MCP tools return compact summaries with paging instead of dumping members.
- The bot's role sits below the owner and senior staff roles. The setup docs say so. Discord's role hierarchy then stops the bot editing those roles, even with Administrator.
Stack
discord.pyis the Discord library, used throughAutoShardedClientfrom the start. It runs as one shard below 2,500 servers and adds shards by itself above that. discord.py's own extensions system and command tree are not the plugin protocol. The core handles interactions itself (D32).- The official
mcpPython SDK over streamable HTTP, through its low-level server, on Starlette and uvicorn in the same asyncio loop as the Discord client.- The low-level
on_list_toolsandon_call_toolhandlers take JSON schemas straight from the Pydantic models, and the tool list is filtered per token. FastMCP has no easy way to filter the list per caller. - A Starlette middleware checks the bearer token on
/mcpand the service API. - The SDK's DNS-rebinding protection is configured with the public hostname, because the reverse proxy forwards it.
- The low-level
- Pydantic models define action inputs, action outputs and config, and the core builds Discord's command payloads from them.
- One schema builder turns an input model into both the MCP tool schema and Discord's application command JSON, so the two cannot drift apart. The core registers the JSON with Discord directly. discord.py's
CommandTreeis not used, so no synthetic signatures are needed. - Input fields are limited to a fixed set of types:
str,LongText,int,bool,Literaland the*Reftypes, each optional or not. Raw interaction data carries options as plain values and IDs, which is exactly what the*Reftypes hold. LongTextholds multi-line text, which slash options cannot. A slash command with aLongTextfield opens a modal for it, and the action runs once the modal is submitted.- Outputs go back as JSON over MCP and the service API. The slash adapter renders them as an embed of the model's fields by default, and an action may supply its own renderer.
- One schema builder turns an input model into both the MCP tool schema and Discord's application command JSON, so the two cannot drift apart. The core registers the JSON with Discord directly. discord.py's
- Postgres through
asyncpg, with raw SQL and short explicit transactions.- Migrations already define the schema in SQL, so an ORM would describe it a second time.
- Each process holds two pools: one logged in as
teabot_appfor the core, and one asteabot_pluginsfor plugin code (D9). A plugin connection switches to the plugin's role when it is acquired and runsRESET ROLEwhen it is released, because asyncpg's own reset leaves the role in place. A single read needs no transaction. - Writes go through
async with ctx.db.transaction() as tx:blocks, and everything inside a block goes throughtx, includingtx.schedule(...)to queue a job in the same transaction. Pyright checks the handle, and nothing is routed implicitly. - Calling
ctx.dbinside an open block raises an error, because it would use another connection and miss the block's own writes. A context variable marks open blocks for this check only. - A transaction block never awaits Discord or HTTP, so no action holds a connection and its row locks across a slow call. Dev mode logs any block held longer than 100 ms.
- One durable work queue in Postgres. Every job is a handler and a payload with a run time, a state, retries and progress. Plugin timers and scheduled pings use it, and so do the core's own handlers for plan applies (D21), audit posts (D24), command syncs (D32) and server data removal (D49).
- Workers claim jobs with
SELECT ... FOR UPDATE SKIP LOCKED, so any number of workers in any number of processes share the queue without double runs. NOTIFYwakes workers when a job is due now. Each process listens on its lock connection (D40), so the wake-ups need no connection of their own, and a poll every five seconds catches any notification lost while that connection reconnects.- A process that runs only some of the shards claims only jobs whose
(guild_id >> 22) % shard_countfalls on its shards, which keeps a job beside the cache it needs. The shard is computed in the claim query and never stored, so resharding cannot leave stale values. A process that runs every shard skips the filter. - Jobs are picked back up after a restart.
- Workers claim jobs with
- One interaction router handles every command, button, select menu and modal.
- Slash commands are routed by command and subcommand name, and components by custom IDs of the form
teabot:<plugin id>:<handler>:<payload>. Because no state is held in memory, buttons keep working after a restart and in any process. - Buttons and select menus are used in place of reactions for role picks and giveaway entry. They are tied to IDs the bot controls and are easier to audit. Simple polls can use Discord's native polls.
- A plan's Confirm button is an ordinary component whose payload is the plan's confirm value, so slash commands, MCP and the service API share one confirm path (D21).
- Each plugin's command group is registered per server, only where the plugin is enabled. The core keeps a hash of each server's command set and syncs only servers whose hash changed, as queue jobs paced within Discord's limits. The hash is saved after a sync succeeds, so a failed sync is retried. A plugin upgrade that touches thousands of servers then spreads over minutes and never blocks startup.
- Slash commands are routed by command and subcommand name, and components by custom IDs of the form
- Plugins never block the event loop. One loop serves the Discord gateway and the MCP server, so blocking I/O in a plugin stalls both. The authoring guide requires async I/O, and dev mode turns on asyncio's slow-callback detection so offenders show in the logs.
- A uv project with one entry point.
uv run teabot runstarts a bot process. The other subcommands are the operator CLI for work that belongs outside Discord: setting up an instance (D43), listing plugins and their state, purging a plugin and scaffolding a new one (D45). The CLI works on the database alone, and reads the advisory locks inpg_locksto see what is loaded (D40). Tests live intests/and run with pytest against a real Postgres. Ruff for linting and formatting, and pyright in strict mode, because types are part of the safety net.
Hosting and operations
- teabot runs as independent instances. Each instance has its own Discord application, token, database and config, and its own operator. The Tea clan's instance, any self-hoster's instance and the hosted service (D47) are all instances of the same framework. Separate applications keep rate limits, Discord verification and intent reviews of one instance away from every other.
- HTTPS at the edge and plain HTTP only between the reverse proxy and the bot. The proxy terminates TLS and forwards
/mcpand/apito a127.0.0.1port. Every client uses the public HTTPS URL, so there is one path to secure and log./healthzis not forwarded, because it lists the installed plugins. Deploy scripts call it on localhost. - The Tea clan's instance follows the droplet conventions (
eventsskill,references/hosting.mdinhballington12/tea-skills). It is the bare-metal example in the instance template (D43):- code in
/opt/teabot, set up withuv sync --frozen --no-dev - secrets in
/etc/teabot/teabot.env - Postgres from the distribution packages, listening on a Unix socket only, with memory settings sized for a shared droplet
- Caddy as the reverse proxy
- a hardened systemd unit
- a deploy script that restarts the bot, which runs migrations, and ends with a health check
- pgBackRest archiving WAL continuously to DigitalOcean Spaces, with weekly full and daily differential backups and its own retention, so a lost droplet costs seconds of data
- code in
- Development uses a separate dev bot application and a test server, so experiments never touch a live server. The whole stack runs locally against Postgres from the template's Compose file, and Claude Code connects to the local MCP URL with a dev server token.
- Plan for verification early. Turn on the Server Members intent, which joins, leaves and member updates need. Turn on Message Content only if a plugin needs message text. A bot must be verified by Discord before it can join more than 100 servers, and verified bots need approval for privileged intents. Large self-hosted instances meet this too, and the setup docs say so.
Scale
- Process memory holds only caches and work in flight. Everything that must be right across processes lives in Postgres.
- Plans, confirm buttons, jobs, plugin config, tokens and command-set hashes are all rows. No correctness depends on which process handles a request.
- Ownership is held as Postgres session advisory locks on one dedicated connection per process. A process takes an exclusive lock for each shard it runs and a shared lock for each plugin it loads.
- A second process on the same bot token fails to take its shard locks and refuses to start. Two processes on one token would otherwise both handle every event. Purge takes a plugin's lock exclusively, which fails while any process has the plugin loaded (D7).
- A crash or a dropped connection releases the locks at once, so no staleness rule is needed. A process whose lock connection drops exits, and its supervisor restarts it.
- Each instance has its own database (D35), so the locks only see processes of the same instance. With separate databases nothing can detect two processes on one token, so D38's separate dev application is the guard there, and the setup docs state it.
- Each process also writes an informational row with its host, shards and version, for
teabot plugins listand later for routing between clusters. Nothing correct depends on it. - The first deployment is one process with all shards. When one process is no longer enough, shards split into clusters of several processes, each owning the servers that Discord's formula
(guild_id >> 22) % shard_countgives it. Plugins need no changes for that step. Its shape is under deferred work.
Open source and distribution
- teabot uses the MIT licence. The core, the SDK, the first-party plugins and the instance template all share it. It is short and permissive, which suits the goal of free self-hosting, and it was settled on 2026-11-14, before any outside contribution, because changing it later needs every contributor's agreement. Third-party plugins choose their own licence.
- The framework and the instances are separate projects.
- This repository is the framework. It holds the core, the SDK, the first-party plugins, the instance template and the docs, and it publishes
teabotand eachteabot-<plugin>to PyPI. - An instance is a small project made from the template: a
pyproject.tomlthat lists the plugins it runs, auv.lock, an env file and deploy files. The Tea clan's instance is one such repo, and the hosted service is another. - Choosing plugins, pinning them and reviewing their updates happen in the instance, which is where D4 belongs.
- This repository is the framework. It holds the core, the SDK, the first-party plugins, the instance template and the docs, and it publishes
- The instance template supports both a quick and a careful setup. It ships a Docker Compose file with the bot and Postgres, for anyone who wants a working bot in minutes, and the Tea droplet's bare-metal files as a second example (D37).
teabot initcreates the database roles, generates the secrets in the env file and prints the Discord application settings to use. The README walks through creating the Discord application, the intents to turn on, and the rule of one teabot per server. - Anyone can write plugins for their own instance without approval from the teabot maintainers. A plugin is a package with a
teabot.pluginsentry point, kept inside the instance's repo, in its own repo or on PyPI. The operator who installs it is the one who reviews it. The maintainers' review applies only to the hosted service's catalogue (D47) and to listings in a future plugin hub. - Plugins build against
teabot.sdk, which follows semantic versioning.teabot.sdkholds everything a plugin uses: the protocol types,ActionContext, the*RefandLongTexttypes and the registrar. Everything else inteabotis internal and may change in any release.teabot.testingprovides guild and member fakes and a Postgres fixture that runs a plugin's migrations, so plugin authors test the way the core does.teabot new-plugin <id>scaffolds a package with its entry point, manifest, first migration, README with an "External connections" section, and tests.- A breaking change to
teabot.sdkneeds a major version, and the old form keeps working with a deprecation warning for at least one minor release first.
- Plugin ids are unique within an instance.
- An id matches
[a-z][a-z0-9_]{1,31}, which fits Discord's command names and the Postgres schema and role names of D9. - The ids
core,admin,teabotandpluginare reserved, as areplugins,auditandtokens, the admin plugin's command groups. - When two installed packages declare the same id, the loader loads neither and names both packages in the error. A local
giveawaysplugin and a later first-party one therefore never share a schema or a command group by accident. - A future plugin hub reserves ids across its listings.
- An id matches
- The hosted service is an instance run by the teabot maintainers. Server admins sign up by adding its bot, and they enable plugins from a catalogue of plugins the maintainers have reviewed. Custom plugins need a self-hosted instance, because plugins are not sandboxed (D5). Before it opens, the hosted service needs the deferred work for strangers sharing one instance: per-server quotas and fair queue claims, OAuth (D16), member data deletion (D11), egress consent and enforcement (D12), and a privacy policy and terms of service for Discord verification.
- The repository carries the files an open-source project needs.
LICENSE,CONTRIBUTING.md,SECURITY.mdwith a private way to report a vulnerability, through GitHub's private reporting, a code of conduct, a changelog kept per release, and release notes that call out any manual step for operators. - When the bot leaves a server, that server's data is deleted after a grace period.
- On the guild-remove event, the core records the time and queues a
purge_guildjob 30 days later. If the bot is added back before then, the job is cancelled and everything is as it was. - The job deletes the server's rows from every core table and from every plugin table, using the
guild_idcolumn that D9 requires. No plugin code is needed. - The grace period is a setting, so an operator can shorten it. Discord's developer policy expects bots to delete data they no longer need.
- On the guild-remove event, the core records the time and queues a
First milestone
- The first plugin is an announcements proof of concept. It posts an embed to a channel, and it exercises a slash command with a
LongTextbody, an MCP tool, a service-API call, the permission check and the audit log.
Metadata
Release files for teabot 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| teabot-1.0.0.tar.gz | 436.1 kB | Without provenance | Details for teabot-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| teabot-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for teabot-1.0.0-py3-none-any.whl |
Total release size: 562.4 kB
Release files / teabot-1.0.0.tar.gz
| Download URL | teabot-1.0.0.tar.gz |
|---|---|
| Size | 436.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3ab2f2d4eed57ded9bba8e6dec728cf09b169ef97524d4245b1fe4ae9578b34
|
|
BLAKE2b-256 checksum How to use checksums |
d1ac1d10831bcbc56803bd81ded09bcfbc9090425f6905d4e31b26e7b2dc272e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / teabot-1.0.0-py3-none-any.whl
| Download URL | teabot-1.0.0-py3-none-any.whl |
|---|---|
| Size | 126.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1509d6ca97ae806870c849d54210727519f53fd933a6b7fc32a1a171bbe620d0
|
|
BLAKE2b-256 checksum How to use checksums |
8a00c7aee777d75acd19f15266018c78d29fd3fea716ffa461d6a8700ed121ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for teabot 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.