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
2
2
3
3
import (
4
4
"context"
5
+ "encoding/json"
5
6
"errors"
6
7
"io"
7
8
"log"
@@ -18,7 +19,6 @@ type Bot struct {
18
19
SyncCheckCallback func (resp SyncCheckResponse ) // 心跳回调
19
20
MessageHandler MessageHandler // 获取消息成功的handle
20
21
MessageErrorHandler MessageErrorHandler // 获取消息发生错误的handle, 返回err == nil 则尝试继续监听
21
- Serializer Serializer // 序列化器, 默认为json
22
22
Caller * Caller
23
23
Storage * Session
24
24
err error
@@ -318,7 +318,7 @@ func (b *Bot) DumpTo(writer io.Writer) error {
318
318
SyncKey : b .Storage .Response .SyncKey ,
319
319
UUID : b .uuid ,
320
320
}
321
- return b . Serializer .Encode (writer , item )
321
+ return json . NewEncoder ( writer ) .Encode (item )
322
322
}
323
323
324
324
// IsHot returns true if is hot login otherwise false
@@ -344,11 +344,10 @@ func NewBot(c context.Context) *Bot {
344
344
caller .Client .SetMode (normal )
345
345
ctx , cancel := context .WithCancel (c )
346
346
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 ,
352
351
}
353
352
}
354
353
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments