Refactor project to use chorus::Gateway[...]

This commit is contained in:
bitfl0wer 2023-11-15 21:03:43 +01:00
parent 497c3bda74
commit b738f4d543
No known key found for this signature in database
GPG Key ID: 0ACD574FCF5226CF
12 changed files with 13 additions and 10 deletions

View File

@ -4,6 +4,7 @@ use chorus::{
self, self,
gateway::Observer, gateway::Observer,
types::{GatewayIdentifyPayload, GatewayReady}, types::{GatewayIdentifyPayload, GatewayReady},
Gateway,
}; };
use std::{sync::Arc, time::Duration}; use std::{sync::Arc, time::Duration};
use tokio::{self, time::sleep}; use tokio::{self, time::sleep};

View File

@ -1,7 +1,7 @@
use std::time::Duration; use std::time::Duration;
use chorus::gateway::{GatewayCapable, GatewayHandleCapable}; use chorus::gateway::{GatewayCapable, GatewayHandleCapable};
use chorus::{self, types::GatewayIdentifyPayload}; use chorus::{self, types::GatewayIdentifyPayload, Gateway};
use tokio::time::sleep; use tokio::time::sleep;
/// This example creates a simple gateway connection and a session with an Identify event /// This example creates a simple gateway connection and a session with an Identify event

View File

@ -8,6 +8,7 @@ use crate::gateway::{GatewayCapable, GatewayHandleCapable};
use crate::instance::{ChorusUser, Instance}; use crate::instance::{ChorusUser, Instance};
use crate::ratelimiter::ChorusRequest; use crate::ratelimiter::ChorusRequest;
use crate::types::{GatewayIdentifyPayload, LimitType, LoginResult, LoginSchema}; use crate::types::{GatewayIdentifyPayload, LimitType, LoginResult, LoginSchema};
use crate::Gateway;
impl Instance { impl Instance {
/// Logs into an existing account on the spacebar server. /// Logs into an existing account on the spacebar server.

View File

@ -12,6 +12,7 @@ use crate::{
types::LimitType, types::LimitType,
types::RegisterSchema, types::RegisterSchema,
}; };
use crate::{Gateway, GatewayHandle};
impl Instance { impl Instance {
/// Registers a new user on the server. /// Registers a new user on the server.

View File

@ -12,7 +12,7 @@ use crate::types::{
}; };
#[cfg(feature = "client")] #[cfg(feature = "client")]
use crate::types::Composite; use crate::{types::Composite, GatewayHandle};
#[cfg(feature = "client")] #[cfg(feature = "client")]
use crate::gateway::Updateable; use crate::gateway::Updateable;

View File

@ -7,7 +7,7 @@ use crate::types::entities::User;
use crate::types::Snowflake; use crate::types::Snowflake;
#[cfg(feature = "client")] #[cfg(feature = "client")]
use crate::types::Composite; use crate::{types::Composite, GatewayHandle};
#[cfg(feature = "client")] #[cfg(feature = "client")]
use crate::gateway::Updateable; use crate::gateway::Updateable;

View File

@ -1,6 +1,7 @@
use std::fmt::Debug; use std::fmt::Debug;
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use bitflags::bitflags;
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr}; use serde_repr::{Deserialize_repr, Serialize_repr};
@ -11,12 +12,11 @@ use crate::types::{
interfaces::WelcomeScreenObject, interfaces::WelcomeScreenObject,
utils::Snowflake, utils::Snowflake,
}; };
use bitflags::bitflags;
use super::PublicUser; use super::PublicUser;
#[cfg(feature = "client")] #[cfg(feature = "client")]
use crate::gateway::Updateable; use crate::{gateway::Updateable, GatewayHandle};
#[cfg(feature = "client")] #[cfg(feature = "client")]
use chorus_macros::{observe_option_vec, observe_vec, Composite, Updateable}; use chorus_macros::{observe_option_vec, observe_vec, Composite, Updateable};

View File

@ -24,7 +24,7 @@ pub use voice_state::*;
pub use webhook::*; pub use webhook::*;
#[cfg(feature = "client")] #[cfg(feature = "client")]
use crate::gateway::Updateable; use crate::{gateway::Updateable, GatewayHandle};
#[cfg(feature = "client")] #[cfg(feature = "client")]
use async_trait::async_trait; use async_trait::async_trait;

View File

@ -12,7 +12,7 @@ use chorus_macros::{Composite, Updateable};
use crate::gateway::Updateable; use crate::gateway::Updateable;
#[cfg(feature = "client")] #[cfg(feature = "client")]
use crate::types::Composite; use crate::{types::Composite, GatewayHandle};
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)] #[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
#[cfg_attr(feature = "client", derive(Updateable, Composite))] #[cfg_attr(feature = "client", derive(Updateable, Composite))]

View File

@ -8,7 +8,7 @@ use std::fmt::Debug;
use crate::gateway::Updateable; use crate::gateway::Updateable;
#[cfg(feature = "client")] #[cfg(feature = "client")]
use crate::types::Composite; use crate::{types::Composite, GatewayHandle};
#[cfg(feature = "client")] #[cfg(feature = "client")]
use chorus_macros::{Composite, Updateable}; use chorus_macros::{Composite, Updateable};

View File

@ -4,7 +4,7 @@ use std::sync::{Arc, RwLock};
use chorus_macros::Composite; use chorus_macros::Composite;
#[cfg(feature = "client")] #[cfg(feature = "client")]
use crate::types::Composite; use crate::{types::Composite, GatewayHandle};
#[cfg(feature = "client")] #[cfg(feature = "client")]
use crate::gateway::Updateable; use crate::gateway::Updateable;

View File

@ -10,7 +10,7 @@ use crate::gateway::Updateable;
use chorus_macros::{Composite, Updateable}; use chorus_macros::{Composite, Updateable};
#[cfg(feature = "client")] #[cfg(feature = "client")]
use crate::types::Composite; use crate::{types::Composite, GatewayHandle};
use crate::types::{ use crate::types::{
entities::{Guild, User}, entities::{Guild, User},