summary refs log tree commit diff
path: root/src/system
diff options
context:
space:
mode:
Diffstat (limited to 'src/system')
-rw-r--r--src/system/bot/gateway.rs4
-rw-r--r--src/system/mod.rs5
-rw-r--r--src/system/types.rs2
3 files changed, 7 insertions, 4 deletions
diff --git a/src/system/bot/gateway.rs b/src/system/bot/gateway.rs
index 5a343d1..bfe4603 100644
--- a/src/system/bot/gateway.rs
+++ b/src/system/bot/gateway.rs
@@ -80,9 +80,9 @@ impl Gateway {
                         }
                     }
                     Ok(event) => match event {
-                        twilight_gateway::Event::Ready(_) => {
+                        twilight_gateway::Event::Ready(ready) => {
                             system_channel
-                                .send(SystemEvent::GatewayConnected(bot_conf.member_id))
+                                .send(SystemEvent::GatewayConnected(bot_conf.member_id, ready.user.id))
                                 .await;
                         }
 
diff --git a/src/system/mod.rs b/src/system/mod.rs
index bd27f4a..6c4d95f 100644
--- a/src/system/mod.rs
+++ b/src/system/mod.rs
@@ -84,7 +84,10 @@ impl Manager {
 
         loop {
             match system_receiver.recv().await {
-                Some(SystemEvent::GatewayConnected(member_id)) => {
+                Some(SystemEvent::GatewayConnected(member_id, user_id)) => {
+                    self.config.members.iter_mut().enumerate()
+                        .find(|(id, _)| *id == member_id).unwrap().1.user_id = Some(user_id);
+
                     let member = self.find_member_by_id(member_id).unwrap();
 
                     println!("Gateway client {} ({}) connected", member.name, member_id);
diff --git a/src/system/types.rs b/src/system/types.rs
index 89eb189..bef6d6d 100644
--- a/src/system/types.rs
+++ b/src/system/types.rs
@@ -24,7 +24,7 @@ pub type CommandEvent = (Timestamp, ());
 
 pub enum SystemEvent {
     // Process of operation
-    GatewayConnected(MemberId),
+    GatewayConnected(MemberId, UserId),
     GatewayError(MemberId, String),
     GatewayClosed(MemberId),
     RefetchMessage(MemberId, MessageId, ChannelId),