Fix MarkdownV2 support in Telegram (#1169)
This commit is contained in:
parent
9b22f16497
commit
a94fe55886
|
@ -322,6 +322,9 @@ func (b *Btelegram) handleEdit(msg *config.Message, chatid int64) (string, error
|
||||||
case "Markdown":
|
case "Markdown":
|
||||||
b.Log.Debug("Using mode markdown")
|
b.Log.Debug("Using mode markdown")
|
||||||
m.ParseMode = tgbotapi.ModeMarkdown
|
m.ParseMode = tgbotapi.ModeMarkdown
|
||||||
|
case MarkdownV2:
|
||||||
|
b.Log.Debug("Using mode MarkdownV2")
|
||||||
|
m.ParseMode = MarkdownV2
|
||||||
}
|
}
|
||||||
if strings.ToLower(b.GetString("MessageFormat")) == HTMLNick {
|
if strings.ToLower(b.GetString("MessageFormat")) == HTMLNick {
|
||||||
b.Log.Debug("Using mode HTML - nick only")
|
b.Log.Debug("Using mode HTML - nick only")
|
||||||
|
|
|
@ -15,6 +15,7 @@ const (
|
||||||
unknownUser = "unknown"
|
unknownUser = "unknown"
|
||||||
HTMLFormat = "HTML"
|
HTMLFormat = "HTML"
|
||||||
HTMLNick = "htmlnick"
|
HTMLNick = "htmlnick"
|
||||||
|
MarkdownV2 = "MarkdownV2"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Btelegram struct {
|
type Btelegram struct {
|
||||||
|
@ -126,6 +127,10 @@ func (b *Btelegram) sendMessage(chatid int64, username, text string) (string, er
|
||||||
b.Log.Debug("Using mode markdown")
|
b.Log.Debug("Using mode markdown")
|
||||||
m.ParseMode = tgbotapi.ModeMarkdown
|
m.ParseMode = tgbotapi.ModeMarkdown
|
||||||
}
|
}
|
||||||
|
if b.GetString("MessageFormat") == MarkdownV2 {
|
||||||
|
b.Log.Debug("Using mode MarkdownV2")
|
||||||
|
m.ParseMode = MarkdownV2
|
||||||
|
}
|
||||||
if strings.ToLower(b.GetString("MessageFormat")) == HTMLNick {
|
if strings.ToLower(b.GetString("MessageFormat")) == HTMLNick {
|
||||||
b.Log.Debug("Using mode HTML - nick only")
|
b.Log.Debug("Using mode HTML - nick only")
|
||||||
m.Text = username + html.EscapeString(text)
|
m.Text = username + html.EscapeString(text)
|
||||||
|
|
Loading…
Reference in New Issue