fix for tls

pull/29/head
Matthew 2020-12-25 21:54:35 -05:00
parent 87746008b4
commit e0d7feb183
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 4 additions and 0 deletions

View File

@ -1,5 +1,6 @@
/* eslint-disable no-plusplus */ /* eslint-disable no-plusplus */
import cheerio from 'cheerio'; import cheerio from 'cheerio';
import https from 'https';
import axios, { AxiosError, AxiosResponse } from 'axios'; import axios, { AxiosError, AxiosResponse } from 'axios';
import { Message } from 'eris'; import { Message } from 'eris';
import { Client, Command, RichEmbed } from '../class'; import { Client, Command, RichEmbed } from '../class';
@ -62,6 +63,7 @@ export default class TLS extends Command {
public async run(message: Message, args: string[]) { public async run(message: Message, args: string[]) {
try { try {
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]); if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
https.globalAgent.options.rejectUnauthorized = false;
let r: AxiosResponse; let r: AxiosResponse;
let s: AxiosResponse; let s: AxiosResponse;
@ -159,8 +161,10 @@ export default class TLS extends Command {
embed.setFooter(this.client.user.username, this.client.user.avatarURL); embed.setFooter(this.client.user.username, this.client.user.avatarURL);
embed.setTimestamp(); embed.setTimestamp();
https.globalAgent.options.rejectUnauthorized = true;
return message.channel.createMessage({ embed }); return message.channel.createMessage({ embed });
} catch (err) { } catch (err) {
https.globalAgent.options.rejectUnauthorized = true;
return this.client.util.handleError(err, message, this, false); return this.client.util.handleError(err, message, this, false);
} }
} }