添加xml格式化
This commit is contained in:
parent
67cff85503
commit
42ea1237ff
14
bot_test.go
14
bot_test.go
@ -33,6 +33,20 @@ func TestBotLogin(t *testing.T) {
|
|||||||
t.Log(self.NickName)
|
t.Log(self.NickName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMessage(t *testing.T) {
|
||||||
|
bot := defaultBot()
|
||||||
|
bot.MessageHandler = func(msg *Message) {
|
||||||
|
if msg.IsMedia() {
|
||||||
|
fmt.Println(msg.Content)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := bot.Login(); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
bot.Block()
|
||||||
|
}
|
||||||
|
|
||||||
func TestFriend(t *testing.T) {
|
func TestFriend(t *testing.T) {
|
||||||
self, err := getSelf()
|
self, err := getSelf()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
12
message.go
12
message.go
@ -260,7 +260,7 @@ func (m *Message) init(bot *Bot) {
|
|||||||
// if !m.IsFriendAdd() {
|
// if !m.IsFriendAdd() {
|
||||||
// return fmt.Errorf("the excepted message type is 37, but got %d", m.MsgType)
|
// return fmt.Errorf("the excepted message type is 37, but got %d", m.MsgType)
|
||||||
// }
|
// }
|
||||||
// m.ClientManager.Client.WebWxVerifyUser(m.ClientManager.storage, m.RecommendInfo, "")
|
// return m.Bot.Caller.Client.WebWxVerifyUser(m.Bot.storage, m.RecommendInfo, "")
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// 发送消息的结构体
|
// 发送消息的结构体
|
||||||
@ -314,3 +314,13 @@ type RecommendInfo struct {
|
|||||||
UserName string
|
UserName string
|
||||||
VerifyFlag int
|
VerifyFlag int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Article struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func xmlFormString(text string) string {
|
||||||
|
lt := strings.ReplaceAll(text, "<", "<")
|
||||||
|
gt := strings.ReplaceAll(lt, ">", ">")
|
||||||
|
br := strings.ReplaceAll(gt, "<br/>", "\n")
|
||||||
|
return strings.ReplaceAll(br, "&amp;", "&")
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user