New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it seems RECALLED: 10002 message dose't trigger on('message') event #8

Closed
JasLin opened this Issue Jun 23, 2016 · 9 comments

Comments

@JasLin
Contributor

JasLin commented Jun 23, 2016

i tested the ding-dong-bot and recalled some message , it dose not trigger the event.

@JasLin JasLin changed the title from it seems RECALLED: 10002 message dose't on('message') event to it seems RECALLED: 10002 message dose't trigger on('message') event Jun 23, 2016

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Jun 27, 2016

Member

Hi JasLin,

when you run ding-dong-bot, there should be a scan event first, with the login qrcode url that you need to scan to login.

the message event will be emitted after login, at the time when you receive a new message.

Member

zixia commented Jun 27, 2016

Hi JasLin,

when you run ding-dong-bot, there should be a scan event first, with the login qrcode url that you need to scan to login.

the message event will be emitted after login, at the time when you receive a new message.

@JasLin

This comment has been minimized.

Show comment
Hide comment
@JasLin

JasLin Jun 28, 2016

Contributor

@zixia thanks for your reply , actually , i have used wechaty in my programs. i write a robot to serve some business, and everything is ok , but the when i recalled message from my wechat in mobile, it never trigger the message event . the test code is simple:

...
.on('message', m => {
  m.ready()
  .then(msg => {
    log.info('Bot', 'recv: %s', msg.toStringEx())
    logToFile(JSON.stringify(msg.rawObj))
    // test recalled message
    if(msg.type() === Message.Type.RECALLED){
        console.log('recalled a message')
        msg.dumpRaw()
    }
    ...

  })
  .catch(e => log.error('Bot', 'ready: %s' , e))
})

there is no message received after recalled some messages from mobile.

BTW: thanks for wechaty again, it may be the best wecaht sdk i have seen in github. i had move my code from python to javascript after compare with wechaty and some python wechat sdk .

Contributor

JasLin commented Jun 28, 2016

@zixia thanks for your reply , actually , i have used wechaty in my programs. i write a robot to serve some business, and everything is ok , but the when i recalled message from my wechat in mobile, it never trigger the message event . the test code is simple:

...
.on('message', m => {
  m.ready()
  .then(msg => {
    log.info('Bot', 'recv: %s', msg.toStringEx())
    logToFile(JSON.stringify(msg.rawObj))
    // test recalled message
    if(msg.type() === Message.Type.RECALLED){
        console.log('recalled a message')
        msg.dumpRaw()
    }
    ...

  })
  .catch(e => log.error('Bot', 'ready: %s' , e))
})

there is no message received after recalled some messages from mobile.

BTW: thanks for wechaty again, it may be the best wecaht sdk i have seen in github. i had move my code from python to javascript after compare with wechaty and some python wechat sdk .

@sjdy521

This comment has been minimized.

Show comment
Hide comment
@sjdy521

sjdy521 Jun 28, 2016

it may be the best wecaht sdk i have seen in github

相当高的评价,我也赞一个

sjdy521 commented Jun 28, 2016

it may be the best wecaht sdk i have seen in github

相当高的评价,我也赞一个

@zixia zixia added the bug label Jun 28, 2016

@zixia zixia self-assigned this Jun 28, 2016

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Jun 28, 2016

Member

@JasLin confirmed.

It seems the message of type RECALLED is not triggered in the current hook process.

It must has other hook point of this type of message, will figure it out when I have time.

also, thanks for your favorable comment! I'd like to write it to README :) and thanks @sjdy521, too!

Member

zixia commented Jun 28, 2016

@JasLin confirmed.

It seems the message of type RECALLED is not triggered in the current hook process.

It must has other hook point of this type of message, will figure it out when I have time.

also, thanks for your favorable comment! I'd like to write it to README :) and thanks @sjdy521, too!

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Nov 12, 2016

Member

@JasLin do u have any idea of how to fix this issue? i'm going to review it next week.

Member

zixia commented Nov 12, 2016

@JasLin do u have any idea of how to fix this issue? i'm going to review it next week.

@JasLin

This comment has been minimized.

Show comment
Hide comment
@JasLin

JasLin Nov 13, 2016

Contributor

@zixia i haven't dig into this issue yet, this issue not so harmfull ,or i will going to see this next week too.

Contributor

JasLin commented Nov 13, 2016

@zixia i haven't dig into this issue yet, this issue not so harmfull ,or i will going to see this next week too.

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Nov 14, 2016

Member

About the RECALLED Message behavior of webwxApp:

Problem

  1. RECALLED Message will not be processed like other messages:

    https://github.com/wechaty/webwx-app-tracker/blob/06ba28a762e4f13d1710962577afb53017d2190f/formatted/webwxApp.js#L2007

  2. It do return instead of call addChatMessage():

    https://github.com/wechaty/webwx-app-tracker/blob/06ba28a762e4f13d1710962577afb53017d2190f/formatted/webwxApp.js#L2034

  3. So there will no message:add:success broadcast event fired for any RECALL Message:

    https://github.com/wechaty/webwx-app-tracker/blob/06ba28a762e4f13d1710962577afb53017d2190f/formatted/webwxApp.js#L1930

  4. At last Wechaty will never get it.

Solution

We need to add addChatMessage() call to process a RECALLED message.

  1. wrap _recalledMsgProcess()

    https://github.com/wechaty/webwx-app-tracker/blob/06ba28a762e4f13d1710962577afb53017d2190f/formatted/webwxApp.js#L2007

  2. wrap messageProcess()

    https://github.com/wechaty/webwx-app-tracker/blob/06ba28a762e4f13d1710962577afb53017d2190f/formatted/webwxApp.js#L1971

  3. any other good idea/suggestion/brainstorming?

TBD

See Also

  1. Prevent Recalling Messages (Prototype): arrowrowe/electronic-wechat@3126eee
Member

zixia commented Nov 14, 2016

About the RECALLED Message behavior of webwxApp:

Problem

  1. RECALLED Message will not be processed like other messages:

    https://github.com/wechaty/webwx-app-tracker/blob/06ba28a762e4f13d1710962577afb53017d2190f/formatted/webwxApp.js#L2007

  2. It do return instead of call addChatMessage():

    https://github.com/wechaty/webwx-app-tracker/blob/06ba28a762e4f13d1710962577afb53017d2190f/formatted/webwxApp.js#L2034

  3. So there will no message:add:success broadcast event fired for any RECALL Message:

    https://github.com/wechaty/webwx-app-tracker/blob/06ba28a762e4f13d1710962577afb53017d2190f/formatted/webwxApp.js#L1930

  4. At last Wechaty will never get it.

Solution

We need to add addChatMessage() call to process a RECALLED message.

  1. wrap _recalledMsgProcess()

    https://github.com/wechaty/webwx-app-tracker/blob/06ba28a762e4f13d1710962577afb53017d2190f/formatted/webwxApp.js#L2007

  2. wrap messageProcess()

    https://github.com/wechaty/webwx-app-tracker/blob/06ba28a762e4f13d1710962577afb53017d2190f/formatted/webwxApp.js#L1971

  3. any other good idea/suggestion/brainstorming?

TBD

See Also

  1. Prevent Recalling Messages (Prototype): arrowrowe/electronic-wechat@3126eee
@zhaozhiming

This comment has been minimized.

Show comment
Hide comment
@zhaozhiming

zhaozhiming Apr 11, 2017

Do the solutions above have not help?

zhaozhiming commented Apr 11, 2017

Do the solutions above have not help?

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Aug 26, 2017

Member

Close this issue because the PR will be merged soon.

Member

zixia commented Aug 26, 2017

Close this issue because the PR will be merged soon.

@zixia zixia closed this Aug 26, 2017

zixia added a commit that referenced this issue Sep 3, 2017

fix(wechaty-bro): resolved emit RECALLED type msg (fix #8) (#744)
* fix(wechaty-bro): resolved emit RECALLED type msg

fix #8

* add(message): add getRevokeId(), Return the recalled message id

* fix(wechaty-bro): modify `hookProcess` to `hookRecalledProcess`

modify `_this` to `chatFactory`

* fix(wechaty-bro): Remain a blank message after repairing the recall message

* fix(wechaty-bro): Unify the data returned by the RECALLED type message

remove Message.getRevokeId function

@zixia zixia moved this from Opportunity to Final Boss in Hacking Opportunity Apr 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment