Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GetBlockID() method to slack.Block interface. #1358

Open
takuo opened this issue Dec 5, 2024 · 0 comments
Open

Add GetBlockID() method to slack.Block interface. #1358

takuo opened this issue Dec 5, 2024 · 0 comments

Comments

@takuo
Copy link

takuo commented Dec 5, 2024

Description

It makes easy to find a block by BlockID from BlockSet since I believe that all MessageBlockType has BlockID.
I will create PR if the request is acceptable.

usage example

	var ic slack.InteractionCallback
	b, _ := io.ReadAll(req.Body)
	json.Unmarshal(b, &ic)

	var block slack.Block
	if i := slices.IndexFunc(ic.View.Blocks.BlockSet, func(blk slack.Block) bool {
		return blk.GetBlockID() == "input-block-age"
	}); i >= 0 {
		block = ic.View.Blocks.BlockSet[i]
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant