Skip to main content

Event

Enum Event 

Source
pub enum Event {
Show 43 variants Ready(Community), AppsReady(Community), PresencesReady(Community), PresenceUpdate { community: Community, presence: Presence, }, CommandsUpdate { community: Community, bot: BotId, }, BotUpdate { community: Community, card: Box<BotCard>, }, BotRemove { community: Community, bot: BotId, member: Member, }, InteractionCreate(Box<Interaction>), InteractionReply(EphemeralReply), ModalOpen(ModalOpen), Autocomplete(Suggestions), InteractionFail(InteractionFailure), MessageCreate(Message), MessageUpdate { message: PartialMessage, author: Option<Member>, content: String, embeds: Option<Vec<Embed>>, mentions: Option<Mentions>, edited_at: u64, }, MessageDelete { message: PartialMessage, by: Option<Member>, }, MessageDeleteBulk { channel: Channel, messages: Vec<PartialMessage>, }, ReactionAdd(Reaction), ReactionRemove(Reaction), ChannelCreate(Channel), ChannelUpdate(Channel), ChannelDelete(Channel), RoleCreate(Role), RoleUpdate(Role), RoleDelete(Role), MemberAdd(Member), MemberUpdate(Member), MemberRemove(Member), VoiceStateUpdate(VoiceState), CommunityUpdate(Community), CommunityDelete { community: Community, reason: RemovalReason, }, CommunityMoving { community: Community, host: HostId, }, CommunityMoved { community: Community, host: HostId, }, CommunityMoveRefused { community: Community, code: String, }, Disconnect(Community), Offline, Online, Warning(String), DmCreate { channel: Channel, recipient: Member, }, DmDelete(Channel), MessageSent { pending: u64, message: Message, }, MessageSendFailed { pending: u64, channel: Channel, error: String, }, TypingStart { channel: Channel, typing: TypingNow, }, Raw { community: Community, channel: Option<Channel>, actor: Option<Member>, event: Box<Event>, },
}
Expand description

One thing that happened.

Variants§

§

Ready(Community)

A community is connected and its cache loaded: after a join, a creation, a restart, or the host coming back.

§

AppsReady(Community)

The community’s bots and their commands loaded (just after Event::Ready).

§

PresencesReady(Community)

Who is online loaded (just after Event::Ready); Community::presences has it.

§

PresenceUpdate

A member’s status or activity changed; offline members leave Community::presences.

Fields

§community: Community

The community.

§presence: Presence

What everyone sees now.

§

CommandsUpdate

A bot’s commands changed (Community::commands has the new list).

Fields

§community: Community

The community.

§bot: BotId

The bot.

§

BotUpdate

A bot was installed, updated, re-granted, enabled, disabled or crashed: its card.

Fields

§community: Community

The community.

§card: Box<BotCard>

The bot’s public card.

§

BotRemove

A bot was removed.

Fields

§community: Community

The community.

§bot: BotId

The bot.

§member: Member

Its member.

§

InteractionCreate(Box<Interaction>)

As a bot: someone used one of this bot’s commands, components or modals.

§

InteractionReply(EphemeralReply)

A bot’s ephemeral reply to this member.

§

ModalOpen(ModalOpen)

A bot asks this member to fill in a modal.

§

Autocomplete(Suggestions)

A bot’s autocomplete suggestions.

§

InteractionFail(InteractionFailure)

One of this member’s interactions got no answer.

§

MessageCreate(Message)

A new message.

§

MessageUpdate

A message was edited by its author.

Fields

§message: PartialMessage

The message.

§author: Option<Member>

Its author, when the host said (only an author edits).

§content: String

Its new text.

§embeds: Option<Vec<Embed>>

Its new embeds; None when the edit left them as they were, Some of none when it removed them all.

§mentions: Option<Mentions>

Who it mentions now, as the host honoured them; None when the edit left its mentions as they were (a 0.3 host never says).

§edited_at: u64

When it was edited, ms since the Unix epoch.

§

MessageDelete

A message was deleted.

Fields

§message: PartialMessage

The message.

§by: Option<Member>

Who deleted it, when the host said.

§

MessageDeleteBulk

Several messages were deleted at once.

Fields

§channel: Channel

The channel.

§messages: Vec<PartialMessage>

The messages.

§

ReactionAdd(Reaction)

Someone added a reaction.

§

ReactionRemove(Reaction)

Someone took a reaction off.

§

ChannelCreate(Channel)

A channel was made, or became visible to this member.

§

ChannelUpdate(Channel)

A channel changed.

§

ChannelDelete(Channel)

A channel was deleted, or is no longer visible to this member.

§

RoleCreate(Role)

A role was made.

§

RoleUpdate(Role)

A role changed.

§

RoleDelete(Role)

A role was deleted.

§

MemberAdd(Member)

Someone joined the community.

§

MemberUpdate(Member)

A member changed: their name, roles or timeout.

§

MemberRemove(Member)

A member left or was removed.

§

VoiceStateUpdate(VoiceState)

Someone joined, left or changed state in a voice channel.

§

CommunityUpdate(Community)

The community’s profile changed.

§

CommunityDelete

This client left a community, or was removed from it (kicked, banned, …); it is forgotten here, keys and saved state included. A removal while this client was away comes on its next session, from a host after 0.4.0 (which says it again after a welcome without the binding, or sends an uncorrelated BANNED).

Fields

§community: Community

The community.

§reason: RemovalReason

Why.

§

CommunityMoving

The owner handed the community to a new host; this client is moving there.

Fields

§community: Community

The community.

§host: HostId

The new host.

§

CommunityMoved

This client moved with its community to the new host.

Fields

§community: Community

The community.

§host: HostId

The new host.

§

CommunityMoveRefused

The new host refused this member; the move is given up.

Fields

§community: Community

The community.

§code: String

The host’s error code.

§

Disconnect(Community)

The connection to a community’s host closed; the community stays saved.

§

Offline

No SimpleX relay is reachable.

§

Online

A relay is reachable again.

§

Warning(String)

Something was ignored safely; the text names no content or secret.

§

DmCreate

DM: a direct message became known: opened by either side, or found when the community loaded. recipient is the other participant.

Fields

§channel: Channel

The DM’s channel; post with Channel::send.

§recipient: Member

The other participant.

§

DmDelete(Channel)

DM: this member closed a direct message.

§

MessageSent

A post made with Channel::send_pending is in: the host accepted it as message, which replaces the pending one shown (matched by pending). Its message.created may also arrive as a Event::MessageCreate.

Fields

§pending: u64
§message: Message

The message as the host keeps it.

§

MessageSendFailed

A post made with Channel::send_pending did not go through; the pending one shown should say so.

Fields

§pending: u64
§channel: Channel

Its channel.

§error: String

Why (the host refused, an upload failed, or the connection gave up).

§

TypingStart

Someone else is typing in a channel (typing): members by id in a named channel, only how many in an anonymous one. It shows for TYPING_SHOWN_MS unless repeated; Channel::typing gives the current state.

Fields

§channel: Channel

The channel.

§typing: TypingNow

Who, or how many.

§

Raw

Any other community event, as the protocol has it.

Fields

§community: Community

The community.

§channel: Option<Channel>

The channel, for a channel event.

§actor: Option<Member>

Who caused it, when the host names them.

§event: Box<Event>

The event.

Trait Implementations§

Source§

impl Clone for Event

Source§

fn clone(&self) -> Event

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Event

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnsafeUnpin for Event

§

impl UnwindSafe for Event

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> CryptoSafe for T
where T: Send + Sync + Debug,

§

impl<T> CryptoSafe for T

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more