From 0053ccbb31c3b87285bf38ee3eda3308c67ad707 Mon Sep 17 00:00:00 2001 From: Ashelyn Rose Date: Thu, 3 Oct 2024 03:18:26 -0600 Subject: Refactor bot into separate client + gateway --- src/system/types.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/system/types.rs') diff --git a/src/system/types.rs b/src/system/types.rs index e8d14a6..41cb10d 100644 --- a/src/system/types.rs +++ b/src/system/types.rs @@ -1,4 +1,5 @@ -use twilight_model::channel::Message; +pub use twilight_model::channel::Message as TwiMessage; +use twilight_model::gateway::payload::incoming::MessageUpdate as PartialMessage; use twilight_model::id::marker::{ChannelMarker, MessageMarker, UserMarker}; use twilight_model::id::Id; use twilight_model::util::Timestamp; @@ -7,9 +8,16 @@ pub type MemberId = usize; pub type MessageId = Id; pub type ChannelId = Id; pub type UserId = Id; +pub type FullMessage = TwiMessage; pub type Status = twilight_model::gateway::presence::Status; +#[derive(Clone)] +pub enum Message { + Complete(FullMessage), + Partial(PartialMessage, MemberId), +} + pub type MessageEvent = (Timestamp, Message); pub type ReactionEvent = (Timestamp, ()); pub type CommandEvent = (Timestamp, ()); @@ -20,9 +28,10 @@ pub enum SystemEvent { GatewayError(MemberId, String), GatewayClosed(MemberId), AllGatewaysConnected, + RefetchMessage(MemberId, MessageId, ChannelId), // User event handling - NewMessage(MessageEvent), + NewMessage(Timestamp, FullMessage), EditedMessage(MessageEvent), NewReaction(ReactionEvent), -- cgit 1.4.1