ayrat555/frankenstein

Fails to decode ChatMemberRestricted

swbartosz opened this issue · 3 comments

Example of update that contains a ChatMemberRestricted:

{"ok":true,"result":[{"update_id":1,
"chat_member":{"chat":{"id":-10000,"title":"a group","type":"supergroup"},"from":{"id":211,"is_bot":true,"first_name":"some name","username":"a_username"},"date":1714065911,"old_chat_member":{"user":{"id":645,"is_bot":false,"first_name":"John","last_name":"Smith"},"status":"left"},"new_chat_member":{"user":{"id":645,"is_bot":false,"first_name":"John","last_name":"Smith"},"status":"restricted","until_date":0,"can_send_messages":false,"can_send_media_messages":false,"can_send_audios":false,"can_send_documents":false,"can_send_photos":false,"can_send_videos":false,"can_send_video_notes":false,"can_send_voice_notes":false,"can_send_polls":false,"can_send_other_messages":false,"can_add_web_page_previews":false,"can_change_info":false,"can_invite_users":false,"can_pin_messages":false,"can_manage_topics":false,"is_member":false}}
}]}

returns with: Decode("Error(\"missing field status\", line: 2, column: 923) (column 923 being around the end).

Seems like the issue is caused by ChatMemberRestricted having a status field. No other ChatMember* has the status field. Removing it seems to work.

I have issue for Failed to get updates: Decode("Error("missing field message_id", line: 2, column: 746) :

hello @Programistich . what kind of update it's failing for?

@Programistich shared the json response that was failing. the issue is message_id should be optional in ExternalReplyInfo struct. (thanks!)

will make a pr with a fix now