Open pest1999 opened 4 years ago
node 版本和示例一致 10.16.0 npm 版本 6.4.1
改写bot.ts后能够正常运行 该动后的bot.ts文件如下
// bot.ts
import { Contact, Message, Wechaty } from 'wechaty'
import { ScanStatus } from 'wechaty-puppet'
import { PuppetPadplus } from 'wechaty-puppet-padplus'
import QrcodeTerminal from 'qrcode-terminal'
const token = 'puppet_padplus_*****' //自行申请token
const puppet = new PuppetPadplus({
token,
})
const name = 'my-padplus-bot2'
const bot = new Wechaty({
name: 'mybot',
puppet, // generate xxxx.memory-card.json and save login data for the next login
})
bot.on('scan', (qrcode, status) => {
if (status === ScanStatus.Waiting) {
QrcodeTerminal.generate(qrcode, {
small: true
})
}
})
bot.on('login', (user: Contact) => {
console.log(`login success, user: ${user}`)
})
bot.on('message', (msg: Message) => {
console.log(`msg : ${msg}`)
})
bot.start()
系统环境:win server 2012 r2 standard 按照文档安装,提示版本号冲突,报错如下
package.json如下:
执行启动命令
ts-node bot.ts
后,报错如下: