-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
【Proposal】New 'room-invite' event #1492
Comments
@zixia What do you think about this proposal? If you think this is good to go, I will try to submit a PR later. |
Thanks for your RFC on the Please submit PR and we can discuss the details based on that. |
I have another suggestion. I suggest adding a new Message type .on('message', function (message) {
if (message.type() === bot.Message.Type.RoomInvitation) {
message.accept()
}
}) @zixia How do you think about this |
@lijiarui Please discuss it with @windmemory, and put what you both are thinking right to your RFC. |
I listen to @windmemory |
Okay, after a fierce discussion on this issue, we decide to use Will submit PR later. |
@windmemory Thank you very much for your workable prototype with the c9 runnable environment. After I study your code, I had made some changes on both Please update your dependency to Please feel free to let me know if you have any problems with the integrations when you continue developing. |
@zixia Thanks for adding related changes in I noticed that you declare a export interface PuppetRoomInviteEvent {
inviterId : string,
roomId : string,
} I would like to point out that, when an invitation is sent along, there is no {
"msg": {
"appmsg": {
"appid": "",
"sdkver": "0",
"title": "邀请你加入群聊",
"des": "\"高原ོ\"邀请你加入群聊Wechaty Developers' Home 2,进入可查看详情。",
"action": "view",
"type": "5",
"showtype": "0",
"soundtype": "0",
"mediatagname": {},
"messageext": {},
"messageaction": {},
"content": {},
"contentattr": "0",
"url": "http://support.weixin.qq.com/cgi-bin/mmsupport-bin/addchatroombyinvite?ticket=AVs3velIDxTkA0EOhKogxg%3D%3D",
"lowurl": {},
"dataurl": {},
"lowdataurl": {},
"appattach": {
"totallen": "0",
"attachid": {},
"emoticonmd5": {},
"fileext": {},
"cdnthumbaeskey": {},
"aeskey": {}
},
"extinfo": {},
"sourceusername": {},
"sourcedisplayname": {},
"thumburl": "http://weixin.qq.com/cgi-bin/getheadimg?username=42e4fc96ae9472a2063bbabbe1cfbddbe3b59b105d1d59c217099cb8f3441f95",
"md5": {},
"statextstr": {}
},
"fromusername": "lylezhuifeng",
"scene": "0",
"appinfo": {
"version": "1",
"appname": {}
},
"commenturl": {}
}
} So how should I deal with the |
About the room id, we need to get it before emit the event. I don't know if the protocol could do that but it's worth to try first. If it couldn't, then we will have to change the design. |
Unfortunately, they are not the same for this case. I saw in However, for |
From the raw message that we received from protocol, there is no |
And actually I think we don't need the |
Ok, if we do not have roomId with the invitation, it's ok. I'll remove it form payload later. |
I would suggest to have a roomName in the payload, so our developers would be able to do something with the name, like filter the room name to decide whether they want their bot to join. |
Now you got I had also added two more to the payload:
export interface RoomInvitationPayload {
id : string,
inviterId : string,
roomTopic : string,
roomMemberCount : number,
roomMemberIdList : string[], // Friends' Contact Id List of the Room
timestamp : number, // Unix Timestamp, in seconds
} |
I had refactored the code which get rid of the depending on the room id, and published them as Please upgrade and feel free to let me know if there have any problems with the implementation. Hope we can use the |
@zixia Thanks for refactor the code in The way we accept the invitation in |
Awesome, looking forward to using this new feature! |
New version of Close this ticket. If anything wrong happened with the new event, please file issue here |
Use case description
A friend send a room invitation to the user, the user needs to click on the card, open up a page, then click the button on the page to join the room.
Design proposal
We could add one
room-invite
event emitted when we receive the invitation from a user. It might looks like this:And here is the definition of
RoomInvitation
:The reason that I wrapped several arguments into one object is that accepting the invitation is a complicate operation, I would like to keep this logic away from our developers, so provide a function to them so when they want to accept the invitation, just do
invite.accept()
, then they will be added into the room.Request for comments, let me know if this works.
The text was updated successfully, but these errors were encountered: