slack-rs / slack-rs-api

Rust interface for the Slack Web API
Apache License 2.0
109 stars 66 forks source link

The `channel_history.rs` example returns MalformedResponse. #78

Open cedric-h opened 4 years ago

cedric-h commented 4 years ago

If I get the code for a slack channel by copying a link to it and grabbing only the last part of the link, and then passing that code to the example, I don't get the error about it not being able to find a channel like I do if I pass anything else. Instead, I get an error about how the Slack API doesn't like the response that this crate is forming for it.

Err(MalformedResponse(Error("unknown variant `slackbot_response`, expected one of `standard`, `bot_message`, `channel_archive`,
`channel_join`, `channel_leave`, `channel_name`, `channel_purpose`, `channel_topic`, `channel_unarchive`, `file_comment`, `file_
mention`, `file_share`, `group_archive`, `group_join`, `group_leave`, `group_name`, `group_purpose`, `group_topic`, `group_unarc
hive`, `me_message`, `message_changed`, `message_deleted`, `message_replied`, `pinned_item`, `reply_broadcast`, `unpinned_item`"
, line: 1, column: 5466)))

Is there any way to see the JSON that's generated? I turned on logging all the way down to trace, and I got a ton of logs from tokio in particular, but not much else.

dten commented 4 years ago

Thanks for the report. It seems that there are some message types which are unhandled. The original design doesn't handled any types other than what the library knows about so it's an error. Slack don't version their API so new message types can just appear and cause issues for this very strict API. I feel like it needs an unknowns which just keeps the message blob but doesn't die. It should also handle any new types as they appear and this looks like a new one.