基于ilink,写了个微信bot库

3

https://github.com/AndySkaura/weixinProxy
可以在cli中使用,方便传输文件。
在库里使用,方便自己项目接入微信。

bot.login({ onQr, onStatus })

请求二维码并轮询登录确认,成功后保存 token

bot.onMessage(handler)

监听收到的消息,返回取消监听函数

bot.onError(handler)

监听接收循环里的错误

bot.start()

启动长轮询接收循环

bot.stop()

停止长轮询接收循环

bot.receiveOnce()

只拉取并处理一轮消息,适合定时任务

bot.send(userId, text)

给指定用户发送文本

bot.sendImage(userId, filePath, options?)

发送图片

bot.sendFile(userId, filePath)

发送文件

bot.sendVideo(userId, filePath, options?)

发送视频

bot.sessions()

读取已见过的会话摘要

bot.isLoggedIn()

判断本地是否已有 token

后续打算基于该项目做个网关平台,可以通过http通知到自己的微信。
目前的场景就是自己的各项服务可以用外部的hook或自己的通知脚本直接调用http给自己微信发消息