> ## 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.

# Triggers and placeholders

> Event names and the values they expose to scripts.

## Triggers

Use `triggers:` to run a script when a Mikting event occurs. Each event
provides the variables listed below.

| Trigger | Source event | Variables |
| - | - | - |
| `miktingWebhook:<hookId>` | `POST {hookPrefix}/:hookId` | `hook_id`, `hook_body`, `hook_body_<path>` |
| `miktingVoiceJoin` / `miktingVoiceLeave` / `miktingVoiceMove` | Discord `VoiceStateUpdate` | `voice_old`, `voice_new`, `voice_old_name`, `voice_new_name` |
| `miktingPollVote` | `MessagePollVoteAdd` | `poll_answer`, `poll_text`, `poll_voter`, `poll_message` |
| `miktingScheduledEventCreate` | `GuildScheduledEventCreate` | `event_id`, `event_name`, `event_start` |
| `miktingAutomodFlag` | `AutoModerationActionExecution` | `automod_rule`, `automod_action`, `automod_content` |

Voice, poll, scheduled-event, and automod events are forwarded only for the
primary guild. For example, this action replies when a member votes:

```yaml theme={null}
actions:
  - id: miktingReply
    args: { content: '<@[[poll_voter]]> voted!' }
    triggers: miktingPollVote
```

HTTP failures set `[[mikting_error]]` and `[[mikting_ok]] = false` in the
current action chain. Follow-up actions still run. The former
`miktingHttpError` trigger is no longer available.

## Placeholders

Use these values wherever the bot resolves placeholders. The placeholder
resolver receives the event context, so `%mikting_var_X%` covers context
values. Use `[[X]]` to read a script variable.

| Placeholder | Value |
| - | - |
| `%mikting_var_content%` | Trigger message content. |
| `%mikting_var_guild_id%` / `%mikting_var_guild_name%` | Guild ID or name. |
| `%mikting_var_channel_id%` | Channel ID. |
| `%mikting_last_status%` / `%mikting_last_ok%` | Last HTTP status or success flag. |
| `%mikting_store_<key>%` | Global store value, encoded as JSON when it is not a string. |
| `%mikting_hook_url%` | Public webhook base URL. |
| `%mikting_libs%` | Number of loaded library functions. |
| `%mikting_store_driver%` | Active driver: `sqlite` or `memory(fallback)`. |

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


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