Pay for one year of Premium, keep it forever.

See the offer

Triggers

A rule has exactly one trigger. It decides both when the rule runs and which variables you get to work with.

Message triggers

TriggerFires when
message_createsomeone posts a message
message_edita message is edited
message_deletea 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

TriggerFires when
reaction_addsomeone reacts to a message
reaction_removesomeone 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

TriggerFires when
button_clicka member clicks a button you placed
select_menua 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 playing
  • ticket_open, ticket_close
  • economy_balance_threshold, economy_item_purchase
  • automod_action, Discord AutoMod acted on someone

Triggers with no event at all

  • scheduled, runs on a repeating interval, with no Discord event behind it
  • webhook, runs when an outside service calls a secret URL
  • custom_event, runs when another rule of your server emits a named event. See custom events.

Running a rule on a schedule

A scheduled rule repeats at the interval you choose, with a minimum set by your plan. Its first run decides when the series starts:

  • One interval after saving, the default. A rule saved at 19:52 with "every 24 hours" runs every day at 19:52.
  • At a date and time. The rule runs then, and every interval after it, so "every 24 hours, first run tonight at 20:00" runs every day at 20:00. The editor shows the next run before you save. A first run already in the past keeps its time of day: the rule simply starts at the next one.

Editing the actions never moves the schedule. Changing the interval or the first run moves the next run: to the next slot after the first run you set, or one interval after saving if you did not set one. The schedule counts in fixed hours, not calendar days, so a daily rule shifts by an hour against your local clock when daylight saving time starts or ends.

Every run can read {schedule.run_count} (1 on the first run) and {schedule.is_first_run} (true on the first run only). A condition on {schedule.is_first_run} lets a rule post a welcome message once, then its regular content afterwards. Switching the rule off and on again, or changing its trigger, starts a new series, and the count starts over at 1.

Created on · Last updated on