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

message-update events #38

Open
hcfw007 opened this issue Nov 7, 2022 · 8 comments
Open

message-update events #38

hcfw007 opened this issue Nov 7, 2022 · 8 comments

Comments

@hcfw007
Copy link
Member

hcfw007 commented Nov 7, 2022

For updating message payload e.g. failed, read, etc.

Puppet Event:

export interface EventMessageUpdatePayload {
  id: string
}

Wechaty Event Listener:

(message: MessageInterface) => void | Promise<void>
@su-chang
Copy link

su-chang commented Nov 7, 2022

@su-chang
Copy link

su-chang commented Nov 7, 2022

EventMessageUpdatePayload
export interface EventMessageUpdatePayload extends EventMessagePayload {
  isRevoke?: boolean
  isQuoteMessage?: boolean
  isRoomNotice?: boolean
  isReadReceipt?: boolean
  isSendFail?: boolean
}

或者这样?

export enum MESSAGE_UPDATE_TYPE {
  REVOKE,
  SEND_FAIL,
  ...
}
export interface EventMessageUpdatePayload extends EventMessagePayload {
  type: MESSAGE_UPDATE_TYPE,
}

直接就把这个数据推上来吧,你觉得咋样?

@hcfw007
Copy link
Member Author

hcfw007 commented Nov 7, 2022

我觉得只要一个id,收到这个事件之后去重新拉取messagePayload比较好吧,万一企微出了这个功能呢?
image

@su-chang
Copy link

su-chang commented Nov 7, 2022

我觉得只要一个id,收到这个事件之后去重新拉取messagePayload比较好吧,万一企微出了这个功能呢?

这样重新拉取messagePayload,那要更新messagePayload的字段了?但是success这样的字段放在messagePayload里有点奇怪。你有啥建议不?

@windmemory
Copy link
Member

我觉得可以单id推送,然后重新拉取message数据,拉到之后更新之前的message。这里要保证推送的message和之前的message的id是一样的就行

@hcfw007
Copy link
Member Author

hcfw007 commented Nov 7, 2022

这样似乎直接进行message的dirty,然后wechaty层做一些额外的处理就行,改动也比较小。不过message的payload可能要增加一些字段以标记状态。

@su-chang
Copy link

su-chang commented Nov 7, 2022

这样似乎直接进行message的dirty,然后wechaty层做一些额外的处理就行,改动也比较小。不过message的payload可能要增加一些字段以标记状态。

这个可以达成共识

@su-chang
Copy link

su-chang commented Nov 9, 2022

TODO

puppet-service

针对 client 和 server 中的 messagePayload 新增字段。

wechaty

监听 Message 的 dirty 事件,同步 message 数据,并推送一个 message 事件

看看是否有问题,如果没有问题就继续推进了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants