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

append attachments after message body to prevent it from being escaped

parent 43ac627e
Branches
No related tags found
No related merge requests found
......@@ -142,10 +142,6 @@ func discordHandleCreate(session *discordgo.Session, create *discordgo.MessageCr
}
}
for i, attachment := range create.Message.Attachments {
msg.Text += fmt.Sprintf("\n[Attachment %v](%s)", i, attachment.URL)
}
msg.ParseMode = "MarkdownV2"
msg.Text = strings.ReplaceAll(msg.Text, ">", "\\>")
msg.Text = strings.ReplaceAll(msg.Text, "_", "\\_")
......@@ -156,6 +152,10 @@ func discordHandleCreate(session *discordgo.Session, create *discordgo.MessageCr
msg.Text = strings.ReplaceAll(msg.Text, "!", "\\!")
msg.Text = discordMakeHeader(create.Author) + msg.Text
for i, attachment := range create.Message.Attachments {
msg.Text += fmt.Sprintf("\n[Attachment %v](%s)", i, attachment.URL)
}
if m, err := botAPI.Send(msg); err != nil {
log.Printf("error relaying message %s, %s", create.Message.ID, err)
return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment