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.63k stars 1.12k forks source link

Add support for Rich Text Lists #1155

Closed daniel-pieper-personio closed 6 months ago

daniel-pieper-personio commented 1 year ago

This PR adds support for rich text lists. For example:

{
    "token": "...",
    "team_id": "...",
    "api_app_id": "...",
    "event": {
        "client_msg_id": "...",
        "type": "message",
        "text": "test message with list\n1. first point\n2. second point\n• first bullet\n• second bullet\n",
        "user": "...",
        "ts": "1672827783.092039",
        "blocks": [
            {
                "type": "rich_text",
                "block_id": "...",
                "elements": [
                    {
                        "type": "rich_text_section",
                        "elements": [
                            {
                                "type": "text",
                                "text": "test message with list\n"
                            }
                        ]
                    },
                    {
                        "type": "rich_text_list",
                        "elements": [
                            {
                                "type": "rich_text_section",
                                "elements": [
                                    {
                                        "type": "text",
                                        "text": "first point"
                                    }
                                ]
                            },
                            {
                                "type": "rich_text_section",
                                "elements": [
                                    {
                                        "type": "text",
                                        "text": "second point"
                                    }
                                ]
                            }
                        ],
                        "style": "ordered",
                        "indent": 0,
                        "border": 0
                    },
                    {
                        "type": "rich_text_list",
                        "elements": [
                            {
                                "type": "rich_text_section",
                                "elements": [
                                    {
                                        "type": "text",
                                        "text": "first bullet"
                                    }
                                ]
                            },
                            {
                                "type": "rich_text_section",
                                "elements": [
                                    {
                                        "type": "text",
                                        "text": "second bullet"
                                    }
                                ]
                            }
                        ],
                        "style": "bullet",
                        "indent": 0,
                        "border": 0
                    },
                    {
                        "type": "rich_text_section",
                        "elements": []
                    }
                ]
            }
        ],
        "team": "...",
        "channel": "...",
        "event_ts": "1672827783.092039",
        "channel_type": "im"
    },
    "type": "event_callback",
    "event_id": "...",
    "event_time": 1672827783,
    "authorizations": [
        {
            "enterprise_id": null,
            "team_id": "...",
            "user_id": "...",
            "is_bot": true,
            "is_enterprise_install": false
        }
    ],
    "is_ext_shared_channel": false,
    "event_context": "..."
}

Reference: https://api.slack.com/changelog/2019-09-what-they-see-is-what-you-get-and-more-and-less

daniel-pieper-personio commented 9 months ago

@PierekEast would you mind triggering the workflow? I've updated the PR so it hopefully passes the linter :)

PierekEast commented 9 months ago

@PierekEast would you mind triggering the workflow? I've updated the PR so it hopefully passes the linter :)

Not sure I can do that 🤔

david4shure commented 7 months ago

Any updates here? Are there workarounds to using RichText lists?

parsley42 commented 7 months ago

@david4shure Right now slack-go/slack is essentially unmaintained. I can add new maintainers, and have done some maintaining work in the past, but really what's needed is a current/daily Go developer with some open source experience, and ideally someone familiar with the programming patterns in this library. I haven't the expertise nor the time to stay on top of PR reviews and discussions.

I did, however, close + reopen so the tests would run, and apparently the linting test failed.

chase-allen-tech commented 6 months ago

Hi team. Could you please make this mergeable? My work is waiting for this to be completed.

PierekEast commented 6 months ago

Hey guys, I did fixed the linting problem locally, but I cannot push to the @daniel-pieper-personio branch.

Ideally, @daniel-pieper-personio - you could quickly change that and the linter should pass and then everybody will be happy :D

There was some whitespace that the go linter did not like:

image

If anyone knows how I could apply these changes to this repo, apart from taking everything from this branch and creating a separate PR, then I would appreciate being enlightened.

But in the end, I could do the above and mention that PR as a duplicate.

Cheers!

rusq commented 6 months ago

@nlopes I summon you. Only you can save the world!

parsley42 commented 6 months ago

Note that this library needs more maintainers. I'll occasionally review/merge, but don't consider myself qualified since I'm down to <100 lines of Go / year at this point. The only good thing about me is I occasionally respond.