summary refs log tree commit diff
path: root/src/system/types.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/system/types.rs')
-rw-r--r--src/system/types.rs59
1 files changed, 21 insertions, 38 deletions
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<MessageMarker>;
-pub type ChannelId = Id<ChannelMarker>;
-pub type ServerId = Id<GuildMarker>;
-pub type UserId = Id<UserMarker>;
-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<Mutex<Shard>>,
+    pub client: Arc<Mutex<Client>>,
 }
 
-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<UserMarker>,
+    pub command_prefix: String,
+    pub members: Vec<Member>
+}
 
-    // Autoproxy
-    AutoproxyTimeout(Timestamp),
+#[derive(Clone)]
+pub enum Response {
+    Proxy {member: Member, content: String},
+    Noop {delete_source: bool},
 }
 
 pub enum SystemThreadCommand {