mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
added field language for MessageEntity
This commit is contained in:
parent
a95bb5b2d9
commit
4d8b2d0473
1 changed files with 20 additions and 1 deletions
|
@ -32,7 +32,7 @@ pub enum MessageEntityKind {
|
|||
Bold,
|
||||
Italic,
|
||||
Code,
|
||||
Pre,
|
||||
Pre { language: Option<String> },
|
||||
TextLink { url: String },
|
||||
TextMention { user: User },
|
||||
Underline,
|
||||
|
@ -72,6 +72,25 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre() {
|
||||
use serde_json::from_str;
|
||||
|
||||
assert_eq!(
|
||||
MessageEntity {
|
||||
kind: MessageEntityKind::Pre {
|
||||
language: Some("rust".to_string()),
|
||||
},
|
||||
offset: 1,
|
||||
length: 2,
|
||||
},
|
||||
from_str::<MessageEntity>(
|
||||
r#"{"type":"pre","url":"ya.ru","offset":1,"length":2,"language":"rust"}"#
|
||||
)
|
||||
.unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn text_from() {
|
||||
let message = message();
|
||||
|
|
Loading…
Add table
Reference in a new issue