summaryrefslogtreecommitdiff
path: root/gateway/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'gateway/src/main.rs')
-rw-r--r--gateway/src/main.rs48
1 files changed, 13 insertions, 35 deletions
diff --git a/gateway/src/main.rs b/gateway/src/main.rs
index 003a903..4c42c7a 100644
--- a/gateway/src/main.rs
+++ b/gateway/src/main.rs
@@ -1,41 +1,19 @@
-mod client;
-
-use client::connection::Connection;
use common::config::Settings;
-use futures::StreamExt;
-use log::info;
-use serde_json::Value;
-
-use crate::client::payloads::{dispatch::Dispatch, gateway::{FullMessage, Message, OpCodes}, payloads::identify::{Identify, IdentifyProprerties}};
+use shard::{Shard, ShardConfig};
+#[macro_use]
+extern crate num_derive;
-#[tokio::main]
-async fn main() {
- let settings: Settings<Value> = Settings::new("gateway").unwrap();
+pub mod connection;
+mod error;
+mod utils;
+mod shard;
+mod payloads;
- let mut conn = Connection::new();
- conn.start().await.unwrap();
- loop {
- if let Some(val) = conn.next().await {
- let data = val.as_ref().unwrap();
- match data {
- Message::Dispatch(dispatch) => {
- match &dispatch.data {
- Dispatch::Ready(_ready) => {
-
- },
- }
- },
- Message::Reconnect(_) => todo!(),
- Message::InvalidSession(_) => todo!(),
- Message::Hello(_hello) => {
- info!("Server said hello! {:?}", _hello);
- },
- Message::HeartbeatACK(_) => todo!(),
- }
- } else {
- break;
- }
- }
+#[tokio::main]
+async fn main() {
+ let settings: Settings<ShardConfig> = Settings::new("gateway").unwrap();
+ let mut shard = Shard::new(settings.config);
+ shard.start().await;
}