Merge pull request #40 from suntong/master

Content fix
This commit is contained in:
Ivy 2021-07-25 17:46:16 +08:00 committed by GitHub
commit 5259114400
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,8 +5,10 @@ import (
"encoding/xml"
"errors"
"fmt"
"html"
"net/http"
"os"
"regexp"
"strconv"
"strings"
"sync"
@ -326,6 +328,13 @@ func (m *Message) init(bot *Bot) {
}
}
}
if regexp.MustCompile(`^<`).MatchString(m.Content) {
m.Content = html.UnescapeString(m.Content)
}
//if m.IsText()
{
m.Content = strings.Replace(m.Content, `<br/>`, "\n", -1)
}
}
// 发送消息的结构体