Compare commits
No commits in common. "3a5bbb73e0a3db6040ab4b20c95e79744e16bae8" and "4bf7037cf0d610d8219d98f9b6e996c186e83f6c" have entirely different histories.
3a5bbb73e0
...
4bf7037cf0
|
@ -252,9 +252,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chorus-macros"
|
name = "chorus-macros"
|
||||||
version = "0.3.0"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "de4221700bc486c6e6bc261fdea478936d33067a06325895f5d2a8cde5917272"
|
checksum = "a81545a60b926f815517dadbbd40cd502294ae2baea25fa8194d854d607512b0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
@ -43,7 +43,7 @@ thiserror = "1.0.56"
|
||||||
jsonwebtoken = "8.3.0"
|
jsonwebtoken = "8.3.0"
|
||||||
log = "0.4.20"
|
log = "0.4.20"
|
||||||
async-trait = "0.1.77"
|
async-trait = "0.1.77"
|
||||||
chorus-macros = "0.3.0"
|
chorus-macros = "0.2.0"
|
||||||
sqlx = { version = "0.7.3", features = [
|
sqlx = { version = "0.7.3", features = [
|
||||||
"mysql",
|
"mysql",
|
||||||
"sqlite",
|
"sqlite",
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
use custom_error::custom_error;
|
use custom_error::custom_error;
|
||||||
|
|
||||||
use crate::types::WebSocketEvent;
|
use crate::types::WebSocketEvent;
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
|
|
||||||
custom_error! {
|
custom_error! {
|
||||||
#[derive(PartialEq, Eq, Clone, Hash)]
|
#[derive(PartialEq, Eq, Clone, Hash)]
|
||||||
|
@ -73,7 +72,7 @@ custom_error! {
|
||||||
/// Supposed to be sent as numbers, though they are sent as string most of the time?
|
/// Supposed to be sent as numbers, though they are sent as string most of the time?
|
||||||
///
|
///
|
||||||
/// Also includes errors when initiating a connection and unexpected opcodes
|
/// Also includes errors when initiating a connection and unexpected opcodes
|
||||||
#[derive(PartialEq, Eq, Default, Clone, WebSocketEvent)]
|
#[derive(PartialEq, Eq, Default, Clone)]
|
||||||
pub GatewayError
|
pub GatewayError
|
||||||
// Errors we have received from the gateway
|
// Errors we have received from the gateway
|
||||||
#[default]
|
#[default]
|
||||||
|
@ -100,13 +99,15 @@ custom_error! {
|
||||||
UnexpectedOpcodeReceived{opcode: u8} = "Received an opcode we weren't expecting to receive: {opcode}",
|
UnexpectedOpcodeReceived{opcode: u8} = "Received an opcode we weren't expecting to receive: {opcode}",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for GatewayError {}
|
||||||
|
|
||||||
custom_error! {
|
custom_error! {
|
||||||
/// Voice Gateway errors
|
/// Voice Gateway errors
|
||||||
///
|
///
|
||||||
/// Similar to [GatewayError].
|
/// Similar to [GatewayError].
|
||||||
///
|
///
|
||||||
/// See <https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes>;
|
/// See <https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes>;
|
||||||
#[derive(Clone, Default, PartialEq, Eq, WebSocketEvent)]
|
#[derive(Clone, Default, PartialEq, Eq)]
|
||||||
pub VoiceGatewayError
|
pub VoiceGatewayError
|
||||||
// Errors we receive
|
// Errors we receive
|
||||||
#[default]
|
#[default]
|
||||||
|
@ -131,9 +132,11 @@ custom_error! {
|
||||||
UnexpectedOpcodeReceived{opcode: u8} = "Received an opcode we weren't expecting to receive: {opcode}",
|
UnexpectedOpcodeReceived{opcode: u8} = "Received an opcode we weren't expecting to receive: {opcode}",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for VoiceGatewayError {}
|
||||||
|
|
||||||
custom_error! {
|
custom_error! {
|
||||||
/// Voice UDP errors.
|
/// Voice UDP errors.
|
||||||
#[derive(Clone, PartialEq, Eq, WebSocketEvent)]
|
#[derive(Clone, PartialEq, Eq)]
|
||||||
pub VoiceUdpError
|
pub VoiceUdpError
|
||||||
|
|
||||||
// General errors
|
// General errors
|
||||||
|
@ -152,3 +155,4 @@ custom_error! {
|
||||||
CannotConnect{error: String} = "Cannot connect due to a UDP error: {error}",
|
CannotConnect{error: String} = "Cannot connect due to a UDP error: {error}",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for VoiceUdpError {}
|
||||||
|
|
|
@ -5,11 +5,12 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::types::{GuildApplicationCommandPermissions, WebSocketEvent};
|
use crate::types::{GuildApplicationCommandPermissions, WebSocketEvent};
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#application-command-permissions-update>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#application-command-permissions-update>
|
||||||
pub struct ApplicationCommandPermissionsUpdate {
|
pub struct ApplicationCommandPermissionsUpdate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub permissions: GuildApplicationCommandPermissions,
|
pub permissions: GuildApplicationCommandPermissions,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for ApplicationCommandPermissionsUpdate {}
|
||||||
|
|
|
@ -2,27 +2,28 @@
|
||||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
use crate::types::{JsonField, SourceUrlField, WebSocketEvent};
|
use crate::types::{JsonField, SourceUrlField};
|
||||||
use chorus_macros::{JsonField, SourceUrlField, WebSocketEvent};
|
use chorus_macros::{JsonField, SourceUrlField};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::types::{
|
use crate::types::{
|
||||||
AutoModerationAction, AutoModerationRule, AutoModerationRuleTriggerType, Snowflake,
|
AutoModerationAction, AutoModerationRule, AutoModerationRuleTriggerType, Snowflake,
|
||||||
|
WebSocketEvent,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "client")]
|
#[cfg(feature = "client")]
|
||||||
use super::UpdateMessage;
|
use super::UpdateMessage;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#auto-moderation-rule-create>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#auto-moderation-rule-create>
|
||||||
pub struct AutoModerationRuleCreate {
|
pub struct AutoModerationRuleCreate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub rule: AutoModerationRule,
|
pub rule: AutoModerationRule,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
impl WebSocketEvent for AutoModerationRuleCreate {}
|
||||||
Debug, Deserialize, Serialize, Default, Clone, JsonField, SourceUrlField, WebSocketEvent,
|
|
||||||
)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone, JsonField, SourceUrlField)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#auto-moderation-rule-update>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#auto-moderation-rule-update>
|
||||||
pub struct AutoModerationRuleUpdate {
|
pub struct AutoModerationRuleUpdate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
|
@ -42,14 +43,18 @@ impl UpdateMessage<AutoModerationRule> for AutoModerationRuleUpdate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for AutoModerationRuleUpdate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#auto-moderation-rule-delete>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#auto-moderation-rule-delete>
|
||||||
pub struct AutoModerationRuleDelete {
|
pub struct AutoModerationRuleDelete {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub rule: AutoModerationRule,
|
pub rule: AutoModerationRule,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for AutoModerationRuleDelete {}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#auto-moderation-action-execution>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#auto-moderation-action-execution>
|
||||||
pub struct AutoModerationActionExecution {
|
pub struct AutoModerationActionExecution {
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
|
@ -64,3 +69,5 @@ pub struct AutoModerationActionExecution {
|
||||||
pub matched_keyword: Option<String>,
|
pub matched_keyword: Option<String>,
|
||||||
pub matched_content: Option<String>,
|
pub matched_content: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for AutoModerationActionExecution {}
|
||||||
|
|
|
@ -5,9 +5,8 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::types::{Snowflake, VoiceState, WebSocketEvent};
|
use crate::types::{Snowflake, VoiceState, WebSocketEvent};
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// Officially Undocumented;
|
/// Officially Undocumented;
|
||||||
/// Is sent to a client by the server to signify a new call being created;
|
/// Is sent to a client by the server to signify a new call being created;
|
||||||
///
|
///
|
||||||
|
@ -24,7 +23,9 @@ pub struct CallCreate {
|
||||||
pub channel_id: Snowflake,
|
pub channel_id: Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq, WebSocketEvent)]
|
impl WebSocketEvent for CallCreate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)]
|
||||||
/// Officially Undocumented;
|
/// Officially Undocumented;
|
||||||
/// Updates the client on which calls are ringing, along with a specific call?;
|
/// Updates the client on which calls are ringing, along with a specific call?;
|
||||||
///
|
///
|
||||||
|
@ -39,7 +40,9 @@ pub struct CallUpdate {
|
||||||
pub channel_id: Snowflake,
|
pub channel_id: Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq, WebSocketEvent)]
|
impl WebSocketEvent for CallUpdate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)]
|
||||||
/// Officially Undocumented;
|
/// Officially Undocumented;
|
||||||
/// Deletes a ringing call;
|
/// Deletes a ringing call;
|
||||||
/// Ex: {"t":"CALL_DELETE","s":8,"op":0,"d":{"channel_id":"837609115475771392"}}
|
/// Ex: {"t":"CALL_DELETE","s":8,"op":0,"d":{"channel_id":"837609115475771392"}}
|
||||||
|
@ -47,7 +50,9 @@ pub struct CallDelete {
|
||||||
pub channel_id: Snowflake,
|
pub channel_id: Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq, WebSocketEvent)]
|
impl WebSocketEvent for CallDelete {}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)]
|
||||||
/// Officially Undocumented;
|
/// Officially Undocumented;
|
||||||
/// See <https://unofficial-discord-docs.vercel.app/gateway/op13>;
|
/// See <https://unofficial-discord-docs.vercel.app/gateway/op13>;
|
||||||
///
|
///
|
||||||
|
@ -56,3 +61,4 @@ pub struct CallSync {
|
||||||
pub channel_id: Snowflake,
|
pub channel_id: Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for CallSync {}
|
||||||
|
|
|
@ -18,7 +18,7 @@ use crate::gateway::Shared;
|
||||||
#[cfg(feature = "client")]
|
#[cfg(feature = "client")]
|
||||||
use crate::types::Guild;
|
use crate::types::Guild;
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#channel-pins-update>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#channel-pins-update>
|
||||||
pub struct ChannelPinsUpdate {
|
pub struct ChannelPinsUpdate {
|
||||||
pub guild_id: Option<Snowflake>,
|
pub guild_id: Option<Snowflake>,
|
||||||
|
@ -26,7 +26,9 @@ pub struct ChannelPinsUpdate {
|
||||||
pub last_pin_timestamp: Option<DateTime<Utc>>,
|
pub last_pin_timestamp: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, JsonField, SourceUrlField, WebSocketEvent)]
|
impl WebSocketEvent for ChannelPinsUpdate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, JsonField, SourceUrlField)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#channel-create>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#channel-create>
|
||||||
pub struct ChannelCreate {
|
pub struct ChannelCreate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
|
@ -37,6 +39,8 @@ pub struct ChannelCreate {
|
||||||
pub source_url: String,
|
pub source_url: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for ChannelCreate {}
|
||||||
|
|
||||||
#[cfg(feature = "client")]
|
#[cfg(feature = "client")]
|
||||||
impl UpdateMessage<Guild> for ChannelCreate {
|
impl UpdateMessage<Guild> for ChannelCreate {
|
||||||
#[cfg(not(tarpaulin_include))]
|
#[cfg(not(tarpaulin_include))]
|
||||||
|
@ -55,7 +59,7 @@ impl UpdateMessage<Guild> for ChannelCreate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, JsonField, SourceUrlField, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, JsonField, SourceUrlField)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#channel-update>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#channel-update>
|
||||||
pub struct ChannelUpdate {
|
pub struct ChannelUpdate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
|
@ -66,6 +70,8 @@ pub struct ChannelUpdate {
|
||||||
pub source_url: String,
|
pub source_url: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for ChannelUpdate {}
|
||||||
|
|
||||||
#[cfg(feature = "client")]
|
#[cfg(feature = "client")]
|
||||||
impl UpdateMessage<Channel> for ChannelUpdate {
|
impl UpdateMessage<Channel> for ChannelUpdate {
|
||||||
fn update(&mut self, object_to_update: Shared<Channel>) {
|
fn update(&mut self, object_to_update: Shared<Channel>) {
|
||||||
|
@ -79,7 +85,7 @@ impl UpdateMessage<Channel> for ChannelUpdate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// Officially undocumented.
|
/// Officially undocumented.
|
||||||
/// Sends updates to client about a new message with its id
|
/// Sends updates to client about a new message with its id
|
||||||
/// {"channel_unread_updates": [{"id": "816412869766938648", "last_message_id": "1085892012085104680"}}
|
/// {"channel_unread_updates": [{"id": "816412869766938648", "last_message_id": "1085892012085104680"}}
|
||||||
|
@ -97,7 +103,9 @@ pub struct ChannelUnreadUpdateObject {
|
||||||
pub last_pin_timestamp: Option<String>,
|
pub last_pin_timestamp: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, JsonField, SourceUrlField, WebSocketEvent)]
|
impl WebSocketEvent for ChannelUnreadUpdate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, JsonField, SourceUrlField)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#channel-delete>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#channel-delete>
|
||||||
pub struct ChannelDelete {
|
pub struct ChannelDelete {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
|
@ -132,3 +140,4 @@ impl UpdateMessage<Guild> for ChannelDelete {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for ChannelDelete {}
|
||||||
|
|
|
@ -20,7 +20,7 @@ use super::UpdateMessage;
|
||||||
#[cfg(feature = "client")]
|
#[cfg(feature = "client")]
|
||||||
use crate::gateway::Shared;
|
use crate::gateway::Shared;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, SourceUrlField, JsonField, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone, SourceUrlField, JsonField)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-create>;
|
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-create>;
|
||||||
/// Received to give data about a guild;
|
/// 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
|
// This one is particularly painful, it can be a Guild object with an extra field or an unavailable guild object
|
||||||
|
@ -60,7 +60,9 @@ impl Default for GuildCreateDataOption {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GuildCreate {}
|
||||||
|
|
||||||
|
#[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;
|
/// Received to give info about a user being banned from a guild;
|
||||||
pub struct GuildBanAdd {
|
pub struct GuildBanAdd {
|
||||||
|
@ -68,7 +70,9 @@ pub struct GuildBanAdd {
|
||||||
pub user: PublicUser,
|
pub user: PublicUser,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GuildBanAdd {}
|
||||||
|
|
||||||
|
#[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;
|
/// Received to give info about a user being unbanned from a guild;
|
||||||
pub struct GuildBanRemove {
|
pub struct GuildBanRemove {
|
||||||
|
@ -76,7 +80,9 @@ pub struct GuildBanRemove {
|
||||||
pub user: PublicUser,
|
pub user: PublicUser,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, SourceUrlField, JsonField, WebSocketEvent)]
|
impl WebSocketEvent for GuildBanRemove {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, SourceUrlField, JsonField)]
|
||||||
/// 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;
|
/// Received to give info about a guild being updated;
|
||||||
pub struct GuildUpdate {
|
pub struct GuildUpdate {
|
||||||
|
@ -88,6 +94,8 @@ pub struct GuildUpdate {
|
||||||
pub json: String,
|
pub json: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for GuildUpdate {}
|
||||||
|
|
||||||
#[cfg(feature = "client")]
|
#[cfg(feature = "client")]
|
||||||
impl UpdateMessage<Guild> for GuildUpdate {
|
impl UpdateMessage<Guild> for GuildUpdate {
|
||||||
#[cfg(not(tarpaulin_include))]
|
#[cfg(not(tarpaulin_include))]
|
||||||
|
@ -96,7 +104,7 @@ impl UpdateMessage<Guild> for GuildUpdate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, SourceUrlField, JsonField, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, SourceUrlField, JsonField)]
|
||||||
/// 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;
|
/// Received to tell the client about a guild being deleted;
|
||||||
pub struct GuildDelete {
|
pub struct GuildDelete {
|
||||||
|
@ -117,7 +125,9 @@ impl UpdateMessage<Guild> for GuildDelete {
|
||||||
fn update(&mut self, _: Shared<Guild>) {}
|
fn update(&mut self, _: Shared<Guild>) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GuildDelete {}
|
||||||
|
|
||||||
|
#[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;
|
/// Received to the client about an audit log entry being added;
|
||||||
pub struct GuildAuditLogEntryCreate {
|
pub struct GuildAuditLogEntryCreate {
|
||||||
|
@ -125,7 +135,9 @@ pub struct GuildAuditLogEntryCreate {
|
||||||
pub entry: AuditLogEntry,
|
pub entry: AuditLogEntry,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GuildAuditLogEntryCreate {}
|
||||||
|
|
||||||
|
#[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;
|
/// Received to tell the client about a change to a guild's emoji list;
|
||||||
pub struct GuildEmojisUpdate {
|
pub struct GuildEmojisUpdate {
|
||||||
|
@ -133,7 +145,9 @@ pub struct GuildEmojisUpdate {
|
||||||
pub emojis: Vec<Emoji>,
|
pub emojis: Vec<Emoji>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GuildEmojisUpdate {}
|
||||||
|
|
||||||
|
#[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;
|
/// Received to tell the client about a change to a guild's sticker list;
|
||||||
pub struct GuildStickersUpdate {
|
pub struct GuildStickersUpdate {
|
||||||
|
@ -141,13 +155,17 @@ pub struct GuildStickersUpdate {
|
||||||
pub stickers: Vec<Sticker>,
|
pub stickers: Vec<Sticker>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GuildStickersUpdate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-integrations-update>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-integrations-update>
|
||||||
pub struct GuildIntegrationsUpdate {
|
pub struct GuildIntegrationsUpdate {
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GuildIntegrationsUpdate {}
|
||||||
|
|
||||||
|
#[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;
|
/// Received to tell the client about a user joining a guild;
|
||||||
pub struct GuildMemberAdd {
|
pub struct GuildMemberAdd {
|
||||||
|
@ -156,7 +174,9 @@ pub struct GuildMemberAdd {
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GuildMemberAdd {}
|
||||||
|
|
||||||
|
#[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;
|
/// Received to tell the client about a user leaving a guild;
|
||||||
pub struct GuildMemberRemove {
|
pub struct GuildMemberRemove {
|
||||||
|
@ -164,7 +184,9 @@ pub struct GuildMemberRemove {
|
||||||
pub user: PublicUser,
|
pub user: PublicUser,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GuildMemberRemove {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-member-update>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-member-update>
|
||||||
pub struct GuildMemberUpdate {
|
pub struct GuildMemberUpdate {
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
|
@ -180,7 +202,9 @@ pub struct GuildMemberUpdate {
|
||||||
pub communication_disabled_until: Option<DateTime<Utc>>,
|
pub communication_disabled_until: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GuildMemberUpdate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-members-chunk>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-members-chunk>
|
||||||
pub struct GuildMembersChunk {
|
pub struct GuildMembersChunk {
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
|
@ -192,7 +216,9 @@ pub struct GuildMembersChunk {
|
||||||
pub nonce: Option<String>,
|
pub nonce: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, JsonField, SourceUrlField, WebSocketEvent)]
|
impl WebSocketEvent for GuildMembersChunk {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, JsonField, SourceUrlField)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-role-create>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-role-create>
|
||||||
pub struct GuildRoleCreate {
|
pub struct GuildRoleCreate {
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
|
@ -203,6 +229,8 @@ pub struct GuildRoleCreate {
|
||||||
pub source_url: String,
|
pub source_url: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for GuildRoleCreate {}
|
||||||
|
|
||||||
#[cfg(feature = "client")]
|
#[cfg(feature = "client")]
|
||||||
impl UpdateMessage<Guild> for GuildRoleCreate {
|
impl UpdateMessage<Guild> for GuildRoleCreate {
|
||||||
#[cfg(not(tarpaulin_include))]
|
#[cfg(not(tarpaulin_include))]
|
||||||
|
@ -224,7 +252,7 @@ impl UpdateMessage<Guild> for GuildRoleCreate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, JsonField, SourceUrlField, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, JsonField, SourceUrlField)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-role-update>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-role-update>
|
||||||
pub struct GuildRoleUpdate {
|
pub struct GuildRoleUpdate {
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
|
@ -235,6 +263,8 @@ pub struct GuildRoleUpdate {
|
||||||
pub source_url: String,
|
pub source_url: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for GuildRoleUpdate {}
|
||||||
|
|
||||||
#[cfg(feature = "client")]
|
#[cfg(feature = "client")]
|
||||||
impl UpdateMessage<RoleObject> for GuildRoleUpdate {
|
impl UpdateMessage<RoleObject> for GuildRoleUpdate {
|
||||||
#[cfg(not(tarpaulin_include))]
|
#[cfg(not(tarpaulin_include))]
|
||||||
|
@ -248,35 +278,43 @@ impl UpdateMessage<RoleObject> for GuildRoleUpdate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-role-delete>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-role-delete>
|
||||||
pub struct GuildRoleDelete {
|
pub struct GuildRoleDelete {
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
pub role_id: Snowflake,
|
pub role_id: Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GuildRoleDelete {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-create>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-create>
|
||||||
pub struct GuildScheduledEventCreate {
|
pub struct GuildScheduledEventCreate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub event: GuildScheduledEvent,
|
pub event: GuildScheduledEvent,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GuildScheduledEventCreate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-update>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-update>
|
||||||
pub struct GuildScheduledEventUpdate {
|
pub struct GuildScheduledEventUpdate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub event: GuildScheduledEvent,
|
pub event: GuildScheduledEvent,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GuildScheduledEventUpdate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-delete>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-delete>
|
||||||
pub struct GuildScheduledEventDelete {
|
pub struct GuildScheduledEventDelete {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub event: GuildScheduledEvent,
|
pub event: GuildScheduledEvent,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GuildScheduledEventDelete {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-user-add>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-user-add>
|
||||||
pub struct GuildScheduledEventUserAdd {
|
pub struct GuildScheduledEventUserAdd {
|
||||||
pub guild_scheduled_event_id: Snowflake,
|
pub guild_scheduled_event_id: Snowflake,
|
||||||
|
@ -284,10 +322,14 @@ pub struct GuildScheduledEventUserAdd {
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GuildScheduledEventUserAdd {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-user-remove>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-user-remove>
|
||||||
pub struct GuildScheduledEventUserRemove {
|
pub struct GuildScheduledEventUserRemove {
|
||||||
pub guild_scheduled_event_id: Snowflake,
|
pub guild_scheduled_event_id: Snowflake,
|
||||||
pub user_id: Snowflake,
|
pub user_id: Snowflake,
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for GuildScheduledEventUserRemove {}
|
||||||
|
|
|
@ -5,14 +5,17 @@
|
||||||
use crate::types::events::WebSocketEvent;
|
use crate::types::events::WebSocketEvent;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize)]
|
||||||
pub struct GatewayHeartbeat {
|
pub struct GatewayHeartbeat {
|
||||||
pub op: u8,
|
pub op: u8,
|
||||||
pub d: Option<u64>,
|
pub d: Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GatewayHeartbeat {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
pub struct GatewayHeartbeatAck {
|
pub struct GatewayHeartbeatAck {
|
||||||
pub op: i32,
|
pub op: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for GatewayHeartbeatAck {}
|
||||||
|
|
|
@ -3,20 +3,22 @@
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
use crate::types::WebSocketEvent;
|
use crate::types::WebSocketEvent;
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Received on gateway init, tells the client how often to send heartbeats;
|
/// Received on gateway init, tells the client how often to send heartbeats;
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
pub struct GatewayHello {
|
pub struct GatewayHello {
|
||||||
pub op: i32,
|
pub op: i32,
|
||||||
pub d: HelloData,
|
pub d: HelloData,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq, Copy, WebSocketEvent)]
|
impl WebSocketEvent for GatewayHello {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq, Copy)]
|
||||||
/// Contains info on how often the client should send heartbeats to the server;
|
/// 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
|
/// How often a client should send heartbeats, in milliseconds
|
||||||
pub heartbeat_interval: u64,
|
pub heartbeat_interval: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for HelloData {}
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::types::events::{PresenceUpdate, WebSocketEvent};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::serde_as;
|
use serde_with::serde_as;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
|
||||||
pub struct GatewayIdentifyPayload {
|
pub struct GatewayIdentifyPayload {
|
||||||
pub token: String,
|
pub token: String,
|
||||||
pub properties: GatewayIdentifyConnectionProps,
|
pub properties: GatewayIdentifyConnectionProps,
|
||||||
|
@ -70,7 +70,9 @@ impl GatewayIdentifyPayload {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq, WebSocketEvent)]
|
impl WebSocketEvent for GatewayIdentifyPayload {}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
#[serde_as]
|
#[serde_as]
|
||||||
pub struct GatewayIdentifyConnectionProps {
|
pub struct GatewayIdentifyConnectionProps {
|
||||||
/// Almost always sent
|
/// Almost always sent
|
||||||
|
|
|
@ -5,9 +5,8 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::types::{Integration, Snowflake, WebSocketEvent};
|
use crate::types::{Integration, Snowflake, WebSocketEvent};
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#integration-create>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#integration-create>
|
||||||
pub struct IntegrationCreate {
|
pub struct IntegrationCreate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
|
@ -15,7 +14,9 @@ pub struct IntegrationCreate {
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for IntegrationCreate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#integration-update>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#integration-update>
|
||||||
pub struct IntegrationUpdate {
|
pub struct IntegrationUpdate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
|
@ -23,7 +24,9 @@ pub struct IntegrationUpdate {
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for IntegrationUpdate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#integration-delete>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#integration-delete>
|
||||||
pub struct IntegrationDelete {
|
pub struct IntegrationDelete {
|
||||||
pub id: Snowflake,
|
pub id: Snowflake,
|
||||||
|
@ -31,3 +34,4 @@ pub struct IntegrationDelete {
|
||||||
pub application_id: Option<Snowflake>,
|
pub application_id: Option<Snowflake>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for IntegrationDelete {}
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::types::{Interaction, WebSocketEvent};
|
use crate::types::{Interaction, WebSocketEvent};
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#interaction-create>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#interaction-create>
|
||||||
pub struct InteractionCreate {
|
pub struct InteractionCreate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub interaction: Interaction,
|
pub interaction: Interaction,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for InteractionCreate {}
|
||||||
|
|
|
@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::WebSocketEvent;
|
use super::WebSocketEvent;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// Your session is now invalid.
|
/// Your session is now invalid.
|
||||||
///
|
///
|
||||||
/// Either reauthenticate and reidentify or resume if possible.
|
/// Either reauthenticate and reidentify or resume if possible.
|
||||||
|
@ -14,3 +14,4 @@ pub struct GatewayInvalidSession {
|
||||||
pub resumable: bool,
|
pub resumable: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for GatewayInvalidSession {}
|
||||||
|
|
|
@ -5,16 +5,17 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::types::{GuildInvite, Snowflake, WebSocketEvent};
|
use crate::types::{GuildInvite, Snowflake, WebSocketEvent};
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#invite-create>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#invite-create>
|
||||||
pub struct InviteCreate {
|
pub struct InviteCreate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub invite: GuildInvite,
|
pub invite: GuildInvite,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for InviteCreate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#invite-delete>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#invite-delete>
|
||||||
pub struct InviteDelete {
|
pub struct InviteDelete {
|
||||||
pub channel_id: Snowflake,
|
pub channel_id: Snowflake,
|
||||||
|
@ -22,3 +23,4 @@ pub struct InviteDelete {
|
||||||
pub code: String,
|
pub code: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for InviteDelete {}
|
||||||
|
|
|
@ -7,9 +7,10 @@ use std::collections::HashMap;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::types::Snowflake;
|
use crate::types::Snowflake;
|
||||||
|
|
||||||
use super::WebSocketEvent;
|
use super::WebSocketEvent;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// Officially Undocumented
|
/// Officially Undocumented
|
||||||
///
|
///
|
||||||
/// Sent to the server to signify lazy loading of a guild;
|
/// Sent to the server to signify lazy loading of a guild;
|
||||||
|
@ -30,3 +31,4 @@ pub struct LazyRequest {
|
||||||
pub channels: Option<HashMap<String, Vec<Vec<u64>>>>,
|
pub channels: Option<HashMap<String, Vec<Vec<u64>>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for LazyRequest {}
|
||||||
|
|
|
@ -6,12 +6,12 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::types::{
|
use crate::types::{
|
||||||
entities::{Emoji, GuildMember, Message, PublicUser},
|
entities::{Emoji, GuildMember, Message, PublicUser},
|
||||||
Snowflake, WebSocketEvent
|
Snowflake,
|
||||||
};
|
};
|
||||||
|
|
||||||
use chorus_macros::WebSocketEvent;
|
use super::WebSocketEvent;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#typing-start>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#typing-start>
|
||||||
pub struct TypingStartEvent {
|
pub struct TypingStartEvent {
|
||||||
|
@ -22,7 +22,9 @@ pub struct TypingStartEvent {
|
||||||
pub member: Option<GuildMember>,
|
pub member: Option<GuildMember>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for TypingStartEvent {}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#message-create>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#message-create>
|
||||||
pub struct MessageCreate {
|
pub struct MessageCreate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
|
@ -32,7 +34,7 @@ pub struct MessageCreate {
|
||||||
pub mentions: Option<Vec<MessageCreateUser>>,
|
pub mentions: Option<Vec<MessageCreateUser>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Default, Clone, WebSocketEvent)]
|
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#message-create-message-create-extra-fields>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#message-create-message-create-extra-fields>
|
||||||
pub struct MessageCreateUser {
|
pub struct MessageCreateUser {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
|
@ -40,7 +42,9 @@ pub struct MessageCreateUser {
|
||||||
pub member: Option<GuildMember>,
|
pub member: Option<GuildMember>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for MessageCreate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#message-update>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#message-update>
|
||||||
pub struct MessageUpdate {
|
pub struct MessageUpdate {
|
||||||
|
@ -51,7 +55,9 @@ pub struct MessageUpdate {
|
||||||
pub mentions: Option<Vec<MessageCreateUser>>,
|
pub mentions: Option<Vec<MessageCreateUser>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for MessageUpdate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#message-delete>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#message-delete>
|
||||||
pub struct MessageDelete {
|
pub struct MessageDelete {
|
||||||
|
@ -60,7 +66,9 @@ pub struct MessageDelete {
|
||||||
pub guild_id: Option<Snowflake>,
|
pub guild_id: Option<Snowflake>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for MessageDelete {}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#message-delete-bulk>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#message-delete-bulk>
|
||||||
pub struct MessageDeleteBulk {
|
pub struct MessageDeleteBulk {
|
||||||
|
@ -69,7 +77,9 @@ pub struct MessageDeleteBulk {
|
||||||
pub guild_id: Option<Snowflake>,
|
pub guild_id: Option<Snowflake>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for MessageDeleteBulk {}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#message-reaction-add>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#message-reaction-add>
|
||||||
pub struct MessageReactionAdd {
|
pub struct MessageReactionAdd {
|
||||||
|
@ -81,7 +91,9 @@ pub struct MessageReactionAdd {
|
||||||
pub emoji: Emoji,
|
pub emoji: Emoji,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for MessageReactionAdd {}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#message-reaction-remove>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#message-reaction-remove>
|
||||||
pub struct MessageReactionRemove {
|
pub struct MessageReactionRemove {
|
||||||
|
@ -92,7 +104,9 @@ pub struct MessageReactionRemove {
|
||||||
pub emoji: Emoji,
|
pub emoji: Emoji,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for MessageReactionRemove {}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#message-reaction-remove-all>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#message-reaction-remove-all>
|
||||||
pub struct MessageReactionRemoveAll {
|
pub struct MessageReactionRemoveAll {
|
||||||
|
@ -101,7 +115,9 @@ pub struct MessageReactionRemoveAll {
|
||||||
pub guild_id: Option<Snowflake>,
|
pub guild_id: Option<Snowflake>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for MessageReactionRemoveAll {}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#message-reaction-remove-emoji>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#message-reaction-remove-emoji>
|
||||||
pub struct MessageReactionRemoveEmoji {
|
pub struct MessageReactionRemoveEmoji {
|
||||||
|
@ -111,7 +127,9 @@ pub struct MessageReactionRemoveEmoji {
|
||||||
pub emoji: Emoji,
|
pub emoji: Emoji,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for MessageReactionRemoveEmoji {}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// Officially Undocumented
|
/// Officially Undocumented
|
||||||
///
|
///
|
||||||
/// Not documented anywhere unofficially
|
/// Not documented anywhere unofficially
|
||||||
|
@ -132,3 +150,4 @@ pub struct MessageACK {
|
||||||
pub channel_id: Snowflake,
|
pub channel_id: Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for MessageACK {}
|
||||||
|
|
|
@ -33,8 +33,6 @@ pub use voice::*;
|
||||||
pub use voice_gateway::*;
|
pub use voice_gateway::*;
|
||||||
pub use webhooks::*;
|
pub use webhooks::*;
|
||||||
|
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
|
|
||||||
#[cfg(feature = "client")]
|
#[cfg(feature = "client")]
|
||||||
use super::Snowflake;
|
use super::Snowflake;
|
||||||
|
|
||||||
|
@ -86,7 +84,7 @@ mod voice_gateway;
|
||||||
|
|
||||||
pub trait WebSocketEvent: Send + Sync + Debug {}
|
pub trait WebSocketEvent: Send + Sync + Debug {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Serialize, Clone, WebSocketEvent)]
|
#[derive(Debug, Default, Serialize, Clone)]
|
||||||
/// The payload used for sending events to the gateway
|
/// The payload used for sending events to the gateway
|
||||||
///
|
///
|
||||||
/// Similar to [GatewayReceivePayload], except we send a [serde_json::value::Value] for d whilst we receive a [serde_json::value::RawValue]
|
/// Similar to [GatewayReceivePayload], except we send a [serde_json::value::Value] for d whilst we receive a [serde_json::value::RawValue]
|
||||||
|
@ -104,6 +102,8 @@ pub struct GatewaySendPayload {
|
||||||
pub sequence_number: Option<u64>,
|
pub sequence_number: Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for GatewaySendPayload {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Clone)]
|
#[derive(Debug, Default, Deserialize, Clone)]
|
||||||
/// The payload used for receiving events from the gateway
|
/// The payload used for receiving events from the gateway
|
||||||
pub struct GatewayReceivePayload<'a> {
|
pub struct GatewayReceivePayload<'a> {
|
||||||
|
|
|
@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{ChannelUnreadUpdateObject, WebSocketEvent};
|
use super::{ChannelUnreadUpdateObject, WebSocketEvent};
|
||||||
use crate::types::{GuildMember, Snowflake, VoiceState};
|
use crate::types::{GuildMember, Snowflake, VoiceState};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default)]
|
||||||
/// Officially Undocumented
|
/// Officially Undocumented
|
||||||
///
|
///
|
||||||
/// Seems to be passively set to update the client on guild details (though, why not just send the update events?)
|
/// Seems to be passively set to update the client on guild details (though, why not just send the update events?)
|
||||||
|
@ -18,3 +18,4 @@ pub struct PassiveUpdateV1 {
|
||||||
pub channels: Vec<ChannelUnreadUpdateObject>,
|
pub channels: Vec<ChannelUnreadUpdateObject>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for PassiveUpdateV1 {}
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::types::{events::WebSocketEvent, UserStatus};
|
||||||
use crate::types::{Activity, ClientStatusObject, PublicUser, Snowflake};
|
use crate::types::{Activity, ClientStatusObject, PublicUser, Snowflake};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// Sent by the client to update its status and presence;
|
/// Sent by the client to update its status and presence;
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#update-presence>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#update-presence>
|
||||||
pub struct UpdatePresence {
|
pub struct UpdatePresence {
|
||||||
|
@ -18,7 +18,7 @@ pub struct UpdatePresence {
|
||||||
pub afk: bool,
|
pub afk: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq)]
|
||||||
/// Received to tell the client that a user updated their presence / status
|
/// 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>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#presence-update-presence-update-event-fields>
|
||||||
pub struct PresenceUpdate {
|
pub struct PresenceUpdate {
|
||||||
|
@ -30,3 +30,4 @@ pub struct PresenceUpdate {
|
||||||
pub client_status: ClientStatusObject,
|
pub client_status: ClientStatusObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for PresenceUpdate {}
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::types::events::{Session, WebSocketEvent};
|
||||||
use crate::types::interfaces::ClientStatusObject;
|
use crate::types::interfaces::ClientStatusObject;
|
||||||
use crate::types::{Activity, GuildMember, PresenceUpdate, VoiceState};
|
use crate::types::{Activity, GuildMember, PresenceUpdate, VoiceState};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// 1/2 half documented;
|
/// 1/2 half documented;
|
||||||
/// Received after identifying, provides initial user info;
|
/// Received after identifying, provides initial user info;
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#ready;>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#ready;>
|
||||||
|
@ -30,7 +30,9 @@ pub struct GatewayReady {
|
||||||
pub shard: Option<(u64, u64)>,
|
pub shard: Option<(u64, u64)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for GatewayReady {}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// Officially Undocumented;
|
/// Officially Undocumented;
|
||||||
/// Sent after the READY event when a client is a user, seems to somehow add onto the ready event;
|
/// Sent after the READY event when a client is a user, seems to somehow add onto the ready event;
|
||||||
pub struct GatewayReadySupplemental {
|
pub struct GatewayReadySupplemental {
|
||||||
|
@ -43,6 +45,8 @@ pub struct GatewayReadySupplemental {
|
||||||
pub disclose: Vec<String>,
|
pub disclose: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for GatewayReadySupplemental {}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
pub struct MergedPresences {
|
pub struct MergedPresences {
|
||||||
pub guilds: Vec<Vec<MergedPresenceGuild>>,
|
pub guilds: Vec<Vec<MergedPresenceGuild>>,
|
||||||
|
|
|
@ -2,10 +2,11 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::WebSocketEvent;
|
use super::WebSocketEvent;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// "The reconnect event is dispatched when a client should reconnect to the Gateway (and resume their existing session, if they have one). This event usually occurs during deploys to migrate sessions gracefully off old hosts"
|
/// "The reconnect event is dispatched when a client should reconnect to the Gateway (and resume their existing session, if they have one). This event usually occurs during deploys to migrate sessions gracefully off old hosts"
|
||||||
///
|
///
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://docs.discord.sex/topics/gateway-events#reconnect>
|
/// See <https://docs.discord.sex/topics/gateway-events#reconnect>
|
||||||
pub struct GatewayReconnect {}
|
pub struct GatewayReconnect {}
|
||||||
|
|
||||||
|
impl WebSocketEvent for GatewayReconnect {}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
use crate::types::{events::WebSocketEvent, Relationship, RelationshipType, Snowflake};
|
use crate::types::{events::WebSocketEvent, Relationship, RelationshipType, Snowflake};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default)]
|
||||||
/// See <https://github.com/spacebarchat/server/issues/204>
|
/// See <https://github.com/spacebarchat/server/issues/204>
|
||||||
pub struct RelationshipAdd {
|
pub struct RelationshipAdd {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
|
@ -13,7 +13,9 @@ pub struct RelationshipAdd {
|
||||||
pub should_notify: bool,
|
pub should_notify: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for RelationshipAdd {}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// See <https://github.com/spacebarchat/server/issues/203>
|
/// See <https://github.com/spacebarchat/server/issues/203>
|
||||||
pub struct RelationshipRemove {
|
pub struct RelationshipRemove {
|
||||||
pub id: Snowflake,
|
pub id: Snowflake,
|
||||||
|
@ -21,3 +23,4 @@ pub struct RelationshipRemove {
|
||||||
pub relationship_type: RelationshipType,
|
pub relationship_type: RelationshipType,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for RelationshipRemove {}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
use crate::types::{events::WebSocketEvent, Snowflake};
|
use crate::types::{events::WebSocketEvent, Snowflake};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#request-guild-members-request-guild-members-structure>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#request-guild-members-request-guild-members-structure>
|
||||||
pub struct GatewayRequestGuildMembers {
|
pub struct GatewayRequestGuildMembers {
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
|
@ -17,3 +17,4 @@ pub struct GatewayRequestGuildMembers {
|
||||||
pub nonce: Option<String>,
|
pub nonce: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for GatewayRequestGuildMembers {}
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
use crate::types::events::WebSocketEvent;
|
use crate::types::events::WebSocketEvent;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, Default, WebSocketEvent)]
|
#[derive(Debug, Clone, Deserialize, Serialize, Default)]
|
||||||
pub struct GatewayResume {
|
pub struct GatewayResume {
|
||||||
pub token: String,
|
pub token: String,
|
||||||
pub session_id: String,
|
pub session_id: String,
|
||||||
pub seq: String,
|
pub seq: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for GatewayResume {}
|
||||||
|
|
|
@ -2,12 +2,11 @@
|
||||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::types::{Activity, WebSocketEvent};
|
use crate::types::{Activity, WebSocketEvent};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// Officially Undocumented
|
/// Officially Undocumented
|
||||||
/// Seems like it sends active session info to users on connect
|
/// Seems like it sends active session info to users on connect
|
||||||
/// [{"activities":[],"client_info":{"client":"web","os":"other","version":0},"session_id":"ab5941b50d818b1f8d93b4b1b581b192","status":"online"}]
|
/// [{"activities":[],"client_info":{"client":"web","os":"other","version":0},"session_id":"ab5941b50d818b1f8d93b4b1b581b192","status":"online"}]
|
||||||
|
@ -34,3 +33,4 @@ pub struct ClientInfo {
|
||||||
pub version: u8,
|
pub version: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for SessionsReplace {}
|
||||||
|
|
|
@ -5,26 +5,30 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::types::{StageInstance, WebSocketEvent};
|
use crate::types::{StageInstance, WebSocketEvent};
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#stage-instance-create>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#stage-instance-create>
|
||||||
pub struct StageInstanceCreate {
|
pub struct StageInstanceCreate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub stage_instance: StageInstance,
|
pub stage_instance: StageInstance,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for StageInstanceCreate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#stage-instance-update>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#stage-instance-update>
|
||||||
pub struct StageInstanceUpdate {
|
pub struct StageInstanceUpdate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub stage_instance: StageInstance,
|
pub stage_instance: StageInstance,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for StageInstanceUpdate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#stage-instance-delete>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#stage-instance-delete>
|
||||||
pub struct StageInstanceDelete {
|
pub struct StageInstanceDelete {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub stage_instance: StageInstance,
|
pub stage_instance: StageInstance,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for StageInstanceDelete {}
|
||||||
|
|
|
@ -12,14 +12,16 @@ use crate::types::{JsonField, Snowflake, SourceUrlField};
|
||||||
#[cfg(feature = "client")]
|
#[cfg(feature = "client")]
|
||||||
use super::UpdateMessage;
|
use super::UpdateMessage;
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#thread-create>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#thread-create>
|
||||||
pub struct ThreadCreate {
|
pub struct ThreadCreate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub thread: Channel,
|
pub thread: Channel,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, JsonField, SourceUrlField, WebSocketEvent)]
|
impl WebSocketEvent for ThreadCreate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, JsonField, SourceUrlField)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#thread-update>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#thread-update>
|
||||||
pub struct ThreadUpdate {
|
pub struct ThreadUpdate {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
|
@ -30,6 +32,8 @@ pub struct ThreadUpdate {
|
||||||
pub source_url: String,
|
pub source_url: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for ThreadUpdate {}
|
||||||
|
|
||||||
#[cfg(feature = "client")]
|
#[cfg(feature = "client")]
|
||||||
impl UpdateMessage<Channel> for ThreadUpdate {
|
impl UpdateMessage<Channel> for ThreadUpdate {
|
||||||
#[cfg(not(tarpaulin_include))]
|
#[cfg(not(tarpaulin_include))]
|
||||||
|
@ -38,14 +42,16 @@ impl UpdateMessage<Channel> for ThreadUpdate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#thread-delete>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#thread-delete>
|
||||||
pub struct ThreadDelete {
|
pub struct ThreadDelete {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub thread: Channel,
|
pub thread: Channel,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for ThreadDelete {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#thread-list-sync>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#thread-list-sync>
|
||||||
pub struct ThreadListSync {
|
pub struct ThreadListSync {
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
|
@ -54,7 +60,9 @@ pub struct ThreadListSync {
|
||||||
pub members: Option<Vec<ThreadMember>>,
|
pub members: Option<Vec<ThreadMember>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for ThreadListSync {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#thread-member-update>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#thread-member-update>
|
||||||
/// The inner payload is a thread member object with an extra field.
|
/// The inner payload is a thread member object with an extra field.
|
||||||
pub struct ThreadMemberUpdate {
|
pub struct ThreadMemberUpdate {
|
||||||
|
@ -63,7 +71,9 @@ pub struct ThreadMemberUpdate {
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent)]
|
impl WebSocketEvent for ThreadMemberUpdate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#thread-members-update>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#thread-members-update>
|
||||||
pub struct ThreadMembersUpdate {
|
pub struct ThreadMembersUpdate {
|
||||||
pub id: Snowflake,
|
pub id: Snowflake,
|
||||||
|
@ -74,3 +84,4 @@ pub struct ThreadMembersUpdate {
|
||||||
pub removed_members: Option<Vec<Snowflake>>,
|
pub removed_members: Option<Vec<Snowflake>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for ThreadMembersUpdate {}
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::types::entities::PublicUser;
|
||||||
use crate::types::events::WebSocketEvent;
|
use crate::types::events::WebSocketEvent;
|
||||||
use crate::types::utils::Snowflake;
|
use crate::types::utils::Snowflake;
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
/// 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);
|
/// Sent to indicate updates to a user object; (name changes, discriminator changes, etc);
|
||||||
pub struct UserUpdate {
|
pub struct UserUpdate {
|
||||||
|
@ -16,7 +16,9 @@ pub struct UserUpdate {
|
||||||
pub user: PublicUser,
|
pub user: PublicUser,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq, WebSocketEvent)]
|
impl WebSocketEvent for UserUpdate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
/// 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;
|
||||||
|
@ -39,6 +41,8 @@ pub struct UserGuildSettingsUpdate {
|
||||||
pub channel_overrides: Vec<UserGuildSettingsChannelOverride>,
|
pub channel_overrides: Vec<UserGuildSettingsChannelOverride>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for UserGuildSettingsUpdate {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
/// Undocumented;
|
/// Undocumented;
|
||||||
///
|
///
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
use crate::types::{events::WebSocketEvent, Snowflake, VoiceState};
|
use crate::types::{events::WebSocketEvent, Snowflake, VoiceState};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, Copy, PartialEq, Eq, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone, Copy, PartialEq, Eq)]
|
||||||
///
|
///
|
||||||
/// Sent to the server to indicate an update of the voice state (leave voice channel, join voice channel, mute, deafen);
|
/// Sent to the server to indicate an update of the voice state (leave voice channel, join voice channel, mute, deafen);
|
||||||
///
|
///
|
||||||
|
@ -17,7 +17,9 @@ pub struct UpdateVoiceState {
|
||||||
pub self_deaf: bool,
|
pub self_deaf: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
impl WebSocketEvent for UpdateVoiceState {}
|
||||||
|
|
||||||
|
#[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 to indicate an update in a user's voice state (leave voice channel, join voice channel, mute, deafen, etc);
|
/// Received from the server to indicate an update in a user's voice state (leave voice channel, join voice channel, mute, deafen, etc);
|
||||||
|
@ -28,7 +30,9 @@ pub struct VoiceStateUpdate {
|
||||||
pub state: VoiceState,
|
pub state: VoiceState,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq, WebSocketEvent)]
|
impl WebSocketEvent for VoiceStateUpdate {}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)]
|
||||||
/// 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;
|
/// Received to indicate which voice endpoint, token and guild_id to use;
|
||||||
|
@ -41,3 +45,4 @@ pub struct VoiceServerUpdate {
|
||||||
pub endpoint: Option<String>,
|
pub endpoint: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for VoiceServerUpdate {}
|
||||||
|
|
|
@ -3,10 +3,9 @@
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
use crate::types::{Snowflake, WebSocketEvent};
|
use crate::types::{Snowflake, WebSocketEvent};
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Copy, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Copy)]
|
||||||
/// Sent when another user connects to the voice server.
|
/// Sent when another user connects to the voice server.
|
||||||
///
|
///
|
||||||
/// Contains the user id and "flags".
|
/// Contains the user id and "flags".
|
||||||
|
@ -22,7 +21,9 @@ pub struct VoiceClientConnectFlags {
|
||||||
pub flags: Option<u8>,
|
pub flags: Option<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Copy, WebSocketEvent)]
|
impl WebSocketEvent for VoiceClientConnectFlags {}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Copy)]
|
||||||
/// Sent when another user connects to the voice server.
|
/// Sent when another user connects to the voice server.
|
||||||
///
|
///
|
||||||
/// Contains the user id and "platform".
|
/// Contains the user id and "platform".
|
||||||
|
@ -36,3 +37,4 @@ pub struct VoiceClientConnectPlatform {
|
||||||
pub platform: u8,
|
pub platform: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for VoiceClientConnectPlatform {}
|
||||||
|
|
|
@ -3,10 +3,9 @@
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
use crate::types::{Snowflake, WebSocketEvent};
|
use crate::types::{Snowflake, WebSocketEvent};
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Copy, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Copy)]
|
||||||
/// Sent when another user disconnects from the voice server.
|
/// Sent when another user disconnects from the voice server.
|
||||||
///
|
///
|
||||||
/// When received, the SSRC of the user should be discarded.
|
/// When received, the SSRC of the user should be discarded.
|
||||||
|
@ -16,3 +15,4 @@ pub struct VoiceClientDisconnection {
|
||||||
pub user_id: Snowflake,
|
pub user_id: Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for VoiceClientDisconnection {}
|
||||||
|
|
|
@ -3,10 +3,9 @@
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
use crate::types::WebSocketEvent;
|
use crate::types::WebSocketEvent;
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Copy, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Copy)]
|
||||||
/// Contains info on how often the client should send heartbeats to the server;
|
/// Contains info on how often the client should send heartbeats to the server;
|
||||||
///
|
///
|
||||||
/// Differs from the normal hello data in that discord sends heartbeat interval as a float.
|
/// Differs from the normal hello data in that discord sends heartbeat interval as a float.
|
||||||
|
@ -22,3 +21,4 @@ pub struct VoiceHelloData {
|
||||||
pub heartbeat_interval: f64,
|
pub heartbeat_interval: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for VoiceHelloData {}
|
||||||
|
|
|
@ -3,10 +3,9 @@
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
use crate::types::{Snowflake, WebSocketEvent};
|
use crate::types::{Snowflake, WebSocketEvent};
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)]
|
||||||
/// The identify payload for the voice gateway connection;
|
/// The identify payload for the voice gateway connection;
|
||||||
///
|
///
|
||||||
/// Contains authentication info and context to authenticate to the voice gateway.
|
/// Contains authentication info and context to authenticate to the voice gateway.
|
||||||
|
@ -23,3 +22,4 @@ pub struct VoiceIdentify {
|
||||||
// TODO: Add video streams
|
// TODO: Add video streams
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for VoiceIdentify {}
|
||||||
|
|
|
@ -3,10 +3,9 @@
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
use crate::types::WebSocketEvent;
|
use crate::types::WebSocketEvent;
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Copy, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Copy)]
|
||||||
/// What does this do?
|
/// What does this do?
|
||||||
///
|
///
|
||||||
/// {"op":15,"d":{"any":100}}
|
/// {"op":15,"d":{"any":100}}
|
||||||
|
@ -16,3 +15,4 @@ pub struct VoiceMediaSinkWants {
|
||||||
pub any: u16,
|
pub any: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for VoiceMediaSinkWants {}
|
||||||
|
|
|
@ -30,7 +30,7 @@ mod speaking;
|
||||||
mod ssrc_definition;
|
mod ssrc_definition;
|
||||||
mod voice_backend_version;
|
mod voice_backend_version;
|
||||||
|
|
||||||
#[derive(Debug, Default, Serialize, Clone, WebSocketEvent)]
|
#[derive(Debug, Default, Serialize, Clone)]
|
||||||
/// The payload used for sending events to the voice gateway.
|
/// The payload used for sending events to the voice gateway.
|
||||||
///
|
///
|
||||||
/// Similar to [VoiceGatewayReceivePayload], except we send a [Value] for d whilst we receive a [serde_json::value::RawValue]
|
/// Similar to [VoiceGatewayReceivePayload], except we send a [Value] for d whilst we receive a [serde_json::value::RawValue]
|
||||||
|
@ -42,6 +42,8 @@ pub struct VoiceGatewaySendPayload {
|
||||||
pub data: Value,
|
pub data: Value,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for VoiceGatewaySendPayload {}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
/// The payload used for receiving events from the voice gateway.
|
/// The payload used for receiving events from the voice gateway.
|
||||||
///
|
///
|
||||||
|
|
|
@ -5,12 +5,11 @@
|
||||||
use std::net::Ipv4Addr;
|
use std::net::Ipv4Addr;
|
||||||
|
|
||||||
use crate::types::WebSocketEvent;
|
use crate::types::WebSocketEvent;
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::VoiceEncryptionMode;
|
use super::VoiceEncryptionMode;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
/// The voice gateway's ready event;
|
/// The voice gateway's ready event;
|
||||||
///
|
///
|
||||||
/// Gives the user info about the UDP connection IP and port, srrc to use,
|
/// Gives the user info about the UDP connection IP and port, srrc to use,
|
||||||
|
@ -44,3 +43,4 @@ impl Default for VoiceReady {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for VoiceReady {}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
use super::{AudioCodec, VideoCodec, VoiceEncryptionMode};
|
use super::{AudioCodec, VideoCodec, VoiceEncryptionMode};
|
||||||
use crate::types::WebSocketEvent;
|
use crate::types::WebSocketEvent;
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, Default, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
|
||||||
/// Event that describes our encryption mode and secret key for encryption
|
/// Event that describes our encryption mode and secret key for encryption
|
||||||
///
|
///
|
||||||
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#session-description-structure>
|
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#session-description-structure>
|
||||||
|
@ -20,7 +19,9 @@ pub struct SessionDescription {
|
||||||
pub keyframe_interval: Option<u64>,
|
pub keyframe_interval: Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, Default, WebSocketEvent)]
|
impl WebSocketEvent for SessionDescription {}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
|
||||||
/// Event that might be sent to update session parameters
|
/// Event that might be sent to update session parameters
|
||||||
///
|
///
|
||||||
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#session-update-structure>
|
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#session-update-structure>
|
||||||
|
@ -35,3 +36,4 @@ pub struct SessionUpdate {
|
||||||
pub new_media_session_id: Option<String>,
|
pub new_media_session_id: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for SessionUpdate {}
|
||||||
|
|
|
@ -6,14 +6,13 @@ use bitflags::bitflags;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::types::{Snowflake, WebSocketEvent};
|
use crate::types::{Snowflake, WebSocketEvent};
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
|
|
||||||
/// Event that tells the server we are speaking;
|
/// Event that tells the server we are speaking;
|
||||||
///
|
///
|
||||||
/// Essentially, what allows us to send UDP data and lights up the green circle around your avatar.
|
/// Essentially, what allows us to send UDP data and lights up the green circle around your avatar.
|
||||||
///
|
///
|
||||||
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#speaking-structure>
|
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#speaking-structure>
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, Default, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
|
||||||
pub struct Speaking {
|
pub struct Speaking {
|
||||||
/// Data about the audio we're transmitting.
|
/// Data about the audio we're transmitting.
|
||||||
///
|
///
|
||||||
|
@ -28,6 +27,8 @@ pub struct Speaking {
|
||||||
pub delay: u64,
|
pub delay: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for Speaking {}
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
/// Bitflags of speaking types;
|
/// Bitflags of speaking types;
|
||||||
///
|
///
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
use crate::types::{Snowflake, WebSocketEvent};
|
use crate::types::{Snowflake, WebSocketEvent};
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Defines an event which provides ssrcs for voice and video for a user id.
|
/// Defines an event which provides ssrcs for voice and video for a user id.
|
||||||
|
@ -25,7 +24,7 @@ use serde::{Deserialize, Serialize};
|
||||||
/// ```json
|
/// ```json
|
||||||
/// {"op":12,"d":{"audio_ssrc":2307250864,"video_ssrc":0,"rtx_ssrc":0,"streams":[{"type":"video","rid":"100","ssrc":26595,"active":false,"quality":100,"rtx_ssrc":26596,"max_bitrate":2500000,"max_framerate":30,"max_resolution":{"type":"fixed","width":1280,"height":720}}]}}
|
/// {"op":12,"d":{"audio_ssrc":2307250864,"video_ssrc":0,"rtx_ssrc":0,"streams":[{"type":"video","rid":"100","ssrc":26595,"active":false,"quality":100,"rtx_ssrc":26596,"max_bitrate":2500000,"max_framerate":30,"max_resolution":{"type":"fixed","width":1280,"height":720}}]}}
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq, WebSocketEvent)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)]
|
||||||
pub struct SsrcDefinition {
|
pub struct SsrcDefinition {
|
||||||
/// The ssrc used for video communications.
|
/// The ssrc used for video communications.
|
||||||
///
|
///
|
||||||
|
@ -51,3 +50,4 @@ pub struct SsrcDefinition {
|
||||||
pub streams: Vec<String>,
|
pub streams: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for SsrcDefinition {}
|
||||||
|
|
|
@ -3,10 +3,9 @@
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
use crate::types::WebSocketEvent;
|
use crate::types::WebSocketEvent;
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, WebSocketEvent)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq)]
|
||||||
/// Received from the voice gateway server to describe the backend version.
|
/// Received from the voice gateway server to describe the backend version.
|
||||||
///
|
///
|
||||||
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#voice-backend-version>
|
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#voice-backend-version>
|
||||||
|
@ -19,3 +18,4 @@ pub struct VoiceBackendVersion {
|
||||||
pub rtc_worker_version: String,
|
pub rtc_worker_version: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for VoiceBackendVersion {}
|
||||||
|
|
|
@ -4,13 +4,15 @@
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::types::{Snowflake, WebSocketEvent};
|
use crate::types::Snowflake;
|
||||||
use chorus_macros::WebSocketEvent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
|
use super::WebSocketEvent;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
|
||||||
/// See <https://discord.com/developers/docs/topics/gateway-events#webhooks-update>
|
/// See <https://discord.com/developers/docs/topics/gateway-events#webhooks-update>
|
||||||
pub struct WebhooksUpdate {
|
pub struct WebhooksUpdate {
|
||||||
pub guild_id: Snowflake,
|
pub guild_id: Snowflake,
|
||||||
pub channel_id: Snowflake,
|
pub channel_id: Snowflake,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WebSocketEvent for WebhooksUpdate {}
|
||||||
|
|
Loading…
Reference in New Issue