MCPcopy
hub / github.com/42wim/matterbridge / TGGetParseMode

Function TGGetParseMode

bridge/telegram/telegram.go:67–87  ·  view source on GitHub ↗
(b *Btelegram, username string, text string)

Source from the content-addressed store, hash-verified

65}
66
67func TGGetParseMode(b *Btelegram, username string, text string) (textout string, parsemode string) {
68 textout = username + text
69 if b.GetString("MessageFormat") == HTMLFormat {
70 b.Log.Debug("Using mode HTML")
71 parsemode = tgbotapi.ModeHTML
72 }
73 if b.GetString("MessageFormat") == "Markdown" {
74 b.Log.Debug("Using mode markdown")
75 parsemode = tgbotapi.ModeMarkdown
76 }
77 if b.GetString("MessageFormat") == MarkdownV2 {
78 b.Log.Debug("Using mode MarkdownV2")
79 parsemode = MarkdownV2
80 }
81 if strings.ToLower(b.GetString("MessageFormat")) == HTMLNick {
82 b.Log.Debug("Using mode HTML - nick only")
83 textout = username + html.EscapeString(text)
84 parsemode = tgbotapi.ModeHTML
85 }
86 return textout, parsemode
87}
88
89func (b *Btelegram) Send(msg config.Message) (string, error) {
90 b.Log.Debugf("=> Receiving %#v", msg)

Callers 2

sendMessageMethod · 0.85
handleUploadFileMethod · 0.85

Calls 1

GetStringMethod · 0.65

Tested by

no test coverage detected