{"id":16535846,"url":"https://github.com/yqchilde/wxbot","last_synced_at":"2025-04-04T13:11:52.445Z","repository":{"id":59042744,"uuid":"522762795","full_name":"yqchilde/wxbot","owner":"yqchilde","description":"☝🏻 一个好玩的个人微信机器人程序(DaenDLL、VLW)，插件开发，查天气，ChatGPT聊天，设置定时任务，公众号监控转发...","archived":false,"fork":false,"pushed_at":"2023-07-10T03:31:55.000Z","size":10830,"stargazers_count":618,"open_issues_count":9,"forks_count":122,"subscribers_count":13,"default_branch":"hook","last_synced_at":"2024-10-12T18:29:07.121Z","etag":null,"topics":["chatgpt","go","golang","gpt-35-turbo","openai","wechat","wechat-bot","wxbot"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yqchilde.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-09T01:32:06.000Z","updated_at":"2024-10-11T14:52:22.000Z","dependencies_parsed_at":"2024-06-20T00:13:45.533Z","dependency_job_id":"130ea16c-60d6-48a2-a15f-402f20e3fb3e","html_url":"https://github.com/yqchilde/wxbot","commit_stats":{"total_commits":358,"total_committers":4,"mean_commits":89.5,"dds":0.03351955307262566,"last_synced_commit":"de1c09009fcd06fc8286867eb94db6c280b99480"},"previous_names":[],"tags_count":70,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yqchilde%2Fwxbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yqchilde%2Fwxbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yqchilde%2Fwxbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yqchilde%2Fwxbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yqchilde","download_url":"https://codeload.github.com/yqchilde/wxbot/tar.gz/refs/heads/hook","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247182354,"owners_count":20897380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatgpt","go","golang","gpt-35-turbo","openai","wechat","wechat-bot","wxbot"],"created_at":"2024-10-11T18:29:04.228Z","updated_at":"2025-04-04T13:11:52.423Z","avatar_url":"https://github.com/yqchilde.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# WxBot\n\n* [What's this?](#whats-this)\n    * [已对接框架](#已对接框架)\n    * [已对接API](#已对接api)\n    * [已有插件](#已有插件)\n    * [指令大全](#指令大全)\n* [How to use?](#how-to-use)\n    * [本地运行](#本地运行)\n    * [Releases包](#releases包)\n    * [Docker运行](#docker运行)\n    * [Actions编译](#actions编译)\n* [How to develop?](#how-to-develop)\n    * [制作插件或接入其他框架](#制作插件或接入其他框架)\n    * [参考案例](#参考案例)\n    * [调试-环境变量](#调试-环境变量)\n    * [提交Pr注意项](#提交pr注意项)\n* [Feature](#feature)\n* [Thanks](#thanks)\n* [Support](#support)\n* [License](#license)\n\n## What's this?\n\n一个还算有意思的wechat robot项目，理想将其设计成一个多功能的机器人助手 😈\n\n* 🤨框架可无侵入扩展，现已接入`Dean DLL`、~~`千寻框架`~~、`vlw框架`，请参考`framework`目录\n* 🤨功能可无侵入扩展，现已集成`plugins`目录下的功能，请参考`plugins`目录\n* 🤨新手视频教程 📺\n    * BiliBili：[https://www.bilibili.com/video/BV1Q84y1c7iF](https://www.bilibili.com/video/BV1Q84y1c7iF)\n    * YouTube：[https://www.youtube.com/watch?v=JMeEa7ETIL0](https://www.youtube.com/watch?v=JMeEa7ETIL0)\n\n**🔔 注意：**\n\n1. 使用本项目之前需要您已经配置好相关的 `微信的hook` 类软件，那么只需要在这类软件上设置回调地址即可\n2. 本项目已接入`Dean DLL`、~~`千寻`~~、`vlw`三个框架，如果您有其他框架，可自行添加(参考`framework`目录，实现`IFramework`接口即可)，或联系我添加\n3. 本项目不提供任何`hook`类软件，您需要利用搜索引擎自行寻找\n4. 本项目暂时只支持HTTP协议，关于websocket协议支持目前不考虑\n5. 简而言之，本项目是一个消息处理的中间件，微信消息监听获取是从框架获取\n6. 本项目仅供学习交流使用，不得用于商业用途，否则后果自负\n7. 使用本项目造成封禁账号等后果，本项目不承担任何责任，实际上您使用任何非官方的微信机器人都有可能造成账号封禁，所以请谨慎使用\n8. 如果您阅读了上面的内容，觉得没有问题，那么请继续阅读下面的内容\n\n**功能示例：**\n\n![img](docs/screenshots.jpg)\n\n### 已对接框架\n\n\u003cdetails open\u003e\n\u003csummary\u003e🎁 已接入框架，展开看👇\u003c/summary\u003e\n\n* [x] [Dean DLL](https://gitee.com/qxvxhook/pc-vx-hook-http-api/tree/36018/DaenWxHook) | [👉对接说明文档👀](docs/deandll.md)\n  * 具体配置查看 `config.yaml` 文件注释说明\n  * ![img](docs/deandll.png)\n* [x] [VLW框架](https://github.com/yqchilde/wxbot)\n    * 具体配置查看 `config.yaml` 文件注释说明\n    * ![img](docs/vlw.png)\n\n\u003c/details\u003e\n\n### 已对接API\n\n\u003cdetails\u003e\n\u003csummary\u003e🎁 已对接API，展开看👇\u003c/summary\u003e\n\n```go\n// IFramework 这是接入框架所定义的接口\ntype IFramework interface {\n\t// Callback 这是消息回调方法，vx框架回调消息转发给该Server\n\tCallback(func(*Event, IFramework))\n\n\t// GetMemePictures 获取表情包图片地址(迷因图)\n\t// return: 图片链接(网络URL或图片base64)\n\tGetMemePictures(message *Message) string\n\n\t// SendText 发送文本消息\n\t// toWxId: 好友ID/群ID\n\t// text: 文本内容\n\tSendText(toWxId, text string) error\n\n\t// SendTextAndAt 发送文本消息并@，只有群聊有效\n\t// toGroupWxId: 群ID\n\t// toWxId: 好友ID/群ID/all\n\t// toWxName: 好友昵称/群昵称，留空为自动获取\n\t// text: 文本内容\n\tSendTextAndAt(toGroupWxId, toWxId, toWxName, text string) error\n\n\t// SendImage 发送图片消息\n\t// toWxId: 好友ID/群ID\n\t// path: 图片路径\n\tSendImage(toWxId, path string) error\n\n\t// SendShareLink 发送分享链接消息\n\t// toWxId: 好友ID/群ID\n\t// title: 标题\n\t// desc: 描述\n\t// imageUrl: 图片链接\n\t// jumpUrl: 跳转链接\n\tSendShareLink(toWxId, title, desc, imageUrl, jumpUrl string) error\n\n\t// SendFile 发送文件消息\n\t// toWxId: 好友ID/群ID/公众号ID\n\t// path: 本地文件绝对路径\n\tSendFile(toWxId, path string) error\n\n\t// SendVideo 发送视频消息\n\t// toWxId: 好友ID/群ID/公众号ID\n\t// path: 本地视频文件绝对路径\n\tSendVideo(toWxId, path string) error\n\n\t// SendEmoji 发送表情消息\n\t// toWxId: 好友ID/群ID/公众号ID\n\t// path: 本地动态表情文件绝对路径\n\tSendEmoji(toWxId, path string) error\n\n\t// SendMusic 发送音乐消息\n\t// toWxId: 好友ID/群ID/公众号ID\n\t// name: 音乐名称\n\t// author: 音乐作者\n\t// app: 音乐来源(VLW需留空)，酷狗/wx79f2c4418704b4f8，网易云/wx8dd6ecd81906fd84，QQ音乐/wx5aa333606550dfd5\n\t// jumpUrl: 音乐跳转链接\n\t// musicUrl: 网络歌曲直链\n\t// coverUrl: 封面图片链接\n\tSendMusic(toWxId, name, author, app, jumpUrl, musicUrl, coverUrl string) error\n\n\t// SendMiniProgram 发送小程序消息\n\t// toWxId: 好友ID/群ID/公众号ID\n\t// ghId: 小程序ID\n\t// title: 标题\n\t// content: 内容\n\t// imagePath: 图片路径, 本地图片路径或网络图片URL\n\t// jumpPath: 小程序点击跳转地址，例如：pages/index/index.html\n\tSendMiniProgram(toWxId, ghId, title, content, imagePath, jumpPath string) error\n\n\t// SendMessageRecord 发送消息记录\n\t// toWxId: 好友ID/群ID/公众号ID\n\t// title: 仅供电脑上显示用，手机上的话微信会根据[显示昵称]来自动生成 谁和谁的聊天记录\n\t// dataList:\n\t// \t- wxid: 发送此条消息的人的wxid\n\t// \t- nickName: 显示的昵称(可随意伪造)\n\t// \t- timestamp: 10位时间戳\n\t// \t- msg: 消息内容\n\tSendMessageRecord(toWxId, title string, dataList []map[string]interface{}) error\n\n\t// SendMessageRecordXML 发送消息记录(XML方式)\n\t// toWxId: 好友ID/群ID/公众号ID\n\t// xmlStr: 消息记录XML代码\n\tSendMessageRecordXML(toWxId, xmlStr string) error\n\n\t// SendFavorites 发送收藏消息\n\t// toWxId: 好友ID/群ID/公众号ID\n\t// favoritesId: 收藏夹ID\n\tSendFavorites(toWxId, favoritesId string) error\n\n\t// SendXML 发送XML消息\n\t// toWxId: 好友ID/群ID/公众号ID\n\t// xmlStr: XML代码\n\tSendXML(toWxId, xmlStr string) error\n\n\t// SendBusinessCard 发送名片消息\n\t// toWxId: 好友ID/群ID/公众号ID\n\t// targetWxId: 目标用户ID\n\tSendBusinessCard(toWxId, targetWxId string) error\n\n\t// AgreeFriendVerify 同意好友验证\n\t// v3: 验证V3\n\t// v4: 验证V4\n\t// scene: 验证场景\n\tAgreeFriendVerify(v3, v4, scene string) error\n\n\t// InviteIntoGroup 邀请好友加入群组\n\t// groupWxId: 群ID\n\t// wxId: 好友ID\n\t// typ: 邀请类型，1-直接拉，2-发送邀请链接\n\tInviteIntoGroup(groupWxId, wxId string, typ int) error\n\n\t// GetObjectInfo 获取对象信息\n\t// wxId: 好友ID/群ID/公众号ID\n\t// return: User, error\n\tGetObjectInfo(wxId string) (*User, error)\n\n\t// GetFriends 获取好友列表\n\t// isRefresh: 是否刷新 false-从缓存中获取，true-重新遍历二叉树并刷新缓存\n\t// return: []*User, error\n\tGetFriends(isRefresh bool) ([]*User, error)\n\n\t// GetGroups 获取群组列表\n\t// isRefresh: 是否刷新 false-从缓存中获取，true-重新遍历二叉树并刷新缓存\n\t// return: []*User, error\n\tGetGroups(isRefresh bool) ([]*User, error)\n\n\t// GetGroupMembers 获取群成员列表\n\t// groupWxId: 群ID\n\t// isRefresh: 是否刷新 false-从缓存中获取，true-重新遍历二叉树并刷新缓存\n\t// return: []*User, error\n\tGetGroupMembers(groupWxId string, isRefresh bool) ([]*User, error)\n\n\t// GetMPs 获取公众号订阅列表\n\t// isRefresh: 是否刷新 false-从缓存中获取，true-重新遍历二叉树并刷新缓存\n\t// return: []*User, error\n\tGetMPs(isRefresh bool) ([]*User, error)\n}\n```\n\n\u003c/details\u003e\n\n### 已有插件\n\n\u003cdetails open\u003e\n\u003csummary\u003e🎁 已有插件 👇\u003c/summary\u003e\n\n* [x] [百度百科-点击查看使用说明](plugins/baidubaike)\n    * `import _ \"github.com/yqchilde/wxbot/plugins/baidubaike\"`\n* [x] [ChatGPT聊天-点击查看使用说明](plugins/chatgpt)\n    * `import _ \"github.com/yqchilde/wxbot/plugins/chatgpt\"`\n* [x] [KFC疯狂星期四骚话-点击查看使用说明](plugins/crazykfc)\n    * `import _ \"github.com/yqchilde/wxbot/plugins/crazykfc\"`\n* [x] [获取表情原图-点击查看使用说明](plugins/memepicture)\n    * `import _ \"github.com/yqchilde/wxbot/plugins/memepicture\"`\n* [x] [摸鱼办-点击查看使用说明](plugins/moyuban)\n    * `import _ \"github.com/yqchilde/wxbot/plugins/moyuban\"`\n* [x] [查拼音缩写-点击查看使用说明](plugins/pinyinsuoxie)\n    * `import _ \"github.com/yqchilde/wxbot/plugins/pinyinsuoxie\"`\n* [x] [获取美女图片-点击查看使用说明](plugins/plmm)\n    * `import _ \"github.com/yqchilde/wxbot/plugins/plmm\"`\n* [x] [查天气-点击查看使用说明](plugins/weather)\n    * `import _ \"github.com/yqchilde/wxbot/plugins/weather\"`\n* [x] [获取每日早报-点击查看使用说明](plugins/zaobao)\n    * `import _ \"github.com/yqchilde/wxbot/plugins/zaobao\"`\n* [x] [管理相关-点击查看使用说明](plugins/manager)\n    * `import _ \"github.com/yqchilde/wxbot/plugins/manager\"`\n* [x] [公众号监控转发-点击查看使用说明](plugins/ghmonitor)\n    * `import _ \"github.com/yqchilde/wxbot/plugins/ghmonitor\"`\n* [x] [聊天热词云-点击查看使用说明](plugins/ghmonitor)\n    * `import _ \"github.com/yqchilde/wxbot/plugins/wordcloud\"`\n* [x] [查ID-点击查看使用说明](plugins/chaid)\n  * `import _ \"github.com/yqchilde/wxbot/plugins/chaid\"`\n* [x] [有道翻译-点击查看使用说明](plugins/youdaofanyi)\n  * `import _ \"github.com/yqchilde/wxbot/plugins/youdaofanyi\"`\n* [x] [自动通过好友添加请求-点击查看使用说明](plugins/friendadd)\n  * `import _ \"github.com/yqchilde/wxbot/plugins/friendadd\"`\n* [x] [选择困难症帮手-点击查看使用说明](plugins/choose)\n  * `import _ \"github.com/yqchilde/wxbot/plugins/choose\"`\n* [x] [读取本地图片-点击查看使用说明](plugins/localimage)\n  * `import _ \"github.com/yqchilde/wxbot/plugins/localimage\"`\n* [x] [爬取图片到本地-点击查看使用说明](plugins/localimagespider)\n  * `import _ \"github.com/yqchilde/wxbot/plugins/localimagespider\"`\n\n\u003c/details\u003e\n\n### 指令大全\n\n[点击查看机器人有哪些指令](docs/command.md)\n\n## How to use?\n\n### 本地运行\n\n1. 克隆代码\n\n```bash\ngit clone https://github.com/yqchilde/wxbot.git\n```\n\n2. 配置`config.yaml`\n\n3. 调试运行或编译\n   * 调试运行执行 `go run main.go`\n   * 编译执行 `make release`\n\n### Releases包\n\n1. 去[Releases](https://github.com/yqchilde/wxbot/releases)下载对应系统的编译包，解压后执行二进制文件即可\n\n### Docker运行\n\n1. 方式一：一键脚本启动\n\n```shell\nbash -c \"$(curl -fsSL https://raw.fastgit.org/yqchilde/wxbot/hook/docker/run.sh)\"\n```\n\n2. 方式二：命令启动，注意提前配置`config.yaml`,否则会报错\n```shell\ndocker run -d \\\n  --name=\"wxbot\" \\\n  -p 9528:9528 \\\n  -v $(pwd)/config.yaml:/app/config.yaml \\\n  -v $(pwd)/data:/app/data \\\n  yqchilde/wxbot:latest\n```\n\n### Actions编译\n\n1. 先`fork`本项目\n2. 在 [https://github.com/settings/tokens](https://github.com/settings/tokens) 这里获取一个token用于给actions使用\n3. 给项目添加一个秘钥，名字为`WXBOT_TOKEN`，值为上面获取的token\n4. 自行创建一个tag，如`v1.0.0`，然后等待actions编译完成，编译完成后会在`release`中生成对应的`wxbot`文件\n\n\n## How to develop?\n\n### 制作插件或接入其他框架\n\n🤔如果您想要扩展自己的插件，可以参考`plugins`目录下的插件\n\n🤔如果您想要扩展其他框架，可以参考`frameworks`目录下的框架\n\n🤔如果您需要增减插件，可编辑 [plugins.yaml](plugins.yaml) 中代码中去掉对应插件的导入或者添加对应插件的导入，照猫画虎即可\n\n🔴修改完`plugins.yaml`后需要执行一次`make plugins`或`go generate -tags plugins ./engine/plugins`生成对应的`plugins.go`文件再去编译\n\n```yaml\n- \"github.com/yqchilde/wxbot/plugins/baidubaike\"   # 百度百科\n- \"github.com/yqchilde/wxbot/plugins/chatgpt\"      # GPT聊天\n- \"github.com/yqchilde/wxbot/plugins/crazykfc\"     # 肯德基疯狂星期四骚话\n- \"github.com/yqchilde/wxbot/plugins/ghmonitor\"    # 公众号消息监控转发\n- \"github.com/yqchilde/wxbot/plugins/manager\"      # 群组管理相关\n- \"github.com/yqchilde/wxbot/plugins/memepicture\"  # 表情包原图\n- \"github.com/yqchilde/wxbot/plugins/moyuban\"      # 摸鱼办\n- \"github.com/yqchilde/wxbot/plugins/pinyinsuoxie\" # 拼音缩写翻译\n- \"github.com/yqchilde/wxbot/plugins/plmm\"         # 漂亮妹妹\n- \"github.com/yqchilde/wxbot/plugins/weather\"      # 天气查询\n- \"github.com/yqchilde/wxbot/plugins/zaobao\"       # 每日早报\n- \"github.com/yqchilde/wxbot/plugins/wordcloud\"    # 聊天热词\n- \"github.com/yqchilde/wxbot/plugins/chaid\"        # 查wxId\n- \"github.com/yqchilde/wxbot/plugins/youdaofanyi\"  # 有道翻译\n```\n\n### 参考案例\n\n[查看更多使用案例](examples)\n\n### 调试-环境变量\n\n| 环境变量名 | 变量类型 | 说明                                                         |\n| ---------- | -------- | ------------------------------------------------------------ |\n| DEBUG      | bool     | 优先级大于其他`DEBUG_`开头的变量，开启后开启所有DEBUG模式\u003cbr /\u003e用于调试HTTP请求和调用日志文件名和行号 |\n| DEBUG_LOG  | bool     | 用于调试调用日志文件名和行号                                 |\n\n### 提交Pr注意项\n\n1. import包时顺序要规范，先import标准库，再import第三方库，最后import自己的库，例如：\n```go\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"strings\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/PullRequestInc/go-gpt3\"\n\n\t\"github.com/yqchilde/wxbot/engine/control\"\n\t\"github.com/yqchilde/wxbot/engine/pkg/log\"\n\t\"github.com/yqchilde/wxbot/engine/pkg/sqlite\"\n\t\"github.com/yqchilde/wxbot/engine/robot\"\n)\n```\n\n2. 若提交的是`插件`，请在`plugins.yaml`中添加对应的插件\n3. 若提交的是`插件`，请在`README.md`中已有插件部分添加对应的插件\n4. 若提交的是`插件`，请在`plugins/README.md`中添加对应的插件\n5. 提交代码请先`make plugins` 或 `go generate -tags plugins ./engine/plugins` 生成对应的`plugins.go`文件\n\n## Feature\n\n开发计划：[🕒 开发计划](https://github.com/users/yqchilde/projects/2)  \n如果您感觉这个项目有意思，麻烦帮我点一下star  \n这个项目待(不)补(完)充(善)很多东西，由于工作关系会抽出时间弄，感谢您发现并使用此仓库\n\n如果您有疑惑可以加Q群讨论\n\n\u003cimg src=\"docs/qq.jpg\" width=30%\u003e\n\n## 打个广告\n\n* [ChatGPT成品账号](https://ka.closeai.me)\n\n## Thanks\n\n### JetBrains 开源证书支持\n\n`yqchilde/wxbot` 项目一直以来都是在 JetBrains 公司旗下的 GoLand 集成开发环境中进行开发，基于 **free JetBrains Open Source license(s)** 正版免费授权，在此表达我的谢意。\n\n\u003ca href=\"https://www.jetbrains.com/?from=yqchilde/wxbot\" target=\"_blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/panjf2000/illustrations/master/jetbrains/jetbrains-variant-4.png\" width=\"200\" align=\"middle\"/\u003e\u003c/a\u003e\n\n### 开源项目\n\n* 非Hook版机器人核心由 [openwechat](https://github.com/eatmoreapple/openwechat) SDK实现，在`nohook`分支，已暂停维护\n\n* Hook版机器人框架我使用的是 ~~《我的框架》已跑路~~，现在用的是~~千寻~~，Dean DLL，为hook分支\n\n* hook分支大量借鉴了一个十分优秀的项目`ZeroBot-Plugin`的设计方案 👍🏻，其中很多基础代码来自`ZeroBot-Plugin`，在此基础上扩展了支持`wechat`的方式，非常感谢，Thanks♪(･ω･)ﾉ\n\n## License\n\nAGPL-3.0 license. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyqchilde%2Fwxbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyqchilde%2Fwxbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyqchilde%2Fwxbot/lists"}