fix: link
This commit is contained in:
@@ -2,6 +2,7 @@ package memos
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/imroc/req/v3"
|
"github.com/imroc/req/v3"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@@ -40,10 +41,14 @@ func InitClient(host, token string) {
|
|||||||
func Post(pd PostData) error {
|
func Post(pd PostData) error {
|
||||||
var createMemoResp Memo
|
var createMemoResp Memo
|
||||||
|
|
||||||
|
content := fmt.Sprintf("#%s #%d \n\n%s", pd.ChannelTitle, pd.ChannelID, pd.Content)
|
||||||
|
content = strings.ReplaceAll(content, "http://", " http://")
|
||||||
|
content = strings.ReplaceAll(content, "https://", " https://")
|
||||||
|
|
||||||
resp, err := client.R().
|
resp, err := client.R().
|
||||||
SetSuccessResult(&createMemoResp).
|
SetSuccessResult(&createMemoResp).
|
||||||
SetBodyJsonMarshal(Memo{
|
SetBodyJsonMarshal(Memo{
|
||||||
Content: fmt.Sprintf("#%s #%d \n\n%s", pd.ChannelTitle, pd.ChannelID, pd.Content),
|
Content: content,
|
||||||
Visibility: "PUBLIC",
|
Visibility: "PUBLIC",
|
||||||
}).
|
}).
|
||||||
Post("api/v1/memos")
|
Post("api/v1/memos")
|
||||||
|
|||||||
Reference in New Issue
Block a user