fixes for site cmd

pull/29/head
Matthew 2020-12-29 19:21:43 -05:00
parent 97859b4044
commit 18c7f1d071
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 20 additions and 7 deletions

View File

@ -145,11 +145,21 @@ export default class SiteInfo extends Command {
loading.delete().catch(() => {}); loading.delete().catch(() => {});
return this.error(message.channel, 'Unable to receive information.'); return this.error(message.channel, 'Unable to receive information.');
} }
let screenshotData: string;
const browser = await puppeteer.launch(); try {
const page = await browser.newPage(); const browser = await puppeteer.launch({
await page.goto(`https://${args[0]}`); ignoreHTTPSErrors: true,
const screenshotData = await page.screenshot(); args: [
'--ignore-certificate-errors',
'--ignore-certificate-errors-spki-list',
],
});
const page = await browser.newPage();
await page.goto(`https://${args[0]}`);
screenshotData = await page.screenshot();
} catch (e) {
this.client.util.signale.error(e);
}
embeds.forEach((embed) => { embeds.forEach((embed) => {
embed.setAuthor(author.name, author.icon, author.url); embed.setAuthor(author.name, author.icon, author.url);
embed.setColor('#4870fe'); embed.setColor('#4870fe');
@ -157,8 +167,11 @@ export default class SiteInfo extends Command {
embed.setTimestamp(); embed.setTimestamp();
}); });
if (embeds.length === 1) return message.channel.createMessage({ embed: embeds[0] }, { name: 'img.png', file: screenshotData }); if (screenshotData) {
await message.channel.createMessage('', { name: 'img.png', file: screenshotData }); if (embeds.length === 1) return message.channel.createMessage({ embed: embeds[0] }, { name: 'img.png', file: screenshotData });
} else {
await message.channel.createMessage('', { name: 'img.png', file: screenshotData });
}
loading.delete().catch(() => {}); loading.delete().catch(() => {});
return await createPaginationEmbed(message, embeds, { return await createPaginationEmbed(message, embeds, {
cycling: true, cycling: true,