MCPcopy
hub / github.com/silenceper/wechat

github.com/silenceper/wechat @v2.1.13 sqlite

repository ↗ · DeepWiki ↗ · release v2.1.13 ↗
2,282 symbols 4,584 edges 213 files 2,224 documented · 97%
README

WeChat SDK for Go

Go Go Report Card pkg GitHub release (latest SemVer) star

使用Golang开发的微信SDK,简单、易用。

文档 && 例子

API列表

Wechat SDK 2.0 文档

Wechat SDK 2.0 例子

快速开始

import "github.com/silenceper/wechat/v2"

以下是一个微信公众号处理消息接收以及回复的例子:

// 使用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 {

    // 回复消息:演示回复用户发送的消息
    text := message.NewText(msg.Content)
    return &message.Reply{MsgType: message.MsgTypeText, MsgData: text}
})

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

目录说明

  • officialaccount: 微信公众号API
  • miniprogram: 小程序API
  • minigame:小游戏API
  • pay:微信支付API
  • openplatform:开放平台API
  • work:企业微信
  • aispeech:智能对话
  • doc: api文档

贡献

  • API列表中查看哪些API未实现
  • 提交issue,描述需要贡献的内容
  • 完成更改后,提交PR

感谢以下贡献者

作者公众号

img

License

Apache License, Version 2.0

Extension points exported contracts — how you extend this code

AccessTokenHandle (Interface)
AccessTokenHandle AccessToken 接口 [8 implementers]
credential/access_token.go
Cache (Interface)
Cache interface [3 implementers]
cache/cache.go
JsTicketHandle (Interface)
JsTicketHandle js ticket获取 [2 implementers]
credential/js_ticket.go
PushData (Interface)
PushData 推送的数据 (已转对应的结构体)
miniprogram/message/message.go
URIModifier (FuncType)
URIModifier URI修改器
util/http.go
AccessTokenContextHandle (Interface)
AccessTokenContextHandle AccessToken 接口 [7 implementers]
credential/access_token.go
ContextCache (Interface)
ContextCache interface [1 implementers]
cache/cache.go
JsTicketContextHandle (Interface)
JsTicketContextHandle js ticket获取 [1 implementers]
credential/js_ticket.go

Core symbols most depended-on inside this repo

GetAccessToken
called by 395
credential/access_token.go
DecodeWithError
called by 289
util/error.go
PostJSON
called by 269
util/http.go
DecodeWithCommonError
called by 95
util/error.go
HTTPGet
called by 62
util/http.go
PostJSONContext
called by 57
util/http.go
HTTPPost
called by 31
util/http.go
NewSDKErr
called by 23
work/kf/error.go

Shape

Struct 1,228
Method 803
Function 202
TypeAlias 41
Interface 7
FuncType 1

Languages

Go100%

Modules by API surface

work/checkin/record.go66 symbols
work/externalcontact/moment.go64 symbols
miniprogram/express/intracity.go48 symbols
miniprogram/virtualpayment/domain.go47 symbols
miniprogram/message/message.go46 symbols
miniprogram/minidrama/domain.go45 symbols
work/externalcontact/msg.go43 symbols
work/externalcontact/external_user.go42 symbols
work/addresslist/user.go39 symbols
work/checkin/checkin.go38 symbols
work/msgaudit/message.go37 symbols
work/kf/knowledge.go37 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

github.com/alicebob/miniredis/v2v2.30.0 · 1×
github.com/bradfitz/gomemcachev0.0.0-2022010621544 · 1×
github.com/fatih/structsv1.1.0 · 1×
github.com/go-redis/redis/v8v8.11.5 · 1×
golang.org/x/cryptov0.0.0-2022062221311 · 1×
gopkg.in/h2non/gock.v1v1.1.2 · 1×

For agents

$ claude mcp add wechat \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact