Fixed qrcreate, added help page URL to help command title
This commit is contained in:
parent
8abc023d67
commit
8d9859ea72
2 changed files with 21 additions and 13 deletions
|
@ -18,6 +18,7 @@ exports.run = async (message, args) => {
|
||||||
"icon_url": client.user.avatarURL
|
"icon_url": client.user.avatarURL
|
||||||
},
|
},
|
||||||
"title": `${guild.prefix}${aliases.has(args[0].toLowerCase()) ? collections.aliases.get(args[0].toLowerCase()) : args[0].toLowerCase()}`,
|
"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,
|
"description": info.description,
|
||||||
"color": 16711680,
|
"color": 16711680,
|
||||||
"fields": [{
|
"fields": [{
|
||||||
|
|
|
@ -6,21 +6,28 @@ exports.run = async (message, args, content) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const writable = new stream.PassThrough();
|
const writable = new stream.PassThrough();
|
||||||
qrcode.toFileStream(writable, content, { margin: 1 });
|
qrcode.toFileStream(writable, content, { margin: 1 });
|
||||||
const chunks = [];
|
const file = await streamToBuf(writable);
|
||||||
writable.on("data", (chunk) => {
|
return {
|
||||||
chunks.push(chunk);
|
file: file,
|
||||||
});
|
name: "qr.png"
|
||||||
writable.once("error", (error) => {
|
};
|
||||||
if (error) throw error;
|
|
||||||
});
|
|
||||||
writable.once("end", () => {
|
|
||||||
return {
|
|
||||||
file: Buffer.concat(chunks),
|
|
||||||
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.category = 1;
|
||||||
exports.help = "Generates a QR code";
|
exports.help = "Generates a QR code";
|
||||||
exports.params = "[text]";
|
exports.params = "[text]";
|
Loading…
Add table
Add a link
Reference in a new issue