diff --git a/src/commands/cwg_create.ts b/src/commands/cwg_create.ts index bb1113f..39209b3 100644 --- a/src/commands/cwg_create.ts +++ b/src/commands/cwg_create.ts @@ -130,9 +130,9 @@ export default class CWG_Create extends Command { return Promise.all(completed); } catch (err) { + this.client.util.handleError(err, message, this); const tasks = [fs.unlink(`/etc/nginx/sites-enabled/${args[1]}`), fs.unlink(`/etc/nginx/sites-available/${args[1]}`), this.client.db.Domain.deleteMany({ domain: args[1] })]; - await Promise.allSettled(tasks); - return this.client.util.handleError(err, message, this); + return Promise.allSettled(tasks); } } @@ -172,15 +172,6 @@ export default class CWG_Create extends Command { x509, enabled: true, }); - if (domain.includes('cloud.libraryofcode.org')) { - const dmn = domain.split('.'); - await axios({ - method: 'post', - url: 'https://api.cloudflare.com/client/v4/zones/5e82fc3111ed4fbf9f58caa34f7553a7/dns_records', - headers: { Authorization: `Bearer ${this.client.config.cloudflare}`, 'Content-Type': 'application/json' }, - data: JSON.stringify({ type: 'CNAME', name: `${dmn[0]}.${dmn[1]}`, content: 'cloud.libraryofcode.org', proxied: false }), - }); - } return entry.save(); } catch (error) { const tasks = [fs.unlink(`/etc/nginx/sites-enabled/${domain}`), fs.unlink(`/etc/nginx/sites-available/${domain}`), this.client.db.Domain.deleteMany({ domain })];