wechaty / wechaty-puppet-padplus

DEPRECATED: One puppet based on iPad protocal for Wechaty
https://wechaty.js.org/docs/puppet-services/
313 stars 64 forks source link

如何判断公众号的文章推送? #296

Closed suntong closed 3 years ago

suntong commented 3 years ago

Is your feature request related to a problem? Please describe.

请问,padplus如何判断公众号的文章推送啊? 我一直用的方法在昨天突然不管用了

A clear and concise description of what the problem is.

I always filter out the 公众号的文章推送, but suddenly they become url type several days ago.

Describe the solution you'd like

公众号的文章推送 are indeed url type, but please make it distinguishable from the normal url type. I.e., they are from 公众号, that's the most prominent identification.

[enhancement]

su-chang commented 3 years ago

Can you provide some detail info about this problem with log here?

Thank you.

guoxiangke commented 3 years ago

const sender: Contact | null = msg.from() if (sender.type() === Contact.Type.Official) { log.info('onMessage', 'todo 暂不处理公众号消息') return }

suntong commented 3 years ago

Wow, works like a charm. Thanks a lot @guoxiangke!

suntong commented 3 years ago

FTR,

Contact.Type: ContactType.Unknown | ContactType.Personal | ContactType.Official

Ref: https://wechaty.js.org/docs/api/contact#Contact

Not that straightforward to me, i.e., it'd take me quite a while to translate above into actual code.