@@ -202,7 +202,7 @@ Example:
202202These triggers will run the command at a regular interval of time -- for instance, every 2 hours -- in the selected
203203channel.
204204
205- When using an interval trigger, the custom command does not receive any user or member context. Thus, ` {{ .User.ID }} `
205+ When using a time-based trigger, the custom command does not receive any user or member context. Thus, ` {{ .User.ID }} `
206206and similar templates will result in no value and member-dependent functions such as ` addRoleID ` will fail.
207207
208208![ Overview of interval configuration options.] ( interval_trigger_options.png?width=60vw )
@@ -215,17 +215,24 @@ and similar templates will result in no value and member-dependent functions suc
215215
216216Interval (** 1** ) sets how often the command will run in ** hours** or ** minutes** .
217217
218+ {{< callout context="caution" title="Warning: Interval duration limits" icon="outline/info-circle" >}}
219+
220+ The minimum interval is 5 minutes, and the max is 1 month. Up to 5 interval triggers may have an interval of 10 minutes
221+ or shorter.
222+
223+ {{< /callout >}}
224+
218225Channel (** 2** ) specifies a channel to run the command in. The response, if any, will be sent to this channel.
219226
227+ You must specify a channel to run time-based commands in even if the command doesn't output a message.
228+
220229Excluding hours and/or weekdays (** 3** ) prevents the command from triggering during those hours or weekdays. ** This uses
221230UTC time** , not your local timezone.
222231
223232When editing an interval command, a ** Run Now** button appears at the bottom of the page. It executes the command as
224233long as the command is not disabled and a channel is selected. Running an interval command using this button reschedules
225234all subsequent runs based off the current time.
226235
227- You must specify a channel to run interval commands in even if the command doesn't output a message.
228-
229236##### Component
230237
231238[ In-depth Interactions Guide] ( /docs/reference/custom-interactions )
@@ -242,6 +249,114 @@ The modal trigger is used to trigger custom commands via submitting a modal.
242249
243250The trigger is matched using [ RegEx] ( /docs/reference/regex ) .
244251
252+ ##### Crontab
253+
254+ This trigger will run the command periodically using [ Cron Syntax] ( https://en.wikipedia.org/wiki/Cron ) to schedule runs.
255+ In contrast to interval triggers, which run a command with a fixed delay but unknown time, cron triggers can be made to
256+ execute periodically at fixed times, dates, and/or intervals. For instance, you could schedule execution for 23:45 every
257+ Saturday.
258+
259+ When using a time-based trigger, the custom command does not receive any user or member context. Thus, ` {{ .User.ID }} `
260+ and similar templates will result in no value and member-dependent functions such as ` addRoleID ` will fail.
261+
262+ ![ Overview of crontab configuration options.] ( crontab_trigger_options.png?width=60vw )
263+
264+ <center >
265+
266+ ** 1** Cron Expression ** 2** Channel ** 3** Excluding hours/weekdays
267+
268+ </center >
269+
270+ Cron Expression (** 1** ) defines the expression used to schedule the cron job. It uses the standard expression format
271+ (see below). It does not support predefined schedules such as ` @hourly ` . The cron scheduler uses UTC always.
272+
273+ Read more on [ Cron Expressions] ( #cron-expressions ) below.
274+
275+ Channel (** 2** ) specifies a channel to run the command in. The response, if any, will be sent to this channel.
276+
277+ Excluding hours and/or weekdays (** 3** ) prevents the command from triggering during those hours or weekdays. ** This uses
278+ UTC time** , not your local timezone.
279+
280+ You must specify a channel to run time-based commands in even if the command doesn't output a message.
281+
282+ ###### Cron Expressions
283+
284+ A cron expression represents a set of times, using 5 space-separated fields.
285+
286+ Field name | Mandatory? | Allowed values | Allowed special characters
287+ -------------- | ---------- | -------------- | --------------------------
288+ Minutes | Yes | 0-59 | * / , -
289+ Hours | Yes | 0-23 | * / , -
290+ Day of month | Yes | 1-31 | * / , - ?
291+ Month | Yes | 1-12 or JAN-DEC | * / , -
292+ Day of week (DOW)| Yes | 0-6 or SUN-SAT | * / , - ?
293+
294+ To read more about the supported format of cron expressions, visit [ Robfig's Cron package documentation - Expression
295+ Format] ( https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format ) .
296+
297+ {{< callout context="tip" title="Tip: Debugging Cron Expressions" icon="outline/rocket" >}}
298+
299+ To help build and debug cron expressions, we reccomend using [ Cronitor's Crontab Guru] ( https://crontab.guru/ ) or a
300+ similar site. Note that predefined schedules such as ` @hourly ` , and the use of ` 7 ` in the DOW field may parse correctly
301+ on Corntab Guru, but are not supported with YAGPDB.
302+
303+ {{< /callout >}}
304+
305+ ** Special Characters**
306+
307+ - Asterisk ( * )
308+
309+ The asterisk indicates that the cron expression will match for all values of the field; e.g., using an asterisk in the
310+ 5th field (month) would indicate every month.
311+
312+ - Slash ( / )
313+
314+ Slashes are used to describe increments of ranges. For example 3-59/15 in the 1st field (minutes) would indicate the 3rd
315+ minute of the hour and every 15 minutes thereafter. The form "* \/ ..." is equivalent to the form "first-last/...", that
316+ is, an increment over the largest possible range of the field. The form "N/..." is accepted as meaning "N-MAX/...", that
317+ is, starting at N, use the increment until the end of that specific range. It does not wrap around.
318+
319+ - Comma ( , )
320+
321+ Commas are used to separate items of a list. For example, using "MON,WED,FRI" in the 5th field (day of week) would mean
322+ Mondays, Wednesdays and Fridays.
323+
324+ - Hyphen ( - )
325+
326+ Hyphens are used to define ranges. For example, 9-17 would indicate every hour between 9am and 5pm inclusive.
327+
328+ - Question mark ( ? )
329+
330+ Question mark may be used instead of '* ' for leaving either day-of-month or day-of-week blank.
331+
332+ Quick Examples:
333+
334+ ``` txt
335+ 45 23 * * 6
336+ Run once a week, on Saturday at 23:45.
337+
338+ 0 * * * *
339+ Run once an hour, beginning of hour.
340+
341+ 0 0 * * *
342+ Run once a day, midnight.
343+
344+ 0 0 * * 0
345+ Run once a week, midnight between Sat/Sun.
346+
347+ 0 0 1 * *
348+ Run once a month, midnight, first of month.
349+
350+ 0 0 1 1 *
351+ Run once a year, midnight, Jan. 1st.
352+ ```
353+
354+ {{< callout context="caution" title="Warning: Cron interval limits" icon="outline/info-circle" >}}
355+
356+ Your cron expression must schedule jobs with greater than a 10 minute interval between executions.
357+
358+ {{< /callout >}}
359+
245360#### Case Sensitivity
246361
247362Any commands which allow you to specify trigger text (command, regex, exact match, and so on) have a ** Case
0 commit comments