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
 | 
			
		||||
        },
 | 
			
		||||
        "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": [{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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]";
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue