问题描述
- 使用 wechaty 开发微信机器人,想实现机器人自动通过好友功能时编辑器提示下面错误,想问下有朋友知道问题出现在哪里吗?
'Friendship' only refers to a type, but is being used as a value here.ts(2693)
相关代码
import {
WechatyBuilder,
Friendship
} from 'wechaty'
const bot = WechatyBuilder.build({
name: "PadLocalDemo",
puppet,
})
.on('friendship', async friendship => {
switch (friendship.type()) {
case Friendship.Type.Receive:
await friendship.accept()
case Friendship.Type.Confirm:
console.log(friendship.contact())
}
})
bot.start()
bot.ready()