Skip to content
Snippets Groups Projects
Commit dd9dead6 authored by Ophestra's avatar Ophestra
Browse files

parse using mode "MarkdownV2", properly escape strings

parent 6ecaf724
No related branches found
No related tags found
No related merge requests found
...@@ -119,7 +119,6 @@ func discordHandleCreate(session *discordgo.Session, create *discordgo.MessageCr ...@@ -119,7 +119,6 @@ func discordHandleCreate(session *discordgo.Session, create *discordgo.MessageCr
} }
msg := tgbotapi.NewMessage(int64(tc.ID), "") msg := tgbotapi.NewMessage(int64(tc.ID), "")
msg.ParseMode = "Markdown"
if create.Message.Content == "" && len(create.Message.Attachments) == 0 { if create.Message.Content == "" && len(create.Message.Attachments) == 0 {
// FIXME: implement stickers after library supports it // FIXME: implement stickers after library supports it
...@@ -149,6 +148,9 @@ func discordHandleCreate(session *discordgo.Session, create *discordgo.MessageCr ...@@ -149,6 +148,9 @@ func discordHandleCreate(session *discordgo.Session, create *discordgo.MessageCr
msg.Text += fmt.Sprintf("\n[Attachment %v](%s)", i, attachment.URL) msg.Text += fmt.Sprintf("\n[Attachment %v](%s)", i, attachment.URL)
} }
msg.ParseMode = "MarkdownV2"
msg.Text = strings.ReplaceAll(msg.Text, ">", "\\>")
if m, err := botAPI.Send(msg); err != nil { if m, err := botAPI.Send(msg); err != nil {
log.Printf("error relaying message %s, %s", create.Message.ID, err) log.Printf("error relaying message %s, %s", create.Message.ID, err)
return return
...@@ -192,7 +194,6 @@ func discordHandleUpdate(session *discordgo.Session, update *discordgo.MessageUp ...@@ -192,7 +194,6 @@ func discordHandleUpdate(session *discordgo.Session, update *discordgo.MessageUp
} }
edit := tgbotapi.NewEditMessageText(int64(tc.ID), tid, discordMakeHeader(update.Message.Author)+update.Message.Content) edit := tgbotapi.NewEditMessageText(int64(tc.ID), tid, discordMakeHeader(update.Message.Author)+update.Message.Content)
edit.ParseMode = "Markdown"
if _, err := botAPI.Send(edit); err != nil { if _, err := botAPI.Send(edit); err != nil {
log.Printf("error relaying edit on message %s: %s", update.Message.ID, err) log.Printf("error relaying edit on message %s: %s", update.Message.ID, err)
return return
......
...@@ -4,8 +4,6 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 ...@@ -4,8 +4,6 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU= github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU=
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM= github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM=
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.0.0-rc1 h1:Mr8jIV7wDfLw5Fw6BPupm0aduTFdLjhI3wFuIIZKvO4=
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.0.0-rc1/go.mod h1:2s/IzRcxCszyNh760IjJiqoYHTnifk8ZeNYL33z8Pww=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/pelletier/go-toml/v2 v2.0.0-beta.3 h1:PNCTU4naEJ8mKal97P3A2qDU74QRQGlv4FXiL1XDqi4= github.com/pelletier/go-toml/v2 v2.0.0-beta.3 h1:PNCTU4naEJ8mKal97P3A2qDU74QRQGlv4FXiL1XDqi4=
......
...@@ -392,7 +392,6 @@ func telegramCommand(update tgbotapi.Update) { ...@@ -392,7 +392,6 @@ func telegramCommand(update tgbotapi.Update) {
switch update.Message.Command() { switch update.Message.Command() {
case "start": case "start":
if update.Message.Chat.ID == int64(update.Message.From.ID) { if update.Message.Chat.ID == int64(update.Message.From.ID) {
message.ParseMode = "Markdown"
message.Text = "Thanks for using BridgeThing!\n" + message.Text = "Thanks for using BridgeThing!\n" +
"To find the ID of a Telegram chat, use /id\n" + "To find the ID of a Telegram chat, use /id\n" +
"To get the invite URL, use /invite\n" + "To get the invite URL, use /invite\n" +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment