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

Function SendRoomNotice

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

Source from the content-addressed store, hash-verified

98}
99
100func SendRoomNotice(ctx context.Context, userId, msgType, body, outType, roomId string) error {
101 apiClient := GetHttpClient(time.Minute * 1)
102 defer apiClient.CloseIdleConnections()
103 req := sendNoticeRequest{
104 UserID: userId,
105 Content: struct {
106 MsgType string `json:"msgtype,omitempty"`
107 Body string `json:"body,omitempty"`
108 }(struct {
109 MsgType string
110 Body string
111 }{MsgType: msgType, Body: body}),
112 Type: outType,
113 StateKey: "",
114 RoomId: roomId,
115 }
116 res := struct {
117 EventId string `json:"event_id,omitempty"`
118 }{}
119 return PostJSONNoSpan(ctx, &apiClient, LocalServerUrl+RoomMsgNoticePath, req, &res)
120}

Callers

nothing calls this directly

Calls 2

GetHttpClientFunction · 0.85
PostJSONNoSpanFunction · 0.85

Tested by

no test coverage detected