pub struct TriggerEngine { /* private fields */ }Expand description
The trigger engine manages event-to-action routing.
Implementations§
Source§impl TriggerEngine
impl TriggerEngine
Sourcepub fn register_trigger(&self, trigger: Trigger) -> TriggerId
pub fn register_trigger(&self, trigger: Trigger) -> TriggerId
Register a new trigger and return its ID.
Sourcepub fn remove_trigger(&self, id: &TriggerId)
pub fn remove_trigger(&self, id: &TriggerId)
Remove a trigger by ID.
Sourcepub fn list_triggers(&self) -> Vec<(TriggerId, TriggerSummary)>
pub fn list_triggers(&self) -> Vec<(TriggerId, TriggerSummary)>
List all triggers with summary information.
Sourcepub async fn check_keyword(&self, message: &str) -> Vec<TriggerId>
pub async fn check_keyword(&self, message: &str) -> Vec<TriggerId>
Check if a message matches any keyword triggers.
Returns the IDs of all matching triggers and increments their fire counts.
Sourcepub async fn check_event(&self, event: &PunchEvent) -> Vec<TriggerId>
pub async fn check_event(&self, event: &PunchEvent) -> Vec<TriggerId>
Check if a PunchEvent matches any event triggers.
Returns the IDs of all matching triggers and increments their fire counts.
Sourcepub fn get_schedule_triggers(&self) -> Vec<(TriggerId, Duration)>
pub fn get_schedule_triggers(&self) -> Vec<(TriggerId, Duration)>
Get all schedule-type triggers with their intervals.
Sourcepub fn get_trigger(&self, id: &TriggerId) -> Option<Trigger>
pub fn get_trigger(&self, id: &TriggerId) -> Option<Trigger>
Get a trigger by ID.
Sourcepub fn check_webhook(&self, id: &TriggerId) -> Option<TriggerAction>
pub fn check_webhook(&self, id: &TriggerId) -> Option<TriggerAction>
Check if a webhook trigger exists and return its action.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TriggerEngine
impl !RefUnwindSafe for TriggerEngine
impl Send for TriggerEngine
impl Sync for TriggerEngine
impl Unpin for TriggerEngine
impl UnsafeUnpin for TriggerEngine
impl UnwindSafe for TriggerEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more