turns out UpdatePresence and PresenceUpdate are different events
This commit is contained in:
parent
78e63657c8
commit
3db9114ecf
|
@ -235,10 +235,10 @@ impl GatewayHandle {
|
|||
}
|
||||
|
||||
/// Sends an update presence event to the gateway
|
||||
pub async fn send_update_presence(&self, to_send: types::PresenceUpdate) {
|
||||
pub async fn send_update_presence(&self, to_send: types::UpdatePresence) {
|
||||
let to_send_value = serde_json::to_value(&to_send).unwrap();
|
||||
|
||||
println!("GW: Sending Presence Update..");
|
||||
println!("GW: Sending Update Presence..");
|
||||
|
||||
self.send_json_event(GATEWAY_UPDATE_PRESENCE, to_send_value)
|
||||
.await;
|
||||
|
|
|
@ -1,14 +1,28 @@
|
|||
use crate::types::events::WebSocketEvent;
|
||||
use crate::types::interfaces::Activity;
|
||||
use crate::types::PublicUser;
|
||||
use crate::types::{events::WebSocketEvent, UserStatus};
|
||||
use crate::types::{PublicUser, Snowflake};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||
/// Sent by the client to update its status and presence;
|
||||
/// See https://discord.com/developers/docs/topics/gateway-events#update-presence
|
||||
pub struct UpdatePresence {
|
||||
/// unix time of when the client went idle, or none if client is not idle
|
||||
pub since: Option<u128>,
|
||||
/// the client's status (online, invisible, offline, dnd, idle..)
|
||||
pub status: UserStatus,
|
||||
pub activities: Vec<Activity>,
|
||||
pub afk: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||
/// Received to tell the client that a user updated their presence / status
|
||||
/// See https://discord.com/developers/docs/topics/gateway-events#presence-update-presence-update-event-fields
|
||||
pub struct PresenceUpdate {
|
||||
pub user: PublicUser,
|
||||
pub guild_id: Option<String>,
|
||||
pub status: String,
|
||||
#[serde(default)]
|
||||
pub guild_id: Option<Snowflake>,
|
||||
pub status: UserStatus,
|
||||
pub activities: Vec<Activity>,
|
||||
pub client_status: ClientStatusObject,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue