mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-19 21:40:51 +02:00
Fix
This commit is contained in:
@@ -24,8 +24,9 @@ module.exports = class ReadQRCodeCommand extends Command {
|
|||||||
async run(msg, { image }) {
|
async run(msg, { image }) {
|
||||||
const { body } = await request.get(image);
|
const { body } = await request.get(image);
|
||||||
const img = await loadImage(body);
|
const img = await loadImage(body);
|
||||||
const canvas = createCanvas(img);
|
const canvas = createCanvas(img.height, img.width);
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
|
ctx.drawImage(img, 0, 0);
|
||||||
const imgData = ctx.getImageData(0, 0, img.width, img.height);
|
const imgData = ctx.getImageData(0, 0, img.width, img.height);
|
||||||
try {
|
try {
|
||||||
const result = await this.readQrCode(imgData);
|
const result = await this.readQrCode(imgData);
|
||||||
|
|||||||
Reference in New Issue
Block a user