MCPcopy Create free account
hub / github.com/daodst/chat / SendServerNotice

Function SendServerNotice

new_feature/notice_func.go:79–98  ·  view source on GitHub ↗
(ctx context.Context, userId, msgType, body, outType string)

Source from the content-addressed store, hash-verified

77}
78
79func SendServerNotice(ctx context.Context, userId, msgType, body, outType string) error {
80 apiClient := GetHttpClient(time.Minute * 1)
81 defer apiClient.CloseIdleConnections()
82 req := sendNoticeRequest{
83 UserID: userId,
84 Content: struct {
85 MsgType string `json:"msgtype,omitempty"`
86 Body string `json:"body,omitempty"`
87 }(struct {
88 MsgType string
89 Body string
90 }{MsgType: msgType, Body: body}),
91 Type: outType,
92 StateKey: "",
93 }
94 res := struct {
95 EventId string `json:"event_id,omitempty"`
96 }{}
97 return PostJSONNoSpan(ctx, &apiClient, LocalServerUrl+ServerNoticePath, req, &res)
98}
99
100func SendRoomNotice(ctx context.Context, userId, msgType, body, outType, roomId string) error {
101 apiClient := GetHttpClient(time.Minute * 1)

Callers

nothing calls this directly

Calls 2

GetHttpClientFunction · 0.85
PostJSONNoSpanFunction · 0.85

Tested by

no test coverage detected