mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 15:01:45 +01:00
Fix deserialization of VoiceChat{Started,Ended}
messages
This commit is contained in:
parent
a07c9b0431
commit
9ce53a2b02
4 changed files with 18 additions and 2 deletions
|
@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Type of response for `CopyMessage` method ([#141](pr141), [#142](pr142))
|
- Type of response for `CopyMessage` method ([#141](pr141), [#142](pr142))
|
||||||
- Bad request serialization when the `language` field of `MessageEntityKind::Pre` is `None` ([#145](pr145))
|
- Bad request serialization when the `language` field of `MessageEntityKind::Pre` is `None` ([#145](pr145))
|
||||||
- Deserialization of `MediaKind::Venue` ([#147][pr147])
|
- Deserialization of `MediaKind::Venue` ([#147][pr147])
|
||||||
|
- Deserialization of `VoiceChat{Started,Ended}` messages ([#153][pr153])
|
||||||
|
|
||||||
[pr119]: https://github.com/teloxide/teloxide-core/pull/119
|
[pr119]: https://github.com/teloxide/teloxide-core/pull/119
|
||||||
[pr133]: https://github.com/teloxide/teloxide-core/pull/133
|
[pr133]: https://github.com/teloxide/teloxide-core/pull/133
|
||||||
|
@ -62,6 +63,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
[pr143]: https://github.com/teloxide/teloxide-core/pull/143
|
[pr143]: https://github.com/teloxide/teloxide-core/pull/143
|
||||||
[pr145]: https://github.com/teloxide/teloxide-core/pull/145
|
[pr145]: https://github.com/teloxide/teloxide-core/pull/145
|
||||||
[pr147]: https://github.com/teloxide/teloxide-core/pull/147
|
[pr147]: https://github.com/teloxide/teloxide-core/pull/147
|
||||||
|
[pr153]: https://github.com/teloxide/teloxide-core/pull/153
|
||||||
[issue473]: https://github.com/teloxide/teloxide/issues/473
|
[issue473]: https://github.com/teloxide/teloxide/issues/473
|
||||||
[issue427]: https://github.com/teloxide/teloxide/issues/427
|
[issue427]: https://github.com/teloxide/teloxide/issues/427
|
||||||
|
|
||||||
|
|
|
@ -1393,4 +1393,18 @@ mod tests {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Regression test for <https://github.com/teloxide/teloxide/issues/475>
|
||||||
|
#[test]
|
||||||
|
fn issue_475() {
|
||||||
|
let json = r#"{"message_id":198295,"from":{"id":1087968824,"is_bot":true,"first_name":"Group","username":"GroupAnonymousBot"},"sender_chat":{"id":-1001331354980,"title":"C++ Together 2.0","username":"cpptogether","type":"supergroup"},"chat":{"id":-1001331354980,"title":"C++ Together 2.0","username":"cpptogether","type":"supergroup"},"date":1638236631,"voice_chat_started":{}}"#;
|
||||||
|
|
||||||
|
let message: Message = serde_json::from_str(json).unwrap();
|
||||||
|
|
||||||
|
assert!(matches!(message.kind, MessageKind::VoiceChatStarted { .. }));
|
||||||
|
|
||||||
|
// FIXME(waffle): it seems like we are losing `sender_chat` in some
|
||||||
|
// cases inclusing this
|
||||||
|
// assert!(message.sender_chat().is_some());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,4 +3,4 @@ use serde::{Deserialize, Serialize};
|
||||||
/// This object represents a service message about a voice chat ended in the
|
/// This object represents a service message about a voice chat ended in the
|
||||||
/// chat.
|
/// chat.
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct VoiceChatEnded;
|
pub struct VoiceChatEnded {}
|
||||||
|
|
|
@ -3,4 +3,4 @@ use serde::{Deserialize, Serialize};
|
||||||
/// This object represents a service message about a voice chat started in the
|
/// This object represents a service message about a voice chat started in the
|
||||||
/// chat. Currently holds no information.
|
/// chat. Currently holds no information.
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct VoiceChatStarted;
|
pub struct VoiceChatStarted {}
|
||||||
|
|
Loading…
Reference in a new issue