Skip to content

Want to get information about sent-out message #1501

@windmemory

Description

@windmemory

Refer to wechaty/wechaty-puppet-padchat#112

I think it makes sense to solve this problem. Currently when we call Contact.say() or Room.say() or Message.say(), it is a Promise<void> as the return type. We don't have access to the message that we just sent out. Besides, we don't receive the self-sent-out message in the message event. So currently there is no way to know that which message is the one that we just said.

So I would suggest two options to solve this problem:

  • Change the return type for three say() methods to Promise<string>, so we can return the message id back to the developer. As I dived into iPad protocol, the message id is available there.
  • Emit message event every time we sent out message, in this way, developer could listen to the event, then get the one they just sent out by matching the content.

I personally prefer to have them both :P
That is to say, we get the message id, then emit a event with that message id and the content, then return the message id back.

What do you think? @zixia Let me know your thoughts, then I could submit a prototype PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions