Flow reference: Logic

Count in Time Window

Count how often something happens per key (e.g. messages per member) in the last seconds: over the limit goes to over. Sets {rate.count}.

Count how often something happens per key (e.g. messages per member) in the last seconds: over the limit goes to over. Sets {rate.count}.

When and how to use it

Connect the input from the preceding step on the path that should perform this operation.
Fill the fields with data available in the trigger's context.
Connect the needed outputs; an unconnected path cannot run later blocks.

Configuration fields

Count per (key) — key


Counter key. Runs with the same key share one counter, so add {user.id} to count per member or {channel.id} per channel; a fixed text counts everyone together.

Input: Text with variable suggestions.

Editor guidance: Runs with the same key share one counter: {user.id} counts per member, {channel.id} per channel.

Format example, not a ready value for your server: spam:{user.id}.

Default: spam:{user.id}.


Time window (seconds, 1-86400) — windowSeconds


Observation window in seconds for counting suspicious actions. Tune together with the action limit and trusted whitelist.

Input: Number.

Default: 10.


Allowed in the window — threshold


How many runs are allowed inside the time window. The run that goes over it, and every later run inside the window, takes the over output.

Input: Number.

Editor guidance: The run that goes over this number (and every run after it inside the window) takes the over output.

Default: 5.

Outputs and next steps

under: The count is within the allowed number for the time window.
over: The count went over the allowed number; connect the reaction (warn, timeout, delete).

Test and troubleshoot

Invoke the correct trigger with simple inputs and verify the expected effect. Confirm variables exist on this path. A preview alone does not verify Discord delivery.

Save, validate and publish. Perform one real test and read the first relevant log error. [Testing](/docs/flow-testing) · [Variables](/docs/flow-variables) · [Permissions](/docs/flow-permissions).