> ## Documentation Index
> Fetch the complete documentation index at: https://mikting.docs.komo.moe/llms.txt
> Use this file to discover all available pages before exploring further.

# Conditions

> Boolean checks and the actions that run when they fail.

A condition returns true or false. Prefix its ID with `!` to invert the
result. Add `not-met-actions` to run actions when the condition is false:

```yaml theme={null}
conditions:
  - id: miktingHttpOk
    args: { storeAs: mod }
    not-met-actions:
      - id: miktingReply
        args: { content: 'Backend down, try later.' }
```

String arguments accept `[[variables]]`, `%placeholders%`, and secret
references. The engine defines `not-met-actions` in
`src/core/services/conditions/conditionData.ts`.

## Reference

A `?` marks an optional argument.

| Condition | Arguments | Result |
| - | - | - |
| `miktingVarCheck` | `key`, `equals?` \| `contains?` \| `matches?` | Checks a variable. `matches` takes a regular expression. Without a comparator, checks that the value is nonempty. |
| `miktingJsonMatch` | `storeAs`, `path`, `equals?` \| `regex?` | Matches the value at a dot path in `[[<storeAs>_json]]`. |
| `miktingHttpOk` | `storeAs?` | Checks whether the last HTTP request, or the named request, returned a 2xx status. |
| `miktingInVoice` | `channel?` | Checks whether the context member is in a voice channel. Optionally restricts the check by channel ID or name. |
| `miktingAccountAge` | `days` | Checks whether the Discord account is older than the given number of days. |
| `miktingJoined` | `days` | Checks whether the member joined the guild more than the given number of days ago. |
| `miktingIsTimeouted` | None | Checks whether the member is currently timed out. |
| `miktingListIncludes` | `key`, `item` | Looks for an item in an array or comma-separated string. |
| `miktingDateCompare` | `a`, `op: before\|after\|sameDay`, `b` | Compares timestamps in milliseconds or date strings. |
| `miktingExpr` | `expr` | Evaluates a filtrex expression. See the expression rules below. |

`miktingHttpOk` checks the HTTP status. For an API with a configured response
validator, also check its `valid` output before acting on the returned data.

## Expressions and inversion

`miktingExpr` provides `len(x)` and `num(x)`. Bare variable names use numeric
conversion where applicable; arrays remain arrays. Use `[[var]]` for string
comparisons. These examples check a variable, evaluate a numeric expression,
and invert a timeout condition:

```yaml theme={null}
conditions:
  - id: miktingVarCheck
    args: { key: role_pick, equals: 'mage' }
  - id: miktingExpr
    args: { expr: 'num(coins) >= 100 and len(inv) > 0' }
  - id: '!miktingIsTimeouted'   # inverted: only when NOT timed out
```

[Documentation home](https://mikting.docs.komo.moe/index.md) · [Source Markdown](https://gitlab.com/komomori/mikting/-/blob/main/docs/mikting-conditions.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.