NOTICE: our dev machines are all Macs, may not adapt other platforms perfectly at the moment. If you have any problems during using this puppet, issues are welcome to open.
PadLocal is a complete Wechaty puppet implementation. You can use all the Wechaty apis as always. ๐๐ป https://github.com/wechaty/wechaty#guitar-api
All you need to do is to provide PadLocal as Wechaty puppet:
const bot = new Wechaty({
name: "PadLocalBot",
new PuppetPadlocal({
endpoint: `${padLocalHost}:${padLocalPort}`,
token: padLocalToken,
serverCAFilePath: padLocalServerCAFilePath
})
})
Also, we provided a simple demo project to show how to use padlocal puppet. You can checkout this repo to see how it works.
If you want to explore PadLocal step by step, following instructions may be helpful.
node --version // >= v12.0.0
mkdir my-padlocal-bot && cd my-padlocal-bot
npm init -y
npm install ts-node typescript -g --registry=https://r.npm.taobao.org
tsc --init --target ES6
npm install wechaty@latest --registry=https://r.npm.taobao.org
npm install wechaty-puppet-padlocal@latest --registry=https://r.npm.taobao.org
// bot.ts
import {PuppetPadlocal} from "wechaty-puppet-padlocal";
import {Contact, Message, ScanStatus, Wechaty} from "wechaty";
const host: string = "" // padlocal server host
const port: number = 0 // padlocal server port
const token: string = "" // padlocal token
const serverCAFilePath: string = "" // padlocal server ca file path
const puppet = new PuppetPadlocal({
endpoint: `${host}:${port}`,
token,
serverCAFilePath
})
const bot = new Wechaty({
name: "TestBot",
puppet,
})
bot
.on("scan", (qrcode: string, status: ScanStatus) => {
if (status === ScanStatus.Waiting && qrcode) {
const qrcodeImageUrl = ["https://api.qrserver.com/v1/create-qr-code/?data=", encodeURIComponent(qrcode)].join("");
console.log(`onScan: ${ScanStatus[status]}(${status}) - ${qrcodeImageUrl}`);
} else {
console.log(`onScan: ${ScanStatus[status]}(${status})`);
}
})
.on("login", (user: Contact) => {
console.log(`${user} login`);
})
.on("logout", (user: Contact) => {
console.log(`${user} logout`);
})
.on("message", async (message: Message) => {
console.log(`on message: ${message.toString()}`);
})
.start()
console.log("TestBot", "started");
ts-node bot.ts
ๅ่ฝ | padpro | padplus | macpro | padlocal |
---|---|---|---|---|
<ๆถๆฏ> | ||||
ๆถๅๆๆฌ | โ | โ | โ | โ |
ๆถๅไธชไบบๅ็ | โ | โ | โ | โ |
ๆถๅๅพๆ้พๆฅ | โ | โ | โ | โ |
ๅ้ๅพ็ใๆไปถ | โ | โ ๏ผๅฏนๅ ๅฎนๆๅคงๅฐ้ๅถ๏ผ20Mไปฅไธ๏ผ | โ | โ |
ๆฅๆถๅพ็ใๆไปถ | โ | โ ๏ผๅฏนๅ ๅฎนๆๅคงๅฐ้ๅถ๏ผ25Mไปฅไธ๏ผ | โ | โ |
ๅ้่ง้ข | โ | โ | โ | โ |
ๆฅๆถ่ง้ข | โ | โ | โ | โ |
ๅ้ๅฐ็จๅบ | โ | โ | โ | โ |
ๆฅๆถๅจๅพ | โ | โ | โ | โ |
ๅ้ๅจๅพ | โ | โ | โ | โ |
ๆฅๆถ่ฏญ้ณๆถๆฏ | โ | โ | โ | โ |
ๅ้่ฏญ้ณๆถๆฏ | โ | โ | โ | โ |
่ฝฌๅๆๆฌ | โ | โ | โ | โ |
่ฝฌๅๅพ็ | โ | โ | โ | โ |
่ฝฌๅๅพๆ้พๆฅ | โ | โ | โ | โ |
่ฝฌๅ้ณ้ข | โ | โ | โ | โ |
่ฝฌๅ่ง้ข | โ | โ | โ | โ |
่ฝฌๅๆไปถ | โ | โ | โ | โ |
่ฝฌๅๅจๅพ | โ | โ | โ | โ |
่ฝฌๅๅฐ็จๅบ | โ | โ | โ | โ |
<็พค็ป> | ||||
ๅๅปบ็พค่ | โ | โ | โ | โ |
่ฎพ็ฝฎ็พคๅ ฌๅ | โ | โ | โ | โ |
่ทๅ็พคๅ ฌๅ | โ | โ | โ | โ |
็พคไบ็ปด็ | โ | โ | โ | โ |
ๆไบบ่ฟ็พค | โ | โ | โ | โ |
่ธขไบบๅบ็พค | โ | โ | โ | โ |
้ๅบ็พค่ | โ | โ | โ | โ |
ๆน็พคๅ็งฐ | โ | โ | โ | โ |
ๅ ฅ็พคไบไปถ | โ | โ | โ | โ |
็ฆป็พคไบไปถ | โ | โ | โ | โ |
็พคๅ็งฐๅๆดไบไปถ | โ | โ | โ | โ |
@็พคๆๅ | โ | โ | โ | โ |
็พคๅ่กจ | โ | โ | โ | โ |
็พคๆๅๅ่กจ | โ | โ | โ | โ |
็พค่ฏฆๆ | โ | โ | โ | โ |
<่็ณปไบบ> | ||||
ไฟฎๆนๅคๆณจ | โ | โ | โ | โ |
ๆทปๅ ๅฅฝๅ | โ | โ | โ | โ |
่ชๅจ้่ฟๅฅฝๅ | โ | โ | โ | โ |
ๆทปๅ ๅฅฝๅ | โ | โ | โ | โ |
ๅฅฝๅๅ่กจ | โ | โ | โ | โ |
ๅฅฝๅ่ฏฆๆ | โ | โ | โ | โ |
<ๅ ถไป> | ||||
็ปๅฝๅพฎไฟก | โ | โ | โ | โ |
ๆซ็ ็ถๆ | โ | โ | โ | โ |
้ๅบๅพฎไฟก | โ | โ | โ | โ |
ไพ่ตๅ่ฎฎ | iPad | iPad | Mac | iPad |
Padlocal is in beta testing stage, granting tokens to limited partners. If you want to apply, please contact admin for further information.