Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 当不回复消息的时候, 会答应错误日志, #784

Open
maxbad opened this issue Jul 17, 2024 · 1 comment
Open

[BUG] 当不回复消息的时候, 会答应错误日志, #784

maxbad opened this issue Jul 17, 2024 · 1 comment
Labels

Comments

@maxbad
Copy link

maxbad commented Jul 17, 2024

描述

// 使用memcache保存access_token,也可选择redis或自定义cache
wc := wechat.NewWechat()
memory := cache.NewMemory()
cfg := &offConfig.Config{
    AppID:     "xxx",
    AppSecret: "xxx",
    Token:     "xxx",
    // EncodingAESKey: "xxxx",
    Cache: memory,
}
officialAccount := wc.GetOfficialAccount(cfg)

// 传入request和responseWriter
server := officialAccount.GetServer(req, rw)
// 设置接收消息的处理方法
server.SetMessageHandler(func(msg *message.MixMessage) *message.Reply {

    // 不回复消息
    return nil
})

// 处理消息接收以及回复
err := server.Serve()
if err != nil {
    fmt.Println(err)
    return
}
// 发送回复的消息
server.Send()

@maxbad maxbad added the bug label Jul 17, 2024
@houseme
Copy link
Collaborator

houseme commented Jul 17, 2024

欢迎提 pr 改进,也可以找下老的issue 看看

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants