(BTW, the second Wechat account is newly created, i dont know if this is the issue).
Error Message:
02:27:10 INFO StarterBot onScan: Waiting(2) - https://api.qrserver.com/v1/create-qr-code/?data=http%3A%2F%2Fweixin.qq.com%2Fx%2FQeegtG06MNd1Ukh3NTMM
02:27:19 INFO StarterBot onScan: Scanned(3)
02:27:19 INFO StarterBot onScan: Confirmed(4)
02:27:24 ERR [PuppetPadlocal] login failed: VError: [tid:9447ec8d] request has been cancelled for reason: SERVER_ERROR: 2 UNKNOWN: [tid:9447ec8d] wechat bad request error
at Request._failAllPendingRequest (/Users/jelly/workspace/rw-helper-back/wechat-bot/node_modules/padlocal-client-ts/src/Request.ts:334:15)
at ClientDuplexStreamImpl.<anonymous> (/Users/jelly/workspace/rw-helper-back/wechat-bot/node_modules/padlocal-client-ts/src/Request.ts:82:12)
at ClientDuplexStreamImpl.emit (events.js:314:20)
at ClientDuplexStreamImpl.EventEmitter.emit (domain.js:486:12)
at Object.onReceiveStatus (/Users/jelly/workspace/rw-helper-back/wechat-bot/node_modules/@grpc/grpc-js/src/client.ts:666:18)
at Object.onReceiveStatus (/Users/jelly/workspace/rw-helper-back/wechat-bot/node_modules/@grpc/grpc-js/src/client-interceptors.ts:387:48)
at /Users/jelly/workspace/rw-helper-back/wechat-bot/node_modules/@grpc/grpc-js/src/call-stream.ts:249:24
at processTicksAndRejections (internal/process/task_queues.js:75:11)
Ding-Dong bot Code:
import { PuppetPadlocal } from "wechaty-puppet-padlocal";
import { Contact, Message, ScanStatus, Wechaty, log } from "wechaty";
import { generate } from "qrcode-terminal";
require("dotenv").config();
const puppet = new PuppetPadlocal({});
const bot = new Wechaty({
name: "TestBot",
puppet,
});
bot
.on("scan", (qrcode: string, status: ScanStatus) => {
if (status === ScanStatus.Waiting || status === ScanStatus.Timeout) {
generate(qrcode, { small: true }); // show qrcode on console
require("dotenv").config(); const puppet = new PuppetPadlocal({});
const bot = new Wechaty({ name: "TestBot", puppet, });
bot .on("scan", (qrcode: string, status: ScanStatus) => { if (status === ScanStatus.Waiting || status === ScanStatus.Timeout) { generate(qrcode, { small: true }); // show qrcode on console
})
.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()}
); if (message.text() === "ding") { await message.say("dong"); } if (message.text() === "esc") { await bot.logout(); } }).start();
console.log("TestBot", "started");