Docs + unneeded &mut
This commit is contained in:
parent
dc2fc90414
commit
a278b63ecb
|
@ -101,7 +101,7 @@ impl GatewayMessage {
|
||||||
"unknown opcode" | "4001" => {
|
"unknown opcode" | "4001" => {
|
||||||
return Some(GatewayError::UnknownOpcodeError);
|
return Some(GatewayError::UnknownOpcodeError);
|
||||||
}
|
}
|
||||||
"decode error" | "4002" => {
|
"decode error" | "error while decoding payload" | "4002" => {
|
||||||
return Some(GatewayError::DecodeError);
|
return Some(GatewayError::DecodeError);
|
||||||
}
|
}
|
||||||
"not authenticated" | "4003" => {
|
"not authenticated" | "4003" => {
|
||||||
|
@ -281,8 +281,10 @@ impl GatewayHandle {
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Closes the websocket connection and stops all gateway tasks
|
/// Closes the websocket connection and stops all gateway tasks;
|
||||||
pub async fn close(&mut self) {
|
///
|
||||||
|
/// Esentially pulls the plug on the gateway, leaving it possible to resume;
|
||||||
|
pub async fn close(&self) {
|
||||||
self.kill_send.send(()).unwrap();
|
self.kill_send.send(()).unwrap();
|
||||||
self.websocket_send.lock().await.close().await.unwrap();
|
self.websocket_send.lock().await.close().await.unwrap();
|
||||||
}
|
}
|
||||||
|
@ -411,6 +413,14 @@ impl Gateway {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !msg.is_error() && !msg.is_payload() {
|
||||||
|
println!(
|
||||||
|
"Message unrecognised: {:?}, please open an issue on the chorus github",
|
||||||
|
msg.message.to_string()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// To:do: handle errors in a good way, maybe observers like events?
|
// To:do: handle errors in a good way, maybe observers like events?
|
||||||
if msg.is_error() {
|
if msg.is_error() {
|
||||||
println!("GW: Received error, connection will close..");
|
println!("GW: Received error, connection will close..");
|
||||||
|
|
|
@ -3,9 +3,10 @@ use serde::{Deserialize, Serialize};
|
||||||
use crate::types::{VoiceState, WebSocketEvent};
|
use crate::types::{VoiceState, WebSocketEvent};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// Officially Undocumented
|
/// Officially Undocumented;
|
||||||
/// Is sent to a client by the server to signify a new being created
|
/// Is sent to a client by the server to signify a new call being created;
|
||||||
/// {"t":"CALL_CREATE","s":2,"op":0,"d":{"voice_states":[],"ringing":[],"region":"milan","message_id":"1107187514906775613","embedded_activities":[],"channel_id":"837609115475771392"}}
|
///
|
||||||
|
/// Ex: {"t":"CALL_CREATE","s":2,"op":0,"d":{"voice_states":[],"ringing":[],"region":"milan","message_id":"1107187514906775613","embedded_activities":[],"channel_id":"837609115475771392"}}
|
||||||
pub struct CallCreate {
|
pub struct CallCreate {
|
||||||
pub voice_states: Vec<VoiceState>,
|
pub voice_states: Vec<VoiceState>,
|
||||||
/// Seems like a vec of channel ids
|
/// Seems like a vec of channel ids
|
||||||
|
@ -19,9 +20,10 @@ pub struct CallCreate {
|
||||||
impl WebSocketEvent for CallCreate {}
|
impl WebSocketEvent for CallCreate {}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// Officially Undocumented
|
/// Officially Undocumented;
|
||||||
/// Updates the status of calls
|
/// Updates the client on which calls are ringing, along with a specific call?;
|
||||||
/// {"t":"CALL_UPDATE","s":5,"op":0,"d":{"ringing":["837606544539254834"],"region":"milan","message_id":"1107191540234846308","guild_id":null,"channel_id":"837609115475771392"}}
|
///
|
||||||
|
/// Ex: {"t":"CALL_UPDATE","s":5,"op":0,"d":{"ringing":["837606544539254834"],"region":"milan","message_id":"1107191540234846308","guild_id":null,"channel_id":"837609115475771392"}}
|
||||||
pub struct CallUpdate {
|
pub struct CallUpdate {
|
||||||
/// Seems like a vec of channel ids
|
/// Seems like a vec of channel ids
|
||||||
pub ringing: Vec<String>,
|
pub ringing: Vec<String>,
|
||||||
|
@ -33,18 +35,19 @@ pub struct CallUpdate {
|
||||||
impl WebSocketEvent for CallUpdate {}
|
impl WebSocketEvent for CallUpdate {}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// Officially Undocumented
|
/// Officially Undocumented;
|
||||||
/// Deletes a ringing call
|
/// Deletes a ringing call;
|
||||||
/// {"t":"CALL_DELETE","s":8,"op":0,"d":{"channel_id":"837609115475771392"}}
|
/// Ex: {"t":"CALL_DELETE","s":8,"op":0,"d":{"channel_id":"837609115475771392"}}
|
||||||
pub struct CallDelete {
|
pub struct CallDelete {
|
||||||
pub channel_id: String,
|
pub channel_id: String,
|
||||||
}
|
}
|
||||||
impl WebSocketEvent for CallDelete {}
|
impl WebSocketEvent for CallDelete {}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// Officially Undocumented
|
/// Officially Undocumented;
|
||||||
/// See https://unofficial-discord-docs.vercel.app/gateway/op13
|
/// See https://unofficial-discord-docs.vercel.app/gateway/op13;
|
||||||
/// {"op":13,"d":{"channel_id":"837609115475771392"}}
|
///
|
||||||
|
/// Ex: {"op":13,"d":{"channel_id":"837609115475771392"}}
|
||||||
pub struct CallSync {
|
pub struct CallSync {
|
||||||
pub channel_id: String,
|
pub channel_id: String,
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,9 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::PresenceUpdate;
|
use super::PresenceUpdate;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// See https://discord.com/developers/docs/topics/gateway-events#guild-create
|
/// See https://discord.com/developers/docs/topics/gateway-events#guild-create;
|
||||||
/// This one is particularly painful, it can be a Guild object with an extra field or an unavailable guild object
|
/// Received to give data about a guild;
|
||||||
|
// This one is particularly painful, it can be a Guild object with an extra field or an unavailable guild object
|
||||||
pub struct GuildCreate {
|
pub struct GuildCreate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub d: GuildCreateDataOption,
|
pub d: GuildCreateDataOption,
|
||||||
|
@ -29,7 +30,8 @@ impl Default for GuildCreateDataOption {
|
||||||
impl WebSocketEvent for GuildCreate {}
|
impl WebSocketEvent for GuildCreate {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See https://discord.com/developers/docs/topics/gateway-events#guild-ban-add-guild-ban-add-event-fields
|
/// See https://discord.com/developers/docs/topics/gateway-events#guild-ban-add-guild-ban-add-event-fields;
|
||||||
|
/// Received to give info about a user being banned from a guild;
|
||||||
pub struct GuildBanAdd {
|
pub struct GuildBanAdd {
|
||||||
pub guild_id: String,
|
pub guild_id: String,
|
||||||
pub user: PublicUser,
|
pub user: PublicUser,
|
||||||
|
@ -38,7 +40,8 @@ pub struct GuildBanAdd {
|
||||||
impl WebSocketEvent for GuildBanAdd {}
|
impl WebSocketEvent for GuildBanAdd {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See https://discord.com/developers/docs/topics/gateway-events#guild-ban-remove
|
/// See https://discord.com/developers/docs/topics/gateway-events#guild-ban-remove;
|
||||||
|
/// Received to give info about a user being unbanned from a guild;
|
||||||
pub struct GuildBanRemove {
|
pub struct GuildBanRemove {
|
||||||
pub guild_id: String,
|
pub guild_id: String,
|
||||||
pub user: PublicUser,
|
pub user: PublicUser,
|
||||||
|
@ -47,7 +50,8 @@ pub struct GuildBanRemove {
|
||||||
impl WebSocketEvent for GuildBanRemove {}
|
impl WebSocketEvent for GuildBanRemove {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See https://discord.com/developers/docs/topics/gateway-events#guild-update
|
/// See https://discord.com/developers/docs/topics/gateway-events#guild-update;
|
||||||
|
/// Received to give info about a guild being updated;
|
||||||
pub struct GuildUpdate {
|
pub struct GuildUpdate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub guild: Guild,
|
pub guild: Guild,
|
||||||
|
@ -56,7 +60,8 @@ pub struct GuildUpdate {
|
||||||
impl WebSocketEvent for GuildUpdate {}
|
impl WebSocketEvent for GuildUpdate {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See https://discord.com/developers/docs/topics/gateway-events#guild-delete
|
/// See https://discord.com/developers/docs/topics/gateway-events#guild-delete;
|
||||||
|
/// Received to tell the client about a guild being deleted;
|
||||||
pub struct GuildDelete {
|
pub struct GuildDelete {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub guild: UnavailableGuild,
|
pub guild: UnavailableGuild,
|
||||||
|
@ -65,7 +70,8 @@ pub struct GuildDelete {
|
||||||
impl WebSocketEvent for GuildDelete {}
|
impl WebSocketEvent for GuildDelete {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See https://discord.com/developers/docs/topics/gateway-events#guild-audit-log-entry-create
|
/// See https://discord.com/developers/docs/topics/gateway-events#guild-audit-log-entry-create;
|
||||||
|
/// Received to the client about an audit log entry being added;
|
||||||
pub struct GuildAuditLogEntryCreate {
|
pub struct GuildAuditLogEntryCreate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub entry: AuditLogEntry,
|
pub entry: AuditLogEntry,
|
||||||
|
@ -74,7 +80,8 @@ pub struct GuildAuditLogEntryCreate {
|
||||||
impl WebSocketEvent for GuildAuditLogEntryCreate {}
|
impl WebSocketEvent for GuildAuditLogEntryCreate {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See https://discord.com/developers/docs/topics/gateway-events#guild-emojis-update
|
/// See https://discord.com/developers/docs/topics/gateway-events#guild-emojis-update;
|
||||||
|
/// Received to tell the client about a change to a guild's emoji list;
|
||||||
pub struct GuildEmojisUpdate {
|
pub struct GuildEmojisUpdate {
|
||||||
pub guild_id: String,
|
pub guild_id: String,
|
||||||
pub emojis: Vec<Emoji>,
|
pub emojis: Vec<Emoji>,
|
||||||
|
@ -83,7 +90,8 @@ pub struct GuildEmojisUpdate {
|
||||||
impl WebSocketEvent for GuildEmojisUpdate {}
|
impl WebSocketEvent for GuildEmojisUpdate {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See https://discord.com/developers/docs/topics/gateway-events#guild-stickers-update
|
/// See https://discord.com/developers/docs/topics/gateway-events#guild-stickers-update;
|
||||||
|
/// Received to tell the client about a change to a guild's sticker list;
|
||||||
pub struct GuildStickersUpdate {
|
pub struct GuildStickersUpdate {
|
||||||
pub guild_id: String,
|
pub guild_id: String,
|
||||||
pub stickers: Vec<Sticker>,
|
pub stickers: Vec<Sticker>,
|
||||||
|
@ -100,7 +108,8 @@ pub struct GuildIntegrationsUpdate {
|
||||||
impl WebSocketEvent for GuildIntegrationsUpdate {}
|
impl WebSocketEvent for GuildIntegrationsUpdate {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See https://discord.com/developers/docs/topics/gateway-events#guild-member-add
|
/// See https://discord.com/developers/docs/topics/gateway-events#guild-member-add;
|
||||||
|
/// Received to tell the client about a user joining a guild;
|
||||||
pub struct GuildMemberAdd {
|
pub struct GuildMemberAdd {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub member: GuildMember,
|
pub member: GuildMember,
|
||||||
|
@ -110,7 +119,8 @@ pub struct GuildMemberAdd {
|
||||||
impl WebSocketEvent for GuildMemberAdd {}
|
impl WebSocketEvent for GuildMemberAdd {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See https://discord.com/developers/docs/topics/gateway-events#guild-member-remove
|
/// See https://discord.com/developers/docs/topics/gateway-events#guild-member-remove;
|
||||||
|
/// Received to tell the client about a user leaving a guild;
|
||||||
pub struct GuildMemberRemove {
|
pub struct GuildMemberRemove {
|
||||||
pub guild_id: String,
|
pub guild_id: String,
|
||||||
pub user: PublicUser,
|
pub user: PublicUser,
|
||||||
|
|
|
@ -2,6 +2,7 @@ use crate::types::events::WebSocketEvent;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
|
/// Received on gateway init, tells the client how often to send heartbeats;
|
||||||
pub struct GatewayHello {
|
pub struct GatewayHello {
|
||||||
pub op: i32,
|
pub op: i32,
|
||||||
pub d: HelloData,
|
pub d: HelloData,
|
||||||
|
@ -10,7 +11,10 @@ pub struct GatewayHello {
|
||||||
impl WebSocketEvent for GatewayHello {}
|
impl WebSocketEvent for GatewayHello {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
|
/// Contains info on how often the client should send heartbeats to the server;
|
||||||
pub struct HelloData {
|
pub struct HelloData {
|
||||||
|
/// How often a client should send heartbeats, in milliseconds
|
||||||
|
// u128 because std used u128s for milliseconds
|
||||||
pub heartbeat_interval: u128,
|
pub heartbeat_interval: u128,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@ use crate::types::{Activity, GuildMember, PresenceUpdate, VoiceState};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// Sort of documented, though most fields are left out
|
/// 1/2 half documented;
|
||||||
/// For a full example see https://gist.github.com/kozabrada123/a347002b1fb8825a5727e40746d4e199
|
/// Received after identifying, provides initial user info;
|
||||||
/// to:do add all undocumented fields
|
/// See https://discord.com/developers/docs/topics/gateway-events#ready;
|
||||||
pub struct GatewayReady {
|
pub struct GatewayReady {
|
||||||
pub analytics_token: Option<String>,
|
pub analytics_token: Option<String>,
|
||||||
pub auth_session_id_hash: Option<String>,
|
pub auth_session_id_hash: Option<String>,
|
||||||
|
@ -28,9 +28,8 @@ pub struct GatewayReady {
|
||||||
impl WebSocketEvent for GatewayReady {}
|
impl WebSocketEvent for GatewayReady {}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// Officially Undocumented
|
/// Officially Undocumented;
|
||||||
/// Sent after the READY event when a client is a user
|
/// Sent after the READY event when a client is a user, seems to somehow add onto the ready event;
|
||||||
/// {"t":"READY_SUPPLEMENTAL","s":2,"op":0,"d":{"merged_presences":{"guilds":[[{"user_id":"463640391196082177","status":"online","game":null,"client_status":{"web":"online"},"activities":[]}]],"friends":[{"user_id":"463640391196082177","status":"online","last_modified":1684053508443,"client_status":{"web":"online"},"activities":[]}]},"merged_members":[[{"user_id":"463640391196082177","roles":[],"premium_since":null,"pending":false,"nick":"pog","mute":false,"joined_at":"2021-05-30T15:24:08.763000+00:00","flags":0,"deaf":false,"communication_disabled_until":null,"avatar":null}]],"lazy_private_channels":[],"guilds":[{"voice_states":[],"id":"848582562217590824","embedded_activities":[]}],"disclose":["pomelo"]}}
|
|
||||||
pub struct GatewayReadySupplemental {
|
pub struct GatewayReadySupplemental {
|
||||||
pub merged_presences: MergedPresences,
|
pub merged_presences: MergedPresences,
|
||||||
pub merged_members: Vec<Vec<GuildMember>>,
|
pub merged_members: Vec<Vec<GuildMember>>,
|
||||||
|
|
|
@ -4,7 +4,8 @@ use crate::types::utils::Snowflake;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See https://discord.com/developers/docs/topics/gateway-events#user-update
|
/// See https://discord.com/developers/docs/topics/gateway-events#user-update;
|
||||||
|
/// Sent to indicate updates to a user object; (name changes, discriminator changes, etc);
|
||||||
pub struct UserUpdate {
|
pub struct UserUpdate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub user: PublicUser,
|
pub user: PublicUser,
|
||||||
|
@ -13,11 +14,11 @@ pub struct UserUpdate {
|
||||||
impl WebSocketEvent for UserUpdate {}
|
impl WebSocketEvent for UserUpdate {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// Undocumented
|
/// Undocumented;
|
||||||
///
|
///
|
||||||
/// Possibly an update for muted guild / channel settings for the current user
|
/// Possibly an update for muted guild / channel settings for the current user;
|
||||||
///
|
///
|
||||||
/// {"version":2,"suppress_roles":false,"suppress_everyone":false,"notify_highlights":0,"muted":false,"mute_scheduled_events":false,"mute_config":null,"mobile_push":true,"message_notifications":1,"hide_muted_channels":false,"guild_id":"848582562217590824","flags":0,"channel_overrides":[{"muted":false,"mute_config":null,"message_notifications":3,"flags":4096,"collapsed":false,"channel_id":"1042689182893604885"}]}
|
/// Ex: {"version":2,"suppress_roles":false,"suppress_everyone":false,"notify_highlights":0,"muted":false,"mute_scheduled_events":false,"mute_config":null,"mobile_push":true,"message_notifications":1,"hide_muted_channels":false,"guild_id":"848582562217590824","flags":0,"channel_overrides":[{"muted":false,"mute_config":null,"message_notifications":3,"flags":4096,"collapsed":false,"channel_id":"1042689182893604885"}]}
|
||||||
pub struct UserGuildSettingsUpdate {
|
pub struct UserGuildSettingsUpdate {
|
||||||
pub version: u8,
|
pub version: u8,
|
||||||
pub suppress_roles: bool,
|
pub suppress_roles: bool,
|
||||||
|
@ -38,11 +39,11 @@ pub struct UserGuildSettingsUpdate {
|
||||||
impl WebSocketEvent for UserGuildSettingsUpdate {}
|
impl WebSocketEvent for UserGuildSettingsUpdate {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// Undocumented
|
/// Undocumented;
|
||||||
///
|
///
|
||||||
/// Received in [UserGuildSettingsUpdate]
|
/// Received in [UserGuildSettingsUpdate];
|
||||||
///
|
///
|
||||||
/// {"muted":false,"mute_config":null,"message_notifications":3,"flags":4096,"collapsed":false,"channel_id":"1042689182893604885"}
|
/// Ex: {"muted":false,"mute_config":null,"message_notifications":3,"flags":4096,"collapsed":false,"channel_id":"1042689182893604885"}
|
||||||
pub struct UserGuildSettingsChannelOverride {
|
pub struct UserGuildSettingsChannelOverride {
|
||||||
pub muted: bool,
|
pub muted: bool,
|
||||||
/// ??
|
/// ??
|
||||||
|
|
|
@ -2,11 +2,11 @@ use crate::types::{events::WebSocketEvent, VoiceState};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// See https://discord.com/developers/docs/topics/gateway-events#update-voice-state
|
/// See https://discord.com/developers/docs/topics/gateway-events#update-voice-state;
|
||||||
///
|
///
|
||||||
/// Sent to the server
|
/// Sent to the server to indicate an update of the voice state (leave voice channel, join voice channel, mute, deafen);
|
||||||
///
|
///
|
||||||
/// Not to be confused with [VoiceStateUpdate]
|
/// Not to be confused with [VoiceStateUpdate];
|
||||||
pub struct UpdateVoiceState {
|
pub struct UpdateVoiceState {
|
||||||
pub guild_id: Option<String>,
|
pub guild_id: Option<String>,
|
||||||
pub channel_id: Option<String>,
|
pub channel_id: Option<String>,
|
||||||
|
@ -17,11 +17,11 @@ pub struct UpdateVoiceState {
|
||||||
impl WebSocketEvent for UpdateVoiceState {}
|
impl WebSocketEvent for UpdateVoiceState {}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// See https://discord.com/developers/docs/topics/gateway-events#voice-state-update
|
/// See https://discord.com/developers/docs/topics/gateway-events#voice-state-update;
|
||||||
///
|
///
|
||||||
/// Received from the server
|
/// Received from the server to indicate an update in a user's voice state (leave voice channel, join voice channel, mute, deafen, etc);
|
||||||
///
|
///
|
||||||
/// Not to be confused with [UpdateVoiceState]
|
/// Not to be confused with [UpdateVoiceState];
|
||||||
pub struct VoiceStateUpdate {
|
pub struct VoiceStateUpdate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub state: VoiceState,
|
pub state: VoiceState,
|
||||||
|
@ -30,7 +30,9 @@ pub struct VoiceStateUpdate {
|
||||||
impl WebSocketEvent for VoiceStateUpdate {}
|
impl WebSocketEvent for VoiceStateUpdate {}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// See https://discord.com/developers/docs/topics/gateway-events#voice-server-update
|
/// See https://discord.com/developers/docs/topics/gateway-events#voice-server-update;
|
||||||
|
///
|
||||||
|
/// Received to indicate which voice endpoint, token and guild_id to use;
|
||||||
pub struct VoiceServerUpdate {
|
pub struct VoiceServerUpdate {
|
||||||
pub token: String,
|
pub token: String,
|
||||||
pub guild_id: String,
|
pub guild_id: String,
|
||||||
|
|
Loading…
Reference in New Issue