{"id":15015827,"url":"https://github.com/hexsum/mojo-weixin","last_synced_at":"2025-12-12T02:45:53.025Z","repository":{"id":56833493,"uuid":"49632852","full_name":"hexsum/Mojo-Weixin","owner":"hexsum","description":"使用Perl语言（不会没关系）编写的个人账号微信/weixin/wechat客户端框架（非GUI），可通过插件提供基于HTTP协议的api接口供其他语言或系统调用","archived":false,"fork":false,"pushed_at":"2023-09-19T02:36:05.000Z","size":2062,"stargazers_count":1243,"open_issues_count":19,"forks_count":255,"subscribers_count":93,"default_branch":"master","last_synced_at":"2025-04-05T16:01:46.517Z","etag":null,"topics":["api","bot","chat","chatbot","cli","docker","irc","mojo","perl","wechat","weixin","weixinbot"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hexsum.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","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}},"created_at":"2016-01-14T08:18:48.000Z","updated_at":"2025-04-01T22:15:22.000Z","dependencies_parsed_at":"2024-01-14T11:07:37.983Z","dependency_job_id":null,"html_url":"https://github.com/hexsum/Mojo-Weixin","commit_stats":null,"previous_names":["sjdy521/mojo-weixin"],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexsum%2FMojo-Weixin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexsum%2FMojo-Weixin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexsum%2FMojo-Weixin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexsum%2FMojo-Weixin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hexsum","download_url":"https://codeload.github.com/hexsum/Mojo-Weixin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247829491,"owners_count":21002995,"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":["api","bot","chat","chatbot","cli","docker","irc","mojo","perl","wechat","weixin","weixinbot"],"created_at":"2024-09-24T19:48:00.604Z","updated_at":"2025-12-12T02:45:52.957Z","avatar_url":"https://github.com/hexsum.png","language":"Perl","readme":"Mojo-Weixin v1.4.6 [![Build Status](https://travis-ci.org/sjdy521/Mojo-Weixin.svg?branch=master)](https://travis-ci.org/sjdy521/Mojo-Weixin) [![API列表](https://img.shields.io/badge/doc-API%E5%88%97%E8%A1%A8-brightgreen.svg)](API.md) [![QQ群-498880156](https://img.shields.io/badge/QQ%E7%BE%A4-498880156-blue.svg)](http://jq.qq.com/?_wv=1027\u0026k=kjVJzo) [![IRC](https://img.shields.io/badge/IRC-%E5%AE%98%E6%96%B9%E9%A2%91%E9%81%93-yellow.svg)](http://irc.perfi.wang/?channel=#Mojo-Webqq)\n[![LICENSE](https://img.shields.io/badge/license-Anti%20996-blue.svg)](https://github.com/996icu/996.ICU/blob/master/LICENSE)\n========================\n\n使用Perl语言编写的微信客户端框架，基于Mojolicious，要求Perl版本5.10+，可通过插件提供基于HTTP协议的api接口供其他语言或系统调用\n\n### 郑重声明\n\n本项目完全遵循微信官方提供的原始功能，不包含任何破坏、盗号等行为，本项目完全开源，目的是为了促进技术交流学习，禁止任何对国家、企业、个人等构成危害的非法用途，否则后果自负\n\n### 特色功能\n\n* 支持 发送/接收文字、图片、视频、语音、表情、文件等多种媒体消息（网页版自身功能范围）\n* 支持 新增/失去好友、新增/退出群组、新增/失去群成员 等事件提醒\n* 支持 创建群组、群组加人/踢人、发送/接受好友验证申请、设置群组名称、设置好友备注\n* 支持 Windows/Linux/Mac 多平台，支持docker镜像，易安装部署，不懂Perl也能用\n* 提供 基于HTTP协议的API接口 ，简洁丰富，方便和其他编程语言集成\n* 一个产品经理的倾情之作，代码由内而外都更加注重“用户体验”，外加主人人品极好，你会懂的\n\n### 插件列表\n\n|名称                | 优先级  |当前状态    |github作者   | 功能说明                 \n|:-------------------|:--------|:-----------|:------------|:----------------------------\n|[ShowMsg](https://metacpan.org/pod/distribution/Mojo-Weixin/lib/Mojo/Weixin.pod#Mojo::Weixin::Plugin::ShowMsg)             |100      |已发布      |sjdy521      |打印客户端接收和发送的消息\n|[IRCShell](https://metacpan.org/pod/distribution/Mojo-Weixin/lib/Mojo/Weixin.pod#Mojo::Weixin::Plugin::IRCShell)            |99       |已发布      |sjdy521      |Linux环境下通过irc客户端使用微信\n|[Openwx](https://metacpan.org/pod/distribution/Mojo-Weixin/lib/Mojo/Weixin.pod#Mojo::Weixin::Plugin::Openwx)              |98       |已发布      |sjdy521      |提供微信发送消息api接口\n|[Beauty](https://metacpan.org/pod/distribution/Mojo-Weixin/lib/Mojo/Weixin.pod#Mojo::Weixin::Plugin::Beauty)              |95       |已发布      |sjdy521      |识别指定关键字发送美女图片\n|[Translation](https://metacpan.org/pod/distribution/Mojo-Weixin/lib/Mojo/Weixin.pod#Mojo::Weixin::Plugin::Translation)         |93       |已发布      |sjdy521      |多国语言翻译功能\n|[KnowledgeBase](https://metacpan.org/pod/distribution/Mojo-Weixin/lib/Mojo/Weixin.pod#Mojo::Weixin::Plugin::KnowledgeBase)       |2        |已发布      |sjdy521      | 通过微信消息自定义问答知识库\n|[AutoVerify](https://metacpan.org/pod/distribution/Mojo-Weixin/lib/Mojo/Weixin.pod#Mojo::Weixin::Plugin::AutoVerify)          |1        |已发布      |sjdy521      |收到好友验证请求时自动批准同意\n|[PostQRcode](https://metacpan.org/pod/distribution/Mojo-Weixin/lib/Mojo/Weixin.pod#Mojo::Weixin::Plugin::PostQRcode)          |0        |已发布      |sjdy521      |登录二维码发送到邮箱实现远程扫码\n|[UploadQRcode](https://metacpan.org/pod/distribution/Mojo-Weixin/lib/Mojo/Weixin.pod#Mojo::Weixin::Plugin::UploadQRcode)          |0        |已发布      |sjdy521      |二维码上传图床获得公网访问url\n|[XiaoiceReply](https://metacpan.org/pod/distribution/Mojo-Weixin/lib/Mojo/Weixin.pod#Mojo::Weixin::Plugin::XiaoiceReply)        |1        |已发布      |sjdy521      |利用微软小冰实现智能聊天回复\n|[ShowQRcode](https://metacpan.org/pod/distribution/Mojo-Weixin/doc/Weixin.pod#Mojo::Weixin::Plugin::ShowQRcode)          |0        |已发布      |sjdy521  |调用系统图片查看程序来示二维码（目前仅支持win）\n|[SmartReply](https://metacpan.org/pod/distribution/Mojo-Weixin/lib/Mojo/Weixin.pod#Mojo::Weixin::Plugin::SmartReply)          |0        |已发布      |sjdy521      |智能聊天回复\n\n更多插件参考[完整插件列表](Plugin.md)\n\n### 效果展示\n\n敲一行命令就能启动一个智能聊天机器人，Perl 和你都如此优雅. Enjoy!\n\n    cpanm Mojo::Weixin \u0026\u0026 perl -MMojo::Weixin -e \"Mojo::Weixin-\u003enew-\u003eload('ShowMsg')-\u003eload('SmartReply')-\u003erun()\"\n    \n```\n[16/01/19 23:10:49] [info] 客户端准备登录...\n[16/01/19 23:10:50] [info] 清除残留的历史二维码图片\n[16/01/19 23:10:30] [info] 二维码已下载到本地[ /tmp/mojo_weixin_qrcode.jpg ]\n[16/01/19 23:11:20] [info] 等待手机微信扫描二维码...\n[16/01/19 23:12:09] [info] 手机微信扫码成功，请在手机微信上点击 [登录] 按钮...\n[16/01/19 23:12:10] [info] 正在进行登录...\n[16/01/19 23:12:10] [info] 微信登录成功\n[16/01/19 23:13:40] [info] 获取联系人信息...\n[16/01/19 23:13:40] [info] 更新个人信息成功\n[16/01/19 23:14:41] [info] 更新好友信息成功\n[16/01/19 23:15:42] [info] 更新群组[ 红包群 ]信息成功\n[16/01/19 23:15:42] [info] 更新群组[ Perl语言交流 ]信息成功\n[16/01/19 23:15:42] [info] 开始接收消息...\n[16/01/19 23:15:00] [群消息] 小灰|Perl语言交流 : Mojo::Weixin不错哦\n[16/01/19 23:15:58] [群消息] 我-\u003ePerl语言交流 : 多谢多谢\n```\n#### 通过irc客户端在linux终端上使用微信\n\n```\n    +-------------------+                      +----------------+  \n    |  Tencent          |                      | Any IRC Client |\n    |  Weixin Server    |                      | wechat、irssi  |\n    +---v-------------^-+                      +-v------------^-+     \n        |             |                          |            |\n        | 微信协议交互|                          |IRC协议交互 |\n+-- --- |--  - -  --  | - - -   --   -  -   ---  | ---  ----- | --+\n|   +---v-------------^--+                  +----v------------^-+ |   \n|   |                    \u003c——————————————————\u003c                   | |\n|   |   Weixin  Client   |  Weixin - IRC    |  IRC Server       | |\n|   |                    |     协议转换     |  监听本机6667端口 | |\n|   |                    \u003e——————————————————\u003e                   | | \n|   +--------------------+                  +-------------------+ |\n|                                                                 |\n|                                       我们程序实现的部分        | \n+---  - - - -  -- - --  ----  ------  -------  ------  ---    ----+\n\n```\n\n![IRCShell](screenshot/IRCShell.jpg)\n\n#### 更多应用效果 请参见[Mojo-Weixin作品展](Collection.md)\n\n### 安装方法\n\n推荐使用[cpanm](https://metacpan.org/pod/distribution/App-cpanminus/bin/cpanm)在线安装[Mojo::Weixin](https://metacpan.org/pod/distribution/Mojo-Weixin/doc/Weixin.pod)模块, 如果使用docker方式请参见[Docker镜像安装及使用方法](Docker.md)\n\n1. *安装perl*\n  \n    安装之前请先确认下你的系统是否已经安装了Perl，因为除了windows，其他大部分的平台默认都可能已经预装过\n\n    并且你的Perl版本至少5.10.1+，推荐5.14+\n\n    [Perl官网下载页面](https://www.perl.org/get.html) 有包含Unix/Linux、Mac OS X、Windows多平台比较全面详细的安装说明\n\n    建议大家尽量选择**Binaries**（二进制预编译）的版本，安装即可使用，比较方便\n\n    Linux上如果你的perl版本较低，想要升级perl，可以考虑使用工具[perlbrew](https://perlbrew.pl/)\n\n    |平台    |推荐选择  |下载地址         |\n    |:-------|:--------|:---------------|\n    |Windows |1. **StrawberryPerl**\u003cbr\u003e2. ActivePerl\u003cbr\u003e3. **Mojo-StrawberryPerl**|[StrawberryPerl下载地址](http://strawberryperl.com/)\u003cbr\u003e[Mojo-StrawberryPerl下载地址](https://github.com/sjdy521/Mojo-StrawberryPerl)\u003cbr\u003e[ActivePerl下载地址](http://www.activestate.com/activeperl/downloads)\u003cbr\u003e|\n    |Linux   |1. **系统自带**\u003cbr\u003e2. **yum/apt等包管理器**\u003cbr\u003e3. 官方源码编译\u003cbr\u003e4. ActivePerl\u003cbr\u003e5. DWIM-Perl|[ActivePerl下载地址](http://www.activestate.com/activeperl/downloads)\u003cbr\u003e[DWIM-Perl下载地址](http://dwimperl.com/linux.html)|\n    |Mac     |1. **系统自带**\u003cbr\u003e2. ActivePerl|[ActivePerl下载地址](http://www.activestate.com/activeperl/downloads)|\n  \n    注意：\n    \n    [Mojo-StrawberryPerl](https://github.com/sjdy521/Mojo-StrawberryPerl)是基于StrawberryPerl精简打包而成，适用于windows 32位/64位系统\n\n2. *安装cpanm工具*（如果系统已经安装了cpanm可以忽略此步骤）\n\n    方法a： 通过cpan安装cpanm（只适用于root用户）\n\n        $ cpan -i App::cpanminus\n    \n    方法b： 直接在线安装cpanm\n\n        $ curl -kL http://cpanmin.us | perl - App::cpanminus\n\n        官方服务器在国外，如果无法访问，可以选择下面的命令：\n        \n        $ curl http://share-10066126.cos.myqcloud.com/cpanm.pl|perl - App::cpanminus\n\n2. *使用cpanm在线安装 Mojo::Weixin 模块*（如果系统已经安装了该模块，执行此步骤会对模块进行升级）\n\n        $ cpanm Mojo::Weixin\n    \n    如果安装过程中一直提示下载失败，很可能是因为访问到国外服务器网络比较差\n    \n    这种情况下可以尝试按如下方式手动指定国内的镜像站点\n    \n        $ cpanm --mirror http://mirrors.163.com/cpan/ Mojo::Weixin\n\n3. *安装失败可能有帮助的解决方法*\n        \n    如果你运气不佳，通过cpanm没有一次性安装成功，这里提供了一些可能有用的信息\n\n    在安装 Mojo::Weixin 的过程中，cpan或者cpanm会帮助我们自动安装很多其他的依赖模块\n    \n    在众多的依赖模块中，安装经常容易出现问题的主要是 IO::Socket::SSL\n    \n    IO::Socket::SSL 主要提供了 https 支持，在安装过程中可能会涉及到SSL相关库的编译\n\n    对于 Linux 用户，通常采用的是编译安装的方式，系统缺少编译安装必要的环境，则会导致编译失败\n    \n    对于 Windows 用户，由于不具备良好的编译安装环境，推荐采用一些已经打包比较全面的Perl运行环境\n    \n    例如比较流行的 strawberryperl 或者 activeperl 的最新版本都默认包含 Mojo::Weixin 的核心依赖模块\n\n    RedHat/Centos:\n\n        $ yum install -y openssl-devel\n        \n    Ubuntu:\n\n        $ sudo apt-get install libssl-dev\n    \n    搞定了编译和运行环境之后，再重新回到 步骤2 安装Mojo::Weixin即可\n    \n    请尽量在root下安装使用，非root下安装使用参考[FAQ](https://github.com/sjdy521/Mojo-Weixin/blob/master/FAQ.md#5-%E9%9D%9Eroot%E8%B4%A6%E5%8F%B7%E5%AE%89%E8%A3%85%E5%90%8E%E6%97%A0%E6%B3%95%E4%BD%BF%E7%94%A8%E9%97%AE%E9%A2%98)\n    \n    如果仍然有问题，Linux上可以尝试执行如下脚本进行依赖模块检查\n    \n        $ curl -ks \"https://raw.githubusercontent.com/sjdy521/Mojo-Weixin/master/script/check_dependencies.pl\"|perl -\n        \n\n### 如何使用\n\n1. *我对Perl很熟悉，是一个专业的Perler*\n\n    该项目是一个纯粹的Perl模块，已经发布到了cpan上，请仔细阅读 `Mojo::Weixin` 模块的[使用文档](https://metacpan.org/pod/distribution/Mojo-Weixin/doc/Weixin.pod)\n\n    除此之外，你可以看下 [demo](https://github.com/sjdy521/Mojo-Weixin/tree/master/demo) 目录下的更多代码示例\n\n2. *我是对Perl不熟悉，是一个其他语言的开发者，只对提供的消息发送/接收接口感兴趣*\n\n    可以直接把如下代码保存成一个源码文件(必须使用UTF8编码)，使用 perl 解释器来运行\n    \n        #!/usr/bin/env perl\n        use Mojo::Weixin;\n        my ($host,$port,$post_api);\n        \n        $host = \"0.0.0.0\"; #发送消息接口监听地址，没有特殊需要请不要修改\n        $port = 3000;      #发送消息接口监听端口，修改为自己希望监听的端口\n        #$post_api = 'http://xxxx';  #接收到的消息上报接口，如果不需要接收消息上报，可以删除或注释此行\n        \n        my $client = Mojo::Weixin-\u003enew(log_level=\u003e\"info\",http_debug=\u003e0);\n        $client-\u003eload(\"ShowMsg\");\n        $client-\u003eload(\"Openwx\",data=\u003e{listen=\u003e[{host=\u003e$host,port=\u003e$port}], post_api=\u003e$post_api});\n        $client-\u003erun();\n    \n    上述代码保存成 xxxx.pl 文件，然后使用 perl 来运行，就会完成 微信 登录并在本机产生一个监听指定地址端口的 http server\n    \n        $ perl xxxx.pl\n    \n    发送好友消息的接口调用示例\n    \n        http://127.0.0.1:3000/openwx/send_friend_message?id=xxxx\u0026content=hello\n        \n        * About to connect() to 127.0.0.1 port 3000 (#0)\n        *   Trying 127.0.0.1...\n        * Connected to 127.0.0.1 (127.0.0.1) port 3000 (#0)\n        \u003e GET /openwx/send_friend_message?id=xxxxx\u0026content=hello HTTP/1.1\n        \u003e User-Agent: curl/7.29.0\n        \u003e Host: 127.0.0.1:3000\n        \u003e Accept: */*\n        \u003e \n        \u003c HTTP/1.1 200 OK\n        \u003c Content-Type: application/json;charset=UTF-8\n        \u003c Date: Sun, 13 Dec 2015 04:54:38 GMT\n        \u003c Content-Length: 52\n        \u003c Server: Mojolicious (Perl)\n        \u003c\n        * Connection #0 to host 127.0.0.1 left intact\n        \n        {\"status\":\"发送成功\",\"id\":23910327,\"code\":0}\n    \n    更多接口参数说明参考[Openwx插件API文档](API.md)\n    \n3.  *我是一个极客，我只想能够在命令行上通过  IRC 的方式来玩转微信聊天*\n\n    请阅读[IRCShell插件使用步骤](IRC.md)\n    \n### 核心依赖模块\n\n* [Mojolicious](https://metacpan.org/pod/Mojolicious)\n* [Encode::Locale](https://metacpan.org/pod/Encode::Locale)\n\n### 相关文档\n\n* [更新日志](Changes)\n* [开发\u0026配置文档](doc/Weixin.pod)\n* [基于HTTP的API文档](API.md)\n* [FAQ](FAQ.md)\n\n### 官方交流\n\n* [QQ群](http://jq.qq.com/?_wv=1027\u0026k=kjVJzo)\n* [IRC](http://irc.perfi.wang/?channel=#Mojo-Webqq)\n\n### 友情链接\n\n*JavaScript*\n\n* [wechaty](https://github.com/zixia/wechaty) Wechaty is wechat for bot in Javascript(ES6). It's a Personal Account Robot Framework/Library.\n* [wechatircd](https://github.com/MaskRay/wechatircd) 用IRC客户端控制微信网页版\n* [Weixinbot](https://github.com/feit/Weixinbot) Nodejs 封装网页版微信的接口，可编程控制微信消息\n\n*Python*\n* [WeixinBot](https://github.com/Urinx/WeixinBot) 网页版微信API，包含终端版微信及微信机器人\n* [ItChat](https://github.com/littlecodersh/ItChat) 微信个人号接口、微信机器人及命令行微信。三十行即可自定义个人号机器人\n\n*Java*\n* [wechat-client](https://github.com/dadiyang/wechat-client) Mojo-Weixin HTTP 接口 的 Java 客户端，非常感谢 @dadiyang 贡献\n\n### 赞助奖励\n\n可以通过扫描支付宝付款二维码进行赞助，感谢您的支持和鼓励\n\n![donate](screenshot/donate.jpg)\n\n特别致谢 [那些曾经赞助的小伙伴们](https://github.com/sjdy521/Mojo-Thanks)\n\n### COPYRIGHT 和 LICENCE\n\nCopyright (C) 2014 by sjdy521\n\nThis library is free software; you can redistribute it and/or modify it under [MIT License](LICENSE) and [Anti 996 License](LICENSE.996ICU)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexsum%2Fmojo-weixin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexsum%2Fmojo-weixin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexsum%2Fmojo-weixin/lists"}