From e9253bd959bf5bf6e8bcc6de4db247895b015a16 Mon Sep 17 00:00:00 2001 From: Ashelyn Rose Date: Fri, 28 Feb 2025 21:52:16 -0700 Subject: Partial refactor Handles message prefixes and autoproxy --- src/system/types.rs | 59 +++++++++++++++++++---------------------------------- 1 file changed, 21 insertions(+), 38 deletions(-) (limited to 'src/system/types.rs') diff --git a/src/system/types.rs b/src/system/types.rs index 2698f9d..bd1e40f 100644 --- a/src/system/types.rs +++ b/src/system/types.rs @@ -1,46 +1,29 @@ -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, GuildMarker}; -use twilight_model::id::Id; -use twilight_model::util::Timestamp; - -pub type MemberId = usize; -pub type MessageId = Id; -pub type ChannelId = Id; -pub type ServerId = Id; -pub type UserId = Id; -pub type FullMessage = TwiMessage; - -pub type Status = twilight_model::gateway::presence::Status; +use regex::Regex; +use twilight_http::Client; +use twilight_gateway::Shard; +use twilight_model::id::{marker::UserMarker, Id}; +use std::sync::Arc; +use tokio::sync::Mutex; #[derive(Clone)] -pub enum Message { - Complete(FullMessage, MemberId), - Partial(PartialMessage, MemberId), +pub struct Member { + pub discord_token: String, + pub message_pattern: Regex, + pub shard: Arc>, + pub client: Arc>, } -pub type MessageEvent = (Timestamp, Message); -pub type ReactionEvent = (Timestamp, ()); -pub type CommandEvent = (Timestamp, ()); - -pub enum SystemEvent { - // Process of operation - GatewayConnected(MemberId, UserId), - GatewayError(MemberId, String), - GatewayClosed(MemberId), - RefetchMessage(MemberId, MessageId, ChannelId), - UpdateClientStatus(MemberId), - - // User event handling - NewMessage(Timestamp, FullMessage, MemberId), - EditedMessage(MessageEvent), - NewReaction(ReactionEvent), - - // Command handling - NewCommand(CommandEvent), +#[derive(Clone)] +pub struct System { + pub followed_user: Id, + pub command_prefix: String, + pub members: Vec +} - // Autoproxy - AutoproxyTimeout(Timestamp), +#[derive(Clone)] +pub enum Response { + Proxy {member: Member, content: String}, + Noop {delete_source: bool}, } pub enum SystemThreadCommand { -- cgit 1.4.1