Skip to content

Checks

Decide whether a handler runs with gates, middleware, and rate limits, and see the order seedcord runs them in.

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

When someone runs a command, clicks a button, or submits a modal, seedcord runs a series of steps, from your handler's constructor to the last after() call. That run is a 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.