Remove serde(with) for message timestamps
This commit is contained in:
parent
a75701d9c6
commit
eefdd4aebf
|
@ -26,9 +26,9 @@ pub struct Message {
|
|||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub author: Option<PublicUser>,
|
||||
pub content: Option<String>,
|
||||
#[serde(with = "ts_seconds_str")]
|
||||
// #[serde(with = "ts_seconds_str")]
|
||||
pub timestamp: DateTime<Utc>,
|
||||
#[serde(with = "ts_seconds_option_str")]
|
||||
// #[serde(with = "ts_seconds_option_str")]
|
||||
pub edited_timestamp: Option<DateTime<Utc>>,
|
||||
pub tts: Option<bool>,
|
||||
pub mention_everyone: bool,
|
||||
|
@ -255,3 +255,61 @@ pub struct MessageActivity {
|
|||
pub activity_type: i64,
|
||||
pub party_id: Option<String>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn test_deserialize_message() {
|
||||
let raw = r#"{
|
||||
"id":"1246967362553443002",
|
||||
"channel_id":"1246967361836216935",
|
||||
"guild_id":"1246967361001550368",
|
||||
"author":{
|
||||
"username":"integrationtestuser",
|
||||
"discriminator":"3864",
|
||||
"id":"1246967359860699591",
|
||||
"public_flags":0,
|
||||
"avatar":null,
|
||||
"accent_color":null,
|
||||
"banner":null,
|
||||
"bio":"",
|
||||
"bot":false,
|
||||
"premium_since":"2024-06-02T23:23:06.124+00:00",
|
||||
"premium_type":2,
|
||||
"theme_colors":null,
|
||||
"pronouns":null
|
||||
},
|
||||
"member":{
|
||||
"index":142,
|
||||
"id":"1246967359860699591",
|
||||
"guild_id":"1246967361001550368",
|
||||
"nick":null,
|
||||
"joined_at":"2024-06-02T23:23:06.526+00:00",
|
||||
"premium_since":null,"deaf":false,"mute":false,"pending":false,
|
||||
"last_message_id":null,
|
||||
"joined_by":null,
|
||||
"avatar":null,
|
||||
"banner":null,
|
||||
"bio":"",
|
||||
"theme_colors":null,
|
||||
"pronouns":null,
|
||||
"communication_disabled_until":null,
|
||||
"roles":[]
|
||||
},
|
||||
"content":"A Message!",
|
||||
"timestamp":"2024-06-02T23:23:06.762+00:00",
|
||||
"edited_timestamp":null,
|
||||
"tts":false,
|
||||
"mention_everyone":false,
|
||||
"mentions":[],
|
||||
"mention_roles":[],
|
||||
"attachments":[],
|
||||
"embeds":[],
|
||||
"reactions":[],
|
||||
"pinned":false,
|
||||
"type":0,
|
||||
"flags":null
|
||||
}"#;
|
||||
let message: super::Message = serde_json::from_str(raw).unwrap();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue