mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-13 17:22:26 +08:00
Update README.md
This commit is contained in:
@@ -11,6 +11,9 @@
|
|||||||
以下是一个处理消息接收以及回复的例子:
|
以下是一个处理消息接收以及回复的例子:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
|
//使用memcache保存access_token,也可选择redis或自定义cache
|
||||||
|
memCache=cache.NewMemcache("127.0.0.1:11211")
|
||||||
|
|
||||||
//配置微信参数
|
//配置微信参数
|
||||||
config := &wechat.Config{
|
config := &wechat.Config{
|
||||||
AppID: "xxxx",
|
AppID: "xxxx",
|
||||||
@@ -27,7 +30,7 @@ server.SetMessageHandler(func(msg message.MixMessage) *message.Reply {
|
|||||||
|
|
||||||
//回复消息:演示回复用户发送的消息
|
//回复消息:演示回复用户发送的消息
|
||||||
text := message.NewText(msg.Content)
|
text := message.NewText(msg.Content)
|
||||||
return &message.Reply{message.MsgText, text}
|
return &message.Reply{message.MsgTypeText, text}
|
||||||
})
|
})
|
||||||
|
|
||||||
server.Serve()
|
server.Serve()
|
||||||
|
|||||||
Reference in New Issue
Block a user