提交 5ad688b7 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

switch to our wechaty QR Code online api service (https://github.com/wechaty/qrcode/issues/1)

上级 70edb1d6
......@@ -65,7 +65,7 @@ Wechaty already held lots of talk and got a lot of blogs in the past 4 years, he
const { Wechaty } = require('wechaty') // import { Wechaty } from 'wechaty'
Wechaty.instance() // Global Instance
.on('scan', (qrcode, status) => console.log(`Scan QR Code to login: ${status}\nhttps://api.qrserver.com/v1/create-qr-code/?data=${encodeURIComponent(qrcode)}`))
.on('scan', (qrcode, status) => console.log(`Scan QR Code to login: ${status}\nhttps://wechaty.github.io/qrcode/${encodeURIComponent(qrcode)}`))
.on('login', user => console.log(`User ${user} logined`))
.on('message', message => console.log(`Message: ${message}`))
.start()
......
......@@ -142,7 +142,7 @@ Creates an instance of Wechaty.
```js
const { Wechaty } = require('wechaty')
const bot = new Wechaty()
bot.on('scan', (qrcode, status) => console.log(['https://api.qrserver.com/v1/create-qr-code/?data=',encodeURIComponent(qrcode),'&size=220x220&margin=20',].join('')))
bot.on('scan', (qrcode, status) => console.log('https://wechaty.github.io/qrcode/' + encodeURIComponent(qrcode)))
bot.on('login', user => console.log(`User ${user} logined`))
bot.on('message', message => console.log(`Message: ${message}`))
bot.start()
......
......@@ -76,10 +76,8 @@ function onScan (qrcode: string, status: ScanStatus) {
if (status === ScanStatus.Waiting || status === ScanStatus.Timeout) {
generate(qrcode)
// Generate a QR Code online via
// http://goqr.me/api/doc/create-qr-code/
const qrcodeImageUrl = [
'https://api.qrserver.com/v1/create-qr-code/?data=',
'https://wechaty.github.io/qrcode/',
encodeURIComponent(qrcode),
].join('')
......
......@@ -163,9 +163,8 @@ export const AT_SEPARATOR_REGEX = /[\u2005\u0020]/
export function qrcodeValueToImageUrl (qrcodeValue: string): string {
return [
'https://api.qrserver.com/v1/create-qr-code/?data=',
'https://wechaty.github.io/qrcode/',
encodeURIComponent(qrcodeValue),
'&size=220x220&margin=20',
].join('')
}
......
......@@ -149,7 +149,7 @@ const PUPPET_MEMORY_NAME = 'puppet'
* @example <caption>The World's Shortest ChatBot Code: 6 lines of JavaScript</caption>
* const { Wechaty } = require('wechaty')
* const bot = new Wechaty()
* bot.on('scan', (qrCode, status) => console.log(['https://api.qrserver.com/v1/create-qr-code/?data=',encodeURIComponent(qrcode),'&size=220x220&margin=20',].join('')))
* bot.on('scan', (qrCode, status) => console.log('https://wechaty.github.io/qrcode/' + encodeURIComponent(qrcode)))
* bot.on('login', user => console.log(`User ${user} logged in`))
* bot.on('message', message => console.log(`Message: ${message}`))
* bot.start()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册