Commit 94fff387 authored by nanahira's avatar nanahira

update qrcode display

parent e62ddd43
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"file-type": "16.5.3", "file-type": "16.5.3",
"koishi-thirdeye": "^11.1.21", "koishi-thirdeye": "^11.1.21",
"mime2ext": "^1.0.1", "mime2ext": "^1.0.1",
"qrcode-terminal": "^0.12.0",
"wechaty": "^1.20.2", "wechaty": "^1.20.2",
"wechaty-puppet-wechat": "^1.18.4" "wechaty-puppet-wechat": "^1.18.4"
}, },
...@@ -19,6 +20,7 @@ ...@@ -19,6 +20,7 @@
"@koishijs/plugin-help": "^2.0.2", "@koishijs/plugin-help": "^2.0.2",
"@types/jest": "^29.2.4", "@types/jest": "^29.2.4",
"@types/node": "^18.11.17", "@types/node": "^18.11.17",
"@types/qrcode-terminal": "^0.12.0",
"@types/raven": "^2.5.4", "@types/raven": "^2.5.4",
"@typescript-eslint/eslint-plugin": "^5.46.1", "@typescript-eslint/eslint-plugin": "^5.46.1",
"@typescript-eslint/parser": "^5.46.1", "@typescript-eslint/parser": "^5.46.1",
...@@ -2268,6 +2270,12 @@ ...@@ -2268,6 +2270,12 @@
"integrity": "sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==", "integrity": "sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==",
"dev": true "dev": true
}, },
"node_modules/@types/qrcode-terminal": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/@types/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz",
"integrity": "sha512-g0fQKl3IVnUePV8tLkiBTduxAVSZsXts444T2aMfjOEGxd7XoeSIs16/AmRe2NlcJLqbvsOBSXov7dKSo4wigA==",
"dev": true
},
"node_modules/@types/qs": { "node_modules/@types/qs": {
"version": "6.9.7", "version": "6.9.7",
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",
...@@ -8022,6 +8030,14 @@ ...@@ -8022,6 +8030,14 @@
"node": ">=10.13.0" "node": ">=10.13.0"
} }
}, },
"node_modules/qrcode-terminal": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz",
"integrity": "sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ==",
"bin": {
"qrcode-terminal": "bin/qrcode-terminal.js"
}
},
"node_modules/qrcode/node_modules/cliui": { "node_modules/qrcode/node_modules/cliui": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
...@@ -12212,6 +12228,12 @@ ...@@ -12212,6 +12228,12 @@
"integrity": "sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==", "integrity": "sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==",
"dev": true "dev": true
}, },
"@types/qrcode-terminal": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/@types/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz",
"integrity": "sha512-g0fQKl3IVnUePV8tLkiBTduxAVSZsXts444T2aMfjOEGxd7XoeSIs16/AmRe2NlcJLqbvsOBSXov7dKSo4wigA==",
"dev": true
},
"@types/qs": { "@types/qs": {
"version": "6.9.7", "version": "6.9.7",
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",
...@@ -16590,6 +16612,11 @@ ...@@ -16590,6 +16612,11 @@
} }
} }
}, },
"qrcode-terminal": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz",
"integrity": "sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ=="
},
"qs": { "qs": {
"version": "6.11.0", "version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
......
...@@ -14,6 +14,7 @@ import { WechatyEvents, WechatyInstance } from './def'; ...@@ -14,6 +14,7 @@ import { WechatyEvents, WechatyInstance } from './def';
import { WechatyAdapter } from './adapter'; import { WechatyAdapter } from './adapter';
import { adaptContact, adaptMessage, adaptRoom, fileBoxToUrl } from './utils'; import { adaptContact, adaptMessage, adaptRoom, fileBoxToUrl } from './utils';
import { WechatyMessenger } from './message'; import { WechatyMessenger } from './message';
import qrcodeTerminal from 'qrcode-terminal';
declare module 'koishi' { declare module 'koishi' {
// eslint-disable-next-line @typescript-eslint/no-empty-interface // eslint-disable-next-line @typescript-eslint/no-empty-interface
...@@ -75,11 +76,8 @@ export default class WechatyBot extends Bot< ...@@ -75,11 +76,8 @@ export default class WechatyBot extends Bot<
this.offline(error); this.offline(error);
}); });
this.internal.on('scan', (qrcode, status) => { this.internal.on('scan', (qrcode, status) => {
this.logger.info( this.logger.info(`Scan (${status}):`);
`Scan (${status}): https://wechaty.js.org/qrcode/${encodeURIComponent( qrcodeTerminal.generate(qrcode);
qrcode,
)}`,
);
}); });
await this.internal.start(); await this.internal.start();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment