From 025c14139bf32c70d7cab2a03596cb23e88ffa67 Mon Sep 17 00:00:00 2001 From: Matthew Ray Date: Tue, 12 May 2020 10:44:16 -0400 Subject: [PATCH] typing fix --- src/commands/cwg_create.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/commands/cwg_create.ts b/src/commands/cwg_create.ts index d9554c7..0cb4f10 100644 --- a/src/commands/cwg_create.ts +++ b/src/commands/cwg_create.ts @@ -32,8 +32,6 @@ export default class CWG_Create extends Command { try { if (!args[2]) return this.client.commands.get('help').run(message, ['cwg', this.name]); - let certs: { cert: string, key: string }; - if (!this.urlRegex.test(args[1])) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid URL***`); if (Number(args[2]) <= 1024 || Number(args[2]) >= 65535) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Port must be greater than 1024 and less than 65535***`); if (!args[1].endsWith('.cloud.libraryofcode.org') && !args[4]) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Certificate Chain and Private Key are required for custom domains***`); @@ -59,6 +57,7 @@ export default class CWG_Create extends Command { const edit = await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Binding domain...***`); + let certs: { cert?: string, key?: string } = {}; if (!args[1].endsWith('.cloud.libraryofcode.org')) { const urls = args.slice(3, 5); if (urls.some((l) => !l.includes('snippets.cloud.libraryofcode.org/raw/'))) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid snippets URL***`); @@ -72,8 +71,6 @@ export default class CWG_Create extends Command { certs = { cert: certAndPrivateKey[0], key: certAndPrivateKey[1] }; } else { - // eslint-disable-next-line no-shadow - const certs: { cert?: string, key?: string } = {}; certs.cert = await fs.readFile('/etc/ssl/private/cloud-libraryofcode-org.chain.crt', { encoding: 'utf8' }); certs.key = await fs.readFile('/etc/ssl/private/cloud-libraryofcode-org.key', { encoding: 'utf8' }); }