forked from shiyimin/wxbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit db28f55
Showing
5 changed files
with
401 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
download | ||
*.out | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# wxbot 微信机器人 | ||
|
||
<a href="https://github.com/fritx/awesome-wechat"><img width="110" height="20" src="https://img.shields.io/badge/awesome-wechat-brightgreen.svg"></a> <a href="https://github.com/fritx/wxbot"><img width="74" height="20" src="https://img.shields.io/badge/github-dev-orange.svg"></a> | ||
|
||
- __普通个人号 微信机器人/外挂__ (不同于[webot](https://github.com/node-webot/webot)等公众号机器人) | ||
- 意义: 个人号可充当公众号使用 关系增强/门槛降低/更多行为/依旧自动化 | ||
- 与[qqbot](https://github.com/xhan/qqbot)/[wqq](https://github.com/fritx/wqq)等不同: 基于浏览器/用户行为自动化 更贴近用户/更可靠 | ||
- 基于浏览器桌面平台[electron](https://github.com/atom/electron) 跨平台win/linux/mac | ||
- 基于微信网页版 <https://wx.qq.com> | ||
- 目前处于高度开发和观察阶段 | ||
- 目前代码提供自动回复 可自行定制 | ||
|
||
请使用较新版本的electron>=v1.0 | ||
如果electron=v0.x 可以查看分支[wxbot#electron-v0](https://github.com/fritx/wxbot/tree/electron-v0) | ||
|
||
```plain | ||
$ cd wxbot | ||
$ npm install | ||
$ electron . --enable-logging # 运行 需扫二维码登录 | ||
``` | ||
|
||
<img width="643" src="https://raw.githubusercontent.com/fritx/wxbot/dev/screenshot.jpeg"> | ||
|
||
## 功能实现 | ||
|
||
- [x] 自动回复 | ||
- [x] 识别并回复相同的文本/表情/emoji | ||
- [x] 识别图片/语音/视频/小视频 | ||
- [x] 识别位置/名片/链接/附件 | ||
- [x] 识别转账/在线聊天/实时对讲 | ||
- [x] 发送图片 | ||
- [x] 下载自定义表情/名片/图片/语音/附件 | ||
- [ ] 下载视频/小视频 | ||
- [ ] 感应系统消息 时间/邀请加群/红包等 | ||
- [x] 探索运行于无界面平台 [atom/electron#228](https://github.com/atom/electron/issues/228) | ||
|
||
## 无界面linux运行 | ||
|
||
- 从命令行输出 获取二维码图片url 自行打开/扫描 | ||
- 参照配置 [segmentio/nightmare#224 (comment)](https://github.com/segmentio/nightmare/issues/224#issuecomment-141575361) | ||
|
||
## 如何正确地下载electron | ||
|
||
参考 <http://blog.fritx.me/?weekly/150904> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
var BrowserWindow = require('electron').BrowserWindow | ||
var app = require('electron').app | ||
// var ipc = require('ipc') | ||
var _ = require('lodash') | ||
var fs = require('fs-extra') | ||
var bytes = require('bytes') | ||
|
||
function debug(/*args*/){ | ||
var args = JSON.stringify(_.toArray(arguments)) | ||
console.log(args) | ||
} | ||
|
||
|
||
var downloadDir = `${__dirname}/download` | ||
fs.mkdirpSync(downloadDir) | ||
|
||
app.on('ready', function(){ | ||
|
||
// var win = new BrowserWindow({}) | ||
// win.loadURL('file://' + __dirname + '/index.html') | ||
|
||
var win = new BrowserWindow({ | ||
width: 900, | ||
height: 610, | ||
webPreferences: { | ||
nodeIntegration: false, | ||
preload: __dirname + '/preload.js' | ||
} | ||
}) | ||
win.loadURL('https://wx.qq.com/?lang=zh_CN&t=' + Date.now()) | ||
|
||
// electron api DownloadItem | ||
// https://github.com/atom/electron/blob/master/docs/api/download-item.md | ||
win.webContents.session.on('will-download', function(e, item){ | ||
//e.preventDefault() | ||
var url = item.getURL() | ||
var mime = item.getMimeType() | ||
var filename = item.getFilename() | ||
var total = item.getTotalBytes() | ||
debug('开始下载', filename, mime, bytes(total), url) | ||
item.setSavePath(`${downloadDir}/${filename}`) | ||
item.on('updated', function() { | ||
// debug('下载中', filename, item.getReceivedBytes()) | ||
}) | ||
item.on('done', function(e, state){ | ||
if (state == 'completed') { | ||
debug('下载完成', filename) | ||
} else { | ||
debug('下载失败', filename) | ||
} | ||
}) | ||
}) | ||
|
||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "wxbot", | ||
"version": "0.0.8", | ||
"description": "普通个人号 微信机器人/外挂", | ||
"repository": "[email protected]:fritx/wxbot.git", | ||
"homepage": "https://github.com/fritx/wxbot", | ||
"keywords": [ | ||
"weixin", | ||
"wx", | ||
"qq", | ||
"bot" | ||
], | ||
"scripts": { | ||
"start": "electron ." | ||
}, | ||
"dependencies": { | ||
"bytes": "^2.1.0", | ||
"fs-extra": "^0.24.0", | ||
"lodash": "^3.10.1" | ||
} | ||
} |
Oops, something went wrong.