Removed unnecessary logs, added alternative URL for screenshot
This commit is contained in:
		
							parent
							
								
									b7aeacdf66
								
							
						
					
					
						commit
						a839b3b9c8
					
				
					 3 changed files with 2 additions and 5 deletions
				
			
		| 
						 | 
					@ -5,7 +5,7 @@ const fetch = require("node-fetch");
 | 
				
			||||||
exports.run = async (message, args) => {
 | 
					exports.run = async (message, args) => {
 | 
				
			||||||
  message.channel.sendTyping();
 | 
					  message.channel.sendTyping();
 | 
				
			||||||
  if (args.length === 0) return `${message.author.mention}, you need to provide a URL to screenshot!`;
 | 
					  if (args.length === 0) return `${message.author.mention}, you need to provide a URL to screenshot!`;
 | 
				
			||||||
  const getEndpoint = await fetch("http://172.17.0.2:9222/json/version");
 | 
					  const getEndpoint = await fetch(`http://${process.env.NODE_ENV === "development" ? "192.168.99.100" : "172.17.0.2"}:9222/json/version`);
 | 
				
			||||||
  const endpoint = await getEndpoint.json();
 | 
					  const endpoint = await getEndpoint.json();
 | 
				
			||||||
  const url = urlRegex.test(args[0]) ? args[0] : `http://${args[0]}`;
 | 
					  const url = urlRegex.test(args[0]) ? args[0] : `http://${args[0]}`;
 | 
				
			||||||
  const browser = await puppeteer.connect({
 | 
					  const browser = await puppeteer.connect({
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,18 +50,15 @@ module.exports = async () => {
 | 
				
			||||||
  gm.prototype.bufferPromise = function(format, type) {
 | 
					  gm.prototype.bufferPromise = function(format, type) {
 | 
				
			||||||
    return new Promise((resolve, reject) => {
 | 
					    return new Promise((resolve, reject) => {
 | 
				
			||||||
      if (format) {
 | 
					      if (format) {
 | 
				
			||||||
        console.log(format);
 | 
					 | 
				
			||||||
        this.out(type !== "sonic" ? "-layers" : "", type !== "sonic" ? "optimize" : "").stream(format, (err, stdout, stderr) => {
 | 
					        this.out(type !== "sonic" ? "-layers" : "", type !== "sonic" ? "optimize" : "").stream(format, (err, stdout, stderr) => {
 | 
				
			||||||
          if (err) return reject(err);
 | 
					          if (err) return reject(err);
 | 
				
			||||||
          const chunks = [];
 | 
					          const chunks = [];
 | 
				
			||||||
          stdout.on("data", (chunk) => {
 | 
					          stdout.on("data", (chunk) => {
 | 
				
			||||||
            console.log(chunk);
 | 
					 | 
				
			||||||
            chunks.push(chunk);
 | 
					            chunks.push(chunk);
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
          // these are 'once' because they can and do fire multiple times for multiple errors,
 | 
					          // these are 'once' because they can and do fire multiple times for multiple errors,
 | 
				
			||||||
          // but this is a promise so you'll have to deal with them one at a time
 | 
					          // but this is a promise so you'll have to deal with them one at a time
 | 
				
			||||||
          stdout.once("end", () => {
 | 
					          stdout.once("end", () => {
 | 
				
			||||||
            console.log(Buffer.concat(chunks));
 | 
					 | 
				
			||||||
            resolve(Buffer.concat(chunks));
 | 
					            resolve(Buffer.concat(chunks));
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
          stderr.once("data", (data) => {
 | 
					          stderr.once("data", (data) => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  "name": "esmbot",
 | 
					  "name": "esmbot",
 | 
				
			||||||
  "version": "1.1.7",
 | 
					  "version": "1.2.1",
 | 
				
			||||||
  "lockfileVersion": 1,
 | 
					  "lockfileVersion": 1,
 | 
				
			||||||
  "requires": true,
 | 
					  "requires": true,
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue