From d4814cb6ea0d0978124099402c84d1bd6536ba76 Mon Sep 17 00:00:00 2001 From: Huan LI Date: Mon, 4 Jun 2018 12:18:53 +0800 Subject: [PATCH] follow FileBox breaking changes --- examples/self-testing-bot.ts | 2 +- package.json | 2 +- src/puppet-mock/puppet-mock.ts | 2 +- src/puppet-padchat/puppet-padchat.ts | 2 +- src/puppet-puppeteer/puppet-puppeteer.ts | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/self-testing-bot.ts b/examples/self-testing-bot.ts index a4d7ad5a..141961f2 100644 --- a/examples/self-testing-bot.ts +++ b/examples/self-testing-bot.ts @@ -215,7 +215,7 @@ bot /** * 2. reply qrcode image */ - const fileBox = FileBox.fromLocal(BOT_QR_CODE_IMAGE_FILE) + const fileBox = FileBox.fromFile(BOT_QR_CODE_IMAGE_FILE) // const fileBox = FileBox.packStream( // fs.createReadStream(BOT_QR_CODE_IMAGE_FILE), // BOT_QR_CODE_IMAGE_FILE, diff --git a/package.json b/package.json index 25244ed6..79b47c80 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "clone-class": "^0.6.11", "cuid": "^2.1.1", "express": "^4.16.3", - "file-box": "^0.8.14", + "file-box": "^0.8.19", "hot-import": "^0.2.1", "jimp": "^0.2.28", "jsqr": "^1.0.4", diff --git a/src/puppet-mock/puppet-mock.ts b/src/puppet-mock/puppet-mock.ts index 910a5b13..ec06984b 100644 --- a/src/puppet-mock/puppet-mock.ts +++ b/src/puppet-mock/puppet-mock.ts @@ -157,7 +157,7 @@ export class PuppetMock extends Puppet { log.verbose('PuppetMock', 'contactAvatar(%s)', contactId) const WECHATY_ICON_PNG = path.resolve('../../docs/images/wechaty-icon.png') - return FileBox.fromLocal(WECHATY_ICON_PNG) + return FileBox.fromFile(WECHATY_ICON_PNG) } public async contactRawPayload(id: string): Promise { diff --git a/src/puppet-padchat/puppet-padchat.ts b/src/puppet-padchat/puppet-padchat.ts index bbe140ae..92dd84a0 100644 --- a/src/puppet-padchat/puppet-padchat.ts +++ b/src/puppet-padchat/puppet-padchat.ts @@ -368,7 +368,7 @@ export class PuppetPadchat extends Puppet { throw new Error('no avatar') } - const file = FileBox.fromRemote(payload.avatar) + const file = FileBox.fromUrl(payload.avatar) return file } diff --git a/src/puppet-puppeteer/puppet-puppeteer.ts b/src/puppet-puppeteer/puppet-puppeteer.ts index 70974e1b..52642d94 100644 --- a/src/puppet-puppeteer/puppet-puppeteer.ts +++ b/src/puppet-puppeteer/puppet-puppeteer.ts @@ -465,7 +465,7 @@ export class PuppetPuppeteer extends Puppet { Cookie: cookies.map(c => `${c['name']}=${c['value']}`).join('; '), } - const fileBox = FileBox.fromRemote(url, filename, headers) + const fileBox = FileBox.fromUrl(url, filename, headers) return fileBox } @@ -753,7 +753,7 @@ export class PuppetPuppeteer extends Puppet { // await contact.ready() const fileName = (payload.name || 'unknown') + '-avatar.jpg' - return FileBox.fromRemote( + return FileBox.fromUrl( avatarUrl, fileName, headers, -- GitLab