#[non_exhaustive]pub enum BotEvent {
Ready {
communities: usize,
},
Message(IncomingMessage),
MessageUpdate {
chat_id: String,
message: Message,
},
Delete {
chat_id: String,
message_id: String,
},
MemberJoin {
channel_id: String,
npub: String,
},
MemberLeave {
channel_id: String,
npub: String,
},
Typing {
chat_id: String,
npub: String,
until: u64,
},
Invite {
community_id: String,
},
Removed {
community_id: String,
},
ChannelKeyed {
community_id: String,
channel_id: String,
backfilled: usize,
},
}Expand description
Every kind of inbound event a bot can observe. Delivered to VectorBot::on_event. DMs and
Community channels are unified: chat_id is the sender’s npub for a DM, the channel id for a
Community message.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Ready
The realtime subscriptions REGISTERED: healthy relays deliver live events
from this moment. Fires once per listen, right after the startup catch-up
sync — stream auth continues in the background, and each AUTH-gating relay
joins the stream the moment its own auth completes, gating nobody else.
No longer gated on the slowest relay in the set. Fires even
with communities: 0, so “subscribed to nothing” and “still connecting”
are different observable states. Messages sent BEFORE this are not
delivered live; recover them with a sync + Channel::history.
Message(IncomingMessage)
A new message (DM or Community channel).
MessageUpdate
A reaction or edit landed on an existing message; message is the updated view (inspect
.reactions / .content, keyed by message.id).
Delete
A message was deleted (cooperative delete / moderation tombstone).
MemberJoin
A member joined a Community channel.
MemberLeave
A member left (or was kicked from) a Community channel.
Typing
A member is typing in a Community channel; until is the unix-secs the indicator expires.
Invite
A Community invite arrived. Already auto-handled per InvitePolicy; surfaced for visibility
(and for Manual policy, so you can decide via VectorBot::accept_invite).
Removed
This bot was removed from a Community (kicked / banned / a leave authored on another device).
ChannelKeyed
A private channel became readable — its key arrived after an admin granted
access. Until this fires, the channel is listed by
Community::channels with is_readable() false.
backfilled counts the messages that PREDATE the grant and were pulled
into local state before this event. They are history, not delivery — none
of them arrive as BotEvent::Message, ever. Read them explicitly and
decide what deserves acting on:
if backfilled > 0 {
let missed = bot.community(community_id).channel(channel_id).history(backfilled).await;
// e.g. answer the question that was asked before the grant
}Trait Implementations§
Auto Trait Implementations§
impl Freeze for BotEvent
impl RefUnwindSafe for BotEvent
impl Send for BotEvent
impl Sync for BotEvent
impl Unpin for BotEvent
impl UnsafeUnpin for BotEvent
impl UnwindSafe for BotEvent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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