mirror of
https://github.com/wechaty/getting-started.git
synced 2026-10-16 21:12:46 +08:00
clean
This commit is contained in:
@@ -27,10 +27,8 @@ const {
|
||||
log,
|
||||
} = require('wechaty')
|
||||
|
||||
const BOT_QR_CODE_IMAGE_FILE = path.resolve(
|
||||
__dirname,
|
||||
'../docs/images/bot-qr-code.png',
|
||||
)
|
||||
const BOT_QR_CODE_IMAGE_FILE_BOX = FileBox
|
||||
.fromUrl('https://wechaty.js.org/img/friday-qrcode.svg')
|
||||
|
||||
const bot = Wechaty.instance()
|
||||
|
||||
@@ -198,14 +196,13 @@ bot
|
||||
/**
|
||||
* 2. reply qrcode image
|
||||
*/
|
||||
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,
|
||||
// )
|
||||
|
||||
log.info('Bot', 'REPLY: %s', fileBox)
|
||||
await msg.say(fileBox)
|
||||
log.info('Bot', 'REPLY: %s', BOT_QR_CODE_IMAGE_FILE_BOX)
|
||||
await msg.say(BOT_QR_CODE_IMAGE_FILE_BOX)
|
||||
|
||||
/**
|
||||
* 3. reply 'scan now!'
|
||||
|
||||
@@ -30,8 +30,7 @@ const qrTerm = require('qrcode-terminal')
|
||||
*
|
||||
*/
|
||||
const bot = new Wechaty({
|
||||
profile : config.default.DEFAULT_PROFILE,
|
||||
name : 'myWechatyBot',
|
||||
name: 'myWechatyBot',
|
||||
})
|
||||
|
||||
/**
|
||||
@@ -132,7 +131,7 @@ async function onMessage (msg) {
|
||||
/**
|
||||
* 2. reply image(qrcode image)
|
||||
*/
|
||||
const fileBox = FileBox.fromUrl('https://wechaty.github.io/wechaty/images/bot-qr-code.png')
|
||||
const fileBox = FileBox.fromUrl('https://wechaty.js.org/img/friday-qrcode.svg')
|
||||
|
||||
await msg.say(fileBox)
|
||||
console.log('REPLY: %s', fileBox.toString())
|
||||
|
||||
Reference in New Issue
Block a user