fixes for site cmd
parent
97859b4044
commit
18c7f1d071
|
@ -145,11 +145,21 @@ export default class SiteInfo extends Command {
|
|||
loading.delete().catch(() => {});
|
||||
return this.error(message.channel, 'Unable to receive information.');
|
||||
}
|
||||
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
await page.goto(`https://${args[0]}`);
|
||||
const screenshotData = await page.screenshot();
|
||||
let screenshotData: string;
|
||||
try {
|
||||
const browser = await puppeteer.launch({
|
||||
ignoreHTTPSErrors: true,
|
||||
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) => {
|
||||
embed.setAuthor(author.name, author.icon, author.url);
|
||||
embed.setColor('#4870fe');
|
||||
|
@ -157,8 +167,11 @@ export default class SiteInfo extends Command {
|
|||
embed.setTimestamp();
|
||||
});
|
||||
|
||||
if (embeds.length === 1) return message.channel.createMessage({ embed: embeds[0] }, { name: 'img.png', file: screenshotData });
|
||||
await message.channel.createMessage('', { name: 'img.png', file: screenshotData });
|
||||
if (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(() => {});
|
||||
return await createPaginationEmbed(message, embeds, {
|
||||
cycling: true,
|
||||
|
|
Loading…
Reference in New Issue