-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
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 toPromise<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
Labels
No labels