Skip to content
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

无法自动通过好友请求 #115

Closed
lijiarui opened this issue Dec 3, 2016 · 5 comments
Closed

无法自动通过好友请求 #115

lijiarui opened this issue Dec 3, 2016 · 5 comments

Comments

@lijiarui
Copy link
Member

lijiarui commented Dec 3, 2016

Run npm run doctor or wechaty run doctor(for docker user), paste output here

> wechaty@0.6.32 doctor /root/wechaty
> ts-node bin/doctor


#### Wechaty Doctor

1. Wechaty version: #git[dea72c4 0.6.32]
2. Linux x64 version 3.16.0-4-amd64 memory 419/1000 MB
3. Docker: false
4. Node version: v6.9.1

Expected behavior

自动通过好友请求

Actual behavior

无法成功通过好友请求

Paste the full output logs here with WECHATY_LOG=silly set

processTaskList: #2 addfriend
VERB FriendRequest accept() 周海圆
VERB PuppetWebBridge verifyUserOk(@ac74b83b9e502c4a7d31d07fe26cd607213276912fd3f1f15a2d69fe3cc6a3e2, v2_f543dc3059cc6b1ee4e688dcd5c2755ccfb1c254a432631ffd685a3786d3d640533d318b8ce8707d02c375742fb34e092738329440d9fefcb09f403794eaa981@stranger)
VERB PuppetWebBridge proxyWechaty(verifyUserOk, @ac74b83b9e502c4a7d31d07fe26cd607213276912fd3f1f15a2d69fe3cc6a3e2, v2_f543dc3059cc6b1ee4e688dcd5c2755ccfb1c254a432631ffd685a3786d3d640533d318b8ce8707d02c375742fb34e092738329440d9fefcb09f403794eaa981@stranger)
VERB Contact say(hi,我是专门管理微信群的机器人,切尔西还是曼城 ?)
VERB PuppetWebBridge proxyWechaty(send, @ac74b83b9e502c4a7d31d07fe26cd607213276912fd3f1f15a2d69fe3cc6a3e2, hi,我是专门管理微信 群的机器人,切尔西还是曼城?)
VERB Contact say(回复我加群暗号,我会将你拉入指定的微信群)
VERB PuppetWebBridge proxyWechaty(send, @ac74b83b9e502c4a7d31d07fe26cd607213276912fd3f1f15a2d69fe3cc6a3e2, 回复我加群暗号,我会 将你拉入指定的微信群)
setTimeout processTaskList 10 seconds
VERB PuppetWebFriendRequest accept() with contact 周海圆 ready()
WARN Message DEPRECATED get() at Error: stack
    at Message.get (/root/wechaty/src/message.ts:442:51)
    at m.ready.then.msg (/root/wechaty/example/orangiss/juzimi.ts:197:30)
WARN PuppetWebBrowser execute() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver i, WebDriverError: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.16.0-4-amd64 x86_64)
    at WebDriverError (/root/wechaty/node_modules/selenium-webdriver/lib/error.js:27:5)
    at Object.checkLegacyResponse (/root/wechaty/node_modules/selenium-webdriver/lib/error.js:505:15)
    at parseHttpResponse (/root/wechaty/node_modules/selenium-webdriver/lib/http.js:509:13)
    at doSend.then.response (/root/wechaty/node_modules/selenium-webdriver/lib/http.js:440:13)
    at process._tickDomainCallback (internal/process/next_tick.js:129:7)
WARN PuppetWebBridge execute() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.16.0-4-amd64 x86_64)
VERB PuppetWebBridge proxyWechaty(send, @ac74b83b9e502c4a7d31d07fe26cd607213276912fd3f1f15a2d69fe3cc6a3e2, hi,我是专门管理微信 群的机器人,切尔西还是曼城?)
WARN PuppetWebBridge proxyWechaty() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.16.0-4-amd64 x86_64)
ERR PuppetWebBridge send() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.16.0-4-amd64 x86_64)
ERR PuppetWeb send() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.16.0-4-amd64 x86_64)
ERR Wechaty send() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.16.0-4-amd64 x86_64)
(node:1049) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): WebDriverError: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.16.0-4-amd64 x86_64)
VERB PuppetWebEvent onServerLog(friendVerify(@ac74b83b9e502c4a7d31d07fe26cd607213276912fd3f1f15a2d69fe3cc6a3e2, v2_f543dc3059cc6b1ee4e688dcd5c2755ccfb1c254a432631ffd685a3786d3d640533d318b8ce8707d02c375742fb34e092738329440d9fefcb09f403794eaa981@stranger) fail)
WARN Message DEPRECATED get() at Error: stack
    at Message.get (/root/wechaty/src/message.ts:442:51)
    at m.ready.then.msg (/root/wechaty/example/orangiss/juzimi.ts:197:30)
WARN PuppetWebBrowser execute() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver i, WebDriverError: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.16.0-4-amd64 x86_64)
    at WebDriverError (/root/wechaty/node_modules/selenium-webdriver/lib/error.js:27:5)
    at Object.checkLegacyResponse (/root/wechaty/node_modules/selenium-webdriver/lib/error.js:505:15)
    at parseHttpResponse (/root/wechaty/node_modules/selenium-webdriver/lib/http.js:509:13)
    at doSend.then.response (/root/wechaty/node_modules/selenium-webdriver/lib/http.js:440:13)
    at process._tickDomainCallback (internal/process/next_tick.js:129:7)
WARN PuppetWebBridge execute() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.16.0-4-amd64 x86_64)
VERB PuppetWebBridge proxyWechaty(send, @ac74b83b9e502c4a7d31d07fe26cd607213276912fd3f1f15a2d69fe3cc6a3e2, 回复我加群暗号,我会 将你拉入指定的微信群)
WARN PuppetWebBridge proxyWechaty() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.16.0-4-amd64 x86_64)
ERR PuppetWebBridge send() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.16.0-4-amd64 x86_64)
ERR PuppetWeb send() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.16.0-4-amd64 x86_64)
ERR Wechaty send() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.16.0-4-amd64 x86_64)
(node:1049) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): WebDriverError: unknown error: r.isBrandContact is not a function
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 3.16.0-4-amd64 x86_64)
setTimeout processTaskList 10 seconds

部分verbose日志:

processTaskList: #1 addfriend(我永远是我)
VERB FriendRequest accept() 我永远是我
VERB PuppetWebBridge verifyUserOk(@1b81691210a2daa9cbb9e1a070f4a6d7f4acfb79b21497aedf968117fb5238ae, v2_a257da5fa4e3a3f23a5e4b917d04dd7b3bbdd8c63ee5863879143a3857278398462e5592720e65bf593912344fa1b84b3573bf4f3eba10578cf97263f7c54062@stranger)
VERB PuppetWebBridge proxyWechaty(verifyUserOk, @1b81691210a2daa9cbb9e1a070f4a6d7f4acfb79b21497aedf968117fb5238ae, v2_a257da5fa4e3a3f23a5e4b917d04dd7b3bbdd8c63ee5863879143a3857278398462e5592720e65bf593912344fa1b84b3573bf4f3eba10578cf97263f7c54062@stranger)
setTimeout processTaskList 60 seconds
VERB PuppetWebFriendRequest accept() with contact 我永远是我 ready()
VERB PuppetWebEvent onServerLog(friendVerify(@1b81691210a2daa9cbb9e1a070f4a6d7f4acfb79b21497aedf968117fb5238ae, v2_a257da5fa4e3a3f23a5e4b917d04dd7b3bbdd8c63ee5863879143a3857278398462e5592720e65bf593912344fa1b84b3573bf4f3eba10578cf97263f7c54062@stranger) fail)
setTimeout processTaskList 60 seconds
VERB PuppetWebBridge proxyWechaty(getContact, @@f770b62162723406b33df6a67198da3be41c2c5044cc6f2e6a6958c03a8f00d2)
@huan
Copy link
Member

huan commented Dec 3, 2016

Need More Information

Sorry, you did not follow the ISSUE Template, and there's not enough information about your problem.

In order to help us to find the problem out, you should provide the steps to reproduce the problem.

I'll close this issue. Please re-submit a new issue to provide the information that needed.

@lijiarui
Copy link
Member Author

lijiarui commented Dec 3, 2016

I'm sorry for not providing the standart issue...

code as follows:

import {
  Wechaty
  , log
  , Room
} from 'wechaty'

const bot = Wechaty.instance({ profile: 'juzimi11' })
const AutoReply_1 = "hi,我是专门管理微信群的机器人,你要加入的群是 【切尔西】还是【曼城】?"
const AutoReply_2 = "回复我加群暗号,我会将你拉入指定的微信群"
let logMsg = ''
bot
.on('scan', (url, code) => {
  if (!/201|200/.test(String(code))){
    let loginUrl = url.replace(/\/qrcode\//, '/l/')
    require('qrcode-terminal').generate(loginUrl)
  }
  console.log(`${url}\n[${code}] Scan QR Code in above url to login: `)
})

.on('friend', async function(contact, request){
    try {
      if (request) {
        let name = contact.name()
        let friendlog = "addfriend("+name+")"
        addTaskFunc(async _ => {
          await request.accept()
          contact.say(AutoReply_1)
          contact.say(AutoReply_2)
        },friendlog)
      } else {
        contact.say(AutoReply_1)
        contact.say(AutoReply_2)
        logMsg = 'friend ship confirmed with ' + contact.name()
      }
  } catch (e) {
    logMsg = e.message
  }
})

.init()

const taskFuncList: Function[] = []
let taskSerialNumber = 0

function addTaskFunc(taskFunc: Function, taskName='unnamed') {
  taskSerialNumber++
  taskFunc['taskName'] =  '#' + taskSerialNumber + ' ' + taskName
  taskFuncList.push(taskFunc)
}

function processTaskList() {
  if (taskFuncList.length > 0) {
    const taskFunc = taskFuncList.shift()
    if (taskFunc) {
      console.log('processTaskList: ' + taskFunc['taskName'])
      taskFunc()
    } else {
      console.error('processTaskList: pop task empty?')
    }
  }

  console.log('setTimeout processTaskList 5 seconds')
  setTimeout(processTaskList, 5 * 1000)
}

processTaskList()

Silly log as follows:

processTaskList: #2 addfriend(Lu宪哲)
VERB FriendRequest accept() Lu宪哲
VERB PuppetWebBridge verifyUserOk(@a9d77b27e717b3c6819baa525f07641d7cb42b8267674e8d24a18729d69b6887, v2_6157e9d802e38197862327cf7f9fc7329816acc56c1582fba8bc9d7e1a512e8d7743d3520fc219a32f7bf5d22f9a964a4c131636ac464cd81b35c83ec411c6a9@stranger)
VERB PuppetWebBridge proxyWechaty(verifyUserOk, @a9d77b27e717b3c6819baa525f07641d7cb42b8267674e8d24a18729d69b6887, v2_6157e9d802e38197862327cf7f9fc7329816acc56c1582fba8bc9d7e1a512e8d7743d3520fc219a32f7bf5d22f9a964a4c131636ac464cd81b35c83ec411c6a9@stranger)
SILL PuppetWebBridge execute()
SILL PuppetWebBrowser Browser.execute("return typeof WechatyBro === "undefined"")
SILL StateMonitor Browser:target() open
SILL StateMonitor Browser:current() open
setTimeout processTaskList 5 seconds
SILL PuppetWebBridge execute()
SILL PuppetWebBrowser Browser.execute(" const callback = arguments[arguments.length - 1] const isAsync = (typeof  ... ")
SILL StateMonitor Browser:target() open
SILL StateMonitor Browser:current() open
SILL PuppetWebFriendRequest accept() retryPromise() attempt 1 with timeout 60000
SILL Contact ready()
VERB PuppetWebFriendRequest accept() with contact Lu宪哲 ready()
VERB Contact say(hi,我是专门管理微信群的机器人,你要加入的群是 【切尔西】还是【曼城】?)
SILL Message constructor() SN:12
SILL Contact say() from: 邀群助手 to: Lu宪哲 content: hi,我是专门管理微信群的机器人,你要加入的群是 【切尔西】还是【曼城】?
SILL PuppetWeb send() destination: @a9d77b27e717b3c6819baa525f07641d7cb42b8267674e8d24a18729d69b6887, content: hi,我是专门管理微信群的机器人,你要加入的群是 【切尔西】还是【曼城】?)
VERB PuppetWebBridge proxyWechaty(send, @a9d77b27e717b3c6819baa525f07641d7cb42b8267674e8d24a18729d69b6887, hi,我是专门管理微信群的机器人,你要加入的群是 【切尔西】还是【曼城】?)
SILL PuppetWebBridge execute()
SILL PuppetWebBrowser Browser.execute("return typeof WechatyBro === "undefined"")
SILL StateMonitor Browser:target() open
SILL StateMonitor Browser:current() open
VERB Contact say(回复我加群暗号,我会将你拉入指定的微信群)
SILL Message constructor() SN:13
SILL Contact say() from: 邀群助手 to: Lu宪哲 content: 回复我加群暗号,我会将你拉入指定的微信群
SILL PuppetWeb send() destination: @a9d77b27e717b3c6819baa525f07641d7cb42b8267674e8d24a18729d69b6887, content: 回复我加群暗号,我会将你拉入指定的微信群)
VERB PuppetWebBridge proxyWechaty(send, @a9d77b27e717b3c6819baa525f07641d7cb42b8267674e8d24a18729d69b6887, 回复我加群暗号,我会将你拉入指定的微信群)
SILL PuppetWebBridge execute()
SILL PuppetWebBrowser Browser.execute("return typeof WechatyBro === "undefined"")
SILL StateMonitor Browser:target() open
SILL StateMonitor Browser:current() open
SILL PuppetWebBridge execute()
SILL PuppetWebBrowser Browser.execute(" const callback = arguments[arguments.length - 1] const isAsync = (typeof  ... ")
SILL StateMonitor Browser:target() open
SILL StateMonitor Browser:current() open
SILL PuppetWebBridge execute()
SILL PuppetWebBrowser Browser.execute(" const callback = arguments[arguments.length - 1] const isAsync = (typeof  ... ")
SILL StateMonitor Browser:target() open
SILL StateMonitor Browser:current() open
SILL Message constructor() SN:14
SILL Message ready()
SILL Contact ready()
SILL Contact ready()
SILL Message ready()
SILL Contact ready()
SILL Contact ready()
SILL Message ready()
SILL Contact ready()
SILL Contact ready()
SILL PuppetWebBrowser execute() script:  const callback = arguments[arguments.length - 1]
      const isAsync = (typeof callback === 'function')
      return WechatyBro
              .send
              .apply(undefined
                      , isAsync
                        ? JSON.parse(decodeURIComponent(window.atob('JTVCJTIyJTQwYTlkNzdiMjdlNzE3YjNjNjgxOWJhYTUyNWYwNzY0MWQ3Y2I0MmI4MjY3Njc0ZThkMjRhMTg3MjlkNjliNjg4NyUyMiUyQyUyMmhpJUVGJUJDJThDJUU2JTg4JTkxJUU2JTk4JUFGJUU0JUI4JTkzJUU5JTk3JUE4JUU3JUFFJUExJUU3JTkwJTg2JUU1JUJFJUFFJUU0JUJGJUExJUU3JUJFJUE0JUU3JTlBJTg0JUU2JTlDJUJBJUU1JTk5JUE4JUU0JUJBJUJBJUVGJUJDJThDJUU0JUJEJUEwJUU4JUE2JTgxJUU1JThBJUEwJUU1JTg1JUE1JUU3JTlBJTg0JUU3JUJFJUE0JUU2JTk4JUFGJTIwJUUzJTgwJTkwJUU1JTg4JTg3JUU1JUIwJTk0JUU4JUE1JUJGJUUzJTgwJTkxJUU4JUJGJTk4JUU2JTk4JUFGJUUzJTgwJTkwJUU2JTlCJUJDJUU1JTlGJThFJUUzJTgwJTkxJUVGJUJDJTlGJTIyJTVE'))).concat(callback)
                        : JSON.parse(decodeURIComponent(window.atob('JTVCJTIyJTQwYTlkNzdiMjdlNzE3YjNjNjgxOWJhYTUyNWYwNzY0MWQ3Y2I0MmI4MjY3Njc0ZThkMjRhMTg3MjlkNjliNjg4NyUyMiUyQyUyMmhpJUVGJUJDJThDJUU2JTg4JTkxJUU2JTk4JUFGJUU0JUI4JTkzJUU5JTk3JUE4JUU3JUFFJUExJUU3JTkwJTg2JUU1JUJFJUFFJUU0JUJGJUExJUU3JUJFJUE0JUU3JTlBJTg0JUU2JTlDJUJBJUU1JTk5JUE4JUU0JUJBJUJBJUVGJUJDJThDJUU0JUJEJUEwJUU4JUE2JTgxJUU1JThBJUEwJUU1JTg1JUE1JUU3JTlBJTg0JUU3JUJFJUE0JUU2JTk4JUFGJTIwJUUzJTgwJTkwJUU1JTg4JTg3JUU1JUIwJTk0JUU4JUE1JUJGJUUzJTgwJTkxJUU4JUJGJTk4JUU2JTk4JUFGJUUzJTgwJTkwJUU2JTlCJUJDJUU1JTlGJThFJUUzJTgwJTkxJUVGJUJDJTlGJTIyJTVE')))
                    )

WARN PuppetWebBrowser execute() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver i, WebDriverError: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver info: chromedriver=2.22 (5e2d5494d735a71aa5c2e7ef9bf5ce96945e92e9),platform=Linux 3.16.0-4-amd64 x86_64)
    at Object.checkLegacyResponse (/wechaty/node_modules/selenium-webdriver/lib/error.js:505:15)
    at parseHttpResponse (/wechaty/node_modules/selenium-webdriver/lib/http.js:509:13)
    at doSend.then.response (/wechaty/node_modules/selenium-webdriver/lib/http.js:440:13)
    at process._tickDomainCallback (internal/process/next_tick.js:129:7)
WARN PuppetWebBridge execute() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver info: chromedriver=2.22 (5e2d5494d735a71aa5c2e7ef9bf5ce96945e92e9),platform=Linux 3.16.0-4-amd64 x86_64)
VERB PuppetWebBridge proxyWechaty(send, @a9d77b27e717b3c6819baa525f07641d7cb42b8267674e8d24a18729d69b6887, hi,我是专门管理微信群的机器人,你要加入的群是 【切尔西】还是【曼城】?)
WARN PuppetWebBridge proxyWechaty() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver info: chromedriver=2.22 (5e2d5494d735a71aa5c2e7ef9bf5ce96945e92e9),platform=Linux 3.16.0-4-amd64 x86_64)
ERR PuppetWebBridge send() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver info: chromedriver=2.22 (5e2d5494d735a71aa5c2e7ef9bf5ce96945e92e9),platform=Linux 3.16.0-4-amd64 x86_64)
ERR PuppetWeb send() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver info: chromedriver=2.22 (5e2d5494d735a71aa5c2e7ef9bf5ce96945e92e9),platform=Linux 3.16.0-4-amd64 x86_64)
ERR Wechaty send() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver info: chromedriver=2.22 (5e2d5494d735a71aa5c2e7ef9bf5ce96945e92e9),platform=Linux 3.16.0-4-amd64 x86_64)
(node:24) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): WebDriverError: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver info: chromedriver=2.22 (5e2d5494d735a71aa5c2e7ef9bf5ce96945e92e9),platform=Linux 3.16.0-4-amd64 x86_64)
SILL Message constructor() SN:15
SILL Message ready()
SILL Contact ready()
SILL Contact ready()
SILL Message ready()
SILL Contact ready()
SILL Contact ready()
SILL Message ready()
SILL Contact ready()
SILL Contact ready()
VERB PuppetWebEvent onServerLog(friendVerify(@a9d77b27e717b3c6819baa525f07641d7cb42b8267674e8d24a18729d69b6887, v2_6157e9d802e38197862327cf7f9fc7329816acc56c1582fba8bc9d7e1a512e8d7743d3520fc219a32f7bf5d22f9a964a4c131636ac464cd81b35c83ec411c6a9@stranger) fail)
SILL PuppetWebBrowser execute() script:  const callback = arguments[arguments.length - 1]
      const isAsync = (typeof callback === 'function')
      return WechatyBro
              .send
              .apply(undefined
                      , isAsync
                        ? JSON.parse(decodeURIComponent(window.atob('JTVCJTIyJTQwYTlkNzdiMjdlNzE3YjNjNjgxOWJhYTUyNWYwNzY0MWQ3Y2I0MmI4MjY3Njc0ZThkMjRhMTg3MjlkNjliNjg4NyUyMiUyQyUyMiVFNSU5QiU5RSVFNSVBNCU4RCVFNiU4OCU5MSVFNSU4QSVBMCVFNyVCRSVBNCVFNiU5QSU5NyVFNSU4RiVCNyVFRiVCQyU4QyVFNiU4OCU5MSVFNCVCQyU5QSVFNSVCMCU4NiVFNCVCRCVBMCVFNiU4QiU4OSVFNSU4NSVBNSVFNiU4QyU4NyVFNSVBRSU5QSVFNyU5QSU4NCVFNSVCRSVBRSVFNCVCRiVBMSVFNyVCRSVBNCUyMiU1RA=='))).concat(callback)
                        : JSON.parse(decodeURIComponent(window.atob('JTVCJTIyJTQwYTlkNzdiMjdlNzE3YjNjNjgxOWJhYTUyNWYwNzY0MWQ3Y2I0MmI4MjY3Njc0ZThkMjRhMTg3MjlkNjliNjg4NyUyMiUyQyUyMiVFNSU5QiU5RSVFNSVBNCU4RCVFNiU4OCU5MSVFNSU4QSVBMCVFNyVCRSVBNCVFNiU5QSU5NyVFNSU4RiVCNyVFRiVCQyU4QyVFNiU4OCU5MSVFNCVCQyU5QSVFNSVCMCU4NiVFNCVCRCVBMCVFNiU4QiU4OSVFNSU4NSVBNSVFNiU4QyU4NyVFNSVBRSU5QSVFNyU5QSU4NCVFNSVCRSVBRSVFNCVCRiVBMSVFNyVCRSVBNCUyMiU1RA==')))
                    )

WARN PuppetWebBrowser execute() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver i, WebDriverError: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver info: chromedriver=2.22 (5e2d5494d735a71aa5c2e7ef9bf5ce96945e92e9),platform=Linux 3.16.0-4-amd64 x86_64)
    at Object.checkLegacyResponse (/wechaty/node_modules/selenium-webdriver/lib/error.js:505:15)
    at parseHttpResponse (/wechaty/node_modules/selenium-webdriver/lib/http.js:509:13)
    at doSend.then.response (/wechaty/node_modules/selenium-webdriver/lib/http.js:440:13)
    at process._tickDomainCallback (internal/process/next_tick.js:129:7)
WARN PuppetWebBridge execute() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver info: chromedriver=2.22 (5e2d5494d735a71aa5c2e7ef9bf5ce96945e92e9),platform=Linux 3.16.0-4-amd64 x86_64)
VERB PuppetWebBridge proxyWechaty(send, @a9d77b27e717b3c6819baa525f07641d7cb42b8267674e8d24a18729d69b6887, 回复我加群暗号,我会将你拉入指定的微信群)
WARN PuppetWebBridge proxyWechaty() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver info: chromedriver=2.22 (5e2d5494d735a71aa5c2e7ef9bf5ce96945e92e9),platform=Linux 3.16.0-4-amd64 x86_64)
ERR PuppetWebBridge send() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver info: chromedriver=2.22 (5e2d5494d735a71aa5c2e7ef9bf5ce96945e92e9),platform=Linux 3.16.0-4-amd64 x86_64)
ERR PuppetWeb send() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver info: chromedriver=2.22 (5e2d5494d735a71aa5c2e7ef9bf5ce96945e92e9),platform=Linux 3.16.0-4-amd64 x86_64)
ERR Wechaty send() exception: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver info: chromedriver=2.22 (5e2d5494d735a71aa5c2e7ef9bf5ce96945e92e9),platform=Linux 3.16.0-4-amd64 x86_64)
(node:24) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): WebDriverError: unknown error: r.isBrandContact is not a function
  (Session info: chrome=53.0.2785.92)
  (Driver info: chromedriver=2.22 (5e2d5494d735a71aa5c2e7ef9bf5ce96945e92e9),platform=Linux 3.16.0-4-amd64 x86_64)

@lijiarui
Copy link
Member Author

lijiarui commented Dec 3, 2016

I found you did tell me it failed in function onServerLog() , is it right?

processTaskList: #19 addfriend(Aban)
VERB FriendRequest accept() Aban
VERB PuppetWebBridge verifyUserOk(@06d89ca92f2af308960f7f082e8f3c9265b82a07d9237cf7d8e29ac564a80921, v2_95f3b190d312e2648d35ee117e9f95bae437290ab64ac74d97566dad324c7d2e5cf62737332a552606b8fa787887b57a01d1a614c9a6a4e4687c79a757fc72d7@stranger)
VERB PuppetWebBridge proxyWechaty(verifyUserOk, @06d89ca92f2af308960f7f082e8f3c9265b82a07d9237cf7d8e29ac564a80921, v2_95f3b190d312e2648d35ee117e9f95bae437290ab64ac74d97566dad324c7d2e5cf62737332a552606b8fa787887b57a01d1a614c9a6a4e4687c79a757fc72d7@stranger)
setTimeout processTaskList 5 seconds
VERB PuppetWebFriendRequest accept() with contact Aban ready()
VERB PuppetWebEvent onServerLog(friendVerify(@06d89ca92f2af308960f7f082e8f3c9265b82a07d9237cf7d8e29ac564a80921, v2_95f3b190d312e2648d35ee117e9f95bae437290ab64ac74d97566dad324c7d2e5cf62737332a552606b8fa787887b57a01d1a614c9a6a4e4687c79a757fc72d7@stranger) fail)

@huan
Copy link
Member

huan commented Dec 3, 2016

Yes, if accept() fails, onServerLog() will show an error message.

You can use the return value of request.accept() to know whether its success or failure.

The following code shows you how to do that:

on('friend', async (contact, request) => {
  if (request) {
      result = await request.accept()
      if (result) {
        console.log('succeed')
      } else {
        console.error('failed')
      }
  }
}

Notice that in order to do that, you need to use the latest master branch code, or version above 0.6.41

@lijiarui
Copy link
Member Author

lijiarui commented Dec 3, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants