MCPcopy Create free account
hub / github.com/bytebase/bytebase / getMessageCard

Function getMessageCard

backend/plugin/webhook/feishu/feishu.go:225–261  ·  view source on GitHub ↗
(context webhook.Context)

Source from the content-addressed store, hash-verified

223}
224
225func getMessageCard(context webhook.Context) *WebhookCard {
226 var markdownBuf strings.Builder
227
228 if context.Description != "" {
229 _, _ = fmt.Fprintf(&markdownBuf, "%s\n", context.Description)
230 }
231
232 for _, meta := range context.GetMetaList() {
233 _, _ = fmt.Fprintf(&markdownBuf, "**%s**: %s\n", meta.Name, meta.Value)
234 }
235
236 if context.ActorName != "" {
237 _, _ = fmt.Fprintf(&markdownBuf, "**Actor**: %s (%s)\n", context.ActorName, context.ActorEmail)
238 }
239 _, _ = fmt.Fprintf(&markdownBuf, "[View in Bytebase](%s)", context.Link)
240
241 return &WebhookCard{
242 Config: WebhookCardConfig{
243 WideScreenMode: true,
244 EnableForward: true,
245 },
246 Header: WebhookCardHeader{
247 Title: WebhookCardHeaderTitle{
248 Content: context.Title,
249 Tag: "plain_text",
250 },
251 },
252 I18nElements: WebhookCardI18nElements{
253 English: []WebhookMarkdownSection{
254 {
255 Tag: "markdown",
256 Content: markdownBuf.String(),
257 },
258 },
259 },
260 }
261}

Callers 2

postDirectMessageFunction · 0.70
postMessageFunction · 0.70

Calls 2

GetMetaListMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected