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

code clean

上级 63486af0
...@@ -74,7 +74,7 @@ function onScan (qrcode: string, status: number) { ...@@ -74,7 +74,7 @@ function onScan (qrcode: string, status: number) {
const qrcodeImageUrl = [ const qrcodeImageUrl = [
'https://api.qrserver.com/v1/create-qr-code/?data=', 'https://api.qrserver.com/v1/create-qr-code/?data=',
encodeURIComponent(qrcode), encodeURIComponent(qrcode),
'&size=220x220&margin=0', '&size=220x220&margin=20',
].join('') ].join('')
console.log(`[${status}] ${qrcodeImageUrl}\nScan QR Code above to log in: `) console.log(`[${status}] ${qrcodeImageUrl}\nScan QR Code above to log in: `)
...@@ -116,13 +116,13 @@ async function onMessage (msg: Message) { ...@@ -116,13 +116,13 @@ async function onMessage (msg: Message) {
} }
/** /**
* 1. reply 'dong' * 2.1. reply 'dong'
*/ */
await msg.say('dong') await msg.say('dong')
console.log('REPLY: dong') console.log('REPLY: dong')
/** /**
* 2. reply image(qrcode image) * 2.2. reply image(qrcode image)
*/ */
const fileBox = FileBox.fromUrl('https://chatie.io/wechaty/images/bot-qr-code.png') const fileBox = FileBox.fromUrl('https://chatie.io/wechaty/images/bot-qr-code.png')
...@@ -130,7 +130,7 @@ async function onMessage (msg: Message) { ...@@ -130,7 +130,7 @@ async function onMessage (msg: Message) {
console.log('REPLY: %s', fileBox.toString()) console.log('REPLY: %s', fileBox.toString())
/** /**
* 3. reply 'scan now!' * 2.3. reply 'scan now!'
*/ */
await msg.say([ await msg.say([
'Join Wechaty Developers Community\n\n', 'Join Wechaty Developers Community\n\n',
......
...@@ -224,7 +224,7 @@ export function qrcodeValueToImageUrl(qrcodeValue: string): string { ...@@ -224,7 +224,7 @@ export function qrcodeValueToImageUrl(qrcodeValue: string): string {
return [ return [
'https://api.qrserver.com/v1/create-qr-code/?data=', 'https://api.qrserver.com/v1/create-qr-code/?data=',
encodeURIComponent(qrcodeValue), encodeURIComponent(qrcodeValue),
'&size=220x220&margin=0', '&size=220x220&margin=20',
].join('') ].join('')
} }
......
...@@ -539,7 +539,7 @@ export class Wechaty extends Accessory implements Sayable { ...@@ -539,7 +539,7 @@ export class Wechaty extends Accessory implements Sayable {
} else if (puppet instanceof Puppet) { } else if (puppet instanceof Puppet) {
return puppet return puppet
} else { } else {
throw new Error('unsupported options.puppet!') throw new Error('unsupported options.puppet: ' + puppet)
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册