Triggers
A rule has exactly one trigger. It decides both when the rule runs and which variables you get to work with.
Message triggers
| Trigger | Fires when |
|---|---|
message_create | someone posts a message |
message_edit | a message is edited |
message_delete | a message is deleted |
message_create and message_edit accept a match type: any_message,
contains, exact, starts_with, ends_with, or regex. With contains
you can also demand a whole word, so bad stops matching inside
badminton. message_delete has no match type: the message is already gone,
so every delete in scope fires the rule and you filter with the channel and
role settings instead.
Regex patterns run on a linear-time engine (RE2). That is why some exotic patterns are refused at save time: a pattern that could hang the bot on a crafted message is rejected rather than shipped.
Discord's edit and delete events do not carry the message as it was before.
FlaviBot keeps its own short-lived copy for servers that have a rule needing
it, which is what makes {message.old_content} on an edit, and the whole
message on a delete, work at all. Two consequences: the copy starts being
kept when you save the rule, so a message posted before that has nothing to
recover, and it is dropped after 48 hours.
On a delete, the deleted message's author is {message.author.mention}, not
{user.mention}. Discord never says who pressed delete, so the rule has no
actor and {user.*} would be a lie.
Reaction triggers
| Trigger | Fires when |
|---|---|
reaction_add | someone reacts to a message |
reaction_remove | someone removes their reaction |
Both can be limited to specific emojis, and reaction_add exposes
{reaction.count}, the total on that message, which is what a
"pin it at 5 stars" or "mute at 10 flags" rule counts on.
Member triggers
member_join, member_leave, boost_start, boost_end,
member_role_add, member_role_remove, member_nickname_change,
member_timeout.
member_join can additionally require a minimum account age, which is
what turns it into an anti-scam gate: fire only for accounts younger than N
days, then kick or ban.
Interaction triggers
| Trigger | Fires when |
|---|---|
button_click | a member clicks a button you placed |
select_menu | a member picks an option in a dropdown |
These are how panels work. A button trigger can also open a form (a modal) on click: the rule then runs when the form is submitted, and every answer becomes a variable.
A select menu exposes what was picked as {select.value}, and can be
restricted to specific option values.
Voice, channel and role triggers
voice_join, voice_leave, voice_move, channel_create,
channel_update, channel_delete, thread_create, role_create,
role_update, role_delete, invite_create, invite_delete.
Feature triggers
These come from FlaviBot itself rather than from Discord:
level_up, a member gains a level (optionally only past level N)music_track_start, a track starts playingticket_open,ticket_closeeconomy_balance_threshold,economy_item_purchaseautomod_action, Discord AutoMod acted on someone
Triggers with no event at all
scheduled, runs on a repeating interval, with no Discord event behind itwebhook, runs when an outside service calls a secret URLcustom_event, runs when another rule of your server emits a named event. See custom events.
