serenity-rs / songbird

An async Rust library for the Discord voice API
ISC License
391 stars 111 forks source link

Clearification on Documentation `event::Event::Periodic` #182

Open Skarlett opened 1 year ago

Skarlett commented 1 year ago

Periodic(Duration, Option<Duration>) Periodic events rely upon two parameters: a period and an optional phase.

If the phase is None, then the event will first fire in one period. Periodic events repeat automatically so long as the action in >>> EventData returns None.

It's a bit vague, but I think I understand it best with the SongFade example. The phase is the initial waiting period before firing period at the interval specificed in a period.

I think this can be described better as

Periodic(Duration, Option<Duration>) Periodic events rely upon two parameters: a period and an optional phase.

If the phase is None, then the event will first fire in one period. Periodic events repeat automatically so long as the action in >>> EventData returns None.

Otherwise if phase is present, then the duration of the phase is completed before firing the first period.

The terms period and phase probably should be better defined, and perhaps an illustration outlining the event timeline will satisfy

FelixMcFelix commented 1 year ago

I agree that this is a little unclear. An ASCII diagram or similar would go a long way!