fewensa / telegram-client

Rust Telegram Client
MIT License
93 stars 13 forks source link

deserialize error #22

Closed DogLi closed 3 years ago

DogLi commented 3 years ago

I use the telegram-client version 1.7.0, compiled tdlibjson.so based on td tag v1.7.0, and get error:

{"@type":"updateOption","name":"unix_time","value":{"@type":"optionValueInteger","value":"1617790356"}}
2021-04-07 18:12:36,888 ERROR [telegram_client::handler] TELEGRAM DATA FAIL. IF YOU SEE THIS MESSAGE, PLEASE POST AN ISSUE TO https://github.com/fewensa/telegram-client/issues 
 INCLUDE THIS JSON => {"@type":"updateOption","name":"unix_time","value":{"@type":"optionValueInteger","value":"123"}}
2021-04-07 18:12:36,888 ERROR [telegram_client::handler] SerdeJson(Error("unknown field `\"{} can\'t deserialize to {}::{}\", updateOption, TdType, UpdateOption, _e`, expected `\"{:?}\", _e`", line: 0, column: 0))

...
...
 INCLUDE THIS JSON => {"@type":"updateChatLastMessage","chat_id":-123,"last_message":{"@type":"message","id":123,"sender_user_id":0,"chat_id":-123,"is_outgoing":false,"can_be_edited":false,"can_be_forwarded":true,"can_be_deleted_only_for_self":false,"can_be_deleted_for_all_users":false,"is_channel_post":true,"contains_unread_mention":false,"date":1617787825,"edit_date":0,"reply_to_message_id":2405433344,"ttl":0,"ttl_expires_in":0.000000,"via_bot_user_id":0,"author_signature":"","views":1,"media_album_id":"0","restriction_reason":"","content":{"@type":"messageText","text":{"@type":"formattedText","xxxxx","entities":[{"@type":"textEntity","offset":7,"length":4,"type":{"@type":"textEntityTypeHashtag"}}]}}},"order":"123"}
2021-04-07 16:30:26.416 ERROR [6_<uname- 0>] (/root/.cargo/registry/src/github.com-1ecc6299db9ec823/telegram-client-1.7.0/src/handler.rs:53) [telegram_client::handler] -- SerdeJson(Error("unknown field `\"{} can\'t deserialize to {}::{}\", updateChatLastMessage, TdType,\nUpdateChatLastMessage, _e`, expected `\"{:?}\", _e`", line: 0, column: 0))

maybe same as #20

DogLi commented 3 years ago

user_id in UpdateUserFullInfo is i64, but in telegram it gives a string also the optionValueInteger

fewensa commented 3 years ago

user_id in UpdateUserFullInfo is i64, but in telegram it gives a string also the optionValueInteger

I don't think so, this question already solved. Related: https://github.com/fewensa/telegram-client/issues/16 https://github.com/fewensa/fantasy/issues/1

Usual this question is use different version of rtdlib and td. what's version do you use of td?

I'll test as soon. any news can talk with this issue.

fewensa commented 3 years ago

Hi, I did some tests, this problem does not exist in version 1.7.0

2021-08-21 15:14:52,425 DEBUG [telegram_client::api::api] <=== {"@type":"updateChatLastMessage","chat_id":6***2,"last_message":{"@type":"message","id":7***4,"sender":{"@type":"messageSenderUser","user_id":6***2},"chat_id":6***2,"is_outgoing":false,"is_pinned":false,"can_be_edited":false,"can_be_forwarded":true,"can_be_deleted_only_for_self":true,"can_be_deleted_for_all_users":true,"can_get_statistics":false,"can_get_message_thread":false,"is_channel_post":false,"contains_unread_mention":false,"date":1629530092,"edit_date":0,"reply_in_chat_id":0,"reply_to_message_id":0,"message_thread_id":0,"ttl":0,"ttl_expires_in":0.000000,"via_bot_user_id":0,"author_signature":"","media_album_id":"0","restriction_reason":"","content":{"@type":"messageText","text":{"@type":"formattedText","text":"b","entities":[]}}},"positions":[]}
2021-08-21 15:14:52,426 DEBUG [full_client] Chat last message: 6***2, data: {"@type":"message","@extra":null,"id":7***4,"sender":{"@type":"messageSenderUser","@extra":null,"user_id":6***2},"chat_id":6***2,"sending_state":null,"scheduling_state":null,"is_outgoing":false,"is_pinned":false,"can_be_edited":false,"can_be_forwarded":true,"can_be_deleted_only_for_self":true,"can_be_deleted_for_all_users":true,"can_get_statistics":false,"can_get_message_thread":false,"is_channel_post":false,"contains_unread_mention":false,"date":1629530092,"edit_date":0,"forward_info":null,"interaction_info":null,"reply_in_chat_id":0,"reply_to_message_id":0,"message_thread_id":0,"ttl":0,"ttl_expires_in":0.0,"via_bot_user_id":0,"author_signature":"","media_album_id":0,"restriction_reason":"","content":{"@type":"messageText","@extra":null,"text":{"@type":"formattedText","@extra":null,"text":"b","entities":[]},"web_page":null},"reply_markup":null}
[ 3][t10][1629530253.014801502][Td.cpp:4588][#2][!Td][&td_requests] Sending update: updateOption {
  name = "version"
  value = optionValueString {
    value = "1.7.0"
  }
}

telegram-client: =1.7.0 rtdlib: =1.7.0

This issue will close, If there are still problems, you can reopen this issue.

fewensa commented 3 years ago

This is indeed a bug and will be fixed in the next version, follow this issue https://github.com/fewensa/telegram-client/issues/25 also same as https://github.com/fewensa/telegram-client/issues/20

fewensa commented 3 years ago

The new version released https://crates.io/crates/telegram-client