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

Does it support multi-lines post message #42

Open
Nanyan opened this issue Mar 14, 2023 · 3 comments
Open

Does it support multi-lines post message #42

Nanyan opened this issue Mar 14, 2023 · 3 comments

Comments

@Nanyan
Copy link

Nanyan commented Mar 14, 2023

Currently I found it seems do not support multi-lines message when I'm using the PostNotificationV2 method.

Am I missing something?

Will it be supported?

Thanks.

@crispgm
Copy link
Contributor

crispgm commented Mar 14, 2023

Currently I found it seems do not support multi-lines message when I'm using the PostNotificationV2 method.

Am I missing something?

Will it be supported?

Thanks.

May I ask what is a multi-line message? I think it's available to just use \n to post multi-line.

@Nanyan
Copy link
Author

Nanyan commented Mar 15, 2023

Great, using \n to start a new line works fine.

I saw there's a different example from the official docs to post a rich text, as follows:

{
    "chat_id": "oc_5ce6d572455d361153b7cb51da133945",
    "msg_type": "post",
    "content": {
        "post": {
            "zh_cn": {
                "title": "I am a title",
                "content": [
                    [
                        {
                            "tag": "text",
                            "un_escape": true,
                            "text": "line 1 :",
                        },
                        {
                            "tag": "a",
                            "text": "super link",
                            "href": "www.baidu.com"
                        },
                        {
                            "tag": "at",
                            "user_id": "ou_18eac85d35a26f989317ad4f02e8bbbb"
                        }
                    ],
                    [
                        {
                            "tag": "text",
                            "text": "line 2 :",
                        },
                        {
                            "tag": "text",
                            "text": "text content",
                        }
                    ],
                    [
                        {
                            "tag": "text",
                            "text": "",
                        },
                        {
                            "tag": "img",
                            "image_key": "b15a91e5-156d-4d81-8bac-3d27c321001b",
                            "width": 300,
                            "height": 300
                        }
                    ]
                ]
            }
        }
    }
}

It seems currently this package do not support the above rich text.
Do you think it's better to support it?

@crispgm
Copy link
Contributor

crispgm commented Mar 15, 2023

Great, using \n to start a new line works fine.

I saw there's a different example from the official docs to post a rich text, as follows:

{
    "chat_id": "oc_5ce6d572455d361153b7cb51da133945",
    "msg_type": "post",
    "content": {
        "post": {
            "zh_cn": {
                "title": "I am a title",
                "content": [
                    [
                        {
                            "tag": "text",
                            "un_escape": true,
                            "text": "line 1 :",
                        },
                        {
                            "tag": "a",
                            "text": "super link",
                            "href": "www.baidu.com"
                        },
                        {
                            "tag": "at",
                            "user_id": "ou_18eac85d35a26f989317ad4f02e8bbbb"
                        }
                    ],
                    [
                        {
                            "tag": "text",
                            "text": "line 2 :",
                        },
                        {
                            "tag": "text",
                            "text": "text content",
                        }
                    ],
                    [
                        {
                            "tag": "text",
                            "text": "",
                        },
                        {
                            "tag": "img",
                            "image_key": "b15a91e5-156d-4d81-8bac-3d27c321001b",
                            "width": 300,
                            "height": 300
                        }
                    ]
                ]
            }
        }
    }
}

It seems currently this package do not support the above rich text. Do you think it's better to support it?

This is available but you may use MsgBuffer to build one. Refer to here: https://github.com/go-lark/lark/blob/main/api_notification_test.go#L39

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

2 participants