File tree Expand file tree Collapse file tree 2 files changed +6
-32
lines changed
Expand file tree Collapse file tree 2 files changed +6
-32
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package openwechat
22
33import (
44 "context"
5+ "encoding/json"
56 "errors"
67 "io"
78 "log"
@@ -18,7 +19,6 @@ type Bot struct {
1819 SyncCheckCallback func (resp SyncCheckResponse ) // 心跳回调
1920 MessageHandler MessageHandler // 获取消息成功的handle
2021 MessageErrorHandler MessageErrorHandler // 获取消息发生错误的handle, 返回err == nil 则尝试继续监听
21- Serializer Serializer // 序列化器, 默认为json
2222 Caller * Caller
2323 Storage * Session
2424 err error
@@ -318,7 +318,7 @@ func (b *Bot) DumpTo(writer io.Writer) error {
318318 SyncKey : b .Storage .Response .SyncKey ,
319319 UUID : b .uuid ,
320320 }
321- return b . Serializer .Encode (writer , item )
321+ return json . NewEncoder ( writer ) .Encode (item )
322322}
323323
324324// IsHot returns true if is hot login otherwise false
@@ -344,11 +344,10 @@ func NewBot(c context.Context) *Bot {
344344 caller .Client .SetMode (normal )
345345 ctx , cancel := context .WithCancel (c )
346346 return & Bot {
347- Caller : caller ,
348- Storage : & Session {},
349- Serializer : & JsonSerializer {},
350- context : ctx ,
351- cancel : cancel ,
347+ Caller : caller ,
348+ Storage : & Session {},
349+ context : ctx ,
350+ cancel : cancel ,
352351 }
353352}
354353
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments