MCPcopy
hub / github.com/eatmoreapple/openwechat

github.com/eatmoreapple/openwechat @v1.4.10 sqlite

repository ↗ · DeepWiki ↗ · release v1.4.10 ↗
646 symbols 1,671 edges 28 files 428 documented · 66%
README

openwechat

Go Doc Release Go Report Card Stars Forks Sourcegraph

golang版个人微信号API, 突破登录限制,类似开发公众号一样,开发个人微信号

微信机器人,利用微信号完成一些功能的定制化开发⭐

  • 模块简单易用,易于扩展
  • 支持定制化开发,如日志记录,自动回复
  • 突破登录限制📣
  • 无需重复扫码登录
  • 支持多个微信号同时登陆

安装

go get -u github.com/eatmoreapple/openwechat

快速开始

package main

import (
    "fmt"
    "github.com/eatmoreapple/openwechat"
)

func main() {
    bot := openwechat.DefaultBot(openwechat.Desktop) // 桌面模式

    // 注册消息处理函数
    bot.MessageHandler = func(msg *openwechat.Message) {
        if msg.IsText() && msg.Content == "ping" {
            msg.ReplyText("pong")
        }
    }
    // 注册登陆二维码回调
    bot.UUIDCallback = openwechat.PrintlnQrcodeUrl

    // 登陆
    if err := bot.Login(); err != nil {
        fmt.Println(err)
        return
    }

    // 获取登陆的用户
    self, err := bot.GetCurrentUser()
    if err != nil {
        fmt.Println(err)
        return
    }

    // 获取所有的好友
    friends, err := self.Friends()
    fmt.Println(friends, err)

    // 获取所有的群组
    groups, err := self.Groups()
    fmt.Println(groups, err)

    // 阻塞主goroutine, 直到发生异常或者用户主动退出
    bot.Block()
}

支持功能

  • 消息回复、给指定对象(好友、群组)发送文本、图片、文件、emoji表情等消息
  • 热登陆(无需重复扫码登录)、自定义消息处理、文件下载、消息防撤回
  • 获取对象信息、设置好友备注、拉好友进群等
  • 更多功能请查看文档

文档

点击查看

项目主页

https://github.com/eatmoreapple/openwechat

Thanks

JetBrains

** 如果喜欢的话,可以请作者吃包辣条。谢谢支持 :smile: **

Extension points exported contracts — how you extend this code

MessageProcessor (Interface)
(no doc) [7 implementers]
message_processor.go
BotLogin (Interface)
BotLogin 定义了一个Login的接口 [4 implementers]
bot_login.go
HttpHook (Interface)
HttpHook 请求上下文钩子 [1 implementers]
client.go
MessageDispatcher (Interface)
MessageDispatcher 消息分发处理接口 跟 DispatchMessage 结合封装成 MessageHandler [1 implementers]
message_handle.go
Mode (Interface)
(no doc) [2 implementers]
mode.go
SendMessageFunc (FuncType)
(no doc)
user.go
BotPreparer (Interface)
(no doc) [1 implementers]
bot_login.go
UploadFile (Interface)
(no doc)
client.go

Core symbols most depended-on inside this repo

String
called by 43
user.go
Close
called by 35
storage.go
Do
called by 33
client.go
BaseHost
called by 31
url.go
Self
called by 30
user.go
Context
called by 28
bot.go
Error
called by 22
errors.go
Bot
called by 21
user.go

Shape

Method 448
Struct 83
Function 72
TypeAlias 28
Interface 8
FuncType 7

Languages

Go100%

Modules by API surface

user.go110 symbols
message.go88 symbols
relations.go73 symbols
client.go73 symbols
caller.go54 symbols
message_handle.go47 symbols
bot.go44 symbols
bot_login.go39 symbols
entity.go23 symbols
message_processor.go18 symbols
mode.go13 symbols
cookiejar.go9 symbols

For agents

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

⬇ download graph artifact