{"id":17637862,"url":"https://github.com/liangjfblue/wxbot4g","last_synced_at":"2025-05-05T23:25:08.689Z","repository":{"id":40291619,"uuid":"217054790","full_name":"liangjfblue/wxBot4g","owner":"liangjfblue","description":"wxBot4g 是基于go的微信机器人","archived":false,"fork":false,"pushed_at":"2023-02-09T20:37:37.000Z","size":54,"stargazers_count":31,"open_issues_count":4,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T12:13:51.565Z","etag":null,"topics":["bot","gin","golang","wechat"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liangjfblue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-10-23T12:43:39.000Z","updated_at":"2025-04-07T14:09:02.000Z","dependencies_parsed_at":"2024-06-20T01:32:49.720Z","dependency_job_id":"417f4d52-5293-429c-97c9-6f87653f4e02","html_url":"https://github.com/liangjfblue/wxBot4g","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liangjfblue%2FwxBot4g","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liangjfblue%2FwxBot4g/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liangjfblue%2FwxBot4g/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liangjfblue%2FwxBot4g/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liangjfblue","download_url":"https://codeload.github.com/liangjfblue/wxBot4g/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252591726,"owners_count":21773138,"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":["bot","gin","golang","wechat"],"created_at":"2024-10-23T03:06:25.973Z","updated_at":"2025-05-05T23:25:08.668Z","avatar_url":"https://github.com/liangjfblue.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"wxBot4g 是基于go的微信机器人\n\n## 技术\n- gin（http框架）\n- cron（定时任务）\n- etree（解析xml）\n- viper（配置文件读取）\n- logrus（日志框架）\n- go-qrcode（登陆二维码生成）\n\n## 目前支持的消息类型\n### 好友消息\n- [x] 文本\n- [x] 图片\n- [x] 地理位置\n- [x] 个人名片\n- [x] 语音\n- [x] 小视频\n- [ ] 动画\n\n### 群消息\n- [x] 文本\n- [x] 图片\n- [x] 地理位置\n- [x] 个人名片\n- [x] 语音\n- [ ] 动画\n\n### TODO功能\n- [x] 提供restful api，发送消息到指定好友/群\n- [ ] 文件/图片上传阿里云oss\n- [ ] 监听指定群报警\n- [ ] 聊天记录中文分析，情感分析\n\n## 使用例子\n\n24行代码就实现微信机器人的监听消息功能\n\n```\npackage main\n\nimport (\n    \"wxBot4g/models\"\n    \"wxBot4g/pkg/define\"\n    \"wxBot4g/wcbot\"\n\n    \"github.com/sirupsen/logrus\"\n)\n\nfunc HandleMsg(msg models.RealRecvMsg) {\n    logrus.Debug(\"MsgType: \", msg.MsgType, \" \", \" MsgTypeId: \", msg.MsgTypeId)\n    logrus.Info(\n        \"消息类型:\", define.MsgIdString(msg.MsgType), \" \",\n        \"数据类型:\", define.MsgTypeIdString(msg.MsgTypeId), \" \",\n        \"发送人:\", msg.SendMsgUSer.Name, \" \",\n        \"内容:\", msg.Content.Data)\n}\n\nfunc main() {\n    bot := wcbot.New(HandleMsg)\n    bot.Debug = true\n    bot.Run()\n}\n```\n\n## 消息类型和数据类型\n\n### MsgType（消息类型）\n\n| 数据类型编号 | 数据类型   | 说明                 |\n| ------------ | ---------- | -------------------- |\n| 0            | Init       | 初始化消息，内部数据 |\n| 1            | Self       | 自己发送的消息       |\n| 2            | FileHelper | 文件消息             |\n| 3            | Group      | 群消息               |\n| 4            | Contact    | 联系人消息           |\n| 5            | Public     | 公众号消息           |\n| 6            | Special    | 特殊账号消息         |\n| 51           | 获取wxid   | 获取wxid消息         |\n| 99           | Unknown    | 未知账号消息         |\n\n### MsgTypeId（数据类型）\n\n| 数据类型编号 | 数据类型  | 说明                                                         |\n| ------------ | --------- | ------------------------------------------------------------ |\n| 0            | Text      | 文本消息的具体内容                                           |\n| 1            | Location  | 地理位置                                                     |\n| 3            | Image     | 图片数据的url，HTTP POST请求此url可以得到jpg文件格式的数据   |\n| 4            | Voice     | 语音数据的url，HTTP POST请求此url可以得到mp3文件格式的数据   |\n| 5            | Recommend | 包含 nickname (昵称)， alias (别名)，province (省份)，city (城市)， gender (性别)字段 |\n| 6            | Animation | 动画url, HTTP POST请求此url可以得到gif文件格式的数据         |\n| 7            | Share     | 字典，包含 type (类型)，title (标题)，desc (描述)，url (链接)，from (源网站)字段 |\n| 8            | Video     | 视频，未支持                                                 |\n| 9            | VideoCall | 视频电话，未支持                                             |\n| 10           | Redraw    | 撤回消息                                                     |\n| 11           | Empty     | 内容，未支持                                                 |\n| 99           | Unknown   | 未支持                                                       |\n\n## 功能api\n\n### 发送文本消息(好友/群)\n\n```\nhttp://127.0.0.1:7788/v1/msg/text?to=测试群\u0026word=你好, 测试一下\u0026appKey=khr1244o1oh\n```\n\n### 发送图片消息(好友/群)\n\n请参考`wxBot4g/wcbot/imageHandle_test.go`\n\nv1.1\n\n- 增加终端二维码扫码登录\n- 增加api，发送文本、图片消息到指定群\n- 增加单元测试","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliangjfblue%2Fwxbot4g","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliangjfblue%2Fwxbot4g","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliangjfblue%2Fwxbot4g/lists"}