wechaty/wechaty-puppet-padchat

FORWARDED: Accept invitation failed, this is a forwarded invitation, can not be accepted

huan opened this issue · 3 comments

huan commented

When I use roomInvitation.accept() to auto accept a room invitation with the follow event code:

wechaty.on('room-invite', onRoomInvitation)

I got this exception:

20:15:34 ERR Config ###########################
20:15:34 ERR Config unhandledRejection: Error: FORWARDED: Accept invitation failed, this is a forwarded invitation, can not be accepted [object Promise]
20:15:34 ERR Config ###########################
20:15:34 ERR Config process.on(unhandledRejection) promise.catch(FORWARDED: Accept invitation failed, this is a forwarded invitation, can not be accepted)
Config Error: FORWARDED: Accept invitation failed, this is a forwarded invitation, can not be accepted
    at PuppetPadchat.<anonymous> (/home/ubuntu/workspace/node_modules/wechaty-puppet-padchat/src/puppet-padchat.ts:1463:13)
    at Generator.next (<anonymous>)
    at fulfilled (/home/ubuntu/workspace/node_modules/wechaty-puppet-padchat/dist/src/puppet-padchat.js:22:58)
(node:7562) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)

$ npm ls wechaty-puppet-padchat
wechaty@0.23.36 /home/ubuntu/workspace
└── wechaty-puppet-padchat@0.18.2 

The exception said that the invitation is a FORWARDED invitation, however I can make sure it's not because that invitation is sent by me.

The stranger thing is that the bot will join the room after the exception, which means that the underlying mechanism is work without problem.

Hi,@huan, room-invite event on RoomInvitation only supported by padchat@puppet?
Why I am not able to trigger this event in default web puppet? like:
bot.on('room-invite', async roomInvitation => {
try {
console.log(received room-invite event.)
await roomInvitation.accept()
} catch (e) {
console.error(e)
}
})

huan commented

@jayjaylin Yes, currently I believe you can not receive the room invitation via the Web Wechat, nor accept it.