Fix channel.rs

This commit is contained in:
bitfl0wer 2023-08-04 16:41:57 +02:00
parent b9b5e5e463
commit cfb84f3da0
1 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,6 @@
use crate::types::events::WebSocketEvent; use crate::types::events::WebSocketEvent;
use crate::types::{entities::Channel, Snowflake}; use crate::types::{entities::Channel, JsonField, Snowflake};
use chorus_macros::JsonField;
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -24,17 +25,19 @@ pub struct ChannelCreate {
impl WebSocketEvent for ChannelCreate {} impl WebSocketEvent for ChannelCreate {}
#[derive(Debug, Default, Deserialize, Serialize, Clone)] #[derive(Debug, Default, Deserialize, Serialize, Clone, JsonField)]
/// 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)]
pub channel: Channel, pub channel: Channel,
#[serde(skip)]
pub json: String,
} }
impl WebSocketEvent for ChannelUpdate {} impl WebSocketEvent for ChannelUpdate {}
impl UpdateMessage<Channel> for ChannelUpdate { impl UpdateMessage<Channel> for ChannelUpdate {
fn update(&self, object_to_update: &mut Channel) { fn update(&mut self, object_to_update: &mut Channel) {
*object_to_update = self.channel.clone(); *object_to_update = self.channel.clone();
} }
fn id(&self) -> Snowflake { fn id(&self) -> Snowflake {