Skip to content

Checks

Decide whether a handler runs, and run code around it. Covers the order seedcord runs a dispatch in, gates, middleware, rate limits, and checks inside a handler.

Most commands need a few things settled before they run. Is the caller in a server? Do they hold the permission? Have they used this command in the last minute? This tab covers the checks that decide whether a handler runs, and the middleware that runs around them.

What a dispatch is

A dispatch is one interaction arriving and everything seedcord runs for it, from building your handler to the last after() call. Every click, command, and modal submit is its own dispatch. Each one runs in this order.

an interaction arrives

├─ 1. seedcord builds your handler      your constructor runs here
├─ 2. each middleware's execute()       lowest priority first
├─ 3. each gate's check                 left to right
├─ 4. each effect gate's commit         only once every check passed
├─ 5. your handler's execute()
└─ 6. each middleware's after()         reverse of step 2, every time

a throw or a refusal in 2, 3, 4, or 5 skips straight to 6

A gate can read what a middleware wrote, since every middleware runs first.

In this tab

Gateway only

A gateway event runs its own order, with event middleware ahead of every handler registered for it. The event dispatch order lists every step.