slack-rs / slack-rs-api

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

`bot_add` message variant not supported #73

Closed resinten closed 4 years ago

resinten commented 5 years ago

When getting the history from a group or channel, the bot_add message is not supported and crashes. It appears that messages for "X added bot Y to the channel" cause an error for MalformedResponse on the basis that the bot_add type is unknown. This may be a case of the generated code being outdated?

Err(MalformedResponse(Error("unknown variant `bot_add`, 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_unarchive`, `me_message`, `message_changed`, `message_deleted`, `message_replied`, `pinned_item`, `reply_broadcast`, `unpinned_item`", line: 1, column: 327)))
resinten commented 5 years ago

In fact, if I post a new message and set the count to Some(1) in the HistoryRequest, then it works because the bot add message is not in the response body.

dten commented 5 years ago

Oh dear thanks for the report. Suppose that needs adding to the schema. It should also probably provide some access to unknown messages without dying

dten commented 4 years ago

slack_api::MessageBotAdd now exists, doesn't solve the catch all case but enough for this issue https://docs.rs/slack_api/0.23.1/slack_api/struct.MessageBotAdd.html