diff --git a/commands/help.js b/commands/help.js index 661abd13..b3728ae2 100644 --- a/commands/help.js +++ b/commands/help.js @@ -18,6 +18,7 @@ exports.run = async (message, args) => { "icon_url": client.user.avatarURL }, "title": `${guild.prefix}${aliases.has(args[0].toLowerCase()) ? collections.aliases.get(args[0].toLowerCase()) : args[0].toLowerCase()}`, + "url": "https://projectlounge.pw/esmBot/help.html", "description": info.description, "color": 16711680, "fields": [{ diff --git a/commands/qrcreate.js b/commands/qrcreate.js index 2e326a7b..7759ccd2 100644 --- a/commands/qrcreate.js +++ b/commands/qrcreate.js @@ -6,21 +6,28 @@ exports.run = async (message, args, content) => { message.channel.sendTyping(); const writable = new stream.PassThrough(); qrcode.toFileStream(writable, content, { margin: 1 }); - const chunks = []; - writable.on("data", (chunk) => { - chunks.push(chunk); - }); - writable.once("error", (error) => { - if (error) throw error; - }); - writable.once("end", () => { - return { - file: Buffer.concat(chunks), - name: "qr.png" - }; - }); + const file = await streamToBuf(writable); + return { + file: file, + name: "qr.png" + }; }; +function streamToBuf(stream) { + return new Promise((resolve, reject) => { + const chunks = []; + stream.on("data", (chunk) => { + chunks.push(chunk); + }); + stream.once("error", (error) => { + reject(error); + }); + stream.once("end", () => { + resolve(Buffer.concat(chunks)); + }); + }); +} + exports.category = 1; exports.help = "Generates a QR code"; exports.params = "[text]"; \ No newline at end of file