Removed unnecessary logs, added alternative URL for screenshot

This commit is contained in:
TheEssem 2020-02-26 14:58:38 -06:00
parent b7aeacdf66
commit a839b3b9c8
3 changed files with 2 additions and 5 deletions

View file

@ -5,7 +5,7 @@ const fetch = require("node-fetch");
exports.run = async (message, args) => {
message.channel.sendTyping();
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 url = urlRegex.test(args[0]) ? args[0] : `http://${args[0]}`;
const browser = await puppeteer.connect({

View file

@ -50,18 +50,15 @@ module.exports = async () => {
gm.prototype.bufferPromise = function(format, type) {
return new Promise((resolve, reject) => {
if (format) {
console.log(format);
this.out(type !== "sonic" ? "-layers" : "", type !== "sonic" ? "optimize" : "").stream(format, (err, stdout, stderr) => {
if (err) return reject(err);
const chunks = [];
stdout.on("data", (chunk) => {
console.log(chunk);
chunks.push(chunk);
});
// 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
stdout.once("end", () => {
console.log(Buffer.concat(chunks));
resolve(Buffer.concat(chunks));
});
stderr.once("data", (data) => {

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "esmbot",
"version": "1.1.7",
"version": "1.2.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {