slack-go / slack

Slack API in Go, originally by @nlopes; Maintainers needed, contact @parsley42
https://pkg.go.dev/github.com/slack-go/slack
BSD 2-Clause "Simplified" License
4.6k stars 1.11k forks source link

No filter object in multi_conversation_select #1192

Open imamfzn opened 1 year ago

imamfzn commented 1 year ago

Hi team, currently there is no filter field in the multi_conversation_select block element type like below:

https://github.com/slack-go/slack/blob/b4b5a6428b1d432dabb23dda46b6898010a8a521/block_element.go#L270-L283

At the moment, only the conversation_select which has the filter object. In the slack documentation, it said the filter object also supported in the multi_conversation_select.

As a workaround to bypass this issue, i create a conversation_select block element, and change the element type once it created to be multi_conversation_select, like:

var modal slack.ModalViewRequest
// omitted code to parsed/unmarshal the json kit to be the the view struct
// ...

block := modal.Blocks.BlockSet[0].(*slack.SectionBlock)
block.Accessory.SelectElement.Type = "multi_conversations_select"
modal.Blocks.BlockSet[0] = block
Example json kit template used ```json { "type": "modal", "title": { "type": "plain_text", "text": "Add to Channel", "emoji": true }, "submit": { "type": "plain_text", "text": "Add", "emoji": true }, "close": { "type": "plain_text", "text": "Close", "emoji": true }, "blocks": [ { "type": "section", "block_id": "block_add_to_channel", "text": { "type": "mrkdwn", "text": "*Add these people to {{.ChannelName}}*" }, "accessory": { "action_id": "action_add_to_channel", "type": "conversations_select", "placeholder": { "type": "plain_text", "text": "Add people and/or channels" }, "filter": { "include": [ "im", "public" ], "exclude_bot_users": true } } } ] } ```

But i think that way is not clean, since we actually can directly create the multi_conversation_select with filter object based on the slack documentation.

I create my own pull request in https://github.com/slack-go/slack/pull/1191, please help to review and merge / please help to fix that issue if my PR is not suitable.

Thank you!