Smartqq client framework written in Perl language, based on Mojolicious, requires Perl version 5.10+, and can provide an API interface based on HTTP protocol through plug-ins for other languages or systems to call
This project fully follows the original functions provided by QQ official, and does not include any acts of sabotage, account theft, etc. This project is completely open source. The purpose is to promote technical exchange and learning. Any illegal use that is harmful to the country, enterprises, individuals, etc. is prohibited, otherwise there will be consequences conceited
name | priority | Current status | github author | Function description |
---|---|---|---|---|
ShowMsg | 100 | Published | sjdy521 | Print messages received and sent by the client |
GroupManage | 100 | Published | sjdy521 | Group management, welcome to join the group, limit the frequency of posting pictures, etc. |
IRCShell | 99 | Published | sjdy521 | Using qq through irc client in Linux environment |
Openqq | 98 | Published | sjdy521 | Provides QQ message sending API interface |
Perlcode | 97 | Published | sjdy521 | Execute perl code through qq message |
Perldoc | 96 | Published | sjdy521 | Query perl documents through qq messages |
Translation | 93 | Published | sjdy521 | Multi-language translation function |
KnowledgeBase | 3 | Published | sjdy521 | Customizable editable Q&A knowledge base |
Qiandao | 1 | Published | sjdy521 | QQ group daily check-in |
PostQRcode | 0 | Published | sjdy521 | Log in QR code and send it to your email for remote scanning. |
UploadQRcode | 0 | Published | sjdy521 | Upload the QR code to the image bed to obtain the public network access URL |
ShowQRcode | 0 | Published | autodataming | Call the system image viewing program to display the QR code (currently only supports win) |
SmartReply | 0 | Published | sjdy521 | Smart chat reply |
For more plug-ins, refer to the complete plug-in list
Just type a single command to start an intelligent chatbot, both Perl and you are so elegant. Enjoy!
cpanm Mojo::Webqq && perl -MMojo::Webqq -e "Mojo::Webqq->new->load('ShowMsg')->load('SmartReply')->run()"
[15/09/30 15:11:59] [info] 初始化 smartqq 客户端参数...
[15/09/30 15:11:59] [info] 检查验证码...
[15/09/30 15:11:59] [info] 检查结果: 很幸运,本次登录不需要验证码
[15/09/30 15:11:59] [info] 正在获取登录二维码...
[15/09/30 15:11:59] [info] 二维码已下载到本地[ /tmp/mojo_webqq_qrcode_xxx.png ]
[15/09/30 15:12:00] [info] 登录二维码已经发送到邮箱: ******
[15/09/30 15:12:00] [info] 等待手机QQ扫描二维码...
[15/09/30 15:12:43] [info] 手机QQ扫码成功,请在手机上点击[允许登录smartQQ]按钮...
[15/09/30 15:12:46] [info] 检查安全代码...
[15/09/30 15:12:47] [info] 设置登录验证参数...
[15/09/30 15:12:47] [info] 尝试进行登录(2)...
[15/09/30 15:12:47] [info] 登录成功
[15/09/30 15:12:47] [info] 更新个人信息...
[15/09/30 15:12:47] [info] 更新好友信息...
[15/09/30 15:12:47] [info] 更新[ PERL学习交流 ]信息
[15/09/30 15:12:52] [info] 更新[ Mojolicious ]信息
[15/09/30 15:12:55] [info] 开始接收消息...
[15/09/30 14:09:20] [群消息] 小灰|PERL学习交流 : Mojo::Webqq不错哦
[15/09/30 14:10:20] [群消息] 我->PERL学习交流 : 多谢多谢
+-------------------+ +----------------+
| Tencent | | Any IRC Client |
| SmartQQ Server | | wechat、irssi |
+---v-------------^-+ +-v------------^-+
| | | |
| QQ协议交互 | |IRC协议交互 |
+-- --- |-- - - -- | - - - -- - - --- | --- ----- | --+
| +---v-------------^--+ +----v------------^-+ |
| | <——————————————————< | |
| | SmartQQ Client | QQ - IRC | IRC Server | |
| | | 协议转换 | 监听本机6667端口 | |
| | >——————————————————> | |
| +--------------------+ +-------------------+ |
| |
| 我们程序实现的部分 |
+--- - - - - -- - -- ---- ------ ------- ------ --- ----+
It is recommended to use cpanm to install or upgrade the Mojo::Webqq module online. If you use docker, please see Docker image installation and usage.
Install perl
Before installation, please confirm whether Perl is already installed on your system, because except for Windows, most other platforms may have it pre-installed by default.
And your Perl version is at least 5.10.1+, 5.14+ is recommended
The Perl official website download page contains relatively comprehensive and detailed installation instructions for Unix/Linux, Mac OS X, and Windows multiple platforms.
It is recommended that you try to choose the Binaries (binary pre-compiled) version, which can be used immediately after installation, which is more convenient.
platform | Recommended choice | Download address |
---|---|---|
Windows | 1. StrawberryPerl 2. ActivePerl 3. Mojo-StrawberryPerl | StrawberryPerl download address Mojo-StrawberryPerl download address ActivePerl download address |
Linux | 1. Comes with the system 2. Package managers such as yum/apt 3. Official source code compilation 4. ActivePerl 5. DWIM-Perl | ActivePerl download address DWIM-Perl download address |
Mac | 1. The system comes with 2. ActivePerl | ActivePerl download address |
Notice:
Mojo-StrawberryPerl is streamlined and packaged based on StrawberryPerl and is suitable for Windows 32-bit/64-bit systems.
Install the cpanm package management tool (you can ignore this step if cpanm is already installed on the system)
Method a: Install cpanm via cpan
$ cpan -i App::cpanminus
Method b: Install cpanm directly online
$ curl -kL https://cpanmin.us | perl - App::cpanminus
官方服务器在国外,如果无法访问,可以选择下面的命令:
$ curl http://share-10066126.cos.myqcloud.com/cpanm.pl|perl - App::cpanminus
Use cpanm to install the Mojo::Webqq module online (if the system has already installed the module, performing this step will upgrade the module)
$ cpanm Mojo::Webqq
If it keeps prompting that the download failed during the installation process, it is probably because the network access to the foreign server is poor.
In this case, you can try to manually specify the domestic mirror site as follows:
$ cpanm --mirror http://mirrors.163.com/cpan/ Mojo::Webqq
Installation failed solutions that may help
If you're unlucky and don't get a first-time installation via cpanm, here's some information that might be helpful
During the installation of Mojo::Webqq, cpan or cpanm will help us automatically install many other dependent modules
Among the many dependent modules, the one that is often prone to installation problems is IO::Socket::SSL.
IO::Socket::SSL mainly provides https support. The installation process may involve the compilation of SSL related libraries.
For Linux users, compilation and installation are usually used. If the system lacks the necessary environment for compilation and installation, compilation will fail.
For Windows users, since there is no good compilation and installation environment, it is recommended to use some Perl running environments that have been packaged more comprehensively.
For example, the latest versions of the more popular strawberryperl or activeperl include the core dependency module of Mojo::Webqq by default.
RedHat/Centos:
$ yum install -y openssl-devel
Ubuntu:
$ sudo apt-get install libssl-dev
After fixing the compilation and running environment, go back to step 2 and install Mojo::Webqq.
Please try to install and use it under root. For installation and use under non-root, please refer to FAQ.
If you still have problems, you can try executing the following script on Linux to check dependent modules
$ curl -ks "https://raw.githubusercontent.com/sjdy521/Mojo-Webqq/master/script/check_dependencies.pl"|perl -
I am very familiar with Perl and am a professional Perler
This project is a pure Perl module that has been released to cpan. Please read the usage documentation of Mojo::Weqq
module carefully.
In addition, you can check out more code examples in the demo directory
I am not familiar with Perl and am a developer of other languages. I am only interested in the message sending/receiving interface provided.
You can directly save the following code into a source code file (must be UTF-8 encoded) and use the perl interpreter to run it
#!/usr/bin/env perl
use Mojo::Webqq;
my ($host,$port,$post_api);
$host = "0.0.0.0"; #发送消息接口监听地址,没有特殊需要请不要修改
$port = 5000; #发送消息接口监听端口,修改为自己希望监听的端口
#$post_api = 'http://xxxx'; #接收到的消息上报接口,如果不需要接收消息上报,可以删除或注释此行
my $client = Mojo::Webqq->new();
$client->load("ShowMsg");
$client->load("Openqq",data=>{listen=>[{host=>$host,port=>$port}], post_api=>$post_api});
$client->run();
Save the above code as a xxxx.pl file, and then use perl to run it. QQ login will be completed and an http server listening to the specified address port will be generated on the local machine.
$ perl xxxx.pl
Example of interface call for sending friend messages
http://127.0.0.1:5000/openqq/send_friend_message?uid=xxxxx&content=hello
* About to connect() to 127.0.0.1 port 5000 (#0)
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0)
> GET /openqq/send_friend_message?uid==xxxxx&content=hello HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 127.0.0.1:5000
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json;charset=UTF-8
< Date: Sun, 13 Dec 2015 04:54:38 GMT
< Content-Length: 52
< Server: Mojolicious (Perl)
<
* Connection #0 to host 127.0.0.1 left intact
{"status":"发送成功","msg_id":23910327,"code":0}
For more interface parameter descriptions, please refer to the API documentation.
I am a geek, I just want to be able to play QQ chat through IRC on the command line
Please read the steps to use the IRCShell plug-in
I am a QQ group owner or administrator. I want to add a robot group management function to my group.
Please pay attention to the GroupManage plug-in usage documentation
JavaScript
Python
Java
You can sponsor by scanning the Alipay payment QR code. Thank you for your support and encouragement.
Special thanks to those friends who have sponsored
Copyright (C) 2014 by sjdy521
This library is free software; you can redistribute it and/or modify it under BSD 2-clause "Simplified" license