{"action":"created","issue":{"url":"https://api.github.com/repos/wechaty/wechaty/issues/64","repository_url":"https://api.github.com/repos/wechaty/wechaty","labels_url":"https://api.github.com/repos/wechaty/wechaty/issues/64/labels{/name}","comments_url":"https://api.github.com/repos/wechaty/wechaty/issues/64/comments","events_url":"https://api.github.com/repos/wechaty/wechaty/issues/64/events","html_url":"https://github.com/wechaty/wechaty/issues/64","id":185423481,"number":64,"title":"当用户昵称中含有表情时，无法出发room-join 事件","user":{"login":"lijiarui","id":6419514,"avatar_url":"https://avatars.githubusercontent.com/u/6419514?v=3","gravatar_id":"","url":"https://api.github.com/users/lijiarui","html_url":"https://github.com/lijiarui","followers_url":"https://api.github.com/users/lijiarui/followers","following_url":"https://api.github.com/users/lijiarui/following{/other_user}","gists_url":"https://api.github.com/users/lijiarui/gists{/gist_id}","starred_url":"https://api.github.com/users/lijiarui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lijiarui/subscriptions","organizations_url":"https://api.github.com/users/lijiarui/orgs","repos_url":"https://api.github.com/users/lijiarui/repos","events_url":"https://api.github.com/users/lijiarui/events{/privacy}","received_events_url":"https://api.github.com/users/lijiarui/received_events","type":"User","site_admin":false},"labels":[{"id":367767329,"url":"https://api.github.com/repos/wechaty/wechaty/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-26T15:13:17Z","updated_at":"2016-10-28T09:08:26Z","closed_at":null,"body":"### Run `npm run doctor` and paste the output here \r\n\r\n#### Wechaty Doctor\r\n\r\n1. Wechaty version: #git[32234c2 fix sloc file glob bug in win32]\r\n2. Darwin x64 version 15.6.0 memory 24/4096 MB\r\n3. Docker: false\r\n\r\n### Expected behavior\r\n\r\n当用户昵称中含有表情的时候，该修改群名称，可以触发room-topic 事件。并将群名称改回来。\r\n用户昵称为：李佳芮😂\r\n代码如下：\r\n\r\n.on('room-topic',  async function(this, room, topic, oldTopic, changer) {\r\n  try {\r\n    log.info('Bot', 'EVENT: room-topic - Room %s change topic  to %s by member %s'\r\n                  , oldTopic\r\n                  , topic\r\n                  , changer.name()\r\n                )\r\n    \r\n    const user = bot.user()\r\n    const user_id = user.id\r\n    if (!user) {\r\n      throw new Error('no user')\r\n    }\r\n\r\n    if(user_id !== changer.id){\r\n      room.say(\"@\" + changer.name() + \"  \" + RoomNoChangeTopic)  \r\n      room.topic(String(oldTopic))   \r\n    }\r\n       \r\n  } catch (e) {\r\n    log.error('Bot', 'room-topic event exception: %s', e.stack)\r\n  }\r\n\r\n  return\r\n})\r\n\r\n### Actual behavior\r\n\r\n当用户昵称中含有表情的时候，修改昵称后。无法出发room-join事件\r\n\r\n### Steps to reproduce the behavior (and fixes, if any)\r\n\r\n\r\n### Paste the full output logs here with `WECHATY_LOG=silly` set\r\n\r\n当用户昵称含有表情时候的contact日志：\r\nContact {\r\n  id: '@0578030b97ba8e15b0a489f1c5cf9326',\r\n  rawObj: \r\n   { '$$hashKey': '01X',\r\n     Alias: 'ruirui_0914',\r\n     AppAccountFlag: 0,\r\n     AttrStatus: 100455,\r\n     ChatRoomId: 0,\r\n     City: '海淀',\r\n     ContactFlag: 3,\r\n     DisplayName: '',\r\n     EncryChatRoomId: '0',\r\n     HeadImgUrl: '/cgi-bin/mmwebwx-bin/webwxgeticon?seq=635310315&username=@0578030b97ba8e15b0a489f1c5cf9326&skey=',\r\n     HideInputBarFlag: 0,\r\n     KeyWord: 'qq5',\r\n     MMFromBatchGet: true,\r\n     MMFromBatchget: true,\r\n     MMOrderSymbol: 'LIJIARUISPANCLASSEMOJIEMOJI1F602SPAN',\r\n     MemberCount: 0,\r\n     MemberList: [],\r\n     NickName: '李佳芮<img class=\"emoji emoji1f602\" text=\"_web\" src=\"/zh_CN/htmledition/v2/images/spacer.gif\" />',\r\n     OwnerUin: 0,\r\n     PYInitial: 'LJRSPANCLASSEMOJIEMOJI1F602SPAN',\r\n     PYQuanPin: 'lijiaruispanclassemojiemoji1f602span',\r\n     Province: '北京',\r\n     RemarkName: '',\r\n     RemarkPYInitial: '',\r\n     RemarkPYQuanPin: '',\r\n     Sex: 2,\r\n     Signature: '回山洞里',\r\n     SnsFlag: 49,\r\n     StarFriend: 0,\r\n     Statues: 0,\r\n     Uin: 0,\r\n     UniFriend: 0,\r\n     UserName: '@0578030b97ba8e15b0a489f1c5cf9326',\r\n     VerifyFlag: 0,\r\n     _h: 50,\r\n     _index: 9,\r\n     _offsetTop: 320,\r\n     stranger: false },\r\n  obj: \r\n   { id: '@0578030b97ba8e15b0a489f1c5cf9326',\r\n     uin: 0,\r\n     weixin: 'ruirui_0914',\r\n     name: '李佳芮<img class=\"emoji emoji1f602\" text=\"_web\" src=\"/zh_CN/htmledition/v2/images/spacer.gif\" />',\r\n     remark: '',\r\n     sex: 2,\r\n     province: '北京',\r\n     city: '海淀',\r\n     signature: '回山洞里',\r\n     address: 'ruirui_0914',\r\n     star: false,\r\n     stranger: false } }\r\n\r\n\r\n修改群名称后的日志内容：\r\n\r\nSILL Room member() check nickMap: {\"@a793fa0ff9106bcc64051770987e4562e52949f6bb5715ac2dc87c622de10413\":\"桔子<span class=\\\"emoji emoji1f633\\\"></span>\",\"@1a1c49763374bfe5de31218e28c57979\":\"李卓桓\",\"@0578030b97ba8e15b0a489f1c5cf9326\":\"李佳芮<span class=\\\"emoji emoji1f602\\\"></span>\"}\r\nSILL PuppetWebEvent onServerDing(heartbeat@browser)\r\nSILL PuppetWebWatchdog onFeed: 60000, HEARTBEAT:[heartbeat@browser]\r\nSILL StateMonitor Puppet.state.current() is live\r\nSILL PuppetWebWatchdog clearWatchDogTimer() [45] seconds left\r\nSILL PuppetWebWatchdog setWatchDogTimer(60000, HEARTBEAT:[heartbeat@browser])\r\nSILL PuppetWebWatchdog monitorScan(HEARTBEAT)\r\nSILL PuppetWebWatchdog autoSaveSession()\r\nSILL PuppetWebWatchdog memoryCheck() free: 82 MB, require: 64 MB\r\nSILL PuppetWebFirer fireRoomJoin() retryPromise() attempt 19 with timeout 60000\r\nSILL Room ready()\r\nSILL PuppetWebBridge getContact() retryPromise: attampt 1/35 time for timeout 306250\r\nSILL PuppetWebBrowser Browser.execute(\"return typeof WechatyBro === \"undefined\"\")\r\nSILL StateMonitor Browser.state.target() is open\r\nSILL PuppetWebBrowser Browser.execute(\" const callback = arguments[arguments.length - 1] const isAsync = (typeof  ... \")\r\nSILL StateMonitor Browser.state.target() is open\r\nSILL Room contactGetter(@@51e8f28fd56097716dc676a55ed443eb228cdbef9667e9038cbd47265ba2bf71) resolved\r\nSILL Contact ready(function)\r\nSILL Contact ready(function)\r\nSILL Contact ready(function)\r\nVERB Room member(李佳芮<img class=\"emoji emoji1f602\" text=\"_web\" src=\"/zh_CN/htmledition/v2/images/spacer.gif\" />)\r\nSILL Room member() check nickMap: {\"@a793fa0ff9106bcc64051770987e4562e52949f6bb5715ac2dc87c622de10413\":\"桔子<span class=\\\"emoji emoji1f633\\\"></span>\",\"@1a1c49763374bfe5de31218e28c57979\":\"李卓桓\",\"@0578030b97ba8e15b0a489f1c5cf9326\":\"李佳芮<span class=\\\"emoji emoji1f602\\\"></span>\"}\r\nSILL PuppetWebFirer fireRoomJoin() retryPromise() attempt 20 with timeout 60000\r\nSILL Room ready()\r\nSILL PuppetWebBridge getContact() retryPromise: attampt 1/35 time for timeout 306250\r\nSILL PuppetWebBrowser Browser.execute(\"return typeof WechatyBro === \"undefined\"\")\r\nSILL StateMonitor Browser.state.target() is open\r\nSILL PuppetWebBrowser Browser.execute(\" const callback = arguments[arguments.length - 1] const isAsync = (typeof  ... \")\r\nSILL StateMonitor Browser.state.target() is open\r\nSILL Room contactGetter(@@51e8f28fd56097716dc676a55ed443eb228cdbef9667e9038cbd47265ba2bf71) resolved\r\nSILL Contact ready(function)\r\nSILL Contact ready(function)\r\nSILL Contact ready(function)\r\nVERB Room member(李佳芮<img class=\"emoji emoji1f602\" text=\"_web\" src=\"/zh_CN/htmledition/v2/images/spacer.gif\" />)\r\nSILL Room member() check nickMap: {\"@a793fa0ff9106bcc64051770987e4562e52949f6bb5715ac2dc87c622de10413\":\"桔子<span class=\\\"emoji emoji1f633\\\"></span>\",\"@1a1c49763374bfe5de31218e28c57979\":\"李卓桓\",\"@0578030b97ba8e15b0a489f1c5cf9326\":\"李佳芮<span class=\\\"emoji emoji1f602\\\"></span>\"}\r\nSILL PuppetWebFirer fireRoomJoin() reject() inviteeContactList: , inviterContact: 你\r\nSILL Contact ready()\r\nSILL Room ready()\r\n————————————————\r\nVERB Room say(欢迎 入群, )\r\nSILL Message constructor() SN:16\r\nSILL PuppetWeb send() destination: testjuzi, content: 欢迎 入群)\r\nSILL PuppetWebBrowser Browser.execute(\"return typeof WechatyBro === \"undefined\"\")\r\nSILL StateMonitor Browser.state.target() is open\r\nSILL PuppetWebBrowser Browser.execute(\" const callback = arguments[arguments.length - 1] const isAsync = (typeof  ... \")\r\nSILL StateMonitor Browser.state.target() is open\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/wechaty/wechaty/issues/comments/256872713","html_url":"https://github.com/wechaty/wechaty/issues/64#issuecomment-256872713","issue_url":"https://api.github.com/repos/wechaty/wechaty/issues/64","id":256872713,"user":{"login":"zixia","id":1361891,"avatar_url":"https://avatars.githubusercontent.com/u/1361891?v=3","gravatar_id":"","url":"https://api.github.com/users/zixia","html_url":"https://github.com/zixia","followers_url":"https://api.github.com/users/zixia/followers","following_url":"https://api.github.com/users/zixia/following{/other_user}","gists_url":"https://api.github.com/users/zixia/gists{/gist_id}","starred_url":"https://api.github.com/users/zixia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zixia/subscriptions","organizations_url":"https://api.github.com/users/zixia/orgs","repos_url":"https://api.github.com/users/zixia/repos","events_url":"https://api.github.com/users/zixia/events{/privacy}","received_events_url":"https://api.github.com/users/zixia/received_events","type":"User","site_admin":false},"created_at":"2016-10-28T09:08:26Z","updated_at":"2016-10-28T09:08:26Z","body":"this bug is related to the wechat security policy:\r\n\r\n1. there is no unique id for user inside wechat web version \r\n1. we only can match user by their username\r\n1. when a user join room, we got a sys message 'A' include username 'nameA'\r\n1. in order to find user of 'nameA', we have to match the names in the chat room, or contacts.\r\n  1. there is a 'nameB' inside room 'memberList'\r\n  1. and a 'nameC' inside contacts.\r\n\r\nunfortunately, if a user put emoji inside their name, then any 2 of the 3 names A B C will be not equal.\r\n\r\neven worse, in some sys message, wechat web version will strip the emoji.\r\n\r\nfor the above reason, the only way to fix this, is totally ignore all the emoji in user name."}}
{"actor":{"display_login":"zixia"}}