Add rest of send events
This commit is contained in:
parent
595716afc5
commit
11d371eee2
|
@ -803,6 +803,30 @@ pub struct GatewayReady {
|
|||
|
||||
impl WebSocketEvent for GatewayReady {}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Default)]
|
||||
/// See https://discord.com/developers/docs/topics/gateway-events#request-guild-members-request-guild-members-structure
|
||||
pub struct GatewayRequestGuildMembers {
|
||||
pub guild_id: String,
|
||||
pub query: Option<String>,
|
||||
pub limit: u64,
|
||||
pub presence: Option<bool>,
|
||||
pub user_ids: Option<String>,
|
||||
pub nonce: Option<String>,
|
||||
}
|
||||
|
||||
impl WebSocketEvent for GatewayRequestGuildMembers {}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Default)]
|
||||
/// See https://discord.com/developers/docs/topics/gateway-events#update-voice-state-gateway-voice-state-update-structure
|
||||
pub struct GatewayVoiceStateUpdate {
|
||||
pub guild_id: String,
|
||||
pub channel_id: Option<String>,
|
||||
pub self_mute: bool,
|
||||
pub self_deaf: bool,
|
||||
}
|
||||
|
||||
impl WebSocketEvent for GatewayVoiceStateUpdate {}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Serialize)]
|
||||
pub struct GatewayHello {
|
||||
pub op: i32,
|
||||
|
|
|
@ -69,8 +69,30 @@ impl GatewayHandle {
|
|||
|
||||
let to_send_value = serde_json::to_value(&to_send).unwrap();
|
||||
|
||||
println!("GW: Sending Presence Update..");
|
||||
|
||||
self.send_json_event(3, to_send_value).await;
|
||||
}
|
||||
|
||||
/// Sends a Request Guild Members to the server
|
||||
pub async fn send_request_guild_members(&self, to_send: GatewayRequestGuildMembers) {
|
||||
|
||||
let to_send_value = serde_json::to_value(&to_send).unwrap();
|
||||
|
||||
println!("GW: Sending Request Guild Members..");
|
||||
|
||||
self.send_json_event(8, to_send_value).await;
|
||||
}
|
||||
|
||||
/// Sends a Request Guild Members to the server
|
||||
pub async fn send_update_voice_state(&self, to_send: GatewayVoiceStateUpdate) {
|
||||
|
||||
let to_send_value = serde_json::to_value(&to_send).unwrap();
|
||||
|
||||
println!("GW: Sending Voice State Update..");
|
||||
|
||||
self.send_json_event(4, to_send_value).await;
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Gateway {
|
||||
|
|
Loading…
Reference in New Issue