{"action":"created","issue":{"url":"https://api.github.com/repos/Chatie/wechaty/issues/1492","repository_url":"https://api.github.com/repos/Chatie/wechaty","labels_url":"https://api.github.com/repos/Chatie/wechaty/issues/1492/labels{/name}","comments_url":"https://api.github.com/repos/Chatie/wechaty/issues/1492/comments","events_url":"https://api.github.com/repos/Chatie/wechaty/issues/1492/events","html_url":"https://github.com/Chatie/wechaty/issues/1492","id":342547302,"node_id":"MDU6SXNzdWUzNDI1NDczMDI=","number":1492,"title":"【Proposal】New 'room-invite' event","user":{"login":"windmemory","id":6801292,"node_id":"MDQ6VXNlcjY4MDEyOTI=","avatar_url":"https://avatars3.githubusercontent.com/u/6801292?v=4","gravatar_id":"","url":"https://api.github.com/users/windmemory","html_url":"https://github.com/windmemory","followers_url":"https://api.github.com/users/windmemory/followers","following_url":"https://api.github.com/users/windmemory/following{/other_user}","gists_url":"https://api.github.com/users/windmemory/gists{/gist_id}","starred_url":"https://api.github.com/users/windmemory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/windmemory/subscriptions","organizations_url":"https://api.github.com/users/windmemory/orgs","repos_url":"https://api.github.com/users/windmemory/repos","events_url":"https://api.github.com/users/windmemory/events{/privacy}","received_events_url":"https://api.github.com/users/windmemory/received_events","type":"User","site_admin":false},"labels":[{"id":367767331,"node_id":"MDU6TGFiZWwzNjc3NjczMzE=","url":"https://api.github.com/repos/Chatie/wechaty/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":18,"created_at":"2018-07-19T01:31:54Z","updated_at":"2018-07-24T09:57:47Z","closed_at":"2018-07-24T09:57:47Z","author_association":"CONTRIBUTOR","body":"## Use case description\r\nA 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. \r\n\r\n## Design proposal\r\nWe could add one `room-invite` event emitted when we receive the invitation from a user. It might looks like this:\r\n```typescript\r\npublic emit(event: 'room-invite', roomInvitation: RoomInvitation): boolean\r\n```\r\nAnd here is the definition of `RoomInvitation`:\r\n```typescript\r\nexport interface RoomInvitation {\r\n  roomName: string,\r\n  fromUser: string,\r\n  timestamp: number,\r\n  accept: () => Promise<boolean>\r\n}\r\n```\r\nThe 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. \r\n\r\nRequest for comments, let me know if this works. "},"comment":{"url":"https://api.github.com/repos/Chatie/wechaty/issues/comments/407350924","html_url":"https://github.com/Chatie/wechaty/issues/1492#issuecomment-407350924","issue_url":"https://api.github.com/repos/Chatie/wechaty/issues/1492","id":407350924,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzM1MDkyNA==","user":{"login":"windmemory","id":6801292,"node_id":"MDQ6VXNlcjY4MDEyOTI=","avatar_url":"https://avatars3.githubusercontent.com/u/6801292?v=4","gravatar_id":"","url":"https://api.github.com/users/windmemory","html_url":"https://github.com/windmemory","followers_url":"https://api.github.com/users/windmemory/followers","following_url":"https://api.github.com/users/windmemory/following{/other_user}","gists_url":"https://api.github.com/users/windmemory/gists{/gist_id}","starred_url":"https://api.github.com/users/windmemory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/windmemory/subscriptions","organizations_url":"https://api.github.com/users/windmemory/orgs","repos_url":"https://api.github.com/users/windmemory/repos","events_url":"https://api.github.com/users/windmemory/events{/privacy}","received_events_url":"https://api.github.com/users/windmemory/received_events","type":"User","site_admin":false},"created_at":"2018-07-24T09:57:47Z","updated_at":"2018-07-24T09:57:47Z","author_association":"CONTRIBUTOR","body":"New version of `wechaty-puppet-padchat` has implemented the `room-invite` event. \r\nPlease use version `0.9.0` or above to use this feature. \r\n\r\nClose this ticket. If anything wrong happened with the new event, please file issue [here](https://github.com/lijiarui/wechaty-puppet-padchat/issues/new)"}}
{"actor":{"display_login":"windmemory"}}