Skip to content
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

Plugin support for HA #10

Open
huan opened this issue Oct 11, 2021 · 0 comments
Open

Plugin support for HA #10

huan opened this issue Oct 11, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@huan
Copy link
Member

huan commented Oct 11, 2021

When we are using plugin with HAWechaty, we will register the plugin to all the underlying Wechaty instances:

https://github.com/wechaty/ha-wechaty/blob/eb47c40bd59802beac388e4f288b3a7ab0222b8e/src/ha-wechaty.ts#L338-L344

Which means that, all the available plugin will react to the messages, lead to the below issue

The above issue is because the Wechaty Chatopera Plugin will use the message.say() to send back the message, and when we have two Wechaty instances in HA, the message will be processed twice.

await message.say(answer)

We need to figure out a way to deal with this situation and make it the best practice.

Deduplication

One message will be received by more than one bot with HA Wechaty, which means it will be emitted many times. However, we only want HA Wechaty to emit one message for one message, not many.

陈明雨: 我应该可以,一会我修改下文档~            (2021-10-14 15:10:44)
陈明雨: 我应该可以,一会我修改下文档~            (2021-10-14 15:10:44)
陈明雨: 我应该可以,一会我修改下文档~            (2021-10-14 15:10:44)
Huan (李卓桓): [Fireworks] 大家晚上见!            (2021-10-14 15:24:12)
Huan (李卓桓): [烟花] 大家晚上见!            (2021-10-14 15:24:13)
Huan (李卓桓): [烟花] 大家晚上见!            (2021-10-14 15:24:13)

Even the text message will not match each other when the bot is using different puppet protocols:

Huan (李卓桓): [Fireworks] 大家晚上见!            (2021-10-14 15:24:12)
Huan (李卓桓): [烟花] 大家晚上见!            (2021-10-14 15:24:13)

The above message comes from PadLocal and Paimon.

See: kaiyuanshe/osschat#178

@huan huan added the enhancement New feature or request label Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant